import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.policies.ProxyDownloadException;
import org.apache.archiva.proxy.RepositoryProxyConnectors;
+import org.apache.archiva.redback.authentication.AuthenticationException;
+import org.apache.archiva.redback.authentication.AuthenticationResult;
+import org.apache.archiva.redback.authorization.AuthorizationException;
+import org.apache.archiva.redback.authorization.UnauthorizedException;
+import org.apache.archiva.redback.integration.filter.authentication.HttpAuthenticator;
+import org.apache.archiva.redback.policy.AccountLockedException;
+import org.apache.archiva.redback.policy.MustChangePasswordException;
+import org.apache.archiva.redback.system.SecuritySession;
+import org.apache.archiva.redback.users.User;
+import org.apache.archiva.redback.users.UserManager;
import org.apache.archiva.repository.ManagedRepositoryContent;
import org.apache.archiva.repository.RepositoryContentFactory;
import org.apache.archiva.repository.RepositoryException;
import org.codehaus.plexus.digest.ChecksumFile;
import org.codehaus.plexus.digest.Digester;
import org.codehaus.plexus.digest.DigesterException;
-import org.apache.archiva.redback.authentication.AuthenticationException;
-import org.apache.archiva.redback.authentication.AuthenticationResult;
-import org.apache.archiva.redback.authorization.AuthorizationException;
-import org.apache.archiva.redback.authorization.UnauthorizedException;
-import org.apache.archiva.redback.policy.AccountLockedException;
-import org.apache.archiva.redback.policy.MustChangePasswordException;
-import org.apache.archiva.redback.system.SecuritySession;
-import org.apache.archiva.redback.users.User;
-import org.apache.archiva.redback.users.UserManager;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-import org.apache.archiva.redback.integration.filter.authentication.HttpAuthenticator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
/**
*
*/
-@Service( "davResourceFactory#archiva" )
+@Service ( "davResourceFactory#archiva" )
public class ArchivaDavResourceFactory
implements DavResourceFactory, Auditable
{
*
*/
@Inject
- @Named( value = "repositoryProxyConnectors#default" )
+ @Named ( value = "repositoryProxyConnectors#default" )
private RepositoryProxyConnectors connectors;
/**
*
*/
@Inject
- @Named( value = "httpAuthenticator#basic" )
+ @Named ( value = "httpAuthenticator#basic" )
private HttpAuthenticator httpAuth;
@Inject
*
*/
@Inject
- @Named( value = "archivaTaskScheduler#repository" )
+ @Named ( value = "archivaTaskScheduler#repository" )
private RepositoryArchivaTaskScheduler scheduler;
private ApplicationContext applicationContext;
String event = ( previouslyExisted ? AuditEvent.MODIFY_FILE : AuditEvent.CREATE_FILE )
+ PROXIED_SUFFIX;
- if ( log.isDebugEnabled() )
- {
- log.debug( "Proxied artifact '" + resourceFile.getName() + "' in repository '"
- + managedRepository.getId() + "' (current user '" + activePrincipal
- + "')" );
- }
+ log.debug( "Proxied artifact '{}' in repository '{}' (current user '{}')",
+ resourceFile.getName(), managedRepository.getId(), activePrincipal );
+
triggerAuditEvent( request.getRemoteAddr(), archivaLocator.getRepositoryId(),
logicalResource.getPath(), event, activePrincipal );
}
return ( proxiedFile != null );
}
-
+
// Not any of the above? Then it's gotta be an artifact reference.
try
{
File proxiedFile = connectors.fetchFromProxies( managedRepository, artifact );
resource.setPath( managedRepository.toPath( artifact ) );
- if ( log.isDebugEnabled() )
- {
- log.debug( "Proxied artifact '" + artifact.getGroupId() + ":" + artifact.getArtifactId() + ":"
- + artifact.getVersion() + "'" );
- }
+
+ log.debug( "Proxied artifact '{}:{}:{}'", artifact.getGroupId(), artifact.getArtifactId(),
+ artifact.getVersion() );
+
return ( proxiedFile != null );
}
}
Model model = null;
try
{
- model = mavenXpp3Reader.read(reader);
+ model = mavenXpp3Reader.read( reader );
}
finally
{
catch ( DavException e )
{
// TODO: review exception handling
- if ( log.isDebugEnabled() )
- {
- log.debug( "Skipping repository '" + managedRepository + "' for user '"
- + activePrincipal + "': " + e.getMessage() );
- }
+
+ log.debug( "Skipping repository '{}' for user '{}': {}", managedRepository,
+ activePrincipal, e.getMessage() );
+
}
}
catch ( UnauthorizedException e )
{
// TODO: review exception handling
- if ( log.isDebugEnabled() )
- {
- log.debug( "Skipping repository '" + managedRepository + "' for user '"
- + activePrincipal + "': " + e.getMessage() );
- }
+
+ log.debug( "Skipping repository '{}' for user '{}': {}", managedRepository,
+ activePrincipal, e.getMessage() );
+
}
}
}
catch ( UnauthorizedException e )
{
// TODO: review exception handling
- if ( log.isDebugEnabled() )
- {
- log.debug( "Skipping repository '" + repository + "' for user '" + activePrincipal + "': "
- + e.getMessage() );
- }
+
+ log.debug( "Skipping repository '{}' for user '{}': {}", repository, activePrincipal,
+ e.getMessage() );
}
}
IndexingContext indexingContext = indexMerger.buildMergedIndex( authzRepos, true );
import org.apache.archiva.admin.model.beans.ManagedRepository;
import org.apache.archiva.checksum.ChecksumAlgorithm;
import org.apache.archiva.checksum.ChecksummedFile;
-import org.apache.archiva.metadata.model.ArtifactMetadata;
-import org.apache.archiva.metadata.repository.MetadataRepository;
-import org.apache.archiva.metadata.repository.MetadataRepositoryException;
-import org.apache.archiva.metadata.repository.RepositorySession;
-import org.apache.archiva.metadata.repository.RepositorySessionFactory;
-import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator;
-import org.apache.archiva.reports.RepositoryProblemFacet;
-import org.apache.commons.collections.CollectionUtils;
import org.apache.archiva.configuration.ArchivaConfiguration;
import org.apache.archiva.configuration.ConfigurationNames;
import org.apache.archiva.configuration.FileTypes;
import org.apache.archiva.consumers.AbstractMonitoredConsumer;
import org.apache.archiva.consumers.ConsumerException;
import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
+import org.apache.archiva.metadata.model.ArtifactMetadata;
+import org.apache.archiva.metadata.repository.MetadataRepository;
+import org.apache.archiva.metadata.repository.MetadataRepositoryException;
+import org.apache.archiva.metadata.repository.RepositorySession;
+import org.apache.archiva.metadata.repository.RepositorySessionFactory;
+import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator;
import org.apache.archiva.redback.components.registry.Registry;
import org.apache.archiva.redback.components.registry.RegistryListener;
+import org.apache.archiva.reports.RepositoryProblemFacet;
+import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Scope;
* Search the artifact repository of known SHA1 Checksums for potential duplicate artifacts.
* <p/>
* TODO: no need for this to be a scanner - we can just query the database / content repository to get a full list
- *
- *
*/
-@Service( "knownRepositoryContentConsumer#duplicate-artifacts" )
-@Scope( "prototype" )
+@Service ( "knownRepositoryContentConsumer#duplicate-artifacts" )
+@Scope ( "prototype" )
public class DuplicateArtifactsConsumer
extends AbstractMonitoredConsumer
implements KnownRepositoryContentConsumer, RegistryListener
/**
* FIXME: can be of other types
- *
*/
@Inject
private RepositorySessionFactory repositorySessionFactory;
/**
* FIXME: needs to be selected based on the repository in question
- *
*/
@Inject
- @Named( value = "repositoryPathTranslator#maven2" )
+ @Named ( value = "repositoryPathTranslator#maven2" )
private RepositoryPathTranslator pathTranslator;
private RepositorySession repositorySession;
for ( ArtifactMetadata dupArtifact : results )
{
String id = path.substring( path.lastIndexOf( "/" ) + 1 );
- if ( dupArtifact.getId().equals( id )
- && dupArtifact.getNamespace().equals( originalArtifact.getNamespace() )
- && dupArtifact.getProject().equals( originalArtifact.getProject() )
- && dupArtifact.getVersion().equals( originalArtifact.getVersion() ) )
+ if ( dupArtifact.getId().equals( id ) && dupArtifact.getNamespace().equals(
+ originalArtifact.getNamespace() ) && dupArtifact.getProject().equals(
+ originalArtifact.getProject() ) && dupArtifact.getVersion().equals(
+ originalArtifact.getVersion() ) )
{
// Skip reference to itself.
- if ( log.isDebugEnabled() )
- {
- log.debug( "Not counting duplicate for artifact " + dupArtifact + " for path " + path );
- }
+
+ log.debug( "Not counting duplicate for artifact {} for path {}", dupArtifact, path );
+
continue;
}