diff --git a/sandbox/repoclean/install.sh b/sandbox/repoclean/install.sh new file mode 100644 index 0000000000..8376a0c934 --- /dev/null +++ b/sandbox/repoclean/install.sh @@ -0,0 +1,56 @@ +#!/bin/sh + +echo "" +echo "*******************" +echo "* NOTE: Usage for this script is: 'sh ./install.sh /path/to/install/target /path/to/local/repo'" +echo "*******************" +echo "" + +( + # First, ensure that the repoclean library has been built. + + echo "-----------------------------------------------------------------------" + echo " Building a clean copy of repoclean ... " + echo "-----------------------------------------------------------------------" + m2 clean:clean package + ret=$?; if [ $ret != 0 ]; then exit $ret; fi +) +ret=$?; if [ $ret != 0 ]; then exit $ret; fi + +( + # Now, install the bash script and dependencies to the specified target dir. + + echo "" + echo "-----------------------------------------------------------------------" + echo " Installing repoclean to ${1} ... " + echo "-----------------------------------------------------------------------" + echo "" + + mkdir -p $1/lib && \ + + echo "Copying application libraries..." + echo "" + + cp target/repoclean-1.0-SNAPSHOT.jar $1/lib && \ + cp $2/plexus/jars/plexus-container-default-1.0-alpha-2-SNAPSHOT.jar $1/lib && \ + cp $2/plexus/jars/plexus-utils-1.0-alpha-2-SNAPSHOT.jar $1/lib && \ + cp $2/classworlds/jars/classworlds-1.1-alpha-1.jar $1/lib && \ + + echo "Copying startup script, and changing its permissions to '+x'..." + echo "" + + cp src/main/bash/repoclean.sh $1 && \ + chmod +x $1/repoclean.sh + + ret=$?; if [ $ret != 0 ]; then exit $ret; fi + +) +ret=$?; if [ $ret != 0 ]; then exit $ret; fi + +echo "" +echo "*******************" +echo "* repoclean utility has been installed to: ${1}." +echo "*" +echo "* To run, change to '${1}' and execute './repoclean.sh', which will give further usage instructions." +echo "*******************" +echo "" diff --git a/sandbox/repoclean/pom.xml b/sandbox/repoclean/pom.xml new file mode 100644 index 0000000000..fc7906cf56 --- /dev/null +++ b/sandbox/repoclean/pom.xml @@ -0,0 +1,34 @@ + + 4.0.0 + maven + repoclean + 1.0-SNAPSHOT + Maven v3-to-v4 Repository Cleaner + + + + plexus + plexus-container-default + 1.0-alpha-2-SNAPSHOT + compile + + + plexus + plexus-utils + 1.0-alpha-2-SNAPSHOT + compile + + + classworlds + classworlds + 1.1-alpha-1 + compile + + + junit + junit + 3.8.1 + test + + + \ No newline at end of file diff --git a/sandbox/repoclean/src/main/bash/repoclean.sh b/sandbox/repoclean/src/main/bash/repoclean.sh new file mode 100644 index 0000000000..79a213cb99 --- /dev/null +++ b/sandbox/repoclean/src/main/bash/repoclean.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +CP=./lib/repoclean-1.0-SNAPSHOT.jar +CP=$CP:./lib/plexus-container-default-1.0-alpha-2-SNAPSHOT.jar +CP=$CP:./lib/plexus-utils-1.0-alpha-2-SNAPSHOT.jar +CP=$CP:./lib/classworlds-1.1-alpha-1.jar + +java -classpath ${CP} org.apache.maven.tools.repoclean.Main $* | tee repoclean-log.txt diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/Branch.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/Branch.java new file mode 100644 index 0000000000..174ae4c086 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/Branch.java @@ -0,0 +1,52 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v3_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class Branch. + * + * @version $Revision$ $Date$ + */ +public class Branch + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field tag + */ + private String tag; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getTag + */ + public String getTag() + { + return this.tag; + } //-- String getTag() + + /** + * Method setTag + * + * @param tag + */ + public void setTag( String tag ) + { + this.tag = tag; + } //-- void setTag(String) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/Build.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/Build.java new file mode 100644 index 0000000000..0604e8d7c5 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/Build.java @@ -0,0 +1,263 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v3_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class Build. + * + * @version $Revision$ $Date$ + */ +public class Build + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field nagEmailAddress + */ + private String nagEmailAddress; + + /** + * Field sourceDirectory + */ + private String sourceDirectory; + + /** + * Field unitTestSourceDirectory + */ + private String unitTestSourceDirectory; + + /** + * Field aspectSourceDirectory + */ + private String aspectSourceDirectory; + + /** + * Field integrationUnitTestSourceDirectory + */ + private String integrationUnitTestSourceDirectory; + + /** + * Field sourceModifications + */ + private java.util.List sourceModifications; + + /** + * Field unitTest + */ + private UnitTest unitTest = new UnitTest(); + + /** + * Field resources + */ + private java.util.List resources; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method addResource + * + * @param resource + */ + public void addResource( Resource resource ) + { + getResources().add( resource ); + } //-- void addResource(Resource) + + /** + * Method addSourceModification + * + * @param sourceModification + */ + public void addSourceModification( SourceModification sourceModification ) + { + getSourceModifications().add( sourceModification ); + } //-- void addSourceModification(SourceModification) + + /** + * Method getAspectSourceDirectory + */ + public String getAspectSourceDirectory() + { + return this.aspectSourceDirectory; + } //-- String getAspectSourceDirectory() + + /** + * Method getIntegrationUnitTestSourceDirectory + */ + public String getIntegrationUnitTestSourceDirectory() + { + return this.integrationUnitTestSourceDirectory; + } //-- String getIntegrationUnitTestSourceDirectory() + + /** + * Method getNagEmailAddress + */ + public String getNagEmailAddress() + { + return this.nagEmailAddress; + } //-- String getNagEmailAddress() + + /** + * Method getResources + */ + public java.util.List getResources() + { + if ( this.resources == null ) + { + this.resources = new java.util.ArrayList(); + } + + return this.resources; + } //-- java.util.List getResources() + + /** + * Method getSourceDirectory + */ + public String getSourceDirectory() + { + return this.sourceDirectory; + } //-- String getSourceDirectory() + + /** + * Method getSourceModifications + */ + public java.util.List getSourceModifications() + { + if ( this.sourceModifications == null ) + { + this.sourceModifications = new java.util.ArrayList(); + } + + return this.sourceModifications; + } //-- java.util.List getSourceModifications() + + /** + * Method getUnitTest + */ + public UnitTest getUnitTest() + { + return this.unitTest; + } //-- UnitTest getUnitTest() + + /** + * Method getUnitTestSourceDirectory + */ + public String getUnitTestSourceDirectory() + { + return this.unitTestSourceDirectory; + } //-- String getUnitTestSourceDirectory() + + /** + * Method removeResource + * + * @param resource + */ + public void removeResource( Resource resource ) + { + getResources().remove( resource ); + } //-- void removeResource(Resource) + + /** + * Method removeSourceModification + * + * @param sourceModification + */ + public void removeSourceModification( SourceModification sourceModification ) + { + getSourceModifications().remove( sourceModification ); + } //-- void removeSourceModification(SourceModification) + + /** + * Method setAspectSourceDirectory + * + * @param aspectSourceDirectory + */ + public void setAspectSourceDirectory( String aspectSourceDirectory ) + { + this.aspectSourceDirectory = aspectSourceDirectory; + } //-- void setAspectSourceDirectory(String) + + /** + * Method setIntegrationUnitTestSourceDirectory + * + * @param integrationUnitTestSourceDirectory + */ + public void setIntegrationUnitTestSourceDirectory( String integrationUnitTestSourceDirectory ) + { + this.integrationUnitTestSourceDirectory = integrationUnitTestSourceDirectory; + } //-- void setIntegrationUnitTestSourceDirectory(String) + + /** + * Method setNagEmailAddress + * + * @param nagEmailAddress + */ + public void setNagEmailAddress( String nagEmailAddress ) + { + this.nagEmailAddress = nagEmailAddress; + } //-- void setNagEmailAddress(String) + + /** + * Method setResources + * + * @param resources + */ + public void setResources( java.util.List resources ) + { + this.resources = resources; + } //-- void setResources(java.util.List) + + /** + * Method setSourceDirectory + * + * @param sourceDirectory + */ + public void setSourceDirectory( String sourceDirectory ) + { + this.sourceDirectory = sourceDirectory; + } //-- void setSourceDirectory(String) + + /** + * Method setSourceModifications + * + * @param sourceModifications + */ + public void setSourceModifications( java.util.List sourceModifications ) + { + this.sourceModifications = sourceModifications; + } //-- void setSourceModifications(java.util.List) + + /** + * Method setUnitTest + * + * @param unitTest + */ + public void setUnitTest( UnitTest unitTest ) + { + this.unitTest = unitTest; + } //-- void setUnitTest(UnitTest) + + /** + * Method setUnitTestSourceDirectory + * + * @param unitTestSourceDirectory + */ + public void setUnitTestSourceDirectory( String unitTestSourceDirectory ) + { + this.unitTestSourceDirectory = unitTestSourceDirectory; + } //-- void setUnitTestSourceDirectory(String) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/Contributor.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/Contributor.java new file mode 100644 index 0000000000..e3a17eeb39 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/Contributor.java @@ -0,0 +1,192 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v3_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class Contributor. + * + * @version $Revision$ $Date$ + */ +public class Contributor + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field name + */ + private String name; + + /** + * Field email + */ + private String email; + + /** + * Field url + */ + private String url; + + /** + * Field organization + */ + private String organization; + + /** + * Field roles + */ + private java.util.List roles; + + /** + * Field timezone + */ + private String timezone; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method addRole + * + * @param string + */ + public void addRole( String string ) + { + getRoles().add( string ); + } //-- void addRole(String) + + /** + * Method getEmail + */ + public String getEmail() + { + return this.email; + } //-- String getEmail() + + /** + * Method getName + */ + public String getName() + { + return this.name; + } //-- String getName() + + /** + * Method getOrganization + */ + public String getOrganization() + { + return this.organization; + } //-- String getOrganization() + + /** + * Method getRoles + */ + public java.util.List getRoles() + { + if ( this.roles == null ) + { + this.roles = new java.util.ArrayList(); + } + + return this.roles; + } //-- java.util.List getRoles() + + /** + * Method getTimezone + */ + public String getTimezone() + { + return this.timezone; + } //-- String getTimezone() + + /** + * Method getUrl + */ + public String getUrl() + { + return this.url; + } //-- String getUrl() + + /** + * Method removeRole + * + * @param string + */ + public void removeRole( String string ) + { + getRoles().remove( string ); + } //-- void removeRole(String) + + /** + * Method setEmail + * + * @param email + */ + public void setEmail( String email ) + { + this.email = email; + } //-- void setEmail(String) + + /** + * Method setName + * + * @param name + */ + public void setName( String name ) + { + this.name = name; + } //-- void setName(String) + + /** + * Method setOrganization + * + * @param organization + */ + public void setOrganization( String organization ) + { + this.organization = organization; + } //-- void setOrganization(String) + + /** + * Method setRoles + * + * @param roles + */ + public void setRoles( java.util.List roles ) + { + this.roles = roles; + } //-- void setRoles(java.util.List) + + /** + * Method setTimezone + * + * @param timezone + */ + public void setTimezone( String timezone ) + { + this.timezone = timezone; + } //-- void setTimezone(String) + + /** + * Method setUrl + * + * @param url + */ + public void setUrl( String url ) + { + this.url = url; + } //-- void setUrl(String) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/Dependency.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/Dependency.java new file mode 100644 index 0000000000..4cdce0ec04 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/Dependency.java @@ -0,0 +1,298 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v3_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class Dependency. + * + * @version $Revision$ $Date$ + */ +public class Dependency + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field id + */ + private String id; + + /** + * Field groupId + */ + private String groupId; + + /** + * Field artifactId + */ + private String artifactId; + + /** + * Field version + */ + private String version; + + /** + * Field url + */ + private String url; + + /** + * Field jar + */ + private String jar; + + /** + * Field type + */ + private String type = "jar"; + + /** + * Field properties + */ + private java.util.Properties properties; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method addProperty + * + * @param key + * @param value + */ + public void addProperty( String key, String value ) + { + getProperties().put( key, value ); + } //-- void addProperty(String, String) + + /** + * Method getArtifactId + */ + public String getArtifactId() + { + return this.artifactId; + } //-- String getArtifactId() + + /** + * Method getGroupId + */ + public String getGroupId() + { + return this.groupId; + } //-- String getGroupId() + + /** + * Method getId + */ + public String getId() + { + return this.id; + } //-- String getId() + + /** + * Method getJar + */ + public String getJar() + { + return this.jar; + } //-- String getJar() + + /** + * Method getProperties + */ + public java.util.Properties getProperties() + { + if ( this.properties == null ) + { + this.properties = new java.util.Properties(); + } + + return this.properties; + } //-- java.util.Properties getProperties() + + /** + * Method getType + */ + public String getType() + { + return this.type; + } //-- String getType() + + /** + * Method getUrl + */ + public String getUrl() + { + return this.url; + } //-- String getUrl() + + /** + * Method getVersion + */ + public String getVersion() + { + return this.version; + } //-- String getVersion() + + /** + * Method setArtifactId + * + * @param artifactId + */ + public void setArtifactId( String artifactId ) + { + this.artifactId = artifactId; + } //-- void setArtifactId(String) + + /** + * Method setGroupId + * + * @param groupId + */ + public void setGroupId( String groupId ) + { + this.groupId = groupId; + } //-- void setGroupId(String) + + /** + * Method setId + * + * @param id + */ + public void setId( String id ) + { + this.id = id; + } //-- void setId(String) + + /** + * Method setJar + * + * @param jar + */ + public void setJar( String jar ) + { + this.jar = jar; + } //-- void setJar(String) + + /** + * Method setProperties + * + * @param properties + */ + public void setProperties( java.util.Properties properties ) + { + this.properties = properties; + } //-- void setProperties(java.util.Properties) + + /** + * Method setType + * + * @param type + */ + public void setType( String type ) + { + this.type = type; + } //-- void setType(String) + + /** + * Method setUrl + * + * @param url + */ + public void setUrl( String url ) + { + this.url = url; + } //-- void setUrl(String) + + /** + * Method setVersion + * + * @param version + */ + public void setVersion( String version ) + { + this.version = version; + } //-- void setVersion(String) + + public String toString() + { + return groupId + "/" + type + "s:" + artifactId + "-" + version; + } + + public String getKey() + { + return getId() + ":" + getType(); + } + + public String getArtifactDirectory() + { + return getGroupId(); + } + + public String getArtifact() + { + // If the jar name has been explicty set then use that. This + // is when the element is explicity used in the POM. + if ( getJar() != null ) + { + return getJar(); + } + + return getArtifactId() + "-" + getVersion() + "." + getExtension(); + } + + public String getExtension() + { + if ( "ejb".equals( getType() ) || "plugin".equals( getType() ) || "aspect".equals( getType() ) ) + return "jar"; + return getType(); + } + + public boolean isAddedToClasspath() + { + return ( "jar".equals( getType() ) || "ejb".equals( getType() ) ); + } + + public boolean isPlugin() + { + return ( "plugin".equals( getType() ) ); + } + + public String getProperty( String property ) + { + return getProperties().getProperty( property ); + } + + public boolean equals( Object o ) + { + if ( this == o ) + { + return true; + } + + if ( !( o instanceof Dependency ) ) + { + return false; + } + + Dependency d = (Dependency) o; + return getId().equals( d.getId() ); + } + + public int hashCode() + { + return getId().hashCode(); + } +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/Developer.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/Developer.java new file mode 100644 index 0000000000..5caba145b0 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/Developer.java @@ -0,0 +1,53 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v3_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class Developer. + * + * @version $Revision$ $Date$ + */ +public class Developer + extends Contributor + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field id + */ + private String id; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getId + */ + public String getId() + { + return this.id; + } //-- String getId() + + /** + * Method setId + * + * @param id + */ + public void setId( String id ) + { + this.id = id; + } //-- void setId(String) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/FileSet.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/FileSet.java new file mode 100644 index 0000000000..6c98461b19 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/FileSet.java @@ -0,0 +1,53 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v3_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class FileSet. + * + * @version $Revision$ $Date$ + */ +public class FileSet + extends PatternSet + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field directory + */ + private String directory; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getDirectory + */ + public String getDirectory() + { + return this.directory; + } //-- String getDirectory() + + /** + * Method setDirectory + * + * @param directory + */ + public void setDirectory( String directory ) + { + this.directory = directory; + } //-- void setDirectory(String) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/License.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/License.java new file mode 100644 index 0000000000..cde75e6c26 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/License.java @@ -0,0 +1,121 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v3_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class License. + * + * @version $Revision$ $Date$ + */ +public class License + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field name + */ + private String name; + + /** + * Field url + */ + private String url; + + /** + * Field distribution + */ + private String distribution; + + /** + * Field comments + */ + private String comments; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getComments + */ + public String getComments() + { + return this.comments; + } //-- String getComments() + + /** + * Method getDistribution + */ + public String getDistribution() + { + return this.distribution; + } //-- String getDistribution() + + /** + * Method getName + */ + public String getName() + { + return this.name; + } //-- String getName() + + /** + * Method getUrl + */ + public String getUrl() + { + return this.url; + } //-- String getUrl() + + /** + * Method setComments + * + * @param comments + */ + public void setComments( String comments ) + { + this.comments = comments; + } //-- void setComments(String) + + /** + * Method setDistribution + * + * @param distribution + */ + public void setDistribution( String distribution ) + { + this.distribution = distribution; + } //-- void setDistribution(String) + + /** + * Method setName + * + * @param name + */ + public void setName( String name ) + { + this.name = name; + } //-- void setName(String) + + /** + * Method setUrl + * + * @param url + */ + public void setUrl( String url ) + { + this.url = url; + } //-- void setUrl(String) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/MailingList.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/MailingList.java new file mode 100644 index 0000000000..4b0952e6f6 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/MailingList.java @@ -0,0 +1,121 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v3_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class MailingList. + * + * @version $Revision$ $Date$ + */ +public class MailingList + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field name + */ + private String name; + + /** + * Field subscribe + */ + private String subscribe; + + /** + * Field unsubscribe + */ + private String unsubscribe; + + /** + * Field archive + */ + private String archive; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getArchive + */ + public String getArchive() + { + return this.archive; + } //-- String getArchive() + + /** + * Method getName + */ + public String getName() + { + return this.name; + } //-- String getName() + + /** + * Method getSubscribe + */ + public String getSubscribe() + { + return this.subscribe; + } //-- String getSubscribe() + + /** + * Method getUnsubscribe + */ + public String getUnsubscribe() + { + return this.unsubscribe; + } //-- String getUnsubscribe() + + /** + * Method setArchive + * + * @param archive + */ + public void setArchive( String archive ) + { + this.archive = archive; + } //-- void setArchive(String) + + /** + * Method setName + * + * @param name + */ + public void setName( String name ) + { + this.name = name; + } //-- void setName(String) + + /** + * Method setSubscribe + * + * @param subscribe + */ + public void setSubscribe( String subscribe ) + { + this.subscribe = subscribe; + } //-- void setSubscribe(String) + + /** + * Method setUnsubscribe + * + * @param unsubscribe + */ + public void setUnsubscribe( String unsubscribe ) + { + this.unsubscribe = unsubscribe; + } //-- void setUnsubscribe(String) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/Model.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/Model.java new file mode 100644 index 0000000000..33ac34db71 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/Model.java @@ -0,0 +1,1027 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v3_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + +/** + * Class Model. + * + * @version $Revision$ $Date$ + */ +public class Model + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field extend + */ + private String extend; + + /** + * Field pomVersion + */ + private String pomVersion; + + /** + * Field id + */ + private String id; + + /** + * Field groupId + */ + private String groupId; + + /** + * Field artifactId + */ + private String artifactId; + + /** + * Field name + */ + private String name; + + /** + * Field currentVersion + */ + private String currentVersion; + + /** + * Field shortDescription + */ + private String shortDescription; + + /** + * Field description + */ + private String description; + + /** + * Field url + */ + private String url; + + /** + * Field logo + */ + private String logo; + + /** + * Field issueTrackingUrl + */ + private String issueTrackingUrl; + + /** + * Field inceptionYear + */ + private String inceptionYear; + + /** + * Field gumpRepositoryId + */ + private String gumpRepositoryId; + + /** + * Field siteAddress + */ + private String siteAddress; + + /** + * Field siteDirectory + */ + private String siteDirectory; + + /** + * Field distributionSite + */ + private String distributionSite; + + /** + * Field distributionDirectory + */ + private String distributionDirectory; + + /** + * Field mailingLists + */ + private java.util.List mailingLists; + + /** + * Field developers + */ + private java.util.List developers; + + /** + * Field contributors + */ + private java.util.List contributors; + + /** + * These should ultimately only be compile time dependencies + * when transitive + * dependencies come into play. + */ + private java.util.List dependencies; + + /** + * Field licenses + */ + private java.util.List licenses; + + /** + * Field versions + */ + private java.util.List versions; + + /** + * Field branches + */ + private java.util.List branches; + + /** + * Field packageGroups + */ + private java.util.List packageGroups; + + /** + * Field reports + */ + private java.util.List reports; + + /** + * Field repository + */ + private Repository repository; + + /** + * Field build + */ + private Build build; + + /** + * Field organization + */ + private Organization organization; + + /** + * Field properties + */ + private java.util.Properties properties; + + /** + * Field packageName + */ + private String packageName; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method addBranch + * + * @param branch + */ + public void addBranch( Branch branch ) + { + getBranches().add( branch ); + } //-- void addBranch(Branch) + + /** + * Method addContributor + * + * @param contributor + */ + public void addContributor( Contributor contributor ) + { + getContributors().add( contributor ); + } //-- void addContributor(Contributor) + + /** + * Method addDependency + * + * @param dependency + */ + public void addDependency( Dependency dependency ) + { + getDependencies().add( dependency ); + } //-- void addDependency(Dependency) + + /** + * Method addDeveloper + * + * @param developer + */ + public void addDeveloper( Developer developer ) + { + getDevelopers().add( developer ); + } //-- void addDeveloper(Developer) + + /** + * Method addLicense + * + * @param license + */ + public void addLicense( License license ) + { + getLicenses().add( license ); + } //-- void addLicense(License) + + /** + * Method addMailingList + * + * @param mailingList + */ + public void addMailingList( MailingList mailingList ) + { + getMailingLists().add( mailingList ); + } //-- void addMailingList(MailingList) + + /** + * Method addPackageGroup + * + * @param packageGroup + */ + public void addPackageGroup( PackageGroup packageGroup ) + { + getPackageGroups().add( packageGroup ); + } //-- void addPackageGroup(PackageGroup) + + /** + * Method addProperty + * + * @param key + * @param value + */ + public void addProperty( String key, String value ) + { + getProperties().put( key, value ); + } //-- void addProperty(String, String) + + /** + * Method addReport + * + * @param string + */ + public void addReport( String string ) + { + getReports().add( string ); + } //-- void addReport(String) + + /** + * Method addVersion + * + * @param version + */ + public void addVersion( Version version ) + { + getVersions().add( version ); + } //-- void addVersion(Version) + + /** + * Method getArtifactId + */ + public String getArtifactId() + { + return this.artifactId; + } //-- String getArtifactId() + + /** + * Method getBranches + */ + public java.util.List getBranches() + { + if ( this.branches == null ) + { + this.branches = new java.util.ArrayList(); + } + + return this.branches; + } //-- java.util.List getBranches() + + /** + * Method getBuild + */ + public Build getBuild() + { + return this.build; + } //-- Build getBuild() + + /** + * Method getContributors + */ + public java.util.List getContributors() + { + if ( this.contributors == null ) + { + this.contributors = new java.util.ArrayList(); + } + + return this.contributors; + } //-- java.util.List getContributors() + + /** + * Method getCurrentVersion + */ + public String getCurrentVersion() + { + return this.currentVersion; + } //-- String getCurrentVersion() + + /** + * Method getDependencies + */ + public java.util.List getDependencies() + { + if ( this.dependencies == null ) + { + this.dependencies = new java.util.ArrayList(); + } + + return this.dependencies; + } //-- java.util.List getDependencies() + + /** + * Method getDescription + */ + public String getDescription() + { + return this.description; + } //-- String getDescription() + + /** + * Method getDevelopers + */ + public java.util.List getDevelopers() + { + if ( this.developers == null ) + { + this.developers = new java.util.ArrayList(); + } + + return this.developers; + } //-- java.util.List getDevelopers() + + /** + * Method getDistributionDirectory + */ + public String getDistributionDirectory() + { + return this.distributionDirectory; + } //-- String getDistributionDirectory() + + /** + * Method getDistributionSite + */ + public String getDistributionSite() + { + return this.distributionSite; + } //-- String getDistributionSite() + + /** + * Method getExtend + */ + public String getExtend() + { + return this.extend; + } //-- String getExtend() + + /** + * Method getGroupId + */ + public String getGroupId() + { + return this.groupId; + } //-- String getGroupId() + + /** + * Method getGumpRepositoryId + */ + public String getGumpRepositoryId() + { + return this.gumpRepositoryId; + } //-- String getGumpRepositoryId() + + /** + * Method getId + */ + public String getId() + { + return this.id; + } //-- String getId() + + /** + * Method getInceptionYear + */ + public String getInceptionYear() + { + return this.inceptionYear; + } //-- String getInceptionYear() + + /** + * Method getIssueTrackingUrl + */ + public String getIssueTrackingUrl() + { + return this.issueTrackingUrl; + } //-- String getIssueTrackingUrl() + + /** + * Method getLicenses + */ + public java.util.List getLicenses() + { + if ( this.licenses == null ) + { + this.licenses = new java.util.ArrayList(); + } + + return this.licenses; + } //-- java.util.List getLicenses() + + /** + * Method getLogo + */ + public String getLogo() + { + return this.logo; + } //-- String getLogo() + + /** + * Method getMailingLists + */ + public java.util.List getMailingLists() + { + if ( this.mailingLists == null ) + { + this.mailingLists = new java.util.ArrayList(); + } + + return this.mailingLists; + } //-- java.util.List getMailingLists() + + /** + * Method getName + */ + public String getName() + { + return this.name; + } //-- String getName() + + /** + * Method getOrganization + */ + public Organization getOrganization() + { + return this.organization; + } //-- Organization getOrganization() + + /** + * Method getPackageGroups + */ + public java.util.List getPackageGroups() + { + if ( this.packageGroups == null ) + { + this.packageGroups = new java.util.ArrayList(); + } + + return this.packageGroups; + } //-- java.util.List getPackageGroups() + + /** + * Method getPackageName + */ + public String getPackageName() + { + return this.packageName; + } //-- String getPackageName() + + /** + * Method getPomVersion + */ + public String getPomVersion() + { + return this.pomVersion; + } //-- String getPomVersion() + + /** + * Method getProperties + */ + public java.util.Properties getProperties() + { + if ( this.properties == null ) + { + this.properties = new java.util.Properties(); + } + + return this.properties; + } //-- java.util.Properties getProperties() + + /** + * Method getReports + */ + public java.util.List getReports() + { + if ( this.reports == null ) + { + this.reports = new java.util.ArrayList(); + } + + return this.reports; + } //-- java.util.List getReports() + + /** + * Method getRepository + */ + public Repository getRepository() + { + return this.repository; + } //-- Repository getRepository() + + /** + * Method getShortDescription + */ + public String getShortDescription() + { + return this.shortDescription; + } //-- String getShortDescription() + + /** + * Method getSiteAddress + */ + public String getSiteAddress() + { + return this.siteAddress; + } //-- String getSiteAddress() + + /** + * Method getSiteDirectory + */ + public String getSiteDirectory() + { + return this.siteDirectory; + } //-- String getSiteDirectory() + + /** + * Method getUrl + */ + public String getUrl() + { + return this.url; + } //-- String getUrl() + + /** + * Method getVersions + */ + public java.util.List getVersions() + { + if ( this.versions == null ) + { + this.versions = new java.util.ArrayList(); + } + + return this.versions; + } //-- java.util.List getVersions() + + /** + * Method removeBranch + * + * @param branch + */ + public void removeBranch( Branch branch ) + { + getBranches().remove( branch ); + } //-- void removeBranch(Branch) + + /** + * Method removeContributor + * + * @param contributor + */ + public void removeContributor( Contributor contributor ) + { + getContributors().remove( contributor ); + } //-- void removeContributor(Contributor) + + /** + * Method removeDependency + * + * @param dependency + */ + public void removeDependency( Dependency dependency ) + { + getDependencies().remove( dependency ); + } //-- void removeDependency(Dependency) + + /** + * Method removeDeveloper + * + * @param developer + */ + public void removeDeveloper( Developer developer ) + { + getDevelopers().remove( developer ); + } //-- void removeDeveloper(Developer) + + /** + * Method removeLicense + * + * @param license + */ + public void removeLicense( License license ) + { + getLicenses().remove( license ); + } //-- void removeLicense(License) + + /** + * Method removeMailingList + * + * @param mailingList + */ + public void removeMailingList( MailingList mailingList ) + { + getMailingLists().remove( mailingList ); + } //-- void removeMailingList(MailingList) + + /** + * Method removePackageGroup + * + * @param packageGroup + */ + public void removePackageGroup( PackageGroup packageGroup ) + { + getPackageGroups().remove( packageGroup ); + } //-- void removePackageGroup(PackageGroup) + + /** + * Method removeReport + * + * @param string + */ + public void removeReport( String string ) + { + getReports().remove( string ); + } //-- void removeReport(String) + + /** + * Method removeVersion + * + * @param version + */ + public void removeVersion( Version version ) + { + getVersions().remove( version ); + } //-- void removeVersion(Version) + + /** + * Method setArtifactId + * + * @param artifactId + */ + public void setArtifactId( String artifactId ) + { + this.artifactId = artifactId; + } //-- void setArtifactId(String) + + /** + * Method setBranches + * + * @param branches + */ + public void setBranches( java.util.List branches ) + { + this.branches = branches; + } //-- void setBranches(java.util.List) + + /** + * Method setBuild + * + * @param build + */ + public void setBuild( Build build ) + { + this.build = build; + } //-- void setBuild(Build) + + /** + * Method setContributors + * + * @param contributors + */ + public void setContributors( java.util.List contributors ) + { + this.contributors = contributors; + } //-- void setContributors(java.util.List) + + /** + * Method setCurrentVersion + * + * @param currentVersion + */ + public void setCurrentVersion( String currentVersion ) + { + this.currentVersion = currentVersion; + } //-- void setCurrentVersion(String) + + /** + * Method setDependencies + * + * @param dependencies + */ + public void setDependencies( java.util.List dependencies ) + { + this.dependencies = dependencies; + } //-- void setDependencies(java.util.List) + + /** + * Method setDescription + * + * @param description + */ + public void setDescription( String description ) + { + this.description = description; + } //-- void setDescription(String) + + /** + * Method setDevelopers + * + * @param developers + */ + public void setDevelopers( java.util.List developers ) + { + this.developers = developers; + } //-- void setDevelopers(java.util.List) + + /** + * Method setDistributionDirectory + * + * @param distributionDirectory + */ + public void setDistributionDirectory( String distributionDirectory ) + { + this.distributionDirectory = distributionDirectory; + } //-- void setDistributionDirectory(String) + + /** + * Method setDistributionSite + * + * @param distributionSite + */ + public void setDistributionSite( String distributionSite ) + { + this.distributionSite = distributionSite; + } //-- void setDistributionSite(String) + + /** + * Method setExtend + * + * @param extend + */ + public void setExtend( String extend ) + { + this.extend = extend; + } //-- void setExtend(String) + + /** + * Method setGroupId + * + * @param groupId + */ + public void setGroupId( String groupId ) + { + this.groupId = groupId; + } //-- void setGroupId(String) + + /** + * Method setGumpRepositoryId + * + * @param gumpRepositoryId + */ + public void setGumpRepositoryId( String gumpRepositoryId ) + { + this.gumpRepositoryId = gumpRepositoryId; + } //-- void setGumpRepositoryId(String) + + /** + * Method setId + * + * @param id + */ + public void setId( String id ) + { + this.id = id; + } //-- void setId(String) + + /** + * Method setInceptionYear + * + * @param inceptionYear + */ + public void setInceptionYear( String inceptionYear ) + { + this.inceptionYear = inceptionYear; + } //-- void setInceptionYear(String) + + /** + * Method setIssueTrackingUrl + * + * @param issueTrackingUrl + */ + public void setIssueTrackingUrl( String issueTrackingUrl ) + { + this.issueTrackingUrl = issueTrackingUrl; + } //-- void setIssueTrackingUrl(String) + + /** + * Method setLicenses + * + * @param licenses + */ + public void setLicenses( java.util.List licenses ) + { + this.licenses = licenses; + } //-- void setLicenses(java.util.List) + + /** + * Method setLogo + * + * @param logo + */ + public void setLogo( String logo ) + { + this.logo = logo; + } //-- void setLogo(String) + + /** + * Method setMailingLists + * + * @param mailingLists + */ + public void setMailingLists( java.util.List mailingLists ) + { + this.mailingLists = mailingLists; + } //-- void setMailingLists(java.util.List) + + /** + * Method setName + * + * @param name + */ + public void setName( String name ) + { + this.name = name; + } //-- void setName(String) + + /** + * Method setOrganization + * + * @param organization + */ + public void setOrganization( Organization organization ) + { + this.organization = organization; + } //-- void setOrganization(Organization) + + /** + * Method setPackageGroups + * + * @param packageGroups + */ + public void setPackageGroups( java.util.List packageGroups ) + { + this.packageGroups = packageGroups; + } //-- void setPackageGroups(java.util.List) + + /** + * Method setPackageName + * + * @param packageName + */ + public void setPackageName( String packageName ) + { + this.packageName = packageName; + } //-- void setPackageName(String) + + /** + * Method setPomVersion + * + * @param pomVersion + */ + public void setPomVersion( String pomVersion ) + { + this.pomVersion = pomVersion; + } //-- void setPomVersion(String) + + /** + * Method setProperties + * + * @param properties + */ + public void setProperties( java.util.Properties properties ) + { + this.properties = properties; + } //-- void setProperties(java.util.Properties) + + /** + * Method setReports + * + * @param reports + */ + public void setReports( java.util.List reports ) + { + this.reports = reports; + } //-- void setReports(java.util.List) + + /** + * Method setRepository + * + * @param repository + */ + public void setRepository( Repository repository ) + { + this.repository = repository; + } //-- void setRepository(Repository) + + /** + * Method setShortDescription + * + * @param shortDescription + */ + public void setShortDescription( String shortDescription ) + { + this.shortDescription = shortDescription; + } //-- void setShortDescription(String) + + /** + * Method setSiteAddress + * + * @param siteAddress + */ + public void setSiteAddress( String siteAddress ) + { + this.siteAddress = siteAddress; + } //-- void setSiteAddress(String) + + /** + * Method setSiteDirectory + * + * @param siteDirectory + */ + public void setSiteDirectory( String siteDirectory ) + { + this.siteDirectory = siteDirectory; + } //-- void setSiteDirectory(String) + + /** + * Method setUrl + * + * @param url + */ + public void setUrl( String url ) + { + this.url = url; + } //-- void setUrl(String) + + /** + * Method setVersions + * + * @param versions + */ + public void setVersions( java.util.List versions ) + { + this.versions = versions; + } //-- void setVersions(java.util.List) + + public void setVersion( String version ) + { + this.currentVersion = version; + } + + public String getVersion() + { + return currentVersion; + } + + // We need this because we can't use package as a field name. + public void setPackage( String packageName ) + { + this.packageName = packageName; + } + + public String getPackage() + { + return packageName; + } +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/Organization.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/Organization.java new file mode 100644 index 0000000000..71aac2a1a7 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/Organization.java @@ -0,0 +1,98 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v3_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class Organization. + * + * @version $Revision$ $Date$ + */ +public class Organization + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field name + */ + private String name; + + /** + * Field url + */ + private String url; + + /** + * Field logo + */ + private String logo; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getLogo + */ + public String getLogo() + { + return this.logo; + } //-- String getLogo() + + /** + * Method getName + */ + public String getName() + { + return this.name; + } //-- String getName() + + /** + * Method getUrl + */ + public String getUrl() + { + return this.url; + } //-- String getUrl() + + /** + * Method setLogo + * + * @param logo + */ + public void setLogo( String logo ) + { + this.logo = logo; + } //-- void setLogo(String) + + /** + * Method setName + * + * @param name + */ + public void setName( String name ) + { + this.name = name; + } //-- void setName(String) + + /** + * Method setUrl + * + * @param url + */ + public void setUrl( String url ) + { + this.url = url; + } //-- void setUrl(String) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/PackageGroup.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/PackageGroup.java new file mode 100644 index 0000000000..65e5064e12 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/PackageGroup.java @@ -0,0 +1,75 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v3_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class PackageGroup. + * + * @version $Revision$ $Date$ + */ +public class PackageGroup + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field title + */ + private String title; + + /** + * Field packages + */ + private String packages; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getPackages + */ + public String getPackages() + { + return this.packages; + } //-- String getPackages() + + /** + * Method getTitle + */ + public String getTitle() + { + return this.title; + } //-- String getTitle() + + /** + * Method setPackages + * + * @param packages + */ + public void setPackages( String packages ) + { + this.packages = packages; + } //-- void setPackages(String) + + /** + * Method setTitle + * + * @param title + */ + public void setTitle( String title ) + { + this.title = title; + } //-- void setTitle(String) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/PatternSet.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/PatternSet.java new file mode 100644 index 0000000000..fe3e5241b2 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/PatternSet.java @@ -0,0 +1,152 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v3_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + +import java.util.ArrayList; +import java.util.List; + +/** + * Class PatternSet. + * + * @version $Revision$ $Date$ + */ +public class PatternSet + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field includes + */ + private java.util.List includes; + + /** + * Field excludes + */ + private java.util.List excludes; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method addExclude + * + * @param string + */ + public void addExclude( String string ) + { + getExcludes().add( string ); + } //-- void addExclude(String) + + /** + * Method addInclude + * + * @param string + */ + public void addInclude( String string ) + { + getIncludes().add( string ); + } //-- void addInclude(String) + + /** + * Method getExcludes + */ + public java.util.List getExcludes() + { + if ( this.excludes == null ) + { + this.excludes = new java.util.ArrayList(); + } + + return this.excludes; + } //-- java.util.List getExcludes() + + /** + * Method getIncludes + */ + public java.util.List getIncludes() + { + if ( this.includes == null ) + { + this.includes = new java.util.ArrayList(); + } + + return this.includes; + } //-- java.util.List getIncludes() + + /** + * Method removeExclude + * + * @param string + */ + public void removeExclude( String string ) + { + getExcludes().remove( string ); + } //-- void removeExclude(String) + + /** + * Method removeInclude + * + * @param string + */ + public void removeInclude( String string ) + { + getIncludes().remove( string ); + } //-- void removeInclude(String) + + /** + * Method setExcludes + * + * @param excludes + */ + public void setExcludes( java.util.List excludes ) + { + this.excludes = excludes; + } //-- void setExcludes(java.util.List) + + /** + * Method setIncludes + * + * @param includes + */ + public void setIncludes( java.util.List includes ) + { + this.includes = includes; + } //-- void setIncludes(java.util.List) + + public List getDefaultExcludes() + { + List defaultExcludes = new ArrayList(); + defaultExcludes.add( "**/*~" ); + defaultExcludes.add( "**/#*#" ); + defaultExcludes.add( "**/.#*" ); + defaultExcludes.add( "**/%*%" ); + defaultExcludes.add( "**/._*" ); + // CVS + defaultExcludes.add( "**/CVS" ); + defaultExcludes.add( "**/CVS/**" ); + defaultExcludes.add( "**/.cvsignore" ); + // SCCS + defaultExcludes.add( "**/SCCS" ); + defaultExcludes.add( "**/SCCS/**" ); + // Visual SourceSafe + defaultExcludes.add( "**/vssver.scc" ); + // Subversion + defaultExcludes.add( "**/.svn" ); + defaultExcludes.add( "**/.svn/**" ); + // Mac + defaultExcludes.add( "**/.DS_Store" ); + + return defaultExcludes; + } +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/Repository.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/Repository.java new file mode 100644 index 0000000000..e2b4d88d37 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/Repository.java @@ -0,0 +1,98 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v3_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class Repository. + * + * @version $Revision$ $Date$ + */ +public class Repository + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field connection + */ + private String connection; + + /** + * Field developerConnection + */ + private String developerConnection; + + /** + * Field url + */ + private String url; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getConnection + */ + public String getConnection() + { + return this.connection; + } //-- String getConnection() + + /** + * Method getDeveloperConnection + */ + public String getDeveloperConnection() + { + return this.developerConnection; + } //-- String getDeveloperConnection() + + /** + * Method getUrl + */ + public String getUrl() + { + return this.url; + } //-- String getUrl() + + /** + * Method setConnection + * + * @param connection + */ + public void setConnection( String connection ) + { + this.connection = connection; + } //-- void setConnection(String) + + /** + * Method setDeveloperConnection + * + * @param developerConnection + */ + public void setDeveloperConnection( String developerConnection ) + { + this.developerConnection = developerConnection; + } //-- void setDeveloperConnection(String) + + /** + * Method setUrl + * + * @param url + */ + public void setUrl( String url ) + { + this.url = url; + } //-- void setUrl(String) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/Resource.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/Resource.java new file mode 100644 index 0000000000..9fe7ef1bbb --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/Resource.java @@ -0,0 +1,76 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v3_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class Resource. + * + * @version $Revision$ $Date$ + */ +public class Resource + extends FileSet + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field targetPath + */ + private String targetPath; + + /** + * Field filtering + */ + private boolean filtering = false; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getTargetPath + */ + public String getTargetPath() + { + return this.targetPath; + } //-- String getTargetPath() + + /** + * Method isFiltering + */ + public boolean isFiltering() + { + return this.filtering; + } //-- boolean isFiltering() + + /** + * Method setFiltering + * + * @param filtering + */ + public void setFiltering( boolean filtering ) + { + this.filtering = filtering; + } //-- void setFiltering(boolean) + + /** + * Method setTargetPath + * + * @param targetPath + */ + public void setTargetPath( String targetPath ) + { + this.targetPath = targetPath; + } //-- void setTargetPath(String) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/SourceModification.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/SourceModification.java new file mode 100644 index 0000000000..1c8f077911 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/SourceModification.java @@ -0,0 +1,76 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v3_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class SourceModification. + * + * @version $Revision$ $Date$ + */ +public class SourceModification + extends FileSet + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field className + */ + private String className; + + /** + * Field property + */ + private String property; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getClassName + */ + public String getClassName() + { + return this.className; + } //-- String getClassName() + + /** + * Method getProperty + */ + public String getProperty() + { + return this.property; + } //-- String getProperty() + + /** + * Method setClassName + * + * @param className + */ + public void setClassName( String className ) + { + this.className = className; + } //-- void setClassName(String) + + /** + * Method setProperty + * + * @param property + */ + public void setProperty( String property ) + { + this.property = property; + } //-- void setProperty(String) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/UnitTest.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/UnitTest.java new file mode 100644 index 0000000000..f7283d38e6 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/UnitTest.java @@ -0,0 +1,78 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v3_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class UnitTest. + * + * @version $Revision$ $Date$ + */ +public class UnitTest + extends PatternSet + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field resources + */ + private java.util.List resources; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method addResource + * + * @param resource + */ + public void addResource( Resource resource ) + { + getResources().add( resource ); + } //-- void addResource(Resource) + + /** + * Method getResources + */ + public java.util.List getResources() + { + if ( this.resources == null ) + { + this.resources = new java.util.ArrayList(); + } + + return this.resources; + } //-- java.util.List getResources() + + /** + * Method removeResource + * + * @param resource + */ + public void removeResource( Resource resource ) + { + getResources().remove( resource ); + } //-- void removeResource(Resource) + + /** + * Method setResources + * + * @param resources + */ + public void setResources( java.util.List resources ) + { + this.resources = resources; + } //-- void setResources(java.util.List) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/Version.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/Version.java new file mode 100644 index 0000000000..97c40aaa18 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/Version.java @@ -0,0 +1,102 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v3_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class Version. + * + * @version $Revision$ $Date$ + */ +public class Version + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field name + */ + private String name; + + /** + * Field tag + */ + private String tag; + + /** + * Field id + */ + private String id; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getId + */ + public String getId() + { + return this.id; + } //-- String getId() + + /** + * Method getName + */ + public String getName() + { + return this.name; + } //-- String getName() + + /** + * Method getTag + */ + public String getTag() + { + return this.tag; + } //-- String getTag() + + /** + * Method setId + * + * @param id + */ + public void setId( String id ) + { + this.id = id; + } //-- void setId(String) + + /** + * Method setName + * + * @param name + */ + public void setName( String name ) + { + this.name = name; + } //-- void setName(String) + + /** + * Method setTag + * + * @param tag + */ + public void setTag( String tag ) + { + this.tag = tag; + } //-- void setTag(String) + + public String toString() + { + return getId(); + } +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/io/xpp3/MavenXpp3Reader.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/io/xpp3/MavenXpp3Reader.java new file mode 100644 index 0000000000..77be70c2f2 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/io/xpp3/MavenXpp3Reader.java @@ -0,0 +1,1428 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v3_0_0.io.xpp3; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + +import org.apache.maven.model.v3_0_0.Branch; +import org.apache.maven.model.v3_0_0.Build; +import org.apache.maven.model.v3_0_0.Contributor; +import org.apache.maven.model.v3_0_0.Dependency; +import org.apache.maven.model.v3_0_0.Developer; +import org.apache.maven.model.v3_0_0.FileSet; +import org.apache.maven.model.v3_0_0.License; +import org.apache.maven.model.v3_0_0.MailingList; +import org.apache.maven.model.v3_0_0.Model; +import org.apache.maven.model.v3_0_0.Organization; +import org.apache.maven.model.v3_0_0.PackageGroup; +import org.apache.maven.model.v3_0_0.PatternSet; +import org.apache.maven.model.v3_0_0.Repository; +import org.apache.maven.model.v3_0_0.Resource; +import org.apache.maven.model.v3_0_0.SourceModification; +import org.apache.maven.model.v3_0_0.UnitTest; +import org.apache.maven.model.v3_0_0.Version; +import org.codehaus.plexus.util.xml.pull.MXParser; +import org.codehaus.plexus.util.xml.pull.XmlPullParser; + +import java.io.Reader; + +/** + * Class MavenXpp3Reader. + * + * @version $Revision$ $Date$ + */ +public class MavenXpp3Reader +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * If set the parser till be loaded with all single characters + * from the XHTML specification. + * The entities used: + * + */ + private boolean addDefaultEntities = true; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getAddDefaultEntities + */ + public boolean getAddDefaultEntities() + { + return addDefaultEntities; + } //-- boolean getAddDefaultEntities() + + /** + * Method parseBranch + * + * @param tagName + * @param parser + */ + private Branch parseBranch( String tagName, XmlPullParser parser ) throws Exception + { + Branch branch = new Branch(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "tag" ) ) + { + branch.setTag( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + return branch; + } //-- Branch parseBranch(String, XmlPullParser) + + /** + * Method parseBuild + * + * @param tagName + * @param parser + */ + private Build parseBuild( String tagName, XmlPullParser parser ) throws Exception + { + Build build = new Build(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "nagEmailAddress" ) ) + { + build.setNagEmailAddress( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "sourceDirectory" ) ) + { + build.setSourceDirectory( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "unitTestSourceDirectory" ) ) + { + build.setUnitTestSourceDirectory( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "aspectSourceDirectory" ) ) + { + build.setAspectSourceDirectory( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "integrationUnitTestSourceDirectory" ) ) + { + build.setIntegrationUnitTestSourceDirectory( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "sourceModifications" ) ) + { + java.util.List sourceModifications = new java.util.ArrayList(); + build.setSourceModifications( sourceModifications ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "sourceModification" ) ) + { + sourceModifications.add( parseSourceModification( "sourceModification", parser ) ); + } + else + { + parser.nextText(); + } + } + } + else if ( parser.getName().equals( "unitTest" ) ) + { + build.setUnitTest( parseUnitTest( "unitTest", parser ) ); + } + else if ( parser.getName().equals( "resources" ) ) + { + java.util.List resources = new java.util.ArrayList(); + build.setResources( resources ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "resource" ) ) + { + resources.add( parseResource( "resource", parser ) ); + } + else + { + parser.nextText(); + } + } + } + else + { + parser.nextText(); + } + } + return build; + } //-- Build parseBuild(String, XmlPullParser) + + /** + * Method parseContributor + * + * @param tagName + * @param parser + */ + private Contributor parseContributor( String tagName, XmlPullParser parser ) throws Exception + { + Contributor contributor = new Contributor(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "name" ) ) + { + contributor.setName( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "email" ) ) + { + contributor.setEmail( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "url" ) ) + { + contributor.setUrl( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "organization" ) ) + { + contributor.setOrganization( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "roles" ) ) + { + java.util.List roles = new java.util.ArrayList(); + contributor.setRoles( roles ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "role" ) ) + { + roles.add( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + } + else if ( parser.getName().equals( "timezone" ) ) + { + contributor.setTimezone( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + return contributor; + } //-- Contributor parseContributor(String, XmlPullParser) + + /** + * Method parseDependency + * + * @param tagName + * @param parser + */ + private Dependency parseDependency( String tagName, XmlPullParser parser ) throws Exception + { + Dependency dependency = new Dependency(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "id" ) ) + { + dependency.setId( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "groupId" ) ) + { + dependency.setGroupId( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "artifactId" ) ) + { + dependency.setArtifactId( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "version" ) ) + { + dependency.setVersion( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "url" ) ) + { + dependency.setUrl( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "jar" ) ) + { + dependency.setJar( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "type" ) ) + { + dependency.setType( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "properties" ) ) + { + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + String key = parser.getName(); + String value = parser.nextText().trim(); + dependency.addProperty( key, value ); + } + } + else + { + parser.nextText(); + } + } + return dependency; + } //-- Dependency parseDependency(String, XmlPullParser) + + /** + * Method parseDeveloper + * + * @param tagName + * @param parser + */ + private Developer parseDeveloper( String tagName, XmlPullParser parser ) throws Exception + { + Developer developer = new Developer(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "id" ) ) + { + developer.setId( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "name" ) ) + { + developer.setName( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "email" ) ) + { + developer.setEmail( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "url" ) ) + { + developer.setUrl( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "organization" ) ) + { + developer.setOrganization( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "roles" ) ) + { + java.util.List roles = new java.util.ArrayList(); + developer.setRoles( roles ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "role" ) ) + { + roles.add( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + } + else if ( parser.getName().equals( "timezone" ) ) + { + developer.setTimezone( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + return developer; + } //-- Developer parseDeveloper(String, XmlPullParser) + + /** + * Method parseFileSet + * + * @param tagName + * @param parser + */ + private FileSet parseFileSet( String tagName, XmlPullParser parser ) throws Exception + { + FileSet fileSet = new FileSet(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "directory" ) ) + { + fileSet.setDirectory( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "includes" ) ) + { + java.util.List includes = new java.util.ArrayList(); + fileSet.setIncludes( includes ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "include" ) ) + { + includes.add( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + } + else if ( parser.getName().equals( "excludes" ) ) + { + java.util.List excludes = new java.util.ArrayList(); + fileSet.setExcludes( excludes ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "exclude" ) ) + { + excludes.add( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + } + else + { + parser.nextText(); + } + } + return fileSet; + } //-- FileSet parseFileSet(String, XmlPullParser) + + /** + * Method parseLicense + * + * @param tagName + * @param parser + */ + private License parseLicense( String tagName, XmlPullParser parser ) throws Exception + { + License license = new License(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "name" ) ) + { + license.setName( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "url" ) ) + { + license.setUrl( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "distribution" ) ) + { + license.setDistribution( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "comments" ) ) + { + license.setComments( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + return license; + } //-- License parseLicense(String, XmlPullParser) + + /** + * Method parseMailingList + * + * @param tagName + * @param parser + */ + private MailingList parseMailingList( String tagName, XmlPullParser parser ) throws Exception + { + MailingList mailingList = new MailingList(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "name" ) ) + { + mailingList.setName( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "subscribe" ) ) + { + mailingList.setSubscribe( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "unsubscribe" ) ) + { + mailingList.setUnsubscribe( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "archive" ) ) + { + mailingList.setArchive( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + return mailingList; + } //-- MailingList parseMailingList(String, XmlPullParser) + + /** + * Method parseModel + * + * @param tagName + * @param parser + */ + private Model parseModel( String tagName, XmlPullParser parser ) throws Exception + { + Model model = new Model(); + int eventType = parser.getEventType(); + while ( eventType != XmlPullParser.END_DOCUMENT ) + { + if ( eventType == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "extend" ) ) + { + model.setExtend( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "pomVersion" ) ) + { + model.setPomVersion( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "id" ) ) + { + model.setId( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "groupId" ) ) + { + model.setGroupId( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "artifactId" ) ) + { + model.setArtifactId( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "name" ) ) + { + model.setName( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "currentVersion" ) ) + { + model.setCurrentVersion( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "shortDescription" ) ) + { + model.setShortDescription( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "description" ) ) + { + model.setDescription( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "url" ) ) + { + model.setUrl( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "logo" ) ) + { + model.setLogo( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "issueTrackingUrl" ) ) + { + model.setIssueTrackingUrl( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "inceptionYear" ) ) + { + model.setInceptionYear( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "gumpRepositoryId" ) ) + { + model.setGumpRepositoryId( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "siteAddress" ) ) + { + model.setSiteAddress( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "siteDirectory" ) ) + { + model.setSiteDirectory( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "distributionSite" ) ) + { + model.setDistributionSite( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "distributionDirectory" ) ) + { + model.setDistributionDirectory( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "mailingLists" ) ) + { + java.util.List mailingLists = new java.util.ArrayList(); + model.setMailingLists( mailingLists ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "mailingList" ) ) + { + mailingLists.add( parseMailingList( "mailingList", parser ) ); + } + else + { + parser.nextText(); + } + } + } + else if ( parser.getName().equals( "developers" ) ) + { + java.util.List developers = new java.util.ArrayList(); + model.setDevelopers( developers ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "developer" ) ) + { + developers.add( parseDeveloper( "developer", parser ) ); + } + else + { + parser.nextText(); + } + } + } + else if ( parser.getName().equals( "contributors" ) ) + { + java.util.List contributors = new java.util.ArrayList(); + model.setContributors( contributors ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "contributor" ) ) + { + contributors.add( parseContributor( "contributor", parser ) ); + } + else + { + parser.nextText(); + } + } + } + else if ( parser.getName().equals( "dependencies" ) ) + { + java.util.List dependencies = new java.util.ArrayList(); + model.setDependencies( dependencies ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "dependency" ) ) + { + dependencies.add( parseDependency( "dependency", parser ) ); + } + else + { + parser.nextText(); + } + } + } + else if ( parser.getName().equals( "licenses" ) ) + { + java.util.List licenses = new java.util.ArrayList(); + model.setLicenses( licenses ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "license" ) ) + { + licenses.add( parseLicense( "license", parser ) ); + } + else + { + parser.nextText(); + } + } + } + else if ( parser.getName().equals( "versions" ) ) + { + java.util.List versions = new java.util.ArrayList(); + model.setVersions( versions ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "version" ) ) + { + versions.add( parseVersion( "version", parser ) ); + } + else + { + parser.nextText(); + } + } + } + else if ( parser.getName().equals( "branches" ) ) + { + java.util.List branches = new java.util.ArrayList(); + model.setBranches( branches ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "branch" ) ) + { + branches.add( parseBranch( "branch", parser ) ); + } + else + { + parser.nextText(); + } + } + } + else if ( parser.getName().equals( "packageGroups" ) ) + { + java.util.List packageGroups = new java.util.ArrayList(); + model.setPackageGroups( packageGroups ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "packageGroup" ) ) + { + packageGroups.add( parsePackageGroup( "packageGroup", parser ) ); + } + else + { + parser.nextText(); + } + } + } + else if ( parser.getName().equals( "reports" ) ) + { + java.util.List reports = new java.util.ArrayList(); + model.setReports( reports ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "report" ) ) + { + reports.add( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + } + else if ( parser.getName().equals( "repository" ) ) + { + model.setRepository( parseRepository( "repository", parser ) ); + } + else if ( parser.getName().equals( "build" ) ) + { + model.setBuild( parseBuild( "build", parser ) ); + } + else if ( parser.getName().equals( "organization" ) ) + { + model.setOrganization( parseOrganization( "organization", parser ) ); + } + else if ( parser.getName().equals( "properties" ) ) + { + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + String key = parser.getName(); + String value = parser.nextText().trim(); + model.addProperty( key, value ); + } + } + else if ( parser.getName().equals( "package" ) ) + { + model.setPackageName( parser.nextText().trim() ); + } + } + eventType = parser.next(); + } + return model; + } //-- Model parseModel(String, XmlPullParser) + + /** + * Method parseOrganization + * + * @param tagName + * @param parser + */ + private Organization parseOrganization( String tagName, XmlPullParser parser ) throws Exception + { + Organization organization = new Organization(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "name" ) ) + { + organization.setName( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "url" ) ) + { + organization.setUrl( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "logo" ) ) + { + organization.setLogo( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + return organization; + } //-- Organization parseOrganization(String, XmlPullParser) + + /** + * Method parsePackageGroup + * + * @param tagName + * @param parser + */ + private PackageGroup parsePackageGroup( String tagName, XmlPullParser parser ) throws Exception + { + PackageGroup packageGroup = new PackageGroup(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "title" ) ) + { + packageGroup.setTitle( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "packages" ) ) + { + packageGroup.setPackages( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + return packageGroup; + } //-- PackageGroup parsePackageGroup(String, XmlPullParser) + + /** + * Method parsePatternSet + * + * @param tagName + * @param parser + */ + private PatternSet parsePatternSet( String tagName, XmlPullParser parser ) throws Exception + { + PatternSet patternSet = new PatternSet(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "includes" ) ) + { + java.util.List includes = new java.util.ArrayList(); + patternSet.setIncludes( includes ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "include" ) ) + { + includes.add( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + } + else if ( parser.getName().equals( "excludes" ) ) + { + java.util.List excludes = new java.util.ArrayList(); + patternSet.setExcludes( excludes ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "exclude" ) ) + { + excludes.add( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + } + else + { + parser.nextText(); + } + } + return patternSet; + } //-- PatternSet parsePatternSet(String, XmlPullParser) + + /** + * Method parseRepository + * + * @param tagName + * @param parser + */ + private Repository parseRepository( String tagName, XmlPullParser parser ) throws Exception + { + Repository repository = new Repository(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "connection" ) ) + { + repository.setConnection( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "developerConnection" ) ) + { + repository.setDeveloperConnection( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "url" ) ) + { + repository.setUrl( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + return repository; + } //-- Repository parseRepository(String, XmlPullParser) + + /** + * Method parseResource + * + * @param tagName + * @param parser + */ + private Resource parseResource( String tagName, XmlPullParser parser ) throws Exception + { + Resource resource = new Resource(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "targetPath" ) ) + { + resource.setTargetPath( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "filtering" ) ) + { + resource.setFiltering( ( new Boolean( parser.nextText().trim() ) ).booleanValue() ); + } + else if ( parser.getName().equals( "directory" ) ) + { + resource.setDirectory( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "includes" ) ) + { + java.util.List includes = new java.util.ArrayList(); + resource.setIncludes( includes ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "include" ) ) + { + includes.add( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + } + else if ( parser.getName().equals( "excludes" ) ) + { + java.util.List excludes = new java.util.ArrayList(); + resource.setExcludes( excludes ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "exclude" ) ) + { + excludes.add( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + } + else + { + parser.nextText(); + } + } + return resource; + } //-- Resource parseResource(String, XmlPullParser) + + /** + * Method parseSourceModification + * + * @param tagName + * @param parser + */ + private SourceModification parseSourceModification( String tagName, XmlPullParser parser ) throws Exception + { + SourceModification sourceModification = new SourceModification(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "className" ) ) + { + sourceModification.setClassName( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "property" ) ) + { + sourceModification.setProperty( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "directory" ) ) + { + sourceModification.setDirectory( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "includes" ) ) + { + java.util.List includes = new java.util.ArrayList(); + sourceModification.setIncludes( includes ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "include" ) ) + { + includes.add( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + } + else if ( parser.getName().equals( "excludes" ) ) + { + java.util.List excludes = new java.util.ArrayList(); + sourceModification.setExcludes( excludes ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "exclude" ) ) + { + excludes.add( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + } + else + { + parser.nextText(); + } + } + return sourceModification; + } //-- SourceModification parseSourceModification(String, XmlPullParser) + + /** + * Method parseUnitTest + * + * @param tagName + * @param parser + */ + private UnitTest parseUnitTest( String tagName, XmlPullParser parser ) throws Exception + { + UnitTest unitTest = new UnitTest(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "resources" ) ) + { + java.util.List resources = new java.util.ArrayList(); + unitTest.setResources( resources ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "resource" ) ) + { + resources.add( parseResource( "resource", parser ) ); + } + else + { + parser.nextText(); + } + } + } + else if ( parser.getName().equals( "includes" ) ) + { + java.util.List includes = new java.util.ArrayList(); + unitTest.setIncludes( includes ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "include" ) ) + { + includes.add( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + } + else if ( parser.getName().equals( "excludes" ) ) + { + java.util.List excludes = new java.util.ArrayList(); + unitTest.setExcludes( excludes ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "exclude" ) ) + { + excludes.add( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + } + else + { + parser.nextText(); + } + } + return unitTest; + } //-- UnitTest parseUnitTest(String, XmlPullParser) + + /** + * Method parseVersion + * + * @param tagName + * @param parser + */ + private Version parseVersion( String tagName, XmlPullParser parser ) throws Exception + { + Version version = new Version(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "name" ) ) + { + version.setName( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "tag" ) ) + { + version.setTag( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "id" ) ) + { + version.setId( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + return version; + } //-- Version parseVersion(String, XmlPullParser) + + /** + * Method read + * + * @param reader + */ + public Model read( Reader reader ) throws Exception + { + XmlPullParser parser = new MXParser(); + parser.setInput( reader ); + + if ( addDefaultEntities ) + { + // ---------------------------------------------------------------------- + // Latin 1 entities + // ---------------------------------------------------------------------- + + parser.defineEntityReplacementText( "nbsp", "\u00a0" ); + parser.defineEntityReplacementText( "iexcl", "\u00a1" ); + parser.defineEntityReplacementText( "cent", "\u00a2" ); + parser.defineEntityReplacementText( "pound", "\u00a3" ); + parser.defineEntityReplacementText( "curren", "\u00a4" ); + parser.defineEntityReplacementText( "yen", "\u00a5" ); + parser.defineEntityReplacementText( "brvbar", "\u00a6" ); + parser.defineEntityReplacementText( "sect", "\u00a7" ); + parser.defineEntityReplacementText( "uml", "\u00a8" ); + parser.defineEntityReplacementText( "copy", "\u00a9" ); + parser.defineEntityReplacementText( "ordf", "\u00aa" ); + parser.defineEntityReplacementText( "laquo", "\u00ab" ); + parser.defineEntityReplacementText( "not", "\u00ac" ); + parser.defineEntityReplacementText( "shy", "\u00ad" ); + parser.defineEntityReplacementText( "reg", "\u00ae" ); + parser.defineEntityReplacementText( "macr", "\u00af" ); + parser.defineEntityReplacementText( "deg", "\u00b0" ); + parser.defineEntityReplacementText( "plusmn", "\u00b1" ); + parser.defineEntityReplacementText( "sup2", "\u00b2" ); + parser.defineEntityReplacementText( "sup3", "\u00b3" ); + parser.defineEntityReplacementText( "acute", "\u00b4" ); + parser.defineEntityReplacementText( "micro", "\u00b5" ); + parser.defineEntityReplacementText( "para", "\u00b6" ); + parser.defineEntityReplacementText( "middot", "\u00b7" ); + parser.defineEntityReplacementText( "cedil", "\u00b8" ); + parser.defineEntityReplacementText( "sup1", "\u00b9" ); + parser.defineEntityReplacementText( "ordm", "\u00ba" ); + parser.defineEntityReplacementText( "raquo", "\u00bb" ); + parser.defineEntityReplacementText( "frac14", "\u00bc" ); + parser.defineEntityReplacementText( "frac12", "\u00bd" ); + parser.defineEntityReplacementText( "frac34", "\u00be" ); + parser.defineEntityReplacementText( "iquest", "\u00bf" ); + parser.defineEntityReplacementText( "Agrave", "\u00c0" ); + parser.defineEntityReplacementText( "Aacute", "\u00c1" ); + parser.defineEntityReplacementText( "Acirc", "\u00c2" ); + parser.defineEntityReplacementText( "Atilde", "\u00c3" ); + parser.defineEntityReplacementText( "Auml", "\u00c4" ); + parser.defineEntityReplacementText( "Aring", "\u00c5" ); + parser.defineEntityReplacementText( "AElig", "\u00c6" ); + parser.defineEntityReplacementText( "Ccedil", "\u00c7" ); + parser.defineEntityReplacementText( "Egrave", "\u00c8" ); + parser.defineEntityReplacementText( "Eacute", "\u00c9" ); + parser.defineEntityReplacementText( "Ecirc", "\u00ca" ); + parser.defineEntityReplacementText( "Euml", "\u00cb" ); + parser.defineEntityReplacementText( "Igrave", "\u00cc" ); + parser.defineEntityReplacementText( "Iacute", "\u00cd" ); + parser.defineEntityReplacementText( "Icirc", "\u00ce" ); + parser.defineEntityReplacementText( "Iuml", "\u00cf" ); + parser.defineEntityReplacementText( "ETH", "\u00d0" ); + parser.defineEntityReplacementText( "Ntilde", "\u00d1" ); + parser.defineEntityReplacementText( "Ograve", "\u00d2" ); + parser.defineEntityReplacementText( "Oacute", "\u00d3" ); + parser.defineEntityReplacementText( "Ocirc", "\u00d4" ); + parser.defineEntityReplacementText( "Otilde", "\u00d5" ); + parser.defineEntityReplacementText( "Ouml", "\u00d6" ); + parser.defineEntityReplacementText( "times", "\u00d7" ); + parser.defineEntityReplacementText( "Oslash", "\u00d8" ); + parser.defineEntityReplacementText( "Ugrave", "\u00d9" ); + parser.defineEntityReplacementText( "Uacute", "\u00da" ); + parser.defineEntityReplacementText( "Ucirc", "\u00db" ); + parser.defineEntityReplacementText( "Uuml", "\u00dc" ); + parser.defineEntityReplacementText( "Yacute", "\u00dd" ); + parser.defineEntityReplacementText( "THORN", "\u00de" ); + parser.defineEntityReplacementText( "szlig", "\u00df" ); + parser.defineEntityReplacementText( "agrave", "\u00e0" ); + parser.defineEntityReplacementText( "aacute", "\u00e1" ); + parser.defineEntityReplacementText( "acirc", "\u00e2" ); + parser.defineEntityReplacementText( "atilde", "\u00e3" ); + parser.defineEntityReplacementText( "auml", "\u00e4" ); + parser.defineEntityReplacementText( "aring", "\u00e5" ); + parser.defineEntityReplacementText( "aelig", "\u00e6" ); + parser.defineEntityReplacementText( "ccedil", "\u00e7" ); + parser.defineEntityReplacementText( "egrave", "\u00e8" ); + parser.defineEntityReplacementText( "eacute", "\u00e9" ); + parser.defineEntityReplacementText( "ecirc", "\u00ea" ); + parser.defineEntityReplacementText( "euml", "\u00eb" ); + parser.defineEntityReplacementText( "igrave", "\u00ec" ); + parser.defineEntityReplacementText( "iacute", "\u00ed" ); + parser.defineEntityReplacementText( "icirc", "\u00ee" ); + parser.defineEntityReplacementText( "iuml", "\u00ef" ); + parser.defineEntityReplacementText( "eth", "\u00f0" ); + parser.defineEntityReplacementText( "ntilde", "\u00f1" ); + parser.defineEntityReplacementText( "ograve", "\u00f2" ); + parser.defineEntityReplacementText( "oacute", "\u00f3" ); + parser.defineEntityReplacementText( "ocirc", "\u00f4" ); + parser.defineEntityReplacementText( "otilde", "\u00f5" ); + parser.defineEntityReplacementText( "ouml", "\u00f6" ); + parser.defineEntityReplacementText( "divide", "\u00f7" ); + parser.defineEntityReplacementText( "oslash", "\u00f8" ); + parser.defineEntityReplacementText( "ugrave", "\u00f9" ); + parser.defineEntityReplacementText( "uacute", "\u00fa" ); + parser.defineEntityReplacementText( "ucirc", "\u00fb" ); + parser.defineEntityReplacementText( "uuml", "\u00fc" ); + parser.defineEntityReplacementText( "yacute", "\u00fd" ); + parser.defineEntityReplacementText( "thorn", "\u00fe" ); + parser.defineEntityReplacementText( "yuml", "\u00ff" ); + + // ---------------------------------------------------------------------- + // Special entities + // ---------------------------------------------------------------------- + + parser.defineEntityReplacementText( "OElig", "\u0152" ); + parser.defineEntityReplacementText( "oelig", "\u0153" ); + parser.defineEntityReplacementText( "Scaron", "\u0160" ); + parser.defineEntityReplacementText( "scaron", "\u0161" ); + parser.defineEntityReplacementText( "Yuml", "\u0178" ); + parser.defineEntityReplacementText( "circ", "\u02c6" ); + parser.defineEntityReplacementText( "tilde", "\u02dc" ); + parser.defineEntityReplacementText( "ensp", "\u2002" ); + parser.defineEntityReplacementText( "emsp", "\u2003" ); + parser.defineEntityReplacementText( "thinsp", "\u2009" ); + parser.defineEntityReplacementText( "zwnj", "\u200c" ); + parser.defineEntityReplacementText( "zwj", "\u200d" ); + parser.defineEntityReplacementText( "lrm", "\u200e" ); + parser.defineEntityReplacementText( "rlm", "\u200f" ); + parser.defineEntityReplacementText( "ndash", "\u2013" ); + parser.defineEntityReplacementText( "mdash", "\u2014" ); + parser.defineEntityReplacementText( "lsquo", "\u2018" ); + parser.defineEntityReplacementText( "rsquo", "\u2019" ); + parser.defineEntityReplacementText( "sbquo", "\u201a" ); + parser.defineEntityReplacementText( "ldquo", "\u201c" ); + parser.defineEntityReplacementText( "rdquo", "\u201d" ); + parser.defineEntityReplacementText( "bdquo", "\u201e" ); + parser.defineEntityReplacementText( "dagger", "\u2020" ); + parser.defineEntityReplacementText( "Dagger", "\u2021" ); + parser.defineEntityReplacementText( "permil", "\u2030" ); + parser.defineEntityReplacementText( "lsaquo", "\u2039" ); + parser.defineEntityReplacementText( "rsaquo", "\u203a" ); + parser.defineEntityReplacementText( "euro", "\u20ac" ); + + // ---------------------------------------------------------------------- + // Symbol entities + // ---------------------------------------------------------------------- + + parser.defineEntityReplacementText( "fnof", "\u0192" ); + parser.defineEntityReplacementText( "Alpha", "\u0391" ); + parser.defineEntityReplacementText( "Beta", "\u0392" ); + parser.defineEntityReplacementText( "Gamma", "\u0393" ); + parser.defineEntityReplacementText( "Delta", "\u0394" ); + parser.defineEntityReplacementText( "Epsilon", "\u0395" ); + parser.defineEntityReplacementText( "Zeta", "\u0396" ); + parser.defineEntityReplacementText( "Eta", "\u0397" ); + parser.defineEntityReplacementText( "Theta", "\u0398" ); + parser.defineEntityReplacementText( "Iota", "\u0399" ); + parser.defineEntityReplacementText( "Kappa", "\u039a" ); + parser.defineEntityReplacementText( "Lambda", "\u039b" ); + parser.defineEntityReplacementText( "Mu", "\u039c" ); + parser.defineEntityReplacementText( "Nu", "\u039d" ); + parser.defineEntityReplacementText( "Xi", "\u039e" ); + parser.defineEntityReplacementText( "Omicron", "\u039f" ); + parser.defineEntityReplacementText( "Pi", "\u03a0" ); + parser.defineEntityReplacementText( "Rho", "\u03a1" ); + parser.defineEntityReplacementText( "Sigma", "\u03a3" ); + parser.defineEntityReplacementText( "Tau", "\u03a4" ); + parser.defineEntityReplacementText( "Upsilon", "\u03a5" ); + parser.defineEntityReplacementText( "Phi", "\u03a6" ); + parser.defineEntityReplacementText( "Chi", "\u03a7" ); + parser.defineEntityReplacementText( "Psi", "\u03a8" ); + parser.defineEntityReplacementText( "Omega", "\u03a9" ); + parser.defineEntityReplacementText( "alpha", "\u03b1" ); + parser.defineEntityReplacementText( "beta", "\u03b2" ); + parser.defineEntityReplacementText( "gamma", "\u03b3" ); + parser.defineEntityReplacementText( "delta", "\u03b4" ); + parser.defineEntityReplacementText( "epsilon", "\u03b5" ); + parser.defineEntityReplacementText( "zeta", "\u03b6" ); + parser.defineEntityReplacementText( "eta", "\u03b7" ); + parser.defineEntityReplacementText( "theta", "\u03b8" ); + parser.defineEntityReplacementText( "iota", "\u03b9" ); + parser.defineEntityReplacementText( "kappa", "\u03ba" ); + parser.defineEntityReplacementText( "lambda", "\u03bb" ); + parser.defineEntityReplacementText( "mu", "\u03bc" ); + parser.defineEntityReplacementText( "nu", "\u03bd" ); + parser.defineEntityReplacementText( "xi", "\u03be" ); + parser.defineEntityReplacementText( "omicron", "\u03bf" ); + parser.defineEntityReplacementText( "pi", "\u03c0" ); + parser.defineEntityReplacementText( "rho", "\u03c1" ); + parser.defineEntityReplacementText( "sigmaf", "\u03c2" ); + parser.defineEntityReplacementText( "sigma", "\u03c3" ); + parser.defineEntityReplacementText( "tau", "\u03c4" ); + parser.defineEntityReplacementText( "upsilon", "\u03c5" ); + parser.defineEntityReplacementText( "phi", "\u03c6" ); + parser.defineEntityReplacementText( "chi", "\u03c7" ); + parser.defineEntityReplacementText( "psi", "\u03c8" ); + parser.defineEntityReplacementText( "omega", "\u03c9" ); + parser.defineEntityReplacementText( "thetasym", "\u03d1" ); + parser.defineEntityReplacementText( "upsih", "\u03d2" ); + parser.defineEntityReplacementText( "piv", "\u03d6" ); + parser.defineEntityReplacementText( "bull", "\u2022" ); + parser.defineEntityReplacementText( "hellip", "\u2026" ); + parser.defineEntityReplacementText( "prime", "\u2032" ); + parser.defineEntityReplacementText( "Prime", "\u2033" ); + parser.defineEntityReplacementText( "oline", "\u203e" ); + parser.defineEntityReplacementText( "frasl", "\u2044" ); + parser.defineEntityReplacementText( "weierp", "\u2118" ); + parser.defineEntityReplacementText( "image", "\u2111" ); + parser.defineEntityReplacementText( "real", "\u211c" ); + parser.defineEntityReplacementText( "trade", "\u2122" ); + parser.defineEntityReplacementText( "alefsym", "\u2135" ); + parser.defineEntityReplacementText( "larr", "\u2190" ); + parser.defineEntityReplacementText( "uarr", "\u2191" ); + parser.defineEntityReplacementText( "rarr", "\u2192" ); + parser.defineEntityReplacementText( "darr", "\u2193" ); + parser.defineEntityReplacementText( "harr", "\u2194" ); + parser.defineEntityReplacementText( "crarr", "\u21b5" ); + parser.defineEntityReplacementText( "lArr", "\u21d0" ); + parser.defineEntityReplacementText( "uArr", "\u21d1" ); + parser.defineEntityReplacementText( "rArr", "\u21d2" ); + parser.defineEntityReplacementText( "dArr", "\u21d3" ); + parser.defineEntityReplacementText( "hArr", "\u21d4" ); + parser.defineEntityReplacementText( "forall", "\u2200" ); + parser.defineEntityReplacementText( "part", "\u2202" ); + parser.defineEntityReplacementText( "exist", "\u2203" ); + parser.defineEntityReplacementText( "empty", "\u2205" ); + parser.defineEntityReplacementText( "nabla", "\u2207" ); + parser.defineEntityReplacementText( "isin", "\u2208" ); + parser.defineEntityReplacementText( "notin", "\u2209" ); + parser.defineEntityReplacementText( "ni", "\u220b" ); + parser.defineEntityReplacementText( "prod", "\u220f" ); + parser.defineEntityReplacementText( "sum", "\u2211" ); + parser.defineEntityReplacementText( "minus", "\u2212" ); + parser.defineEntityReplacementText( "lowast", "\u2217" ); + parser.defineEntityReplacementText( "radic", "\u221a" ); + parser.defineEntityReplacementText( "prop", "\u221d" ); + parser.defineEntityReplacementText( "infin", "\u221e" ); + parser.defineEntityReplacementText( "ang", "\u2220" ); + parser.defineEntityReplacementText( "and", "\u2227" ); + parser.defineEntityReplacementText( "or", "\u2228" ); + parser.defineEntityReplacementText( "cap", "\u2229" ); + parser.defineEntityReplacementText( "cup", "\u222a" ); + parser.defineEntityReplacementText( "int", "\u222b" ); + parser.defineEntityReplacementText( "there4", "\u2234" ); + parser.defineEntityReplacementText( "sim", "\u223c" ); + parser.defineEntityReplacementText( "cong", "\u2245" ); + parser.defineEntityReplacementText( "asymp", "\u2248" ); + parser.defineEntityReplacementText( "ne", "\u2260" ); + parser.defineEntityReplacementText( "equiv", "\u2261" ); + parser.defineEntityReplacementText( "le", "\u2264" ); + parser.defineEntityReplacementText( "ge", "\u2265" ); + parser.defineEntityReplacementText( "sub", "\u2282" ); + parser.defineEntityReplacementText( "sup", "\u2283" ); + parser.defineEntityReplacementText( "nsub", "\u2284" ); + parser.defineEntityReplacementText( "sube", "\u2286" ); + parser.defineEntityReplacementText( "supe", "\u2287" ); + parser.defineEntityReplacementText( "oplus", "\u2295" ); + parser.defineEntityReplacementText( "otimes", "\u2297" ); + parser.defineEntityReplacementText( "perp", "\u22a5" ); + parser.defineEntityReplacementText( "sdot", "\u22c5" ); + parser.defineEntityReplacementText( "lceil", "\u2308" ); + parser.defineEntityReplacementText( "rceil", "\u2309" ); + parser.defineEntityReplacementText( "lfloor", "\u230a" ); + parser.defineEntityReplacementText( "rfloor", "\u230b" ); + parser.defineEntityReplacementText( "lang", "\u2329" ); + parser.defineEntityReplacementText( "rang", "\u232a" ); + parser.defineEntityReplacementText( "loz", "\u25ca" ); + parser.defineEntityReplacementText( "spades", "\u2660" ); + parser.defineEntityReplacementText( "clubs", "\u2663" ); + parser.defineEntityReplacementText( "hearts", "\u2665" ); + parser.defineEntityReplacementText( "diams", "\u2666" ); + + } + + return parseModel( "model", parser ); + } //-- Model read(Reader) + + /** + * Returns the state of the "add default entities" flag. + * + * @param addDefaultEntities + */ + public void setAddDefaultEntities( boolean addDefaultEntities ) + { + this.addDefaultEntities = addDefaultEntities; + } //-- void setAddDefaultEntities(boolean) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/io/xpp3/MavenXpp3Writer.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/io/xpp3/MavenXpp3Writer.java new file mode 100644 index 0000000000..107d9553b2 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v3_0_0/io/xpp3/MavenXpp3Writer.java @@ -0,0 +1,945 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v3_0_0.io.xpp3; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + +import org.apache.maven.model.v3_0_0.Branch; +import org.apache.maven.model.v3_0_0.Build; +import org.apache.maven.model.v3_0_0.Contributor; +import org.apache.maven.model.v3_0_0.Dependency; +import org.apache.maven.model.v3_0_0.Developer; +import org.apache.maven.model.v3_0_0.FileSet; +import org.apache.maven.model.v3_0_0.License; +import org.apache.maven.model.v3_0_0.MailingList; +import org.apache.maven.model.v3_0_0.Model; +import org.apache.maven.model.v3_0_0.Organization; +import org.apache.maven.model.v3_0_0.PackageGroup; +import org.apache.maven.model.v3_0_0.PatternSet; +import org.apache.maven.model.v3_0_0.Repository; +import org.apache.maven.model.v3_0_0.Resource; +import org.apache.maven.model.v3_0_0.SourceModification; +import org.apache.maven.model.v3_0_0.UnitTest; +import org.apache.maven.model.v3_0_0.Version; +import org.codehaus.plexus.util.xml.pull.MXSerializer; +import org.codehaus.plexus.util.xml.pull.XmlSerializer; + +import java.io.Writer; +import java.util.Iterator; + +/** + * Class MavenXpp3Writer. + * + * @version $Revision$ $Date$ + */ +public class MavenXpp3Writer +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field serializer + */ + private org.codehaus.plexus.util.xml.pull.XmlSerializer serializer; + + /** + * Field NAMESPACE + */ + private String NAMESPACE; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method write + * + * @param writer + * @param model + */ + public void write( Writer writer, Model model ) throws Exception + { + serializer = new MXSerializer(); + serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-indentation", " " ); + serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n" ); + serializer.setOutput( writer ); + writeModel( model, "model", serializer ); + } //-- void write(Writer, Model) + + /** + * Method writeBranch + * + * @param branch + * @param serializer + * @param tagName + */ + private void writeBranch( Branch branch, String tagName, XmlSerializer serializer ) throws Exception + { + if ( branch != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( branch.getTag() != null ) + { + serializer.startTag( NAMESPACE, "tag" ).text( branch.getTag() ).endTag( NAMESPACE, "tag" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writeBranch(Branch, String, XmlSerializer) + + /** + * Method writeBuild + * + * @param build + * @param serializer + * @param tagName + */ + private void writeBuild( Build build, String tagName, XmlSerializer serializer ) throws Exception + { + if ( build != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( build.getNagEmailAddress() != null ) + { + serializer.startTag( NAMESPACE, "nagEmailAddress" ).text( build.getNagEmailAddress() ) + .endTag( NAMESPACE, "nagEmailAddress" ); + } + if ( build.getSourceDirectory() != null ) + { + serializer.startTag( NAMESPACE, "sourceDirectory" ).text( build.getSourceDirectory() ) + .endTag( NAMESPACE, "sourceDirectory" ); + } + if ( build.getUnitTestSourceDirectory() != null ) + { + serializer.startTag( NAMESPACE, "unitTestSourceDirectory" ).text( build.getUnitTestSourceDirectory() ) + .endTag( NAMESPACE, "unitTestSourceDirectory" ); + } + if ( build.getAspectSourceDirectory() != null ) + { + serializer.startTag( NAMESPACE, "aspectSourceDirectory" ).text( build.getAspectSourceDirectory() ) + .endTag( NAMESPACE, "aspectSourceDirectory" ); + } + if ( build.getIntegrationUnitTestSourceDirectory() != null ) + { + serializer.startTag( NAMESPACE, "integrationUnitTestSourceDirectory" ) + .text( build.getIntegrationUnitTestSourceDirectory() ) + .endTag( NAMESPACE, "integrationUnitTestSourceDirectory" ); + } + if ( build.getSourceModifications() != null && build.getSourceModifications().size() > 0 ) + { + serializer.startTag( NAMESPACE, "sourceModifications" ); + for ( Iterator iter = build.getSourceModifications().iterator(); iter.hasNext(); ) + { + SourceModification sourceModification = (SourceModification) iter.next(); + writeSourceModification( sourceModification, "sourceModification", serializer ); + } + serializer.endTag( NAMESPACE, "sourceModifications" ); + } + if ( build.getUnitTest() != null ) + { + writeUnitTest( build.getUnitTest(), "unitTest", serializer ); + } + if ( build.getResources() != null && build.getResources().size() > 0 ) + { + serializer.startTag( NAMESPACE, "resources" ); + for ( Iterator iter = build.getResources().iterator(); iter.hasNext(); ) + { + Resource resource = (Resource) iter.next(); + writeResource( resource, "resource", serializer ); + } + serializer.endTag( NAMESPACE, "resources" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writeBuild(Build, String, XmlSerializer) + + /** + * Method writeContributor + * + * @param contributor + * @param serializer + * @param tagName + */ + private void writeContributor( Contributor contributor, String tagName, XmlSerializer serializer ) throws Exception + { + if ( contributor != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( contributor.getName() != null ) + { + serializer.startTag( NAMESPACE, "name" ).text( contributor.getName() ).endTag( NAMESPACE, "name" ); + } + if ( contributor.getEmail() != null ) + { + serializer.startTag( NAMESPACE, "email" ).text( contributor.getEmail() ).endTag( NAMESPACE, "email" ); + } + if ( contributor.getUrl() != null ) + { + serializer.startTag( NAMESPACE, "url" ).text( contributor.getUrl() ).endTag( NAMESPACE, "url" ); + } + if ( contributor.getOrganization() != null ) + { + serializer.startTag( NAMESPACE, "organization" ).text( contributor.getOrganization() ) + .endTag( NAMESPACE, "organization" ); + } + if ( contributor.getRoles() != null && contributor.getRoles().size() > 0 ) + { + serializer.startTag( NAMESPACE, "roles" ); + for ( Iterator iter = contributor.getRoles().iterator(); iter.hasNext(); ) + { + String role = (String) iter.next(); + serializer.startTag( NAMESPACE, "role" ).text( role ).endTag( NAMESPACE, "role" ); + } + serializer.endTag( NAMESPACE, "roles" ); + } + if ( contributor.getTimezone() != null ) + { + serializer.startTag( NAMESPACE, "timezone" ).text( contributor.getTimezone() ).endTag( NAMESPACE, + "timezone" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writeContributor(Contributor, String, XmlSerializer) + + /** + * Method writeDependency + * + * @param dependency + * @param serializer + * @param tagName + */ + private void writeDependency( Dependency dependency, String tagName, XmlSerializer serializer ) throws Exception + { + if ( dependency != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( dependency.getId() != null ) + { + serializer.startTag( NAMESPACE, "id" ).text( dependency.getId() ).endTag( NAMESPACE, "id" ); + } + if ( dependency.getGroupId() != null ) + { + serializer.startTag( NAMESPACE, "groupId" ).text( dependency.getGroupId() ).endTag( NAMESPACE, + "groupId" ); + } + if ( dependency.getArtifactId() != null ) + { + serializer.startTag( NAMESPACE, "artifactId" ).text( dependency.getArtifactId() ).endTag( NAMESPACE, + "artifactId" ); + } + if ( dependency.getVersion() != null ) + { + serializer.startTag( NAMESPACE, "version" ).text( dependency.getVersion() ).endTag( NAMESPACE, + "version" ); + } + if ( dependency.getUrl() != null ) + { + serializer.startTag( NAMESPACE, "url" ).text( dependency.getUrl() ).endTag( NAMESPACE, "url" ); + } + if ( dependency.getJar() != null ) + { + serializer.startTag( NAMESPACE, "jar" ).text( dependency.getJar() ).endTag( NAMESPACE, "jar" ); + } + if ( dependency.getType() != null ) + { + serializer.startTag( NAMESPACE, "type" ).text( dependency.getType() ).endTag( NAMESPACE, "type" ); + } + if ( dependency.getProperties() != null && dependency.getProperties().size() > 0 ) + { + serializer.startTag( NAMESPACE, "properties" ); + for ( Iterator iter = dependency.getProperties().keySet().iterator(); iter.hasNext(); ) + { + String key = (String) iter.next(); + String value = (String) dependency.getProperties().get( key ); + serializer.startTag( NAMESPACE, "" + key + "" ).text( value ).endTag( NAMESPACE, "" + key + "" ); + } + serializer.endTag( NAMESPACE, "properties" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writeDependency(Dependency, String, XmlSerializer) + + /** + * Method writeDeveloper + * + * @param developer + * @param serializer + * @param tagName + */ + private void writeDeveloper( Developer developer, String tagName, XmlSerializer serializer ) throws Exception + { + if ( developer != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( developer.getId() != null ) + { + serializer.startTag( NAMESPACE, "id" ).text( developer.getId() ).endTag( NAMESPACE, "id" ); + } + if ( developer.getName() != null ) + { + serializer.startTag( NAMESPACE, "name" ).text( developer.getName() ).endTag( NAMESPACE, "name" ); + } + if ( developer.getEmail() != null ) + { + serializer.startTag( NAMESPACE, "email" ).text( developer.getEmail() ).endTag( NAMESPACE, "email" ); + } + if ( developer.getUrl() != null ) + { + serializer.startTag( NAMESPACE, "url" ).text( developer.getUrl() ).endTag( NAMESPACE, "url" ); + } + if ( developer.getOrganization() != null ) + { + serializer.startTag( NAMESPACE, "organization" ).text( developer.getOrganization() ) + .endTag( NAMESPACE, "organization" ); + } + if ( developer.getRoles() != null && developer.getRoles().size() > 0 ) + { + serializer.startTag( NAMESPACE, "roles" ); + for ( Iterator iter = developer.getRoles().iterator(); iter.hasNext(); ) + { + String role = (String) iter.next(); + serializer.startTag( NAMESPACE, "role" ).text( role ).endTag( NAMESPACE, "role" ); + } + serializer.endTag( NAMESPACE, "roles" ); + } + if ( developer.getTimezone() != null ) + { + serializer.startTag( NAMESPACE, "timezone" ).text( developer.getTimezone() ).endTag( NAMESPACE, + "timezone" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writeDeveloper(Developer, String, XmlSerializer) + + /** + * Method writeFileSet + * + * @param fileSet + * @param serializer + * @param tagName + */ + private void writeFileSet( FileSet fileSet, String tagName, XmlSerializer serializer ) throws Exception + { + if ( fileSet != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( fileSet.getDirectory() != null ) + { + serializer.startTag( NAMESPACE, "directory" ).text( fileSet.getDirectory() ).endTag( NAMESPACE, + "directory" ); + } + if ( fileSet.getIncludes() != null && fileSet.getIncludes().size() > 0 ) + { + serializer.startTag( NAMESPACE, "includes" ); + for ( Iterator iter = fileSet.getIncludes().iterator(); iter.hasNext(); ) + { + String include = (String) iter.next(); + serializer.startTag( NAMESPACE, "include" ).text( include ).endTag( NAMESPACE, "include" ); + } + serializer.endTag( NAMESPACE, "includes" ); + } + if ( fileSet.getExcludes() != null && fileSet.getExcludes().size() > 0 ) + { + serializer.startTag( NAMESPACE, "excludes" ); + for ( Iterator iter = fileSet.getExcludes().iterator(); iter.hasNext(); ) + { + String exclude = (String) iter.next(); + serializer.startTag( NAMESPACE, "exclude" ).text( exclude ).endTag( NAMESPACE, "exclude" ); + } + serializer.endTag( NAMESPACE, "excludes" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writeFileSet(FileSet, String, XmlSerializer) + + /** + * Method writeLicense + * + * @param license + * @param serializer + * @param tagName + */ + private void writeLicense( License license, String tagName, XmlSerializer serializer ) throws Exception + { + if ( license != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( license.getName() != null ) + { + serializer.startTag( NAMESPACE, "name" ).text( license.getName() ).endTag( NAMESPACE, "name" ); + } + if ( license.getUrl() != null ) + { + serializer.startTag( NAMESPACE, "url" ).text( license.getUrl() ).endTag( NAMESPACE, "url" ); + } + if ( license.getDistribution() != null ) + { + serializer.startTag( NAMESPACE, "distribution" ).text( license.getDistribution() ) + .endTag( NAMESPACE, "distribution" ); + } + if ( license.getComments() != null ) + { + serializer.startTag( NAMESPACE, "comments" ).text( license.getComments() ).endTag( NAMESPACE, + "comments" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writeLicense(License, String, XmlSerializer) + + /** + * Method writeMailingList + * + * @param mailingList + * @param serializer + * @param tagName + */ + private void writeMailingList( MailingList mailingList, String tagName, XmlSerializer serializer ) throws Exception + { + if ( mailingList != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( mailingList.getName() != null ) + { + serializer.startTag( NAMESPACE, "name" ).text( mailingList.getName() ).endTag( NAMESPACE, "name" ); + } + if ( mailingList.getSubscribe() != null ) + { + serializer.startTag( NAMESPACE, "subscribe" ).text( mailingList.getSubscribe() ).endTag( NAMESPACE, + "subscribe" ); + } + if ( mailingList.getUnsubscribe() != null ) + { + serializer.startTag( NAMESPACE, "unsubscribe" ).text( mailingList.getUnsubscribe() ) + .endTag( NAMESPACE, "unsubscribe" ); + } + if ( mailingList.getArchive() != null ) + { + serializer.startTag( NAMESPACE, "archive" ).text( mailingList.getArchive() ).endTag( NAMESPACE, + "archive" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writeMailingList(MailingList, String, XmlSerializer) + + /** + * Method writeModel + * + * @param model + * @param serializer + * @param tagName + */ + private void writeModel( Model model, String tagName, XmlSerializer serializer ) throws Exception + { + if ( model != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( model.getExtend() != null ) + { + serializer.startTag( NAMESPACE, "extend" ).text( model.getExtend() ).endTag( NAMESPACE, "extend" ); + } + if ( model.getPomVersion() != null ) + { + serializer.startTag( NAMESPACE, "pomVersion" ).text( model.getPomVersion() ).endTag( NAMESPACE, + "pomVersion" ); + } + if ( model.getId() != null ) + { + serializer.startTag( NAMESPACE, "id" ).text( model.getId() ).endTag( NAMESPACE, "id" ); + } + if ( model.getGroupId() != null ) + { + serializer.startTag( NAMESPACE, "groupId" ).text( model.getGroupId() ).endTag( NAMESPACE, "groupId" ); + } + if ( model.getArtifactId() != null ) + { + serializer.startTag( NAMESPACE, "artifactId" ).text( model.getArtifactId() ).endTag( NAMESPACE, + "artifactId" ); + } + if ( model.getName() != null ) + { + serializer.startTag( NAMESPACE, "name" ).text( model.getName() ).endTag( NAMESPACE, "name" ); + } + if ( model.getCurrentVersion() != null ) + { + serializer.startTag( NAMESPACE, "currentVersion" ).text( model.getCurrentVersion() ) + .endTag( NAMESPACE, "currentVersion" ); + } + if ( model.getShortDescription() != null ) + { + serializer.startTag( NAMESPACE, "shortDescription" ).text( model.getShortDescription() ) + .endTag( NAMESPACE, "shortDescription" ); + } + if ( model.getDescription() != null ) + { + serializer.startTag( NAMESPACE, "description" ).text( model.getDescription() ).endTag( NAMESPACE, + "description" ); + } + if ( model.getUrl() != null ) + { + serializer.startTag( NAMESPACE, "url" ).text( model.getUrl() ).endTag( NAMESPACE, "url" ); + } + if ( model.getLogo() != null ) + { + serializer.startTag( NAMESPACE, "logo" ).text( model.getLogo() ).endTag( NAMESPACE, "logo" ); + } + if ( model.getIssueTrackingUrl() != null ) + { + serializer.startTag( NAMESPACE, "issueTrackingUrl" ).text( model.getIssueTrackingUrl() ) + .endTag( NAMESPACE, "issueTrackingUrl" ); + } + if ( model.getInceptionYear() != null ) + { + serializer.startTag( NAMESPACE, "inceptionYear" ).text( model.getInceptionYear() ) + .endTag( NAMESPACE, "inceptionYear" ); + } + if ( model.getGumpRepositoryId() != null ) + { + serializer.startTag( NAMESPACE, "gumpRepositoryId" ).text( model.getGumpRepositoryId() ) + .endTag( NAMESPACE, "gumpRepositoryId" ); + } + if ( model.getSiteAddress() != null ) + { + serializer.startTag( NAMESPACE, "siteAddress" ).text( model.getSiteAddress() ).endTag( NAMESPACE, + "siteAddress" ); + } + if ( model.getSiteDirectory() != null ) + { + serializer.startTag( NAMESPACE, "siteDirectory" ).text( model.getSiteDirectory() ) + .endTag( NAMESPACE, "siteDirectory" ); + } + if ( model.getDistributionSite() != null ) + { + serializer.startTag( NAMESPACE, "distributionSite" ).text( model.getDistributionSite() ) + .endTag( NAMESPACE, "distributionSite" ); + } + if ( model.getDistributionDirectory() != null ) + { + serializer.startTag( NAMESPACE, "distributionDirectory" ).text( model.getDistributionDirectory() ) + .endTag( NAMESPACE, "distributionDirectory" ); + } + if ( model.getMailingLists() != null && model.getMailingLists().size() > 0 ) + { + serializer.startTag( NAMESPACE, "mailingLists" ); + for ( Iterator iter = model.getMailingLists().iterator(); iter.hasNext(); ) + { + MailingList mailingList = (MailingList) iter.next(); + writeMailingList( mailingList, "mailingList", serializer ); + } + serializer.endTag( NAMESPACE, "mailingLists" ); + } + if ( model.getDevelopers() != null && model.getDevelopers().size() > 0 ) + { + serializer.startTag( NAMESPACE, "developers" ); + for ( Iterator iter = model.getDevelopers().iterator(); iter.hasNext(); ) + { + Developer developer = (Developer) iter.next(); + writeDeveloper( developer, "developer", serializer ); + } + serializer.endTag( NAMESPACE, "developers" ); + } + if ( model.getContributors() != null && model.getContributors().size() > 0 ) + { + serializer.startTag( NAMESPACE, "contributors" ); + for ( Iterator iter = model.getContributors().iterator(); iter.hasNext(); ) + { + Contributor contributor = (Contributor) iter.next(); + writeContributor( contributor, "contributor", serializer ); + } + serializer.endTag( NAMESPACE, "contributors" ); + } + if ( model.getDependencies() != null && model.getDependencies().size() > 0 ) + { + serializer.startTag( NAMESPACE, "dependencies" ); + for ( Iterator iter = model.getDependencies().iterator(); iter.hasNext(); ) + { + Dependency dependency = (Dependency) iter.next(); + writeDependency( dependency, "dependency", serializer ); + } + serializer.endTag( NAMESPACE, "dependencies" ); + } + if ( model.getLicenses() != null && model.getLicenses().size() > 0 ) + { + serializer.startTag( NAMESPACE, "licenses" ); + for ( Iterator iter = model.getLicenses().iterator(); iter.hasNext(); ) + { + License license = (License) iter.next(); + writeLicense( license, "license", serializer ); + } + serializer.endTag( NAMESPACE, "licenses" ); + } + if ( model.getVersions() != null && model.getVersions().size() > 0 ) + { + serializer.startTag( NAMESPACE, "versions" ); + for ( Iterator iter = model.getVersions().iterator(); iter.hasNext(); ) + { + Version version = (Version) iter.next(); + writeVersion( version, "version", serializer ); + } + serializer.endTag( NAMESPACE, "versions" ); + } + if ( model.getBranches() != null && model.getBranches().size() > 0 ) + { + serializer.startTag( NAMESPACE, "branches" ); + for ( Iterator iter = model.getBranches().iterator(); iter.hasNext(); ) + { + Branch branch = (Branch) iter.next(); + writeBranch( branch, "branch", serializer ); + } + serializer.endTag( NAMESPACE, "branches" ); + } + if ( model.getPackageGroups() != null && model.getPackageGroups().size() > 0 ) + { + serializer.startTag( NAMESPACE, "packageGroups" ); + for ( Iterator iter = model.getPackageGroups().iterator(); iter.hasNext(); ) + { + PackageGroup packageGroup = (PackageGroup) iter.next(); + writePackageGroup( packageGroup, "packageGroup", serializer ); + } + serializer.endTag( NAMESPACE, "packageGroups" ); + } + if ( model.getReports() != null && model.getReports().size() > 0 ) + { + serializer.startTag( NAMESPACE, "reports" ); + for ( Iterator iter = model.getReports().iterator(); iter.hasNext(); ) + { + String report = (String) iter.next(); + serializer.startTag( NAMESPACE, "report" ).text( report ).endTag( NAMESPACE, "report" ); + } + serializer.endTag( NAMESPACE, "reports" ); + } + if ( model.getRepository() != null ) + { + writeRepository( model.getRepository(), "repository", serializer ); + } + if ( model.getBuild() != null ) + { + writeBuild( model.getBuild(), "build", serializer ); + } + if ( model.getOrganization() != null ) + { + writeOrganization( model.getOrganization(), "organization", serializer ); + } + if ( model.getProperties() != null && model.getProperties().size() > 0 ) + { + serializer.startTag( NAMESPACE, "properties" ); + for ( Iterator iter = model.getProperties().keySet().iterator(); iter.hasNext(); ) + { + String key = (String) iter.next(); + String value = (String) model.getProperties().get( key ); + serializer.startTag( NAMESPACE, "" + key + "" ).text( value ).endTag( NAMESPACE, "" + key + "" ); + } + serializer.endTag( NAMESPACE, "properties" ); + } + if ( model.getPackageName() != null ) + { + serializer.startTag( NAMESPACE, "package" ).text( model.getPackageName() ) + .endTag( NAMESPACE, "package" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writeModel(Model, String, XmlSerializer) + + /** + * Method writeOrganization + * + * @param organization + * @param serializer + * @param tagName + */ + private void writeOrganization( Organization organization, String tagName, XmlSerializer serializer ) + throws Exception + { + if ( organization != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( organization.getName() != null ) + { + serializer.startTag( NAMESPACE, "name" ).text( organization.getName() ).endTag( NAMESPACE, "name" ); + } + if ( organization.getUrl() != null ) + { + serializer.startTag( NAMESPACE, "url" ).text( organization.getUrl() ).endTag( NAMESPACE, "url" ); + } + if ( organization.getLogo() != null ) + { + serializer.startTag( NAMESPACE, "logo" ).text( organization.getLogo() ).endTag( NAMESPACE, "logo" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writeOrganization(Organization, String, XmlSerializer) + + /** + * Method writePackageGroup + * + * @param packageGroup + * @param serializer + * @param tagName + */ + private void writePackageGroup( PackageGroup packageGroup, String tagName, XmlSerializer serializer ) + throws Exception + { + if ( packageGroup != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( packageGroup.getTitle() != null ) + { + serializer.startTag( NAMESPACE, "title" ).text( packageGroup.getTitle() ).endTag( NAMESPACE, "title" ); + } + if ( packageGroup.getPackages() != null ) + { + serializer.startTag( NAMESPACE, "packages" ).text( packageGroup.getPackages() ).endTag( NAMESPACE, + "packages" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writePackageGroup(PackageGroup, String, XmlSerializer) + + /** + * Method writePatternSet + * + * @param patternSet + * @param serializer + * @param tagName + */ + private void writePatternSet( PatternSet patternSet, String tagName, XmlSerializer serializer ) throws Exception + { + if ( patternSet != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( patternSet.getIncludes() != null && patternSet.getIncludes().size() > 0 ) + { + serializer.startTag( NAMESPACE, "includes" ); + for ( Iterator iter = patternSet.getIncludes().iterator(); iter.hasNext(); ) + { + String include = (String) iter.next(); + serializer.startTag( NAMESPACE, "include" ).text( include ).endTag( NAMESPACE, "include" ); + } + serializer.endTag( NAMESPACE, "includes" ); + } + if ( patternSet.getExcludes() != null && patternSet.getExcludes().size() > 0 ) + { + serializer.startTag( NAMESPACE, "excludes" ); + for ( Iterator iter = patternSet.getExcludes().iterator(); iter.hasNext(); ) + { + String exclude = (String) iter.next(); + serializer.startTag( NAMESPACE, "exclude" ).text( exclude ).endTag( NAMESPACE, "exclude" ); + } + serializer.endTag( NAMESPACE, "excludes" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writePatternSet(PatternSet, String, XmlSerializer) + + /** + * Method writeRepository + * + * @param repository + * @param serializer + * @param tagName + */ + private void writeRepository( Repository repository, String tagName, XmlSerializer serializer ) throws Exception + { + if ( repository != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( repository.getConnection() != null ) + { + serializer.startTag( NAMESPACE, "connection" ).text( repository.getConnection() ).endTag( NAMESPACE, + "connection" ); + } + if ( repository.getDeveloperConnection() != null ) + { + serializer.startTag( NAMESPACE, "developerConnection" ).text( repository.getDeveloperConnection() ) + .endTag( NAMESPACE, "developerConnection" ); + } + if ( repository.getUrl() != null ) + { + serializer.startTag( NAMESPACE, "url" ).text( repository.getUrl() ).endTag( NAMESPACE, "url" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writeRepository(Repository, String, XmlSerializer) + + /** + * Method writeResource + * + * @param resource + * @param serializer + * @param tagName + */ + private void writeResource( Resource resource, String tagName, XmlSerializer serializer ) throws Exception + { + if ( resource != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( resource.getTargetPath() != null ) + { + serializer.startTag( NAMESPACE, "targetPath" ).text( resource.getTargetPath() ).endTag( NAMESPACE, + "targetPath" ); + } + if ( resource.isFiltering() != false ) + { + serializer.startTag( NAMESPACE, "filtering" ).text( String.valueOf( resource.isFiltering() ) ) + .endTag( NAMESPACE, "filtering" ); + } + if ( resource.getDirectory() != null ) + { + serializer.startTag( NAMESPACE, "directory" ).text( resource.getDirectory() ).endTag( NAMESPACE, + "directory" ); + } + if ( resource.getIncludes() != null && resource.getIncludes().size() > 0 ) + { + serializer.startTag( NAMESPACE, "includes" ); + for ( Iterator iter = resource.getIncludes().iterator(); iter.hasNext(); ) + { + String include = (String) iter.next(); + serializer.startTag( NAMESPACE, "include" ).text( include ).endTag( NAMESPACE, "include" ); + } + serializer.endTag( NAMESPACE, "includes" ); + } + if ( resource.getExcludes() != null && resource.getExcludes().size() > 0 ) + { + serializer.startTag( NAMESPACE, "excludes" ); + for ( Iterator iter = resource.getExcludes().iterator(); iter.hasNext(); ) + { + String exclude = (String) iter.next(); + serializer.startTag( NAMESPACE, "exclude" ).text( exclude ).endTag( NAMESPACE, "exclude" ); + } + serializer.endTag( NAMESPACE, "excludes" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writeResource(Resource, String, XmlSerializer) + + /** + * Method writeSourceModification + * + * @param sourceModification + * @param serializer + * @param tagName + */ + private void writeSourceModification( SourceModification sourceModification, String tagName, + XmlSerializer serializer ) throws Exception + { + if ( sourceModification != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( sourceModification.getClassName() != null ) + { + serializer.startTag( NAMESPACE, "className" ).text( sourceModification.getClassName() ) + .endTag( NAMESPACE, "className" ); + } + if ( sourceModification.getProperty() != null ) + { + serializer.startTag( NAMESPACE, "property" ).text( sourceModification.getProperty() ) + .endTag( NAMESPACE, "property" ); + } + if ( sourceModification.getDirectory() != null ) + { + serializer.startTag( NAMESPACE, "directory" ).text( sourceModification.getDirectory() ) + .endTag( NAMESPACE, "directory" ); + } + if ( sourceModification.getIncludes() != null && sourceModification.getIncludes().size() > 0 ) + { + serializer.startTag( NAMESPACE, "includes" ); + for ( Iterator iter = sourceModification.getIncludes().iterator(); iter.hasNext(); ) + { + String include = (String) iter.next(); + serializer.startTag( NAMESPACE, "include" ).text( include ).endTag( NAMESPACE, "include" ); + } + serializer.endTag( NAMESPACE, "includes" ); + } + if ( sourceModification.getExcludes() != null && sourceModification.getExcludes().size() > 0 ) + { + serializer.startTag( NAMESPACE, "excludes" ); + for ( Iterator iter = sourceModification.getExcludes().iterator(); iter.hasNext(); ) + { + String exclude = (String) iter.next(); + serializer.startTag( NAMESPACE, "exclude" ).text( exclude ).endTag( NAMESPACE, "exclude" ); + } + serializer.endTag( NAMESPACE, "excludes" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writeSourceModification(SourceModification, String, XmlSerializer) + + /** + * Method writeUnitTest + * + * @param unitTest + * @param serializer + * @param tagName + */ + private void writeUnitTest( UnitTest unitTest, String tagName, XmlSerializer serializer ) throws Exception + { + if ( unitTest != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( unitTest.getResources() != null && unitTest.getResources().size() > 0 ) + { + serializer.startTag( NAMESPACE, "resources" ); + for ( Iterator iter = unitTest.getResources().iterator(); iter.hasNext(); ) + { + Resource resource = (Resource) iter.next(); + writeResource( resource, "resource", serializer ); + } + serializer.endTag( NAMESPACE, "resources" ); + } + if ( unitTest.getIncludes() != null && unitTest.getIncludes().size() > 0 ) + { + serializer.startTag( NAMESPACE, "includes" ); + for ( Iterator iter = unitTest.getIncludes().iterator(); iter.hasNext(); ) + { + String include = (String) iter.next(); + serializer.startTag( NAMESPACE, "include" ).text( include ).endTag( NAMESPACE, "include" ); + } + serializer.endTag( NAMESPACE, "includes" ); + } + if ( unitTest.getExcludes() != null && unitTest.getExcludes().size() > 0 ) + { + serializer.startTag( NAMESPACE, "excludes" ); + for ( Iterator iter = unitTest.getExcludes().iterator(); iter.hasNext(); ) + { + String exclude = (String) iter.next(); + serializer.startTag( NAMESPACE, "exclude" ).text( exclude ).endTag( NAMESPACE, "exclude" ); + } + serializer.endTag( NAMESPACE, "excludes" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writeUnitTest(UnitTest, String, XmlSerializer) + + /** + * Method writeVersion + * + * @param version + * @param serializer + * @param tagName + */ + private void writeVersion( Version version, String tagName, XmlSerializer serializer ) throws Exception + { + if ( version != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( version.getName() != null ) + { + serializer.startTag( NAMESPACE, "name" ).text( version.getName() ).endTag( NAMESPACE, "name" ); + } + if ( version.getTag() != null ) + { + serializer.startTag( NAMESPACE, "tag" ).text( version.getTag() ).endTag( NAMESPACE, "tag" ); + } + if ( version.getId() != null ) + { + serializer.startTag( NAMESPACE, "id" ).text( version.getId() ).endTag( NAMESPACE, "id" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writeVersion(Version, String, XmlSerializer) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Build.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Build.java new file mode 100644 index 0000000000..e562ef0892 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Build.java @@ -0,0 +1,357 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v4_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class Build. + * + * @version $Revision$ $Date$ + */ +public class Build + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field sourceDirectory + */ + private String sourceDirectory; + + /** + * Field scriptSourceDirectory + */ + private String scriptSourceDirectory; + + /** + * Field testSourceDirectory + */ + private String testSourceDirectory; + + /** + * Field resources + */ + private java.util.List resources; + + /** + * Field testResources + */ + private java.util.List testResources; + + /** + * Field directory + */ + private String directory; + + /** + * Field outputDirectory + */ + private String outputDirectory; + + /** + * Field finalName + */ + private String finalName; + + /** + * Field testOutputDirectory + */ + private String testOutputDirectory; + + /** + * Field plugins + */ + private java.util.List plugins; + + /** + * Field pluginManagement + */ + private PluginManagement pluginManagement; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method addPlugin + * + * @param plugin + */ + public void addPlugin( Plugin plugin ) + { + getPlugins().add( plugin ); + } //-- void addPlugin(Plugin) + + /** + * Method addResource + * + * @param resource + */ + public void addResource( Resource resource ) + { + getResources().add( resource ); + } //-- void addResource(Resource) + + /** + * Method addTestResource + * + * @param resource + */ + public void addTestResource( Resource resource ) + { + getTestResources().add( resource ); + } //-- void addTestResource(Resource) + + /** + * Method getDirectory + */ + public String getDirectory() + { + return this.directory; + } //-- String getDirectory() + + /** + * Method getFinalName + */ + public String getFinalName() + { + return this.finalName; + } //-- String getFinalName() + + /** + * Method getOutputDirectory + */ + public String getOutputDirectory() + { + return this.outputDirectory; + } //-- String getOutputDirectory() + + /** + * Method getPluginManagement + */ + public PluginManagement getPluginManagement() + { + return this.pluginManagement; + } //-- PluginManagement getPluginManagement() + + /** + * Method getPlugins + */ + public java.util.List getPlugins() + { + if ( this.plugins == null ) + { + this.plugins = new java.util.ArrayList(); + } + + return this.plugins; + } //-- java.util.List getPlugins() + + /** + * Method getResources + */ + public java.util.List getResources() + { + if ( this.resources == null ) + { + this.resources = new java.util.ArrayList(); + } + + return this.resources; + } //-- java.util.List getResources() + + /** + * Method getScriptSourceDirectory + */ + public String getScriptSourceDirectory() + { + return this.scriptSourceDirectory; + } //-- String getScriptSourceDirectory() + + /** + * Method getSourceDirectory + */ + public String getSourceDirectory() + { + return this.sourceDirectory; + } //-- String getSourceDirectory() + + /** + * Method getTestOutputDirectory + */ + public String getTestOutputDirectory() + { + return this.testOutputDirectory; + } //-- String getTestOutputDirectory() + + /** + * Method getTestResources + */ + public java.util.List getTestResources() + { + if ( this.testResources == null ) + { + this.testResources = new java.util.ArrayList(); + } + + return this.testResources; + } //-- java.util.List getTestResources() + + /** + * Method getTestSourceDirectory + */ + public String getTestSourceDirectory() + { + return this.testSourceDirectory; + } //-- String getTestSourceDirectory() + + /** + * Method removePlugin + * + * @param plugin + */ + public void removePlugin( Plugin plugin ) + { + getPlugins().remove( plugin ); + } //-- void removePlugin(Plugin) + + /** + * Method removeResource + * + * @param resource + */ + public void removeResource( Resource resource ) + { + getResources().remove( resource ); + } //-- void removeResource(Resource) + + /** + * Method removeTestResource + * + * @param resource + */ + public void removeTestResource( Resource resource ) + { + getTestResources().remove( resource ); + } //-- void removeTestResource(Resource) + + /** + * Method setDirectory + * + * @param directory + */ + public void setDirectory( String directory ) + { + this.directory = directory; + } //-- void setDirectory(String) + + /** + * Method setFinalName + * + * @param finalName + */ + public void setFinalName( String finalName ) + { + this.finalName = finalName; + } //-- void setFinalName(String) + + /** + * Method setOutputDirectory + * + * @param outputDirectory + */ + public void setOutputDirectory( String outputDirectory ) + { + this.outputDirectory = outputDirectory; + } //-- void setOutputDirectory(String) + + /** + * Method setPluginManagement + * + * @param pluginManagement + */ + public void setPluginManagement( PluginManagement pluginManagement ) + { + this.pluginManagement = pluginManagement; + } //-- void setPluginManagement(PluginManagement) + + /** + * Method setPlugins + * + * @param plugins + */ + public void setPlugins( java.util.List plugins ) + { + this.plugins = plugins; + } //-- void setPlugins(java.util.List) + + /** + * Method setResources + * + * @param resources + */ + public void setResources( java.util.List resources ) + { + this.resources = resources; + } //-- void setResources(java.util.List) + + /** + * Method setScriptSourceDirectory + * + * @param scriptSourceDirectory + */ + public void setScriptSourceDirectory( String scriptSourceDirectory ) + { + this.scriptSourceDirectory = scriptSourceDirectory; + } //-- void setScriptSourceDirectory(String) + + /** + * Method setSourceDirectory + * + * @param sourceDirectory + */ + public void setSourceDirectory( String sourceDirectory ) + { + this.sourceDirectory = sourceDirectory; + } //-- void setSourceDirectory(String) + + /** + * Method setTestOutputDirectory + * + * @param testOutputDirectory + */ + public void setTestOutputDirectory( String testOutputDirectory ) + { + this.testOutputDirectory = testOutputDirectory; + } //-- void setTestOutputDirectory(String) + + /** + * Method setTestResources + * + * @param testResources + */ + public void setTestResources( java.util.List testResources ) + { + this.testResources = testResources; + } //-- void setTestResources(java.util.List) + + /** + * Method setTestSourceDirectory + * + * @param testSourceDirectory + */ + public void setTestSourceDirectory( String testSourceDirectory ) + { + this.testSourceDirectory = testSourceDirectory; + } //-- void setTestSourceDirectory(String) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/CiManagement.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/CiManagement.java new file mode 100644 index 0000000000..f24a863a1c --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/CiManagement.java @@ -0,0 +1,123 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v4_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class CiManagement. + * + * @version $Revision$ $Date$ + */ +public class CiManagement + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field system + */ + private String system; + + /** + * Field url + */ + private String url; + + /** + * Field notifiers + */ + private java.util.List notifiers; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method addNotifier + * + * @param notifier + */ + public void addNotifier( Notifier notifier ) + { + getNotifiers().add( notifier ); + } //-- void addNotifier(Notifier) + + /** + * Method getNotifiers + */ + public java.util.List getNotifiers() + { + if ( this.notifiers == null ) + { + this.notifiers = new java.util.ArrayList(); + } + + return this.notifiers; + } //-- java.util.List getNotifiers() + + /** + * Method getSystem + */ + public String getSystem() + { + return this.system; + } //-- String getSystem() + + /** + * Method getUrl + */ + public String getUrl() + { + return this.url; + } //-- String getUrl() + + /** + * Method removeNotifier + * + * @param notifier + */ + public void removeNotifier( Notifier notifier ) + { + getNotifiers().remove( notifier ); + } //-- void removeNotifier(Notifier) + + /** + * Method setNotifiers + * + * @param notifiers + */ + public void setNotifiers( java.util.List notifiers ) + { + this.notifiers = notifiers; + } //-- void setNotifiers(java.util.List) + + /** + * Method setSystem + * + * @param system + */ + public void setSystem( String system ) + { + this.system = system; + } //-- void setSystem(String) + + /** + * Method setUrl + * + * @param url + */ + public void setUrl( String url ) + { + this.url = url; + } //-- void setUrl(String) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Contributor.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Contributor.java new file mode 100644 index 0000000000..e7b5d38524 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Contributor.java @@ -0,0 +1,192 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v4_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class Contributor. + * + * @version $Revision$ $Date$ + */ +public class Contributor + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field name + */ + private String name; + + /** + * Field email + */ + private String email; + + /** + * Field url + */ + private String url; + + /** + * Field organization + */ + private String organization; + + /** + * Field roles + */ + private java.util.List roles; + + /** + * Field timezone + */ + private String timezone; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method addRole + * + * @param string + */ + public void addRole( String string ) + { + getRoles().add( string ); + } //-- void addRole(String) + + /** + * Method getEmail + */ + public String getEmail() + { + return this.email; + } //-- String getEmail() + + /** + * Method getName + */ + public String getName() + { + return this.name; + } //-- String getName() + + /** + * Method getOrganization + */ + public String getOrganization() + { + return this.organization; + } //-- String getOrganization() + + /** + * Method getRoles + */ + public java.util.List getRoles() + { + if ( this.roles == null ) + { + this.roles = new java.util.ArrayList(); + } + + return this.roles; + } //-- java.util.List getRoles() + + /** + * Method getTimezone + */ + public String getTimezone() + { + return this.timezone; + } //-- String getTimezone() + + /** + * Method getUrl + */ + public String getUrl() + { + return this.url; + } //-- String getUrl() + + /** + * Method removeRole + * + * @param string + */ + public void removeRole( String string ) + { + getRoles().remove( string ); + } //-- void removeRole(String) + + /** + * Method setEmail + * + * @param email + */ + public void setEmail( String email ) + { + this.email = email; + } //-- void setEmail(String) + + /** + * Method setName + * + * @param name + */ + public void setName( String name ) + { + this.name = name; + } //-- void setName(String) + + /** + * Method setOrganization + * + * @param organization + */ + public void setOrganization( String organization ) + { + this.organization = organization; + } //-- void setOrganization(String) + + /** + * Method setRoles + * + * @param roles + */ + public void setRoles( java.util.List roles ) + { + this.roles = roles; + } //-- void setRoles(java.util.List) + + /** + * Method setTimezone + * + * @param timezone + */ + public void setTimezone( String timezone ) + { + this.timezone = timezone; + } //-- void setTimezone(String) + + /** + * Method setUrl + * + * @param url + */ + public void setUrl( String url ) + { + this.url = url; + } //-- void setUrl(String) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Dependency.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Dependency.java new file mode 100644 index 0000000000..5ae1cbd715 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Dependency.java @@ -0,0 +1,158 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v4_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class Dependency. + * + * @version $Revision$ $Date$ + */ +public class Dependency + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field groupId + */ + private String groupId; + + /** + * Field artifactId + */ + private String artifactId; + + /** + * Field version + */ + private String version; + + /** + * Field type + */ + private String type = "jar"; + + /** + * Field scope + */ + private String scope = "compile"; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getArtifactId + */ + public String getArtifactId() + { + return this.artifactId; + } //-- String getArtifactId() + + /** + * Method getGroupId + */ + public String getGroupId() + { + return this.groupId; + } //-- String getGroupId() + + /** + * Method getScope + */ + public String getScope() + { + return this.scope; + } //-- String getScope() + + /** + * Method getType + */ + public String getType() + { + return this.type; + } //-- String getType() + + /** + * Method getVersion + */ + public String getVersion() + { + return this.version; + } //-- String getVersion() + + /** + * Method setArtifactId + * + * @param artifactId + */ + public void setArtifactId( String artifactId ) + { + this.artifactId = artifactId; + } //-- void setArtifactId(String) + + /** + * Method setGroupId + * + * @param groupId + */ + public void setGroupId( String groupId ) + { + this.groupId = groupId; + } //-- void setGroupId(String) + + /** + * Method setScope + * + * @param scope + */ + public void setScope( String scope ) + { + this.scope = scope; + } //-- void setScope(String) + + /** + * Method setType + * + * @param type + */ + public void setType( String type ) + { + this.type = type; + } //-- void setType(String) + + /** + * Method setVersion + * + * @param version + */ + public void setVersion( String version ) + { + this.version = version; + } //-- void setVersion(String) + + public String toString() + { + return groupId + "/" + type + "s:" + artifactId + "-" + version; + } + + public String getId() + { + return groupId + ":" + artifactId + ":" + type + ":" + version; + } + + public String getManagementKey() + { + return groupId + ":" + artifactId + ":" + type; + } +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/DependencyManagement.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/DependencyManagement.java new file mode 100644 index 0000000000..9a012ad87c --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/DependencyManagement.java @@ -0,0 +1,77 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v4_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class DependencyManagement. + * + * @version $Revision$ $Date$ + */ +public class DependencyManagement + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field dependencies + */ + private java.util.List dependencies; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method addDependency + * + * @param dependency + */ + public void addDependency( Dependency dependency ) + { + getDependencies().add( dependency ); + } //-- void addDependency(Dependency) + + /** + * Method getDependencies + */ + public java.util.List getDependencies() + { + if ( this.dependencies == null ) + { + this.dependencies = new java.util.ArrayList(); + } + + return this.dependencies; + } //-- java.util.List getDependencies() + + /** + * Method removeDependency + * + * @param dependency + */ + public void removeDependency( Dependency dependency ) + { + getDependencies().remove( dependency ); + } //-- void removeDependency(Dependency) + + /** + * Method setDependencies + * + * @param dependencies + */ + public void setDependencies( java.util.List dependencies ) + { + this.dependencies = dependencies; + } //-- void setDependencies(java.util.List) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Developer.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Developer.java new file mode 100644 index 0000000000..671edba075 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Developer.java @@ -0,0 +1,53 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v4_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class Developer. + * + * @version $Revision$ $Date$ + */ +public class Developer + extends Contributor + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field id + */ + private String id; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getId + */ + public String getId() + { + return this.id; + } //-- String getId() + + /** + * Method setId + * + * @param id + */ + public void setId( String id ) + { + this.id = id; + } //-- void setId(String) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/DistributionManagement.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/DistributionManagement.java new file mode 100644 index 0000000000..6ec9e39f40 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/DistributionManagement.java @@ -0,0 +1,75 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v4_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class DistributionManagement. + * + * @version $Revision$ $Date$ + */ +public class DistributionManagement + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field repository + */ + private Repository repository; + + /** + * Field site + */ + private Site site; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getRepository + */ + public Repository getRepository() + { + return this.repository; + } //-- Repository getRepository() + + /** + * Method getSite + */ + public Site getSite() + { + return this.site; + } //-- Site getSite() + + /** + * Method setRepository + * + * @param repository + */ + public void setRepository( Repository repository ) + { + this.repository = repository; + } //-- void setRepository(Repository) + + /** + * Method setSite + * + * @param site + */ + public void setSite( Site site ) + { + this.site = site; + } //-- void setSite(Site) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/FileSet.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/FileSet.java new file mode 100644 index 0000000000..82edf1c164 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/FileSet.java @@ -0,0 +1,53 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v4_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class FileSet. + * + * @version $Revision$ $Date$ + */ +public class FileSet + extends PatternSet + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field directory + */ + private String directory; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getDirectory + */ + public String getDirectory() + { + return this.directory; + } //-- String getDirectory() + + /** + * Method setDirectory + * + * @param directory + */ + public void setDirectory( String directory ) + { + this.directory = directory; + } //-- void setDirectory(String) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Goal.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Goal.java new file mode 100644 index 0000000000..39d48613c6 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Goal.java @@ -0,0 +1,114 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v4_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class Goal. + * + * @version $Revision$ $Date$ + */ +public class Goal + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field id + */ + private String id; + + /** + * Field disabled + */ + private Boolean disabled; + + /** + * Field configuration + */ + private java.util.Properties configuration; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method addConfiguration + * + * @param key + * @param value + */ + public void addConfiguration( String key, String value ) + { + getConfiguration().put( key, value ); + } //-- void addConfiguration(String, String) + + /** + * Method getConfiguration + */ + public java.util.Properties getConfiguration() + { + if ( this.configuration == null ) + { + this.configuration = new java.util.Properties(); + } + + return this.configuration; + } //-- java.util.Properties getConfiguration() + + /** + * Method getId + */ + public String getId() + { + return this.id; + } //-- String getId() + + /** + * Method isDisabled + */ + public Boolean isDisabled() + { + return this.disabled; + } //-- Boolean isDisabled() + + /** + * Method setConfiguration + * + * @param configuration + */ + public void setConfiguration( java.util.Properties configuration ) + { + this.configuration = configuration; + } //-- void setConfiguration(java.util.Properties) + + /** + * Method setDisabled + * + * @param disabled + */ + public void setDisabled( Boolean disabled ) + { + this.disabled = disabled; + } //-- void setDisabled(Boolean) + + /** + * Method setId + * + * @param id + */ + public void setId( String id ) + { + this.id = id; + } //-- void setId(String) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/IssueManagement.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/IssueManagement.java new file mode 100644 index 0000000000..227897c47e --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/IssueManagement.java @@ -0,0 +1,75 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v4_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class IssueManagement. + * + * @version $Revision$ $Date$ + */ +public class IssueManagement + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field system + */ + private String system; + + /** + * Field url + */ + private String url; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getSystem + */ + public String getSystem() + { + return this.system; + } //-- String getSystem() + + /** + * Method getUrl + */ + public String getUrl() + { + return this.url; + } //-- String getUrl() + + /** + * Method setSystem + * + * @param system + */ + public void setSystem( String system ) + { + this.system = system; + } //-- void setSystem(String) + + /** + * Method setUrl + * + * @param url + */ + public void setUrl( String url ) + { + this.url = url; + } //-- void setUrl(String) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/License.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/License.java new file mode 100644 index 0000000000..6c1845d25b --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/License.java @@ -0,0 +1,98 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v4_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class License. + * + * @version $Revision$ $Date$ + */ +public class License + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field name + */ + private String name; + + /** + * Field url + */ + private String url; + + /** + * Field comments + */ + private String comments; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getComments + */ + public String getComments() + { + return this.comments; + } //-- String getComments() + + /** + * Method getName + */ + public String getName() + { + return this.name; + } //-- String getName() + + /** + * Method getUrl + */ + public String getUrl() + { + return this.url; + } //-- String getUrl() + + /** + * Method setComments + * + * @param comments + */ + public void setComments( String comments ) + { + this.comments = comments; + } //-- void setComments(String) + + /** + * Method setName + * + * @param name + */ + public void setName( String name ) + { + this.name = name; + } //-- void setName(String) + + /** + * Method setUrl + * + * @param url + */ + public void setUrl( String url ) + { + this.url = url; + } //-- void setUrl(String) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/MailingList.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/MailingList.java new file mode 100644 index 0000000000..fde1a06dad --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/MailingList.java @@ -0,0 +1,192 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v4_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class MailingList. + * + * @version $Revision$ $Date$ + */ +public class MailingList + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field name + */ + private String name; + + /** + * Field subscribe + */ + private String subscribe; + + /** + * Field unsubscribe + */ + private String unsubscribe; + + /** + * Field post + */ + private String post; + + /** + * Field archive + */ + private String archive; + + /** + * Field otherArchives + */ + private java.util.List otherArchives; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method addOtherArchive + * + * @param string + */ + public void addOtherArchive( String string ) + { + getOtherArchives().add( string ); + } //-- void addOtherArchive(String) + + /** + * Method getArchive + */ + public String getArchive() + { + return this.archive; + } //-- String getArchive() + + /** + * Method getName + */ + public String getName() + { + return this.name; + } //-- String getName() + + /** + * Method getOtherArchives + */ + public java.util.List getOtherArchives() + { + if ( this.otherArchives == null ) + { + this.otherArchives = new java.util.ArrayList(); + } + + return this.otherArchives; + } //-- java.util.List getOtherArchives() + + /** + * Method getPost + */ + public String getPost() + { + return this.post; + } //-- String getPost() + + /** + * Method getSubscribe + */ + public String getSubscribe() + { + return this.subscribe; + } //-- String getSubscribe() + + /** + * Method getUnsubscribe + */ + public String getUnsubscribe() + { + return this.unsubscribe; + } //-- String getUnsubscribe() + + /** + * Method removeOtherArchive + * + * @param string + */ + public void removeOtherArchive( String string ) + { + getOtherArchives().remove( string ); + } //-- void removeOtherArchive(String) + + /** + * Method setArchive + * + * @param archive + */ + public void setArchive( String archive ) + { + this.archive = archive; + } //-- void setArchive(String) + + /** + * Method setName + * + * @param name + */ + public void setName( String name ) + { + this.name = name; + } //-- void setName(String) + + /** + * Method setOtherArchives + * + * @param otherArchives + */ + public void setOtherArchives( java.util.List otherArchives ) + { + this.otherArchives = otherArchives; + } //-- void setOtherArchives(java.util.List) + + /** + * Method setPost + * + * @param post + */ + public void setPost( String post ) + { + this.post = post; + } //-- void setPost(String) + + /** + * Method setSubscribe + * + * @param subscribe + */ + public void setSubscribe( String subscribe ) + { + this.subscribe = subscribe; + } //-- void setSubscribe(String) + + /** + * Method setUnsubscribe + * + * @param unsubscribe + */ + public void setUnsubscribe( String unsubscribe ) + { + this.unsubscribe = unsubscribe; + } //-- void setUnsubscribe(String) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Model.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Model.java new file mode 100644 index 0000000000..527e15e241 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Model.java @@ -0,0 +1,867 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v4_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class Model. + * + * @version $Revision$ $Date$ + */ +public class Model + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field extend + */ + private String extend; + + /** + * Field parent + */ + private Parent parent; + + /** + * Field modelVersion + */ + private String modelVersion; + + /** + * Field groupId + */ + private String groupId; + + /** + * Field artifactId + */ + private String artifactId; + + /** + * Field packaging + */ + private String packaging = "jar"; + + /** + * Field modules + */ + private java.util.List modules; + + /** + * Field name + */ + private String name; + + /** + * Field version + */ + private String version; + + /** + * Field description + */ + private String description; + + /** + * Field url + */ + private String url; + + /** + * Field issueManagement + */ + private IssueManagement issueManagement; + + /** + * Field ciManagement + */ + private CiManagement ciManagement; + + /** + * Field inceptionYear + */ + private String inceptionYear; + + /** + * Field repositories + */ + private java.util.List repositories; + + /** + * This may be removed or relocated in the near future. It is + * undecided whether plugins really need a remote repository + * set of their own. + */ + private java.util.List pluginRepositories; + + /** + * Field mailingLists + */ + private java.util.List mailingLists; + + /** + * Field developers + */ + private java.util.List developers; + + /** + * Field contributors + */ + private java.util.List contributors; + + /** + * These should ultimately only be compile time dependencies + * when transitive dependencies come into play. + */ + private java.util.List dependencies; + + /** + * Field licenses + */ + private java.util.List licenses; + + /** + * Field reports + */ + private Reports reports; + + /** + * Field scm + */ + private Scm scm; + + /** + * Field build + */ + private Build build; + + /** + * Field organization + */ + private Organization organization; + + /** + * Field distributionManagement + */ + private DistributionManagement distributionManagement; + + /** + * Field dependencyManagement + */ + private DependencyManagement dependencyManagement; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method addContributor + * + * @param contributor + */ + public void addContributor( Contributor contributor ) + { + getContributors().add( contributor ); + } //-- void addContributor(Contributor) + + /** + * Method addDependency + * + * @param dependency + */ + public void addDependency( Dependency dependency ) + { + getDependencies().add( dependency ); + } //-- void addDependency(Dependency) + + /** + * Method addDeveloper + * + * @param developer + */ + public void addDeveloper( Developer developer ) + { + getDevelopers().add( developer ); + } //-- void addDeveloper(Developer) + + /** + * Method addLicense + * + * @param license + */ + public void addLicense( License license ) + { + getLicenses().add( license ); + } //-- void addLicense(License) + + /** + * Method addMailingList + * + * @param mailingList + */ + public void addMailingList( MailingList mailingList ) + { + getMailingLists().add( mailingList ); + } //-- void addMailingList(MailingList) + + /** + * Method addModule + * + * @param string + */ + public void addModule( String string ) + { + getModules().add( string ); + } //-- void addModule(String) + + /** + * Method addPluginRepository + * + * @param repository + */ + public void addPluginRepository( Repository repository ) + { + getPluginRepositories().add( repository ); + } //-- void addPluginRepository(Repository) + + /** + * Method addRepository + * + * @param repository + */ + public void addRepository( Repository repository ) + { + getRepositories().add( repository ); + } //-- void addRepository(Repository) + + /** + * Method getArtifactId + */ + public String getArtifactId() + { + return this.artifactId; + } //-- String getArtifactId() + + /** + * Method getBuild + */ + public Build getBuild() + { + return this.build; + } //-- Build getBuild() + + /** + * Method getCiManagement + */ + public CiManagement getCiManagement() + { + return this.ciManagement; + } //-- CiManagement getCiManagement() + + /** + * Method getContributors + */ + public java.util.List getContributors() + { + if ( this.contributors == null ) + { + this.contributors = new java.util.ArrayList(); + } + + return this.contributors; + } //-- java.util.List getContributors() + + /** + * Method getDependencies + */ + public java.util.List getDependencies() + { + if ( this.dependencies == null ) + { + this.dependencies = new java.util.ArrayList(); + } + + return this.dependencies; + } //-- java.util.List getDependencies() + + /** + * Method getDependencyManagement + */ + public DependencyManagement getDependencyManagement() + { + return this.dependencyManagement; + } //-- DependencyManagement getDependencyManagement() + + /** + * Method getDescription + */ + public String getDescription() + { + return this.description; + } //-- String getDescription() + + /** + * Method getDevelopers + */ + public java.util.List getDevelopers() + { + if ( this.developers == null ) + { + this.developers = new java.util.ArrayList(); + } + + return this.developers; + } //-- java.util.List getDevelopers() + + /** + * Method getDistributionManagement + */ + public DistributionManagement getDistributionManagement() + { + return this.distributionManagement; + } //-- DistributionManagement getDistributionManagement() + + /** + * Method getExtend + */ + public String getExtend() + { + return this.extend; + } //-- String getExtend() + + /** + * Method getGroupId + */ + public String getGroupId() + { + return this.groupId; + } //-- String getGroupId() + + /** + * Method getInceptionYear + */ + public String getInceptionYear() + { + return this.inceptionYear; + } //-- String getInceptionYear() + + /** + * Method getIssueManagement + */ + public IssueManagement getIssueManagement() + { + return this.issueManagement; + } //-- IssueManagement getIssueManagement() + + /** + * Method getLicenses + */ + public java.util.List getLicenses() + { + if ( this.licenses == null ) + { + this.licenses = new java.util.ArrayList(); + } + + return this.licenses; + } //-- java.util.List getLicenses() + + /** + * Method getMailingLists + */ + public java.util.List getMailingLists() + { + if ( this.mailingLists == null ) + { + this.mailingLists = new java.util.ArrayList(); + } + + return this.mailingLists; + } //-- java.util.List getMailingLists() + + /** + * Method getModelVersion + */ + public String getModelVersion() + { + return this.modelVersion; + } //-- String getModelVersion() + + /** + * Method getModules + */ + public java.util.List getModules() + { + if ( this.modules == null ) + { + this.modules = new java.util.ArrayList(); + } + + return this.modules; + } //-- java.util.List getModules() + + /** + * Method getName + */ + public String getName() + { + return this.name; + } //-- String getName() + + /** + * Method getOrganization + */ + public Organization getOrganization() + { + return this.organization; + } //-- Organization getOrganization() + + /** + * Method getPackaging + */ + public String getPackaging() + { + return this.packaging; + } //-- String getPackaging() + + /** + * Method getParent + */ + public Parent getParent() + { + return this.parent; + } //-- Parent getParent() + + /** + * Method getPluginRepositories + */ + public java.util.List getPluginRepositories() + { + if ( this.pluginRepositories == null ) + { + this.pluginRepositories = new java.util.ArrayList(); + } + + return this.pluginRepositories; + } //-- java.util.List getPluginRepositories() + + /** + * Method getReports + */ + public Reports getReports() + { + return this.reports; + } //-- Reports getReports() + + /** + * Method getRepositories + */ + public java.util.List getRepositories() + { + if ( this.repositories == null ) + { + this.repositories = new java.util.ArrayList(); + } + + return this.repositories; + } //-- java.util.List getRepositories() + + /** + * Method getScm + */ + public Scm getScm() + { + return this.scm; + } //-- Scm getScm() + + /** + * Method getUrl + */ + public String getUrl() + { + return this.url; + } //-- String getUrl() + + /** + * Method getVersion + */ + public String getVersion() + { + return this.version; + } //-- String getVersion() + + /** + * Method removeContributor + * + * @param contributor + */ + public void removeContributor( Contributor contributor ) + { + getContributors().remove( contributor ); + } //-- void removeContributor(Contributor) + + /** + * Method removeDependency + * + * @param dependency + */ + public void removeDependency( Dependency dependency ) + { + getDependencies().remove( dependency ); + } //-- void removeDependency(Dependency) + + /** + * Method removeDeveloper + * + * @param developer + */ + public void removeDeveloper( Developer developer ) + { + getDevelopers().remove( developer ); + } //-- void removeDeveloper(Developer) + + /** + * Method removeLicense + * + * @param license + */ + public void removeLicense( License license ) + { + getLicenses().remove( license ); + } //-- void removeLicense(License) + + /** + * Method removeMailingList + * + * @param mailingList + */ + public void removeMailingList( MailingList mailingList ) + { + getMailingLists().remove( mailingList ); + } //-- void removeMailingList(MailingList) + + /** + * Method removeModule + * + * @param string + */ + public void removeModule( String string ) + { + getModules().remove( string ); + } //-- void removeModule(String) + + /** + * Method removePluginRepository + * + * @param repository + */ + public void removePluginRepository( Repository repository ) + { + getPluginRepositories().remove( repository ); + } //-- void removePluginRepository(Repository) + + /** + * Method removeRepository + * + * @param repository + */ + public void removeRepository( Repository repository ) + { + getRepositories().remove( repository ); + } //-- void removeRepository(Repository) + + /** + * Method setArtifactId + * + * @param artifactId + */ + public void setArtifactId( String artifactId ) + { + this.artifactId = artifactId; + } //-- void setArtifactId(String) + + /** + * Method setBuild + * + * @param build + */ + public void setBuild( Build build ) + { + this.build = build; + } //-- void setBuild(Build) + + /** + * Method setCiManagement + * + * @param ciManagement + */ + public void setCiManagement( CiManagement ciManagement ) + { + this.ciManagement = ciManagement; + } //-- void setCiManagement(CiManagement) + + /** + * Method setContributors + * + * @param contributors + */ + public void setContributors( java.util.List contributors ) + { + this.contributors = contributors; + } //-- void setContributors(java.util.List) + + /** + * Method setDependencies + * + * @param dependencies + */ + public void setDependencies( java.util.List dependencies ) + { + this.dependencies = dependencies; + } //-- void setDependencies(java.util.List) + + /** + * Method setDependencyManagement + * + * @param dependencyManagement + */ + public void setDependencyManagement( DependencyManagement dependencyManagement ) + { + this.dependencyManagement = dependencyManagement; + } //-- void setDependencyManagement(DependencyManagement) + + /** + * Method setDescription + * + * @param description + */ + public void setDescription( String description ) + { + this.description = description; + } //-- void setDescription(String) + + /** + * Method setDevelopers + * + * @param developers + */ + public void setDevelopers( java.util.List developers ) + { + this.developers = developers; + } //-- void setDevelopers(java.util.List) + + /** + * Method setDistributionManagement + * + * @param distributionManagement + */ + public void setDistributionManagement( DistributionManagement distributionManagement ) + { + this.distributionManagement = distributionManagement; + } //-- void setDistributionManagement(DistributionManagement) + + /** + * Method setExtend + * + * @param extend + */ + public void setExtend( String extend ) + { + this.extend = extend; + } //-- void setExtend(String) + + /** + * Method setGroupId + * + * @param groupId + */ + public void setGroupId( String groupId ) + { + this.groupId = groupId; + } //-- void setGroupId(String) + + /** + * Method setInceptionYear + * + * @param inceptionYear + */ + public void setInceptionYear( String inceptionYear ) + { + this.inceptionYear = inceptionYear; + } //-- void setInceptionYear(String) + + /** + * Method setIssueManagement + * + * @param issueManagement + */ + public void setIssueManagement( IssueManagement issueManagement ) + { + this.issueManagement = issueManagement; + } //-- void setIssueManagement(IssueManagement) + + /** + * Method setLicenses + * + * @param licenses + */ + public void setLicenses( java.util.List licenses ) + { + this.licenses = licenses; + } //-- void setLicenses(java.util.List) + + /** + * Method setMailingLists + * + * @param mailingLists + */ + public void setMailingLists( java.util.List mailingLists ) + { + this.mailingLists = mailingLists; + } //-- void setMailingLists(java.util.List) + + /** + * Method setModelVersion + * + * @param modelVersion + */ + public void setModelVersion( String modelVersion ) + { + this.modelVersion = modelVersion; + } //-- void setModelVersion(String) + + /** + * Method setModules + * + * @param modules + */ + public void setModules( java.util.List modules ) + { + this.modules = modules; + } //-- void setModules(java.util.List) + + /** + * Method setName + * + * @param name + */ + public void setName( String name ) + { + this.name = name; + } //-- void setName(String) + + /** + * Method setOrganization + * + * @param organization + */ + public void setOrganization( Organization organization ) + { + this.organization = organization; + } //-- void setOrganization(Organization) + + /** + * Method setPackaging + * + * @param packaging + */ + public void setPackaging( String packaging ) + { + this.packaging = packaging; + } //-- void setPackaging(String) + + /** + * Method setParent + * + * @param parent + */ + public void setParent( Parent parent ) + { + this.parent = parent; + } //-- void setParent(Parent) + + /** + * Method setPluginRepositories + * + * @param pluginRepositories + */ + public void setPluginRepositories( java.util.List pluginRepositories ) + { + this.pluginRepositories = pluginRepositories; + } //-- void setPluginRepositories(java.util.List) + + /** + * Method setReports + * + * @param reports + */ + public void setReports( Reports reports ) + { + this.reports = reports; + } //-- void setReports(Reports) + + /** + * Method setRepositories + * + * @param repositories + */ + public void setRepositories( java.util.List repositories ) + { + this.repositories = repositories; + } //-- void setRepositories(java.util.List) + + /** + * Method setScm + * + * @param scm + */ + public void setScm( Scm scm ) + { + this.scm = scm; + } //-- void setScm(Scm) + + /** + * Method setUrl + * + * @param url + */ + public void setUrl( String url ) + { + this.url = url; + } //-- void setUrl(String) + + /** + * Method setVersion + * + * @param version + */ + public void setVersion( String version ) + { + this.version = version; + } //-- void setVersion(String) + + public String getId() + { + StringBuffer id = new StringBuffer(); + + id.append( getGroupId() ); + id.append( ":" ); + id.append( getArtifactId() ); + id.append( ":" ); + id.append( getPackaging() ); + id.append( ":" ); + id.append( getVersion() ); + + return id.toString(); + } +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Notifier.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Notifier.java new file mode 100644 index 0000000000..fa622374dc --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Notifier.java @@ -0,0 +1,114 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v4_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class Notifier. + * + * @version $Revision$ $Date$ + */ +public class Notifier + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field type + */ + private String type = "email"; + + /** + * Field address + */ + private String address; + + /** + * Field configuration + */ + private java.util.Properties configuration; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method addConfiguration + * + * @param key + * @param value + */ + public void addConfiguration( String key, String value ) + { + getConfiguration().put( key, value ); + } //-- void addConfiguration(String, String) + + /** + * Method getAddress + */ + public String getAddress() + { + return this.address; + } //-- String getAddress() + + /** + * Method getConfiguration + */ + public java.util.Properties getConfiguration() + { + if ( this.configuration == null ) + { + this.configuration = new java.util.Properties(); + } + + return this.configuration; + } //-- java.util.Properties getConfiguration() + + /** + * Method getType + */ + public String getType() + { + return this.type; + } //-- String getType() + + /** + * Method setAddress + * + * @param address + */ + public void setAddress( String address ) + { + this.address = address; + } //-- void setAddress(String) + + /** + * Method setConfiguration + * + * @param configuration + */ + public void setConfiguration( java.util.Properties configuration ) + { + this.configuration = configuration; + } //-- void setConfiguration(java.util.Properties) + + /** + * Method setType + * + * @param type + */ + public void setType( String type ) + { + this.type = type; + } //-- void setType(String) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Organization.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Organization.java new file mode 100644 index 0000000000..650f857680 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Organization.java @@ -0,0 +1,75 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v4_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class Organization. + * + * @version $Revision$ $Date$ + */ +public class Organization + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field name + */ + private String name; + + /** + * Field url + */ + private String url; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getName + */ + public String getName() + { + return this.name; + } //-- String getName() + + /** + * Method getUrl + */ + public String getUrl() + { + return this.url; + } //-- String getUrl() + + /** + * Method setName + * + * @param name + */ + public void setName( String name ) + { + this.name = name; + } //-- void setName(String) + + /** + * Method setUrl + * + * @param url + */ + public void setUrl( String url ) + { + this.url = url; + } //-- void setUrl(String) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Parent.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Parent.java new file mode 100644 index 0000000000..4f6f9d028a --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Parent.java @@ -0,0 +1,98 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v4_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class Parent. + * + * @version $Revision$ $Date$ + */ +public class Parent + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field artifactId + */ + private String artifactId; + + /** + * Field groupId + */ + private String groupId; + + /** + * Field version + */ + private String version; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getArtifactId + */ + public String getArtifactId() + { + return this.artifactId; + } //-- String getArtifactId() + + /** + * Method getGroupId + */ + public String getGroupId() + { + return this.groupId; + } //-- String getGroupId() + + /** + * Method getVersion + */ + public String getVersion() + { + return this.version; + } //-- String getVersion() + + /** + * Method setArtifactId + * + * @param artifactId + */ + public void setArtifactId( String artifactId ) + { + this.artifactId = artifactId; + } //-- void setArtifactId(String) + + /** + * Method setGroupId + * + * @param groupId + */ + public void setGroupId( String groupId ) + { + this.groupId = groupId; + } //-- void setGroupId(String) + + /** + * Method setVersion + * + * @param version + */ + public void setVersion( String version ) + { + this.version = version; + } //-- void setVersion(String) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/PatternSet.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/PatternSet.java new file mode 100644 index 0000000000..54bf3da52d --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/PatternSet.java @@ -0,0 +1,106 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v4_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + +import java.util.ArrayList; +import java.util.List; + +/** + * Class PatternSet. + * + * @version $Revision$ $Date$ + */ +public class PatternSet + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field includes + */ + private String includes; + + /** + * Field excludes + */ + private String excludes; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getExcludes + */ + public String getExcludes() + { + return this.excludes; + } //-- String getExcludes() + + /** + * Method getIncludes + */ + public String getIncludes() + { + return this.includes; + } //-- String getIncludes() + + /** + * Method setExcludes + * + * @param excludes + */ + public void setExcludes( String excludes ) + { + this.excludes = excludes; + } //-- void setExcludes(String) + + /** + * Method setIncludes + * + * @param includes + */ + public void setIncludes( String includes ) + { + this.includes = includes; + } //-- void setIncludes(String) + + public List getDefaultExcludes() + { + List defaultExcludes = new ArrayList(); + defaultExcludes.add( "**/*~" ); + defaultExcludes.add( "**/#*#" ); + defaultExcludes.add( "**/.#*" ); + defaultExcludes.add( "**/%*%" ); + defaultExcludes.add( "**/._*" ); + + // CVS + defaultExcludes.add( "**/CVS" ); + defaultExcludes.add( "**/CVS/**" ); + defaultExcludes.add( "**/.cvsignore" ); + + // SCCS + defaultExcludes.add( "**/SCCS" ); + defaultExcludes.add( "**/SCCS/**" ); + + // Visual SourceSafe + defaultExcludes.add( "**/vssver.scc" ); + + // Subversion + defaultExcludes.add( "**/.svn" ); + defaultExcludes.add( "**/.svn/**" ); + + // Mac + defaultExcludes.add( "**/.DS_Store" ); + return defaultExcludes; + } +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Plugin.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Plugin.java new file mode 100644 index 0000000000..1d7265c2fd --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Plugin.java @@ -0,0 +1,208 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v4_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class Plugin. + * + * @version $Revision$ $Date$ + */ +public class Plugin + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field groupId + */ + private String groupId = "maven"; + + /** + * Field artifactId + */ + private String artifactId; + + /** + * Field version + */ + private String version; + + /** + * Field disabled + */ + private Boolean disabled; + + /** + * Field configuration + */ + private java.util.Properties configuration; + + /** + * Field goals + */ + private java.util.List goals; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method addConfiguration + * + * @param key + * @param value + */ + public void addConfiguration( String key, String value ) + { + getConfiguration().put( key, value ); + } //-- void addConfiguration(String, String) + + /** + * Method addGoal + * + * @param goal + */ + public void addGoal( Goal goal ) + { + getGoals().add( goal ); + } //-- void addGoal(Goal) + + /** + * Method getArtifactId + */ + public String getArtifactId() + { + return this.artifactId; + } //-- String getArtifactId() + + /** + * Method getConfiguration + */ + public java.util.Properties getConfiguration() + { + if ( this.configuration == null ) + { + this.configuration = new java.util.Properties(); + } + + return this.configuration; + } //-- java.util.Properties getConfiguration() + + /** + * Method getGoals + */ + public java.util.List getGoals() + { + if ( this.goals == null ) + { + this.goals = new java.util.ArrayList(); + } + + return this.goals; + } //-- java.util.List getGoals() + + /** + * Method getGroupId + */ + public String getGroupId() + { + return this.groupId; + } //-- String getGroupId() + + /** + * Method getVersion + */ + public String getVersion() + { + return this.version; + } //-- String getVersion() + + /** + * Method isDisabled + */ + public Boolean isDisabled() + { + return this.disabled; + } //-- Boolean isDisabled() + + /** + * Method removeGoal + * + * @param goal + */ + public void removeGoal( Goal goal ) + { + getGoals().remove( goal ); + } //-- void removeGoal(Goal) + + /** + * Method setArtifactId + * + * @param artifactId + */ + public void setArtifactId( String artifactId ) + { + this.artifactId = artifactId; + } //-- void setArtifactId(String) + + /** + * Method setConfiguration + * + * @param configuration + */ + public void setConfiguration( java.util.Properties configuration ) + { + this.configuration = configuration; + } //-- void setConfiguration(java.util.Properties) + + /** + * Method setDisabled + * + * @param disabled + */ + public void setDisabled( Boolean disabled ) + { + this.disabled = disabled; + } //-- void setDisabled(Boolean) + + /** + * Method setGoals + * + * @param goals + */ + public void setGoals( java.util.List goals ) + { + this.goals = goals; + } //-- void setGoals(java.util.List) + + /** + * Method setGroupId + * + * @param groupId + */ + public void setGroupId( String groupId ) + { + this.groupId = groupId; + } //-- void setGroupId(String) + + /** + * Method setVersion + * + * @param version + */ + public void setVersion( String version ) + { + this.version = version; + } //-- void setVersion(String) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/PluginManagement.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/PluginManagement.java new file mode 100644 index 0000000000..130ae17590 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/PluginManagement.java @@ -0,0 +1,77 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v4_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class PluginManagement. + * + * @version $Revision$ $Date$ + */ +public class PluginManagement + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field plugins + */ + private java.util.List plugins; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method addPlugin + * + * @param plugin + */ + public void addPlugin( Plugin plugin ) + { + getPlugins().add( plugin ); + } //-- void addPlugin(Plugin) + + /** + * Method getPlugins + */ + public java.util.List getPlugins() + { + if ( this.plugins == null ) + { + this.plugins = new java.util.ArrayList(); + } + + return this.plugins; + } //-- java.util.List getPlugins() + + /** + * Method removePlugin + * + * @param plugin + */ + public void removePlugin( Plugin plugin ) + { + getPlugins().remove( plugin ); + } //-- void removePlugin(Plugin) + + /** + * Method setPlugins + * + * @param plugins + */ + public void setPlugins( java.util.List plugins ) + { + this.plugins = plugins; + } //-- void setPlugins(java.util.List) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Reports.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Reports.java new file mode 100644 index 0000000000..75b3922bea --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Reports.java @@ -0,0 +1,100 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v4_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class Reports. + * + * @version $Revision$ $Date$ + */ +public class Reports + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field outputDirectory + */ + private String outputDirectory; + + /** + * Field plugins + */ + private java.util.List plugins; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method addPlugin + * + * @param plugin + */ + public void addPlugin( Plugin plugin ) + { + getPlugins().add( plugin ); + } //-- void addPlugin(Plugin) + + /** + * Method getOutputDirectory + */ + public String getOutputDirectory() + { + return this.outputDirectory; + } //-- String getOutputDirectory() + + /** + * Method getPlugins + */ + public java.util.List getPlugins() + { + if ( this.plugins == null ) + { + this.plugins = new java.util.ArrayList(); + } + + return this.plugins; + } //-- java.util.List getPlugins() + + /** + * Method removePlugin + * + * @param plugin + */ + public void removePlugin( Plugin plugin ) + { + getPlugins().remove( plugin ); + } //-- void removePlugin(Plugin) + + /** + * Method setOutputDirectory + * + * @param outputDirectory + */ + public void setOutputDirectory( String outputDirectory ) + { + this.outputDirectory = outputDirectory; + } //-- void setOutputDirectory(String) + + /** + * Method setPlugins + * + * @param plugins + */ + public void setPlugins( java.util.List plugins ) + { + this.plugins = plugins; + } //-- void setPlugins(java.util.List) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Repository.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Repository.java new file mode 100644 index 0000000000..d16220de78 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Repository.java @@ -0,0 +1,111 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v4_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class Repository. + * + * @version $Revision$ $Date$ + */ +public class Repository + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field id + */ + private String id; + + /** + * Field name + */ + private String name; + + /** + * Field url + */ + private String url; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getId + */ + public String getId() + { + return this.id; + } //-- String getId() + + /** + * Method getName + */ + public String getName() + { + return this.name; + } //-- String getName() + + /** + * Method getUrl + */ + public String getUrl() + { + return this.url; + } //-- String getUrl() + + /** + * Method setId + * + * @param id + */ + public void setId( String id ) + { + this.id = id; + } //-- void setId(String) + + /** + * Method setName + * + * @param name + */ + public void setName( String name ) + { + this.name = name; + } //-- void setName(String) + + /** + * Method setUrl + * + * @param url + */ + public void setUrl( String url ) + { + this.url = url; + } //-- void setUrl(String) + + public boolean equals( Object obj ) + { + Repository other = (Repository) obj; + + boolean retValue = false; + + if ( id != null ) + { + retValue = id.equals( other.id ); + } + + return retValue; + } +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Resource.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Resource.java new file mode 100644 index 0000000000..6af38c2f1b --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Resource.java @@ -0,0 +1,53 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v4_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class Resource. + * + * @version $Revision$ $Date$ + */ +public class Resource + extends FileSet + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field targetPath + */ + private String targetPath; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getTargetPath + */ + public String getTargetPath() + { + return this.targetPath; + } //-- String getTargetPath() + + /** + * Method setTargetPath + * + * @param targetPath + */ + public void setTargetPath( String targetPath ) + { + this.targetPath = targetPath; + } //-- void setTargetPath(String) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Scm.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Scm.java new file mode 100644 index 0000000000..15df535cf1 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Scm.java @@ -0,0 +1,98 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v4_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class Scm. + * + * @version $Revision$ $Date$ + */ +public class Scm + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field connection + */ + private String connection; + + /** + * Field developerConnection + */ + private String developerConnection; + + /** + * Field url + */ + private String url; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getConnection + */ + public String getConnection() + { + return this.connection; + } //-- String getConnection() + + /** + * Method getDeveloperConnection + */ + public String getDeveloperConnection() + { + return this.developerConnection; + } //-- String getDeveloperConnection() + + /** + * Method getUrl + */ + public String getUrl() + { + return this.url; + } //-- String getUrl() + + /** + * Method setConnection + * + * @param connection + */ + public void setConnection( String connection ) + { + this.connection = connection; + } //-- void setConnection(String) + + /** + * Method setDeveloperConnection + * + * @param developerConnection + */ + public void setDeveloperConnection( String developerConnection ) + { + this.developerConnection = developerConnection; + } //-- void setDeveloperConnection(String) + + /** + * Method setUrl + * + * @param url + */ + public void setUrl( String url ) + { + this.url = url; + } //-- void setUrl(String) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Site.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Site.java new file mode 100644 index 0000000000..51f00059db --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/Site.java @@ -0,0 +1,98 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v4_0_0; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + + +/** + * Class Site. + * + * @version $Revision$ $Date$ + */ +public class Site + implements java.io.Serializable +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field id + */ + private String id; + + /** + * Field name + */ + private String name; + + /** + * Field url + */ + private String url; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getId + */ + public String getId() + { + return this.id; + } //-- String getId() + + /** + * Method getName + */ + public String getName() + { + return this.name; + } //-- String getName() + + /** + * Method getUrl + */ + public String getUrl() + { + return this.url; + } //-- String getUrl() + + /** + * Method setId + * + * @param id + */ + public void setId( String id ) + { + this.id = id; + } //-- void setId(String) + + /** + * Method setName + * + * @param name + */ + public void setName( String name ) + { + this.name = name; + } //-- void setName(String) + + /** + * Method setUrl + * + * @param url + */ + public void setUrl( String url ) + { + this.url = url; + } //-- void setUrl(String) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/io/xpp3/MavenXpp3Reader.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/io/xpp3/MavenXpp3Reader.java new file mode 100644 index 0000000000..f760f3cb8a --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/io/xpp3/MavenXpp3Reader.java @@ -0,0 +1,1580 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v4_0_0.io.xpp3; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + +import org.apache.maven.model.v4_0_0.Build; +import org.apache.maven.model.v4_0_0.CiManagement; +import org.apache.maven.model.v4_0_0.Contributor; +import org.apache.maven.model.v4_0_0.Dependency; +import org.apache.maven.model.v4_0_0.DependencyManagement; +import org.apache.maven.model.v4_0_0.Developer; +import org.apache.maven.model.v4_0_0.DistributionManagement; +import org.apache.maven.model.v4_0_0.FileSet; +import org.apache.maven.model.v4_0_0.Goal; +import org.apache.maven.model.v4_0_0.IssueManagement; +import org.apache.maven.model.v4_0_0.License; +import org.apache.maven.model.v4_0_0.MailingList; +import org.apache.maven.model.v4_0_0.Model; +import org.apache.maven.model.v4_0_0.Notifier; +import org.apache.maven.model.v4_0_0.Organization; +import org.apache.maven.model.v4_0_0.Parent; +import org.apache.maven.model.v4_0_0.PatternSet; +import org.apache.maven.model.v4_0_0.Plugin; +import org.apache.maven.model.v4_0_0.PluginManagement; +import org.apache.maven.model.v4_0_0.Reports; +import org.apache.maven.model.v4_0_0.Repository; +import org.apache.maven.model.v4_0_0.Resource; +import org.apache.maven.model.v4_0_0.Scm; +import org.apache.maven.model.v4_0_0.Site; +import org.codehaus.plexus.util.xml.pull.MXParser; +import org.codehaus.plexus.util.xml.pull.XmlPullParser; + +import java.io.Reader; + +/** + * Class MavenXpp3Reader. + * + * @version $Revision$ $Date$ + */ +public class MavenXpp3Reader +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * If set the parser till be loaded with all single characters + * from the XHTML specification. + * The entities used: + * + */ + private boolean addDefaultEntities = true; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getAddDefaultEntities + */ + public boolean getAddDefaultEntities() + { + return addDefaultEntities; + } //-- boolean getAddDefaultEntities() + + /** + * Method parseBuild + * + * @param tagName + * @param parser + */ + private Build parseBuild( String tagName, XmlPullParser parser ) throws Exception + { + Build build = new Build(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "sourceDirectory" ) ) + { + build.setSourceDirectory( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "scriptSourceDirectory" ) ) + { + build.setScriptSourceDirectory( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "testSourceDirectory" ) ) + { + build.setTestSourceDirectory( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "resources" ) ) + { + java.util.List resources = new java.util.ArrayList(); + build.setResources( resources ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "resource" ) ) + { + resources.add( parseResource( "resource", parser ) ); + } + else + { + parser.nextText(); + } + } + } + else if ( parser.getName().equals( "testResources" ) ) + { + java.util.List testResources = new java.util.ArrayList(); + build.setTestResources( testResources ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "testResource" ) ) + { + testResources.add( parseResource( "testResource", parser ) ); + } + else + { + parser.nextText(); + } + } + } + else if ( parser.getName().equals( "directory" ) ) + { + build.setDirectory( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "outputDirectory" ) ) + { + build.setOutputDirectory( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "finalName" ) ) + { + build.setFinalName( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "testOutputDirectory" ) ) + { + build.setTestOutputDirectory( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "plugins" ) ) + { + java.util.List plugins = new java.util.ArrayList(); + build.setPlugins( plugins ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "plugin" ) ) + { + plugins.add( parsePlugin( "plugin", parser ) ); + } + else + { + parser.nextText(); + } + } + } + else if ( parser.getName().equals( "pluginManagement" ) ) + { + build.setPluginManagement( parsePluginManagement( "pluginManagement", parser ) ); + } + else + { + parser.nextText(); + } + } + return build; + } //-- Build parseBuild(String, XmlPullParser) + + /** + * Method parseCiManagement + * + * @param tagName + * @param parser + */ + private CiManagement parseCiManagement( String tagName, XmlPullParser parser ) throws Exception + { + CiManagement ciManagement = new CiManagement(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "system" ) ) + { + ciManagement.setSystem( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "url" ) ) + { + ciManagement.setUrl( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "notifiers" ) ) + { + java.util.List notifiers = new java.util.ArrayList(); + ciManagement.setNotifiers( notifiers ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "notifier" ) ) + { + notifiers.add( parseNotifier( "notifier", parser ) ); + } + else + { + parser.nextText(); + } + } + } + else + { + parser.nextText(); + } + } + return ciManagement; + } //-- CiManagement parseCiManagement(String, XmlPullParser) + + /** + * Method parseContributor + * + * @param tagName + * @param parser + */ + private Contributor parseContributor( String tagName, XmlPullParser parser ) throws Exception + { + Contributor contributor = new Contributor(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "name" ) ) + { + contributor.setName( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "email" ) ) + { + contributor.setEmail( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "url" ) ) + { + contributor.setUrl( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "organization" ) ) + { + contributor.setOrganization( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "roles" ) ) + { + java.util.List roles = new java.util.ArrayList(); + contributor.setRoles( roles ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "role" ) ) + { + roles.add( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + } + else if ( parser.getName().equals( "timezone" ) ) + { + contributor.setTimezone( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + return contributor; + } //-- Contributor parseContributor(String, XmlPullParser) + + /** + * Method parseDependency + * + * @param tagName + * @param parser + */ + private Dependency parseDependency( String tagName, XmlPullParser parser ) throws Exception + { + Dependency dependency = new Dependency(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "groupId" ) ) + { + dependency.setGroupId( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "artifactId" ) ) + { + dependency.setArtifactId( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "version" ) ) + { + dependency.setVersion( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "type" ) ) + { + dependency.setType( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "scope" ) ) + { + dependency.setScope( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + return dependency; + } //-- Dependency parseDependency(String, XmlPullParser) + + /** + * Method parseDependencyManagement + * + * @param tagName + * @param parser + */ + private DependencyManagement parseDependencyManagement( String tagName, XmlPullParser parser ) throws Exception + { + DependencyManagement dependencyManagement = new DependencyManagement(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "dependencies" ) ) + { + java.util.List dependencies = new java.util.ArrayList(); + dependencyManagement.setDependencies( dependencies ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "dependency" ) ) + { + dependencies.add( parseDependency( "dependency", parser ) ); + } + else + { + parser.nextText(); + } + } + } + else + { + parser.nextText(); + } + } + return dependencyManagement; + } //-- DependencyManagement parseDependencyManagement(String, XmlPullParser) + + /** + * Method parseDeveloper + * + * @param tagName + * @param parser + */ + private Developer parseDeveloper( String tagName, XmlPullParser parser ) throws Exception + { + Developer developer = new Developer(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "id" ) ) + { + developer.setId( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "name" ) ) + { + developer.setName( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "email" ) ) + { + developer.setEmail( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "url" ) ) + { + developer.setUrl( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "organization" ) ) + { + developer.setOrganization( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "roles" ) ) + { + java.util.List roles = new java.util.ArrayList(); + developer.setRoles( roles ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "role" ) ) + { + roles.add( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + } + else if ( parser.getName().equals( "timezone" ) ) + { + developer.setTimezone( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + return developer; + } //-- Developer parseDeveloper(String, XmlPullParser) + + /** + * Method parseDistributionManagement + * + * @param tagName + * @param parser + */ + private DistributionManagement parseDistributionManagement( String tagName, XmlPullParser parser ) throws Exception + { + DistributionManagement distributionManagement = new DistributionManagement(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "repository" ) ) + { + distributionManagement.setRepository( parseRepository( "repository", parser ) ); + } + else if ( parser.getName().equals( "site" ) ) + { + distributionManagement.setSite( parseSite( "site", parser ) ); + } + else + { + parser.nextText(); + } + } + return distributionManagement; + } //-- DistributionManagement parseDistributionManagement(String, XmlPullParser) + + /** + * Method parseFileSet + * + * @param tagName + * @param parser + */ + private FileSet parseFileSet( String tagName, XmlPullParser parser ) throws Exception + { + FileSet fileSet = new FileSet(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "directory" ) ) + { + fileSet.setDirectory( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "includes" ) ) + { + fileSet.setIncludes( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "excludes" ) ) + { + fileSet.setExcludes( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + return fileSet; + } //-- FileSet parseFileSet(String, XmlPullParser) + + /** + * Method parseGoal + * + * @param tagName + * @param parser + */ + private Goal parseGoal( String tagName, XmlPullParser parser ) throws Exception + { + Goal goal = new Goal(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "id" ) ) + { + goal.setId( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "disabled" ) ) + { + } + else if ( parser.getName().equals( "configuration" ) ) + { + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + String key = parser.getName(); + String value = parser.nextText().trim(); + goal.addConfiguration( key, value ); + } + } + else + { + parser.nextText(); + } + } + return goal; + } //-- Goal parseGoal(String, XmlPullParser) + + /** + * Method parseIssueManagement + * + * @param tagName + * @param parser + */ + private IssueManagement parseIssueManagement( String tagName, XmlPullParser parser ) throws Exception + { + IssueManagement issueManagement = new IssueManagement(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "system" ) ) + { + issueManagement.setSystem( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "url" ) ) + { + issueManagement.setUrl( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + return issueManagement; + } //-- IssueManagement parseIssueManagement(String, XmlPullParser) + + /** + * Method parseLicense + * + * @param tagName + * @param parser + */ + private License parseLicense( String tagName, XmlPullParser parser ) throws Exception + { + License license = new License(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "name" ) ) + { + license.setName( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "url" ) ) + { + license.setUrl( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "comments" ) ) + { + license.setComments( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + return license; + } //-- License parseLicense(String, XmlPullParser) + + /** + * Method parseMailingList + * + * @param tagName + * @param parser + */ + private MailingList parseMailingList( String tagName, XmlPullParser parser ) throws Exception + { + MailingList mailingList = new MailingList(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "name" ) ) + { + mailingList.setName( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "subscribe" ) ) + { + mailingList.setSubscribe( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "unsubscribe" ) ) + { + mailingList.setUnsubscribe( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "post" ) ) + { + mailingList.setPost( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "archive" ) ) + { + mailingList.setArchive( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "otherArchives" ) ) + { + java.util.List otherArchives = new java.util.ArrayList(); + mailingList.setOtherArchives( otherArchives ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "otherArchive" ) ) + { + otherArchives.add( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + } + else + { + parser.nextText(); + } + } + return mailingList; + } //-- MailingList parseMailingList(String, XmlPullParser) + + /** + * Method parseModel + * + * @param tagName + * @param parser + */ + private Model parseModel( String tagName, XmlPullParser parser ) throws Exception + { + Model model = new Model(); + int eventType = parser.getEventType(); + while ( eventType != XmlPullParser.END_DOCUMENT ) + { + if ( eventType == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "extend" ) ) + { + model.setExtend( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "parent" ) ) + { + model.setParent( parseParent( "parent", parser ) ); + } + else if ( parser.getName().equals( "modelVersion" ) ) + { + model.setModelVersion( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "groupId" ) ) + { + model.setGroupId( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "artifactId" ) ) + { + model.setArtifactId( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "packaging" ) ) + { + model.setPackaging( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "modules" ) ) + { + java.util.List modules = new java.util.ArrayList(); + model.setModules( modules ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "module" ) ) + { + modules.add( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + } + else if ( parser.getName().equals( "name" ) ) + { + model.setName( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "version" ) ) + { + model.setVersion( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "description" ) ) + { + model.setDescription( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "url" ) ) + { + model.setUrl( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "issueManagement" ) ) + { + model.setIssueManagement( parseIssueManagement( "issueManagement", parser ) ); + } + else if ( parser.getName().equals( "ciManagement" ) ) + { + model.setCiManagement( parseCiManagement( "ciManagement", parser ) ); + } + else if ( parser.getName().equals( "inceptionYear" ) ) + { + model.setInceptionYear( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "repositories" ) ) + { + java.util.List repositories = new java.util.ArrayList(); + model.setRepositories( repositories ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "repository" ) ) + { + repositories.add( parseRepository( "repository", parser ) ); + } + else + { + parser.nextText(); + } + } + } + else if ( parser.getName().equals( "pluginRepositories" ) ) + { + java.util.List pluginRepositories = new java.util.ArrayList(); + model.setPluginRepositories( pluginRepositories ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "pluginRepository" ) ) + { + pluginRepositories.add( parseRepository( "pluginRepository", parser ) ); + } + else + { + parser.nextText(); + } + } + } + else if ( parser.getName().equals( "mailingLists" ) ) + { + java.util.List mailingLists = new java.util.ArrayList(); + model.setMailingLists( mailingLists ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "mailingList" ) ) + { + mailingLists.add( parseMailingList( "mailingList", parser ) ); + } + else + { + parser.nextText(); + } + } + } + else if ( parser.getName().equals( "developers" ) ) + { + java.util.List developers = new java.util.ArrayList(); + model.setDevelopers( developers ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "developer" ) ) + { + developers.add( parseDeveloper( "developer", parser ) ); + } + else + { + parser.nextText(); + } + } + } + else if ( parser.getName().equals( "contributors" ) ) + { + java.util.List contributors = new java.util.ArrayList(); + model.setContributors( contributors ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "contributor" ) ) + { + contributors.add( parseContributor( "contributor", parser ) ); + } + else + { + parser.nextText(); + } + } + } + else if ( parser.getName().equals( "dependencies" ) ) + { + java.util.List dependencies = new java.util.ArrayList(); + model.setDependencies( dependencies ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "dependency" ) ) + { + dependencies.add( parseDependency( "dependency", parser ) ); + } + else + { + parser.nextText(); + } + } + } + else if ( parser.getName().equals( "licenses" ) ) + { + java.util.List licenses = new java.util.ArrayList(); + model.setLicenses( licenses ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "license" ) ) + { + licenses.add( parseLicense( "license", parser ) ); + } + else + { + parser.nextText(); + } + } + } + else if ( parser.getName().equals( "reports" ) ) + { + model.setReports( parseReports( "reports", parser ) ); + } + else if ( parser.getName().equals( "scm" ) ) + { + model.setScm( parseScm( "scm", parser ) ); + } + else if ( parser.getName().equals( "build" ) ) + { + model.setBuild( parseBuild( "build", parser ) ); + } + else if ( parser.getName().equals( "organization" ) ) + { + model.setOrganization( parseOrganization( "organization", parser ) ); + } + else if ( parser.getName().equals( "distributionManagement" ) ) + { + model.setDistributionManagement( parseDistributionManagement( "distributionManagement", parser ) ); + } + else if ( parser.getName().equals( "dependencyManagement" ) ) + { + model.setDependencyManagement( parseDependencyManagement( "dependencyManagement", parser ) ); + } + } + eventType = parser.next(); + } + return model; + } //-- Model parseModel(String, XmlPullParser) + + /** + * Method parseNotifier + * + * @param tagName + * @param parser + */ + private Notifier parseNotifier( String tagName, XmlPullParser parser ) throws Exception + { + Notifier notifier = new Notifier(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "type" ) ) + { + notifier.setType( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "address" ) ) + { + notifier.setAddress( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "configuration" ) ) + { + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + String key = parser.getName(); + String value = parser.nextText().trim(); + notifier.addConfiguration( key, value ); + } + } + else + { + parser.nextText(); + } + } + return notifier; + } //-- Notifier parseNotifier(String, XmlPullParser) + + /** + * Method parseOrganization + * + * @param tagName + * @param parser + */ + private Organization parseOrganization( String tagName, XmlPullParser parser ) throws Exception + { + Organization organization = new Organization(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "name" ) ) + { + organization.setName( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "url" ) ) + { + organization.setUrl( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + return organization; + } //-- Organization parseOrganization(String, XmlPullParser) + + /** + * Method parseParent + * + * @param tagName + * @param parser + */ + private Parent parseParent( String tagName, XmlPullParser parser ) throws Exception + { + Parent parent = new Parent(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "artifactId" ) ) + { + parent.setArtifactId( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "groupId" ) ) + { + parent.setGroupId( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "version" ) ) + { + parent.setVersion( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + return parent; + } //-- Parent parseParent(String, XmlPullParser) + + /** + * Method parsePatternSet + * + * @param tagName + * @param parser + */ + private PatternSet parsePatternSet( String tagName, XmlPullParser parser ) throws Exception + { + PatternSet patternSet = new PatternSet(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "includes" ) ) + { + patternSet.setIncludes( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "excludes" ) ) + { + patternSet.setExcludes( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + return patternSet; + } //-- PatternSet parsePatternSet(String, XmlPullParser) + + /** + * Method parsePlugin + * + * @param tagName + * @param parser + */ + private Plugin parsePlugin( String tagName, XmlPullParser parser ) throws Exception + { + Plugin plugin = new Plugin(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "groupId" ) ) + { + plugin.setGroupId( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "artifactId" ) ) + { + plugin.setArtifactId( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "version" ) ) + { + plugin.setVersion( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "disabled" ) ) + { + } + else if ( parser.getName().equals( "configuration" ) ) + { + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + String key = parser.getName(); + String value = parser.nextText().trim(); + plugin.addConfiguration( key, value ); + } + } + else if ( parser.getName().equals( "goals" ) ) + { + java.util.List goals = new java.util.ArrayList(); + plugin.setGoals( goals ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "goal" ) ) + { + goals.add( parseGoal( "goal", parser ) ); + } + else + { + parser.nextText(); + } + } + } + else + { + parser.nextText(); + } + } + return plugin; + } //-- Plugin parsePlugin(String, XmlPullParser) + + /** + * Method parsePluginManagement + * + * @param tagName + * @param parser + */ + private PluginManagement parsePluginManagement( String tagName, XmlPullParser parser ) throws Exception + { + PluginManagement pluginManagement = new PluginManagement(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "plugins" ) ) + { + java.util.List plugins = new java.util.ArrayList(); + pluginManagement.setPlugins( plugins ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "plugin" ) ) + { + plugins.add( parsePlugin( "plugin", parser ) ); + } + else + { + parser.nextText(); + } + } + } + else + { + parser.nextText(); + } + } + return pluginManagement; + } //-- PluginManagement parsePluginManagement(String, XmlPullParser) + + /** + * Method parseReports + * + * @param tagName + * @param parser + */ + private Reports parseReports( String tagName, XmlPullParser parser ) throws Exception + { + Reports reports = new Reports(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "outputDirectory" ) ) + { + reports.setOutputDirectory( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "plugins" ) ) + { + java.util.List plugins = new java.util.ArrayList(); + reports.setPlugins( plugins ); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "plugin" ) ) + { + plugins.add( parsePlugin( "plugin", parser ) ); + } + else + { + parser.nextText(); + } + } + } + else + { + parser.nextText(); + } + } + return reports; + } //-- Reports parseReports(String, XmlPullParser) + + /** + * Method parseRepository + * + * @param tagName + * @param parser + */ + private Repository parseRepository( String tagName, XmlPullParser parser ) throws Exception + { + Repository repository = new Repository(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "id" ) ) + { + repository.setId( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "name" ) ) + { + repository.setName( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "url" ) ) + { + repository.setUrl( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + return repository; + } //-- Repository parseRepository(String, XmlPullParser) + + /** + * Method parseResource + * + * @param tagName + * @param parser + */ + private Resource parseResource( String tagName, XmlPullParser parser ) throws Exception + { + Resource resource = new Resource(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "targetPath" ) ) + { + resource.setTargetPath( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "directory" ) ) + { + resource.setDirectory( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "includes" ) ) + { + resource.setIncludes( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "excludes" ) ) + { + resource.setExcludes( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + return resource; + } //-- Resource parseResource(String, XmlPullParser) + + /** + * Method parseScm + * + * @param tagName + * @param parser + */ + private Scm parseScm( String tagName, XmlPullParser parser ) throws Exception + { + Scm scm = new Scm(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "connection" ) ) + { + scm.setConnection( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "developerConnection" ) ) + { + scm.setDeveloperConnection( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "url" ) ) + { + scm.setUrl( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + return scm; + } //-- Scm parseScm(String, XmlPullParser) + + /** + * Method parseSite + * + * @param tagName + * @param parser + */ + private Site parseSite( String tagName, XmlPullParser parser ) throws Exception + { + Site site = new Site(); + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( tagName ) ) + { + } + if ( parser.getName().equals( "id" ) ) + { + site.setId( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "name" ) ) + { + site.setName( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "url" ) ) + { + site.setUrl( parser.nextText().trim() ); + } + else + { + parser.nextText(); + } + } + return site; + } //-- Site parseSite(String, XmlPullParser) + + /** + * Method read + * + * @param reader + */ + public Model read( Reader reader ) throws Exception + { + XmlPullParser parser = new MXParser(); + parser.setInput( reader ); + + if ( addDefaultEntities ) + { + // ---------------------------------------------------------------------- + // Latin 1 entities + // ---------------------------------------------------------------------- + + parser.defineEntityReplacementText( "nbsp", "\u00a0" ); + parser.defineEntityReplacementText( "iexcl", "\u00a1" ); + parser.defineEntityReplacementText( "cent", "\u00a2" ); + parser.defineEntityReplacementText( "pound", "\u00a3" ); + parser.defineEntityReplacementText( "curren", "\u00a4" ); + parser.defineEntityReplacementText( "yen", "\u00a5" ); + parser.defineEntityReplacementText( "brvbar", "\u00a6" ); + parser.defineEntityReplacementText( "sect", "\u00a7" ); + parser.defineEntityReplacementText( "uml", "\u00a8" ); + parser.defineEntityReplacementText( "copy", "\u00a9" ); + parser.defineEntityReplacementText( "ordf", "\u00aa" ); + parser.defineEntityReplacementText( "laquo", "\u00ab" ); + parser.defineEntityReplacementText( "not", "\u00ac" ); + parser.defineEntityReplacementText( "shy", "\u00ad" ); + parser.defineEntityReplacementText( "reg", "\u00ae" ); + parser.defineEntityReplacementText( "macr", "\u00af" ); + parser.defineEntityReplacementText( "deg", "\u00b0" ); + parser.defineEntityReplacementText( "plusmn", "\u00b1" ); + parser.defineEntityReplacementText( "sup2", "\u00b2" ); + parser.defineEntityReplacementText( "sup3", "\u00b3" ); + parser.defineEntityReplacementText( "acute", "\u00b4" ); + parser.defineEntityReplacementText( "micro", "\u00b5" ); + parser.defineEntityReplacementText( "para", "\u00b6" ); + parser.defineEntityReplacementText( "middot", "\u00b7" ); + parser.defineEntityReplacementText( "cedil", "\u00b8" ); + parser.defineEntityReplacementText( "sup1", "\u00b9" ); + parser.defineEntityReplacementText( "ordm", "\u00ba" ); + parser.defineEntityReplacementText( "raquo", "\u00bb" ); + parser.defineEntityReplacementText( "frac14", "\u00bc" ); + parser.defineEntityReplacementText( "frac12", "\u00bd" ); + parser.defineEntityReplacementText( "frac34", "\u00be" ); + parser.defineEntityReplacementText( "iquest", "\u00bf" ); + parser.defineEntityReplacementText( "Agrave", "\u00c0" ); + parser.defineEntityReplacementText( "Aacute", "\u00c1" ); + parser.defineEntityReplacementText( "Acirc", "\u00c2" ); + parser.defineEntityReplacementText( "Atilde", "\u00c3" ); + parser.defineEntityReplacementText( "Auml", "\u00c4" ); + parser.defineEntityReplacementText( "Aring", "\u00c5" ); + parser.defineEntityReplacementText( "AElig", "\u00c6" ); + parser.defineEntityReplacementText( "Ccedil", "\u00c7" ); + parser.defineEntityReplacementText( "Egrave", "\u00c8" ); + parser.defineEntityReplacementText( "Eacute", "\u00c9" ); + parser.defineEntityReplacementText( "Ecirc", "\u00ca" ); + parser.defineEntityReplacementText( "Euml", "\u00cb" ); + parser.defineEntityReplacementText( "Igrave", "\u00cc" ); + parser.defineEntityReplacementText( "Iacute", "\u00cd" ); + parser.defineEntityReplacementText( "Icirc", "\u00ce" ); + parser.defineEntityReplacementText( "Iuml", "\u00cf" ); + parser.defineEntityReplacementText( "ETH", "\u00d0" ); + parser.defineEntityReplacementText( "Ntilde", "\u00d1" ); + parser.defineEntityReplacementText( "Ograve", "\u00d2" ); + parser.defineEntityReplacementText( "Oacute", "\u00d3" ); + parser.defineEntityReplacementText( "Ocirc", "\u00d4" ); + parser.defineEntityReplacementText( "Otilde", "\u00d5" ); + parser.defineEntityReplacementText( "Ouml", "\u00d6" ); + parser.defineEntityReplacementText( "times", "\u00d7" ); + parser.defineEntityReplacementText( "Oslash", "\u00d8" ); + parser.defineEntityReplacementText( "Ugrave", "\u00d9" ); + parser.defineEntityReplacementText( "Uacute", "\u00da" ); + parser.defineEntityReplacementText( "Ucirc", "\u00db" ); + parser.defineEntityReplacementText( "Uuml", "\u00dc" ); + parser.defineEntityReplacementText( "Yacute", "\u00dd" ); + parser.defineEntityReplacementText( "THORN", "\u00de" ); + parser.defineEntityReplacementText( "szlig", "\u00df" ); + parser.defineEntityReplacementText( "agrave", "\u00e0" ); + parser.defineEntityReplacementText( "aacute", "\u00e1" ); + parser.defineEntityReplacementText( "acirc", "\u00e2" ); + parser.defineEntityReplacementText( "atilde", "\u00e3" ); + parser.defineEntityReplacementText( "auml", "\u00e4" ); + parser.defineEntityReplacementText( "aring", "\u00e5" ); + parser.defineEntityReplacementText( "aelig", "\u00e6" ); + parser.defineEntityReplacementText( "ccedil", "\u00e7" ); + parser.defineEntityReplacementText( "egrave", "\u00e8" ); + parser.defineEntityReplacementText( "eacute", "\u00e9" ); + parser.defineEntityReplacementText( "ecirc", "\u00ea" ); + parser.defineEntityReplacementText( "euml", "\u00eb" ); + parser.defineEntityReplacementText( "igrave", "\u00ec" ); + parser.defineEntityReplacementText( "iacute", "\u00ed" ); + parser.defineEntityReplacementText( "icirc", "\u00ee" ); + parser.defineEntityReplacementText( "iuml", "\u00ef" ); + parser.defineEntityReplacementText( "eth", "\u00f0" ); + parser.defineEntityReplacementText( "ntilde", "\u00f1" ); + parser.defineEntityReplacementText( "ograve", "\u00f2" ); + parser.defineEntityReplacementText( "oacute", "\u00f3" ); + parser.defineEntityReplacementText( "ocirc", "\u00f4" ); + parser.defineEntityReplacementText( "otilde", "\u00f5" ); + parser.defineEntityReplacementText( "ouml", "\u00f6" ); + parser.defineEntityReplacementText( "divide", "\u00f7" ); + parser.defineEntityReplacementText( "oslash", "\u00f8" ); + parser.defineEntityReplacementText( "ugrave", "\u00f9" ); + parser.defineEntityReplacementText( "uacute", "\u00fa" ); + parser.defineEntityReplacementText( "ucirc", "\u00fb" ); + parser.defineEntityReplacementText( "uuml", "\u00fc" ); + parser.defineEntityReplacementText( "yacute", "\u00fd" ); + parser.defineEntityReplacementText( "thorn", "\u00fe" ); + parser.defineEntityReplacementText( "yuml", "\u00ff" ); + + // ---------------------------------------------------------------------- + // Special entities + // ---------------------------------------------------------------------- + + parser.defineEntityReplacementText( "OElig", "\u0152" ); + parser.defineEntityReplacementText( "oelig", "\u0153" ); + parser.defineEntityReplacementText( "Scaron", "\u0160" ); + parser.defineEntityReplacementText( "scaron", "\u0161" ); + parser.defineEntityReplacementText( "Yuml", "\u0178" ); + parser.defineEntityReplacementText( "circ", "\u02c6" ); + parser.defineEntityReplacementText( "tilde", "\u02dc" ); + parser.defineEntityReplacementText( "ensp", "\u2002" ); + parser.defineEntityReplacementText( "emsp", "\u2003" ); + parser.defineEntityReplacementText( "thinsp", "\u2009" ); + parser.defineEntityReplacementText( "zwnj", "\u200c" ); + parser.defineEntityReplacementText( "zwj", "\u200d" ); + parser.defineEntityReplacementText( "lrm", "\u200e" ); + parser.defineEntityReplacementText( "rlm", "\u200f" ); + parser.defineEntityReplacementText( "ndash", "\u2013" ); + parser.defineEntityReplacementText( "mdash", "\u2014" ); + parser.defineEntityReplacementText( "lsquo", "\u2018" ); + parser.defineEntityReplacementText( "rsquo", "\u2019" ); + parser.defineEntityReplacementText( "sbquo", "\u201a" ); + parser.defineEntityReplacementText( "ldquo", "\u201c" ); + parser.defineEntityReplacementText( "rdquo", "\u201d" ); + parser.defineEntityReplacementText( "bdquo", "\u201e" ); + parser.defineEntityReplacementText( "dagger", "\u2020" ); + parser.defineEntityReplacementText( "Dagger", "\u2021" ); + parser.defineEntityReplacementText( "permil", "\u2030" ); + parser.defineEntityReplacementText( "lsaquo", "\u2039" ); + parser.defineEntityReplacementText( "rsaquo", "\u203a" ); + parser.defineEntityReplacementText( "euro", "\u20ac" ); + + // ---------------------------------------------------------------------- + // Symbol entities + // ---------------------------------------------------------------------- + + parser.defineEntityReplacementText( "fnof", "\u0192" ); + parser.defineEntityReplacementText( "Alpha", "\u0391" ); + parser.defineEntityReplacementText( "Beta", "\u0392" ); + parser.defineEntityReplacementText( "Gamma", "\u0393" ); + parser.defineEntityReplacementText( "Delta", "\u0394" ); + parser.defineEntityReplacementText( "Epsilon", "\u0395" ); + parser.defineEntityReplacementText( "Zeta", "\u0396" ); + parser.defineEntityReplacementText( "Eta", "\u0397" ); + parser.defineEntityReplacementText( "Theta", "\u0398" ); + parser.defineEntityReplacementText( "Iota", "\u0399" ); + parser.defineEntityReplacementText( "Kappa", "\u039a" ); + parser.defineEntityReplacementText( "Lambda", "\u039b" ); + parser.defineEntityReplacementText( "Mu", "\u039c" ); + parser.defineEntityReplacementText( "Nu", "\u039d" ); + parser.defineEntityReplacementText( "Xi", "\u039e" ); + parser.defineEntityReplacementText( "Omicron", "\u039f" ); + parser.defineEntityReplacementText( "Pi", "\u03a0" ); + parser.defineEntityReplacementText( "Rho", "\u03a1" ); + parser.defineEntityReplacementText( "Sigma", "\u03a3" ); + parser.defineEntityReplacementText( "Tau", "\u03a4" ); + parser.defineEntityReplacementText( "Upsilon", "\u03a5" ); + parser.defineEntityReplacementText( "Phi", "\u03a6" ); + parser.defineEntityReplacementText( "Chi", "\u03a7" ); + parser.defineEntityReplacementText( "Psi", "\u03a8" ); + parser.defineEntityReplacementText( "Omega", "\u03a9" ); + parser.defineEntityReplacementText( "alpha", "\u03b1" ); + parser.defineEntityReplacementText( "beta", "\u03b2" ); + parser.defineEntityReplacementText( "gamma", "\u03b3" ); + parser.defineEntityReplacementText( "delta", "\u03b4" ); + parser.defineEntityReplacementText( "epsilon", "\u03b5" ); + parser.defineEntityReplacementText( "zeta", "\u03b6" ); + parser.defineEntityReplacementText( "eta", "\u03b7" ); + parser.defineEntityReplacementText( "theta", "\u03b8" ); + parser.defineEntityReplacementText( "iota", "\u03b9" ); + parser.defineEntityReplacementText( "kappa", "\u03ba" ); + parser.defineEntityReplacementText( "lambda", "\u03bb" ); + parser.defineEntityReplacementText( "mu", "\u03bc" ); + parser.defineEntityReplacementText( "nu", "\u03bd" ); + parser.defineEntityReplacementText( "xi", "\u03be" ); + parser.defineEntityReplacementText( "omicron", "\u03bf" ); + parser.defineEntityReplacementText( "pi", "\u03c0" ); + parser.defineEntityReplacementText( "rho", "\u03c1" ); + parser.defineEntityReplacementText( "sigmaf", "\u03c2" ); + parser.defineEntityReplacementText( "sigma", "\u03c3" ); + parser.defineEntityReplacementText( "tau", "\u03c4" ); + parser.defineEntityReplacementText( "upsilon", "\u03c5" ); + parser.defineEntityReplacementText( "phi", "\u03c6" ); + parser.defineEntityReplacementText( "chi", "\u03c7" ); + parser.defineEntityReplacementText( "psi", "\u03c8" ); + parser.defineEntityReplacementText( "omega", "\u03c9" ); + parser.defineEntityReplacementText( "thetasym", "\u03d1" ); + parser.defineEntityReplacementText( "upsih", "\u03d2" ); + parser.defineEntityReplacementText( "piv", "\u03d6" ); + parser.defineEntityReplacementText( "bull", "\u2022" ); + parser.defineEntityReplacementText( "hellip", "\u2026" ); + parser.defineEntityReplacementText( "prime", "\u2032" ); + parser.defineEntityReplacementText( "Prime", "\u2033" ); + parser.defineEntityReplacementText( "oline", "\u203e" ); + parser.defineEntityReplacementText( "frasl", "\u2044" ); + parser.defineEntityReplacementText( "weierp", "\u2118" ); + parser.defineEntityReplacementText( "image", "\u2111" ); + parser.defineEntityReplacementText( "real", "\u211c" ); + parser.defineEntityReplacementText( "trade", "\u2122" ); + parser.defineEntityReplacementText( "alefsym", "\u2135" ); + parser.defineEntityReplacementText( "larr", "\u2190" ); + parser.defineEntityReplacementText( "uarr", "\u2191" ); + parser.defineEntityReplacementText( "rarr", "\u2192" ); + parser.defineEntityReplacementText( "darr", "\u2193" ); + parser.defineEntityReplacementText( "harr", "\u2194" ); + parser.defineEntityReplacementText( "crarr", "\u21b5" ); + parser.defineEntityReplacementText( "lArr", "\u21d0" ); + parser.defineEntityReplacementText( "uArr", "\u21d1" ); + parser.defineEntityReplacementText( "rArr", "\u21d2" ); + parser.defineEntityReplacementText( "dArr", "\u21d3" ); + parser.defineEntityReplacementText( "hArr", "\u21d4" ); + parser.defineEntityReplacementText( "forall", "\u2200" ); + parser.defineEntityReplacementText( "part", "\u2202" ); + parser.defineEntityReplacementText( "exist", "\u2203" ); + parser.defineEntityReplacementText( "empty", "\u2205" ); + parser.defineEntityReplacementText( "nabla", "\u2207" ); + parser.defineEntityReplacementText( "isin", "\u2208" ); + parser.defineEntityReplacementText( "notin", "\u2209" ); + parser.defineEntityReplacementText( "ni", "\u220b" ); + parser.defineEntityReplacementText( "prod", "\u220f" ); + parser.defineEntityReplacementText( "sum", "\u2211" ); + parser.defineEntityReplacementText( "minus", "\u2212" ); + parser.defineEntityReplacementText( "lowast", "\u2217" ); + parser.defineEntityReplacementText( "radic", "\u221a" ); + parser.defineEntityReplacementText( "prop", "\u221d" ); + parser.defineEntityReplacementText( "infin", "\u221e" ); + parser.defineEntityReplacementText( "ang", "\u2220" ); + parser.defineEntityReplacementText( "and", "\u2227" ); + parser.defineEntityReplacementText( "or", "\u2228" ); + parser.defineEntityReplacementText( "cap", "\u2229" ); + parser.defineEntityReplacementText( "cup", "\u222a" ); + parser.defineEntityReplacementText( "int", "\u222b" ); + parser.defineEntityReplacementText( "there4", "\u2234" ); + parser.defineEntityReplacementText( "sim", "\u223c" ); + parser.defineEntityReplacementText( "cong", "\u2245" ); + parser.defineEntityReplacementText( "asymp", "\u2248" ); + parser.defineEntityReplacementText( "ne", "\u2260" ); + parser.defineEntityReplacementText( "equiv", "\u2261" ); + parser.defineEntityReplacementText( "le", "\u2264" ); + parser.defineEntityReplacementText( "ge", "\u2265" ); + parser.defineEntityReplacementText( "sub", "\u2282" ); + parser.defineEntityReplacementText( "sup", "\u2283" ); + parser.defineEntityReplacementText( "nsub", "\u2284" ); + parser.defineEntityReplacementText( "sube", "\u2286" ); + parser.defineEntityReplacementText( "supe", "\u2287" ); + parser.defineEntityReplacementText( "oplus", "\u2295" ); + parser.defineEntityReplacementText( "otimes", "\u2297" ); + parser.defineEntityReplacementText( "perp", "\u22a5" ); + parser.defineEntityReplacementText( "sdot", "\u22c5" ); + parser.defineEntityReplacementText( "lceil", "\u2308" ); + parser.defineEntityReplacementText( "rceil", "\u2309" ); + parser.defineEntityReplacementText( "lfloor", "\u230a" ); + parser.defineEntityReplacementText( "rfloor", "\u230b" ); + parser.defineEntityReplacementText( "lang", "\u2329" ); + parser.defineEntityReplacementText( "rang", "\u232a" ); + parser.defineEntityReplacementText( "loz", "\u25ca" ); + parser.defineEntityReplacementText( "spades", "\u2660" ); + parser.defineEntityReplacementText( "clubs", "\u2663" ); + parser.defineEntityReplacementText( "hearts", "\u2665" ); + parser.defineEntityReplacementText( "diams", "\u2666" ); + + } + + return parseModel( "model", parser ); + } //-- Model read(Reader) + + /** + * Returns the state of the "add default entities" flag. + * + * @param addDefaultEntities + */ + public void setAddDefaultEntities( boolean addDefaultEntities ) + { + this.addDefaultEntities = addDefaultEntities; + } //-- void setAddDefaultEntities(boolean) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/io/xpp3/MavenXpp3Writer.java b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/io/xpp3/MavenXpp3Writer.java new file mode 100644 index 0000000000..b7b40e28c3 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/model/v4_0_0/io/xpp3/MavenXpp3Writer.java @@ -0,0 +1,1093 @@ +/* + * $Id$ + */ + +package org.apache.maven.model.v4_0_0.io.xpp3; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + +import org.apache.maven.model.v4_0_0.Build; +import org.apache.maven.model.v4_0_0.CiManagement; +import org.apache.maven.model.v4_0_0.Contributor; +import org.apache.maven.model.v4_0_0.Dependency; +import org.apache.maven.model.v4_0_0.DependencyManagement; +import org.apache.maven.model.v4_0_0.Developer; +import org.apache.maven.model.v4_0_0.DistributionManagement; +import org.apache.maven.model.v4_0_0.FileSet; +import org.apache.maven.model.v4_0_0.Goal; +import org.apache.maven.model.v4_0_0.IssueManagement; +import org.apache.maven.model.v4_0_0.License; +import org.apache.maven.model.v4_0_0.MailingList; +import org.apache.maven.model.v4_0_0.Model; +import org.apache.maven.model.v4_0_0.Notifier; +import org.apache.maven.model.v4_0_0.Organization; +import org.apache.maven.model.v4_0_0.Parent; +import org.apache.maven.model.v4_0_0.PatternSet; +import org.apache.maven.model.v4_0_0.Plugin; +import org.apache.maven.model.v4_0_0.PluginManagement; +import org.apache.maven.model.v4_0_0.Reports; +import org.apache.maven.model.v4_0_0.Repository; +import org.apache.maven.model.v4_0_0.Resource; +import org.apache.maven.model.v4_0_0.Scm; +import org.apache.maven.model.v4_0_0.Site; +import org.codehaus.plexus.util.xml.pull.MXSerializer; +import org.codehaus.plexus.util.xml.pull.XmlSerializer; + +import java.io.Writer; +import java.util.Iterator; + +/** + * Class MavenXpp3Writer. + * + * @version $Revision$ $Date$ + */ +public class MavenXpp3Writer +{ + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field serializer + */ + private org.codehaus.plexus.util.xml.pull.XmlSerializer serializer; + + /** + * Field NAMESPACE + */ + private String NAMESPACE; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method write + * + * @param writer + * @param model + */ + public void write( Writer writer, Model model ) throws Exception + { + serializer = new MXSerializer(); + serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-indentation", " " ); + serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n" ); + serializer.setOutput( writer ); + writeModel( model, "model", serializer ); + } //-- void write(Writer, Model) + + /** + * Method writeBuild + * + * @param build + * @param serializer + * @param tagName + */ + private void writeBuild( Build build, String tagName, XmlSerializer serializer ) throws Exception + { + if ( build != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( build.getSourceDirectory() != null ) + { + serializer.startTag( NAMESPACE, "sourceDirectory" ).text( build.getSourceDirectory() ) + .endTag( NAMESPACE, "sourceDirectory" ); + } + if ( build.getScriptSourceDirectory() != null ) + { + serializer.startTag( NAMESPACE, "scriptSourceDirectory" ).text( build.getScriptSourceDirectory() ) + .endTag( NAMESPACE, "scriptSourceDirectory" ); + } + if ( build.getTestSourceDirectory() != null ) + { + serializer.startTag( NAMESPACE, "testSourceDirectory" ).text( build.getTestSourceDirectory() ) + .endTag( NAMESPACE, "testSourceDirectory" ); + } + if ( build.getResources() != null && build.getResources().size() > 0 ) + { + serializer.startTag( NAMESPACE, "resources" ); + for ( Iterator iter = build.getResources().iterator(); iter.hasNext(); ) + { + Resource resource = (Resource) iter.next(); + writeResource( resource, "resource", serializer ); + } + serializer.endTag( NAMESPACE, "resources" ); + } + if ( build.getTestResources() != null && build.getTestResources().size() > 0 ) + { + serializer.startTag( NAMESPACE, "testResources" ); + for ( Iterator iter = build.getTestResources().iterator(); iter.hasNext(); ) + { + Resource resource = (Resource) iter.next(); + writeResource( resource, "testResource", serializer ); + } + serializer.endTag( NAMESPACE, "testResources" ); + } + if ( build.getDirectory() != null ) + { + serializer.startTag( NAMESPACE, "directory" ).text( build.getDirectory() ).endTag( NAMESPACE, + "directory" ); + } + if ( build.getOutputDirectory() != null ) + { + serializer.startTag( NAMESPACE, "outputDirectory" ).text( build.getOutputDirectory() ) + .endTag( NAMESPACE, "outputDirectory" ); + } + if ( build.getFinalName() != null ) + { + serializer.startTag( NAMESPACE, "finalName" ).text( build.getFinalName() ).endTag( NAMESPACE, + "finalName" ); + } + if ( build.getTestOutputDirectory() != null ) + { + serializer.startTag( NAMESPACE, "testOutputDirectory" ).text( build.getTestOutputDirectory() ) + .endTag( NAMESPACE, "testOutputDirectory" ); + } + if ( build.getPlugins() != null && build.getPlugins().size() > 0 ) + { + serializer.startTag( NAMESPACE, "plugins" ); + for ( Iterator iter = build.getPlugins().iterator(); iter.hasNext(); ) + { + Plugin plugin = (Plugin) iter.next(); + writePlugin( plugin, "plugin", serializer ); + } + serializer.endTag( NAMESPACE, "plugins" ); + } + if ( build.getPluginManagement() != null ) + { + writePluginManagement( build.getPluginManagement(), "pluginManagement", serializer ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writeBuild(Build, String, XmlSerializer) + + /** + * Method writeCiManagement + * + * @param ciManagement + * @param serializer + * @param tagName + */ + private void writeCiManagement( CiManagement ciManagement, String tagName, XmlSerializer serializer ) + throws Exception + { + if ( ciManagement != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( ciManagement.getSystem() != null ) + { + serializer.startTag( NAMESPACE, "system" ).text( ciManagement.getSystem() ) + .endTag( NAMESPACE, "system" ); + } + if ( ciManagement.getUrl() != null ) + { + serializer.startTag( NAMESPACE, "url" ).text( ciManagement.getUrl() ).endTag( NAMESPACE, "url" ); + } + if ( ciManagement.getNotifiers() != null && ciManagement.getNotifiers().size() > 0 ) + { + serializer.startTag( NAMESPACE, "notifiers" ); + for ( Iterator iter = ciManagement.getNotifiers().iterator(); iter.hasNext(); ) + { + Notifier notifier = (Notifier) iter.next(); + writeNotifier( notifier, "notifier", serializer ); + } + serializer.endTag( NAMESPACE, "notifiers" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writeCiManagement(CiManagement, String, XmlSerializer) + + /** + * Method writeContributor + * + * @param contributor + * @param serializer + * @param tagName + */ + private void writeContributor( Contributor contributor, String tagName, XmlSerializer serializer ) throws Exception + { + if ( contributor != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( contributor.getName() != null ) + { + serializer.startTag( NAMESPACE, "name" ).text( contributor.getName() ).endTag( NAMESPACE, "name" ); + } + if ( contributor.getEmail() != null ) + { + serializer.startTag( NAMESPACE, "email" ).text( contributor.getEmail() ).endTag( NAMESPACE, "email" ); + } + if ( contributor.getUrl() != null ) + { + serializer.startTag( NAMESPACE, "url" ).text( contributor.getUrl() ).endTag( NAMESPACE, "url" ); + } + if ( contributor.getOrganization() != null ) + { + serializer.startTag( NAMESPACE, "organization" ).text( contributor.getOrganization() ) + .endTag( NAMESPACE, "organization" ); + } + if ( contributor.getRoles() != null && contributor.getRoles().size() > 0 ) + { + serializer.startTag( NAMESPACE, "roles" ); + for ( Iterator iter = contributor.getRoles().iterator(); iter.hasNext(); ) + { + String role = (String) iter.next(); + serializer.startTag( NAMESPACE, "role" ).text( role ).endTag( NAMESPACE, "role" ); + } + serializer.endTag( NAMESPACE, "roles" ); + } + if ( contributor.getTimezone() != null ) + { + serializer.startTag( NAMESPACE, "timezone" ).text( contributor.getTimezone() ).endTag( NAMESPACE, + "timezone" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writeContributor(Contributor, String, XmlSerializer) + + /** + * Method writeDependency + * + * @param dependency + * @param serializer + * @param tagName + */ + private void writeDependency( Dependency dependency, String tagName, XmlSerializer serializer ) throws Exception + { + if ( dependency != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( dependency.getGroupId() != null ) + { + serializer.startTag( NAMESPACE, "groupId" ).text( dependency.getGroupId() ).endTag( NAMESPACE, + "groupId" ); + } + if ( dependency.getArtifactId() != null ) + { + serializer.startTag( NAMESPACE, "artifactId" ).text( dependency.getArtifactId() ).endTag( NAMESPACE, + "artifactId" ); + } + if ( dependency.getVersion() != null ) + { + serializer.startTag( NAMESPACE, "version" ).text( dependency.getVersion() ).endTag( NAMESPACE, + "version" ); + } + if ( dependency.getType() != null ) + { + serializer.startTag( NAMESPACE, "type" ).text( dependency.getType() ).endTag( NAMESPACE, "type" ); + } + if ( dependency.getScope() != null ) + { + serializer.startTag( NAMESPACE, "scope" ).text( dependency.getScope() ).endTag( NAMESPACE, "scope" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writeDependency(Dependency, String, XmlSerializer) + + /** + * Method writeDependencyManagement + * + * @param dependencyManagement + * @param serializer + * @param tagName + */ + private void writeDependencyManagement( DependencyManagement dependencyManagement, String tagName, + XmlSerializer serializer ) throws Exception + { + if ( dependencyManagement != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( dependencyManagement.getDependencies() != null && dependencyManagement.getDependencies().size() > 0 ) + { + serializer.startTag( NAMESPACE, "dependencies" ); + for ( Iterator iter = dependencyManagement.getDependencies().iterator(); iter.hasNext(); ) + { + Dependency dependency = (Dependency) iter.next(); + writeDependency( dependency, "dependency", serializer ); + } + serializer.endTag( NAMESPACE, "dependencies" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writeDependencyManagement(DependencyManagement, String, XmlSerializer) + + /** + * Method writeDeveloper + * + * @param developer + * @param serializer + * @param tagName + */ + private void writeDeveloper( Developer developer, String tagName, XmlSerializer serializer ) throws Exception + { + if ( developer != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( developer.getId() != null ) + { + serializer.startTag( NAMESPACE, "id" ).text( developer.getId() ).endTag( NAMESPACE, "id" ); + } + if ( developer.getName() != null ) + { + serializer.startTag( NAMESPACE, "name" ).text( developer.getName() ).endTag( NAMESPACE, "name" ); + } + if ( developer.getEmail() != null ) + { + serializer.startTag( NAMESPACE, "email" ).text( developer.getEmail() ).endTag( NAMESPACE, "email" ); + } + if ( developer.getUrl() != null ) + { + serializer.startTag( NAMESPACE, "url" ).text( developer.getUrl() ).endTag( NAMESPACE, "url" ); + } + if ( developer.getOrganization() != null ) + { + serializer.startTag( NAMESPACE, "organization" ).text( developer.getOrganization() ) + .endTag( NAMESPACE, "organization" ); + } + if ( developer.getRoles() != null && developer.getRoles().size() > 0 ) + { + serializer.startTag( NAMESPACE, "roles" ); + for ( Iterator iter = developer.getRoles().iterator(); iter.hasNext(); ) + { + String role = (String) iter.next(); + serializer.startTag( NAMESPACE, "role" ).text( role ).endTag( NAMESPACE, "role" ); + } + serializer.endTag( NAMESPACE, "roles" ); + } + if ( developer.getTimezone() != null ) + { + serializer.startTag( NAMESPACE, "timezone" ).text( developer.getTimezone() ).endTag( NAMESPACE, + "timezone" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writeDeveloper(Developer, String, XmlSerializer) + + /** + * Method writeDistributionManagement + * + * @param distributionManagement + * @param serializer + * @param tagName + */ + private void writeDistributionManagement( DistributionManagement distributionManagement, String tagName, + XmlSerializer serializer ) throws Exception + { + if ( distributionManagement != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( distributionManagement.getRepository() != null ) + { + writeRepository( distributionManagement.getRepository(), "repository", serializer ); + } + if ( distributionManagement.getSite() != null ) + { + writeSite( distributionManagement.getSite(), "site", serializer ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writeDistributionManagement(DistributionManagement, String, XmlSerializer) + + /** + * Method writeFileSet + * + * @param fileSet + * @param serializer + * @param tagName + */ + private void writeFileSet( FileSet fileSet, String tagName, XmlSerializer serializer ) throws Exception + { + if ( fileSet != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( fileSet.getDirectory() != null ) + { + serializer.startTag( NAMESPACE, "directory" ).text( fileSet.getDirectory() ).endTag( NAMESPACE, + "directory" ); + } + if ( fileSet.getIncludes() != null ) + { + serializer.startTag( NAMESPACE, "includes" ).text( fileSet.getIncludes() ).endTag( NAMESPACE, + "includes" ); + } + if ( fileSet.getExcludes() != null ) + { + serializer.startTag( NAMESPACE, "excludes" ).text( fileSet.getExcludes() ).endTag( NAMESPACE, + "excludes" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writeFileSet(FileSet, String, XmlSerializer) + + /** + * Method writeGoal + * + * @param goal + * @param serializer + * @param tagName + */ + private void writeGoal( Goal goal, String tagName, XmlSerializer serializer ) throws Exception + { + if ( goal != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( goal.getId() != null ) + { + serializer.startTag( NAMESPACE, "id" ).text( goal.getId() ).endTag( NAMESPACE, "id" ); + } + if ( goal.isDisabled() != null ) + { + serializer.startTag( NAMESPACE, "disabled" ).text( String.valueOf( goal.isDisabled() ) ) + .endTag( NAMESPACE, "disabled" ); + } + if ( goal.getConfiguration() != null && goal.getConfiguration().size() > 0 ) + { + serializer.startTag( NAMESPACE, "configuration" ); + for ( Iterator iter = goal.getConfiguration().keySet().iterator(); iter.hasNext(); ) + { + String key = (String) iter.next(); + String value = (String) goal.getConfiguration().get( key ); + serializer.startTag( NAMESPACE, "" + key + "" ).text( value ).endTag( NAMESPACE, "" + key + "" ); + } + serializer.endTag( NAMESPACE, "configuration" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writeGoal(Goal, String, XmlSerializer) + + /** + * Method writeIssueManagement + * + * @param issueManagement + * @param serializer + * @param tagName + */ + private void writeIssueManagement( IssueManagement issueManagement, String tagName, XmlSerializer serializer ) + throws Exception + { + if ( issueManagement != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( issueManagement.getSystem() != null ) + { + serializer.startTag( NAMESPACE, "system" ).text( issueManagement.getSystem() ).endTag( NAMESPACE, + "system" ); + } + if ( issueManagement.getUrl() != null ) + { + serializer.startTag( NAMESPACE, "url" ).text( issueManagement.getUrl() ).endTag( NAMESPACE, "url" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writeIssueManagement(IssueManagement, String, XmlSerializer) + + /** + * Method writeLicense + * + * @param license + * @param serializer + * @param tagName + */ + private void writeLicense( License license, String tagName, XmlSerializer serializer ) throws Exception + { + if ( license != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( license.getName() != null ) + { + serializer.startTag( NAMESPACE, "name" ).text( license.getName() ).endTag( NAMESPACE, "name" ); + } + if ( license.getUrl() != null ) + { + serializer.startTag( NAMESPACE, "url" ).text( license.getUrl() ).endTag( NAMESPACE, "url" ); + } + if ( license.getComments() != null ) + { + serializer.startTag( NAMESPACE, "comments" ).text( license.getComments() ).endTag( NAMESPACE, + "comments" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writeLicense(License, String, XmlSerializer) + + /** + * Method writeMailingList + * + * @param mailingList + * @param serializer + * @param tagName + */ + private void writeMailingList( MailingList mailingList, String tagName, XmlSerializer serializer ) throws Exception + { + if ( mailingList != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( mailingList.getName() != null ) + { + serializer.startTag( NAMESPACE, "name" ).text( mailingList.getName() ).endTag( NAMESPACE, "name" ); + } + if ( mailingList.getSubscribe() != null ) + { + serializer.startTag( NAMESPACE, "subscribe" ).text( mailingList.getSubscribe() ).endTag( NAMESPACE, + "subscribe" ); + } + if ( mailingList.getUnsubscribe() != null ) + { + serializer.startTag( NAMESPACE, "unsubscribe" ).text( mailingList.getUnsubscribe() ) + .endTag( NAMESPACE, "unsubscribe" ); + } + if ( mailingList.getPost() != null ) + { + serializer.startTag( NAMESPACE, "post" ).text( mailingList.getPost() ).endTag( NAMESPACE, "post" ); + } + if ( mailingList.getArchive() != null ) + { + serializer.startTag( NAMESPACE, "archive" ).text( mailingList.getArchive() ).endTag( NAMESPACE, + "archive" ); + } + if ( mailingList.getOtherArchives() != null && mailingList.getOtherArchives().size() > 0 ) + { + serializer.startTag( NAMESPACE, "otherArchives" ); + for ( Iterator iter = mailingList.getOtherArchives().iterator(); iter.hasNext(); ) + { + String otherArchive = (String) iter.next(); + serializer.startTag( NAMESPACE, "otherArchive" ).text( otherArchive ).endTag( NAMESPACE, + "otherArchive" ); + } + serializer.endTag( NAMESPACE, "otherArchives" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writeMailingList(MailingList, String, XmlSerializer) + + /** + * Method writeModel + * + * @param model + * @param serializer + * @param tagName + */ + private void writeModel( Model model, String tagName, XmlSerializer serializer ) throws Exception + { + if ( model != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( model.getExtend() != null ) + { + serializer.startTag( NAMESPACE, "extend" ).text( model.getExtend() ).endTag( NAMESPACE, "extend" ); + } + if ( model.getParent() != null ) + { + writeParent( model.getParent(), "parent", serializer ); + } + if ( model.getModelVersion() != null ) + { + serializer.startTag( NAMESPACE, "modelVersion" ).text( model.getModelVersion() ) + .endTag( NAMESPACE, "modelVersion" ); + } + if ( model.getGroupId() != null ) + { + serializer.startTag( NAMESPACE, "groupId" ).text( model.getGroupId() ).endTag( NAMESPACE, "groupId" ); + } + if ( model.getArtifactId() != null ) + { + serializer.startTag( NAMESPACE, "artifactId" ).text( model.getArtifactId() ).endTag( NAMESPACE, + "artifactId" ); + } + if ( model.getPackaging() != null ) + { + serializer.startTag( NAMESPACE, "packaging" ).text( model.getPackaging() ).endTag( NAMESPACE, + "packaging" ); + } + if ( model.getModules() != null && model.getModules().size() > 0 ) + { + serializer.startTag( NAMESPACE, "modules" ); + for ( Iterator iter = model.getModules().iterator(); iter.hasNext(); ) + { + String module = (String) iter.next(); + serializer.startTag( NAMESPACE, "module" ).text( module ).endTag( NAMESPACE, "module" ); + } + serializer.endTag( NAMESPACE, "modules" ); + } + if ( model.getName() != null ) + { + serializer.startTag( NAMESPACE, "name" ).text( model.getName() ).endTag( NAMESPACE, "name" ); + } + if ( model.getVersion() != null ) + { + serializer.startTag( NAMESPACE, "version" ).text( model.getVersion() ).endTag( NAMESPACE, "version" ); + } + if ( model.getDescription() != null ) + { + serializer.startTag( NAMESPACE, "description" ).text( model.getDescription() ).endTag( NAMESPACE, + "description" ); + } + if ( model.getUrl() != null ) + { + serializer.startTag( NAMESPACE, "url" ).text( model.getUrl() ).endTag( NAMESPACE, "url" ); + } + if ( model.getIssueManagement() != null ) + { + writeIssueManagement( model.getIssueManagement(), "issueManagement", serializer ); + } + if ( model.getCiManagement() != null ) + { + writeCiManagement( model.getCiManagement(), "ciManagement", serializer ); + } + if ( model.getInceptionYear() != null ) + { + serializer.startTag( NAMESPACE, "inceptionYear" ).text( model.getInceptionYear() ) + .endTag( NAMESPACE, "inceptionYear" ); + } + if ( model.getRepositories() != null && model.getRepositories().size() > 0 ) + { + serializer.startTag( NAMESPACE, "repositories" ); + for ( Iterator iter = model.getRepositories().iterator(); iter.hasNext(); ) + { + Repository repository = (Repository) iter.next(); + writeRepository( repository, "repository", serializer ); + } + serializer.endTag( NAMESPACE, "repositories" ); + } + if ( model.getPluginRepositories() != null && model.getPluginRepositories().size() > 0 ) + { + serializer.startTag( NAMESPACE, "pluginRepositories" ); + for ( Iterator iter = model.getPluginRepositories().iterator(); iter.hasNext(); ) + { + Repository repository = (Repository) iter.next(); + writeRepository( repository, "pluginRepository", serializer ); + } + serializer.endTag( NAMESPACE, "pluginRepositories" ); + } + if ( model.getMailingLists() != null && model.getMailingLists().size() > 0 ) + { + serializer.startTag( NAMESPACE, "mailingLists" ); + for ( Iterator iter = model.getMailingLists().iterator(); iter.hasNext(); ) + { + MailingList mailingList = (MailingList) iter.next(); + writeMailingList( mailingList, "mailingList", serializer ); + } + serializer.endTag( NAMESPACE, "mailingLists" ); + } + if ( model.getDevelopers() != null && model.getDevelopers().size() > 0 ) + { + serializer.startTag( NAMESPACE, "developers" ); + for ( Iterator iter = model.getDevelopers().iterator(); iter.hasNext(); ) + { + Developer developer = (Developer) iter.next(); + writeDeveloper( developer, "developer", serializer ); + } + serializer.endTag( NAMESPACE, "developers" ); + } + if ( model.getContributors() != null && model.getContributors().size() > 0 ) + { + serializer.startTag( NAMESPACE, "contributors" ); + for ( Iterator iter = model.getContributors().iterator(); iter.hasNext(); ) + { + Contributor contributor = (Contributor) iter.next(); + writeContributor( contributor, "contributor", serializer ); + } + serializer.endTag( NAMESPACE, "contributors" ); + } + if ( model.getDependencies() != null && model.getDependencies().size() > 0 ) + { + serializer.startTag( NAMESPACE, "dependencies" ); + for ( Iterator iter = model.getDependencies().iterator(); iter.hasNext(); ) + { + Dependency dependency = (Dependency) iter.next(); + writeDependency( dependency, "dependency", serializer ); + } + serializer.endTag( NAMESPACE, "dependencies" ); + } + if ( model.getLicenses() != null && model.getLicenses().size() > 0 ) + { + serializer.startTag( NAMESPACE, "licenses" ); + for ( Iterator iter = model.getLicenses().iterator(); iter.hasNext(); ) + { + License license = (License) iter.next(); + writeLicense( license, "license", serializer ); + } + serializer.endTag( NAMESPACE, "licenses" ); + } + if ( model.getReports() != null ) + { + writeReports( model.getReports(), "reports", serializer ); + } + if ( model.getScm() != null ) + { + writeScm( model.getScm(), "scm", serializer ); + } + if ( model.getBuild() != null ) + { + writeBuild( model.getBuild(), "build", serializer ); + } + if ( model.getOrganization() != null ) + { + writeOrganization( model.getOrganization(), "organization", serializer ); + } + if ( model.getDistributionManagement() != null ) + { + writeDistributionManagement( model.getDistributionManagement(), "distributionManagement", serializer ); + } + if ( model.getDependencyManagement() != null ) + { + writeDependencyManagement( model.getDependencyManagement(), "dependencyManagement", serializer ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writeModel(Model, String, XmlSerializer) + + /** + * Method writeNotifier + * + * @param notifier + * @param serializer + * @param tagName + */ + private void writeNotifier( Notifier notifier, String tagName, XmlSerializer serializer ) throws Exception + { + if ( notifier != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( notifier.getType() != null ) + { + serializer.startTag( NAMESPACE, "type" ).text( notifier.getType() ).endTag( NAMESPACE, "type" ); + } + if ( notifier.getAddress() != null ) + { + serializer.startTag( NAMESPACE, "address" ).text( notifier.getAddress() ).endTag( NAMESPACE, "address" ); + } + if ( notifier.getConfiguration() != null && notifier.getConfiguration().size() > 0 ) + { + serializer.startTag( NAMESPACE, "configuration" ); + for ( Iterator iter = notifier.getConfiguration().keySet().iterator(); iter.hasNext(); ) + { + String key = (String) iter.next(); + String value = (String) notifier.getConfiguration().get( key ); + serializer.startTag( NAMESPACE, "" + key + "" ).text( value ).endTag( NAMESPACE, "" + key + "" ); + } + serializer.endTag( NAMESPACE, "configuration" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writeNotifier(Notifier, String, XmlSerializer) + + /** + * Method writeOrganization + * + * @param organization + * @param serializer + * @param tagName + */ + private void writeOrganization( Organization organization, String tagName, XmlSerializer serializer ) + throws Exception + { + if ( organization != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( organization.getName() != null ) + { + serializer.startTag( NAMESPACE, "name" ).text( organization.getName() ).endTag( NAMESPACE, "name" ); + } + if ( organization.getUrl() != null ) + { + serializer.startTag( NAMESPACE, "url" ).text( organization.getUrl() ).endTag( NAMESPACE, "url" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writeOrganization(Organization, String, XmlSerializer) + + /** + * Method writeParent + * + * @param parent + * @param serializer + * @param tagName + */ + private void writeParent( Parent parent, String tagName, XmlSerializer serializer ) throws Exception + { + if ( parent != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( parent.getArtifactId() != null ) + { + serializer.startTag( NAMESPACE, "artifactId" ).text( parent.getArtifactId() ).endTag( NAMESPACE, + "artifactId" ); + } + if ( parent.getGroupId() != null ) + { + serializer.startTag( NAMESPACE, "groupId" ).text( parent.getGroupId() ).endTag( NAMESPACE, "groupId" ); + } + if ( parent.getVersion() != null ) + { + serializer.startTag( NAMESPACE, "version" ).text( parent.getVersion() ).endTag( NAMESPACE, "version" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writeParent(Parent, String, XmlSerializer) + + /** + * Method writePatternSet + * + * @param patternSet + * @param serializer + * @param tagName + */ + private void writePatternSet( PatternSet patternSet, String tagName, XmlSerializer serializer ) throws Exception + { + if ( patternSet != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( patternSet.getIncludes() != null ) + { + serializer.startTag( NAMESPACE, "includes" ).text( patternSet.getIncludes() ).endTag( NAMESPACE, + "includes" ); + } + if ( patternSet.getExcludes() != null ) + { + serializer.startTag( NAMESPACE, "excludes" ).text( patternSet.getExcludes() ).endTag( NAMESPACE, + "excludes" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writePatternSet(PatternSet, String, XmlSerializer) + + /** + * Method writePlugin + * + * @param plugin + * @param serializer + * @param tagName + */ + private void writePlugin( Plugin plugin, String tagName, XmlSerializer serializer ) throws Exception + { + if ( plugin != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( plugin.getGroupId() != null ) + { + serializer.startTag( NAMESPACE, "groupId" ).text( plugin.getGroupId() ).endTag( NAMESPACE, "groupId" ); + } + if ( plugin.getArtifactId() != null ) + { + serializer.startTag( NAMESPACE, "artifactId" ).text( plugin.getArtifactId() ).endTag( NAMESPACE, + "artifactId" ); + } + if ( plugin.getVersion() != null ) + { + serializer.startTag( NAMESPACE, "version" ).text( plugin.getVersion() ).endTag( NAMESPACE, "version" ); + } + if ( plugin.isDisabled() != null ) + { + serializer.startTag( NAMESPACE, "disabled" ).text( String.valueOf( plugin.isDisabled() ) ) + .endTag( NAMESPACE, "disabled" ); + } + if ( plugin.getConfiguration() != null && plugin.getConfiguration().size() > 0 ) + { + serializer.startTag( NAMESPACE, "configuration" ); + for ( Iterator iter = plugin.getConfiguration().keySet().iterator(); iter.hasNext(); ) + { + String key = (String) iter.next(); + String value = (String) plugin.getConfiguration().get( key ); + serializer.startTag( NAMESPACE, "" + key + "" ).text( value ).endTag( NAMESPACE, "" + key + "" ); + } + serializer.endTag( NAMESPACE, "configuration" ); + } + if ( plugin.getGoals() != null && plugin.getGoals().size() > 0 ) + { + serializer.startTag( NAMESPACE, "goals" ); + for ( Iterator iter = plugin.getGoals().iterator(); iter.hasNext(); ) + { + Goal goal = (Goal) iter.next(); + writeGoal( goal, "goal", serializer ); + } + serializer.endTag( NAMESPACE, "goals" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writePlugin(Plugin, String, XmlSerializer) + + /** + * Method writePluginManagement + * + * @param pluginManagement + * @param serializer + * @param tagName + */ + private void writePluginManagement( PluginManagement pluginManagement, String tagName, XmlSerializer serializer ) + throws Exception + { + if ( pluginManagement != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( pluginManagement.getPlugins() != null && pluginManagement.getPlugins().size() > 0 ) + { + serializer.startTag( NAMESPACE, "plugins" ); + for ( Iterator iter = pluginManagement.getPlugins().iterator(); iter.hasNext(); ) + { + Plugin plugin = (Plugin) iter.next(); + writePlugin( plugin, "plugin", serializer ); + } + serializer.endTag( NAMESPACE, "plugins" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writePluginManagement(PluginManagement, String, XmlSerializer) + + /** + * Method writeReports + * + * @param reports + * @param serializer + * @param tagName + */ + private void writeReports( Reports reports, String tagName, XmlSerializer serializer ) throws Exception + { + if ( reports != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( reports.getOutputDirectory() != null ) + { + serializer.startTag( NAMESPACE, "outputDirectory" ).text( reports.getOutputDirectory() ) + .endTag( NAMESPACE, "outputDirectory" ); + } + if ( reports.getPlugins() != null && reports.getPlugins().size() > 0 ) + { + serializer.startTag( NAMESPACE, "plugins" ); + for ( Iterator iter = reports.getPlugins().iterator(); iter.hasNext(); ) + { + Plugin plugin = (Plugin) iter.next(); + writePlugin( plugin, "plugin", serializer ); + } + serializer.endTag( NAMESPACE, "plugins" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writeReports(Reports, String, XmlSerializer) + + /** + * Method writeRepository + * + * @param repository + * @param serializer + * @param tagName + */ + private void writeRepository( Repository repository, String tagName, XmlSerializer serializer ) throws Exception + { + if ( repository != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( repository.getId() != null ) + { + serializer.startTag( NAMESPACE, "id" ).text( repository.getId() ).endTag( NAMESPACE, "id" ); + } + if ( repository.getName() != null ) + { + serializer.startTag( NAMESPACE, "name" ).text( repository.getName() ).endTag( NAMESPACE, "name" ); + } + if ( repository.getUrl() != null ) + { + serializer.startTag( NAMESPACE, "url" ).text( repository.getUrl() ).endTag( NAMESPACE, "url" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writeRepository(Repository, String, XmlSerializer) + + /** + * Method writeResource + * + * @param resource + * @param serializer + * @param tagName + */ + private void writeResource( Resource resource, String tagName, XmlSerializer serializer ) throws Exception + { + if ( resource != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( resource.getTargetPath() != null ) + { + serializer.startTag( NAMESPACE, "targetPath" ).text( resource.getTargetPath() ).endTag( NAMESPACE, + "targetPath" ); + } + if ( resource.getDirectory() != null ) + { + serializer.startTag( NAMESPACE, "directory" ).text( resource.getDirectory() ).endTag( NAMESPACE, + "directory" ); + } + if ( resource.getIncludes() != null ) + { + serializer.startTag( NAMESPACE, "includes" ).text( resource.getIncludes() ).endTag( NAMESPACE, + "includes" ); + } + if ( resource.getExcludes() != null ) + { + serializer.startTag( NAMESPACE, "excludes" ).text( resource.getExcludes() ).endTag( NAMESPACE, + "excludes" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writeResource(Resource, String, XmlSerializer) + + /** + * Method writeScm + * + * @param scm + * @param serializer + * @param tagName + */ + private void writeScm( Scm scm, String tagName, XmlSerializer serializer ) throws Exception + { + if ( scm != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( scm.getConnection() != null ) + { + serializer.startTag( NAMESPACE, "connection" ).text( scm.getConnection() ).endTag( NAMESPACE, + "connection" ); + } + if ( scm.getDeveloperConnection() != null ) + { + serializer.startTag( NAMESPACE, "developerConnection" ).text( scm.getDeveloperConnection() ) + .endTag( NAMESPACE, "developerConnection" ); + } + if ( scm.getUrl() != null ) + { + serializer.startTag( NAMESPACE, "url" ).text( scm.getUrl() ).endTag( NAMESPACE, "url" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writeScm(Scm, String, XmlSerializer) + + /** + * Method writeSite + * + * @param site + * @param serializer + * @param tagName + */ + private void writeSite( Site site, String tagName, XmlSerializer serializer ) throws Exception + { + if ( site != null ) + { + serializer.startTag( NAMESPACE, tagName ); + if ( site.getId() != null ) + { + serializer.startTag( NAMESPACE, "id" ).text( site.getId() ).endTag( NAMESPACE, "id" ); + } + if ( site.getName() != null ) + { + serializer.startTag( NAMESPACE, "name" ).text( site.getName() ).endTag( NAMESPACE, "name" ); + } + if ( site.getUrl() != null ) + { + serializer.startTag( NAMESPACE, "url" ).text( site.getUrl() ).endTag( NAMESPACE, "url" ); + } + serializer.endTag( NAMESPACE, tagName ); + } + } //-- void writeSite(Site, String, XmlSerializer) + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/Main.java b/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/Main.java new file mode 100644 index 0000000000..ad740c06ce --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/Main.java @@ -0,0 +1,78 @@ +package org.apache.maven.tools.repoclean; + +/* ==================================================================== + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ==================================================================== + */ + +import org.codehaus.classworlds.ClassWorld; +import org.codehaus.plexus.embed.Embedder; + +/** + * @author jdcasey + */ +public class Main +{ + + public static void main( String[] inputArgs ) + { + Embedder embedder = new Embedder(); + try + { + embedder.start( new ClassWorld() ); + + String[] args = inputArgs; + + if ( args.length < 2 ) + { + printUsage(); + System.exit( 0 ); + } + + boolean reportOnly = false; + if ( args.length > 2 ) + { + reportOnly = Boolean.valueOf( args[2] ).booleanValue(); + } + + RepositoryCleaner cleaner = null; + try + { + cleaner = (RepositoryCleaner) embedder.lookup( RepositoryCleaner.ROLE ); + + cleaner.cleanRepository( args[0], args[1], reportOnly ); + } + finally + { + if ( cleaner != null ) + { + embedder.release( cleaner ); + } + } + } + catch ( Exception e ) + { + e.printStackTrace(); + } + } + + private static void printUsage() + { + System.out.println( "No repository directory specified.\n\n" + "Usage:\n" + + "--------------------------------------------------\n\n" + + "repoclean []\n" ); + } + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/RepositoryCleaner.java b/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/RepositoryCleaner.java new file mode 100644 index 0000000000..caa51c7846 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/RepositoryCleaner.java @@ -0,0 +1,249 @@ +package org.apache.maven.tools.repoclean; + +/* ==================================================================== + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ==================================================================== + */ + +import org.apache.maven.tools.repoclean.correlate.ArtifactMd5Correlator; +import org.apache.maven.tools.repoclean.correlate.ArtifactPomCorrelator; +import org.apache.maven.tools.repoclean.patch.V4ModelPatcher; +import org.apache.maven.tools.repoclean.pom.PomV3ToV4Translator; +import org.apache.maven.tools.repoclean.report.Reporter; +import org.apache.maven.tools.repoclean.validate.V4ModelIndependenceValidator; +import org.codehaus.plexus.logging.AbstractLogEnabled; +import org.codehaus.plexus.logging.Logger; +import org.codehaus.plexus.util.DirectoryScanner; +import org.codehaus.plexus.util.IOUtil; + +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; + +/** + * @author jdcasey + */ +public class RepositoryCleaner + extends AbstractLogEnabled +{ + + public static final String ROLE = RepositoryCleaner.class.getName(); + + private ArtifactPomCorrelator artifactPomCorrelator; + + private ArtifactMd5Correlator artifactMd5Correlator; + + private PomV3ToV4Translator pomV3ToV4Translator; + + private V4ModelIndependenceValidator v4ModelIndependenceValidator; + + private V4ModelPatcher v4ModelPatcher; + + public void cleanRepository( String repositoryPath, String reportsDir, boolean reportOnly ) + { + Logger logger = getLogger(); + + File reportsBase = new File( reportsDir ); + if ( !reportsBase.exists() ) + { + logger.info( "Creating reports directory: \'" + reportsDir + "\'" ); + reportsBase.mkdirs(); + } + else if ( !reportsBase.isDirectory() ) + { + logger.error( "Cannot write reports to \'" + reportsDir + "\' because it is not a directory." ); + + reportsBase = null; + } + + File repositoryBase = new File( repositoryPath ); + if ( !repositoryBase.exists() ) + { + logger.error( "Cannot clean repository \'" + repositoryPath + "\' because it does not exist." ); + + repositoryBase = null; + } + else if ( !repositoryBase.isDirectory() ) + { + logger.error( "Cannot clean repository \'" + repositoryPath + "\' because it is not a directory." ); + + repositoryBase = null; + } + + // do not proceed if we cannot produce reports, or if the repository is + // invalid. + if ( reportsBase != null && repositoryBase != null ) + { + logger.info( "Scanning for POMs." ); + String[] poms = scanPoms( repositoryPath ); + + logger.info( "Scanning for artifacts." ); + String[] artifacts = scanArtifacts( repositoryPath ); + + Reporter repoReporter = new Reporter( reportsBase, "repository.report.txt" ); + + logger.info( "Correlating artifacts to POMs." ); + artifactPomCorrelator.correlateArtifactsToPoms( poms, artifacts, repoReporter ); + + logger.info( "Correlating artifacts to MD5 digest files." ); + artifactMd5Correlator.correlateArtifactsToMd5( repositoryBase, artifacts, repoReporter, reportOnly ); + + logger.info( "Translating POMs to V4 format." ); + for ( int i = 0; i < poms.length; i++ ) + { + String pom = poms[i]; + + Reporter pomReporter = new Reporter( reportsBase, pom + ".report.txt" ); + + logger.info( "Reading POM: \'" + pom + "\'" ); + org.apache.maven.model.v3_0_0.Model v3Model = null; + try + { + v3Model = readV3( repositoryBase, pom ); + } + catch ( Exception e ) + { + logger.error( "Error reading POM: \'" + pom + "\'", e ); + } + + if ( v3Model != null ) + { + logger.info( "Translating POM: \'" + pom + "\'" ); + org.apache.maven.model.v4_0_0.Model v4Model = pomV3ToV4Translator.translate( v3Model, pomReporter ); + + logger.info( "Performing validation on resulting v4 model for POM: \'" + pom + "\'" ); + boolean isValid = v4ModelIndependenceValidator.validate( v4Model, pomReporter, true ); + + if ( !isValid ) + { + logger.info( "Patching v4 model for POM: \'" + pom + "\' using information glean from path." ); + v4ModelPatcher.patchModel( v4Model, pom, pomReporter ); + + logger.info( "Re-performing validation on patched v4 model for POM: \'" + pom + "\'" ); + isValid = v4ModelIndependenceValidator.validate( v4Model, pomReporter, false ); + } + + if ( pomReporter.hasError() ) + { + repoReporter.warn( "Translation of POM: \'" + pom + "\' encountered errors." ); + } + + if ( !reportOnly ) + { + logger.info( "Writing POM: \'" + pom + "\'" ); + + try + { + writeV4( repositoryBase, pom, v4Model ); + } + catch ( Exception e ) + { + logger.error( "Error writing POM: \'" + pom + "\'", e ); + } + } + else + { + logger.info( "NOT writing POM: \'" + pom + "\'; we are in report-only mode." ); + } + } + else + { + pomReporter.error( "Cannot translate pom. V3 model is null." ); + } + + try + { + pomReporter.writeReport(); + } + catch ( IOException e ) + { + logger.error( "Error writing report for POM: \'" + pom + "\'", e ); + } + } + + try + { + repoReporter.writeReport(); + } + catch ( IOException e ) + { + logger.error( "Error writing report for repository", e ); + } + } + } + + private void writeV4( File repositoryBase, String pom, org.apache.maven.model.v4_0_0.Model model ) throws Exception + { + FileWriter writer = null; + try + { + File pomFile = new File( repositoryBase, pom ); + writer = new FileWriter( pomFile ); + + org.apache.maven.model.v4_0_0.io.xpp3.MavenXpp3Writer modelWriter = new org.apache.maven.model.v4_0_0.io.xpp3.MavenXpp3Writer(); + + modelWriter.write( writer, model ); + } + finally + { + IOUtil.close( writer ); + } + } + + private org.apache.maven.model.v3_0_0.Model readV3( File repositoryBase, String pom ) throws Exception + { + org.apache.maven.model.v3_0_0.Model model = null; + + FileReader reader = null; + try + { + File pomFile = new File( repositoryBase, pom ); + reader = new FileReader( pomFile ); + + org.apache.maven.model.v3_0_0.io.xpp3.MavenXpp3Reader modelReader = new org.apache.maven.model.v3_0_0.io.xpp3.MavenXpp3Reader(); + model = modelReader.read( reader ); + } + finally + { + IOUtil.close( reader ); + } + + return model; + } + + private String[] scanPoms( String repositoryPath ) + { + DirectoryScanner scanner = new DirectoryScanner(); + scanner.setBasedir( repositoryPath ); + scanner.setIncludes( new String[] { "**/poms/*.pom" } ); + + scanner.scan(); + + return scanner.getIncludedFiles(); + } + + private String[] scanArtifacts( String repositoryPath ) + { + DirectoryScanner scanner = new DirectoryScanner(); + scanner.setBasedir( repositoryPath ); + scanner.setExcludes( new String[] { "**/poms/*.pom", "**/*.md5" } ); + + scanner.scan(); + + return scanner.getIncludedFiles(); + } + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/correlate/ArtifactMd5Correlator.java b/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/correlate/ArtifactMd5Correlator.java new file mode 100644 index 0000000000..29a9ba0991 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/correlate/ArtifactMd5Correlator.java @@ -0,0 +1,89 @@ +package org.apache.maven.tools.repoclean.correlate; + +/* ==================================================================== + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ==================================================================== + */ + +import org.apache.maven.tools.repoclean.digest.ArtifactDigestException; +import org.apache.maven.tools.repoclean.digest.ArtifactDigestor; +import org.apache.maven.tools.repoclean.report.Reporter; +import org.codehaus.plexus.util.DirectoryScanner; + +import java.io.File; +import java.util.Arrays; +import java.util.List; + +/** + * @author jdcasey + */ +public class ArtifactMd5Correlator +{ + + public static final String ROLE = ArtifactMd5Correlator.class.getName(); + + private ArtifactDigestor artifactDigestor; + + public void correlateArtifactsToMd5( File repositoryBase, String[] artifacts, Reporter reporter, boolean reportOnly ) + { + reporter.info( "Starting artifact-to-MD5 correlation." ); + + List md5s = scanMd5s( repositoryBase ); + + for ( int i = 0; i < artifacts.length; i++ ) + { + String artifact = artifacts[i]; + + String md5 = artifact + ".md5"; + + if ( !md5s.contains( md5 ) ) + { + reporter.warn( "Cannot find digest file for artifact: \'" + artifact + "\'." ); + + if ( !reportOnly ) + { + reporter.info( "Creating digest file: \'" + md5 + "\'" ); + + File artifactFile = new File( repositoryBase, artifact ); + File md5File = new File( repositoryBase, md5 ); + try + { + artifactDigestor.createArtifactDigest( artifactFile, md5File, ArtifactDigestor.MD5 ); + } + catch ( ArtifactDigestException e ) + { + reporter.error( "Error creating digest for artifact: \'" + artifact + "\'", e ); + } + } + } + } + + reporter.info( "Finished artifact-to-MD5 correlation." ); + } + + private List scanMd5s( File repositoryBase ) + { + DirectoryScanner scanner = new DirectoryScanner(); + scanner.setBasedir( repositoryBase ); + scanner.setIncludes( new String[] { "**/*.md5" } ); + + scanner.scan(); + + String[] md5s = scanner.getIncludedFiles(); + + return Arrays.asList( md5s ); + } + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/correlate/ArtifactPomCorrelator.java b/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/correlate/ArtifactPomCorrelator.java new file mode 100644 index 0000000000..13557cb239 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/correlate/ArtifactPomCorrelator.java @@ -0,0 +1,85 @@ +package org.apache.maven.tools.repoclean.correlate; + +/* ==================================================================== + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ==================================================================== + */ + +import org.apache.maven.tools.repoclean.report.Reporter; + +import java.util.Map; +import java.util.TreeMap; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * @author jdcasey + */ +public class ArtifactPomCorrelator +{ + + public static final String ROLE = ArtifactPomCorrelator.class.getName(); + + public void correlateArtifactsToPoms( String[] poms, String[] artifacts, Reporter reporter ) + { + reporter.info( "Starting artifact-to-POM correlation." ); + + Map pomMap = new TreeMap(); + for ( int i = 0; i < poms.length; i++ ) + { + String key = keyOf( poms[i] ); + + if ( key == null ) + { + reporter.error( "Found POM with invalid name: \'" + poms[i] + "\'" ); + } + else + { + pomMap.put( key, poms[i] ); + } + } + + for ( int i = 0; i < artifacts.length; i++ ) + { + String key = keyOf( artifacts[i] ); + + if ( key == null ) + { + reporter.error( "Found artifact with invalid name: \'" + artifacts[i] + "\'" ); + } + else if ( !pomMap.containsKey( key ) ) + { + reporter.error( "Cannot find POM for artifact: \'" + artifacts[i] + "\'" ); + } + } + + reporter.info( "Finished artifact-to-POM correlation." ); + } + + private String keyOf( String artifact ) + { + Pattern keyPattern = Pattern.compile( "(.+)\\.(jar|pom)" ); + Matcher matcher = keyPattern.matcher( artifact ); + + String key = null; + if ( matcher.matches() ) + { + key = matcher.group( 1 ); + } + + return key; + } + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/digest/ArtifactDigestException.java b/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/digest/ArtifactDigestException.java new file mode 100644 index 0000000000..2d1570b0f1 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/digest/ArtifactDigestException.java @@ -0,0 +1,37 @@ +package org.apache.maven.tools.repoclean.digest; + +/* ==================================================================== + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ==================================================================== + */ + +/** + * @author jdcasey + */ +public class ArtifactDigestException + extends Exception +{ + + public ArtifactDigestException( String message ) + { + super( message ); + } + + public ArtifactDigestException( String message, Throwable cause ) + { + super( message, cause ); + } + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/digest/ArtifactDigestor.java b/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/digest/ArtifactDigestor.java new file mode 100644 index 0000000000..400eabb1b0 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/digest/ArtifactDigestor.java @@ -0,0 +1,100 @@ +/* Created on Sep 20, 2004 */ +package org.apache.maven.tools.repoclean.digest; + +import org.codehaus.plexus.util.IOUtil; + +import java.io.BufferedInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +/** + * @author jdcasey + */ +public class ArtifactDigestor +{ + + public static final String ROLE = ArtifactDigestor.class.getName(); + + public static final String MD5 = "MD5"; + + public static final String SHA = "SHA"; + + public void createArtifactDigest( File artifactFile, File digestFile, String algorithm ) + throws ArtifactDigestException + { + byte[] data = null; + try + { + data = readArtifactFile( artifactFile ); + } + catch ( IOException e ) + { + throw new ArtifactDigestException( "Error reading artifact data from: \'" + artifactFile + "\'", e ); + } + + MessageDigest digest = null; + try + { + digest = MessageDigest.getInstance( algorithm ); + } + catch ( NoSuchAlgorithmException e ) + { + throw new ArtifactDigestException( "Cannot load digest algoritm provider.", e ); + } + + digest.update( data ); + byte[] digestData = digest.digest(); + + try + { + writeDigestFile( digestFile, digestData ); + } + catch ( IOException e ) + { + throw new ArtifactDigestException( "Cannot write digest to file: \'" + digestFile + "\'", e ); + } + } + + private void writeDigestFile( File digestFile, byte[] digestData ) throws IOException + { + FileOutputStream out = null; + try + { + out = new FileOutputStream( digestFile ); + out.write( digestData ); + out.flush(); + } + finally + { + IOUtil.close( out ); + } + } + + private byte[] readArtifactFile( File artifactFile ) throws IOException + { + BufferedInputStream in = null; + try + { + in = new BufferedInputStream( new FileInputStream( artifactFile ) ); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + + byte[] buffer = new byte[16]; + int read = -1; + while ( ( read = in.read( buffer ) ) > -1 ) + { + baos.write( buffer, 0, read ); + } + + return baos.toByteArray(); + } + finally + { + IOUtil.close( in ); + } + } +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/patch/V4ModelPatcher.java b/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/patch/V4ModelPatcher.java new file mode 100644 index 0000000000..e9dd339964 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/patch/V4ModelPatcher.java @@ -0,0 +1,72 @@ +package org.apache.maven.tools.repoclean.patch; + +import org.apache.maven.model.v4_0_0.Model; +import org.apache.maven.tools.repoclean.report.Reporter; +import org.codehaus.plexus.util.StringUtils; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/* ==================================================================== + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ==================================================================== + */ + +/** + * @author jdcasey + */ +public class V4ModelPatcher +{ + + public static final String ROLE = V4ModelPatcher.class.getName(); + + public void patchModel( Model model, String pomPath, Reporter reporter ) + { + // TODO: Need to add more test scenarios to the unit test for this pattern. + // I'm not convinced that this will catch everything. + Pattern pathInfoPattern = Pattern.compile( "(.+)\\/poms\\/([-a-zA-Z0-9]+)-([0-9]+[-.0-9a-zA-Z]+).pom" ); + + Matcher matcher = pathInfoPattern.matcher( pomPath ); + if ( !matcher.matches() ) + { + reporter.info( "POM path: \'" + pomPath + + "\' does not match naming convention. Cannot reliably patch model information from POM path." ); + } + + String parsedGroup = matcher.group( 1 ); + String parsedArtifact = matcher.group( 2 ); + String parsedVersion = matcher.group( 3 ); + + if ( StringUtils.isEmpty( model.getGroupId() ) ) + { + reporter.info( "Patching missing Group Id with parsed data: \'" + parsedGroup + "\'" ); + model.setGroupId( parsedGroup ); + } + + if ( StringUtils.isEmpty( model.getArtifactId() ) ) + { + reporter.info( "Patching missing Artifact Id with parsed data: \'" + parsedArtifact + "\'" ); + model.setArtifactId( parsedArtifact ); + } + + if ( StringUtils.isEmpty( model.getVersion() ) ) + { + reporter.info( "Patching missing Version with parsed data: \'" + parsedVersion + "\'" ); + model.setVersion( parsedVersion ); + } + + } + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/pom/PomTranslationException.java b/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/pom/PomTranslationException.java new file mode 100644 index 0000000000..f06f2526be --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/pom/PomTranslationException.java @@ -0,0 +1,50 @@ +package org.apache.maven.tools.repoclean.pom; + +/* ==================================================================== + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ==================================================================== + */ + +/** + * @author jdcasey + */ +public class PomTranslationException + extends Exception +{ + + private final String groupId; + + private final String artifactId; + + private final String version; + + public PomTranslationException( String groupId, String artifactId, String version, String message ) + { + this( groupId, artifactId, version, message, null ); + } + + public PomTranslationException( String groupId, String artifactId, String version, Throwable cause ) + { + this( groupId, artifactId, version, "[No message provided.]", cause ); + } + + public PomTranslationException( String groupId, String artifactId, String version, String message, Throwable cause ) + { + super( "In POM{" + groupId + ":" + artifactId + ":" + version + "}: " + message, cause ); + this.groupId = groupId; + this.artifactId = artifactId; + this.version = version; + } +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/pom/PomV3ToV4Translator.java b/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/pom/PomV3ToV4Translator.java new file mode 100644 index 0000000000..2ac0e06a9f --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/pom/PomV3ToV4Translator.java @@ -0,0 +1,688 @@ +package org.apache.maven.tools.repoclean.pom; + +import org.apache.maven.model.v4_0_0.Build; +import org.apache.maven.model.v4_0_0.CiManagement; +import org.apache.maven.model.v4_0_0.Contributor; +import org.apache.maven.model.v4_0_0.Dependency; +import org.apache.maven.model.v4_0_0.Developer; +import org.apache.maven.model.v4_0_0.DistributionManagement; +import org.apache.maven.model.v4_0_0.Goal; +import org.apache.maven.model.v4_0_0.IssueManagement; +import org.apache.maven.model.v4_0_0.License; +import org.apache.maven.model.v4_0_0.MailingList; +import org.apache.maven.model.v4_0_0.Model; +import org.apache.maven.model.v4_0_0.Notifier; +import org.apache.maven.model.v4_0_0.Organization; +import org.apache.maven.model.v4_0_0.Plugin; +import org.apache.maven.model.v4_0_0.Reports; +import org.apache.maven.model.v4_0_0.Repository; +import org.apache.maven.model.v4_0_0.Resource; +import org.apache.maven.model.v4_0_0.Scm; +import org.apache.maven.model.v4_0_0.Site; +import org.apache.maven.tools.repoclean.report.Reporter; +import org.codehaus.plexus.logging.AbstractLogEnabled; +import org.codehaus.plexus.util.StringUtils; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Properties; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/* ==================================================================== + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ==================================================================== + */ + +/** + * @author jdcasey + */ +public class PomV3ToV4Translator + extends AbstractLogEnabled +{ + + public static final String ROLE = PomV3ToV4Translator.class.getName(); + + public Model translate( org.apache.maven.model.v3_0_0.Model v3Model, Reporter reporter ) + { + String groupId = v3Model.getGroupId(); + String artifactId = v3Model.getArtifactId(); + + String id = v3Model.getId(); + if ( StringUtils.isNotEmpty( id ) ) + { + if ( StringUtils.isEmpty( groupId ) ) + { + groupId = id; + } + + if ( StringUtils.isEmpty( artifactId ) ) + { + artifactId = id; + } + } + + String version = v3Model.getCurrentVersion(); + if ( version == null ) + { + version = v3Model.getVersion(); + } + + PomKey pomKey = new PomKey( groupId, artifactId, version ); + + StringBuffer logHeader = new StringBuffer(); + logHeader.append( "Translation of POM {" ).append( v3Model.getGroupId() ).append( ":" ) + .append( v3Model.getArtifactId() ).append( ":" ).append( version ).append( "}\n" ); + + reporter.info( "[START] " + logHeader.toString() ); + + warnOfUnsupportedMainModelElements( v3Model, reporter ); + + Model model = null; + try + { + model = new Model(); + model.setArtifactId( v3Model.getArtifactId() ); + model.setBuild( translateBuild( v3Model.getBuild(), reporter ) ); + model.setCiManagement( translateCiManagementInfo( v3Model.getBuild() ) ); + model.setContributors( translateContributors( v3Model.getContributors() ) ); + + model.setDependencies( translateDependencies( v3Model.getDependencies() ) ); + model.setDescription( v3Model.getDescription() ); + model.setDevelopers( translateDevelopers( v3Model.getDevelopers() ) ); + + model.setDistributionManagement( translateDistributionManagement( pomKey, v3Model ) ); + + model.setGroupId( v3Model.getGroupId() ); + model.setInceptionYear( v3Model.getInceptionYear() ); + model.setIssueManagement( translateIssueManagement( v3Model ) ); + + model.setLicenses( translateLicenses( v3Model.getLicenses() ) ); + model.setMailingLists( translateMailingLists( v3Model.getMailingLists() ) ); + model.setModelVersion( "4.0.0" ); + model.setName( v3Model.getName() ); + model.setOrganization( translateOrganization( v3Model.getOrganization(), reporter ) ); + model.setPackaging( "jar" ); + model.setReports( translateReports( v3Model.getReports(), reporter ) ); + model.setScm( translateScm( v3Model ) ); + model.setUrl( v3Model.getUrl() ); + + model.setVersion( version ); + + reporter.info( "[END] " + logHeader.toString() ); + } + catch ( PomTranslationException e ) + { + reporter.error( "Invalid POM detected. Cannot translate.", e ); + } + + return model; + } + + private CiManagement translateCiManagementInfo( org.apache.maven.model.v3_0_0.Build v3Build ) + { + CiManagement ciMgmt = null; + + if ( v3Build != null ) + { + String nagEmailAddress = v3Build.getNagEmailAddress(); + + if ( StringUtils.isNotEmpty( nagEmailAddress ) ) + { + Notifier notifier = new Notifier(); + + notifier.setAddress( nagEmailAddress ); + notifier.setType( "email" ); + + ciMgmt = new CiManagement(); + ciMgmt.addNotifier( notifier ); + } + } + + return ciMgmt; + } + + private void warnOfUnsupportedMainModelElements( org.apache.maven.model.v3_0_0.Model v3Model, Reporter reporter ) + { + if ( StringUtils.isNotEmpty( v3Model.getExtend() ) ) + { + reporter.warn( "Ignoring non-portable parent declaration: " + v3Model.getExtend() ); + } + + if ( StringUtils.isNotEmpty( v3Model.getGumpRepositoryId() ) ) + { + reporter.warn( "Ignoring gump repository id: \'" + v3Model.getGumpRepositoryId() + + "\'. This is not supported in v4 POMs." ); + } + + if ( notEmpty( v3Model.getVersions() ) ) + { + reporter.warn( "Ignoring section. This is not supported in v4 POMs." ); + } + + if ( notEmpty( v3Model.getBranches() ) ) + { + reporter.warn( "Ignoring section. This is not supported in v4 POMs." ); + } + + Properties v3ModelProperties = v3Model.getProperties(); + + if ( v3ModelProperties != null && !v3ModelProperties.isEmpty() ) + { + reporter.warn( "Ignoring section. It is not supported in v4 POMs." ); + } + + if ( StringUtils.isNotEmpty( v3Model.getPackage() ) ) + { + reporter.warn( "Ignoring . It is not supported in v4 POMs." ); + } + + if ( notEmpty( v3Model.getPackageGroups() ) ) + { + reporter.warn( "Ignoring section. It is not supported in v4 POMs." ); + } + + if ( StringUtils.isNotEmpty( v3Model.getLogo() ) ) + { + reporter.warn( "Ignoring for project. It is not supported in v4 POMs." ); + } + + if ( StringUtils.isNotEmpty( v3Model.getShortDescription() ) ) + { + reporter.warn( "Ignoring . It is not supported in v4 POMs." ); + } + } + + private Scm translateScm( org.apache.maven.model.v3_0_0.Model v3Model ) + { + Scm scm = null; + + org.apache.maven.model.v3_0_0.Repository repo = v3Model.getRepository(); + if ( repo != null ) + { + scm = new Scm(); + scm.setConnection( repo.getConnection() ); + scm.setDeveloperConnection( repo.getDeveloperConnection() ); + scm.setUrl( repo.getUrl() ); + } + + return scm; + } + + private Reports translateReports( List v3Reports, Reporter reporter ) + { + Reports reports = null; + if ( v3Reports != null && !v3Reports.isEmpty() ) + { + reports = new Reports(); + for ( Iterator it = v3Reports.iterator(); it.hasNext(); ) + { + String reportName = (String) it.next(); + + Pattern pluginNamePattern = Pattern.compile( "maven-(.+)-plugin" ); + Matcher matcher = pluginNamePattern.matcher( reportName ); + + String reportPluginName = null; + if ( !matcher.matches() ) + { + reporter.warn( "Non-standard report name: \'" + reportName + + "\'. Using entire name for plugin artifactId." ); + + reportPluginName = reportName; + } + else + { + reportPluginName = matcher.group( 1 ); + } + + Plugin reportPlugin = new Plugin(); + + reportPlugin.setGroupId( "maven" ); + + reportPlugin.setArtifactId( reportPluginName ); + + reportPlugin.setVersion( "1.0-SNAPSHOT" ); + + StringBuffer info = new StringBuffer(); + + info.append( "Using some contrived information for report: \'" ).append( reportName ).append( "\'.\n" ) + .append( "\to groupId: \'maven\'\n" ).append( "\to artifactId: \'" ).append( reportPluginName ) + .append( "\'\n" ).append( "\to version: \'1.0-SNAPSHOT\'\n" ).append( "\to goal: \'report\'\n" ) + .append( "\n" ) + .append( "These values were extracted using the v3 report naming convention, but may be wrong." ); + + reporter.info( info.toString() ); + + Goal reportGoal = new Goal(); + + reportGoal.setId( "report" ); + + reportPlugin.addGoal( reportGoal ); + + reports.addPlugin( reportPlugin ); + } + } + + return reports; + } + + private org.apache.maven.model.v4_0_0.Organization translateOrganization( + org.apache.maven.model.v3_0_0.Organization v3Organization, + Reporter reporter ) + { + Organization organization = null; + + if ( v3Organization != null ) + { + organization = new Organization(); + + organization.setName( v3Organization.getName() ); + organization.setUrl( v3Organization.getUrl() ); + + if ( StringUtils.isNotEmpty( v3Organization.getLogo() ) ) + { + reporter.warn( "Ignoring . It is not supported in v4 POMs." ); + } + } + + return organization; + } + + private List translateMailingLists( List v3MailingLists ) + { + List mailingLists = new ArrayList(); + + if ( notEmpty( v3MailingLists ) ) + { + for ( Iterator it = v3MailingLists.iterator(); it.hasNext(); ) + { + org.apache.maven.model.v3_0_0.MailingList v3List = (org.apache.maven.model.v3_0_0.MailingList) it + .next(); + MailingList list = new MailingList(); + list.setArchive( v3List.getArchive() ); + list.setName( v3List.getName() ); + list.setSubscribe( v3List.getSubscribe() ); + list.setUnsubscribe( v3List.getUnsubscribe() ); + + mailingLists.add( list ); + } + } + + return mailingLists; + } + + private List translateLicenses( List v3Licenses ) + { + List licenses = new ArrayList(); + + if ( notEmpty( v3Licenses ) ) + { + for ( Iterator it = v3Licenses.iterator(); it.hasNext(); ) + { + org.apache.maven.model.v3_0_0.License v3License = (org.apache.maven.model.v3_0_0.License) it.next(); + License license = new License(); + license.setComments( v3License.getComments() ); + license.setName( v3License.getName() ); + license.setUrl( v3License.getUrl() ); + + licenses.add( license ); + } + } + + return licenses; + } + + private IssueManagement translateIssueManagement( org.apache.maven.model.v3_0_0.Model v3Model ) + { + IssueManagement issueMgmt = null; + + String issueTrackingUrl = v3Model.getIssueTrackingUrl(); + if ( StringUtils.isNotEmpty( issueTrackingUrl ) ) + { + issueMgmt = new IssueManagement(); + issueMgmt.setUrl( issueTrackingUrl ); + } + + return issueMgmt; + } + + private DistributionManagement translateDistributionManagement( PomKey pomKey, + org.apache.maven.model.v3_0_0.Model v3Model ) + throws PomTranslationException + { + DistributionManagement distributionManagement = new DistributionManagement(); + + Site site = null; + + String siteAddress = v3Model.getSiteAddress(); + + String siteDirectory = v3Model.getSiteDirectory(); + + if ( StringUtils.isEmpty( siteAddress ) ) + { + if ( !StringUtils.isEmpty( siteDirectory ) ) + { + site = new Site(); + + site.setId( "default" ); + + site.setName( "Default Site" ); + + site.setUrl( "file://" + siteDirectory ); + } + } + else + { + if ( StringUtils.isEmpty( siteDirectory ) ) + { + throw new PomTranslationException( pomKey.groupId(), pomKey.artifactId(), pomKey.version(), + "Missing 'siteDirectory': Both siteAddress and siteDirectory must be set at the same time." ); + } + + site = new Site(); + + site.setId( "default" ); + + site.setName( "Default Site" ); + + site.setUrl( "scp://" + siteAddress + "/" + siteDirectory ); + } + + distributionManagement.setSite( site ); + + String distributionSite = v3Model.getDistributionSite(); + + String distributionDirectory = v3Model.getDistributionDirectory(); + + Repository repository = null; + + if ( StringUtils.isEmpty( distributionSite ) ) + { + if ( !StringUtils.isEmpty( distributionDirectory ) ) + { + repository = new Repository(); + + repository.setId( "default" ); + + repository.setName( "Default Repository" ); + + repository.setUrl( "file://" + distributionDirectory ); + // throw new Exception( "Missing 'distributionSite': Both distributionSite and distributionDirectory must be set." ); + } + } + else + { + if ( StringUtils.isEmpty( distributionDirectory ) ) + { + throw new PomTranslationException( pomKey.groupId(), pomKey.artifactId(), pomKey.version(), + "Missing 'distributionDirectory': must be set is 'distributionSite' is set." ); + } + + repository = new Repository(); + + repository.setId( "default" ); + + repository.setName( "Default Repository" ); + + repository.setUrl( distributionSite + "/" + distributionDirectory ); + } + + distributionManagement.setRepository( repository ); + + if ( site == null && repository == null ) + { + return null; + } + + return distributionManagement; + } + + private List translateDevelopers( List v3Developers ) + { + List developers = new ArrayList(); + + if ( notEmpty( v3Developers ) ) + { + for ( Iterator it = v3Developers.iterator(); it.hasNext(); ) + { + org.apache.maven.model.v3_0_0.Developer v3Developer = (org.apache.maven.model.v3_0_0.Developer) it + .next(); + + Developer developer = new Developer(); + + developer.setEmail( v3Developer.getEmail() ); + developer.setId( v3Developer.getId() ); + developer.setName( v3Developer.getName() ); + developer.setOrganization( v3Developer.getOrganization() ); + developer.setRoles( v3Developer.getRoles() ); + developer.setTimezone( v3Developer.getTimezone() ); + developer.setUrl( v3Developer.getUrl() ); + + developers.add( developer ); + } + } + + return developers; + } + + private List translateDependencies( List v3Deps ) + { + List deps = new ArrayList(); + + if ( notEmpty( v3Deps ) ) + { + for ( Iterator it = v3Deps.iterator(); it.hasNext(); ) + { + org.apache.maven.model.v3_0_0.Dependency v3Dep = (org.apache.maven.model.v3_0_0.Dependency) it.next(); + + Dependency dep = new Dependency(); + + dep.setArtifactId( v3Dep.getArtifactId() ); + dep.setGroupId( v3Dep.getGroupId() ); + dep.setVersion( v3Dep.getVersion() ); + dep.setType( v3Dep.getType() ); + + deps.add( dep ); + } + } + + return deps; + } + + private List translateContributors( List v3Contributors ) + { + List contributors = new ArrayList(); + + if ( notEmpty( v3Contributors ) ) + { + for ( Iterator it = v3Contributors.iterator(); it.hasNext(); ) + { + org.apache.maven.model.v3_0_0.Contributor v3Contributor = (org.apache.maven.model.v3_0_0.Contributor) it + .next(); + + Contributor contributor = new Contributor(); + + contributor.setEmail( v3Contributor.getEmail() ); + contributor.setName( v3Contributor.getName() ); + contributor.setOrganization( v3Contributor.getOrganization() ); + contributor.setRoles( v3Contributor.getRoles() ); + contributor.setTimezone( v3Contributor.getTimezone() ); + contributor.setUrl( v3Contributor.getUrl() ); + + contributors.add( contributor ); + } + } + + return contributors; + } + + private Build translateBuild( org.apache.maven.model.v3_0_0.Build v3Build, Reporter reporter ) + { + Build build = null; + if ( v3Build != null ) + { + build = new Build(); + + warnOfUnsupportedBuildElements( v3Build, reporter ); + + build.setSourceDirectory( v3Build.getSourceDirectory() ); + build.setTestSourceDirectory( v3Build.getUnitTestSourceDirectory() ); + + build.setResources( translateResources( v3Build.getResources() ) ); + + org.apache.maven.model.v3_0_0.UnitTest unitTest = v3Build.getUnitTest(); + if ( unitTest != null ) + { + build.setTestResources( translateResources( unitTest.getResources() ) ); + + List testIncludes = unitTest.getIncludes(); + + List testExcludes = new ArrayList( unitTest.getExcludes() ); + testExcludes.addAll( unitTest.getDefaultExcludes() ); + + if ( notEmpty( testIncludes ) || notEmpty( testExcludes ) ) + { + Plugin plugin = new Plugin(); + plugin.setGroupId( "maven" ); + plugin.setArtifactId( "surefire" ); + plugin.setVersion( "1.0-SNAPSHOT" ); + + Properties config = new Properties(); + + String includes = pathPatternsToString( testIncludes ); + + if ( StringUtils.isNotEmpty( includes ) ) + { + config.setProperty( "includes", includes ); + } + + String excludes = pathPatternsToString( testExcludes ); + + if ( StringUtils.isNotEmpty( excludes ) ) + { + config.setProperty( "excludes", excludes ); + } + + if ( !config.isEmpty() ) + { + plugin.setConfiguration( config ); + } + + build.addPlugin( plugin ); + } + } + } + + return build; + } + + private void warnOfUnsupportedBuildElements( org.apache.maven.model.v3_0_0.Build v3Build, Reporter reporter ) + { + if ( notEmpty( v3Build.getSourceModifications() ) ) + { + reporter.warn( "Ignoring section. It is not supported in v4 POMs." ); + } + + if ( StringUtils.isNotEmpty( v3Build.getAspectSourceDirectory() ) ) + { + reporter.warn( "Ignoring . It is not supported in v4 POMs." ); + } + + if ( StringUtils.isNotEmpty( v3Build.getIntegrationUnitTestSourceDirectory() ) ) + { + reporter.warn( "Ignoring . It is not supported in v4 POMs." ); + } + } + + private List translateResources( List v3Resources ) + { + List resources = new ArrayList(); + + if ( notEmpty( v3Resources ) ) + { + for ( Iterator it = v3Resources.iterator(); it.hasNext(); ) + { + org.apache.maven.model.v3_0_0.Resource v3Resource = (org.apache.maven.model.v3_0_0.Resource) it.next(); + Resource resource = new Resource(); + + resource.setDirectory( v3Resource.getDirectory() ); + resource.setExcludes( pathPatternsToString( v3Resource.getExcludes() ) ); + resource.setIncludes( pathPatternsToString( v3Resource.getIncludes() ) ); + resource.setTargetPath( v3Resource.getTargetPath() ); + + resources.add( resource ); + } + } + + return resources; + } + + private String pathPatternsToString( List patterns ) + { + StringBuffer result = new StringBuffer(); + + if ( notEmpty( patterns ) ) + { + for ( Iterator it = patterns.iterator(); it.hasNext(); ) + { + String pattern = (String) it.next(); + + result.append( "," ).append( pattern ); + } + + result.setLength( result.length() - 1 ); + } + + return result.toString(); + } + + private boolean notEmpty( List test ) + { + return test != null && !test.isEmpty(); + } + + private static class PomKey + { + private final String groupId; + + private final String artifactId; + + private final String version; + + PomKey( String groupId, String artifactId, String version ) + { + this.groupId = groupId; + this.artifactId = artifactId; + this.version = version; + } + + public String groupId() + { + return groupId; + } + + public String artifactId() + { + return artifactId; + } + + public String version() + { + return version; + } + } + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/report/Reporter.java b/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/report/Reporter.java new file mode 100644 index 0000000000..24771386fd --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/report/Reporter.java @@ -0,0 +1,179 @@ +package org.apache.maven.tools.repoclean.report; + +import org.codehaus.plexus.util.IOUtil; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +/* ==================================================================== + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ==================================================================== + */ + +/** + * @author jdcasey + */ +public class Reporter +{ + + private static final String WARN_LEVEL = "[WARNING] "; + + private static final String INFO_LEVEL = "[INFO] "; + + private static final String ERROR_LEVEL = "[ERROR] "; + + private File reportsFile; + + private List messages = new ArrayList(); + + private boolean hasError = false; + + private boolean hasWarning = false; + + public Reporter( File reportsBase, String reportPath ) + { + this.reportsFile = new File( reportsBase, reportPath ); + + File parentDir = reportsFile.getParentFile(); + if ( !parentDir.exists() ) + { + parentDir.mkdirs(); + } + + if ( !parentDir.isDirectory() ) + { + throw new IllegalArgumentException( "path: \'" + parentDir.getAbsolutePath() + + "\' refers to a file, not a directory.\n" + "Cannot write report file: \'" + + reportsFile.getAbsolutePath() + "\'." ); + } + } + + public void writeReport() throws IOException + { + BufferedWriter writer = null; + + try + { + writer = new BufferedWriter( new FileWriter( reportsFile ) ); + + for ( Iterator it = messages.iterator(); it.hasNext(); ) + { + Object message = it.next(); + + if ( message instanceof List ) + { + writer.write( format( (List) message ).toString() ); + } + else + { + writer.write( String.valueOf( message ) ); + } + + writer.newLine(); + } + } + finally + { + IOUtil.close( writer ); + } + } + + public boolean hasWarning() + { + return hasWarning; + } + + public boolean hasError() + { + return hasError; + } + + public void warn( String message ) + { + hasWarning = true; + messages.add( new AppendingList( 2 ).append( WARN_LEVEL ).append( message ) ); + } + + public void info( String message ) + { + messages.add( new AppendingList( 2 ).append( INFO_LEVEL ).append( message ) ); + } + + public void error( String message, Throwable error ) + { + hasError = true; + messages.add( new AppendingList( 3 ).append( ERROR_LEVEL ).append( message ).append( error ) ); + } + + public void error( String message ) + { + hasError = true; + messages.add( new AppendingList( 2 ).append( ERROR_LEVEL ).append( message ) ); + } + + private CharSequence format( List messageParts ) + { + StringBuffer buffer = new StringBuffer(); + for ( Iterator it = messageParts.iterator(); it.hasNext(); ) + { + Object part = it.next(); + if ( part instanceof Throwable ) + { + part = formatThrowable( (Throwable) part ); + } + + buffer.append( part ); + } + + return buffer; + } + + private String formatThrowable( Throwable throwable ) + { + StringWriter sWriter = new StringWriter(); + PrintWriter pWriter = new PrintWriter( sWriter ); + + throwable.printStackTrace( pWriter ); + + return sWriter.toString(); + } + + private static class AppendingList + extends ArrayList + { + public AppendingList() + { + } + + public AppendingList( int size ) + { + super( size ); + } + + public AppendingList append( Object item ) + { + super.add( item ); + return this; + } + } + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/validate/V4ModelIndependenceValidator.java b/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/validate/V4ModelIndependenceValidator.java new file mode 100644 index 0000000000..a3992fbc09 --- /dev/null +++ b/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/validate/V4ModelIndependenceValidator.java @@ -0,0 +1,75 @@ +package org.apache.maven.tools.repoclean.validate; + +import org.apache.maven.model.v4_0_0.Model; +import org.apache.maven.tools.repoclean.report.Reporter; +import org.codehaus.plexus.util.StringUtils; + +/* ==================================================================== + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ==================================================================== + */ + +/** + * @author jdcasey + */ +public class V4ModelIndependenceValidator +{ + + public static final String ROLE = V4ModelIndependenceValidator.class.getName(); + + public boolean validate( Model model, Reporter reporter, boolean warnOnly ) + { + boolean isValid = true; + + if ( StringUtils.isEmpty( model.getModelVersion() ) ) + { + problem( "Model-version declaration is missing in resulting v4 model.", reporter, warnOnly ); + isValid = false; + } + + if ( StringUtils.isEmpty( model.getGroupId() ) ) + { + problem( "Group ID is missing in resulting v4 model.", reporter, warnOnly ); + isValid = false; + } + + if ( StringUtils.isEmpty( model.getArtifactId() ) ) + { + problem( "Artifact ID is missing in resulting v4 model.", reporter, warnOnly ); + isValid = false; + } + + if ( StringUtils.isEmpty( model.getVersion() ) ) + { + problem( "Version is missing in resulting v4 model.", reporter, warnOnly ); + isValid = false; + } + + return isValid; + } + + private void problem( String message, Reporter reporter, boolean warnOnly ) + { + if ( warnOnly ) + { + reporter.warn( message ); + } + else + { + reporter.error( message ); + } + } + +} \ No newline at end of file diff --git a/sandbox/repoclean/src/main/resources/META-INF/plexus/components.xml b/sandbox/repoclean/src/main/resources/META-INF/plexus/components.xml new file mode 100644 index 0000000000..83b14185e6 --- /dev/null +++ b/sandbox/repoclean/src/main/resources/META-INF/plexus/components.xml @@ -0,0 +1,89 @@ + + + + + org.apache.maven.tools.repoclean.RepositoryCleaner + org.apache.maven.tools.repoclean.RepositoryCleaner + + + org.apache.maven.tools.repoclean.pom.PomV3ToV4Translator + + + org.apache.maven.tools.repoclean.correlate.ArtifactPomCorrelator + + + org.apache.maven.tools.repoclean.correlate.ArtifactMd5Correlator + + + org.apache.maven.tools.repoclean.validate.V4ModelIndependenceValidator + + + org.apache.maven.tools.repoclean.patch.V4ModelPatcher + + + + + + org.apache.maven.tools.repoclean.pom.PomV3ToV4Translator + org.apache.maven.tools.repoclean.pom.PomV3ToV4Translator + + + + org.apache.maven.tools.repoclean.correlate.ArtifactMd5Correlator + org.apache.maven.tools.repoclean.correlate.ArtifactMd5Correlator + + + org.apache.maven.tools.repoclean.digest.ArtifactDigestor + + + + + + org.apache.maven.tools.repoclean.correlate.ArtifactPomCorrelator + org.apache.maven.tools.repoclean.correlate.ArtifactPomCorrelator + + + + org.apache.maven.tools.repoclean.validate.V4ModelIndependenceValidator + org.apache.maven.tools.repoclean.validate.V4ModelIndependenceValidator + + + + org.apache.maven.tools.repoclean.patch.V4ModelPatcher + org.apache.maven.tools.repoclean.patch.V4ModelPatcher + + + + org.apache.maven.tools.repoclean.digest.ArtifactDigestor + org.apache.maven.tools.repoclean.digest.ArtifactDigestor + + + diff --git a/sandbox/repoclean/src/test/java/org/apache/maven/tools/repoclean/patch/V4ModelPatcherTest.java b/sandbox/repoclean/src/test/java/org/apache/maven/tools/repoclean/patch/V4ModelPatcherTest.java new file mode 100644 index 0000000000..62af657f65 --- /dev/null +++ b/sandbox/repoclean/src/test/java/org/apache/maven/tools/repoclean/patch/V4ModelPatcherTest.java @@ -0,0 +1,64 @@ +package org.apache.maven.tools.repoclean.patch; + +import org.apache.maven.model.v4_0_0.Model; +import org.apache.maven.tools.repoclean.report.Reporter; + +import java.io.File; + +import junit.framework.TestCase; + +/* ==================================================================== + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ==================================================================== + */ + +/** + * @author jdcasey + */ +public class V4ModelPatcherTest + extends TestCase +{ + + public void testShouldPatchWithInfoFromXPP3PomPath() + { + String pomPath = "xpp3/poms/xpp3-1.1.3.3.pom"; + Model model = new Model(); + + V4ModelPatcher patcher = new V4ModelPatcher(); + Reporter reporter = new Reporter( new File( "." ), "testXpp3Patching.txt" ); + + patcher.patchModel( model, pomPath, reporter ); + + assertEquals( "xpp3", model.getGroupId() ); + assertEquals( "xpp3", model.getArtifactId() ); + assertEquals( "1.1.3.3", model.getVersion() ); + } + + public void testShouldPatchWithInfoFromPlexusContainerDefaultPomPath() + { + String pomPath = "plexus/poms/plexus-container-default-1.0-alpha-2-SNAPSHOT.pom"; + Model model = new Model(); + + V4ModelPatcher patcher = new V4ModelPatcher(); + Reporter reporter = new Reporter( new File( "." ), "testPlexusPatching.txt" ); + + patcher.patchModel( model, pomPath, reporter ); + + assertEquals( "plexus", model.getGroupId() ); + assertEquals( "plexus-container-default", model.getArtifactId() ); + assertEquals( "1.0-alpha-2-SNAPSHOT", model.getVersion() ); + } + +} \ No newline at end of file