mirror of https://github.com/apache/archiva.git
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
This commit is contained in:
parent
d8afa32103
commit
76b43a9254
|
@ -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
|
||||
*
|
||||
*
|
||||
*/
|
||||
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;
|
||||
|
@ -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() )
|
||||
{
|
||||
|
|
|
@ -283,7 +283,7 @@ public class RepositoryContentConsumers
|
|||
// yuck. In case you can't read this, it says
|
||||
// "process the file if the consumer has it in the includes list, and not in the excludes list"
|
||||
BaseFile baseFile = new BaseFile( repository.getLocation(), localFile );
|
||||
ConsumerWantsFilePredicate predicate = new ConsumerWantsFilePredicate();
|
||||
ConsumerWantsFilePredicate predicate = new ConsumerWantsFilePredicate( repository );
|
||||
predicate.setBasefile( baseFile );
|
||||
predicate.setCaseSensitive( false );
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ public class RepositoryScannerInstance
|
|||
consumerProcessFile.setConsumerTimings( consumerTimings );
|
||||
consumerProcessFile.setConsumerCounts( consumerCounts );
|
||||
|
||||
this.consumerWantsFile = new ConsumerWantsFilePredicate();
|
||||
this.consumerWantsFile = new ConsumerWantsFilePredicate( repository );
|
||||
|
||||
stats = new RepositoryScanStatistics();
|
||||
stats.setRepositoryId( repository.getId() );
|
||||
|
|
Loading…
Reference in New Issue