[hibernate-commits] Hibernate SVN: r18610 - in jpamodelgen/trunk: src/main/java/org/hibernate/jpamodelgen and 1 other directories.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Fri Jan 22 15:18:31 EST 2010


Author: hardy.ferentschik
Date: 2010-01-22 15:18:31 -0500 (Fri, 22 Jan 2010)
New Revision: 18610

Added:
   jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/Version.java
Modified:
   jpamodelgen/trunk/pom.xml
   jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/Context.java
   jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/JPAMetaModelEntityProcessor.java
   jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/annotation/AnnotationMetaEntity.java
Log:
METAGEN-10
Switched to using Diagnostic.Kind.OTHER for debug messages. Only message in default mode is now "Hibernate JPA 2 Static-Metamodel Generator [version]"

Modified: jpamodelgen/trunk/pom.xml
===================================================================
--- jpamodelgen/trunk/pom.xml	2010-01-22 19:21:33 UTC (rev 18609)
+++ jpamodelgen/trunk/pom.xml	2010-01-22 20:18:31 UTC (rev 18610)
@@ -1,4 +1,6 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
     <modelVersion>4.0.0</modelVersion>
 
@@ -79,6 +81,32 @@
 
         <plugins>
             <plugin>
+                <groupId>org.jboss.maven.plugins</groupId>
+                <artifactId>maven-injection-plugin</artifactId>
+                <version>1.0.2</version>
+                <executions>
+                    <execution>
+                        <phase>compile</phase>
+                        <goals>
+                            <goal>bytecode</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <bytecodeInjections>
+                        <bytecodeInjection>
+                            <expression>${pom.version}</expression>
+                            <targetMembers>
+                                <methodBodyReturn>
+                                    <className>org.hibernate.jpamodelgen.Version</className>
+                                    <methodName>getVersionString</methodName>
+                                </methodBodyReturn>
+                            </targetMembers>
+                        </bytecodeInjection>
+                    </bytecodeInjections>
+                </configuration>
+            </plugin>
+            <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-compiler-plugin</artifactId>
                 <version>2.0.2</version>
@@ -109,6 +137,7 @@
                 <inherited>true</inherited>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-source-plugin</artifactId>
+                <version>2.0.4</version>
                 <executions>
                     <execution>
                         <id>attach-sources</id>
@@ -121,6 +150,7 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-surefire-plugin</artifactId>
+                <version>2.4.3</version>
                 <configuration>
                     <systemProperties>
                         <property>
@@ -140,6 +170,7 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-surefire-report-plugin</artifactId>
+                <version>2.5</version>
                 <executions>
                     <execution>
                         <id>generate-test-report</id>
@@ -172,7 +203,9 @@
                 </configuration>
             </plugin>
             <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-source-plugin</artifactId>
+                <version>2.0.4</version>
                 <executions>
                     <execution>
                         <id>attach-sources</id>
@@ -183,7 +216,9 @@
                 </executions>
             </plugin>
             <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-assembly-plugin</artifactId>
+                <version>2.2-beta-2</version>
                 <configuration>
                     <descriptors>
                         <descriptor>src/main/assembly/dist.xml</descriptor>

Modified: jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/Context.java
===================================================================
--- jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/Context.java	2010-01-22 19:21:33 UTC (rev 18609)
+++ jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/Context.java	2010-01-22 20:18:31 UTC (rev 18610)
@@ -106,7 +106,7 @@
 	//does not work for Entity (risk of circularity)
 	public void processElement(TypeElement element, AccessType defaultAccessTypeForHierarchy) {
 		if ( elementsAlreadyProcessed.contains( element.getQualifiedName().toString() ) ) {
-			logMessage( Diagnostic.Kind.WARNING, "Element already processed (ignoring): " + element );
+			logMessage( Diagnostic.Kind.OTHER, "Element already processed (ignoring): " + element );
 			return;
 		}
 		ClassWriter.writeFile( new AnnotationMetaEntity( element, this, defaultAccessTypeForHierarchy ), this );
@@ -115,7 +115,7 @@
 	}
 
 	public void logMessage(Diagnostic.Kind type, String message) {
-		if ( !logDebug && type.equals( Diagnostic.Kind.NOTE ) ) {
+		if ( !logDebug && type.equals( Diagnostic.Kind.OTHER ) ) {
 			return;
 		}
 		pe.getMessager().printMessage( type, message );

Modified: jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/JPAMetaModelEntityProcessor.java
===================================================================
--- jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/JPAMetaModelEntityProcessor.java	2010-01-22 19:21:33 UTC (rev 18609)
+++ jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/JPAMetaModelEntityProcessor.java	2010-01-22 20:18:31 UTC (rev 18610)
@@ -85,7 +85,7 @@
 	public void init(ProcessingEnvironment env) {
 		super.init( env );
 		context = new Context( env );
-		context.logMessage( Diagnostic.Kind.NOTE, "Init Processor " + this );
+		context.logMessage( Diagnostic.Kind.NOTE, "Hibernate JPA 2 Static-Metamodel Generator " + Version.getVersionString() );
 	}
 
 	@Override
@@ -93,9 +93,9 @@
 						   final RoundEnvironment roundEnvironment) {
 
 		if ( roundEnvironment.processingOver() ) {
-			context.logMessage( Diagnostic.Kind.NOTE, "Last processing round." );
+			context.logMessage( Diagnostic.Kind.OTHER, "Last processing round." );
 			createMetaModelClasses();
-			context.logMessage( Diagnostic.Kind.NOTE, "Finished processing" );
+			context.logMessage( Diagnostic.Kind.OTHER, "Finished processing" );
 			return ALLOW_OTHER_PROCESSORS_TO_CLAIM_ANNOTATIONS;
 		}
 
@@ -104,13 +104,13 @@
 		}
 
 		if ( !hostJPAAnnotations( annotations ) ) {
-			context.logMessage( Diagnostic.Kind.NOTE, "Current processing round does not contain entities" );
+			context.logMessage( Diagnostic.Kind.OTHER, "Current processing round does not contain entities" );
 			return ALLOW_OTHER_PROCESSORS_TO_CLAIM_ANNOTATIONS;
 		}
 
 		Set<? extends Element> elements = roundEnvironment.getRootElements();
 		for ( Element element : elements ) {
-			context.logMessage( Diagnostic.Kind.NOTE, "Processing " + element.toString() );
+			context.logMessage( Diagnostic.Kind.OTHER, "Processing " + element.toString() );
 			handleRootElementAnnotationMirrors( element );
 		}
 
@@ -119,7 +119,7 @@
 
 	private void createMetaModelClasses() {
 		for ( MetaEntity entity : context.getMetaEntitiesToProcess().values() ) {
-			context.logMessage( Diagnostic.Kind.NOTE, "Writing meta model for " + entity );
+			context.logMessage( Diagnostic.Kind.OTHER, "Writing meta model for " + entity );
 			ClassWriter.writeFile( entity, context );
 		}
 
@@ -129,7 +129,7 @@
 		}
 
 		for ( MetaEntity entity : context.getMetaSuperclassAndEmbeddableToProcess().values() ) {
-			context.logMessage( Diagnostic.Kind.NOTE, "Writing meta model for " + entity );
+			context.logMessage( Diagnostic.Kind.OTHER, "Writing meta model for " + entity );
 			ClassWriter.writeFile( entity, context );
 		}
 	}
@@ -336,7 +336,7 @@
 	private InputStream getInputStreamForResource(String resource) {
 		String pkg = getPackage( resource );
 		String name = getRelativeName( resource );
-		context.logMessage( Diagnostic.Kind.NOTE, "Reading resource " + resource );
+		context.logMessage( Diagnostic.Kind.OTHER, "Reading resource " + resource );
 		InputStream ormStream;
 		try {
 			FileObject fileObject = processingEnv.getFiler().getResource( StandardLocation.CLASS_OUTPUT, pkg, name );
@@ -373,7 +373,7 @@
 		InputStream stream = getInputStreamForResource( resource );
 
 		if ( stream == null ) {
-			context.logMessage( Diagnostic.Kind.NOTE, resource + " not found." );
+			context.logMessage( Diagnostic.Kind.OTHER, resource + " not found." );
 			return null;
 		}
 		try {

Added: jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/Version.java
===================================================================
--- jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/Version.java	                        (rev 0)
+++ jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/Version.java	2010-01-22 20:18:31 UTC (rev 18610)
@@ -0,0 +1,31 @@
+// $Id:$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+* http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.hibernate.jpamodelgen;
+
+/**
+ * Information about the Meta Model Generator version.
+ *
+ * @author Hardy Ferentschik
+ */
+public class Version {
+	public static String getVersionString() {
+		return "[WORKING]";
+	}
+}
+
+

Modified: jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/annotation/AnnotationMetaEntity.java
===================================================================
--- jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/annotation/AnnotationMetaEntity.java	2010-01-22 19:21:33 UTC (rev 18609)
+++ jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/annotation/AnnotationMetaEntity.java	2010-01-22 20:18:31 UTC (rev 18610)
@@ -206,14 +206,14 @@
 	}
 
 	private AccessType getAccessTypeForClass(TypeElement searchedElement) {
-		context.logMessage( Diagnostic.Kind.NOTE, "check class " + searchedElement );
+		context.logMessage( Diagnostic.Kind.OTHER, "check class " + searchedElement );
 		AccessType accessType = context.getAccessType( searchedElement );
 
 		if ( defaultAccessTypeForHierarchy == null ) {
 			this.defaultAccessTypeForHierarchy = context.getDefaultAccessTypeForHerarchy( searchedElement );
 		}
 		if ( accessType != null ) {
-			context.logMessage( Diagnostic.Kind.NOTE, "Found in cache" + searchedElement + ":" + accessType );
+			context.logMessage( Diagnostic.Kind.OTHER, "Found in cache" + searchedElement + ":" + accessType );
 			return accessType;
 		}
 
@@ -224,7 +224,7 @@
 		final Access accessAnn = searchedElement.getAnnotation( Access.class );
 		AccessType forcedAccessType = accessAnn != null ? accessAnn.value() : null;
 		if ( forcedAccessType != null ) {
-			context.logMessage( Diagnostic.Kind.NOTE, "access type " + searchedElement + ":" + forcedAccessType );
+			context.logMessage( Diagnostic.Kind.OTHER, "access type " + searchedElement + ":" + forcedAccessType );
 			context.addAccessType( searchedElement, forcedAccessType );
 		}
 
@@ -244,7 +244,7 @@
 					//FIXME consider XML
 					if ( annotationType.equals( Id.class.getName() )
 							|| annotationType.equals( EmbeddedId.class.getName() ) ) {
-						context.logMessage( Diagnostic.Kind.NOTE, "Found id on" + searchedElement );
+						context.logMessage( Diagnostic.Kind.OTHER, "Found id on" + searchedElement );
 						final ElementKind kind = subElement.getKind();
 						if ( kind == ElementKind.FIELD || kind == ElementKind.METHOD ) {
 							accessType = kind == ElementKind.FIELD ? AccessType.FIELD : AccessType.PROPERTY;
@@ -264,7 +264,7 @@
 							if ( forcedAccessType == null ) {
 								context.addAccessType( searchedElement, accessType );
 								context.logMessage(
-										Diagnostic.Kind.NOTE, "access type " + searchedElement + ":" + accessType
+										Diagnostic.Kind.OTHER, "access type " + searchedElement + ":" + accessType
 								);
 								return accessType;
 							}



More information about the hibernate-commits mailing list