diff --git a/archiva-base/archiva-model/pom.xml b/archiva-base/archiva-model/pom.xml
index f0a4acd2a..52c185ea7 100755
--- a/archiva-base/archiva-model/pom.xml
+++ b/archiva-base/archiva-model/pom.xml
@@ -78,8 +78,10 @@
+ * AbstractArtifactKey - a artifact reference to a versioned project. + * This refers to all artifacts of a specific version of a project. + * This type of reference is typically used by {@link ArchivaProjectModel} objects. + *
+ * + *+ * If you don't require things like "Version" or "Type", consider the other keys below. + *
+ * + *Key Type | + *Group ID | + *Artifact ID | + *Version | + *Classifier | + *Type | + *
---|---|---|---|---|---|
{@link AbstractProjectKey} | + *Yes | + *Yes | + *+ * | + * | + * |
{@link AbstractVersionedKey} | + *Yes | + *Yes | + *Yes | + *+ * | + * |
{@link AbstractArtifactKey} | + *Yes | + *Yes | + *Yes | + *Yes | + *Yes | + *
+ * NOTE: This is a jpox required compound key handler class. + *
+ * + * @author Joakim Erdfelt + * @version $Id$ + */ +public class AbstractArtifactKey implements Serializable +{ + /** + * The Group ID. (JPOX Requires this remain public) + */ + public String groupId = ""; + + /** + * The Artifact ID. (JPOX Requires this remain public) + */ + public String artifactId = ""; + + /** + * The Version. (JPOX Requires this remain public) + */ + public String version = ""; + + /** + * The Classifier. (JPOX Requires this remain public) + */ + public String classifier; + + /** + * The Type. (JPOX Requires this remain public) + */ + public String type; + + /** + * Default Constructor. Required by JPOX. + */ + public AbstractArtifactKey() + { + /* do nothing */ + } + + /** + * Key Based Constructor. Required by JPOX. + * + * @param key the String representing this object's values. + */ + public AbstractArtifactKey( String key ) + { + String parts[] = StringUtils.splitPreserveAllTokens( key, ":" ); + groupId = parts[1]; + artifactId = parts[2]; + version = parts[3]; + classifier = parts[4]; + type = parts[5]; + } + + /** + * Get the String representation of this object. - Required by JPOX. + */ + public String toString() + { + return StringUtils.join( new String[] { groupId, artifactId, version, classifier, type } ); + } + + /** + * Get the hashcode for this object's values - Required by JPOX. + */ + public int hashCode() + { + final int PRIME = 31; + int result = super.hashCode(); + result = PRIME * result + ( ( groupId == null ) ? 0 : groupId.hashCode() ); + result = PRIME * result + ( ( artifactId == null ) ? 0 : artifactId.hashCode() ); + result = PRIME * result + ( ( version == null ) ? 0 : version.hashCode() ); + result = PRIME * result + ( ( classifier == null ) ? 0 : classifier.hashCode() ); + result = PRIME * result + ( ( type == null ) ? 0 : type.hashCode() ); + return result; + } + + /** + * Get the equals for this object's values - Required by JPOX. + */ + public boolean equals( Object obj ) + { + if ( this == obj ) + { + return true; + } + + if ( !super.equals( obj ) ) + { + return false; + } + + if ( getClass() != obj.getClass() ) + { + return false; + } + + final AbstractArtifactKey other = (AbstractArtifactKey) obj; + + if ( groupId == null ) + { + if ( other.groupId != null ) + { + return false; + } + } + else if ( !groupId.equals( other.groupId ) ) + { + return false; + } + + if ( artifactId == null ) + { + if ( other.artifactId != null ) + { + return false; + } + } + else if ( !artifactId.equals( other.artifactId ) ) + { + return false; + } + + if ( version == null ) + { + if ( other.version != null ) + { + return false; + } + } + else if ( !version.equals( other.version ) ) + { + return false; + } + + if ( classifier == null ) + { + if ( other.classifier != null ) + { + return false; + } + } + else if ( !classifier.equals( other.classifier ) ) + { + return false; + } + + if ( type == null ) + { + if ( other.type != null ) + { + return false; + } + } + else if ( !type.equals( other.type ) ) + { + return false; + } + + return true; + } +} diff --git a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/AbstractProjectKey.java b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/AbstractProjectKey.java new file mode 100644 index 000000000..23f628cb6 --- /dev/null +++ b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/AbstractProjectKey.java @@ -0,0 +1,180 @@ +package org.apache.maven.archiva.model; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.commons.lang.StringUtils; + +import java.io.Serializable; + +/** + *+ * AbstractProjectKey - A versionless reference to a Project. + * This refers to all versions, and all artifacts of a project. + * This type of reference is typically used by {@link ArchivaRepositoryMetadata} objects. + *
+ * + *+ * If you require things like "Version" or "Type", consider the other keys below. + *
+ * + *Key Type | + *Group ID | + *Artifact ID | + *Version | + *Classifier | + *Type | + *
---|---|---|---|---|---|
{@link AbstractProjectKey} | + *Yes | + *Yes | + *+ * | + * | + * |
{@link AbstractVersionedKey} | + *Yes | + *Yes | + *Yes | + *+ * | + * |
{@link AbstractArtifactKey} | + *Yes | + *Yes | + *Yes | + *Yes | + *Yes | + *
+ * NOTE: This is a jpox required compound key handler class. + *
+ * + * @author Joakim Erdfelt + * @version $Id$ + */ +public class AbstractProjectKey + implements Serializable +{ + /** + * The Group ID. (JPOX Requires this remain public) + */ + public String groupId = ""; + + /** + * The Artifact ID. (JPOX Requires this remain public) + */ + public String artifactId = ""; + + /** + * Default Constructor. Required by JPOX. + */ + public AbstractProjectKey() + { + /* do nothing */ + } + + /** + * Key Based Constructor. Required by JPOX. + * + * @param key the String representing this object's values. + */ + public AbstractProjectKey( String key ) + { + String parts[] = StringUtils.splitPreserveAllTokens( key, ":" ); + groupId = parts[1]; + artifactId = parts[2]; + } + + /** + * Get the String representation of this object. - Required by JPOX. + */ + public String toString() + { + return StringUtils.join( new String[] { groupId, artifactId } ); + } + + /** + * Get the hashcode for this object's values - Required by JPOX. + */ + public int hashCode() + { + final int PRIME = 31; + int result = super.hashCode(); + result = PRIME * result + ( ( groupId == null ) ? 0 : groupId.hashCode() ); + result = PRIME * result + ( ( artifactId == null ) ? 0 : artifactId.hashCode() ); + return result; + } + + /** + * Get the equals for this object's values - Required by JPOX. + */ + public boolean equals( Object obj ) + { + if ( this == obj ) + { + return true; + } + + if ( !super.equals( obj ) ) + { + return false; + } + + if ( getClass() != obj.getClass() ) + { + return false; + } + + final AbstractProjectKey other = (AbstractProjectKey) obj; + + if ( groupId == null ) + { + if ( other.groupId != null ) + { + return false; + } + } + else if ( !groupId.equals( other.groupId ) ) + { + return false; + } + + if ( artifactId == null ) + { + if ( other.artifactId != null ) + { + return false; + } + } + else if ( !artifactId.equals( other.artifactId ) ) + { + return false; + } + + return true; + } +} diff --git a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/RepositoryContentKey.java b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/AbstractVersionedKey.java similarity index 65% rename from archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/RepositoryContentKey.java rename to archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/AbstractVersionedKey.java index a198eaec2..c173a3574 100644 --- a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/RepositoryContentKey.java +++ b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/AbstractVersionedKey.java @@ -24,18 +24,60 @@ import org.apache.commons.lang.StringUtils; import java.io.Serializable; /** - * RepositoryContentKey - the jpox application key support class for all content within the repository. + *+ * AbstractVersionedKey - a versioned reference to a Project. + * This refers to all artifacts of a specific version of a project. + * This type of reference is typically used by {@link ArchivaProjectModel} objects. + *
+ * + *+ * If you require things like "Version" or "Type", consider the other keys below. + *
+ * + *Key Type | + *Group ID | + *Artifact ID | + *Version | + *Classifier | + *Type | + *
---|---|---|---|---|---|
{@link AbstractProjectKey} | + *Yes | + *Yes | + *+ * | + * | + * |
{@link AbstractVersionedKey} | + *Yes | + *Yes | + *Yes | + *+ * | + * |
{@link AbstractArtifactKey} | + *Yes | + *Yes | + *Yes | + *Yes | + *Yes | + *
+ * NOTE: This is a jpox required compound key handler class. + *
* * @author Joakim Erdfelt * @version $Id$ */ -public class RepositoryContentKey implements Serializable +public class AbstractVersionedKey implements Serializable { - /** - * The Repository ID. (JPOX Requires this remain public) - */ - public String repositoryId = ""; - /** * The Group ID. (JPOX Requires this remain public) */ @@ -50,35 +92,34 @@ public class RepositoryContentKey implements Serializable * The Version. (JPOX Requires this remain public) */ public String version = ""; - + /** * Default Constructor. Required by JPOX. */ - public RepositoryContentKey() + public AbstractVersionedKey() { - + /* do nothing */ } - + /** * Key Based Constructor. Required by JPOX. * * @param key the String representing this object's values. */ - public RepositoryContentKey( String key ) + public AbstractVersionedKey( String key ) { - String parts[] = StringUtils.splitPreserveAllTokens( key, ':' ); - repositoryId = parts[0]; + String parts[] = StringUtils.splitPreserveAllTokens( key, ":" ); groupId = parts[1]; artifactId = parts[2]; version = parts[3]; } - + /** * Get the String representation of this object. - Required by JPOX. */ public String toString() { - return StringUtils.join( new String[] { repositoryId, groupId, artifactId, version } ); + return StringUtils.join( new String[] { groupId, artifactId, version } ); } /** @@ -87,8 +128,7 @@ public class RepositoryContentKey implements Serializable public int hashCode() { final int PRIME = 31; - int result = 1; - result = PRIME * result + ( ( repositoryId == null ) ? 0 : repositoryId.hashCode() ); + int result = super.hashCode(); result = PRIME * result + ( ( groupId == null ) ? 0 : groupId.hashCode() ); result = PRIME * result + ( ( artifactId == null ) ? 0 : artifactId.hashCode() ); result = PRIME * result + ( ( version == null ) ? 0 : version.hashCode() ); @@ -104,31 +144,19 @@ public class RepositoryContentKey implements Serializable { return true; } - - if ( obj == null ) + + if ( !super.equals( obj ) ) { return false; } - + if ( getClass() != obj.getClass() ) { return false; } - - final RepositoryContentKey other = (RepositoryContentKey) obj; - - if ( repositoryId == null ) - { - if ( other.repositoryId != null ) - { - return false; - } - } - else if ( !repositoryId.equals( other.repositoryId ) ) - { - return false; - } - + + final AbstractVersionedKey other = (AbstractVersionedKey) obj; + if ( groupId == null ) { if ( other.groupId != null ) @@ -140,7 +168,7 @@ public class RepositoryContentKey implements Serializable { return false; } - + if ( artifactId == null ) { if ( other.artifactId != null ) @@ -152,7 +180,7 @@ public class RepositoryContentKey implements Serializable { return false; } - + if ( version == null ) { if ( other.version != null ) @@ -164,7 +192,7 @@ public class RepositoryContentKey implements Serializable { return false; } - + return true; } } diff --git a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaArtifact.java b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaArtifact.java index 8e4f2c4ac..e3920f45c 100644 --- a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaArtifact.java +++ b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaArtifact.java @@ -19,8 +19,8 @@ package org.apache.maven.archiva.model; * under the License. */ +import org.apache.commons.lang.StringUtils; import org.apache.maven.archiva.common.utils.VersionUtil; -import org.codehaus.plexus.util.StringUtils; /** * ArchivaArtifact - Mutable artifact object. @@ -31,7 +31,7 @@ import org.codehaus.plexus.util.StringUtils; public class ArchivaArtifact { private ArchivaArtifactModel model; - + private ArchivaArtifactPlatformDetails platformDetails; private String baseVersion; @@ -68,14 +68,10 @@ public class ArchivaArtifact model = new ArchivaArtifactModel(); - if ( repository == null ) - { - model.setContentKey( new RepositoryContent( groupId, artifactId, version ) ); - } - else - { - model.setContentKey( new RepositoryContent( repository.getModel(), groupId, artifactId, version ) ); - } + model.setGroupId( groupId ); + model.setArtifactId( artifactId ); + model.setVersion( version ); + model.setRepositoryId( repository.getId() ); model.setClassifier( StringUtils.defaultString( classifier ) ); model.setType( type ); @@ -90,17 +86,17 @@ public class ArchivaArtifact public String getGroupId() { - return model.getContentKey().getGroupId(); + return model.getGroupId(); } public String getArtifactId() { - return model.getContentKey().getArtifactId(); + return model.getArtifactId(); } public String getVersion() { - return model.getContentKey().getVersion(); + return model.getVersion(); } public String getBaseVersion() @@ -134,15 +130,11 @@ public class ArchivaArtifact int result = 1; if ( model != null ) { - RepositoryContent key = model.getContentKey(); - if ( key != null ) - { - result = PRIME * result + ( ( key.getGroupId() == null ) ? 0 : key.getGroupId().hashCode() ); - result = PRIME * result + ( ( key.getArtifactId() == null ) ? 0 : key.getArtifactId().hashCode() ); - result = PRIME * result + ( ( key.getVersion() == null ) ? 0 : key.getVersion().hashCode() ); - result = PRIME * result + ( ( model.getClassifier() == null ) ? 0 : model.getClassifier().hashCode() ); - result = PRIME * result + ( ( model.getType() == null ) ? 0 : model.getType().hashCode() ); - } + result = PRIME * result + ( ( model.getGroupId() == null ) ? 0 : model.getGroupId().hashCode() ); + result = PRIME * result + ( ( model.getArtifactId() == null ) ? 0 : model.getArtifactId().hashCode() ); + result = PRIME * result + ( ( model.getVersion() == null ) ? 0 : model.getVersion().hashCode() ); + result = PRIME * result + ( ( model.getClassifier() == null ) ? 0 : model.getClassifier().hashCode() ); + result = PRIME * result + ( ( model.getType() == null ) ? 0 : model.getType().hashCode() ); } return result; } @@ -173,63 +165,27 @@ public class ArchivaArtifact return false; } } - else - { - RepositoryContent key = model.getContentKey(); - RepositoryContent otherkey = other.model.getContentKey(); - - if ( key == null ) - { - if ( otherkey != null ) - { - return false; - } - } - else - { - if ( !equals( key.getGroupId(), otherkey.getGroupId() ) - || !equals( key.getArtifactId(), otherkey.getArtifactId() ) - || !equals( key.getVersion(), otherkey.getVersion() ) - || !equals( model.getClassifier(), other.model.getClassifier() ) - || !equals( model.getType(), other.model.getType() ) ) - { - return false; - } - } - } - - return true; - } - - private boolean equals( String left, String right ) - { - if ( left == null ) - { - if ( right != null ) - { - return false; - } - } - else if ( !left.equals( right ) ) + if ( !model.equals( other.model ) ) { return false; } + return true; } public String toString() { StringBuffer sb = new StringBuffer(); - if ( model.getContentKey().getGroupId() != null ) + if ( model.getGroupId() != null ) { - sb.append( model.getContentKey().getGroupId() ); + sb.append( model.getGroupId() ); sb.append( ":" ); } appendArtifactTypeClassifierString( sb ); sb.append( ":" ); - if ( model.getContentKey().getVersion() != null ) + if ( model.getVersion() != null ) { - sb.append( model.getContentKey().getVersion() ); + sb.append( model.getVersion() ); } return sb.toString(); @@ -237,7 +193,7 @@ public class ArchivaArtifact private void appendArtifactTypeClassifierString( StringBuffer sb ) { - sb.append( model.getContentKey().getArtifactId() ); + sb.append( model.getArtifactId() ); sb.append( ":" ); sb.append( getType() ); if ( hasClassifier() ) diff --git a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaModelCloner.java b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaModelCloner.java new file mode 100644 index 000000000..8b50de846 --- /dev/null +++ b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaModelCloner.java @@ -0,0 +1,380 @@ +package org.apache.maven.archiva.model; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 java.util.ArrayList; +import java.util.Enumeration; +import java.util.Iterator; +import java.util.List; +import java.util.Properties; + +/** + * Utility methods for cloning various Archiva Model objects. + * + * @author Joakim Erdfelt + * @version $Id$ + */ +public class ArchivaModelCloner +{ + public static ArchivaProjectModel clone( ArchivaProjectModel model ) + { + if ( model == null ) + { + return null; + } + + ArchivaProjectModel cloned = new ArchivaProjectModel(); + + cloned.setGroupId( model.getGroupId() ); + cloned.setArtifactId( model.getArtifactId() ); + cloned.setVersion( model.getVersion() ); + + cloned.setParentProject( clone( model.getParentProject() ) ); + + cloned.setName( model.getName() ); + cloned.setDescription( model.getDescription() ); + cloned.setUrl( model.getUrl() ); + cloned.setPackaging( model.getPackaging() ); + cloned.setOrigin( model.getOrigin() ); + + cloned.setCiManagement( clone( model.getCiManagement() ) ); + cloned.setIndividuals( cloneIndividuals( model.getIndividuals() ) ); + cloned.setIssueManagement( clone( model.getIssueManagement() ) ); + cloned.setLicenses( cloneLicenses( model.getLicenses() ) ); + cloned.setOrganization( clone( model.getOrganization() ) ); + cloned.setScm( clone( model.getScm() ) ); + cloned.setRepositories( cloneRepositories( model.getRepositories() ) ); + cloned.setDependencies( cloneDependencies( model.getDependencies() ) ); + cloned.setPlugins( clonePlugins( model.getPlugins() ) ); + cloned.setReports( cloneReports( model.getReports() ) ); + cloned.setDependencyManagement( cloneDependencies( model.getDependencyManagement() ) ); + + return cloned; + } + + public static ArtifactReference clone( ArtifactReference artifactReference ) + { + if ( artifactReference == null ) + { + return null; + } + + ArtifactReference cloned = new ArtifactReference(); + + cloned.setGroupId( artifactReference.getGroupId() ); + cloned.setArtifactId( artifactReference.getArtifactId() ); + cloned.setVersion( artifactReference.getVersion() ); + cloned.setClassifier( artifactReference.getClassifier() ); + cloned.setType( artifactReference.getType() ); + + return cloned; + } + + public static CiManagement clone( CiManagement ciManagement ) + { + if ( ciManagement == null ) + { + return null; + } + + CiManagement cloned = new CiManagement(); + + cloned.setSystem( ciManagement.getSystem() ); + cloned.setUrl( ciManagement.getUrl() ); + + return cloned; + } + + public static IssueManagement clone( IssueManagement issueManagement ) + { + if ( issueManagement == null ) + { + return null; + } + + IssueManagement cloned = new IssueManagement(); + + cloned.setSystem( issueManagement.getSystem() ); + cloned.setUrl( issueManagement.getUrl() ); + + return cloned; + } + + public static Organization clone( Organization organization ) + { + if ( organization == null ) + { + return null; + } + + Organization cloned = new Organization(); + + cloned.setFavicon( organization.getFavicon() ); + cloned.setName( organization.getName() ); + cloned.setUrl( organization.getUrl() ); + + return cloned; + } + + public static Properties clone( Properties properties ) + { + if ( properties == null ) + { + return null; + } + + Properties cloned = new Properties(); + + Enumeration keys = properties.propertyNames(); + while ( keys.hasMoreElements() ) + { + String key = (String) keys.nextElement(); + String value = properties.getProperty( key ); + cloned.setProperty( key, value ); + } + + return cloned; + } + + public static Scm clone( Scm scm ) + { + if ( scm == null ) + { + return null; + } + + Scm cloned = new Scm(); + + cloned.setConnection( scm.getConnection() ); + cloned.setDeveloperConnection( scm.getDeveloperConnection() ); + cloned.setUrl( scm.getUrl() ); + + return cloned; + } + + public static VersionedReference clone( VersionedReference versionedReference ) + { + if ( versionedReference == null ) + { + return null; + } + + VersionedReference cloned = new VersionedReference(); + + cloned.setGroupId( versionedReference.getGroupId() ); + cloned.setArtifactId( versionedReference.getArtifactId() ); + cloned.setVersion( versionedReference.getVersion() ); + + return cloned; + } + + public static List cloneArtifactReferences( List artifactReferenceList ) + { + if ( artifactReferenceList == null ) + { + return null; + } + + List ret = new ArrayList(); + + Iterator it = artifactReferenceList.iterator(); + while ( it.hasNext() ) + { + ArtifactReference artifactReference = (ArtifactReference) it.next(); + ret.add( clone( artifactReference ) ); + } + + return ret; + } + + public static List cloneDependencies( List dependencies ) + { + if ( dependencies == null ) + { + return null; + } + + List ret = new ArrayList(); + + Iterator it = dependencies.iterator(); + while ( it.hasNext() ) + { + Dependency dep = (Dependency) it.next(); + Dependency cloned = new Dependency(); + + cloned.setGroupId( dep.getGroupId() ); + cloned.setArtifactId( dep.getArtifactId() ); + cloned.setVersion( dep.getVersion() ); + + cloned.setClassifier( dep.getClassifier() ); + cloned.setType( dep.getType() ); + cloned.setScope( dep.getScope() ); + cloned.setOptional( dep.isOptional() ); + cloned.setSystemPath( dep.getSystemPath() ); + cloned.setUrl( dep.getUrl() ); + cloned.setExclusions( cloneExclusions( dep.getExclusions() ) ); + + ret.add( cloned ); + } + + return ret; + } + + public static List cloneExclusions( List exclusions ) + { + if ( exclusions == null ) + { + return null; + } + + List ret = new ArrayList(); + + Iterator it = exclusions.iterator(); + while ( it.hasNext() ) + { + Exclusion exclusion = (Exclusion) it.next(); + Exclusion cloned = new Exclusion(); + + cloned.setGroupId( exclusion.getGroupId() ); + cloned.setArtifactId( exclusion.getArtifactId() ); + + ret.add( cloned ); + } + + return ret; + } + + public static List cloneIndividuals( List individuals ) + { + if ( individuals == null ) + { + return individuals; + } + + List ret = new ArrayList(); + + Iterator it = individuals.iterator(); + while ( it.hasNext() ) + { + Individual individual = (Individual) it.next(); + Individual cloned = new Individual(); + + cloned.setPrincipal( individual.getPrincipal() ); + + cloned.setEmail( individual.getEmail() ); + cloned.setName( individual.getName() ); + cloned.setOrganization( individual.getOrganization() ); + cloned.setOrganizationUrl( individual.getOrganizationUrl() ); + cloned.setUrl( individual.getUrl() ); + cloned.setTimezone( individual.getTimezone() ); + + cloned.setRoles( cloneRoles( individual.getRoles() ) ); + cloned.setProperties( clone( individual.getProperties() ) ); + + ret.add( cloned ); + } + + return ret; + } + + public static List cloneLicenses( List licenses ) + { + if ( licenses == null ) + { + return null; + } + + List ret = new ArrayList(); + + Iterator it = licenses.iterator(); + while ( it.hasNext() ) + { + License license = (License) it.next(); + License cloned = new License(); + + cloned.setId( license.getId() ); + cloned.setName( license.getName() ); + cloned.setUrl( license.getUrl() ); + cloned.setComments( license.getComments() ); + + ret.add( cloned ); + } + + return ret; + } + + public static List clonePlugins( List plugins ) + { + return cloneArtifactReferences( plugins ); + } + + public static List cloneReports( List reports ) + { + return cloneArtifactReferences( reports ); + } + + public static List cloneRepositories( List repositories ) + { + if ( repositories == null ) + { + return null; + } + + List ret = new ArrayList(); + + Iterator it = repositories.iterator(); + while ( it.hasNext() ) + { + ProjectRepository repository = (ProjectRepository) it.next(); + ProjectRepository cloned = new ProjectRepository(); + + cloned.setId( repository.getId() ); + cloned.setName( repository.getName() ); + cloned.setUrl( repository.getUrl() ); + cloned.setLayout( repository.getLayout() ); + cloned.setPlugins( repository.isPlugins() ); + cloned.setReleases( repository.isReleases() ); + cloned.setSnapshots( repository.isSnapshots() ); + + ret.add( cloned ); + } + + return ret; + } + + public static List cloneRoles( List roles ) + { + if ( roles == null ) + { + return null; + } + + List ret = new ArrayList(); + + Iterator it = roles.iterator(); + while ( it.hasNext() ) + { + String roleName = (String) it.next(); + ret.add( roleName ); + } + + return ret; + } +} diff --git a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ArchivaArtifactJavaDetailsKey.java b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ArchivaArtifactJavaDetailsKey.java new file mode 100644 index 000000000..59fbc6b11 --- /dev/null +++ b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ArchivaArtifactJavaDetailsKey.java @@ -0,0 +1,46 @@ +package org.apache.maven.archiva.model.jpox; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.archiva.model.AbstractArtifactKey; + +import java.io.Serializable; + +/** + * ArchivaArtifactJavaDetailsKey - unique classid-key for JPOX. + * + * @author Joakim Erdfelt + * @version $Id$ + */ +public class ArchivaArtifactJavaDetailsKey + extends AbstractArtifactKey + implements Serializable +{ + + public ArchivaArtifactJavaDetailsKey() + { + } + + public ArchivaArtifactJavaDetailsKey( String key ) + { + super( key ); + } + +} diff --git a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ArchivaArtifactModelKey.java b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ArchivaArtifactModelKey.java new file mode 100644 index 000000000..4fdf974e2 --- /dev/null +++ b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ArchivaArtifactModelKey.java @@ -0,0 +1,45 @@ +package org.apache.maven.archiva.model.jpox; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.archiva.model.AbstractArtifactKey; + +import java.io.Serializable; + +/** + * ArchivaArtifactModelKey - unique classid-key for JPOX. + * + * @author Joakim Erdfelt + * @version $Id$ + */ +public class ArchivaArtifactModelKey + extends AbstractArtifactKey + implements Serializable +{ + public ArchivaArtifactModelKey() + { + super(); + } + + public ArchivaArtifactModelKey( String key ) + { + super( key ); + } +} diff --git a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ArchivaProjectModelKey.java b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ArchivaProjectModelKey.java new file mode 100644 index 000000000..cdda128cd --- /dev/null +++ b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ArchivaProjectModelKey.java @@ -0,0 +1,46 @@ +package org.apache.maven.archiva.model.jpox; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.archiva.model.AbstractVersionedKey; + +import java.io.Serializable; + +/** + * ArchivaProjectModelKey - unique classid-key for JPOX. + * + * @author Joakim Erdfelt + * @version $Id$ + */ +public class ArchivaProjectModelKey + extends AbstractVersionedKey + implements Serializable +{ + + public ArchivaProjectModelKey() + { + } + + public ArchivaProjectModelKey( String key ) + { + super( key ); + } + +} diff --git a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ArchivaRepositoryMetadataKey.java b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ArchivaRepositoryMetadataKey.java new file mode 100644 index 000000000..d4274cba5 --- /dev/null +++ b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ArchivaRepositoryMetadataKey.java @@ -0,0 +1,46 @@ +package org.apache.maven.archiva.model.jpox; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.archiva.model.AbstractProjectKey; + +import java.io.Serializable; + +/** + * ArchivaRepositoryMetadataKey - unique classid-key for JPOX. + * + * @author Joakim Erdfelt + * @version $Id$ + */ +public class ArchivaRepositoryMetadataKey + extends AbstractProjectKey + implements Serializable +{ + + public ArchivaRepositoryMetadataKey() + { + } + + public ArchivaRepositoryMetadataKey( String key ) + { + super( key ); + } + +} diff --git a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ArtifactReferenceKey.java b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ArtifactReferenceKey.java new file mode 100644 index 000000000..41110b1b4 --- /dev/null +++ b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ArtifactReferenceKey.java @@ -0,0 +1,46 @@ +package org.apache.maven.archiva.model.jpox; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.archiva.model.AbstractArtifactKey; + +import java.io.Serializable; + +/** + * ArtifactReferenceKey - unique classid-key for JPOX. + * + * @author Joakim Erdfelt + * @version $Id$ + */ +public class ArtifactReferenceKey + extends AbstractArtifactKey + implements Serializable +{ + + public ArtifactReferenceKey() + { + } + + public ArtifactReferenceKey( String key ) + { + super( key ); + } + +} diff --git a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/DependencyKey.java b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/DependencyKey.java new file mode 100644 index 000000000..929f2f142 --- /dev/null +++ b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/DependencyKey.java @@ -0,0 +1,45 @@ +package org.apache.maven.archiva.model.jpox; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.archiva.model.AbstractArtifactKey; + +import java.io.Serializable; + +/** + * DependencyKey - unique classid-key for JPOX. + * + * @author Joakim Erdfelt + * @version $Id$ + */ +public class DependencyKey + extends AbstractArtifactKey + implements Serializable +{ + + public DependencyKey() + { + } + + public DependencyKey( String key ) + { + super( key ); + } +} diff --git a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/VersionedReferenceKey.java b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/VersionedReferenceKey.java new file mode 100644 index 000000000..094307c9e --- /dev/null +++ b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/VersionedReferenceKey.java @@ -0,0 +1,47 @@ +package org.apache.maven.archiva.model.jpox; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.archiva.model.AbstractVersionedKey; + +import java.io.Serializable; + +/** + * VersionedReferenceKey - unique classid-key for JPOX. + * + * @author Joakim Erdfelt + * @version $Id$ + */ +public class VersionedReferenceKey + extends AbstractVersionedKey + implements Serializable +{ + + public VersionedReferenceKey() + { + + } + + public VersionedReferenceKey( String key ) + { + super( key ); + } + +} diff --git a/archiva-base/archiva-model/src/main/mdo/archiva-base.xml b/archiva-base/archiva-model/src/main/mdo/archiva-base.xml index 101fde635..06a07f732 100644 --- a/archiva-base/archiva-model/src/main/mdo/archiva-base.xml +++ b/archiva-base/archiva-model/src/main/mdo/archiva-base.xml @@ -58,18 +58,10 @@
-
- jdk15
.
+ ]]>extensions
to true
, so this is not a complete list.
]]>jdk15
.
+ This url will be provided to the user if the jar file cannot be downloaded
+ from the central repository.
]]>