aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/plugins/maven2-repository/src
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2012-06-05 21:42:02 +0000
committerOlivier Lamy <olamy@apache.org>2012-06-05 21:42:02 +0000
commitea5ddd09615bd26400024da1b8de70b592391c58 (patch)
tree4ce87e7ced70243007271425de5964152d8a1e0c /archiva-modules/plugins/maven2-repository/src
parent25e650b0b4dc368ff6492711e24df6e5edc9b07c (diff)
downloadarchiva-ea5ddd09615bd26400024da1b8de70b592391c58.tar.gz
archiva-ea5ddd09615bd26400024da1b8de70b592391c58.zip
improve MetadataRepository api to be able to remove an artifact with MetadataFacet use case deleting a maven artifact with a classifier
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1346609 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/plugins/maven2-repository/src')
-rw-r--r--archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/MavenArtifactFacet.java19
-rw-r--r--archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/MavenProjectFacet.java39
-rw-r--r--archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java8
3 files changed, 66 insertions, 0 deletions
diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/MavenArtifactFacet.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/MavenArtifactFacet.java
index aa330385d..6e72fdcd7 100644
--- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/MavenArtifactFacet.java
+++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/MavenArtifactFacet.java
@@ -20,6 +20,7 @@ package org.apache.archiva.metadata.repository.storage.maven2;
*/
import org.apache.archiva.metadata.model.MetadataFacet;
+import org.apache.commons.lang.StringUtils;
import java.util.HashMap;
import java.util.Map;
@@ -118,4 +119,22 @@ public class MavenArtifactFacet
this.buildNumber = Integer.parseInt( buildNumber );
}
}
+
+ @Override
+ public boolean equals( Object o )
+ {
+ if ( this == o )
+ {
+ return true;
+ }
+ if ( !( o instanceof MavenArtifactFacet ) )
+ {
+ return false;
+ }
+
+ MavenArtifactFacet that = (MavenArtifactFacet) o;
+
+ return StringUtils.equals( that.getClassifier(), this.classifier );
+ }
+
}
diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/MavenProjectFacet.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/MavenProjectFacet.java
index 83fe1693e..93826d8d1 100644
--- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/MavenProjectFacet.java
+++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/MavenProjectFacet.java
@@ -118,4 +118,43 @@ public class MavenProjectFacet
this.parent = parent;
}
}
+
+ @Override
+ public boolean equals( Object o )
+ {
+ if ( this == o )
+ {
+ return true;
+ }
+ if ( !( o instanceof MavenProjectFacet ) )
+ {
+ return false;
+ }
+
+ MavenProjectFacet that = (MavenProjectFacet) o;
+
+ if ( !artifactId.equals( that.artifactId ) )
+ {
+ return false;
+ }
+ if ( !groupId.equals( that.groupId ) )
+ {
+ return false;
+ }
+ if ( !packaging.equals( that.packaging ) )
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int result = groupId.hashCode();
+ result = 31 * result + artifactId.hashCode();
+ result = 31 * result + packaging.hashCode();
+ return result;
+ }
}
diff --git a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java
index 3d5760765..24a0a5d44 100644
--- a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java
+++ b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java
@@ -198,4 +198,12 @@ public class TestMetadataRepository
{
return null; //To change body of implemented methods use File | Settings | File Templates.
}
+
+
+ public void removeArtifact( String repositoryId, String namespace, String project, String projectVersion,
+ String projectId, MetadataFacet metadataFacet )
+ throws MetadataRepositoryException
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
} \ No newline at end of file