[MRM-737]

-do not index metadata files


git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@675483 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Maria Odea B. Ching 2008-07-10 09:02:07 +00:00
parent 59313f36c3
commit 0a94a40f00
1 changed files with 11 additions and 0 deletions

View File

@ -36,10 +36,13 @@ import org.apache.maven.archiva.repository.ManagedRepositoryContent;
import org.apache.maven.archiva.repository.RepositoryContentFactory; import org.apache.maven.archiva.repository.RepositoryContentFactory;
import org.apache.maven.archiva.repository.RepositoryException; import org.apache.maven.archiva.repository.RepositoryException;
import org.apache.maven.archiva.repository.layout.LayoutException; import org.apache.maven.archiva.repository.layout.LayoutException;
import org.apache.maven.archiva.repository.metadata.MetadataTools;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable; import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException; import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
import org.codehaus.plexus.registry.Registry; import org.codehaus.plexus.registry.Registry;
import org.codehaus.plexus.registry.RegistryListener; import org.codehaus.plexus.registry.RegistryListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -60,6 +63,8 @@ public class IndexContentConsumer
extends AbstractMonitoredConsumer extends AbstractMonitoredConsumer
implements KnownRepositoryContentConsumer, RegistryListener, Initializable implements KnownRepositoryContentConsumer, RegistryListener, Initializable
{ {
private Logger log = LoggerFactory.getLogger( IndexContentConsumer.class );
private static final String READ_CONTENT = "read_content"; private static final String READ_CONTENT = "read_content";
private static final String INDEX_ERROR = "indexing_error"; private static final String INDEX_ERROR = "indexing_error";
@ -147,6 +152,12 @@ public class IndexContentConsumer
public void processFile( String path ) public void processFile( String path )
throws ConsumerException throws ConsumerException
{ {
if ( path.endsWith( "/" + MetadataTools.MAVEN_METADATA ) )
{
log.debug( "File is a metadata file. Not indexing." );
return;
}
FileContentRecord record = new FileContentRecord(); FileContentRecord record = new FileContentRecord();
try try
{ {