import org.apache.archiva.redback.components.registry.RegistryListener;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
// it's prototype bean so we assume configuration won't change during a run
//, RegistryListener
{
+
+ private Logger log = LoggerFactory.getLogger( ArtifactMissingChecksumsConsumer.class );
+
private String id = "create-missing-checksums";
private String description = "Create Missing and/or Fix Invalid Checksums (.sha1, .md5)";
if ( !checksum.isValidChecksum( checksumAlgorithm[0] ) )
{
checksum.fixChecksums( checksumAlgorithm );
+ log.info( "Fixed checksum file {}", checksumFile.getAbsolutePath() );
triggerConsumerInfo( "Fixed checksum file " + checksumFile.getAbsolutePath() );
}
}
catch ( IOException e )
{
+ log.error( "Cannot calculate checksum for file {} :", checksumFile, e );
triggerConsumerError( TYPE_CHECKSUM_CANNOT_CALC, "Cannot calculate checksum for file " + checksumFile +
": " + e.getMessage() );
}
try
{
checksum.createChecksum( checksumAlgorithm[0] );
+ log.info( "Created missing checksum file {}", checksumFile.getAbsolutePath() );
triggerConsumerInfo( "Created missing checksum file " + checksumFile.getAbsolutePath() );
}
catch ( IOException e )
{
+ log.error( "Cannot create checksum for file {} :", checksumFile, e );
triggerConsumerError( TYPE_CHECKSUM_CANNOT_CREATE, "Cannot create checksum for file " + checksumFile +
": " + e.getMessage() );
}
}
else
{
+ log.warn( "Checksum file {} is not a file. ", checksumFile.getAbsolutePath() );
triggerConsumerWarning( TYPE_CHECKSUM_NOT_FILE,
"Checksum file " + checksumFile.getAbsolutePath() + " is not a file." );
}
import org.apache.archiva.redback.components.registry.RegistryListener;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
extends AbstractMonitoredConsumer
implements KnownRepositoryContentConsumer, RegistryListener
{
+
+ private Logger log = LoggerFactory.getLogger( AutoRemoveConsumer.class );
+
/**
* default-value="auto-remove"
*/
File file = new File( this.repositoryDir, path );
if ( file.exists() )
{
+ log.info( "(Auto) Removing File: {}", file.getAbsolutePath() );
triggerConsumerInfo( "(Auto) Removing File: " + file.getAbsolutePath() );
file.delete();
}
import org.apache.commons.io.FileUtils;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
extends AbstractMonitoredConsumer
implements KnownRepositoryContentConsumer
{
+ private Logger log = LoggerFactory.getLogger( AutoRenameConsumer.class );
+
private String id = "auto-rename";
private String description = "Automatically rename common artifact mistakes.";
}
catch ( IOException e )
{
+ log.warn( "Unable to rename {} to {} :", path, correctedPath, e );
triggerConsumerWarning( RENAME_FAILURE, "Unable to rename " + path + " to " + correctedPath +
": " + e.getMessage() );
}
}
}
+ log.info( "(Auto) Removing File: {} ", file.getAbsolutePath() );
triggerConsumerInfo( "(Auto) Removing File: " + file.getAbsolutePath() );
file.delete();
}
}
catch ( LayoutException e )
{
+ log.warn( "Unable to convert path [{}] to an internal project reference: ", path, e );
triggerConsumerWarning( TYPE_METADATA_BAD_INTERNAL_REF,
"Unable to convert path [" + path + "] to an internal project reference: "
+ e.getMessage() );
}
catch ( RepositoryMetadataException e )
{
+ log.error( "Unable to write project metadat for artifact [{}]:", path, e );
triggerConsumerError( TYPE_METADATA_WRITE_FAILURE,
"Unable to write project metadata for artifact [" + path + "]: " + e.getMessage() );
}
catch ( IOException e )
{
+ log.warn( "Project metadata not written due to IO warning: ", e );
triggerConsumerWarning( TYPE_METADATA_IO,
"Project metadata not written due to IO warning: " + e.getMessage() );
}
catch ( ContentNotFoundException e )
{
+ log.warn( "Project metadata not written because no versions were found to update: ", e );
triggerConsumerWarning( TYPE_METADATA_IO,
"Project metadata not written because no versions were found to update: "
+ e.getMessage() );
}
catch ( LayoutException e )
{
+ log.warn( "Unable to convert path [{}] to an internal version reference: ", path, e );
triggerConsumerWarning( TYPE_METADATA_BAD_INTERNAL_REF,
"Unable to convert path [" + path + "] to an internal version reference: "
+ e.getMessage() );
}
catch ( RepositoryMetadataException e )
{
+ log.error( "Unable to write version metadata for artifact [{}]: ", path, e );
triggerConsumerError( TYPE_METADATA_WRITE_FAILURE,
"Unable to write version metadata for artifact [" + path + "]: " + e.getMessage() );
}
catch ( IOException e )
{
+ log.warn( "Version metadata not written due to IO warning: ", e );
triggerConsumerWarning( TYPE_METADATA_IO,
"Version metadata not written due to IO warning: " + e.getMessage() );
}
catch ( ContentNotFoundException e )
{
+ log.warn( "Version metadata not written because no versions were found to update: ", e );
triggerConsumerWarning( TYPE_METADATA_IO,
"Version metadata not written because no versions were found to update: "
+ e.getMessage() );
import org.codehaus.plexus.digest.DigesterException;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
extends AbstractMonitoredConsumer
implements KnownRepositoryContentConsumer
{
+ private Logger log = LoggerFactory.getLogger( ValidateChecksumConsumer.class );
+
private static final String NOT_VALID_CHECKSUM = "checksum-not-valid";
private static final String CHECKSUM_NOT_FOUND = "checksum-not-found";
{
if ( !checksum.isValidChecksum( checksumFile ) )
{
+ log.warn( "The checksum for {} is invalid.", checksumFile );
triggerConsumerWarning( NOT_VALID_CHECKSUM, "The checksum for " + checksumFile + " is invalid." );
}
}
catch ( FileNotFoundException e )
{
+ log.error( "File not found during checksum validation: ", e );
triggerConsumerError( CHECKSUM_NOT_FOUND, "File not found during checksum validation: " + e.getMessage() );
}
catch ( DigesterException e )
{
+ log.error( "Digester failure during checksum validation on {}", checksumFile );
triggerConsumerError( CHECKSUM_DIGESTER_FAILURE,
"Digester failure during checksum validation on " + checksumFile );
}
catch ( IOException e )
{
+ log.error( "Checksum I/O error during validation on {}", checksumFile );
triggerConsumerError( CHECKSUM_IO_ERROR, "Checksum I/O error during validation on " + checksumFile );
}
}