[hibernate-commits] Hibernate SVN: r17072 - in jpamodelgen/trunk/generator: src/main/java/org/hibernate/jpa/metamodel/ap and 1 other directories.
hibernate-commits at lists.jboss.org
hibernate-commits at lists.jboss.org
Fri Jul 10 13:27:47 EDT 2009
Author: hardy.ferentschik
Date: 2009-07-10 13:27:47 -0400 (Fri, 10 Jul 2009)
New Revision: 17072
Added:
jpamodelgen/trunk/generator/src/test/resources/META-INF/orm.xml
Removed:
jpamodelgen/trunk/generator/src/test/resources/META-INF/order.xml
Modified:
jpamodelgen/trunk/generator/pom.xml
jpamodelgen/trunk/generator/src/main/java/org/hibernate/jpa/metamodel/ap/JPAMetaModelEntityProcessor.java
jpamodelgen/trunk/generator/src/test/resources/META-INF/persistence.xml
Log:
added parsing of implicit orm.xml; started to make module independed from parent
Modified: jpamodelgen/trunk/generator/pom.xml
===================================================================
--- jpamodelgen/trunk/generator/pom.xml 2009-07-10 16:25:46 UTC (rev 17071)
+++ jpamodelgen/trunk/generator/pom.xml 2009-07-10 17:27:47 UTC (rev 17072)
@@ -1,24 +1,34 @@
<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">
- <parent>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-jpamodel-generator-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
+ 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>
<groupId>org.hibernate</groupId>
- <artifactId>hibernate-jpamodel-generator</artifactId>
- <name>Hibernate JPA Model Generator</name>
+ <artifactId>jpamodelgen</artifactId>
+ <version>1.0.0-Alpha1</version>
+ <name>JPA Model Generator</name>
+
+ <description> Annotation Processor to cenerate metadata model for JPA2 typesafe queries </description>
+
+ <developers>
+ <developer>
+ <id>hardy.ferentschik</id>
+ <name>Hardy Ferentschik</name>
+ <email>hferents at redhat.com</email>
+ <organization>JBoss, a division of Red Hat</organization>
+ <url>http://in.relation.to/Bloggers/Hardy</url>
+ </developer>
+ </developers>
+
<dependencies>
<dependency>
<groupId>org.hibernate.java-persistence</groupId>
<artifactId>jpa-api</artifactId>
+ <version>2.0.Beta3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
+ <version>5.8</version>
<classifier>jdk15</classifier>
</dependency>
</dependencies>
@@ -54,7 +64,8 @@
<tasks>
<property name="target.dir" value="target/generated-query-classes"/>
<mkdir dir="${target.dir}"/>
- <javac srcdir="src/test/java" destdir="${target.dir}" failonerror="false" excludes="test/**">
+ <javac srcdir="src/test/java" destdir="${target.dir}"
+ failonerror="false" excludes="test/**">
<compilerarg value="-proc:only"/>
<classpath>
<path refid="maven.test.classpath"/>
@@ -150,6 +161,133 @@
<outputName>test-report</outputName>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Implementation-Title>${pom.artifactId}</Implementation-Title>
+ <Implementation-Version>${pom.version}</Implementation-Version>
+ <Implementation-Vendor>${pom.groupId}</Implementation-Vendor>
+ <Implementation-Vendor-Id>${pom.groupId}</Implementation-Vendor-Id>
+ <Implementation-URL>${pom.url}</Implementation-URL>
+ <Specification-Title>JPA2 Model Generator</Specification-Title>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-release-plugin</artifactId>
+ <version>2.0-beta-9</version>
+ <configuration>
+ <autoVersionSubmodules>true</autoVersionSubmodules>
+ <allowTimestampedSnapshots>true</allowTimestampedSnapshots>
+ <remoteTagging>true</remoteTagging>
+ <goals>package deploy</goals>
+ </configuration>
+ </plugin>
</plugins>
</build>
+
+ <inceptionYear>2009</inceptionYear>
+
+ <licenses>
+ <license>
+ <name>Apache License, Version 2.0</name>
+ <url>license.txt</url>
+ </license>
+ </licenses>
+
+ <scm>
+ <connection>scm:svn:https://svn.jboss.org/repos/hibernate/jpamodelgen/trunk</connection>
+ <url>http://fisheye.jboss.org/browse/Hibernate/jpamodelgen/trunk</url>
+ </scm>
+
+ <distributionManagement>
+ <repository>
+ <!-- Copy the dist to the local checkout of the JBoss maven2 repo ${maven.repository.root} -->
+ <!-- It is anticipated that ${maven.repository.root} be set in user's settings.xml -->
+ <!-- todo : replace this with direct svn access once the svnkit providers are available -->
+ <id>repository.jboss.org</id>
+ <url>file://${maven.repository.root}</url>
+ </repository>
+ <snapshotRepository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshot Repository</name>
+ <url>dav:https://snapshots.jboss.org/maven2</url>
+ </snapshotRepository>
+ </distributionManagement>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ <version>2.0.1</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <reportSets>
+ <reportSet>
+ <id>html</id>
+ <configuration>
+ <tags>
+ <tag>
+ <name>todo</name>
+ <placement>a</placement>
+ <head>ToDo:</head>
+ </tag>
+ </tags>
+ </configuration>
+ <reports>
+ <report>javadoc</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jxr-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-clover-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ <configuration>
+ <targetJdk>1.5</targetJdk>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>taglist-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>changelog-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>changes-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </reporting>
</project>
Modified: jpamodelgen/trunk/generator/src/main/java/org/hibernate/jpa/metamodel/ap/JPAMetaModelEntityProcessor.java
===================================================================
--- jpamodelgen/trunk/generator/src/main/java/org/hibernate/jpa/metamodel/ap/JPAMetaModelEntityProcessor.java 2009-07-10 16:25:46 UTC (rev 17071)
+++ jpamodelgen/trunk/generator/src/main/java/org/hibernate/jpa/metamodel/ap/JPAMetaModelEntityProcessor.java 2009-07-10 17:27:47 UTC (rev 17072)
@@ -50,10 +50,12 @@
//@SupportedAnnotationTypes("javax.persistence.Entity")
@SupportedAnnotationTypes("*")
@SupportedSourceVersion(RELEASE_6)
+// TODO Extract all the XML parsing into a separate class
public class JPAMetaModelEntityProcessor extends AbstractProcessor {
private static final String PATH_SEPARATOR = "/";
private static final String PERSISTENCE_XML = "/META-INF/persistence.xml";
+ private static final String ORM_XML = "/META-INF/orm.xml";
private static final Boolean ALLOW_OTHER_PROCESSORS_TO_CLAIM_ANNOTATIONS = Boolean.FALSE;
private static final String ENTITY_ANN = javax.persistence.Entity.class.getName();
private static final String MAPPED_SUPERCLASS_ANN = MappedSuperclass.class.getName();
@@ -143,7 +145,6 @@
private void parsePersistenceXml() {
Persistence persistence = parseXml( PERSISTENCE_XML, Persistence.class, PERSISTENCE_XML_XSD );
if ( persistence != null )
-
{
List<Persistence.PersistenceUnit> persistenceUnits = persistence.getPersistenceUnit();
for ( Persistence.PersistenceUnit unit : persistenceUnits ) {
@@ -153,6 +154,7 @@
}
}
}
+ parsingOrmXml( ORM_XML ); // /META-INF/orm.xml is implicit
xmlProcessed = true;
}
Deleted: jpamodelgen/trunk/generator/src/test/resources/META-INF/order.xml
===================================================================
--- jpamodelgen/trunk/generator/src/test/resources/META-INF/order.xml 2009-07-10 16:25:46 UTC (rev 17071)
+++ jpamodelgen/trunk/generator/src/test/resources/META-INF/order.xml 2009-07-10 17:27:47 UTC (rev 17072)
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_2_0.xsd"
- version="2.0"
- >
- <package>model</package>
- <!-- default package -->
- <entity class="Order" access="FIELD" metadata-complete="true"> <!--means ignore annotations-->
- <attributes>
- <id name="id">
- <column name="fld_id"/>
- </id>
- <basic name="filled"/>
- <basic name="date"/>
- <many-to-one name="shop"/>
- <one-to-many name="items"
- target-entity="Item"
- fetch="EAGER"> <!-- target-entity optional guess the type from the geenric-->
- <cascade>
- <cascade-persist/>
- </cascade>
- </one-to-many>
- <element-collection name="notes"/>
- <!-- new in JPA 2 -->
- </attributes>
- </entity>
-</entity-mappings>
Copied: jpamodelgen/trunk/generator/src/test/resources/META-INF/orm.xml (from rev 17071, jpamodelgen/trunk/generator/src/test/resources/META-INF/order.xml)
===================================================================
--- jpamodelgen/trunk/generator/src/test/resources/META-INF/orm.xml (rev 0)
+++ jpamodelgen/trunk/generator/src/test/resources/META-INF/orm.xml 2009-07-10 17:27:47 UTC (rev 17072)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_2_0.xsd"
+ version="2.0"
+ >
+ <package>model</package>
+ <!-- default package -->
+ <entity class="Order" access="FIELD" metadata-complete="true"> <!--means ignore annotations-->
+ <attributes>
+ <id name="id">
+ <column name="fld_id"/>
+ </id>
+ <basic name="filled"/>
+ <basic name="date"/>
+ <many-to-one name="shop"/>
+ <one-to-many name="items"
+ target-entity="Item"
+ fetch="EAGER"> <!-- target-entity optional guess the type from the geenric-->
+ <cascade>
+ <cascade-persist/>
+ </cascade>
+ </one-to-many>
+ <element-collection name="notes"/>
+ <!-- new in JPA 2 -->
+ </attributes>
+ </entity>
+</entity-mappings>
Modified: jpamodelgen/trunk/generator/src/test/resources/META-INF/persistence.xml
===================================================================
--- jpamodelgen/trunk/generator/src/test/resources/META-INF/persistence.xml 2009-07-10 16:25:46 UTC (rev 17071)
+++ jpamodelgen/trunk/generator/src/test/resources/META-INF/persistence.xml 2009-07-10 17:27:47 UTC (rev 17072)
@@ -4,7 +4,6 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence persistence.xsd" version="2.0">
<persistence-unit name="annotation-processor" transaction-type="JTA">
<description>Test persistence unit</description>
- <mapping-file>/META-INF/order.xml</mapping-file>
<mapping-file>/META-INF/dummy.xml</mapping-file>
<mapping-file>/META-INF/malformed-mapping-xml.xml</mapping-file>
<mapping-file>/META-INF/jpa1-orm.xml</mapping-file>
More information about the hibernate-commits
mailing list