You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by fe...@apache.org on 2005/01/18 03:53:58 UTC

svn commit: r125458 - in maven/maven-1/plugins/trunk/hibernate: . src/main/org/apache/maven/hibernate/beans src/main/org/apache/maven/hibernate/jelly src/plugin-test/codeGenerationTest src/plugin-test/codeGenerationTest/src src/plugin-test/codeGenerationTest/src/main src/plugin-test/codeGenerationTest/src/main/org src/plugin-test/codeGenerationTest/src/main/org/apache src/plugin-test/codeGenerationTest/src/main/org/apache/maven src/plugin-test/codeGenerationTest/src/main/org/apache/maven/hibernate xdocs

Author: felipeal
Date: Mon Jan 17 18:53:55 2005
New Revision: 125458

URL: http://svn.apache.org/viewcvs?view=rev&rev=125458
Log:
MPHIBERNATE-12: new goal that generates POJOs from HBM files (hibernate:code-generation)
Added:
   maven/maven-1/plugins/trunk/hibernate/src/main/org/apache/maven/hibernate/beans/CodeGenerationBean.java
   maven/maven-1/plugins/trunk/hibernate/src/main/org/apache/maven/hibernate/jelly/CodeGenerationTag.java
   maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/
   maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/maven.xml
   maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/project.properties
   maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/project.xml
   maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/src/
   maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/src/main/
   maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/src/main/org/
   maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/src/main/org/apache/
   maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/src/main/org/apache/maven/
   maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/src/main/org/apache/maven/hibernate/
   maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/src/main/org/apache/maven/hibernate/ExcludeItem.hbm.xml
   maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/src/main/org/apache/maven/hibernate/Item.hbm.xml
   maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/src/main/org/apache/maven/hibernate/Item.java
   maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/src/main/org/apache/maven/hibernate/Message.hbm.xml
   maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/src/main/org/apache/maven/hibernate/UserType.java
Modified:
   maven/maven-1/plugins/trunk/hibernate/plugin.jelly
   maven/maven-1/plugins/trunk/hibernate/plugin.properties
   maven/maven-1/plugins/trunk/hibernate/project.xml
   maven/maven-1/plugins/trunk/hibernate/src/main/org/apache/maven/hibernate/jelly/HibernateTagLibrary.java
   maven/maven-1/plugins/trunk/hibernate/xdocs/changes.xml
   maven/maven-1/plugins/trunk/hibernate/xdocs/goals.xml
   maven/maven-1/plugins/trunk/hibernate/xdocs/properties.xml

Modified: maven/maven-1/plugins/trunk/hibernate/plugin.jelly
Url: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/hibernate/plugin.jelly?view=diff&rev=125458&p1=maven/maven-1/plugins/trunk/hibernate/plugin.jelly&r1=125457&p2=maven/maven-1/plugins/trunk/hibernate/plugin.jelly&r2=125458
==============================================================================
--- maven/maven-1/plugins/trunk/hibernate/plugin.jelly	(original)
+++ maven/maven-1/plugins/trunk/hibernate/plugin.jelly	Mon Jan 17 18:53:55 2005
@@ -68,6 +68,17 @@
       includes="${maven.hibernate.input.includes}"
       excludes="${maven.hibernate.input.excludes}"/>      
   </goal>
+  
+  <goal name="hibernate:code-generation" prereqs="hibernate:init" description="Generate POJOs from hbm files">  
+  
+    <ant:echo>Generating POJOs from hbm files</ant:echo>
+    
+    <h:code-generation      
+      basedir="${maven.hibernate.codeGeneration.input.dir}"
+      includes="${maven.hibernate.codeGeneration.input.includes}"
+      excludes="${maven.hibernate.codeGeneration.input.excludes}" 
+      outputdir="${maven.hibernate.codeGeneration.output.dir}"/> 
+  </goal>
      
 </project>
 

Modified: maven/maven-1/plugins/trunk/hibernate/plugin.properties
Url: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/hibernate/plugin.properties?view=diff&rev=125458&p1=maven/maven-1/plugins/trunk/hibernate/plugin.properties&r1=125457&p2=maven/maven-1/plugins/trunk/hibernate/plugin.properties&r2=125458
==============================================================================
--- maven/maven-1/plugins/trunk/hibernate/plugin.properties	(original)
+++ maven/maven-1/plugins/trunk/hibernate/plugin.properties	Mon Jan 17 18:53:55 2005
@@ -24,4 +24,8 @@
 maven.hibernate.input.dir=${maven.build.dest}
 maven.hibernate.input.includes=**/*.hbm.xml
 maven.hibernate.input.excludes=
-maven.hibernate.aggregate.output.file=${maven.hibernate.output.dir}/aggregated-mappings.hbm.xml
\ No newline at end of file
+maven.hibernate.aggregate.output.file=${maven.hibernate.output.dir}/aggregated-mappings.hbm.xml
+maven.hibernate.codeGeneration.input.dir=${maven.src.dir}/hibernate
+maven.hibernate.codeGeneration.output.dir=${maven.src.dir}/hibernate
+maven.hibernate.codeGeneration.input.includes=${maven.hibernate.input.includes}
+maven.hibernate.codeGeneration.input.excludes=

Modified: maven/maven-1/plugins/trunk/hibernate/project.xml
Url: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/hibernate/project.xml?view=diff&rev=125458&p1=maven/maven-1/plugins/trunk/hibernate/project.xml&r1=125457&p2=maven/maven-1/plugins/trunk/hibernate/project.xml&r2=125458
==============================================================================
--- maven/maven-1/plugins/trunk/hibernate/project.xml	(original)
+++ maven/maven-1/plugins/trunk/hibernate/project.xml	Mon Jan 17 18:53:55 2005
@@ -96,6 +96,12 @@
       <type>jar</type>
     </dependency>
     <dependency>
+      <groupId>hibernate</groupId>
+      <artifactId>hibernate-tools</artifactId>
+      <version>2.1.3</version>
+      <type>jar</type>
+    </dependency>
+    <dependency>
       <groupId>ant</groupId>
       <artifactId>ant</artifactId>
       <version>1.5.3-1</version>
@@ -179,5 +185,12 @@
       <version>1.4</version>
       <type>jar</type>
     </dependency>
+    <dependency>
+      <groupId>jdom</groupId>
+      <artifactId>jdom</artifactId>
+      <version>1.0</version>
+      <type>jar</type>
+    </dependency>
+
   </dependencies>
 </project>

Added: maven/maven-1/plugins/trunk/hibernate/src/main/org/apache/maven/hibernate/beans/CodeGenerationBean.java
Url: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/hibernate/src/main/org/apache/maven/hibernate/beans/CodeGenerationBean.java?view=auto&rev=125458
==============================================================================
--- (empty file)
+++ maven/maven-1/plugins/trunk/hibernate/src/main/org/apache/maven/hibernate/beans/CodeGenerationBean.java	Mon Jan 17 18:53:55 2005
@@ -0,0 +1,61 @@
+package org.apache.maven.hibernate.beans;
+
+/* ====================================================================
+ *   Copyright 2001-2004 The Apache Software Foundation.
+ *
+ *   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.
+ * ====================================================================
+ */
+
+import net.sf.hibernate.tool.hbm2java.CodeGenerator;
+
+/**
+ * @author <a href="paulkearney@gmail.com">Paul Kearney</a> 
+ * @version $Id$
+ */
+public class CodeGenerationBean extends CommonOperationsBean {
+    
+    private static final String OUTPUT_SWITCH = "--output=";
+    
+    private String outputdir = null;
+    
+    public void execute() {
+        
+        // Construct output directory argument    
+        StringBuffer switchArg= new StringBuffer();
+        switchArg.append(OUTPUT_SWITCH).append(getOutputdir());
+        
+        // Get list of files that are to be used to generate POJOs
+        final String[] files = getFileNames();
+        
+        // Require new array to combine command args with hbm files array
+        String[] args  = new String[files.length + 1];
+        // Add command arg to new array
+        args[0] = switchArg.toString();
+        // Copy list of hbm files to new array
+        System.arraycopy(files, 0, args, 1, files.length);
+                        
+        // Generate POJOs
+        CodeGenerator generator = new CodeGenerator(); 
+        generator.main(args);  
+        
+    }    
+    
+    public String getOutputdir() {
+        return this.outputdir;
+    }
+        
+    public void setOutputdir(String outputdir) {        
+        this.outputdir = outputdir;
+    }    
+}

Added: maven/maven-1/plugins/trunk/hibernate/src/main/org/apache/maven/hibernate/jelly/CodeGenerationTag.java
Url: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/hibernate/src/main/org/apache/maven/hibernate/jelly/CodeGenerationTag.java?view=auto&rev=125458
==============================================================================
--- (empty file)
+++ maven/maven-1/plugins/trunk/hibernate/src/main/org/apache/maven/hibernate/jelly/CodeGenerationTag.java	Mon Jan 17 18:53:55 2005
@@ -0,0 +1,99 @@
+package org.apache.maven.hibernate.jelly;
+
+/* ====================================================================
+ *   Copyright 2001-2004 The Apache Software Foundation.
+ *
+ *   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.
+ * ====================================================================
+ */
+
+import org.apache.commons.jelly.JellyTagException;
+import org.apache.commons.jelly.MissingAttributeException;
+import org.apache.commons.jelly.TagSupport;
+import org.apache.commons.jelly.XMLOutput;
+import org.apache.maven.hibernate.beans.CodeGenerationBean;
+
+/**
+ * @author <a href="paulkearney@gmail.com">Paul Kearney</a> 
+ * @version $Id$
+ */
+public class CodeGenerationTag extends TagSupport {
+    
+	private CodeGenerationBean bean = new CodeGenerationBean();
+
+	/**
+	 * @see org.apache.commons.jelly.Tag#doTag(org.apache.commons.jelly.XMLOutput)
+	 */
+	public void doTag(XMLOutput arg0) throws MissingAttributeException, JellyTagException {
+
+		execute();
+	}
+
+	/**
+	 *  
+	 */
+	protected void execute() throws JellyTagException 
+	{
+		try {
+			bean.execute();
+		} catch (Exception e) {
+			String msg = "Code generation operation failed";			
+			throw new JellyTagException(msg, e);
+		}
+	}
+	
+	public String getBasedir()
+    {
+        return bean.getBasedir();
+    }
+
+    public String getExcludes()
+    {
+        return bean.getExcludes();
+    }
+
+    public String getIncludes()
+    {
+        return bean.getIncludes();
+    }
+    
+    public String getOutputdir() 
+    {
+    	return bean.getOutputdir();
+    }
+
+    public void setBasedir(String string)
+    {
+        bean.setBasedir(string);
+    }
+	
+	public void setExcludes(String string)
+    {
+        bean.setExcludes(string);
+    }
+
+    public void setIncludes(String string)
+    {
+        bean.setIncludes(string);
+    }
+    
+    public void setOutputdir(String dir) 
+    {
+    	bean.setOutputdir(dir);
+    }
+    
+    public String toString()
+    {
+        return bean.toString();
+    }
+}

Modified: maven/maven-1/plugins/trunk/hibernate/src/main/org/apache/maven/hibernate/jelly/HibernateTagLibrary.java
Url: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/hibernate/src/main/org/apache/maven/hibernate/jelly/HibernateTagLibrary.java?view=diff&rev=125458&p1=maven/maven-1/plugins/trunk/hibernate/src/main/org/apache/maven/hibernate/jelly/HibernateTagLibrary.java&r1=125457&p2=maven/maven-1/plugins/trunk/hibernate/src/main/org/apache/maven/hibernate/jelly/HibernateTagLibrary.java&r2=125458
==============================================================================
--- maven/maven-1/plugins/trunk/hibernate/src/main/org/apache/maven/hibernate/jelly/HibernateTagLibrary.java	(original)
+++ maven/maven-1/plugins/trunk/hibernate/src/main/org/apache/maven/hibernate/jelly/HibernateTagLibrary.java	Mon Jan 17 18:53:55 2005
@@ -24,7 +24,7 @@
  * Hibernate tag library.
  * 
  * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a> 
- * @version $Id: HibernateTagLibrary.java,v 1.4 2004/11/06 21:52:23 felipeal Exp $
+ * @version $Id$
  */
 public class HibernateTagLibrary extends CoreTagLibrary
 {
@@ -37,5 +37,6 @@
         registerTag( "schema-export", SchemaExportTag.class ); 
         registerTag( "schema-update", SchemaUpdateTag.class ); 
         registerTag( "aggregate-mappings", AggregateMappingsTag.class ); 
+        registerTag( "code-generation", CodeGenerationTag.class );
     }
 }

Added: maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/maven.xml
Url: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/maven.xml?view=auto&rev=125458
==============================================================================
--- (empty file)
+++ maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/maven.xml	Mon Jan 17 18:53:55 2005
@@ -0,0 +1,62 @@
+<!-- 
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * 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.
+ */
+ -->
+<project xmlns:util="jelly:util"
+         xmlns:j="jelly:core"
+         xmlns:ant="jelly:ant"
+         xmlns:assert="assert"
+         xmlns:maven="jelly:maven"
+         xmlns:x="jelly:xml"
+         default="testPlugin">
+         
+  <goal name="testPlugin" prereqs="test-hibernate-code-generation">
+    <attainGoal name="clean"/>
+  </goal>
+ 
+  
+  <goal name="test-hibernate-code-generation">
+
+     <!-- definitions -->
+     <j:set var="maven.hibernate.codeGeneration.input.excludes" value="org/apache/maven/hibernate/Item.hbm.xml,org/apache/maven/hibernate/ExcludeItem.hbm.xml"/>
+     <j:set var="itemJavaPath" value="org/apache/maven/hibernate/Item.java"/>
+     <j:set var="itemJavaFullPath" value="${maven.hibernate.codeGeneration.input.dir}/${itemJavaPath}"/>
+     <j:set var="excludeItemJavaPath" value="org/apache/maven/hibernate/ExcludeItem.java"/>
+     <j:set var="excludeItemJavaFullPath" value="${maven.hibernate.codeGeneration.input.dir}/${excludeItemJavaPath}"/>
+     <j:set var="messageJavaFullPath" value="${maven.hibernate.codeGeneration.output.dir}/org/apache/maven/hibernate/Message.java"/>
+
+     <!-- makes sure there was an Item.java before -->
+  	 <assert:assertFileExists file="${itemJavaFullPath}"/>
+
+     <util:loadText var="preItemContent" file="${itemJavaFullPath}"/>    
+     <attainGoal name="hibernate:code-generation"/>
+     <util:loadText var="postItemContent" file="${itemJavaFullPath}"/>
+
+     <!-- makes sure Item.java was not generated -->
+     <assert:assertEquals expected="${preItemContent}" value="${postItemContent}"/>
+
+     <!-- makes sure ExcludeItem.java was not generated -->
+     <assert:assertFileNotFound file="${excludeItemJavaFullPath}"/>
+
+     <!-- makes sure Message.java was generated -->
+  	 <assert:assertFileExists file="${messageJavaFullPath}"/>
+     <attainGoal name="java:compile"/>
+     <delete file="${messageJavaFullPath}"/>
+
+     
+  </goal>
+
+</project>

Added: maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/project.properties
Url: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/project.properties?view=auto&rev=125458
==============================================================================
--- (empty file)
+++ maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/project.properties	Mon Jan 17 18:53:55 2005
@@ -0,0 +1,20 @@
+# -------------------------------------------------------------------
+# Copyright 2004 The Apache Software Foundation.
+# 
+# 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.
+# -------------------------------------------------------------------
+maven.hibernate.quiet=false
+maven.hibernate.codeGeneration.input.dir=${maven.src.dir}/main
+maven.hibernate.codeGeneration.output.dir=${maven.hibernate.codeGeneration.input.dir}
+
+

Added: maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/project.xml
Url: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/project.xml?view=auto&rev=125458
==============================================================================
--- (empty file)
+++ maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/project.xml	Mon Jan 17 18:53:55 2005
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * 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.
+ */
+ -->
+
+
+<project>
+  <pomVersion>3</pomVersion>
+  <id>test-maven-hibernate-plugin-codeGenerationTest</id>
+  <name>Test Cases for Maven Hibernate Plugin's CodeGeneration Tag</name>
+  <groupId>maven</groupId>
+  <currentVersion>1.0-SNAPSHOT</currentVersion>
+  <organization>
+    <name>Apache Software Foundation</name>
+    <url>http://www.apache.org/</url>
+    <logo>http://maven.apache.org/images/jakarta-logo-blue.gif</logo>
+  </organization>
+  <inceptionYear>2005</inceptionYear>
+  <package>org.apache.maven</package>
+  <logo>http://maven.apache.org/images/maven.jpg</logo>
+  <description>Test for Maven Hibernate plugin</description>
+  <shortDescription>Test for Maven Hibernate plugin</shortDescription>
+  <url>http://maven.apache.org/reference/plugins/hibernate/</url>
+  <siteDirectory>/www/maven.apache.org/reference/plugins/hibernate/</siteDirectory>
+  <repository>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk/hibernate/src/plugin-test</connection>
+    <url>http://svn.apache.org/viewcvs.cgi/maven/maven-1/plugins/trunk/hibernate/src/plugin-test</url>
+  </repository>
+  <developers>
+    <developer>
+      <name>Felipe Leme</name>
+      <id>felipeal</id>
+      <email>maven@felipeal.net</email>
+      <organization>Falcon Informatica</organization>
+      <roles>
+        <role>Java Developer</role>
+      </roles>
+      <timezone>-3</timezone>
+    </developer>     
+  </developers>
+
+  <dependencies>
+  
+    <dependency>
+      <groupId>commons-jelly</groupId>
+      <artifactId>commons-jelly-tags-xml</artifactId>
+      <version>20030211.142705</version>
+      <url>http://jakarta.apache.org/commons/jelly/libs/xml/</url>
+    </dependency>
+  
+      
+    <dependency>
+      <groupId>hsqldb</groupId>
+      <artifactId>hsqldb</artifactId>
+      <version>1.7.1</version>
+      <type>jar</type>
+    </dependency>
+  
+    <dependency>
+      <groupId>hibernate</groupId>
+      <artifactId>hibernate</artifactId>
+      <version>2.1.3</version>
+      <type>jar</type>
+    </dependency>    
+    <dependency>
+      <groupId>cglib</groupId>
+      <artifactId>cglib</artifactId>
+      <version>2.0.2</version>
+      <type>jar</type>
+    </dependency>
+    <dependency>
+      <groupId>dom4j</groupId>
+      <artifactId>dom4j</artifactId>
+      <version>1.4</version>
+      <type>jar</type>
+    </dependency>  
+    <dependency>
+      <groupId>commons-lang</groupId>
+      <artifactId>commons-lang</artifactId>
+      <version>2.0</version>
+      <type>jar</type>
+    </dependency>
+  </dependencies>
+  
+  <build>
+    <sourceDirectory>src/main</sourceDirectory>
+    <resources>
+      <resource>
+        <directory>src/main</directory>
+        <includes>
+          <include>**/*.xml</include>
+        </includes>
+      </resource>
+    </resources> 
+  </build>
+</project>

Added: maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/src/main/org/apache/maven/hibernate/ExcludeItem.hbm.xml
Url: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/src/main/org/apache/maven/hibernate/ExcludeItem.hbm.xml?view=auto&rev=125458
==============================================================================
--- (empty file)
+++ maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/src/main/org/apache/maven/hibernate/ExcludeItem.hbm.xml	Mon Jan 17 18:53:55 2005
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+	"-//Hibernate/Hibernate Mapping DTD//EN"
+	"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
+
+<hibernate-mapping>
+	<class
+			name="org.apache.maven.hibernate.ExcludeItem"
+			table="EXCLUDE_ITEMS">
+			<id
+				name="id"
+				type="java.lang.Long"
+				column="EXCLUDE_ITEM_ID">				
+				<generator class="increment"/>	
+			</id>			
+			<property
+				name="name"
+				type="java.lang.String"
+				column="EXCLUDE_ITEM_NAME"/>					
+	</class>
+</hibernate-mapping>

Added: maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/src/main/org/apache/maven/hibernate/Item.hbm.xml
Url: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/src/main/org/apache/maven/hibernate/Item.hbm.xml?view=auto&rev=125458
==============================================================================
--- (empty file)
+++ maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/src/main/org/apache/maven/hibernate/Item.hbm.xml	Mon Jan 17 18:53:55 2005
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+  <!DOCTYPE hibernate-mapping PUBLIC
+   "-//Hibernate/Hibernate Mapping DTD 2.0//EN" 
+   "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd"> 
+
+  <hibernate-mapping auto-import="false">
+  
+    <class name="org.apache.maven.hibernate.Item" table="Item" >
+      <id name="id" type="int" column="ID" unsaved-value="0">
+           <generator class="native"/>
+        </id>
+      <property name="name" column="NAME" type="string"/>      
+      
+    </class>   
+    
+  </hibernate-mapping>

Added: maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/src/main/org/apache/maven/hibernate/Item.java
Url: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/src/main/org/apache/maven/hibernate/Item.java?view=auto&rev=125458
==============================================================================
--- (empty file)
+++ maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/src/main/org/apache/maven/hibernate/Item.java	Mon Jan 17 18:53:55 2005
@@ -0,0 +1,56 @@
+package org.apache.maven.hibernate;
+
+/* ====================================================================
+ *   Copyright 2001-2004 The Apache Software Foundation.
+ *
+ *   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.
+ * ====================================================================
+ */
+
+/**
+ * Class to use with testing the plugin.
+ * 
+ * @author <a href="mailto:epugh@opensourceconnections.com">Eric Pugh</a>
+ *
+ * @version $Id: Item.java 125453 2005-01-18 01:03:25Z felipeal $
+ */
+
+public class Item {
+    private int id;
+    private String name;
+
+    /**
+     * @return Returns the id.
+     */
+    public int getId() {
+        return id;
+    }
+    /**
+     * @param id The id to set.
+     */
+    public void setId(int id) {
+        this.id = id;
+    }
+    /**
+     * @return Returns the name.
+     */
+    public String getName() {
+        return name;
+    }
+    /**
+     * @param name The name to set.
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+}

Added: maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/src/main/org/apache/maven/hibernate/Message.hbm.xml
Url: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/src/main/org/apache/maven/hibernate/Message.hbm.xml?view=auto&rev=125458
==============================================================================
--- (empty file)
+++ maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/src/main/org/apache/maven/hibernate/Message.hbm.xml	Mon Jan 17 18:53:55 2005
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+	"-//Hibernate/Hibernate Mapping DTD//EN"
+	"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
+
+<hibernate-mapping>
+	<class
+			name="org.apache.maven.hibernate.Message"
+			table="MESSAGES">
+			<id
+				name="id"
+				type="java.lang.Long"
+				column="MESSAGE_ID">				
+				<generator class="increment"/>	
+			</id>
+			<property
+				name="text"
+				type="org.apache.maven.hibernate.UserType"
+				column="FIELD_TEXT"/>
+			<property
+				name="field"
+				type="java.lang.String"
+				column="MESSAGE_TEXT"/>
+			<many-to-one
+				name="nextMessage"
+				class="org.apache.maven.hibernate.Message"
+				cascade="all"
+				column="NEXT_MESSAGE_ID"/>				
+	</class>
+</hibernate-mapping>

Added: maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/src/main/org/apache/maven/hibernate/UserType.java
Url: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/src/main/org/apache/maven/hibernate/UserType.java?view=auto&rev=125458
==============================================================================
--- (empty file)
+++ maven/maven-1/plugins/trunk/hibernate/src/plugin-test/codeGenerationTest/src/main/org/apache/maven/hibernate/UserType.java	Mon Jan 17 18:53:55 2005
@@ -0,0 +1,41 @@
+package org.apache.maven.hibernate;
+
+/* ====================================================================
+ *   Copyright 2001-2004 The Apache Software Foundation.
+ *
+ *   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.
+ * ====================================================================
+ */
+
+/**
+ * Class to use with testing the plugin.
+ * 
+ * @author <a href="paulkearney@gmail.com">Paul Kearney</a>
+ *
+ * @version $Id$
+ */
+public class UserType {
+    
+    private Long field;
+
+    private Message message;
+    
+    
+
+    public Long getField() {
+        return field;
+    }
+    public void setField(Long field) {
+        this.field = field;
+    }
+}

Modified: maven/maven-1/plugins/trunk/hibernate/xdocs/changes.xml
Url: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/hibernate/xdocs/changes.xml?view=diff&rev=125458&p1=maven/maven-1/plugins/trunk/hibernate/xdocs/changes.xml&r1=125457&p2=maven/maven-1/plugins/trunk/hibernate/xdocs/changes.xml&r2=125458
==============================================================================
--- maven/maven-1/plugins/trunk/hibernate/xdocs/changes.xml	(original)
+++ maven/maven-1/plugins/trunk/hibernate/xdocs/changes.xml	Mon Jan 17 18:53:55 2005
@@ -25,8 +25,9 @@
   </properties>
   <body>
     <release version="1.3" date="in cvs">
-      <action dev="felipeal" type="add" issue="MPHIBERNATE-13">Added new goal <code>hibernate:schema-update</code></action>
-      <action dev="epugh" type="fix" issue="MPHIBERNATE-9">plugin:test fails without a network connection</action>
+      <action dev="felipeal" type="add" issue="MPHIBERNATE-12" due-to="Paul Kearney">Added new goal <code>hibernate:code-generation</code>.</action>
+      <action dev="felipeal" type="add" issue="MPHIBERNATE-13">Added new goal <code>hibernate:schema-update</code>.</action>
+      <action dev="epugh" type="fix" issue="MPHIBERNATE-9">plugin:test fails without a network connection.</action>
     </release>
     <release version="1.2" date="2004-08-14">
       <action dev="epugh" type="fix" issue="MPHIBERNATE-10" due-to="Henning Schmiedehausen">maven-hibernate ignores the "config" attribute</action>

Modified: maven/maven-1/plugins/trunk/hibernate/xdocs/goals.xml
Url: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/hibernate/xdocs/goals.xml?view=diff&rev=125458&p1=maven/maven-1/plugins/trunk/hibernate/xdocs/goals.xml&r1=125457&p2=maven/maven-1/plugins/trunk/hibernate/xdocs/goals.xml&r2=125458
==============================================================================
--- maven/maven-1/plugins/trunk/hibernate/xdocs/goals.xml	(original)
+++ maven/maven-1/plugins/trunk/hibernate/xdocs/goals.xml	Mon Jan 17 18:53:55 2005
@@ -49,7 +49,14 @@
       	  <td>
              Aggregates multiple hibernate mappings into one      	    
       	  </td>
-      	</tr>      	      	
+      	</tr>  
+	  <a name="hibernate:code-generation" />
+      	<tr>
+      	  <td>hibernate:code-generation</td>
+      	  <td>
+             Generates Java classes from set of *.hbm.xml files      	    
+      	  </td>
+      	</tr>    	      	
       </table>
     </section>
   </body>

Modified: maven/maven-1/plugins/trunk/hibernate/xdocs/properties.xml
Url: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/hibernate/xdocs/properties.xml?view=diff&rev=125458&p1=maven/maven-1/plugins/trunk/hibernate/xdocs/properties.xml&r1=125457&p2=maven/maven-1/plugins/trunk/hibernate/xdocs/properties.xml&r2=125458
==============================================================================
--- maven/maven-1/plugins/trunk/hibernate/xdocs/properties.xml	(original)
+++ maven/maven-1/plugins/trunk/hibernate/xdocs/properties.xml	Mon Jan 17 18:53:55 2005
@@ -133,6 +133,45 @@
           <td>Yes</td>
           <td>When <code>aggregate-mappings</code> is run, this file will contain the aggregated mappings</td>
         </tr> 
+		<tr>
+          <td>maven.hibernate.codeGeneration.input.dir</td>
+          <td>Yes</td>
+          <td>Comma-separated list of directories that contains Hibernate mapping files which will be used to generated Java classes when the goal <code>code-generation</code> is used.
+
+             It defaults to <code>${maven.src.dir}/hibernate</code>.
+		  </td>
+        </tr>	
+		<tr>
+          <td>maven.hibernate.codeGeneration.input.includes</td>
+          <td>Yes</td>
+          <td>
+			Comma-separated list of patterns of Hibernate mapping files, 
+			which will be included during the code generation process (goal <code>code-generation</code>).
+			<br/>
+			<b>Note</b>: Files are relative to <code>${maven.hibernate.codeGeneration.input.dir}</code>.
+			<br/>
+			Default value is <code>${maven.hibernate.input.includes}</code>.
+          </td>
+        </tr> 
+		<tr>
+          <td>maven.hibernate.codeGeneration.input.excludes</td>
+          <td>Yes</td>
+          <td>
+			Comma-separated list of patterns of Hibernate mapping files, 
+			which will be excluded during the code generation process (goal <code>code-generation</code>).
+			<br/>
+			<b>Note</b>: Files are relative to 
+			<code>${maven.hibernate.codeGeneration.input.dir}</code>.
+			<br/>
+			By default no files are excluded.
+          </td>
+        </tr>	
+		<tr>
+          <td>maven.hibernate.codeGeneration.output.dir</td>
+          <td>Yes</td>
+          <td>When <code>code-generation</code> is run, the generated Java files will be placed in
+			  this directory.  It defaults to <code>${maven.src.dir}/hibernate</code>.</td>
+        </tr>
         
       </table>
     </section>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org