modello-maven-plugin-1.1/src/it/ 0000755 0001750 0001750 00000000000 11260155733 015600 5 ustar mkoch mkoch modello-maven-plugin-1.1/src/it/clone-java5/ 0000755 0001750 0001750 00000000000 11260155733 017704 5 ustar mkoch mkoch modello-maven-plugin-1.1/src/it/clone-java5/pom.xml 0000644 0001750 0001750 00000004142 11221417324 021214 0 ustar mkoch mkoch
4.0.0org.codehaus.modello.itsclone0.1-SNAPSHOTClone IT
Test the generation of clone() methods.
org.codehaus.plexusplexus-utils@plexusUtilsVersion@junitjunit@junitVersion@testorg.apache.maven.pluginsmaven-compiler-plugin2.0.21.51.5org.apache.maven.pluginsmaven-resources-plugin2.2org.apache.maven.pluginsmaven-surefire-plugin2.4.3org.codehaus.modellomodello-maven-plugin@project.version@1.0.0truesrc/main/mdo/thing.mdostandardjava
modello-maven-plugin-1.1/src/it/clone-java5/src/ 0000755 0001750 0001750 00000000000 11260155733 020473 5 ustar mkoch mkoch modello-maven-plugin-1.1/src/it/clone-java5/src/test/ 0000755 0001750 0001750 00000000000 11260155733 021452 5 ustar mkoch mkoch modello-maven-plugin-1.1/src/it/clone-java5/src/test/java/ 0000755 0001750 0001750 00000000000 11260155733 022373 5 ustar mkoch mkoch modello-maven-plugin-1.1/src/it/clone-java5/src/test/java/test/ 0000755 0001750 0001750 00000000000 11260155733 023352 5 ustar mkoch mkoch modello-maven-plugin-1.1/src/it/clone-java5/src/test/java/test/CloneTest.java 0000644 0001750 0001750 00000007272 11221417324 026117 0 ustar mkoch mkoch package 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/ 0000755 0001750 0001750 00000000000 11260155733 021417 5 ustar mkoch mkoch modello-maven-plugin-1.1/src/it/clone-java5/src/main/mdo/ 0000755 0001750 0001750 00000000000 11260155733 022176 5 ustar mkoch mkoch modello-maven-plugin-1.1/src/it/clone-java5/src/main/mdo/thing.mdo 0000644 0001750 0001750 00000013553 11221417324 024011 0 ustar mkoch mkoch
thingThingpackagetestSuperThing1.0.0ThingSuperThing1.0.0someBoolean1.0.0booleansomeChar1.0.0charsomeByte1.0.0bytesomeShort1.0.0shortsomeInt1.0.0intsomeLong1.0.0longsomeFloat1.0.0floatsomeDouble1.0.0doublesomeString1.0.0StringsomeDate1.0.0DatesomeDom1.0.0DOMsomeProperties1.0.0PropertiesString*someStringList1.0.0ListString*someStringSet1.0.0SetString*deepThingy1.0.0Thingy1deepThingyList1.0.0ListThingy*deepThingySet1.0.0SetThingy*shallowThingy1.0.0Thingy1shallowThingyList1.0.0ListThingy*shallowThingySet1.0.0SetThingy*1.0.0ThingySuperThing1.0.0
modello-maven-plugin-1.1/src/it/settings.xml 0000644 0001750 0001750 00000003174 11221417324 020161 0 ustar mkoch mkoch
it-repotruelocal.central@localRepositoryUrl@truetruelocal.central@localRepositoryUrl@truetrue
modello-maven-plugin-1.1/src/it/clone/ 0000755 0001750 0001750 00000000000 11260155733 016700 5 ustar mkoch mkoch modello-maven-plugin-1.1/src/it/clone/pom.xml 0000644 0001750 0001750 00000004076 11221417324 020216 0 ustar mkoch mkoch
4.0.0org.codehaus.modello.itsclone0.1-SNAPSHOTClone IT
Test the generation of clone() methods.
org.codehaus.plexusplexus-utils@plexusUtilsVersion@junitjunit@junitVersion@testorg.apache.maven.pluginsmaven-compiler-plugin2.0.21.41.4org.apache.maven.pluginsmaven-resources-plugin2.2org.apache.maven.pluginsmaven-surefire-plugin2.4.3org.codehaus.modellomodello-maven-plugin@project.version@1.0.0src/main/mdo/thing.mdostandardjava
modello-maven-plugin-1.1/src/it/clone/src/ 0000755 0001750 0001750 00000000000 11260155733 017467 5 ustar mkoch mkoch modello-maven-plugin-1.1/src/it/clone/src/test/ 0000755 0001750 0001750 00000000000 11260155733 020446 5 ustar mkoch mkoch modello-maven-plugin-1.1/src/it/clone/src/test/java/ 0000755 0001750 0001750 00000000000 11260155733 021367 5 ustar mkoch mkoch modello-maven-plugin-1.1/src/it/clone/src/test/java/test/ 0000755 0001750 0001750 00000000000 11260155733 022346 5 ustar mkoch mkoch modello-maven-plugin-1.1/src/it/clone/src/test/java/test/CloneTest.java 0000644 0001750 0001750 00000007172 11221417324 025112 0 ustar mkoch mkoch package 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/ 0000755 0001750 0001750 00000000000 11260155733 020413 5 ustar mkoch mkoch modello-maven-plugin-1.1/src/it/clone/src/main/mdo/ 0000755 0001750 0001750 00000000000 11260155733 021172 5 ustar mkoch mkoch modello-maven-plugin-1.1/src/it/clone/src/main/mdo/thing.mdo 0000644 0001750 0001750 00000013553 11221417324 023005 0 ustar mkoch mkoch
thingThingpackagetestSuperThing1.0.0ThingSuperThing1.0.0someBoolean1.0.0booleansomeChar1.0.0charsomeByte1.0.0bytesomeShort1.0.0shortsomeInt1.0.0intsomeLong1.0.0longsomeFloat1.0.0floatsomeDouble1.0.0doublesomeString1.0.0StringsomeDate1.0.0DatesomeDom1.0.0DOMsomeProperties1.0.0PropertiesString*someStringList1.0.0ListString*someStringSet1.0.0SetString*deepThingy1.0.0Thingy1deepThingyList1.0.0ListThingy*deepThingySet1.0.0SetThingy*shallowThingy1.0.0Thingy1shallowThingyList1.0.0ListThingy*shallowThingySet1.0.0SetThingy*1.0.0ThingySuperThing1.0.0
modello-maven-plugin-1.1/src/main/ 0000755 0001750 0001750 00000000000 11260155732 016107 5 ustar mkoch mkoch modello-maven-plugin-1.1/src/main/java/ 0000755 0001750 0001750 00000000000 11260155732 017030 5 ustar mkoch mkoch modello-maven-plugin-1.1/src/main/java/org/ 0000755 0001750 0001750 00000000000 11260155732 017617 5 ustar mkoch mkoch modello-maven-plugin-1.1/src/main/java/org/codehaus/ 0000755 0001750 0001750 00000000000 11260155732 021412 5 ustar mkoch mkoch modello-maven-plugin-1.1/src/main/java/org/codehaus/modello/ 0000755 0001750 0001750 00000000000 11260155732 023045 5 ustar mkoch mkoch modello-maven-plugin-1.1/src/main/java/org/codehaus/modello/maven/ 0000755 0001750 0001750 00000000000 11260155733 024154 5 ustar mkoch mkoch modello-maven-plugin-1.1/src/main/java/org/codehaus/modello/maven/ModelloXsdMojo.java 0000644 0001750 0001750 00000005175 11127177254 027732 0 ustar mkoch mkoch package 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.java 0000644 0001750 0001750 00000006347 11043272564 030070 0 ustar mkoch mkoch package 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.java 0000644 0001750 0001750 00000003726 10544333624 031220 0 ustar mkoch mkoch package 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.java 0000644 0001750 0001750 00000001457 11214024744 031335 0 ustar mkoch mkoch package 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.java 0000644 0001750 0001750 00000025236 11145330132 032570 0 ustar mkoch mkoch package 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.java 0000644 0001750 0001750 00000001457 11214024744 031263 0 ustar mkoch mkoch package 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.java 0000644 0001750 0001750 00000003772 11127507731 031120 0 ustar mkoch mkoch /*
* 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.java 0000644 0001750 0001750 00000003726 10544333624 031146 0 ustar mkoch mkoch package 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.java 0000644 0001750 0001750 00000001553 11127507731 031227 0 ustar mkoch mkoch package 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.java 0000644 0001750 0001750 00000001613 11127507731 031314 0 ustar mkoch mkoch package 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.java 0000644 0001750 0001750 00000003671 10530601337 030043 0 ustar mkoch mkoch package 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.java 0000644 0001750 0001750 00000001553 11127507731 031301 0 ustar mkoch mkoch package 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.java 0000644 0001750 0001750 00000010346 11127507731 030717 0 ustar mkoch mkoch package 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.
*