modello-maven-plugin-1.1/0000755000175000017500000000000011260155733014375 5ustar mkochmkochmodello-maven-plugin-1.1/pom.xml0000644000175000017500000001250411243557055015720 0ustar mkochmkoch modello org.codehaus.modello 1.1 4.0.0 modello-maven-plugin maven-plugin Modello Maven Plugin Modello Maven Plugin enables the use of Modello in Maven builds. 2.0.6 org.apache.maven maven-plugin-api org.codehaus.modello modello-core org.apache.maven maven-project org.codehaus.plexus plexus-container-default org.codehaus.plexus plexus-utils org.codehaus.modello modello-plugin-converters runtime org.codehaus.modello modello-plugin-dom4j runtime org.codehaus.modello modello-plugin-java org.codehaus.modello modello-plugin-jdom runtime org.codehaus.modello modello-plugin-stax runtime org.codehaus.modello modello-plugin-xdoc runtime org.codehaus.modello modello-plugin-xpp3 runtime org.codehaus.modello modello-plugin-xsd runtime org.sonatype.plexus plexus-build-api org.apache.maven.plugins maven-plugin-plugin generated-helpmojo helpmojo org.apache.maven.plugins maven-plugin-plugin 2.4.3 run-its org.apache.maven.plugins maven-invoker-plugin 1.3 src/it ${project.build.directory}/it */pom.xml verify.bsh src/it/settings.xml ${project.build.directory}/local-repo true 1.5.8 3.8.2 clean test integration-test install run run-its-java14 1.4 org.apache.maven.plugins maven-invoker-plugin 1.3 clone-java5/** modello-maven-plugin-1.1/src/0000755000175000017500000000000011260155733015164 5ustar mkochmkochmodello-maven-plugin-1.1/src/test/0000755000175000017500000000000011260155732016142 5ustar mkochmkochmodello-maven-plugin-1.1/src/test/java/0000755000175000017500000000000011260155732017063 5ustar mkochmkochmodello-maven-plugin-1.1/src/test/java/org/0000755000175000017500000000000011260155732017652 5ustar mkochmkochmodello-maven-plugin-1.1/src/test/java/org/codehaus/0000755000175000017500000000000011260155732021445 5ustar mkochmkochmodello-maven-plugin-1.1/src/test/java/org/codehaus/modello/0000755000175000017500000000000011260155732023100 5ustar mkochmkochmodello-maven-plugin-1.1/src/test/java/org/codehaus/modello/maven/0000755000175000017500000000000011260155732024206 5ustar mkochmkochmodello-maven-plugin-1.1/src/test/java/org/codehaus/modello/maven/ModelloConvertersMojoTest.java0000644000175000017500000001062211145330132032174 0ustar mkochmkochpackage org.codehaus.modello.maven; /* * Copyright (c) 2006, Codehaus.org * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ import org.codehaus.modello.core.ModelloCore; import org.codehaus.plexus.PlexusTestCase; import org.sonatype.plexus.build.incremental.BuildContext; import org.codehaus.plexus.util.FileUtils; import java.io.File; import java.util.Arrays; /** * @author Brett Porter * @version $Id: ModelloConvertersMojoTest.java 1184 2009-02-13 17:39:38Z igorife $ */ public class ModelloConvertersMojoTest extends PlexusTestCase { public void testModelloConvertersMojo() throws Exception { ModelloCore modelloCore = (ModelloCore) lookup( ModelloCore.ROLE ); BuildContext buildContext = (BuildContext) lookup( BuildContext.class ); ModelloConvertersMojo mojo = new ModelloConvertersMojo(); File outputDirectory = getTestFile( "target/converters-test" ); FileUtils.deleteDirectory( outputDirectory ); // ---------------------------------------------------------------------- // Call the mojo // ---------------------------------------------------------------------- mojo.setOutputDirectory( outputDirectory ); String models[] = new String[1]; models[0] = getTestPath( "src/test/resources/java-model.mdo" ); mojo.setModels( models ); mojo.setVersion( "1.0.0" ); mojo.setPackageWithVersion( false ); mojo.setPackagedVersions( Arrays.asList( new String[] { "0.9.0", "1.0.0" } ) ); mojo.setModelloCore( modelloCore ); mojo.setBuildContext( buildContext ); mojo.execute(); // ---------------------------------------------------------------------- // Assert // ---------------------------------------------------------------------- File javaFile = new File( outputDirectory, "org/codehaus/mojo/modello/javatest/v1_0_0/convert/VersionConverter.java" ); assertTrue( "The generated java file doesn't exist: '" + javaFile.getAbsolutePath() + "'.", javaFile.exists() ); javaFile = new File( outputDirectory, "org/codehaus/mojo/modello/javatest/v1_0_0/convert/BasicVersionConverter.java" ); assertTrue( "The generated java file doesn't exist: '" + javaFile.getAbsolutePath() + "'.", javaFile.exists() ); javaFile = new File( outputDirectory, "org/codehaus/mojo/modello/javatest/v0_9_0/convert/VersionConverter.java" ); assertTrue( "The generated java file doesn't exist: '" + javaFile.getAbsolutePath() + "'.", javaFile.exists() ); javaFile = new File( outputDirectory, "org/codehaus/mojo/modello/javatest/v0_9_0/convert/BasicVersionConverter.java" ); assertTrue( "The generated java file doesn't exist: '" + javaFile.getAbsolutePath() + "'.", javaFile.exists() ); javaFile = new File( outputDirectory, "org/codehaus/mojo/modello/javatest/convert/VersionConverter.java" ); assertFalse( "The generated java file doesn't exist: '" + javaFile.getAbsolutePath() + "'.", javaFile.exists() ); javaFile = new File( outputDirectory, "org/codehaus/mojo/modello/javatest/convert/BasicVersionConverter.java" ); assertFalse( "The generated java file doesn't exist: '" + javaFile.getAbsolutePath() + "'.", javaFile.exists() ); } } modello-maven-plugin-1.1/src/test/java/org/codehaus/modello/maven/ModelloJavaMojoTest.java0000644000175000017500000001027411145330132030726 0ustar mkochmkochpackage org.codehaus.modello.maven; /* * Copyright (c) 2004, Codehaus.org * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ import org.codehaus.modello.core.ModelloCore; import org.codehaus.plexus.PlexusTestCase; import org.sonatype.plexus.build.incremental.BuildContext; import org.codehaus.plexus.util.FileUtils; import java.io.File; import java.util.Arrays; /** * @author Trygve Laugstøl * @version $Id: ModelloJavaMojoTest.java 1184 2009-02-13 17:39:38Z igorife $ */ public class ModelloJavaMojoTest extends PlexusTestCase { public void testModelloJavaMojo() throws Exception { ModelloCore modelloCore = (ModelloCore) lookup( ModelloCore.ROLE ); BuildContext buildContext = (BuildContext) lookup( BuildContext.class ); ModelloJavaMojo mojo = new ModelloJavaMojo(); File outputDirectory = getTestFile( "target/java-test" ); FileUtils.deleteDirectory( outputDirectory ); // ---------------------------------------------------------------------- // Call the mojo // ---------------------------------------------------------------------- mojo.setOutputDirectory( outputDirectory ); String models[] = new String[1]; models[0] = getTestPath( "src/test/resources/java-model.mdo" ); mojo.setModels( models ); mojo.setVersion( "1.0.0" ); mojo.setPackageWithVersion( false ); mojo.setPackagedVersions( Arrays.asList( new String[] { "0.9.0", "1.0.0" } ) ); mojo.setModelloCore( modelloCore ); mojo.setBuildContext( buildContext ); mojo.execute(); // ---------------------------------------------------------------------- // Assert // ---------------------------------------------------------------------- File javaFile = new File( outputDirectory, "org/codehaus/mojo/modello/javatest/Model.java" ); assertTrue( "The generated java file doesn't exist: '" + javaFile.getAbsolutePath() + "'.", javaFile.exists() ); javaFile = new File( outputDirectory, "org/codehaus/mojo/modello/javatest/NewModel.java" ); assertTrue( "The generated java file doesn't exist: '" + javaFile.getAbsolutePath() + "'.", javaFile.exists() ); javaFile = new File( outputDirectory, "org/codehaus/mojo/modello/javatest/v1_0_0/Model.java" ); assertTrue( "The generated java file doesn't exist: '" + javaFile.getAbsolutePath() + "'.", javaFile.exists() ); javaFile = new File( outputDirectory, "org/codehaus/mojo/modello/javatest/v1_0_0/NewModel.java" ); assertTrue( "The generated java file doesn't exist: '" + javaFile.getAbsolutePath() + "'.", javaFile.exists() ); javaFile = new File( outputDirectory, "org/codehaus/mojo/modello/javatest/v0_9_0/Model.java" ); assertTrue( "The generated java file doesn't exist: '" + javaFile.getAbsolutePath() + "'.", javaFile.exists() ); javaFile = new File( outputDirectory, "org/codehaus/mojo/modello/javatest/v0_9_0/NewModel.java" ); assertFalse( "The generated java file shouldn't exist: '" + javaFile.getAbsolutePath() + "'.", javaFile.exists() ); } } modello-maven-plugin-1.1/src/test/resources/0000755000175000017500000000000011260155732020154 5ustar mkochmkochmodello-maven-plugin-1.1/src/test/resources/java-model.mdo0000644000175000017500000000154611205276556022711 0ustar mkochmkoch maven-java-mojo-test-model Modello Java Mojo Test Model Model package org.codehaus.mojo.modello.javatest Model 0.9.0+ extend 1.0.0+ String NewModel 1.0.0+ modello-maven-plugin-1.1/src/site/0000755000175000017500000000000011260155733016130 5ustar mkochmkochmodello-maven-plugin-1.1/src/site/apt/0000755000175000017500000000000011260155733016714 5ustar mkochmkochmodello-maven-plugin-1.1/src/site/apt/usage.apt.vm0000644000175000017500000000530011226420741021141 0ustar mkochmkoch ------ Usage ------ Denis Cabasson ------ 10 August 2006 ------ Usage This document is intended to provide instructions for using the modello-maven-plugin. * Typical configuration of the plugin in pom.xml You can use the following configuration in your <<>> to invoke the Modello Plugin. +---+ [...] [...] org.codehaus.modello modello-maven-plugin ${project.version} src/main/mdo/myModel.mdo 1.0.0 myModel generate-sources java xpp3-reader myModel-site-xsd pre-site xsd target/generated-site/resources/xsd myModel-site-doc pre-site xdoc [...] [...] +---+ This configuration will take into account the model described in the file <<>> in version 1.0.0. It will execute the following goals in the <<>> phase: * {{{java-mojo.html}java}} which will generate Java beans from the model, * {{{xpp3-reader-mojo.html}xpp3-reader}} which will create an XPP reader for the model. [] The generated Java sources will be located in the <<>> folder (or in the folder set by the <<>> parameter), which will be added as a source folder to the project build cycle. During the <<>> phase, it will execute the following goals: * {{{xdoc-mojo.html}xdoc}} which will generate a documentation of the model in the <<>> folder, which will in turn be processed to output in the standard site, during the <<>> phase, * {{{xsd-mojo.html}xsd}} which will generate an XML Schema for our model in the <<>> folder (set by the <<>> parameter), which will in turn be copied in the standard site, during the <<>> phase. [] modello-maven-plugin-1.1/src/site/apt/examples/0000755000175000017500000000000011260155733020532 5ustar mkochmkochmodello-maven-plugin-1.1/src/site/apt/examples/multi-model.apt.vm0000644000175000017500000000334111226420741024106 0ustar mkochmkoch ------ Example of multi-model configuration ------ Denis Cabasson ------ 10 August 2006 ------ Processing Multiple Modello Models * Configuring your pom.xml You can use the following configuration in your <<>> to have the Modello Plugin take two of your models into account (this configuration is taken from the maven-assembly-plugin which indeed uses two different models). +---+ [...] [...] org.codehaus.modello modello-maven-plugin ${project.version} mdo generate-sources xpp3-reader xpp3-writer java xsd src/main/mdo/descriptor.mdo src/main/mdo/component.mdo 1.0.0 mdo-site pre-site xdoc xsd src/main/mdo/descriptor.mdo src/main/mdo/component.mdo 1.0.0 [...] [...] +---+ modello-maven-plugin-1.1/src/site/apt/index.apt0000644000175000017500000000541411226420741020531 0ustar mkochmkoch ------ Introduction ------ Denis Cabasson HervĂ© Boutemy ------ 1 January 2009 ------ Modello Maven Plugin This plugin makes use of the {{{http://modello.codehaus.org/}Modello}} project. * Goals Overview * {{{xsd-mojo.html}modello:xsd}} Generates an XML Schema from the Modello model. * {{{xdoc-mojo.html}modello:xdoc}} Generates standard documentation for the Modello model, in xdoc format. * {{{java-mojo.html}modello:java}} Generates Java beans from the Modello model. * {{{xpp3-writer-mojo.html}modello:xpp3-writer}} Generates an XML Pull Parser writer from the Modello model. * {{{xpp3-reader-mojo.html}modello:xpp3-reader}} Generates an XML Pull Parser reader from the Modello model. * {{{dom4j-writer-mojo.html}modello:dom4j-writer}} Generates a DOM4J writer from the Modello model. * {{{dom4j-reader-mojo.html}modello:dom4j-reader}} Generates a DOM4J reader from the Modello model. * {{{stax-writer-mojo.html}modello:stax-writer}} Generates a StAX writer from the Modello model. * {{{stax-reader-mojo.html}modello:stax-reader}} Generates a StAX reader from the Modello model. * {{{jdom-writer-mojo.html}modello:jdom-writer}} Generates a {{{http://www.jdom.org/}jdom}} writer from the model that is capable of preserving element ordering and comments. * {{{converters-mojo.html}modello:converters}} Generates classes that can convert between different versions of the model. [] * Usage General instructions on how to use the Modello Plugin can be found on the {{{usage.html}usage page}}. Some more specific use cases are described in the examples given below. In case you still have questions regarding the plugin's usage, please have a look at the {{{faq.html}FAQ}} and feel free to contact the {{{mail-lists.html}user mailing list}}. The posts to the mailing list are archived and could already contain the answer to your question as part of an older thread. Hence, it is also worth browsing/searching the {{{mail-lists.html}mail archive}}. If you feel like the plugin is missing a feature or has a defect, you can fill a feature request or bug report in our {{{issue-tracking.html}issue tracker}}. When creating a new issue, please provide a comprehensive description of your concern. Especially for fixing bugs it is crucial that the developers can reproduce your problem. For this reason, entire debug logs, POMs or most preferably little demo projects attached to the issue are very much appreciated. Of course, patches are welcome, too. Contributors can check out the project from our {{{source-repository.html}source repository}}. * Examples To provide you with better understanding of some usages of the Modello Plugin, you can take a look at the following example: * {{{examples/multi-model.html}Including multiple models}} modello-maven-plugin-1.1/src/site/site.xml0000644000175000017500000000100311226420741017604 0ustar mkochmkoch Modello modello-maven-plugin-1.1/src/site/fml/0000755000175000017500000000000011260155733016706 5ustar mkochmkochmodello-maven-plugin-1.1/src/site/fml/faq.fml0000644000175000017500000000375211137114311020152 0ustar mkochmkoch Where can I find documentation about Modello?

A good starting place to get some insight into Modello is Modello's wiki.

Modello model descriptor is described and documented with Modello.

Is Modello really used anywhere?

Modello is used extensively in Maven. You can find examples of models:

modello-maven-plugin-1.1/src/it/0000755000175000017500000000000011260155733015600 5ustar mkochmkochmodello-maven-plugin-1.1/src/it/clone-java5/0000755000175000017500000000000011260155733017704 5ustar mkochmkochmodello-maven-plugin-1.1/src/it/clone-java5/pom.xml0000644000175000017500000000414211221417324021214 0ustar mkochmkoch 4.0.0 org.codehaus.modello.its clone 0.1-SNAPSHOT Clone IT Test the generation of clone() methods. org.codehaus.plexus plexus-utils @plexusUtilsVersion@ junit junit @junitVersion@ test org.apache.maven.plugins maven-compiler-plugin 2.0.2 1.5 1.5 org.apache.maven.plugins maven-resources-plugin 2.2 org.apache.maven.plugins maven-surefire-plugin 2.4.3 org.codehaus.modello modello-maven-plugin @project.version@ 1.0.0 true src/main/mdo/thing.mdo standard java modello-maven-plugin-1.1/src/it/clone-java5/src/0000755000175000017500000000000011260155733020473 5ustar mkochmkochmodello-maven-plugin-1.1/src/it/clone-java5/src/test/0000755000175000017500000000000011260155733021452 5ustar mkochmkochmodello-maven-plugin-1.1/src/it/clone-java5/src/test/java/0000755000175000017500000000000011260155733022373 5ustar mkochmkochmodello-maven-plugin-1.1/src/it/clone-java5/src/test/java/test/0000755000175000017500000000000011260155733023352 5ustar mkochmkochmodello-maven-plugin-1.1/src/it/clone-java5/src/test/java/test/CloneTest.java0000644000175000017500000000727211221417324026117 0ustar mkochmkochpackage test; import java.util.Date; import org.codehaus.plexus.util.xml.Xpp3Dom; import junit.framework.TestCase; public class CloneTest extends TestCase { public void testNullSafe() throws Exception { Thing orig = new Thing(); Thing copy = (Thing) orig.clone(); assertNotNull( copy ); assertNotSame( orig, copy ); } public void testClone() throws Exception { Thing orig = new Thing(); orig.setSomeBoolean( true ); orig.setSomeChar( 'X' ); orig.setSomeByte( (byte) 7 ); orig.setSomeShort( (short) 11 ); orig.setSomeInt( 13 ); orig.setSomeLong( 17 ); orig.setSomeFloat( -2.5f ); orig.setSomeDouble( 3.14 ); orig.setSomeString( "test" ); orig.setSomeDate( new Date() ); orig.setSomeDom( new Xpp3Dom( "test" ) ); orig.addSomeStringList( "string" ); orig.addSomeStringSet( "string" ); orig.setDeepThingy( new Thingy() ); orig.addDeepThingyList( new Thingy() ); orig.addDeepThingySet( new Thingy() ); orig.setShallowThingy( new Thingy() ); orig.addShallowThingyList( new Thingy() ); orig.addShallowThingySet( new Thingy() ); orig.addSomeProperty( "key", "value" ); orig.customProperties.setProperty( "key", "value" ); // NOTE: This has no cast and checks for covariant return value Thing copy = orig.clone(); assertNotNull( copy ); assertNotSame( orig, copy ); assertEquals( orig.isSomeBoolean(), copy.isSomeBoolean() ); assertEquals( orig.getSomeChar(), copy.getSomeChar() ); assertEquals( orig.getSomeByte(), copy.getSomeByte() ); assertEquals( orig.getSomeShort(), copy.getSomeShort() ); assertEquals( orig.getSomeInt(), copy.getSomeInt() ); assertEquals( orig.getSomeLong(), copy.getSomeLong() ); assertEquals( orig.getSomeFloat(), copy.getSomeFloat(), 0.1 ); assertEquals( orig.getSomeDouble(), copy.getSomeDouble(), 0.1 ); assertEquals( orig.getSomeString(), copy.getSomeString() ); assertEquals( orig.getSomeDate(), copy.getSomeDate() ); assertNotSame( orig.getSomeDate(), copy.getSomeDate() ); assertEquals( orig.getSomeDom(), copy.getSomeDom() ); assertNotSame( orig.getSomeDom(), copy.getSomeDom() ); assertEquals( orig.getSomeStringList(), copy.getSomeStringList() ); assertNotSame( orig.getSomeStringList(), copy.getSomeStringList() ); assertEquals( orig.getSomeStringSet(), copy.getSomeStringSet() ); assertNotSame( orig.getSomeStringSet(), copy.getSomeStringSet() ); assertNotSame( orig.getDeepThingy(), copy.getDeepThingy() ); assertNotSame( orig.getDeepThingyList(), copy.getDeepThingyList() ); assertNotSame( orig.getDeepThingyList().iterator().next(), copy.getDeepThingyList().iterator().next() ); assertNotSame( orig.getDeepThingySet(), copy.getDeepThingySet() ); assertNotSame( orig.getDeepThingySet().iterator().next(), copy.getDeepThingySet().iterator().next() ); assertSame( orig.getShallowThingy(), copy.getShallowThingy() ); assertNotSame( orig.getShallowThingyList(), copy.getShallowThingyList() ); assertSame( orig.getShallowThingyList().iterator().next(), copy.getShallowThingyList().iterator().next() ); assertNotSame( orig.getShallowThingySet(), copy.getShallowThingySet() ); assertSame( orig.getShallowThingySet().iterator().next(), copy.getShallowThingySet().iterator().next() ); assertEquals( orig.customProperties, copy.customProperties ); assertNotSame( orig.customProperties, copy.customProperties ); } } modello-maven-plugin-1.1/src/it/clone-java5/src/main/0000755000175000017500000000000011260155733021417 5ustar mkochmkochmodello-maven-plugin-1.1/src/it/clone-java5/src/main/mdo/0000755000175000017500000000000011260155733022176 5ustar mkochmkochmodello-maven-plugin-1.1/src/it/clone-java5/src/main/mdo/thing.mdo0000644000175000017500000001355311221417324024011 0ustar mkochmkoch thing Thing package test SuperThing 1.0.0 Thing SuperThing 1.0.0 someBoolean 1.0.0 boolean someChar 1.0.0 char someByte 1.0.0 byte someShort 1.0.0 short someInt 1.0.0 int someLong 1.0.0 long someFloat 1.0.0 float someDouble 1.0.0 double someString 1.0.0 String someDate 1.0.0 Date someDom 1.0.0 DOM someProperties 1.0.0 Properties String * someStringList 1.0.0 List String * someStringSet 1.0.0 Set String * deepThingy 1.0.0 Thingy 1 deepThingyList 1.0.0 List Thingy * deepThingySet 1.0.0 Set Thingy * shallowThingy 1.0.0 Thingy 1 shallowThingyList 1.0.0 List Thingy * shallowThingySet 1.0.0 Set Thingy * 1.0.0 Thingy SuperThing 1.0.0 modello-maven-plugin-1.1/src/it/settings.xml0000644000175000017500000000317411221417324020161 0ustar mkochmkoch it-repo true local.central @localRepositoryUrl@ true true local.central @localRepositoryUrl@ true true modello-maven-plugin-1.1/src/it/clone/0000755000175000017500000000000011260155733016700 5ustar mkochmkochmodello-maven-plugin-1.1/src/it/clone/pom.xml0000644000175000017500000000407611221417324020216 0ustar mkochmkoch 4.0.0 org.codehaus.modello.its clone 0.1-SNAPSHOT Clone IT Test the generation of clone() methods. org.codehaus.plexus plexus-utils @plexusUtilsVersion@ junit junit @junitVersion@ test org.apache.maven.plugins maven-compiler-plugin 2.0.2 1.4 1.4 org.apache.maven.plugins maven-resources-plugin 2.2 org.apache.maven.plugins maven-surefire-plugin 2.4.3 org.codehaus.modello modello-maven-plugin @project.version@ 1.0.0 src/main/mdo/thing.mdo standard java modello-maven-plugin-1.1/src/it/clone/src/0000755000175000017500000000000011260155733017467 5ustar mkochmkochmodello-maven-plugin-1.1/src/it/clone/src/test/0000755000175000017500000000000011260155733020446 5ustar mkochmkochmodello-maven-plugin-1.1/src/it/clone/src/test/java/0000755000175000017500000000000011260155733021367 5ustar mkochmkochmodello-maven-plugin-1.1/src/it/clone/src/test/java/test/0000755000175000017500000000000011260155733022346 5ustar mkochmkochmodello-maven-plugin-1.1/src/it/clone/src/test/java/test/CloneTest.java0000644000175000017500000000717211221417324025112 0ustar mkochmkochpackage test; import java.util.Date; import org.codehaus.plexus.util.xml.Xpp3Dom; import junit.framework.TestCase; public class CloneTest extends TestCase { public void testNullSafe() throws Exception { Thing orig = new Thing(); Thing copy = (Thing) orig.clone(); assertNotNull( copy ); assertNotSame( orig, copy ); } public void testClone() throws Exception { Thing orig = new Thing(); orig.setSomeBoolean( true ); orig.setSomeChar( 'X' ); orig.setSomeByte( (byte) 7 ); orig.setSomeShort( (short) 11 ); orig.setSomeInt( 13 ); orig.setSomeLong( 17 ); orig.setSomeFloat( -2.5f ); orig.setSomeDouble( 3.14 ); orig.setSomeString( "test" ); orig.setSomeDate( new Date() ); orig.setSomeDom( new Xpp3Dom( "test" ) ); orig.addSomeStringList( "string" ); orig.addSomeStringSet( "string" ); orig.setDeepThingy( new Thingy() ); orig.addDeepThingyList( new Thingy() ); orig.addDeepThingySet( new Thingy() ); orig.setShallowThingy( new Thingy() ); orig.addShallowThingyList( new Thingy() ); orig.addShallowThingySet( new Thingy() ); orig.addSomeProperty( "key", "value" ); orig.customProperties.setProperty( "key", "value" ); Thing copy = (Thing) orig.clone(); assertNotNull( copy ); assertNotSame( orig, copy ); assertEquals( orig.isSomeBoolean(), copy.isSomeBoolean() ); assertEquals( orig.getSomeChar(), copy.getSomeChar() ); assertEquals( orig.getSomeByte(), copy.getSomeByte() ); assertEquals( orig.getSomeShort(), copy.getSomeShort() ); assertEquals( orig.getSomeInt(), copy.getSomeInt() ); assertEquals( orig.getSomeLong(), copy.getSomeLong() ); assertEquals( orig.getSomeFloat(), copy.getSomeFloat(), 0.1 ); assertEquals( orig.getSomeDouble(), copy.getSomeDouble(), 0.1 ); assertEquals( orig.getSomeString(), copy.getSomeString() ); assertEquals( orig.getSomeDate(), copy.getSomeDate() ); assertNotSame( orig.getSomeDate(), copy.getSomeDate() ); assertEquals( orig.getSomeDom(), copy.getSomeDom() ); assertNotSame( orig.getSomeDom(), copy.getSomeDom() ); assertEquals( orig.getSomeStringList(), copy.getSomeStringList() ); assertNotSame( orig.getSomeStringList(), copy.getSomeStringList() ); assertEquals( orig.getSomeStringSet(), copy.getSomeStringSet() ); assertNotSame( orig.getSomeStringSet(), copy.getSomeStringSet() ); assertNotSame( orig.getDeepThingy(), copy.getDeepThingy() ); assertNotSame( orig.getDeepThingyList(), copy.getDeepThingyList() ); assertNotSame( orig.getDeepThingyList().iterator().next(), copy.getDeepThingyList().iterator().next() ); assertNotSame( orig.getDeepThingySet(), copy.getDeepThingySet() ); assertNotSame( orig.getDeepThingySet().iterator().next(), copy.getDeepThingySet().iterator().next() ); assertSame( orig.getShallowThingy(), copy.getShallowThingy() ); assertNotSame( orig.getShallowThingyList(), copy.getShallowThingyList() ); assertSame( orig.getShallowThingyList().iterator().next(), copy.getShallowThingyList().iterator().next() ); assertNotSame( orig.getShallowThingySet(), copy.getShallowThingySet() ); assertSame( orig.getShallowThingySet().iterator().next(), copy.getShallowThingySet().iterator().next() ); assertEquals( orig.customProperties, copy.customProperties ); assertNotSame( orig.customProperties, copy.customProperties ); } } modello-maven-plugin-1.1/src/it/clone/src/main/0000755000175000017500000000000011260155733020413 5ustar mkochmkochmodello-maven-plugin-1.1/src/it/clone/src/main/mdo/0000755000175000017500000000000011260155733021172 5ustar mkochmkochmodello-maven-plugin-1.1/src/it/clone/src/main/mdo/thing.mdo0000644000175000017500000001355311221417324023005 0ustar mkochmkoch thing Thing package test SuperThing 1.0.0 Thing SuperThing 1.0.0 someBoolean 1.0.0 boolean someChar 1.0.0 char someByte 1.0.0 byte someShort 1.0.0 short someInt 1.0.0 int someLong 1.0.0 long someFloat 1.0.0 float someDouble 1.0.0 double someString 1.0.0 String someDate 1.0.0 Date someDom 1.0.0 DOM someProperties 1.0.0 Properties String * someStringList 1.0.0 List String * someStringSet 1.0.0 Set String * deepThingy 1.0.0 Thingy 1 deepThingyList 1.0.0 List Thingy * deepThingySet 1.0.0 Set Thingy * shallowThingy 1.0.0 Thingy 1 shallowThingyList 1.0.0 List Thingy * shallowThingySet 1.0.0 Set Thingy * 1.0.0 Thingy SuperThing 1.0.0 modello-maven-plugin-1.1/src/main/0000755000175000017500000000000011260155732016107 5ustar mkochmkochmodello-maven-plugin-1.1/src/main/java/0000755000175000017500000000000011260155732017030 5ustar mkochmkochmodello-maven-plugin-1.1/src/main/java/org/0000755000175000017500000000000011260155732017617 5ustar mkochmkochmodello-maven-plugin-1.1/src/main/java/org/codehaus/0000755000175000017500000000000011260155732021412 5ustar mkochmkochmodello-maven-plugin-1.1/src/main/java/org/codehaus/modello/0000755000175000017500000000000011260155732023045 5ustar mkochmkochmodello-maven-plugin-1.1/src/main/java/org/codehaus/modello/maven/0000755000175000017500000000000011260155733024154 5ustar mkochmkochmodello-maven-plugin-1.1/src/main/java/org/codehaus/modello/maven/ModelloXsdMojo.java0000644000175000017500000000517511127177254027732 0ustar mkochmkochpackage org.codehaus.modello.maven; /* * Copyright (c) 2004, Codehaus.org * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ import java.io.File; import java.util.Properties; import org.codehaus.modello.ModelloParameterConstants; /** * Creates an XML schema from the model. * * @goal xsd * * @phase generate-sources * * @author Brett Porter * @version $Id: ModelloXsdMojo.java 1081 2009-01-01 17:34:36Z hboutemy $ */ public class ModelloXsdMojo extends AbstractModelloGeneratorMojo { /** * The output directory of the generated XML Schema. Hint: if you want to publish the schema automatically with * the site, configure this parameter to ${basedir}/target/generated-site/resources/xsd. * * @parameter expression="${basedir}/target/generated-site/xsd" * * @required */ private File outputDirectory; /** * * @parameter * * @since 1.0-alpha-21 */ private String xsdFileName; protected String getGeneratorType() { return "xsd"; } protected void customizeParameters( Properties parameters ) { super.customizeParameters( parameters ); if ( xsdFileName != null ) { parameters.put( ModelloParameterConstants.OUTPUT_XSD_FILE_NAME, xsdFileName ); } } protected boolean producesCompilableResult() { return false; } public File getOutputDirectory() { return outputDirectory; } public void setOutputDirectory( File outputDirectory ) { this.outputDirectory = outputDirectory; } } modello-maven-plugin-1.1/src/main/java/org/codehaus/modello/maven/ModelloXdocMojo.java0000644000175000017500000000634711043272564030070 0ustar mkochmkochpackage org.codehaus.modello.maven; /* * Copyright (c) 2004, Codehaus.org * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ import org.codehaus.modello.ModelloParameterConstants; import java.io.File; import java.util.Properties; /** * Creates documentation for the model in xdoc format. * * @goal xdoc * * @author Brett Porter * @version $Id: ModelloXdocMojo.java 914 2008-07-28 07:29:56Z olamy $ */ public class ModelloXdocMojo extends AbstractModelloGeneratorMojo { /** * The output directory of the generated documentation. * * @parameter expression="${basedir}/target/generated-site/xdoc" * * @required */ private File outputDirectory; /** * * @parameter * * @since 1.0-alpha-21 */ private String xdocFileName; /** * The first version of the model. This is used to decide whether or not * to show the since column. If this is not specified, it defaults to the * version of the model, which in turn means that the since column will not * be shown. * * @parameter * @since 1.0-alpha-14 */ private String firstVersion; protected String getGeneratorType() { return "xdoc"; } protected boolean producesCompilableResult() { return false; } public File getOutputDirectory() { return outputDirectory; } public void setOutputDirectory( File outputDirectory ) { this.outputDirectory = outputDirectory; } protected void customizeParameters( Properties parameters ) { super.customizeParameters( parameters ); // Use version if firstVersion was not specified if ( firstVersion == null ) { firstVersion = getVersion(); } parameters.put( ModelloParameterConstants.FIRST_VERSION, firstVersion ); if ( xdocFileName != null ) { parameters.put( ModelloParameterConstants.OUTPUT_XDOC_FILE_NAME, xdocFileName ); } } public String getFirstVersion() { return firstVersion; } public void setFirstVersion( String firstVersion ) { this.firstVersion = firstVersion; } } modello-maven-plugin-1.1/src/main/java/org/codehaus/modello/maven/ModelloXpp3WriterMojo.java0000644000175000017500000000372610544333624031220 0ustar mkochmkochpackage org.codehaus.modello.maven; import java.io.File; /* * Copyright (c) 2004, Codehaus.org * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /** * Creates an XPP3 writer from the model. * * @goal xpp3-writer * * @phase generate-sources * * @author Brett Porter * @version $Id: ModelloXpp3WriterMojo.java 765 2006-12-27 00:00:20Z aheritier $ */ public class ModelloXpp3WriterMojo extends AbstractModelloGeneratorMojo { /** * The output directory of the generated XPP writer. * * @parameter expression="${basedir}/target/generated-sources/modello" * * @required */ private File outputDirectory; protected String getGeneratorType() { return "xpp3-writer"; } public File getOutputDirectory() { return outputDirectory; } public void setOutputDirectory( File outputDirectory ) { this.outputDirectory = outputDirectory; } } modello-maven-plugin-1.1/src/main/java/org/codehaus/modello/maven/ModelloDom4jWriterMojo.java0000644000175000017500000000145711214024744031335 0ustar mkochmkochpackage org.codehaus.modello.maven; import java.io.File; /** * Creates a DOM4J writer from the model. * * @version $Id: ModelloDom4jWriterMojo.java 1244 2009-06-10 21:47:16Z olamy $ * @goal dom4j-writer * @phase generate-sources */ public class ModelloDom4jWriterMojo extends AbstractModelloGeneratorMojo { /** * The output directory of the generated DOM4J reader. * * @parameter expression="${basedir}/target/generated-sources/modello" * @required */ private File outputDirectory; protected String getGeneratorType() { return "dom4j-writer"; } public File getOutputDirectory() { return outputDirectory; } public void setOutputDirectory( File outputDirectory ) { this.outputDirectory = outputDirectory; } } modello-maven-plugin-1.1/src/main/java/org/codehaus/modello/maven/AbstractModelloGeneratorMojo.java0000644000175000017500000002523611145330132032570 0ustar mkochmkochpackage org.codehaus.modello.maven; /* * Copyright (c) 2004, Codehaus.org * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Properties; import org.apache.maven.model.Resource; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.project.MavenProject; import org.codehaus.modello.ModelloException; import org.codehaus.modello.ModelloParameterConstants; import org.codehaus.modello.core.ModelloCore; import org.codehaus.modello.model.Model; import org.codehaus.modello.model.ModelValidationException; import org.sonatype.plexus.build.incremental.BuildContext; import org.codehaus.plexus.util.StringUtils; /** * @author Trygve Laugstøl * @version $Id: AbstractModelloGeneratorMojo.java 1184 2009-02-13 17:39:38Z igorife $ */ public abstract class AbstractModelloGeneratorMojo extends AbstractMojo { // ---------------------------------------------------------------------- // Parameters // ---------------------------------------------------------------------- /** * Base directory of the project. * * @parameter expression="${basedir}" * @required */ private String basedir; /** * List of relative paths to mdo files containing the models. * * @parameter * @required */ private String[] models; /** * The version of the model we will be working on. * * @parameter expression="${version}" * @required */ private String version; /** * The encoding to use when generating Java source files. * * @parameter expression="${encoding}" default-value="${project.build.sourceEncoding}" * @since 1.0-alpha-19 */ private String encoding; /** * True if the generated package names should include the version. * * @parameter expression="${packageWithVersion}" default-value="false" * @required */ private boolean packageWithVersion; /** *

Note: This is passed by Maven and must not be configured by the user.

* * @component */ private ModelloCore modelloCore; /** * The Maven project instance for the executing project. * * @parameter expression="${project}" * @required */ private MavenProject project; /** * Additional historical versions to generate, each being packaged with the version regardless of the * packageWithVersion setting. * * @parameter */ private List/**/ packagedVersions = Collections.EMPTY_LIST; /** * Generate Java 5 sources, with generic collections. * * @parameter expression="${useJava5}" default-value="false" */ private boolean useJava5; /** @component */ private BuildContext buildContext; // ---------------------------------------------------------------------- // Overridables // ---------------------------------------------------------------------- protected abstract String getGeneratorType(); public abstract File getOutputDirectory(); protected boolean producesCompilableResult() { return true; } protected boolean producesResources() { return false; } /** * Creates a Properties objects. *

* The abstract mojo will override the output directory, the version and the * package with version flag. * * @return the parameters */ protected Properties createParameters() { return new Properties(); } /** * Override this method to customize the values in the properties set. *

* This method will be called after the parameters have been populated with the * parameters in the abstract mojo. * * @param parameters the parameters to customize */ protected void customizeParameters( Properties parameters ) { } // ---------------------------------------------------------------------- // // ---------------------------------------------------------------------- public void execute() throws MojoExecutionException { String outputDirectory = getOutputDirectory().getAbsolutePath(); getLog().info( "outputDirectory: " + outputDirectory ); // ---------------------------------------------------------------------- // Initialize the parameters // ---------------------------------------------------------------------- Properties parameters = createParameters(); parameters.setProperty( ModelloParameterConstants.OUTPUT_DIRECTORY, outputDirectory ); parameters.setProperty( ModelloParameterConstants.VERSION, version ); parameters.setProperty( ModelloParameterConstants.PACKAGE_WITH_VERSION, Boolean.toString( packageWithVersion ) ); parameters.setProperty( ModelloParameterConstants.ALL_VERSIONS, StringUtils.join( packagedVersions.iterator(), "," ) ); parameters.setProperty( ModelloParameterConstants.USE_JAVA5, Boolean.toString( useJava5 ) ); if ( encoding != null ) { parameters.setProperty( ModelloParameterConstants.ENCODING, encoding ); } customizeParameters( parameters ); // ---------------------------------------------------------------------- // // ---------------------------------------------------------------------- try { for ( int i = 0; i < models.length; i++ ) { doExecute( models[i], outputDirectory, parameters ); } } catch ( FileNotFoundException e ) { throw new MojoExecutionException( "Couldn't find file.", e ); } catch ( ModelloException e ) { throw new MojoExecutionException( "Error generating.", e ); } catch ( ModelValidationException e ) { throw new MojoExecutionException( "Error generating.", e ); } catch ( IOException e ) { throw new MojoExecutionException( "Couldn't read file.", e ); } } /** * Performs execute on a single specified model. * * @param modelStr * @param parameters * @param outputDirectory * @throws IOException * @throws ModelloException * @throws ModelValidationException */ private void doExecute( String modelStr, String outputDirectory, Properties parameters ) throws IOException, ModelloException, ModelValidationException { if ( !buildContext.hasDelta( modelStr ) ) { getLog().debug( "Skipping unchanged model: " + modelStr ); return; } getLog().info( "Working on model: " + modelStr ); Model model = modelloCore.loadModel( new File( basedir, modelStr ) ); // TODO: dynamically resolve/load the generator type getLog().info( "Generating current version: " + version ); modelloCore.generate( model, getGeneratorType(), parameters ); for ( Iterator i = packagedVersions.iterator(); i.hasNext(); ) { String version = (String) i.next(); parameters.setProperty( ModelloParameterConstants.VERSION, version ); parameters.setProperty( ModelloParameterConstants.PACKAGE_WITH_VERSION, Boolean.toString( true ) ); getLog().info( "Generating packaged version: " + version ); modelloCore.generate( model, getGeneratorType(), parameters ); } if ( producesCompilableResult() && project != null ) { project.addCompileSourceRoot( outputDirectory ); } if ( producesResources() && project != null ) { Resource resource = new Resource(); resource.setDirectory( outputDirectory ); project.addResource( resource ); } } // ---------------------------------------------------------------------- // Accessors // ---------------------------------------------------------------------- public String getBasedir() { return basedir; } public void setBasedir( String basedir ) { this.basedir = basedir; } public String getVersion() { return version; } public void setVersion( String version ) { this.version = version; } public boolean getPackageWithVersion() { return packageWithVersion; } public void setPackageWithVersion( boolean packageWithVersion ) { this.packageWithVersion = packageWithVersion; } public ModelloCore getModelloCore() { return modelloCore; } public void setModelloCore( ModelloCore modelloCore ) { this.modelloCore = modelloCore; } public void setBuildContext( BuildContext context ) { this.buildContext = context; } public MavenProject getProject() { return project; } public void setProject( MavenProject project ) { this.project = project; } public void setPackagedVersions( List/**/ packagedVersions ) { this.packagedVersions = Collections.unmodifiableList( packagedVersions ); } /** * @return Returns the paths to the models. */ public String[] getModels() { return models; } /** * @param models Sets the paths to the models. */ public void setModels( String[] models ) { this.models = models; } } modello-maven-plugin-1.1/src/main/java/org/codehaus/modello/maven/ModelloDom4jReaderMojo.java0000644000175000017500000000145711214024744031263 0ustar mkochmkochpackage org.codehaus.modello.maven; import java.io.File; /** * Creates a DOM4J reader from the model. * * @version $Id: ModelloDom4jReaderMojo.java 1244 2009-06-10 21:47:16Z olamy $ * @goal dom4j-reader * @phase generate-sources */ public class ModelloDom4jReaderMojo extends AbstractModelloGeneratorMojo { /** * The output directory of the generated DOM4J reader. * * @parameter expression="${basedir}/target/generated-sources/modello" * @required */ private File outputDirectory; protected String getGeneratorType() { return "dom4j-reader"; } public File getOutputDirectory() { return outputDirectory; } public void setOutputDirectory( File outputDirectory ) { this.outputDirectory = outputDirectory; } } modello-maven-plugin-1.1/src/main/java/org/codehaus/modello/maven/ModelloJDOMWriterMojo.java0000644000175000017500000000377211127507731031120 0ustar mkochmkoch/* * Copyright (c) 2004, Codehaus.org * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.codehaus.modello.maven; import java.io.File; /** * Creates a jdom writer from the model that is capable of preserving element ordering * and comments. In future it should also preserve whitespace. * * @goal jdom-writer * * @phase generate-sources * * @author Milos Kleint * */ public class ModelloJDOMWriterMojo extends AbstractModelloGeneratorMojo { /** * The output directory of the generated jdom writer. * * @parameter expression="${basedir}/target/generated-sources/modello" * * @required */ private File outputDirectory; protected String getGeneratorType() { return "jdom-writer"; } public File getOutputDirectory() { return outputDirectory; } public void setOutputDirectory( File outputDirectory ) { this.outputDirectory = outputDirectory; } } modello-maven-plugin-1.1/src/main/java/org/codehaus/modello/maven/ModelloXpp3ReaderMojo.java0000644000175000017500000000372610544333624031146 0ustar mkochmkochpackage org.codehaus.modello.maven; import java.io.File; /* * Copyright (c) 2004, Codehaus.org * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /** * Creates an XPP3 reader from the model. * * @goal xpp3-reader * * @phase generate-sources * * @author Brett Porter * @version $Id: ModelloXpp3ReaderMojo.java 765 2006-12-27 00:00:20Z aheritier $ */ public class ModelloXpp3ReaderMojo extends AbstractModelloGeneratorMojo { /** * The output directory of the generated XPP reader. * * @parameter expression="${basedir}/target/generated-sources/modello" * * @required */ private File outputDirectory; protected String getGeneratorType() { return "xpp3-reader"; } public File getOutputDirectory() { return outputDirectory; } public void setOutputDirectory( File outputDirectory ) { this.outputDirectory = outputDirectory; } } modello-maven-plugin-1.1/src/main/java/org/codehaus/modello/maven/ModelloStaxReaderMojo.java0000644000175000017500000000155311127507731031227 0ustar mkochmkochpackage org.codehaus.modello.maven; import java.io.File; /** * Creates an StAX reader from the model. * * @author Brett Porter * @version $Id: ModelloStaxReaderMojo.java 1094 2009-01-02 22:06:17Z hboutemy $ * @goal stax-reader * @phase generate-sources */ public class ModelloStaxReaderMojo extends AbstractModelloGeneratorMojo { /** * The output directory of the generated StAX reader. * * @parameter expression="${basedir}/target/generated-sources/modello" * @required */ private File outputDirectory; protected String getGeneratorType() { return "stax-reader"; } public File getOutputDirectory() { return outputDirectory; } public void setOutputDirectory( File outputDirectory ) { this.outputDirectory = outputDirectory; } } modello-maven-plugin-1.1/src/main/java/org/codehaus/modello/maven/ModelloConvertersMojo.java0000644000175000017500000000161311127507731031314 0ustar mkochmkochpackage org.codehaus.modello.maven; import java.io.File; /** * Creates classes that can convert between different versions of the model. * * @author Brett Porter * @version $Id: ModelloConvertersMojo.java 1094 2009-01-02 22:06:17Z hboutemy $ * @goal converters * @phase generate-sources */ public class ModelloConvertersMojo extends AbstractModelloGeneratorMojo { /** * The output directory of the generated Java beans. * * @parameter expression="${basedir}/target/generated-sources/modello" * @required */ private File outputDirectory; protected String getGeneratorType() { return "converters"; } public File getOutputDirectory() { return outputDirectory; } public void setOutputDirectory( File outputDirectory ) { this.outputDirectory = outputDirectory; } } modello-maven-plugin-1.1/src/main/java/org/codehaus/modello/maven/ModelloJavaMojo.java0000644000175000017500000000367110530601337030043 0ustar mkochmkochpackage org.codehaus.modello.maven; /* * Copyright (c) 2004, Codehaus.org * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ import java.io.File; /** * Creates Java beans from the Modello model. * * @author Trygve Laugstøl * @version $Id: ModelloJavaMojo.java 688 2006-11-21 13:45:03Z brett $ * @goal java * @phase generate-sources */ public class ModelloJavaMojo extends AbstractModelloGeneratorMojo { /** * The output directory of the generated Java beans. * * @parameter expression="${basedir}/target/generated-sources/modello" * @required */ private File outputDirectory; protected String getGeneratorType() { return "java"; } public File getOutputDirectory() { return outputDirectory; } public void setOutputDirectory( File outputDirectory ) { this.outputDirectory = outputDirectory; } } modello-maven-plugin-1.1/src/main/java/org/codehaus/modello/maven/ModelloStaxWriterMojo.java0000644000175000017500000000155311127507731031301 0ustar mkochmkochpackage org.codehaus.modello.maven; import java.io.File; /** * Creates an StAX writer from the model. * * @author Brett Porter * @version $Id: ModelloStaxWriterMojo.java 1094 2009-01-02 22:06:17Z hboutemy $ * @goal stax-writer * @phase generate-sources */ public class ModelloStaxWriterMojo extends AbstractModelloGeneratorMojo { /** * The output directory of the generated StAX writer. * * @parameter expression="${basedir}/target/generated-sources/modello" * @required */ private File outputDirectory; protected String getGeneratorType() { return "stax-writer"; } public File getOutputDirectory() { return outputDirectory; } public void setOutputDirectory( File outputDirectory ) { this.outputDirectory = outputDirectory; } } modello-maven-plugin-1.1/src/main/java/org/codehaus/modello/maven/ModelloGenerateMojo.java0000644000175000017500000001034611127507731030717 0ustar mkochmkochpackage org.codehaus.modello.maven; /* * Copyright (c) 2007, Codehaus.org * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ import org.apache.maven.plugin.MojoExecutionException; import java.io.File; import java.util.Map; /** *

* ModelloGenerateMojo - A dynamic way to use generators and modello plugins. *

* *

* Example Usage: *

*
 *   <plugin>
 *     <groupId>org.codehaus.modello</groupId>
 *     <artifactId>modello-maven-plugin</artifactId>
 *     <version>1.0-alpha-15-SNAPSHOT</version>
 *     <dependencies>
 *       <dependency>
 *         <groupId>org.codehaus.modello</groupId>
 *         <artifactId>modello-plugin-jpa</artifactId>
 *         <version>1.0.0-SNAPSHOT</version>
 *       </dependency>
 *     </dependencies>
 *     <configuration>
 *       <version>1.0.0</version>
 *       <packageWithVersion>false</packageWithVersion>
 *       <models>
 *         <model>src/main/mdo/project-model.xml</model>
 *       </models>
 *     </configuration>
 *     <executions>
 *       <execution>
 *         <id>java</id>
 *         <goals>
 *           <goal>generate</goal>
 *         </goals>
 *         <configuration>
 *           <generatorId>java</generatorId>
 *         </configuration>
 *       </execution>
 *       <execution>
 *         <id>jpa</id>
 *         <goals>
 *           <goal>generate</goal>
 *         </goals>
 *         <configuration>
 *           <generatorId>jpa-mapping</generatorId>
 *         </configuration>
 *       </execution>
 *     </executions>
 *   </plugin>
 * 
* * @author Joakim Erdfelt * @version $Id: ModelloGenerateMojo.java 1094 2009-01-02 22:06:17Z hboutemy $ * * @goal generate * @phase generate-sources * @description Execute a Modello Generator. */ public class ModelloGenerateMojo extends AbstractModelloGeneratorMojo { /** * @component role="org.codehaus.modello.plugin.ModelloGenerator" * @required */ private Map generatorMap; /** * @parameter expression="${modello.generator.id}" default-value="java" */ private String generatorId; /** * The output directory of the generated source files. * * @parameter expression="${basedir}/target/generated-sources/modello" * @required */ private File outputDirectory; protected String getGeneratorType() { return generatorId; } public File getOutputDirectory() { return outputDirectory; } public void execute() throws MojoExecutionException { if ( !generatorMap.containsKey( generatorId ) ) { throw new MojoExecutionException( "Unable to execute modello, generator id [" + generatorId + "] not found. (Available generator ids : " + generatorMap.keySet() + ")" ); } getLog().info( "[modello:generate {generator: " + generatorId + "}]" ); super.execute(); } }