mirror of https://github.com/apache/archiva.git
simplify inject of bean list
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1160293 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0c7626a137
commit
30ebe43f59
|
@ -27,5 +27,5 @@ package org.apache.maven.archiva.consumers;
|
||||||
public interface KnownRepositoryContentConsumer
|
public interface KnownRepositoryContentConsumer
|
||||||
extends RepositoryContentConsumer
|
extends RepositoryContentConsumer
|
||||||
{
|
{
|
||||||
|
// no op
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,12 +107,13 @@ public class RepositoryPurgeConsumer
|
||||||
|
|
||||||
private boolean deleteReleasedSnapshots;
|
private boolean deleteReleasedSnapshots;
|
||||||
|
|
||||||
@Inject
|
//@Inject
|
||||||
private ApplicationContext applicationContext;
|
//private ApplicationContext applicationContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* plexus.requirement role="org.apache.archiva.repository.events.RepositoryListener"
|
* plexus.requirement role="org.apache.archiva.repository.events.RepositoryListener"
|
||||||
*/
|
*/
|
||||||
|
@Inject
|
||||||
private List<RepositoryListener> listeners = Collections.emptyList();
|
private List<RepositoryListener> listeners = Collections.emptyList();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -250,8 +251,8 @@ public class RepositoryPurgeConsumer
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void initialize()
|
public void initialize()
|
||||||
{
|
{
|
||||||
this.listeners =
|
//this.listeners =
|
||||||
new ArrayList<RepositoryListener>( applicationContext.getBeansOfType( RepositoryListener.class ).values() );
|
// new ArrayList<RepositoryListener>( applicationContext.getBeansOfType( RepositoryListener.class ).values() );
|
||||||
configuration.addChangeListener( this );
|
configuration.addChangeListener( this );
|
||||||
|
|
||||||
initIncludes();
|
initIncludes();
|
||||||
|
|
|
@ -116,22 +116,25 @@ public class DefaultRepositoryProxyConnectors
|
||||||
@Named( value = "metadataTools#default" )
|
@Named( value = "metadataTools#default" )
|
||||||
private MetadataTools metadataTools;
|
private MetadataTools metadataTools;
|
||||||
|
|
||||||
@Inject
|
//@Inject
|
||||||
private ApplicationContext applicationContext;
|
//private ApplicationContext applicationContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* plexus.requirement role="org.apache.maven.archiva.policies.PreDownloadPolicy"
|
* plexus.requirement role="org.apache.maven.archiva.policies.PreDownloadPolicy"
|
||||||
*/
|
*/
|
||||||
|
@Inject
|
||||||
private Map<String, PreDownloadPolicy> preDownloadPolicies;
|
private Map<String, PreDownloadPolicy> preDownloadPolicies;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* plexus.requirement role="org.apache.maven.archiva.policies.PostDownloadPolicy"
|
* plexus.requirement role="org.apache.maven.archiva.policies.PostDownloadPolicy"
|
||||||
*/
|
*/
|
||||||
|
@Inject
|
||||||
private Map<String, PostDownloadPolicy> postDownloadPolicies;
|
private Map<String, PostDownloadPolicy> postDownloadPolicies;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* plexus.requirement role="org.apache.maven.archiva.policies.DownloadErrorPolicy"
|
* plexus.requirement role="org.apache.maven.archiva.policies.DownloadErrorPolicy"
|
||||||
*/
|
*/
|
||||||
|
@Inject
|
||||||
private Map<String, DownloadErrorPolicy> downloadErrorPolicies;
|
private Map<String, DownloadErrorPolicy> downloadErrorPolicies;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -162,9 +165,9 @@ public class DefaultRepositoryProxyConnectors
|
||||||
{
|
{
|
||||||
initConnectorsAndNetworkProxies();
|
initConnectorsAndNetworkProxies();
|
||||||
archivaConfiguration.addChangeListener( this );
|
archivaConfiguration.addChangeListener( this );
|
||||||
this.postDownloadPolicies = applicationContext.getBeansOfType( PostDownloadPolicy.class );
|
//this.postDownloadPolicies = applicationContext.getBeansOfType( PostDownloadPolicy.class );
|
||||||
this.preDownloadPolicies = applicationContext.getBeansOfType( PreDownloadPolicy.class );
|
//his.preDownloadPolicies = applicationContext.getBeansOfType( PreDownloadPolicy.class );
|
||||||
this.downloadErrorPolicies = applicationContext.getBeansOfType( DownloadErrorPolicy.class );
|
//this.downloadErrorPolicies = applicationContext.getBeansOfType( DownloadErrorPolicy.class );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings( "unchecked" )
|
@SuppressWarnings( "unchecked" )
|
||||||
|
|
|
@ -62,16 +62,17 @@ public abstract class AbstractDefaultRepositoryContent
|
||||||
/**
|
/**
|
||||||
* plexus.requirement role="org.apache.archiva.metadata.repository.storage.maven2.ArtifactMappingProvider"
|
* plexus.requirement role="org.apache.archiva.metadata.repository.storage.maven2.ArtifactMappingProvider"
|
||||||
*/
|
*/
|
||||||
protected List<? extends ArtifactMappingProvider> artifactMappingProviders;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected ApplicationContext applicationContext;
|
protected List<ArtifactMappingProvider> artifactMappingProviders;
|
||||||
|
|
||||||
|
//@Inject
|
||||||
|
//protected ApplicationContext applicationContext;
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
protected void initialize()
|
protected void initialize()
|
||||||
{
|
{
|
||||||
artifactMappingProviders = new ArrayList<ArtifactMappingProvider>(
|
//artifactMappingProviders = new ArrayList<ArtifactMappingProvider>(
|
||||||
applicationContext.getBeansOfType( ArtifactMappingProvider.class ).values() );
|
// applicationContext.getBeansOfType( ArtifactMappingProvider.class ).values() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArtifactReference toArtifactReference( String path )
|
public ArtifactReference toArtifactReference( String path )
|
||||||
|
|
|
@ -58,6 +58,7 @@ public abstract class AbstractActionSupport
|
||||||
/**
|
/**
|
||||||
* plexus.requirement role="org.apache.archiva.audit.AuditListener"
|
* plexus.requirement role="org.apache.archiva.audit.AuditListener"
|
||||||
*/
|
*/
|
||||||
|
@Inject
|
||||||
private List<AuditListener> auditListeners = new ArrayList<AuditListener>();
|
private List<AuditListener> auditListeners = new ArrayList<AuditListener>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -75,8 +76,7 @@ public abstract class AbstractActionSupport
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void initialize()
|
public void initialize()
|
||||||
{
|
{
|
||||||
// TODO some caching here
|
// no op
|
||||||
this.auditListeners = Lists.newArrayList( applicationContext.getBeansOfType( AuditListener.class ).values() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings( "unchecked" )
|
@SuppressWarnings( "unchecked" )
|
||||||
|
|
|
@ -125,6 +125,7 @@ public class DeleteArtifactAction
|
||||||
/**
|
/**
|
||||||
* plexus.requirement role="org.apache.archiva.repository.events.RepositoryListener"
|
* plexus.requirement role="org.apache.archiva.repository.events.RepositoryListener"
|
||||||
*/
|
*/
|
||||||
|
@Inject
|
||||||
private List<RepositoryListener> listeners;
|
private List<RepositoryListener> listeners;
|
||||||
|
|
||||||
private ChecksumAlgorithm[] algorithms = new ChecksumAlgorithm[]{ ChecksumAlgorithm.SHA1, ChecksumAlgorithm.MD5 };
|
private ChecksumAlgorithm[] algorithms = new ChecksumAlgorithm[]{ ChecksumAlgorithm.SHA1, ChecksumAlgorithm.MD5 };
|
||||||
|
@ -133,7 +134,6 @@ public class DeleteArtifactAction
|
||||||
public void initialize()
|
public void initialize()
|
||||||
{
|
{
|
||||||
super.initialize();
|
super.initialize();
|
||||||
listeners = Lists.newArrayList( applicationContext.getBeansOfType( RepositoryListener.class ).values() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getGroupId()
|
public String getGroupId()
|
||||||
|
|
|
@ -110,6 +110,7 @@ public class ArchivaDavResourceFactory
|
||||||
/**
|
/**
|
||||||
* plexus.requirement role="org.apache.archiva.audit.AuditListener"
|
* plexus.requirement role="org.apache.archiva.audit.AuditListener"
|
||||||
*/
|
*/
|
||||||
|
@Inject
|
||||||
private List<AuditListener> auditListeners = new ArrayList<AuditListener>();
|
private List<AuditListener> auditListeners = new ArrayList<AuditListener>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -145,7 +146,6 @@ public class ArchivaDavResourceFactory
|
||||||
/**
|
/**
|
||||||
* plexus.requirement
|
* plexus.requirement
|
||||||
*/
|
*/
|
||||||
//Inject
|
|
||||||
private ArchivaConfiguration archivaConfiguration;
|
private ArchivaConfiguration archivaConfiguration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -169,21 +169,16 @@ public class ArchivaDavResourceFactory
|
||||||
/**
|
/**
|
||||||
* plexus.requirement
|
* plexus.requirement
|
||||||
*/
|
*/
|
||||||
//Inject
|
|
||||||
private ChecksumFile checksum;
|
private ChecksumFile checksum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* plexus.requirement role-hint="sha1"
|
* plexus.requirement role-hint="sha1"
|
||||||
*/
|
*/
|
||||||
//Inject
|
|
||||||
//Named( value = "digester#sha1" )
|
|
||||||
private Digester digestSha1;
|
private Digester digestSha1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* plexus.requirement role-hint="md5";
|
* plexus.requirement role-hint="md5";
|
||||||
*/
|
*/
|
||||||
//Inject
|
|
||||||
//Named( value = "digester#md5" )
|
|
||||||
private Digester digestMd5;
|
private Digester digestMd5;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -193,7 +188,6 @@ public class ArchivaDavResourceFactory
|
||||||
@Named( value = "archivaTaskScheduler#repository" )
|
@Named( value = "archivaTaskScheduler#repository" )
|
||||||
private RepositoryArchivaTaskScheduler scheduler;
|
private RepositoryArchivaTaskScheduler scheduler;
|
||||||
|
|
||||||
//Inject
|
|
||||||
private ApplicationContext applicationContext;
|
private ApplicationContext applicationContext;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
@ -209,8 +203,6 @@ public class ArchivaDavResourceFactory
|
||||||
this.digestSha1 = plexusSisuBridge.lookup( Digester.class, "sha1" );
|
this.digestSha1 = plexusSisuBridge.lookup( Digester.class, "sha1" );
|
||||||
|
|
||||||
repositoryRequest = new RepositoryRequest( new LegacyPathParser( archivaConfiguration ) );
|
repositoryRequest = new RepositoryRequest( new LegacyPathParser( archivaConfiguration ) );
|
||||||
this.auditListeners =
|
|
||||||
new ArrayList<AuditListener>( applicationContext.getBeansOfType( AuditListener.class ).values() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
|
|
|
@ -82,17 +82,18 @@ public class DefaultMetadataResolver
|
||||||
/**
|
/**
|
||||||
* plexus.requirement role="org.apache.archiva.repository.events.RepositoryListener"
|
* plexus.requirement role="org.apache.archiva.repository.events.RepositoryListener"
|
||||||
*/
|
*/
|
||||||
|
@Inject
|
||||||
private List<RepositoryListener> listeners;
|
private List<RepositoryListener> listeners;
|
||||||
|
|
||||||
|
|
||||||
@Inject
|
//@Inject
|
||||||
private ApplicationContext applicationContext;
|
//private ApplicationContext applicationContext;
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
private void initialize()
|
private void initialize()
|
||||||
{
|
{
|
||||||
listeners =
|
//listeners =
|
||||||
new ArrayList<RepositoryListener>( applicationContext.getBeansOfType( RepositoryListener.class ).values() );
|
// new ArrayList<RepositoryListener>( applicationContext.getBeansOfType( RepositoryListener.class ).values() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProjectVersionMetadata resolveProjectVersion( RepositorySession session, String repoId, String namespace,
|
public ProjectVersionMetadata resolveProjectVersion( RepositorySession session, String repoId, String namespace,
|
||||||
|
|
|
@ -46,13 +46,14 @@ public class Maven2RepositoryPathTranslator
|
||||||
|
|
||||||
private static final Pattern TIMESTAMP_PATTERN = Pattern.compile( "([0-9]{8}.[0-9]{6})-([0-9]+).*" );
|
private static final Pattern TIMESTAMP_PATTERN = Pattern.compile( "([0-9]{8}.[0-9]{6})-([0-9]+).*" );
|
||||||
|
|
||||||
@Inject
|
//@Inject
|
||||||
private ApplicationContext applicationContext;
|
//private ApplicationContext applicationContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* plexus.requirement role="org.apache.archiva.metadata.repository.storage.maven2.ArtifactMappingProvider"
|
* plexus.requirement role="org.apache.archiva.metadata.repository.storage.maven2.ArtifactMappingProvider"
|
||||||
* see #initialize
|
* see #initialize
|
||||||
*/
|
*/
|
||||||
|
@Inject
|
||||||
private List<ArtifactMappingProvider> artifactMappingProviders;
|
private List<ArtifactMappingProvider> artifactMappingProviders;
|
||||||
|
|
||||||
public Maven2RepositoryPathTranslator()
|
public Maven2RepositoryPathTranslator()
|
||||||
|
@ -63,8 +64,9 @@ public class Maven2RepositoryPathTranslator
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void initialize()
|
public void initialize()
|
||||||
{
|
{
|
||||||
artifactMappingProviders = new ArrayList<ArtifactMappingProvider>(
|
|
||||||
applicationContext.getBeansOfType( ArtifactMappingProvider.class ).values() );
|
//artifactMappingProviders = new ArrayList<ArtifactMappingProvider>(
|
||||||
|
// applicationContext.getBeansOfType( ArtifactMappingProvider.class ).values() );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue