aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-indexer/src/main/java
diff options
context:
space:
mode:
authorBrett Porter <brett@apache.org>2006-09-05 04:08:15 +0000
committerBrett Porter <brett@apache.org>2006-09-05 04:08:15 +0000
commitc0e84cdce77eeae82e6d3c8cb5bf692703c7a37d (patch)
treed9f0e21d8c41be620a1a76884bb33d3c4a65f4f5 /archiva-indexer/src/main/java
parentd875b6a478b02ab43ca4c0ce810073f6a3c8d18f (diff)
downloadarchiva-c0e84cdce77eeae82e6d3c8cb5bf692703c7a37d.tar.gz
archiva-c0e84cdce77eeae82e6d3c8cb5bf692703c7a37d.zip
[MRM-161] add the reporter scheduled task
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@440244 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-indexer/src/main/java')
-rw-r--r--archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/IndexRecordExistsArtifactFilter.java44
1 files changed, 44 insertions, 0 deletions
diff --git a/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/IndexRecordExistsArtifactFilter.java b/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/IndexRecordExistsArtifactFilter.java
new file mode 100644
index 000000000..a5bdf9522
--- /dev/null
+++ b/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/IndexRecordExistsArtifactFilter.java
@@ -0,0 +1,44 @@
+package org.apache.maven.archiva.indexer.record;
+
+/*
+ * Copyright 2005-2006 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.artifact.Artifact;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+
+import java.util.Collection;
+
+/**
+ * Filter that removes artifacts already in the index.
+ * TODO: we could do timestamp comparisons here
+ */
+public class IndexRecordExistsArtifactFilter
+ implements ArtifactFilter
+{
+ private final Collection keys;
+
+ public IndexRecordExistsArtifactFilter( Collection keys )
+ {
+ this.keys = keys;
+ }
+
+ public boolean include( Artifact artifact )
+ {
+ String artifactKey = artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion() +
+ ( artifact.getClassifier() != null ? ":" + artifact.getClassifier() : "" );
+ return !keys.contains( artifactKey );
+ }
+}