public void processFile( String path )
throws ConsumerException
{
- //Ignore paths like .indexer etc
- if (path.startsWith("."))
- return;
-
- try
- {
- ArtifactReference artifact = repository.toArtifactReference( path );
- updateVersionMetadata( artifact, path );
- updateProjectMetadata( artifact, path );
- }
- catch ( LayoutException e )
+ // Ignore paths like .indexer etc
+ if ( !path.startsWith( "." ) )
{
- throw new ConsumerException( "Unable to convert to artifact reference: " + path, e );
+ try
+ {
+ ArtifactReference artifact = repository.toArtifactReference( path );
+ updateVersionMetadata( artifact, path );
+ updateProjectMetadata( artifact, path );
+ }
+ catch ( LayoutException e )
+ {
+ log.info( "Not processing path that is not an artifact: " + path + " (" + e.getMessage() + ")" );
+ }
}
}
import org.apache.maven.archiva.model.ArtifactReference;
import org.apache.maven.archiva.repository.ManagedRepositoryContent;
import org.apache.maven.archiva.repository.events.RepositoryListener;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Base class for all repository purge tasks.
public abstract class AbstractRepositoryPurge
implements RepositoryPurge
{
+ protected Logger log = LoggerFactory.getLogger( AbstractRepositoryPurge.class );
+
protected final ManagedRepositoryContent repository;
protected final List<RepositoryListener> listeners;
}
}
}
- catch ( LayoutException le )
- {
- throw new RepositoryPurgeException( le.getMessage(), le );
- }
catch ( ContentNotFoundException e )
{
throw new RepositoryPurgeException( e.getMessage(), e );
}
+ catch ( LayoutException e )
+ {
+ log.debug( "Not processing file that is not an artifact: " + e.getMessage() );
+ }
}
private Calendar uniqueSnapshotToCalendar( String version )
}
private void doPurgeAllRelated( ArtifactReference reference )
- throws LayoutException
{
try
{
}
catch ( ContentNotFoundException e )
{
- // Nothing to do here.
- // TODO: Log this?
+ // Nothing to do here - it means the repository would have been constructed incorrectly
+ log.debug( e.getMessage(), e );
}
}
}
* @throws LayoutException
*/
public Set<ArtifactReference> getRelatedArtifacts( ArtifactReference reference )
- throws ContentNotFoundException, LayoutException;
+ throws ContentNotFoundException;
/**
* <p>
* @throws LayoutException
*/
public Set<String> getVersions( VersionedReference reference )
- throws ContentNotFoundException, LayoutException;
+ throws ContentNotFoundException;
/**
* Determines if the artifact referenced exists in the repository.
import org.apache.maven.archiva.model.ProjectReference;
import org.apache.maven.archiva.model.VersionedReference;
import org.apache.maven.archiva.repository.layout.LayoutException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* AbstractDefaultRepositoryContent - common methods for working with default (maven 2) layout.
*/
public abstract class AbstractDefaultRepositoryContent
{
+ protected Logger log = LoggerFactory.getLogger( AbstractDefaultRepositoryContent.class );
+
public static final String MAVEN_METADATA = "maven-metadata.xml";
protected static final char PATH_SEPARATOR = '/';
* under the License.
*/
+import java.io.File;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
+
import org.apache.commons.io.FileUtils;
import org.apache.maven.archiva.common.utils.PathUtil;
import org.apache.maven.archiva.configuration.FileTypes;
import org.apache.maven.archiva.repository.ManagedRepositoryContent;
import org.apache.maven.archiva.repository.layout.LayoutException;
-import java.io.File;
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.Set;
-
/**
* ManagedDefaultRepositoryContent
*
}
public Set<ArtifactReference> getRelatedArtifacts( ArtifactReference reference )
- throws ContentNotFoundException, LayoutException
+ throws ContentNotFoundException
{
File artifactFile = toFile( reference );
File repoDir = artifactFile.getParentFile();
if ( filetypes.matchesArtifactPattern( relativePath ) )
{
- ArtifactReference artifact = toArtifactReference( relativePath );
-
- // Test for related, groupId / artifactId / version must match.
- if ( artifact.getGroupId().equals( reference.getGroupId() )
- && artifact.getArtifactId().equals( reference.getArtifactId() )
- && artifact.getVersion().equals( reference.getVersion() ) )
+ try
+ {
+ ArtifactReference artifact = toArtifactReference( relativePath );
+
+ // Test for related, groupId / artifactId / version must match.
+ if ( artifact.getGroupId().equals( reference.getGroupId() )
+ && artifact.getArtifactId().equals( reference.getArtifactId() )
+ && artifact.getVersion().equals( reference.getVersion() ) )
+ {
+ foundArtifacts.add( artifact );
+ }
+ }
+ catch ( LayoutException e )
{
- foundArtifacts.add( artifact );
+ log.debug( "Not processing file that is not an artifact: " + e.getMessage() );
}
}
}
}
public Set<String> getVersions( VersionedReference reference )
- throws ContentNotFoundException, LayoutException
+ throws ContentNotFoundException
{
String path = toMetadataPath( reference );
if ( filetypes.matchesArtifactPattern( relativePath ) )
{
- ArtifactReference artifact = toArtifactReference( relativePath );
-
- foundVersions.add( artifact.getVersion() );
+ try
+ {
+ ArtifactReference artifact = toArtifactReference( relativePath );
+
+ foundVersions.add( artifact.getVersion() );
+ }
+ catch ( LayoutException e )
+ {
+ log.debug( "Not processing file that is not an artifact: " + e.getMessage() );
+ }
}
}
}
public Set<ArtifactReference> getRelatedArtifacts( ArtifactReference reference )
- throws ContentNotFoundException, LayoutException
+ throws ContentNotFoundException
{
File artifactFile = toFile( reference );
File repoDir = artifactFile.getParentFile();