summaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-base/archiva-consumers
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2013-11-15 00:41:06 +0000
committerOlivier Lamy <olamy@apache.org>2013-11-15 00:41:06 +0000
commit76b43a92541e7d209908023d02a94896e65588d3 (patch)
tree5c5f996709aa4e485932f13d6eb1b48902616fe5 /archiva-modules/archiva-base/archiva-consumers
parentd8afa32103ea063ebe959a66fa968dc3cebc7775 (diff)
downloadarchiva-76b43a92541e7d209908023d02a94896e65588d3.tar.gz
archiva-76b43a92541e7d209908023d02a94896e65588d3.zip
ignore files part of index directory when scanning
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1542140 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-base/archiva-consumers')
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/archiva/consumers/functors/ConsumerWantsFilePredicate.java37
1 files changed, 33 insertions, 4 deletions
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/archiva/consumers/functors/ConsumerWantsFilePredicate.java b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/archiva/consumers/functors/ConsumerWantsFilePredicate.java
index 7846d1ecb..e52962c79 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/archiva/consumers/functors/ConsumerWantsFilePredicate.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/archiva/consumers/functors/ConsumerWantsFilePredicate.java
@@ -21,16 +21,18 @@ package org.apache.archiva.consumers.functors;
import java.util.List;
+import org.apache.archiva.admin.model.beans.ManagedRepository;
import org.apache.commons.collections.Predicate;
import org.apache.commons.io.FilenameUtils;
import org.apache.archiva.common.utils.BaseFile;
import org.apache.archiva.consumers.RepositoryContentConsumer;
+import org.apache.commons.lang.StringUtils;
import org.apache.tools.ant.types.selectors.SelectorUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
- * ConsumerWantsFilePredicate
- *
- *
+ * ConsumerWantsFilePredicate
*/
public class ConsumerWantsFilePredicate
implements Predicate
@@ -43,6 +45,23 @@ public class ConsumerWantsFilePredicate
private long changesSince = 0;
+ private ManagedRepository managedRepository;
+
+ private Logger logger = LoggerFactory.getLogger( getClass() );
+
+ /**
+ * @deprecated use constructor with ManagedRepository
+ */
+ public ConsumerWantsFilePredicate()
+ {
+ // no-op
+ }
+
+ public ConsumerWantsFilePredicate( ManagedRepository managedRepository )
+ {
+ this.managedRepository = managedRepository;
+ }
+
public boolean evaluate( Object object )
{
boolean satisfies = false;
@@ -53,7 +72,7 @@ public class ConsumerWantsFilePredicate
if ( wantsFile( consumer, FilenameUtils.separatorsToUnix( basefile.getRelativePath() ) ) )
{
satisfies = true;
-
+
// regardless of the timestamp, we record that it was wanted so it doesn't get counted as invalid
wantedFileCount++;
@@ -114,6 +133,16 @@ public class ConsumerWantsFilePredicate
}
}
+ if ( managedRepository != null )
+ {
+ String indexDirectory = managedRepository.getIndexDirectory();
+ if ( StringUtils.startsWith( relativePath, indexDirectory ) )
+ {
+ logger.debug( "ignore file {} part of the index directory {}", relativePath, indexDirectory );
+ return false;
+ }
+ }
+
// Now test includes.
for ( String pattern : consumer.getIncludes() )
{