summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2011-06-09 15:23:21 +0000
committerOlivier Lamy <olamy@apache.org>2011-06-09 15:23:21 +0000
commitc90eea8f1c293af3af86875ab83d6999d929d686 (patch)
treebbc9687772dca2a4582541c9e460fe217d7efe69
parent013b9914d8fcc0fdc1f4dd6e745dc6382b21ed3e (diff)
downloadarchiva-c90eea8f1c293af3af86875ab83d6999d929d686.tar.gz
archiva-c90eea8f1c293af3af86875ab83d6999d929d686.zip
remove use of plexus-spring all struts actions are spring beans now. Note still have issues with tomcat plugin and sisu bridge which need an urlclassloader
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1133928 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--archiva-modules/archiva-base/archiva-plexus-bridge/src/main/java/org/apache/archiva/common/plexusbridge/PlexusSisuBridge.java11
-rw-r--r--archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContent.java2
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/pom.xml37
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/AbstractActionSupport.java (renamed from archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/PlexusActionSupport.java)42
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/AbstractRepositoryBasedAction.java7
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java45
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/DeleteArtifactAction.java53
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/MergeAction.java33
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java7
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java8
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java64
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/SchedulerAction.java29
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/SystemStatusAction.java37
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/appearance/AbstractAppearanceAction.java42
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/appearance/EditOrganisationInfoAction.java47
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/appearance/OrganisationInfoAction.java10
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AbstractProxyConnectorAction.java9
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AbstractProxyConnectorFormAction.java20
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AddProxyConnectorAction.java31
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/DeleteProxyConnectorAction.java6
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/DisableProxyConnectorAction.java47
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/EditProxyConnectorAction.java7
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/EnableProxyConnectorAction.java45
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ProxyConnectorsAction.java6
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/SortProxyConnectorsAction.java10
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathAction.java20
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/DeleteLegacyArtifactPathAction.java24
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/LegacyArtifactPathAction.java31
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyAction.java41
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/NetworkProxiesAction.java19
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractManagedRepositoriesAction.java37
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractRepositoriesAdminAction.java21
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryAction.java42
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryAction.java32
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryAction.java12
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRemoteRepositoryAction.java13
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRepositoryGroupAction.java19
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryAction.java8
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditRemoteRepositoryAction.java16
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesAction.java19
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryGroupsAction.java114
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/SortRepositoriesAction.java59
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/RepositoryScanningAction.java53
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/GenerateReportAction.java45
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/ViewAuditLogReportAction.java40
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/interceptor/ConfigurationInterceptor.java10
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/SecuritySynchronization.java65
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DependencyTree.java30
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/resources/struts.properties12
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml284
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/web.xml49
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryActionTest.java2
-rw-r--r--archiva-modules/plugins/maven2-repository/pom.xml10
-rw-r--r--archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java2
-rw-r--r--pom.xml2
55 files changed, 1207 insertions, 579 deletions
diff --git a/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/java/org/apache/archiva/common/plexusbridge/PlexusSisuBridge.java b/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/java/org/apache/archiva/common/plexusbridge/PlexusSisuBridge.java
index 5de3cc7de..9ad803049 100644
--- a/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/java/org/apache/archiva/common/plexusbridge/PlexusSisuBridge.java
+++ b/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/java/org/apache/archiva/common/plexusbridge/PlexusSisuBridge.java
@@ -68,7 +68,16 @@ public class PlexusSisuBridge
ClassWorld classWorld = new ClassWorld();
- ClassRealm classRealm = new ClassRealm( classWorld, "maven", Thread.currentThread().getContextClassLoader() );
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+
+ ClassRealm classRealm = new ClassRealm( classWorld, "maven", tccl )
+ {
+ public URL[] getURLs()
+ {
+ return super.getURLs();
+ }
+
+ };
conf.setRealm( classRealm );
conf.setClassWorld( classWorld );
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContent.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContent.java
index 0ba6d1869..6bbd61527 100644
--- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContent.java
+++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContent.java
@@ -46,7 +46,7 @@ import java.util.Set;
*
* @todo no need to be a component when filetypes, legacy path parser is not
*
- * @plexus.component
+ * plexus.component
* role="org.apache.maven.archiva.repository.ManagedRepositoryContent"
* role-hint="legacy"
* instantiation-strategy="per-lookup"
diff --git a/archiva-modules/archiva-web/archiva-webapp/pom.xml b/archiva-modules/archiva-web/archiva-webapp/pom.xml
index 849a626c9..e70751fdc 100644
--- a/archiva-modules/archiva-web/archiva-webapp/pom.xml
+++ b/archiva-modules/archiva-web/archiva-webapp/pom.xml
@@ -300,6 +300,31 @@
<groupId>org.apache.archiva</groupId>
<artifactId>metadata-model</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-model</artifactId>
+ <version>${maven3x.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-model-builder</artifactId>
+ <version>${maven3x.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.sonatype.sisu</groupId>
+ <artifactId>sisu-inject-plexus</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.sonatype.sisu</groupId>
+ <artifactId>sisu-guice</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-plexus-bridge</artifactId>
+ </dependency>
+
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>metadata-repository-api</artifactId>
@@ -537,18 +562,6 @@
</execution>
</executions>
</plugin>
- <plugin>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-component-metadata</artifactId>
- <configuration>
- <roleDefaults>
- <roleDefault>
- <role>com.opensymphony.xwork2.Action</role>
- <instantiation-strategy>per-lookup</instantiation-strategy>
- </roleDefault>
- </roleDefaults>
- </configuration>
- </plugin>
</plugins>
</build>
<profiles>
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/PlexusActionSupport.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/AbstractActionSupport.java
index d42d78245..9b54c99c3 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/PlexusActionSupport.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/AbstractActionSupport.java
@@ -19,27 +19,33 @@ package org.apache.maven.archiva.web.action;
* under the License.
*/
+import com.google.common.collect.Lists;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.archiva.audit.AuditEvent;
import org.apache.archiva.audit.AuditListener;
import org.apache.archiva.audit.Auditable;
import org.apache.archiva.metadata.repository.RepositorySessionFactory;
+import org.apache.commons.lang.StringUtils;
import org.apache.maven.archiva.security.ArchivaXworkUser;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.interceptor.SessionAware;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.context.ApplicationContext;
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import javax.servlet.http.HttpServletRequest;
/**
* LogEnabled and SessionAware ActionSupport
*/
-public abstract class PlexusActionSupport
+public abstract class AbstractActionSupport
extends ActionSupport
implements SessionAware, Auditable
{
@@ -48,17 +54,28 @@ public abstract class PlexusActionSupport
protected Logger log = LoggerFactory.getLogger( getClass() );
/**
- * @plexus.requirement role="org.apache.archiva.audit.AuditListener"
+ * plexus.requirement role="org.apache.archiva.audit.AuditListener"
*/
private List<AuditListener> auditListeners = new ArrayList<AuditListener>();
/**
- * @plexus.requirement
+ * plexus.requirement
*/
+ @Inject
protected RepositorySessionFactory repositorySessionFactory;
+ @Inject
+ protected ApplicationContext applicationContext;
+
private String principal;
+ @PostConstruct
+ public void initialize()
+ {
+ // TODO some caching here
+ this.auditListeners = Lists.newArrayList( applicationContext.getBeansOfType( AuditListener.class ).values() );
+ }
+
@SuppressWarnings( "unchecked" )
public void setSession( Map map )
{
@@ -143,4 +160,21 @@ public abstract class PlexusActionSupport
{
this.repositorySessionFactory = repositorySessionFactory;
}
+
+ protected <T> Map<String, T> getBeansOfType( Class<T> clazz )
+ {
+ //TODO do some caching here !!!
+ // olamy : with plexus we get only roleHint
+ // as per convention we named spring bean role#hint remove role# if exists
+ Map<String, T> springBeans = applicationContext.getBeansOfType( clazz );
+
+ Map<String, T> beans = new HashMap<String, T>( springBeans.size() );
+
+ for ( Map.Entry<String, T> entry : springBeans.entrySet() )
+ {
+ String key = StringUtils.substringAfterLast( entry.getKey(), "#" );
+ beans.put( key, entry.getValue() );
+ }
+ return beans;
+ }
}
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/AbstractRepositoryBasedAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/AbstractRepositoryBasedAction.java
index 835c285d6..709a8cd81 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/AbstractRepositoryBasedAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/AbstractRepositoryBasedAction.java
@@ -27,12 +27,15 @@ import org.apache.maven.archiva.security.ArchivaSecurityException;
import org.apache.maven.archiva.security.PrincipalNotFoundException;
import org.apache.maven.archiva.security.UserRepositories;
+import javax.inject.Inject;
+
public class AbstractRepositoryBasedAction
- extends PlexusActionSupport
+ extends AbstractActionSupport
{
/**
- * @plexus.requirement
+ * plexus.requirement
*/
+ @Inject
private UserRepositories userRepositories;
protected List<String> getObservableRepos()
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java
index c1da5be9f..961839766 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java
@@ -26,6 +26,8 @@ import org.apache.archiva.metadata.repository.RepositorySession;
import org.apache.archiva.metadata.repository.storage.maven2.MavenProjectFacet;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
import java.util.ArrayList;
import java.util.Collection;
@@ -38,8 +40,10 @@ import java.util.Set;
* Browse the repository.
*
* @todo implement repository selectors (all or specific repository)
- * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="browseAction" instantiation-strategy="per-lookup"
+ * plexus.component role="com.opensymphony.xwork2.Action" role-hint="browseAction" instantiation-strategy="per-lookup"
*/
+@Controller( "browseAction" )
+@Scope( "prototype" )
public class BrowseAction
extends AbstractRepositoryBasedAction
{
@@ -172,8 +176,8 @@ public class BrowseAction
for ( String n : namespacesToCollapse )
{
// TODO: check performance of this
- namespaces.add( collapseNamespaces( repositorySession, metadataResolver, selectedRepos,
- groupId + "." + n ) );
+ namespaces.add(
+ collapseNamespaces( repositorySession, metadataResolver, selectedRepos, groupId + "." + n ) );
}
}
finally
@@ -224,8 +228,8 @@ public class BrowseAction
Set<String> versions = new LinkedHashSet<String>();
for ( String repoId : selectedRepos )
{
- versions.addAll( metadataResolver.resolveProjectVersions( repositorySession, repoId, groupId,
- artifactId ) );
+ versions.addAll(
+ metadataResolver.resolveProjectVersions( repositorySession, repoId, groupId, artifactId ) );
}
// TODO: sort by known version ordering method
@@ -262,14 +266,15 @@ public class BrowseAction
{
try
{
- versionMetadata = metadataResolver.resolveProjectVersion( repositorySession, repoId, groupId,
- artifactId, version );
+ versionMetadata =
+ metadataResolver.resolveProjectVersion( repositorySession, repoId, groupId, artifactId,
+ version );
}
catch ( MetadataResolutionException e )
{
log.error(
- "Skipping invalid metadata while compiling shared model for " + groupId + ":" + artifactId +
- " in repo " + repoId + ": " + e.getMessage() );
+ "Skipping invalid metadata while compiling shared model for " + groupId + ":" + artifactId
+ + " in repo " + repoId + ": " + e.getMessage() );
}
}
}
@@ -286,8 +291,8 @@ public class BrowseAction
}
else
{
- MavenProjectFacet versionMetadataMavenFacet = (MavenProjectFacet) versionMetadata.getFacet(
- MavenProjectFacet.FACET_ID );
+ MavenProjectFacet versionMetadataMavenFacet =
+ (MavenProjectFacet) versionMetadata.getFacet( MavenProjectFacet.FACET_ID );
if ( versionMetadataMavenFacet != null )
{
if ( mavenFacet.getPackaging() != null && !StringUtils.equalsIgnoreCase( mavenFacet.getPackaging(),
@@ -309,23 +314,23 @@ public class BrowseAction
sharedModel.setDescription( null );
}
- if ( sharedModel.getIssueManagement() != null && versionMetadata.getIssueManagement() != null &&
- !StringUtils.equalsIgnoreCase( sharedModel.getIssueManagement().getUrl(),
- versionMetadata.getIssueManagement().getUrl() ) )
+ if ( sharedModel.getIssueManagement() != null && versionMetadata.getIssueManagement() != null
+ && !StringUtils.equalsIgnoreCase( sharedModel.getIssueManagement().getUrl(),
+ versionMetadata.getIssueManagement().getUrl() ) )
{
sharedModel.setIssueManagement( null );
}
- if ( sharedModel.getCiManagement() != null && versionMetadata.getCiManagement() != null &&
- !StringUtils.equalsIgnoreCase( sharedModel.getCiManagement().getUrl(),
- versionMetadata.getCiManagement().getUrl() ) )
+ if ( sharedModel.getCiManagement() != null && versionMetadata.getCiManagement() != null
+ && !StringUtils.equalsIgnoreCase( sharedModel.getCiManagement().getUrl(),
+ versionMetadata.getCiManagement().getUrl() ) )
{
sharedModel.setCiManagement( null );
}
- if ( sharedModel.getOrganization() != null && versionMetadata.getOrganization() != null &&
- !StringUtils.equalsIgnoreCase( sharedModel.getOrganization().getName(),
- versionMetadata.getOrganization().getName() ) )
+ if ( sharedModel.getOrganization() != null && versionMetadata.getOrganization() != null
+ && !StringUtils.equalsIgnoreCase( sharedModel.getOrganization().getName(),
+ versionMetadata.getOrganization().getName() ) )
{
sharedModel.setOrganization( null );
}
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/DeleteArtifactAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/DeleteArtifactAction.java
index 177f6b247..dc619c212 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/DeleteArtifactAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/DeleteArtifactAction.java
@@ -19,6 +19,7 @@ package org.apache.maven.archiva.web.action;
* under the License.
*/
+import com.google.common.collect.Lists;
import com.opensymphony.xwork2.Preparable;
import com.opensymphony.xwork2.Validateable;
import org.apache.archiva.audit.AuditEvent;
@@ -51,7 +52,11 @@ import org.apache.maven.archiva.security.AccessDeniedException;
import org.apache.maven.archiva.security.ArchivaSecurityException;
import org.apache.maven.archiva.security.PrincipalNotFoundException;
import org.apache.maven.archiva.security.UserRepositories;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
@@ -65,11 +70,13 @@ import java.util.TimeZone;
/**
* Delete an artifact. Metadata will be updated if one exists, otherwise it would be created.
- *
- * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="deleteArtifactAction" instantiation-strategy="per-lookup"
+ * <p/>
+ * plexus.component role="com.opensymphony.xwork2.Action" role-hint="deleteArtifactAction" instantiation-strategy="per-lookup"
*/
+@Controller( "deleteArtifactAction" )
+@Scope( "prototype" )
public class DeleteArtifactAction
- extends PlexusActionSupport
+ extends AbstractActionSupport
implements Validateable, Preparable, Auditable
{
/**
@@ -98,26 +105,36 @@ public class DeleteArtifactAction
private List<String> managedRepos;
/**
- * @plexus.requirement
+ * plexus.requirement
*/
+ @Inject
private UserRepositories userRepositories;
/**
- * @plexus.requirement role-hint="default"
+ * plexus.requirement role-hint="default"
*/
+ @Inject
private ArchivaConfiguration configuration;
/**
- * @plexus.requirement
+ * plexus.requirement
*/
+ @Inject
private RepositoryContentFactory repositoryFactory;
/**
- * @plexus.requirement role="org.apache.archiva.repository.events.RepositoryListener"
+ * plexus.requirement role="org.apache.archiva.repository.events.RepositoryListener"
*/
private List<RepositoryListener> listeners;
- private ChecksumAlgorithm[] algorithms = new ChecksumAlgorithm[]{ChecksumAlgorithm.SHA1, ChecksumAlgorithm.MD5};
+ private ChecksumAlgorithm[] algorithms = new ChecksumAlgorithm[]{ ChecksumAlgorithm.SHA1, ChecksumAlgorithm.MD5 };
+
+ @PostConstruct
+ public void initialize()
+ {
+ super.initialize();
+ listeners = Lists.newArrayList( applicationContext.getBeansOfType( RepositoryListener.class ).values() );
+ }
public String getGroupId()
{
@@ -196,8 +213,8 @@ public class DeleteArtifactAction
TimeZone timezone = TimeZone.getTimeZone( "UTC" );
DateFormat fmt = new SimpleDateFormat( "yyyyMMdd.HHmmss" );
fmt.setTimeZone( timezone );
- ManagedRepositoryConfiguration repoConfig = configuration.getConfiguration().findManagedRepositoryById(
- repositoryId );
+ ManagedRepositoryConfiguration repoConfig =
+ configuration.getConfiguration().findManagedRepositoryById( repositoryId );
VersionedReference ref = new VersionedReference();
ref.setArtifactId( artifactId );
@@ -229,8 +246,8 @@ public class DeleteArtifactAction
updateMetadata( metadata, metadataFile, lastUpdatedTimestamp );
MetadataRepository metadataRepository = repositorySession.getRepository();
- Collection<ArtifactMetadata> artifacts = metadataRepository.getArtifacts( repositoryId, groupId, artifactId,
- version );
+ Collection<ArtifactMetadata> artifacts =
+ metadataRepository.getArtifacts( repositoryId, groupId, artifactId, version );
for ( ArtifactMetadata artifact : artifacts )
{
@@ -283,8 +300,8 @@ public class DeleteArtifactAction
repositorySession.close();
}
- String msg = "Artifact \'" + groupId + ":" + artifactId + ":" + version +
- "\' was successfully deleted from repository \'" + repositoryId + "\'";
+ String msg = "Artifact \'" + groupId + ":" + artifactId + ":" + version
+ + "\' was successfully deleted from repository \'" + repositoryId + "\'";
addActionMessage( msg );
@@ -420,22 +437,22 @@ public class DeleteArtifactAction
private void trimAllRequestParameterValues()
{
- if( StringUtils.isNotEmpty(groupId))
+ if ( StringUtils.isNotEmpty( groupId ) )
{
groupId = groupId.trim();
}
- if(StringUtils.isNotEmpty(artifactId))
+ if ( StringUtils.isNotEmpty( artifactId ) )
{
artifactId = artifactId.trim();
}
- if(StringUtils.isNotEmpty(version))
+ if ( StringUtils.isNotEmpty( version ) )
{
version = version.trim();
}
- if(StringUtils.isNotEmpty(repositoryId))
+ if ( StringUtils.isNotEmpty( repositoryId ) )
{
repositoryId = repositoryId.trim();
}
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/MergeAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/MergeAction.java
index c985f0e5b..1c86afd14 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/MergeAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/MergeAction.java
@@ -33,33 +33,44 @@ import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.Configuration;
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.web.action.admin.SchedulerAction;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
+import javax.inject.Inject;
+import javax.inject.Named;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
/**
- * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="mergeAction" instantiation-strategy="per-lookup"
+ * plexus.component role="com.opensymphony.xwork2.Action" role-hint="mergeAction" instantiation-strategy="per-lookup"
*/
+@Controller( "mergeAction" )
+@Scope( "prototype" )
public class MergeAction
- extends PlexusActionSupport
+ extends AbstractActionSupport
implements Validateable, Preparable, Auditable
{
/**
- * @plexus.requirement role="org.apache.archiva.stagerepository.merge.RepositoryMerger" role-hint="maven2"
+ * plexus.requirement role="org.apache.archiva.stagerepository.merge.RepositoryMerger" role-hint="maven2"
*/
+ @Inject
+ @Named( value = "repositoryMerger#maven2" )
private Maven2RepositoryMerger repositoryMerger;
/**
- * @plexus.requirement
+ * plexus.requirement
*/
+ @Inject
protected ArchivaConfiguration archivaConfiguration;
/**
- * @plexus.requirement role="com.opensymphony.xwork2.Action" role-hint="schedulerAction"
+ * TODO olamy : why using an action ???
+ * plexus.requirement role="com.opensymphony.xwork2.Action" role-hint="schedulerAction"
*/
+ @Inject
private SchedulerAction scheduler;
private ManagedRepositoryConfiguration repository;
@@ -149,8 +160,8 @@ public class MergeAction
else
{
- Filter<ArtifactMetadata> artifactsWithOutConflicts = new IncludesFilter<ArtifactMetadata>(
- sourceArtifacts );
+ Filter<ArtifactMetadata> artifactsWithOutConflicts =
+ new IncludesFilter<ArtifactMetadata>( sourceArtifacts );
repositoryMerger.merge( metadataRepository, sourceRepoId, repoid, artifactsWithOutConflicts );
for ( ArtifactMetadata metadata : sourceArtifacts )
{
@@ -181,8 +192,8 @@ public class MergeAction
RepositorySession repositorySession = repositorySessionFactory.createSession();
try
{
- conflictSourceArtifacts = repositoryMerger.getConflictingArtifacts( repositorySession.getRepository(),
- sourceRepoId, repoid );
+ conflictSourceArtifacts =
+ repositoryMerger.getConflictingArtifacts( repositorySession.getRepository(), sourceRepoId, repoid );
}
catch ( Exception e )
{
@@ -216,8 +227,8 @@ public class MergeAction
RepositorySession repositorySession = repositorySessionFactory.createSession();
try
{
- conflictSourceArtifacts = repositoryMerger.getConflictingArtifacts( repositorySession.getRepository(),
- sourceRepoId, repoid );
+ conflictSourceArtifacts =
+ repositoryMerger.getConflictingArtifacts( repositorySession.getRepository(), sourceRepoId, repoid );
}
finally
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java
index c3c17048d..818f5e0db 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java
@@ -35,6 +35,8 @@ import org.apache.maven.archiva.common.utils.VersionUtil;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.struts2.ServletActionContext;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
@@ -47,8 +49,10 @@ import java.util.Map;
/**
* Search all indexed fields by the given criteria.
*
- * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="searchAction" instantiation-strategy="per-lookup"
+ * plexus.component role="com.opensymphony.xwork2.Action" role-hint="searchAction" instantiation-strategy="per-lookup"
*/
+@Controller( "searchAction" )
+@Scope( "prototype" )
public class SearchAction
extends AbstractRepositoryBasedAction
implements Preparable
@@ -57,6 +61,7 @@ public class SearchAction
* Query string.
*/
+ // FIXME olamy WTF here??
private ArchivaConfiguration archivaConfiguration;
private String q;
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java
index 92fb80c88..30e134ff3 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java
@@ -38,6 +38,8 @@ import org.apache.maven.archiva.repository.ManagedRepositoryContent;
import org.apache.maven.archiva.repository.RepositoryContentFactory;
import org.apache.maven.archiva.repository.RepositoryException;
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
@@ -56,10 +58,12 @@ import java.util.Map;
*
* TODO change name to ShowVersionedAction to conform to terminology.
*
- * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="showArtifactAction"
+ * plexus.component role="com.opensymphony.xwork2.Action" role-hint="showArtifactAction"
* instantiation-strategy="per-lookup"
*/
@SuppressWarnings( "serial" )
+@Controller( "showArtifactAction" )
+@Scope( "prototype" )
public class ShowArtifactAction
extends AbstractRepositoryBasedAction
implements Validateable
@@ -67,7 +71,7 @@ public class ShowArtifactAction
/* .\ Not Exposed \._____________________________________________ */
/**
- * @plexus.requirement
+ * plexus.requirement
*/
private RepositoryContentFactory repositoryFactory;
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java
index 62c4c71ca..46d09dd46 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java
@@ -54,7 +54,11 @@ import org.apache.maven.model.Model;
import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
import org.codehaus.plexus.taskqueue.TaskQueueException;
import org.codehaus.plexus.util.IOUtil;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
+import javax.inject.Inject;
+import javax.inject.Named;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -72,12 +76,14 @@ import java.util.TimeZone;
/**
* Upload an artifact using Jakarta file upload in webwork. If set by the user a pom will also be generated. Metadata
* will also be updated if one exists, otherwise it would be created.
- *
- * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="uploadAction" instantiation-strategy="per-lookup"
+ * <p/>
+ * plexus.component role="com.opensymphony.xwork2.Action" role-hint="uploadAction" instantiation-strategy="per-lookup"
*/
@SuppressWarnings( "serial" )
+@Controller( "uploadAction" )
+@Scope( "prototype" )
public class UploadAction
- extends PlexusActionSupport
+ extends AbstractActionSupport
implements Validateable, Preparable, Auditable
{
/**
@@ -131,26 +137,31 @@ public class UploadAction
private List<String> managedRepoIdList;
/**
- * @plexus.requirement
+ * plexus.requirement
*/
+ @Inject
private UserRepositories userRepositories;
/**
- * @plexus.requirement role-hint="default"
+ * plexus.requirement role-hint="default"
*/
+ @Inject
private ArchivaConfiguration configuration;
/**
- * @plexus.requirement
+ * plexus.requirement
*/
+ @Inject
private RepositoryContentFactory repositoryFactory;
/**
- * @plexus.requirement role="org.apache.archiva.scheduler.ArchivaTaskScheduler" role-hint="repository"
+ * lexus.requirement role="org.apache.archiva.scheduler.ArchivaTaskScheduler" role-hint="repository"
*/
+ @Inject
+ @Named( value = "archivaTaskScheduler#repository" )
private ArchivaTaskScheduler scheduler;
-
- private ChecksumAlgorithm[] algorithms = new ChecksumAlgorithm[]{ChecksumAlgorithm.SHA1, ChecksumAlgorithm.MD5};
+
+ private ChecksumAlgorithm[] algorithms = new ChecksumAlgorithm[]{ ChecksumAlgorithm.SHA1, ChecksumAlgorithm.MD5 };
public void setArtifact( File file )
{
@@ -415,17 +426,17 @@ public class UploadAction
if ( !config.getRepositoryScanning().getKnownContentConsumers().contains( "metadata-updater" ) )
{
updateProjectMetadata( targetPath.getAbsolutePath(), lastUpdatedTimestamp, timestamp, newBuildNumber,
- fixChecksums );
-
- if ( VersionUtil.isSnapshot( version ) )
- {
- updateVersionMetadata( versionMetadata, versionMetadataFile, lastUpdatedTimestamp, timestamp,
- newBuildNumber, fixChecksums );
- }
+ fixChecksums );
+
+ if ( VersionUtil.isSnapshot( version ) )
+ {
+ updateVersionMetadata( versionMetadata, versionMetadataFile, lastUpdatedTimestamp, timestamp,
+ newBuildNumber, fixChecksums );
+ }
}
- String msg = "Artifact \'" + groupId + ":" + artifactId + ":" + version +
- "\' was successfully deployed to repository \'" + repositoryId + "\'";
+ String msg = "Artifact \'" + groupId + ":" + artifactId + ":" + version
+ + "\' was successfully deployed to repository \'" + repositoryId + "\'";
addActionMessage( msg );
@@ -507,8 +518,8 @@ public class UploadAction
}
return metadata;
}
-
-
+
+
/**
* Update version level metadata for snapshot artifacts. If it does not exist, create the metadata and fix checksums
* if necessary.
@@ -545,15 +556,15 @@ public class UploadAction
/**
* Update artifact level metadata. If it does not exist, create the metadata and fix checksums if necessary.
*/
- private void updateProjectMetadata( String targetPath, Date lastUpdatedTimestamp, String timestamp,
- int buildNumber, boolean fixChecksums )
+ private void updateProjectMetadata( String targetPath, Date lastUpdatedTimestamp, String timestamp, int buildNumber,
+ boolean fixChecksums )
throws RepositoryMetadataException
{
List<String> availableVersions = new ArrayList<String>();
String latestVersion = version;
File projectDir = new File( targetPath ).getParentFile();
- File projectMetadataFile = new File( projectDir, MetadataTools.MAVEN_METADATA );
+ File projectMetadataFile = new File( projectDir, MetadataTools.MAVEN_METADATA );
ArchivaRepositoryMetadata projectMetadata = getMetadata( projectMetadataFile );
@@ -582,7 +593,7 @@ public class UploadAction
{
projectMetadata.setGroupId( groupId );
}
-
+
if ( projectMetadata.getArtifactId() == null )
{
projectMetadata.setArtifactId( artifactId );
@@ -671,9 +682,8 @@ public class UploadAction
}
catch ( TaskQueueException e )
{
- log.error(
- "Unable to queue repository task to execute consumers on resource file ['" + localFile.getName() +
- "']." );
+ log.error( "Unable to queue repository task to execute consumers on resource file ['" + localFile.getName()
+ + "']." );
}
}
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/SchedulerAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/SchedulerAction.java
index 350609979..9871e4d5a 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/SchedulerAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/SchedulerAction.java
@@ -23,31 +23,40 @@ import org.apache.archiva.scheduler.repository.RepositoryArchivaTaskScheduler;
import org.apache.archiva.scheduler.repository.RepositoryTask;
import org.apache.commons.lang.StringUtils;
import org.apache.maven.archiva.security.ArchivaRoleConstants;
-import org.apache.maven.archiva.web.action.PlexusActionSupport;
+import org.apache.maven.archiva.web.action.AbstractActionSupport;
import org.codehaus.plexus.redback.rbac.Resource;
import org.codehaus.plexus.taskqueue.TaskQueueException;
import org.codehaus.redback.integration.interceptor.SecureAction;
import org.codehaus.redback.integration.interceptor.SecureActionBundle;
import org.codehaus.redback.integration.interceptor.SecureActionException;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
+
+import javax.inject.Inject;
+import javax.inject.Named;
/**
* Configures the application.
- *
- * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="schedulerAction" instantiation-strategy="per-lookup"
+ * <p/>
+ * plexus.component role="com.opensymphony.xwork2.Action" role-hint="schedulerAction" instantiation-strategy="per-lookup"
*/
+@Controller( "schedulerAction" )
+@Scope( "prototype" )
public class SchedulerAction
- extends PlexusActionSupport
+ extends AbstractActionSupport
implements SecureAction
{
/**
- * @plexus.requirement role="org.apache.archiva.scheduler.ArchivaTaskScheduler" role-hint="repository"
+ * plexus.requirement role="org.apache.archiva.scheduler.ArchivaTaskScheduler" role-hint="repository"
*/
+ @Inject
+ @Named( value = "archivaTaskScheduler#repository" )
private RepositoryArchivaTaskScheduler repositoryTaskScheduler;
private String repoid;
-
+
private boolean scanAll;
-
+
public String scanRepository()
{
if ( StringUtils.isBlank( repoid ) )
@@ -73,8 +82,8 @@ public class SchedulerAction
}
catch ( TaskQueueException e )
{
- addActionError( "Unable to queue your request to have repository [" + repoid + "] be indexed: "
- + e.getMessage() );
+ addActionError(
+ "Unable to queue your request to have repository [" + repoid + "] be indexed: " + e.getMessage() );
}
}
@@ -116,7 +125,7 @@ public class SchedulerAction
{
this.repoid = repoid;
}
-
+
public boolean getScanAll()
{
return scanAll;
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/SystemStatusAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/SystemStatusAction.java
index 52fd37257..50e6b30e4 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/SystemStatusAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/SystemStatusAction.java
@@ -21,43 +21,58 @@ package org.apache.maven.archiva.web.action.admin;
import org.apache.archiva.repository.scanner.RepositoryScanner;
import org.apache.maven.archiva.security.ArchivaRoleConstants;
-import org.apache.maven.archiva.web.action.PlexusActionSupport;
+import org.apache.maven.archiva.web.action.AbstractActionSupport;
import org.codehaus.plexus.cache.Cache;
import org.codehaus.plexus.redback.rbac.Resource;
import org.codehaus.plexus.taskqueue.TaskQueue;
import org.codehaus.redback.integration.interceptor.SecureAction;
import org.codehaus.redback.integration.interceptor.SecureActionBundle;
import org.codehaus.redback.integration.interceptor.SecureActionException;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
import java.util.Map;
/**
* Shows system status information for the administrator.
*
* @version $Id$
- * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="systemStatus" instantiation-strategy="per-lookup"
+ * plexus.component role="com.opensymphony.xwork2.Action" role-hint="systemStatus" instantiation-strategy="per-lookup"
*/
+@Controller( "systemStatus" )
+@Scope( "prototype" )
public class SystemStatusAction
- extends PlexusActionSupport
+ extends AbstractActionSupport
implements SecureAction
{
/**
- * @plexus.requirement role="org.codehaus.plexus.taskqueue.TaskQueue"
+ * plexus.requirement role="org.codehaus.plexus.taskqueue.TaskQueue"
*/
- private Map<String,TaskQueue> queues;
+ private Map<String, TaskQueue> queues;
/**
- * @plexus.requirement role="org.codehaus.plexus.cache.Cache"
+ * plexus.requirement role="org.codehaus.plexus.cache.Cache"
*/
- private Map<String,Cache> caches;
+ private Map<String, Cache> caches;
/**
- * @plexus.requirement
+ * plexus.requirement
*/
+ @Inject
private RepositoryScanner scanner;
private String memoryStatus;
+ @PostConstruct
+ public void initialize()
+ {
+ super.initialize();
+ queues = getBeansOfType( TaskQueue.class );
+ caches = getBeansOfType( Cache.class );
+ }
+
public SecureActionBundle getSecureActionBundle()
throws SecureActionException
{
@@ -76,14 +91,14 @@ public class SystemStatusAction
long total = runtime.totalMemory();
long used = total - runtime.freeMemory();
long max = runtime.maxMemory();
- memoryStatus = formatMemory(used) + "/" + formatMemory(total) + " (Max: " + formatMemory(max) + ")";
-
+ memoryStatus = formatMemory( used ) + "/" + formatMemory( total ) + " (Max: " + formatMemory( max ) + ")";
+
return SUCCESS;
}
private static String formatMemory( long l )
{
- return l / ( 1024 * 1024 ) + "M";
+ return l / ( 1024 * 1024 ) + "M";
}
public String getMemoryStatus()
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/appearance/AbstractAppearanceAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/appearance/AbstractAppearanceAction.java
index e55ee6841..d232be262 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/appearance/AbstractAppearanceAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/appearance/AbstractAppearanceAction.java
@@ -19,81 +19,83 @@ package org.apache.maven.archiva.web.action.admin.appearance;
* under the License.
*/
+import com.opensymphony.xwork2.Preparable;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.Configuration;
import org.apache.maven.archiva.configuration.OrganisationInformation;
+import org.apache.maven.archiva.web.action.AbstractActionSupport;
-import com.opensymphony.xwork2.Preparable;
-import org.apache.maven.archiva.web.action.PlexusActionSupport;
+import javax.inject.Inject;
/**
- * AbstractAppearanceAction
+ * AbstractAppearanceAction
*
* @version $Id$
*/
public abstract class AbstractAppearanceAction
- extends PlexusActionSupport
+ extends AbstractActionSupport
implements Preparable
{
/**
* Archiva Application Configuration
- * @plexus.requirement
+ * plexus.requirement
*/
+ @Inject
protected ArchivaConfiguration configuration;
-
+
private String organisationLogo;
private String organisationUrl;
private String organisationName;
- public void setConfiguration(ArchivaConfiguration configuration)
+ public void setConfiguration( ArchivaConfiguration configuration )
{
this.configuration = configuration;
}
-
- public String getOrganisationLogo()
+
+ public String getOrganisationLogo()
{
return organisationLogo;
}
- public String getOrganisationName()
+ public String getOrganisationName()
{
return organisationName;
}
- public String getOrganisationUrl()
+ public String getOrganisationUrl()
{
return organisationUrl;
}
- public void setOrganisationLogo(String organisationLogo)
+ public void setOrganisationLogo( String organisationLogo )
{
this.organisationLogo = organisationLogo;
}
- public void setOrganisationName(String organisationName)
+ public void setOrganisationName( String organisationName )
{
this.organisationName = organisationName;
}
- public void setOrganisationUrl(String organisationUrl)
+ public void setOrganisationUrl( String organisationUrl )
{
this.organisationUrl = organisationUrl;
}
public void prepare()
throws Exception
- {
+ {
Configuration config = configuration.getConfiguration();
- if (config != null)
+ if ( config != null )
{
OrganisationInformation orgInfo = config.getOrganisationInfo();
- if (orgInfo != null)
+ if ( orgInfo != null )
{
- setOrganisationLogo(orgInfo.getLogoLocation());
- setOrganisationName(orgInfo.getName());
- setOrganisationUrl(orgInfo.getUrl());
+ setOrganisationLogo( orgInfo.getLogoLocation() );
+ setOrganisationName( orgInfo.getName() );
+ setOrganisationUrl( orgInfo.getUrl() );
}
}
}
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/appearance/EditOrganisationInfoAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/appearance/EditOrganisationInfoAction.java
index c32b8233a..d721c7914 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/appearance/EditOrganisationInfoAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/appearance/EditOrganisationInfoAction.java
@@ -30,14 +30,17 @@ import org.codehaus.plexus.registry.RegistryException;
import org.codehaus.redback.integration.interceptor.SecureAction;
import org.codehaus.redback.integration.interceptor.SecureActionBundle;
import org.codehaus.redback.integration.interceptor.SecureActionException;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
/**
* @version $Id: ConfigurationAction.java 480950 2006-11-30 14:58:35Z evenisse $
- *
- * @plexus.component role="com.opensymphony.xwork2.Action"
- * role-hint="editOrganisationInfo"
- * instantiation-strategy="per-lookup"
+ * plexus.component role="com.opensymphony.xwork2.Action"
+ * role-hint="editOrganisationInfo"
+ * instantiation-strategy="per-lookup"
*/
+@Controller( "editOrganisationInfo" )
+@Scope( "prototype" )
public class EditOrganisationInfoAction
extends AbstractAppearanceAction
implements SecureAction, Validateable
@@ -47,23 +50,23 @@ public class EditOrganisationInfoAction
throws RegistryException, IndeterminateConfigurationException
{
Configuration config = configuration.getConfiguration();
- if (config != null)
+ if ( config != null )
{
OrganisationInformation orgInfo = config.getOrganisationInfo();
- if (orgInfo == null)
+ if ( orgInfo == null )
{
- config.setOrganisationInfo(orgInfo);
+ config.setOrganisationInfo( orgInfo );
}
-
- orgInfo.setLogoLocation(getOrganisationLogo());
- orgInfo.setName(getOrganisationName());
- orgInfo.setUrl(getOrganisationUrl());
-
- configuration.save(config);
+
+ orgInfo.setLogoLocation( getOrganisationLogo() );
+ orgInfo.setName( getOrganisationName() );
+ orgInfo.setUrl( getOrganisationUrl() );
+
+ configuration.save( config );
}
return SUCCESS;
}
-
+
public SecureActionBundle getSecureActionBundle()
throws SecureActionException
{
@@ -72,28 +75,28 @@ public class EditOrganisationInfoAction
bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION, Resource.GLOBAL );
return bundle;
}
-
+
public void validate()
{
// trim all unecessary trailing/leading white-spaces; always put this statement before the closing braces(after all validation).
trimAllRequestParameterValues();
}
-
+
private void trimAllRequestParameterValues()
{
- if(StringUtils.isNotEmpty(super.getOrganisationName()))
+ if ( StringUtils.isNotEmpty( super.getOrganisationName() ) )
{
- super.setOrganisationName(super.getOrganisationName().trim());
+ super.setOrganisationName( super.getOrganisationName().trim() );
}
- if(StringUtils.isNotEmpty(super.getOrganisationUrl()))
+ if ( StringUtils.isNotEmpty( super.getOrganisationUrl() ) )
{
- super.setOrganisationUrl(super.getOrganisationUrl().trim());
+ super.setOrganisationUrl( super.getOrganisationUrl().trim() );
}
- if(StringUtils.isNotEmpty(super.getOrganisationLogo()))
+ if ( StringUtils.isNotEmpty( super.getOrganisationLogo() ) )
{
- super.setOrganisationLogo(super.getOrganisationLogo().trim());
+ super.setOrganisationLogo( super.getOrganisationLogo().trim() );
}
}
}
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/appearance/OrganisationInfoAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/appearance/OrganisationInfoAction.java
index 4298c4d25..9c5925b06 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/appearance/OrganisationInfoAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/appearance/OrganisationInfoAction.java
@@ -19,12 +19,18 @@ package org.apache.maven.archiva.web.action.admin.appearance;
* under the License.
*/
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
+
/**
* Stores the organisation information for displaying on the page.
- *
- * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="organisationInfo" instantiation-strategy="per-lookup"
+ * <p/>
+ * plexus.component role="com.opensymphony.xwork2.Action" role-hint="organisationInfo" instantiation-strategy="per-lookup"
*/
+@Controller( "organisationInfo" )
+@Scope( "prototype" )
public class OrganisationInfoAction
extends AbstractAppearanceAction
{
+ // no op
}
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AbstractProxyConnectorAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AbstractProxyConnectorAction.java
index ec89a9bb2..bee78a0c9 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AbstractProxyConnectorAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AbstractProxyConnectorAction.java
@@ -28,7 +28,7 @@ import org.apache.maven.archiva.configuration.IndeterminateConfigurationExceptio
import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
import org.apache.maven.archiva.configuration.functors.ProxyConnectorSelectionPredicate;
import org.apache.maven.archiva.security.ArchivaRoleConstants;
-import org.apache.maven.archiva.web.action.PlexusActionSupport;
+import org.apache.maven.archiva.web.action.AbstractActionSupport;
import org.codehaus.plexus.redback.rbac.Resource;
import org.codehaus.plexus.registry.RegistryException;
@@ -38,20 +38,23 @@ import org.codehaus.redback.integration.interceptor.SecureAction;
import org.codehaus.redback.integration.interceptor.SecureActionBundle;
import org.codehaus.redback.integration.interceptor.SecureActionException;
+import javax.inject.Inject;
+
/**
* AbstractProxyConnectorAction
*
* @version $Id$
*/
public abstract class AbstractProxyConnectorAction
- extends PlexusActionSupport
+ extends AbstractActionSupport
implements SecureAction
{
public static final String DIRECT_CONNECTION = "(direct connection)";
/**
- * @plexus.requirement
+ * plexus.requirement
*/
+ @Inject
protected ArchivaConfiguration archivaConfiguration;
public SecureActionBundle getSecureActionBundle()
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AbstractProxyConnectorFormAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AbstractProxyConnectorFormAction.java
index fddf47e3c..57baffa58 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AbstractProxyConnectorFormAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AbstractProxyConnectorFormAction.java
@@ -24,6 +24,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import com.google.common.collect.Lists;
+import org.apache.archiva.audit.AuditListener;
import org.apache.commons.lang.StringUtils;
import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
import org.apache.maven.archiva.policies.DownloadErrorPolicy;
@@ -33,6 +35,8 @@ import org.apache.maven.archiva.policies.PreDownloadPolicy;
import com.opensymphony.xwork2.Preparable;
+import javax.annotation.PostConstruct;
+
/**
* AbstractProxyConnectorFormAction - generic fields and methods for either add or edit actions related with the
* Proxy Connector.
@@ -45,17 +49,17 @@ public abstract class AbstractProxyConnectorFormAction
{
/**
- * @plexus.requirement role="org.apache.maven.archiva.policies.PreDownloadPolicy"
+ * plexus.requirement role="org.apache.maven.archiva.policies.PreDownloadPolicy"
*/
private Map<String, PreDownloadPolicy> preDownloadPolicyMap;
/**
- * @plexus.requirement role="org.apache.maven.archiva.policies.PostDownloadPolicy"
+ * plexus.requirement role="org.apache.maven.archiva.policies.PostDownloadPolicy"
*/
private Map<String, PostDownloadPolicy> postDownloadPolicyMap;
/**
- * @plexus.requirement role="org.apache.maven.archiva.policies.DownloadErrorPolicy"
+ * plexus.requirement role="org.apache.maven.archiva.policies.DownloadErrorPolicy"
*/
private Map<String, DownloadErrorPolicy> downloadErrorPolicyMap;
@@ -109,6 +113,16 @@ public abstract class AbstractProxyConnectorFormAction
*/
protected ProxyConnectorConfiguration connector;
+
+ @PostConstruct
+ public void initialize()
+ {
+ super.initialize();
+ this.preDownloadPolicyMap = getBeansOfType( PreDownloadPolicy.class );
+ this.postDownloadPolicyMap = getBeansOfType( PostDownloadPolicy.class );
+ this.downloadErrorPolicyMap = getBeansOfType( DownloadErrorPolicy.class );
+ }
+
protected List<String> escapePatterns( List<String> patterns )
{
List<String> escapedPatterns = new ArrayList<String>();
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AddProxyConnectorAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AddProxyConnectorAction.java
index 02511a13e..7509cc651 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AddProxyConnectorAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AddProxyConnectorAction.java
@@ -21,14 +21,18 @@ package org.apache.maven.archiva.web.action.admin.connectors.proxy;
import org.apache.commons.lang.StringUtils;
import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
/**
- * AddProxyConnectorAction
+ * AddProxyConnectorAction
*
* @version $Id$
- *
- * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="addProxyConnectorAction" instantiation-strategy="per-lookup"
+ * <p/>
+ * plexus.component role="com.opensymphony.xwork2.Action" role-hint="addProxyConnectorAction" instantiation-strategy="per-lookup"
*/
+@Controller( "addProxyConnectorAction" )
+@Scope( "prototype" )
public class AddProxyConnectorAction
extends AbstractProxyConnectorFormAction
{
@@ -38,17 +42,17 @@ public class AddProxyConnectorAction
super.prepare();
connector = new ProxyConnectorConfiguration();
}
-
+
@Override
public String input()
{
- if( connector != null )
+ if ( connector != null )
{
- // MRM-1135
+ // MRM-1135
connector.setBlackListPatterns( escapePatterns( connector.getBlackListPatterns() ) );
connector.setWhiteListPatterns( escapePatterns( connector.getWhiteListPatterns() ) );
}
-
+
return INPUT;
}
@@ -66,18 +70,19 @@ public class AddProxyConnectorAction
ProxyConnectorConfiguration otherConnector = findProxyConnector( sourceId, targetId );
if ( otherConnector != null )
{
- addActionError( "Unable to add proxy connector, as one already exists with source repository id ["
- + sourceId + "] and target repository id [" + targetId + "]." );
+ addActionError(
+ "Unable to add proxy connector, as one already exists with source repository id [" + sourceId
+ + "] and target repository id [" + targetId + "]." );
}
-
+
validateConnector();
if ( hasActionErrors() )
{
return INPUT;
}
-
- if( StringUtils.equals( DIRECT_CONNECTION, connector.getProxyId() ) )
+
+ if ( StringUtils.equals( DIRECT_CONNECTION, connector.getProxyId() ) )
{
connector.setProxyId( null );
}
@@ -85,7 +90,7 @@ public class AddProxyConnectorAction
// MRM-1135
connector.setBlackListPatterns( unescapePatterns( connector.getBlackListPatterns() ) );
connector.setWhiteListPatterns( unescapePatterns( connector.getWhiteListPatterns() ) );
-
+
addProxyConnector( connector );
return saveConfiguration();
}
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/DeleteProxyConnectorAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/DeleteProxyConnectorAction.java
index 48947d076..8ca1b97c4 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/DeleteProxyConnectorAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/DeleteProxyConnectorAction.java
@@ -20,14 +20,18 @@ package org.apache.maven.archiva.web.action.admin.connectors.proxy;
*/
import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
/**
* DeleteProxyConnectorAction
*
* @version $Id$
*
- * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="deleteProxyConnectorAction" instantiation-strategy="per-lookup"
+ * plexus.component role="com.opensymphony.xwork2.Action" role-hint="deleteProxyConnectorAction" instantiation-strategy="per-lookup"
*/
+@Controller( "deleteProxyConnectorAction" )
+@Scope( "prototype" )
public class DeleteProxyConnectorAction
extends AbstractProxyConnectorAction
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/DisableProxyConnectorAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/DisableProxyConnectorAction.java
index f2fbfee2e..022e7b3a7 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/DisableProxyConnectorAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/DisableProxyConnectorAction.java
@@ -1,6 +1,8 @@
package org.apache.maven.archiva.web.action.admin.connectors.proxy;
import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -22,18 +24,21 @@ import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
*/
/**
- * DisableProxyConnectorAction
- *
- * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="disableProxyConnectorAction" instantiation-strategy="per-lookup"
+ * DisableProxyConnectorAction
+ *
+ * plexus.component role="com.opensymphony.xwork2.Action" role-hint="disableProxyConnectorAction" instantiation-strategy="per-lookup"
*/
-public class DisableProxyConnectorAction extends AbstractProxyConnectorAction
+@Controller( "disableProxyConnectorAction" )
+@Scope( "prototype" )
+public class DisableProxyConnectorAction
+ extends AbstractProxyConnectorAction
{
private String source;
-
+
private String target;
-
+
private ProxyConnectorConfiguration proxyConfig;
-
+
public String confirmDisable()
{
this.proxyConfig = findProxyConnector( source, target );
@@ -41,23 +46,25 @@ public class DisableProxyConnectorAction extends AbstractProxyConnectorAction
// Not set? Then there is nothing to delete.
if ( this.proxyConfig == null )
{
- addActionError( "Unable to disable proxy configuration, configuration with source [" + source
- + "], and target [" + target + "] does not exist." );
+ addActionError(
+ "Unable to disable proxy configuration, configuration with source [" + source + "], and target ["
+ + target + "] does not exist." );
return ERROR;
}
return INPUT;
}
-
+
public String disable()
- {
+ {
this.proxyConfig = findProxyConnector( source, target );
// Not set? Then there is nothing to delete.
if ( this.proxyConfig == null )
{
- addActionError( "Unable to disable proxy configuration, configuration with source [" + source
- + "], and target [" + target + "] does not exist." );
+ addActionError(
+ "Unable to disable proxy configuration, configuration with source [" + source + "], and target ["
+ + target + "] does not exist." );
return ERROR;
}
@@ -65,14 +72,14 @@ public class DisableProxyConnectorAction extends AbstractProxyConnectorAction
{
return ERROR;
}
-
- proxyConfig.setDisabled(true);
-
+
+ proxyConfig.setDisabled( true );
+
addActionMessage( "Successfully disabled proxy connector [" + source + " , " + target + " ]" );
setSource( null );
setTarget( null );
-
+
return saveConfiguration();
}
@@ -81,17 +88,17 @@ public class DisableProxyConnectorAction extends AbstractProxyConnectorAction
return source;
}
- public void setSource(String source)
+ public void setSource( String source )
{
this.source = source;
}
- public String getTarget()
+ public String getTarget()
{
return target;
}
- public void setTarget(String target)
+ public void setTarget( String target )
{
this.target = target;
}
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/EditProxyConnectorAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/EditProxyConnectorAction.java
index 6ea3bd8d9..288db7330 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/EditProxyConnectorAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/EditProxyConnectorAction.java
@@ -20,15 +20,18 @@ package org.apache.maven.archiva.web.action.admin.connectors.proxy;
*/
import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
-
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
/**
* EditProxyConnectorAction
*
* @version $Id$
*
- * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="editProxyConnectorAction" instantiation-strategy="per-lookup"
+ * plexus.component role="com.opensymphony.xwork2.Action" role-hint="editProxyConnectorAction" instantiation-strategy="per-lookup"
*/
+@Controller( "editProxyConnectorAction" )
+@Scope( "prototype")
public class EditProxyConnectorAction
extends AbstractProxyConnectorFormAction
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/EnableProxyConnectorAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/EnableProxyConnectorAction.java
index eb3002b60..5af6c8fae 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/EnableProxyConnectorAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/EnableProxyConnectorAction.java
@@ -1,6 +1,8 @@
package org.apache.maven.archiva.web.action.admin.connectors.proxy;
import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -22,18 +24,21 @@ import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
*/
/**
- * EnableProxyConnectorAction
- *
- * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="enableProxyConnectorAction" instantiation-strategy="per-lookup"
+ * EnableProxyConnectorAction
+ * <p/>
+ * plexus.component role="com.opensymphony.xwork2.Action" role-hint="enableProxyConnectorAction" instantiation-strategy="per-lookup"
*/
-public class EnableProxyConnectorAction extends AbstractProxyConnectorAction
+@Controller( "enableProxyConnectorAction" )
+@Scope( "prototype" )
+public class EnableProxyConnectorAction
+ extends AbstractProxyConnectorAction
{
private String source;
-
+
private String target;
-
+
private ProxyConnectorConfiguration proxyConfig;
-
+
public String confirmEnable()
{
this.proxyConfig = findProxyConnector( source, target );
@@ -41,14 +46,15 @@ public class EnableProxyConnectorAction extends AbstractProxyConnectorAction
// Not set? Then there is nothing to delete.
if ( this.proxyConfig == null )
{
- addActionError( "Unable to enable proxy configuration, configuration with source [" + source
- + "], and target [" + target + "] does not exist." );
+ addActionError(
+ "Unable to enable proxy configuration, configuration with source [" + source + "], and target ["
+ + target + "] does not exist." );
return ERROR;
}
return INPUT;
}
-
+
public String enable()
{
this.proxyConfig = findProxyConnector( source, target );
@@ -56,8 +62,9 @@ public class EnableProxyConnectorAction extends AbstractProxyConnectorAction
// Not set? Then there is nothing to delete.
if ( this.proxyConfig == null )
{
- addActionError( "Unable to enabled proxy configuration, configuration with source [" + source
- + "], and target [" + target + "] does not exist." );
+ addActionError(
+ "Unable to enabled proxy configuration, configuration with source [" + source + "], and target ["
+ + target + "] does not exist." );
return ERROR;
}
@@ -65,14 +72,14 @@ public class EnableProxyConnectorAction extends AbstractProxyConnectorAction
{
return ERROR;
}
-
- proxyConfig.setDisabled(false);
-
+
+ proxyConfig.setDisabled( false );
+
addActionMessage( "Successfully enabled proxy connector [" + source + " , " + target + " ]" );
setSource( null );
setTarget( null );
-
+
return saveConfiguration();
}
@@ -81,17 +88,17 @@ public class EnableProxyConnectorAction extends AbstractProxyConnectorAction
return source;
}
- public void setSource(String source)
+ public void setSource( String source )
{
this.source = source;
}
- public String getTarget()
+ public String getTarget()
{
return target;
}
- public void setTarget(String target)
+ public void setTarget( String target )
{
this.target = target;
}
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ProxyConnectorsAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ProxyConnectorsAction.java
index 8745d9497..7dffb7067 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ProxyConnectorsAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ProxyConnectorsAction.java
@@ -24,6 +24,8 @@ import com.opensymphony.xwork2.Preparable;
import org.apache.maven.archiva.configuration.AbstractRepositoryConfiguration;
import org.apache.maven.archiva.configuration.Configuration;
import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
import java.util.HashMap;
import java.util.List;
@@ -34,8 +36,10 @@ import java.util.Map;
*
* @version $Id$
*
- * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="proxyConnectorsAction" instantiation-strategy="per-lookup"
+ * plexus.component role="com.opensymphony.xwork2.Action" role-hint="proxyConnectorsAction" instantiation-strategy="per-lookup"
*/
+@Controller( "proxyConnectorsAction" )
+@Scope( "prototype" )
public class ProxyConnectorsAction
extends AbstractProxyConnectorAction
implements Preparable
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/SortProxyConnectorsAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/SortProxyConnectorsAction.java
index 315f958d9..adfd6c0b7 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/SortProxyConnectorsAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/SortProxyConnectorsAction.java
@@ -21,16 +21,20 @@ package org.apache.maven.archiva.web.action.admin.connectors.proxy;
import org.apache.commons.lang.StringUtils;
import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
import java.util.List;
/**
- * SortProxyConnectorsAction -
+ * SortProxyConnectorsAction -
*
* @version $Id$
- *
- * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="sortProxyConnectorsAction" instantiation-strategy="per-lookup"
+ * <p/>
+ * plexus.component role="com.opensymphony.xwork2.Action" role-hint="sortProxyConnectorsAction" instantiation-strategy="per-lookup"
*/
+@Controller( "sortProxyConnectorsAction" )
+@Scope( "prototype" )
public class SortProxyConnectorsAction
extends AbstractProxyConnectorAction
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathAction.java
index 18a266ccd..1907a2399 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathAction.java
@@ -30,26 +30,36 @@ import org.codehaus.plexus.registry.RegistryException;
import com.opensymphony.xwork2.Preparable;
import com.opensymphony.xwork2.Validateable;
import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.web.action.PlexusActionSupport;
+import org.apache.maven.archiva.web.action.AbstractActionSupport;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
+
+import javax.inject.Inject;
+import javax.inject.Named;
/**
* Add a LegacyArtifactPath to archiva configuration
*
* @since 1.1
- * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="addLegacyArtifactPathAction" instantiation-strategy="per-lookup"
+ * plexus.component role="com.opensymphony.xwork2.Action" role-hint="addLegacyArtifactPathAction" instantiation-strategy="per-lookup"
*/
+@Controller( "addLegacyArtifactPathAction" )
+@Scope( "prototype" )
public class AddLegacyArtifactPathAction
- extends PlexusActionSupport
+ extends AbstractActionSupport
implements Preparable, Validateable
{
/**
- * @plexus.requirement
+ * plexus.requirement
*/
+ @Inject
private ArchivaConfiguration archivaConfiguration;
/**
- * @plexus.requirement role-hint="legacy"
+ * plexus.requirement role-hint="legacy"
*/
+ @Inject
+ @Named(value = "managedRepositoryContent#legacy")
private ManagedRepositoryContent repositoryContent;
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/DeleteLegacyArtifactPathAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/DeleteLegacyArtifactPathAction.java
index f85f57cff..c9aab90e3 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/DeleteLegacyArtifactPathAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/DeleteLegacyArtifactPathAction.java
@@ -19,28 +19,33 @@ package org.apache.maven.archiva.web.action.admin.legacy;
* under the License.
*/
-import java.util.Iterator;
-
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.Configuration;
import org.apache.maven.archiva.configuration.IndeterminateConfigurationException;
import org.apache.maven.archiva.configuration.LegacyArtifactPath;
-import org.apache.maven.archiva.web.action.PlexusActionSupport;
+import org.apache.maven.archiva.web.action.AbstractActionSupport;
import org.codehaus.plexus.registry.RegistryException;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
+
+import javax.inject.Inject;
+import java.util.Iterator;
/**
* Delete a LegacyArtifactPath to archiva configuration
*
- *
* @since 1.1
- * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="deleteLegacyArtifactPathAction" instantiation-strategy="per-lookup"
+ * plexus.component role="com.opensymphony.xwork2.Action" role-hint="deleteLegacyArtifactPathAction" instantiation-strategy="per-lookup"
*/
+@Controller( "deleteLegacyArtifactPathAction" )
+@Scope( "prototype" )
public class DeleteLegacyArtifactPathAction
- extends PlexusActionSupport
+ extends AbstractActionSupport
{
/**
- * @plexus.requirement
+ * plexus.requirement
*/
+ @Inject
private ArchivaConfiguration archivaConfiguration;
private String path;
@@ -49,10 +54,11 @@ public class DeleteLegacyArtifactPathAction
{
log.info( "remove [" + path + "] from legacy artifact path resolution" );
Configuration configuration = archivaConfiguration.getConfiguration();
- for ( Iterator<LegacyArtifactPath> iterator = configuration.getLegacyArtifactPaths().iterator(); iterator.hasNext(); )
+ for ( Iterator<LegacyArtifactPath> iterator = configuration.getLegacyArtifactPaths().iterator();
+ iterator.hasNext(); )
{
LegacyArtifactPath legacyArtifactPath = (LegacyArtifactPath) iterator.next();
- if (legacyArtifactPath.match( path ))
+ if ( legacyArtifactPath.match( path ) )
{
iterator.remove();
}
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/LegacyArtifactPathAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/LegacyArtifactPathAction.java
index d6964a200..fc2fffb28 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/LegacyArtifactPathAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/LegacyArtifactPathAction.java
@@ -19,38 +19,42 @@ package org.apache.maven.archiva.web.action.admin.legacy;
* under the License.
*/
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-
+import com.opensymphony.xwork2.Preparable;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.Configuration;
import org.apache.maven.archiva.configuration.LegacyArtifactPath;
import org.apache.maven.archiva.security.ArchivaRoleConstants;
+import org.apache.maven.archiva.web.action.AbstractActionSupport;
import org.apache.maven.archiva.web.util.ContextUtils;
-import org.codehaus.plexus.redback.rbac.Resource;
-
import org.apache.struts2.interceptor.ServletRequestAware;
-import com.opensymphony.xwork2.Preparable;
-import org.apache.maven.archiva.web.action.PlexusActionSupport;
+import org.codehaus.plexus.redback.rbac.Resource;
import org.codehaus.redback.integration.interceptor.SecureAction;
import org.codehaus.redback.integration.interceptor.SecureActionBundle;
import org.codehaus.redback.integration.interceptor.SecureActionException;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
+
+import javax.inject.Inject;
+import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
+import java.util.List;
/**
* Shows the LegacyArtifactPath Tab for the administrator.
*
* @since 1.1
- * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="legacyArtifactPathAction" instantiation-strategy="per-lookup"
+ * plexus.component role="com.opensymphony.xwork2.Action" role-hint="legacyArtifactPathAction" instantiation-strategy="per-lookup"
*/
+@Controller( "legacyArtifactPathAction" )
+@Scope( "prototype" )
public class LegacyArtifactPathAction
- extends PlexusActionSupport
+ extends AbstractActionSupport
implements SecureAction, ServletRequestAware, Preparable
{
/**
- * @plexus.requirement
+ * plexus.requirement
*/
+ @Inject
private ArchivaConfiguration archivaConfiguration;
private List<LegacyArtifactPath> legacyArtifactPaths;
@@ -72,8 +76,7 @@ public class LegacyArtifactPathAction
SecureActionBundle bundle = new SecureActionBundle();
bundle.setRequiresAuthentication( true );
- bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION,
- Resource.GLOBAL );
+ bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION, Resource.GLOBAL );
return bundle;
}
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyAction.java
index 3299bc3b7..d9cb4b2ef 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyAction.java
@@ -30,26 +30,33 @@ import org.apache.maven.archiva.configuration.IndeterminateConfigurationExceptio
import org.apache.maven.archiva.configuration.NetworkProxyConfiguration;
import org.apache.maven.archiva.configuration.functors.NetworkProxySelectionPredicate;
import org.apache.maven.archiva.security.ArchivaRoleConstants;
-import org.apache.maven.archiva.web.action.PlexusActionSupport;
+import org.apache.maven.archiva.web.action.AbstractActionSupport;
import org.codehaus.plexus.redback.rbac.Resource;
import org.codehaus.plexus.registry.RegistryException;
import org.codehaus.redback.integration.interceptor.SecureAction;
import org.codehaus.redback.integration.interceptor.SecureActionBundle;
import org.codehaus.redback.integration.interceptor.SecureActionException;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
+
+import javax.inject.Inject;
/**
* ConfigureNetworkProxyAction
*
* @version $Id$
- * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="configureNetworkProxyAction" instantiation-strategy="per-lookup"
+ * plexus.component role="com.opensymphony.xwork2.Action" role-hint="configureNetworkProxyAction" instantiation-strategy="per-lookup"
*/
+@Controller( "configureNetworkProxyAction" )
+@Scope( "prototype" )
public class ConfigureNetworkProxyAction
- extends PlexusActionSupport
+ extends AbstractActionSupport
implements SecureAction, Preparable, Validateable
{
/**
- * @plexus.requirement
+ * plexus.requirement
*/
+ @Inject
private ArchivaConfiguration archivaConfiguration;
private String mode;
@@ -81,8 +88,8 @@ public class ConfigureNetworkProxyAction
}
NetworkProxySelectionPredicate networkProxySelection = new NetworkProxySelectionPredicate( id );
- NetworkProxyConfiguration proxyConfig = (NetworkProxyConfiguration) CollectionUtils.find( config
- .getNetworkProxies(), networkProxySelection );
+ NetworkProxyConfiguration proxyConfig =
+ (NetworkProxyConfiguration) CollectionUtils.find( config.getNetworkProxies(), networkProxySelection );
if ( proxyConfig == null )
{
addActionError( "Unable to remove network proxy, proxy with id [" + id + "] not found." );
@@ -235,29 +242,29 @@ public class ConfigureNetworkProxyAction
private void trimAllRequestParameterValues()
{
- if(StringUtils.isNotEmpty(proxy.getId()))
+ if ( StringUtils.isNotEmpty( proxy.getId() ) )
{
- proxy.setId(proxy.getId().trim());
+ proxy.setId( proxy.getId().trim() );
}
-
- if(StringUtils.isNotEmpty(proxy.getHost()))
+
+ if ( StringUtils.isNotEmpty( proxy.getHost() ) )
{
- proxy.setHost(proxy.getHost().trim());
+ proxy.setHost( proxy.getHost().trim() );
}
- if(StringUtils.isNotEmpty(proxy.getPassword()))
+ if ( StringUtils.isNotEmpty( proxy.getPassword() ) )
{
- proxy.setPassword(proxy.getPassword().trim());
+ proxy.setPassword( proxy.getPassword().trim() );
}
- if(StringUtils.isNotEmpty(proxy.getProtocol()))
+ if ( StringUtils.isNotEmpty( proxy.getProtocol() ) )
{
- proxy.setProtocol(proxy.getProtocol().trim());
+ proxy.setProtocol( proxy.getProtocol().trim() );
}
- if(StringUtils.isNotEmpty(proxy.getUsername()))
+ if ( StringUtils.isNotEmpty( proxy.getUsername() ) )
{
- proxy.setUsername(proxy.getUsername().trim());
+ proxy.setUsername( proxy.getUsername().trim() );
}
}
}
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/NetworkProxiesAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/NetworkProxiesAction.java
index dcbbe4249..5bfdd510d 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/NetworkProxiesAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/NetworkProxiesAction.java
@@ -20,32 +20,37 @@ package org.apache.maven.archiva.web.action.admin.networkproxies;
*/
import com.opensymphony.xwork2.Preparable;
-
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.NetworkProxyConfiguration;
import org.apache.maven.archiva.security.ArchivaRoleConstants;
-import org.apache.maven.archiva.web.action.PlexusActionSupport;
+import org.apache.maven.archiva.web.action.AbstractActionSupport;
import org.codehaus.plexus.redback.rbac.Resource;
import org.codehaus.redback.integration.interceptor.SecureAction;
import org.codehaus.redback.integration.interceptor.SecureActionBundle;
import org.codehaus.redback.integration.interceptor.SecureActionException;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
+import javax.inject.Inject;
import java.util.List;
/**
- * NetworkProxiesAction
+ * NetworkProxiesAction
*
* @version $Id$
- *
- * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="networkProxiesAction" instantiation-strategy="per-lookup"
+ * <p/>
+ * plexus.component role="com.opensymphony.xwork2.Action" role-hint="networkProxiesAction" instantiation-strategy="per-lookup"
*/
+@Controller( "networkProxiesAction" )
+@Scope( "prototype" )
public class NetworkProxiesAction
- extends PlexusActionSupport
+ extends AbstractActionSupport
implements Preparable, SecureAction
{
/**
- * @plexus.requirement
+ * plexus.requirement
*/
+ @Inject
private ArchivaConfiguration configuration;
private List<NetworkProxyConfiguration> networkProxies;
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractManagedRepositoriesAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractManagedRepositoriesAction.java
index ce821dedd..356ca6a99 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractManagedRepositoriesAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractManagedRepositoriesAction.java
@@ -28,12 +28,14 @@ import org.codehaus.plexus.redback.role.RoleManager;
import org.codehaus.plexus.redback.role.RoleManagerException;
import org.codehaus.plexus.registry.Registry;
+import javax.inject.Inject;
+import javax.inject.Named;
import java.io.File;
import java.io.IOException;
/**
* Abstract ManagedRepositories Action.
- *
+ * <p/>
* Place for all generic methods used in Managed Repository Administration.
*
* @version $Id$
@@ -42,19 +44,22 @@ public abstract class AbstractManagedRepositoriesAction
extends AbstractRepositoriesAdminAction
{
/**
- * @plexus.requirement role-hint="default"
+ * plexus.requirement role-hint="default"
*/
+ @Inject
protected RoleManager roleManager;
/**
* Plexus registry to read the configuration from.
- *
- * @plexus.requirement role-hint="commons-configuration"
+ * <p/>
+ * plexus.requirement role-hint="commons-configuration"
*/
+ @Inject
+ @Named( value = "commons-configuration" )
private Registry registry;
public static final String CONFIRM = "confirm";
-
+
public RoleManager getRoleManager()
{
return roleManager;
@@ -82,20 +87,22 @@ public abstract class AbstractManagedRepositoriesAction
}
if ( !file.exists() || !file.isDirectory() )
{
- throw new IOException( "Unable to add repository - no write access, can not create the root directory: " + file );
+ throw new IOException(
+ "Unable to add repository - no write access, can not create the root directory: " + file );
}
configuration.addManagedRepository( repository );
}
- protected void addRepositoryRoles( ManagedRepositoryConfiguration newRepository ) throws RoleManagerException
+ protected void addRepositoryRoles( ManagedRepositoryConfiguration newRepository )
+ throws RoleManagerException
{
String repoId = newRepository.getId();
-
+
// TODO: double check these are configured on start up
// TODO: belongs in the business logic
-
+
if ( !roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId ) )
{
roleManager.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId );
@@ -130,12 +137,12 @@ public abstract class AbstractManagedRepositoriesAction
throws RoleManagerException
{
String repoId = existingRepository.getId();
-
+
if ( roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, repoId ) )
{
roleManager.removeTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, repoId );
}
-
+
if ( roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId ) )
{
roleManager.removeTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId );
@@ -146,10 +153,10 @@ public abstract class AbstractManagedRepositoriesAction
protected String removeExpressions( String directory )
{
- String value = StringUtils.replace( directory, "${appserver.base}", registry.getString( "appserver.base",
- "${appserver.base}" ) );
- value = StringUtils.replace( value, "${appserver.home}", registry.getString( "appserver.home",
- "${appserver.home}" ) );
+ String value = StringUtils.replace( directory, "${appserver.base}",
+ registry.getString( "appserver.base", "${appserver.base}" ) );
+ value = StringUtils.replace( value, "${appserver.home}",
+ registry.getString( "appserver.home", "${appserver.home}" ) );
return value;
}
}
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractRepositoriesAdminAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractRepositoriesAdminAction.java
index aad944204..f8e8eaf80 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractRepositoriesAdminAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractRepositoriesAdminAction.java
@@ -26,32 +26,34 @@ import org.apache.maven.archiva.configuration.IndeterminateConfigurationExceptio
import org.apache.maven.archiva.configuration.InvalidConfigurationException;
import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
import org.apache.maven.archiva.security.ArchivaRoleConstants;
-import org.apache.maven.archiva.web.action.PlexusActionSupport;
+import org.apache.maven.archiva.web.action.AbstractActionSupport;
import org.codehaus.plexus.redback.rbac.Resource;
import org.codehaus.plexus.registry.RegistryException;
import org.codehaus.redback.integration.interceptor.SecureAction;
import org.codehaus.redback.integration.interceptor.SecureActionBundle;
import org.codehaus.redback.integration.interceptor.SecureActionException;
+import javax.inject.Inject;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* Abstract AdminRepositories Action base.
- *
+ * <p/>
* Base class for all repository administrative functions.
* This should be neutral to the type of action (add/edit/delete) and type of repo (managed/remote)
*
* @version $Id$
*/
public abstract class AbstractRepositoriesAdminAction
- extends PlexusActionSupport
+ extends AbstractActionSupport
implements SecureAction, Auditable
{
/**
- * @plexus.requirement
+ * plexus.requirement
*/
+ @Inject
protected ArchivaConfiguration archivaConfiguration;
public ArchivaConfiguration getArchivaConfiguration()
@@ -77,12 +79,12 @@ public abstract class AbstractRepositoriesAdminAction
/**
* Save the configuration.
- *
+ *
* @param configuration the configuration to save.
* @return the webwork result code to issue.
- * @throws IOException thrown if unable to save file to disk.
+ * @throws IOException thrown if unable to save file to disk.
* @throws InvalidConfigurationException thrown if configuration is invalid.
- * @throws RegistryException thrown if configuration subsystem has a problem saving the configuration to disk.
+ * @throws RegistryException thrown if configuration subsystem has a problem saving the configuration to disk.
*/
protected String saveConfiguration( Configuration configuration )
{
@@ -107,11 +109,12 @@ public abstract class AbstractRepositoriesAdminAction
/**
* Get the list of ProxyConnectors that are present in the configuration.
- *
+ *
* @return a new list of ProxyConnectors present in the configuration.
*/
protected List<ProxyConnectorConfiguration> getProxyConnectors()
{
- return new ArrayList<ProxyConnectorConfiguration>( archivaConfiguration.getConfiguration().getProxyConnectors() );
+ return new ArrayList<ProxyConnectorConfiguration>(
+ archivaConfiguration.getConfiguration().getProxyConnectors() );
}
}
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryAction.java
index 8634ba176..d8996f886 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryAction.java
@@ -27,17 +27,21 @@ import org.apache.maven.archiva.configuration.Configuration;
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.codehaus.plexus.redback.role.RoleManagerException;
import org.codehaus.redback.components.scheduler.CronExpressionValidator;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
import java.io.File;
import java.io.IOException;
/**
- * AddManagedRepositoryAction
+ * AddManagedRepositoryAction
*
* @version $Id$
- *
- * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="addManagedRepositoryAction" instantiation-strategy="per-lookup"
+ * <p/>
+ * plexus.component role="com.opensymphony.xwork2.Action" role-hint="addManagedRepositoryAction" instantiation-strategy="per-lookup"
*/
+@Controller( "addManagedRepositoryAction" )
+@Scope( "prototype" )
public class AddManagedRepositoryAction
extends AbstractManagedRepositoriesAction
implements Preparable, Validateable
@@ -55,7 +59,7 @@ public class AddManagedRepositoryAction
{
this.repository = new ManagedRepositoryConfiguration();
this.repository.setReleases( false );
- this.repository.setScanned( false );
+ this.repository.setScanned( false );
this.repository.setBlockRedeployments( false );
}
@@ -78,7 +82,7 @@ public class AddManagedRepositoryAction
repository.setLocation( removeExpressions( repository.getLocation() ) );
File location = new File( repository.getLocation() );
- if( location.exists() )
+ if ( location.exists() )
{
return CONFIRM;
}
@@ -162,15 +166,15 @@ public class AddManagedRepositoryAction
addFieldError( "repository.id", "Unable to add new repository with id [" + repoId
+ "], that id already exists as a remote repository." );
}
- else if( config.getRepositoryGroupsAsMap().containsKey( repoId ) )
+ else if ( config.getRepositoryGroupsAsMap().containsKey( repoId ) )
{
addFieldError( "repository.id", "Unable to add new repository with id [" + repoId
- + "], that id already exists as a repository group." );
+ + "], that id already exists as a repository group." );
}
else if ( repoId.toLowerCase().contains( "stage" ) )
{
- addFieldError( "repository.id", "Unable to add new repository with id [" + repoId +
- "], rpository id cannot contains word stage" );
+ addFieldError( "repository.id", "Unable to add new repository with id [" + repoId
+ + "], rpository id cannot contains word stage" );
}
if ( !validator.validate( repository.getRefreshCronExpression() ) )
@@ -184,24 +188,24 @@ public class AddManagedRepositoryAction
private void trimAllRequestParameterValues()
{
- if(StringUtils.isNotEmpty(repository.getId()))
+ if ( StringUtils.isNotEmpty( repository.getId() ) )
{
- repository.setId(repository.getId().trim());
+ repository.setId( repository.getId().trim() );
}
- if(StringUtils.isNotEmpty(repository.getName()))
+ if ( StringUtils.isNotEmpty( repository.getName() ) )
{
- repository.setName(repository.getName().trim());
+ repository.setName( repository.getName().trim() );
}
- if(StringUtils.isNotEmpty(repository.getLocation()))
+ if ( StringUtils.isNotEmpty( repository.getLocation() ) )
{
- repository.setLocation(repository.getLocation().trim());
+ repository.setLocation( repository.getLocation().trim() );
}
-
- if(StringUtils.isNotEmpty(repository.getIndexDir()))
+
+ if ( StringUtils.isNotEmpty( repository.getIndexDir() ) )
{
- repository.setIndexDir(repository.getIndexDir().trim());
+ repository.setIndexDir( repository.getIndexDir().trim() );
}
}
@@ -220,7 +224,7 @@ public class AddManagedRepositoryAction
{
this.stageNeeded = stageNeeded;
}
-
+
public String getAction()
{
return action;
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryAction.java
index b2f718294..48761e1f8 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryAction.java
@@ -25,16 +25,20 @@ import org.apache.archiva.audit.AuditEvent;
import org.apache.maven.archiva.configuration.Configuration;
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
import org.codehaus.plexus.redback.role.RoleManagerException;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
import java.io.IOException;
/**
- * AddRemoteRepositoryAction
+ * AddRemoteRepositoryAction
*
* @version $Id$
- *
- * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="addRemoteRepositoryAction" instantiation-strategy="per-lookup"
+ * <p/>
+ * plexus.component role="com.opensymphony.xwork2.Action" role-hint="addRemoteRepositoryAction" instantiation-strategy="per-lookup"
*/
+@Controller( "addRemoteRepositoryAction" )
+@Scope( "prototype" )
public class AddRemoteRepositoryAction
extends AbstractRemoteRepositoriesAction
implements Preparable, Validateable
@@ -42,8 +46,8 @@ public class AddRemoteRepositoryAction
/**
* The model for this action.
*/
- private RemoteRepositoryConfiguration repository;
-
+ private RemoteRepositoryConfiguration repository;
+
public void prepare()
{
this.repository = new RemoteRepositoryConfiguration();
@@ -57,10 +61,10 @@ public class AddRemoteRepositoryAction
public String commit()
{
Configuration configuration = archivaConfiguration.getConfiguration();
-
+
//MRM-752 - url needs trimming
- repository.setUrl(repository.getUrl().trim());
-
+ repository.setUrl( repository.getUrl().trim() );
+
// Save the repository configuration.
String result;
try
@@ -82,14 +86,14 @@ public class AddRemoteRepositoryAction
return result;
}
-
+
@Override
public void validate()
{
Configuration config = archivaConfiguration.getConfiguration();
-
+
String repoId = repository.getId();
-
+
if ( config.getManagedRepositoriesAsMap().containsKey( repoId ) )
{
addFieldError( "repository.id", "Unable to add new repository with id [" + repoId
@@ -100,13 +104,13 @@ public class AddRemoteRepositoryAction
addFieldError( "repository.id", "Unable to add new repository with id [" + repoId
+ "], that id already exists as a remote repository." );
}
- else if( config.getRepositoryGroupsAsMap().containsKey( repoId ) )
+ else if ( config.getRepositoryGroupsAsMap().containsKey( repoId ) )
{
addFieldError( "repository.id", "Unable to add new repository with id [" + repoId
- + "], that id already exists as a repository group." );
+ + "], that id already exists as a repository group." );
}
}
-
+
public RemoteRepositoryConfiguration getRepository()
{
return repository;
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryAction.java
index 3112a56d6..bd72df542 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryAction.java
@@ -30,7 +30,10 @@ import org.apache.maven.archiva.configuration.Configuration;
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
import org.codehaus.plexus.redback.role.RoleManagerException;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
+import javax.inject.Inject;
import java.io.IOException;
import java.util.List;
import java.util.Map;
@@ -41,6 +44,8 @@ import java.util.Map;
* @version $Id$
* @plexus.component role="com.opensymphony.xwork2.Action" role-hint="deleteManagedRepositoryAction" instantiation-strategy="per-lookup"
*/
+@Controller( "deleteManagedRepositoryAction" )
+@Scope( "prototype" )
public class DeleteManagedRepositoryAction
extends AbstractManagedRepositoriesAction
implements Preparable
@@ -52,8 +57,9 @@ public class DeleteManagedRepositoryAction
private String repoid;
/**
- * @plexus.requirement
+ * plexus.requirement
*/
+ @Inject
private RepositoryStatisticsManager repositoryStatisticsManager;
public void prepare()
@@ -61,8 +67,8 @@ public class DeleteManagedRepositoryAction
if ( StringUtils.isNotBlank( repoid ) )
{
this.repository = archivaConfiguration.getConfiguration().findManagedRepositoryById( repoid );
- this.stagingRepository = archivaConfiguration.getConfiguration().findManagedRepositoryById(
- repoid + "-stage" );
+ this.stagingRepository =
+ archivaConfiguration.getConfiguration().findManagedRepositoryById( repoid + "-stage" );
}
}
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRemoteRepositoryAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRemoteRepositoryAction.java
index 8d0dc5afb..e7f30e0b3 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRemoteRepositoryAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRemoteRepositoryAction.java
@@ -25,16 +25,19 @@ import org.apache.commons.lang.StringUtils;
import org.apache.maven.archiva.configuration.Configuration;
import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
import java.util.List;
/**
- * DeleteRemoteRepositoryAction
+ * DeleteRemoteRepositoryAction
*
* @version $Id$
- *
- * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="deleteRemoteRepositoryAction" instantiation-strategy="per-lookup"
+ * plexus.component role="com.opensymphony.xwork2.Action" role-hint="deleteRemoteRepositoryAction" instantiation-strategy="per-lookup"
*/
+@Controller( "deleteRemoteRepositoryAction" )
+@Scope( "prototype" )
public class DeleteRemoteRepositoryAction
extends AbstractRemoteRepositoriesAction
implements Preparable
@@ -76,7 +79,7 @@ public class DeleteRemoteRepositoryAction
removeRepository( repoid, configuration );
triggerAuditEvent( repoid, null, AuditEvent.DELETE_REMOTE_REPO );
result = saveConfiguration( configuration );
-
+
cleanupRepositoryData( existingRepository );
return result;
@@ -85,7 +88,7 @@ public class DeleteRemoteRepositoryAction
private void cleanupRepositoryData( RemoteRepositoryConfiguration existingRepository )
{
// [MRM-520] Proxy Connectors are not deleted with the deletion of a Repository.
-
+
List<ProxyConnectorConfiguration> proxyConnectors = getProxyConnectors();
for ( ProxyConnectorConfiguration proxyConnector : proxyConnectors )
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRepositoryGroupAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRepositoryGroupAction.java
index 98230a9ba..b8e6ba526 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRepositoryGroupAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRepositoryGroupAction.java
@@ -24,21 +24,24 @@ import org.apache.archiva.audit.AuditEvent;
import org.apache.commons.lang.StringUtils;
import org.apache.maven.archiva.configuration.Configuration;
import org.apache.maven.archiva.configuration.RepositoryGroupConfiguration;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
/**
* DeleteRepositoryGroupAction
- *
- * @version
- * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="deleteRepositoryGroupAction" instantiation-strategy="per-lookup"
+ *
+ * plexus.component role="com.opensymphony.xwork2.Action" role-hint="deleteRepositoryGroupAction" instantiation-strategy="per-lookup"
*/
-public class DeleteRepositoryGroupAction
+@Controller( "deleteRepositoryGroupAction" )
+@Scope( "prototype" )
+public class DeleteRepositoryGroupAction
extends AbstractRepositoriesAdminAction
implements Preparable
{
private RepositoryGroupConfiguration repositoryGroup;
private String repoGroupId;
-
+
public void prepare()
{
if ( StringUtils.isNotBlank( repoGroupId ) )
@@ -46,7 +49,7 @@ public class DeleteRepositoryGroupAction
this.repositoryGroup = archivaConfiguration.getConfiguration().findRepositoryGroupById( repoGroupId );
}
}
-
+
public String confirmDelete()
{
if ( StringUtils.isBlank( repoGroupId ) )
@@ -68,12 +71,12 @@ public class DeleteRepositoryGroupAction
addActionError( "A repository group with that id does not exist." );
return ERROR;
}
-
+
config.removeRepositoryGroup( group );
triggerAuditEvent( AuditEvent.DELETE_REPO_GROUP + " " + repoGroupId );
return saveConfiguration( config );
}
-
+
public RepositoryGroupConfiguration getRepositoryGroup()
{
return repositoryGroup;
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryAction.java
index aa5b54527..0937d82a4 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryAction.java
@@ -30,7 +30,10 @@ import org.apache.maven.archiva.configuration.Configuration;
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.codehaus.plexus.redback.role.RoleManagerException;
import org.codehaus.redback.components.scheduler.CronExpressionValidator;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
+import javax.inject.Inject;
import java.io.File;
import java.io.IOException;
@@ -40,6 +43,8 @@ import java.io.IOException;
* @version $Id$
* @plexus.component role="com.opensymphony.xwork2.Action" role-hint="editManagedRepositoryAction" instantiation-strategy="per-lookup"
*/
+@Controller( "editManagedRepositoryAction" )
+@Scope( "prototype" )
public class EditManagedRepositoryAction
extends AbstractManagedRepositoriesAction
implements Preparable, Validateable
@@ -58,8 +63,9 @@ public class EditManagedRepositoryAction
private boolean stageNeeded;
/**
- * @plexus.requirement
+ * plexus.requirement
*/
+ @Inject
private RepositoryStatisticsManager repositoryStatisticsManager;
public void prepare()
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditRemoteRepositoryAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditRemoteRepositoryAction.java
index 771789a02..0442c1aef 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditRemoteRepositoryAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditRemoteRepositoryAction.java
@@ -25,16 +25,20 @@ import org.apache.commons.lang.StringUtils;
import org.apache.maven.archiva.configuration.Configuration;
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
import org.codehaus.plexus.redback.role.RoleManagerException;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
import java.io.IOException;
/**
- * EditRemoteRepositoryAction
+ * EditRemoteRepositoryAction
*
* @version $Id$
- *
- * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="editRemoteRepositoryAction" instantiation-strategy="per-lookup"
+ * <p/>
+ * plexus.component role="com.opensymphony.xwork2.Action" role-hint="editRemoteRepositoryAction" instantiation-strategy="per-lookup"
*/
+@Controller( "editRemoteRepositoryAction" )
+@Scope( "prototype" )
public class EditRemoteRepositoryAction
extends AbstractRemoteRepositoriesAction
implements Preparable
@@ -65,14 +69,14 @@ public class EditRemoteRepositoryAction
addActionError( "Edit failure, unable to edit a repository with a blank repository id." );
return ERROR;
}
-
+
return INPUT;
}
public String commit()
{
Configuration configuration = archivaConfiguration.getConfiguration();
-
+
// We are in edit mode, remove the old repository configuration.
removeRepository( repository.getId(), configuration );
@@ -97,7 +101,7 @@ public class EditRemoteRepositoryAction
return result;
}
-
+
public RemoteRepositoryConfiguration getRepository()
{
return repository;
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesAction.java
index edd7cf820..5cf201d97 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesAction.java
@@ -31,34 +31,40 @@ import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
import org.apache.maven.archiva.configuration.functors.RepositoryConfigurationComparator;
import org.apache.maven.archiva.security.ArchivaRoleConstants;
-import org.apache.maven.archiva.web.action.PlexusActionSupport;
+import org.apache.maven.archiva.web.action.AbstractActionSupport;
import org.apache.maven.archiva.web.util.ContextUtils;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.codehaus.plexus.redback.rbac.Resource;
import org.codehaus.redback.integration.interceptor.SecureAction;
import org.codehaus.redback.integration.interceptor.SecureActionBundle;
import org.codehaus.redback.integration.interceptor.SecureActionException;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
+import javax.inject.Inject;
+import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import javax.servlet.http.HttpServletRequest;
/**
* Shows the Repositories Tab for the administrator.
*
* @version $Id$
- * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="repositoriesAction" instantiation-strategy="per-lookup"
+ * plexus.component role="com.opensymphony.xwork2.Action" role-hint="repositoriesAction" instantiation-strategy="per-lookup"
*/
+@Controller( "repositoriesAction" )
+@Scope( "prototype" )
public class RepositoriesAction
- extends PlexusActionSupport
+ extends AbstractActionSupport
implements SecureAction, ServletRequestAware, Preparable
{
/**
- * @plexus.requirement
+ * plexus.requirement
*/
+ @Inject
private ArchivaConfiguration archivaConfiguration;
private List<ManagedRepositoryConfiguration> managedRepositories;
@@ -75,8 +81,9 @@ public class RepositoriesAction
private String baseUrl;
/**
- * @plexus.requirement
+ * plexus.requirement
*/
+ @Inject
private RepositoryStatisticsManager repositoryStatisticsManager;
public void setServletRequest( HttpServletRequest request )
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryGroupsAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryGroupsAction.java
index 2cb4094af..e28d2f9c0 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryGroupsAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryGroupsAction.java
@@ -27,19 +27,22 @@ import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.configuration.RepositoryGroupConfiguration;
import org.apache.maven.archiva.web.util.ContextUtils;
import org.apache.struts2.interceptor.ServletRequestAware;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
+import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import javax.servlet.http.HttpServletRequest;
/**
* RepositoryGroupsAction
- *
- * @version
- * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="repositoryGroupsAction" instantiation-strategy="per-lookup"
+ *
+ * @version plexus.component role="com.opensymphony.xwork2.Action" role-hint="repositoryGroupsAction" instantiation-strategy="per-lookup"
*/
+@Controller( "repositoryGroupsAction" )
+@Scope( "prototype" )
public class RepositoryGroupsAction
extends AbstractRepositoriesAdminAction
implements ServletRequestAware, Preparable
@@ -53,16 +56,16 @@ public class RepositoryGroupsAction
private Map<String, List<String>> groupToRepositoryMap;
private String repoGroupId;
-
+
private String repoId;
/**
* Used to construct the repository WebDAV URL in the repository action.
*/
private String baseUrl;
-
- private static final Pattern REPO_GROUP_ID_PATTERN = Pattern.compile( "[A-Za-z0-9\\._\\-]+" );
-
+
+ private static final Pattern REPO_GROUP_ID_PATTERN = Pattern.compile( "[A-Za-z0-9\\._\\-]+" );
+
public void setServletRequest( HttpServletRequest request )
{
this.baseUrl = ContextUtils.getBaseURL( request, "repository" );
@@ -71,75 +74,76 @@ public class RepositoryGroupsAction
public void prepare()
{
Configuration config = archivaConfiguration.getConfiguration();
-
+
repositoryGroup = new RepositoryGroupConfiguration();
repositoryGroups = config.getRepositoryGroupsAsMap();
managedRepositories = config.getManagedRepositoriesAsMap();
groupToRepositoryMap = config.getGroupToRepositoryMap();
}
-
+
public String addRepositoryGroup()
{
Configuration configuration = archivaConfiguration.getConfiguration();
String repoGroupId = repositoryGroup.getId();
-
- if( repoGroupId == null || "".equals( repoGroupId.trim() ) )
+
+ if ( repoGroupId == null || "".equals( repoGroupId.trim() ) )
{
addActionError( "Identifier field is required." );
return ERROR;
}
-
- if( repoGroupId.length() > 100 )
+
+ if ( repoGroupId.length() > 100 )
{
addActionError( "Identifier [" + repoGroupId + "] is over the maximum limit of 100 characters" );
return ERROR;
}
-
- Matcher matcher = REPO_GROUP_ID_PATTERN.matcher( repoGroupId );
- if( !matcher.matches() )
+
+ Matcher matcher = REPO_GROUP_ID_PATTERN.matcher( repoGroupId );
+ if ( !matcher.matches() )
{
- addActionError( "Invalid character(s) found in identifier. Only the following characters are allowed: alphanumeric, '.', '-' and '_'" );
+ addActionError(
+ "Invalid character(s) found in identifier. Only the following characters are allowed: alphanumeric, '.', '-' and '_'" );
return ERROR;
}
-
+
if ( StringUtils.isBlank( repoGroupId ) )
{
- addActionError( "You must enter a repository group id." );
- return ERROR;
+ addActionError( "You must enter a repository group id." );
+ return ERROR;
}
-
+
if ( configuration.getRepositoryGroupsAsMap().containsKey( repoGroupId ) )
{
addActionError( "Unable to add new repository group with id [" + repoGroupId
- + "], that id already exists as a repository group." );
+ + "], that id already exists as a repository group." );
return ERROR;
}
else if ( configuration.getManagedRepositoriesAsMap().containsKey( repoGroupId ) )
{
addActionError( "Unable to add new repository group with id [" + repoGroupId
- + "], that id already exists as a managed repository." );
+ + "], that id already exists as a managed repository." );
return ERROR;
}
else if ( configuration.getRemoteRepositoriesAsMap().containsKey( repoGroupId ) )
{
addActionError( "Unable to add new repository group with id [" + repoGroupId
- + "], that id already exists as a remote repository." );
+ + "], that id already exists as a remote repository." );
return ERROR;
}
-
+
configuration.addRepositoryGroup( repositoryGroup );
triggerAuditEvent( AuditEvent.ADD_REPO_GROUP + " " + repoGroupId );
return saveConfiguration( configuration );
}
-
+
public String addRepositoryToGroup()
{
Configuration config = archivaConfiguration.getConfiguration();
RepositoryGroupConfiguration group = config.findRepositoryGroupById( repoGroupId );
-
+
validateRepository();
-
+
if ( hasErrors() )
{
return ERROR;
@@ -153,113 +157,113 @@ public class RepositoryGroupsAction
// remove the old repository group configuration
config.removeRepositoryGroup( group );
-
+
// save repository group configuration
group.addRepository( repoId );
config.addRepositoryGroup( group );
-
+
triggerAuditEvent( repoId, null, AuditEvent.ADD_REPO_TO_GROUP + " " + repoGroupId );
-
+
return saveConfiguration( config );
}
-
+
public String removeRepositoryFromGroup()
{
Configuration config = archivaConfiguration.getConfiguration();
RepositoryGroupConfiguration group = config.findRepositoryGroupById( repoGroupId );
-
+
validateRepository();
-
- if( hasErrors() )
+
+ if ( hasErrors() )
{
return ERROR;
}
-
+
if ( !group.getRepositories().contains( repoId ) )
{
addActionError( "No repository with id[" + repoId + "] found in the group" );
return ERROR;
}
-
+
// remove the old repository group configuration
config.removeRepositoryGroup( group );
-
+
// save repository group configuration
group.removeRepository( repoId );
config.addRepositoryGroup( group );
-
+
triggerAuditEvent( repoId, null, AuditEvent.DELETE_REPO_FROM_GROUP + " " + repoGroupId );
-
+
return saveConfiguration( config );
}
-
+
public void validateRepository()
{
Configuration config = archivaConfiguration.getConfiguration();
RepositoryGroupConfiguration group = config.findRepositoryGroupById( repoGroupId );
ManagedRepositoryConfiguration repo = config.findManagedRepositoryById( repoId );
-
+
if ( group == null )
{
addActionError( "A repository group with that id does not exist." );
}
-
+
if ( repo == null )
{
addActionError( "A repository with that id does not exist." );
}
}
-
+
public RepositoryGroupConfiguration getRepositoryGroup()
{
return repositoryGroup;
}
-
+
public void setRepositoryGroup( RepositoryGroupConfiguration repositoryGroup )
{
this.repositoryGroup = repositoryGroup;
}
-
+
public Map<String, RepositoryGroupConfiguration> getRepositoryGroups()
{
return repositoryGroups;
}
-
+
public void setRepositoryGroups( Map<String, RepositoryGroupConfiguration> repositoryGroups )
{
this.repositoryGroups = repositoryGroups;
}
-
+
public Map<String, ManagedRepositoryConfiguration> getManagedRepositories()
{
return managedRepositories;
}
-
+
public Map<String, List<String>> getGroupToRepositoryMap()
{
return this.groupToRepositoryMap;
}
-
+
public String getRepoGroupId()
{
return repoGroupId;
}
-
+
public void setRepoGroupId( String repoGroupId )
{
this.repoGroupId = repoGroupId;
}
-
+
public String getRepoId()
{
return repoId;
}
-
+
public void setRepoId( String repoId )
{
this.repoId = repoId;
}
-
+
public String getBaseUrl()
{
return baseUrl;
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/SortRepositoriesAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/SortRepositoriesAction.java
index 0794a8ca5..25fa66c2a 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/SortRepositoriesAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/SortRepositoriesAction.java
@@ -19,86 +19,89 @@ package org.apache.maven.archiva.web.action.admin.repositories;
* under the License.
*/
-import java.util.List;
-
import org.apache.commons.lang.StringUtils;
import org.apache.maven.archiva.configuration.Configuration;
import org.apache.maven.archiva.configuration.RepositoryGroupConfiguration;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
+
+import java.util.List;
/**
* SortRepositoriesAction
- *
- * @version
- * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="sortRepositoriesAction" instantiation-strategy="per-lookup"
+ *
+ * @version plexus.component role="com.opensymphony.xwork2.Action" role-hint="sortRepositoriesAction" instantiation-strategy="per-lookup"
*/
-public class SortRepositoriesAction
+@Controller( "sortRepositoriesAction" )
+@Scope( "prototype" )
+public class SortRepositoriesAction
extends AbstractRepositoriesAdminAction
{
private String repoGroupId;
-
+
private String targetRepo;
-
+
public String sortDown()
{
Configuration config = archivaConfiguration.getConfiguration();
-
+
List<String> repositories = getRepositoriesFromGroup();
-
+
int idx = findTargetRepository( repositories, targetRepo );
-
+
if ( idx >= 0 && validIndex( repositories, idx + 1 ) )
{
repositories.remove( idx );
repositories.add( idx + 1, targetRepo );
}
-
+
return saveConfiguration( config );
}
-
+
public String sortUp()
{
Configuration config = archivaConfiguration.getConfiguration();
-
+
List<String> repositories = getRepositoriesFromGroup();
int idx = findTargetRepository( repositories, targetRepo );
-
+
if ( idx >= 0 && validIndex( repositories, idx - 1 ) )
{
repositories.remove( idx );
repositories.add( idx - 1, targetRepo );
}
-
+
return saveConfiguration( config );
}
-
+
public String getRepoGroupId()
{
return repoGroupId;
}
-
+
public void setRepoGroupId( String repoGroupId )
{
this.repoGroupId = repoGroupId;
}
-
+
public String getTargetRepo()
{
return targetRepo;
}
-
+
public void setTargetRepo( String targetRepo )
{
this.targetRepo = targetRepo;
}
-
+
private int findTargetRepository( List<String> repositories, String targetRepository )
{
int idx = ( -1 );
-
+
for ( int i = 0; i < repositories.size(); i++ )
{
- if ( StringUtils.equals( targetRepository, repositories.get(i) ) )
+ if ( StringUtils.equals( targetRepository, repositories.get( i ) ) )
{
idx = i;
break;
@@ -106,16 +109,16 @@ public class SortRepositoriesAction
}
return idx;
}
-
+
private List<String> getRepositoriesFromGroup()
{
Configuration config = archivaConfiguration.getConfiguration();
RepositoryGroupConfiguration repoGroup = config.findRepositoryGroupById( repoGroupId );
return repoGroup.getRepositories();
}
-
+
private boolean validIndex( List<String> repositories, int idx )
- {
- return ( idx >= 0 ) && ( idx < repositories.size() );
- }
+ {
+ return ( idx >= 0 ) && ( idx < repositories.size() );
+ }
}
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/RepositoryScanningAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/RepositoryScanningAction.java
index 6916d6529..04006431c 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/RepositoryScanningAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/RepositoryScanningAction.java
@@ -34,13 +34,16 @@ import org.apache.maven.archiva.configuration.RepositoryScanningConfiguration;
import org.apache.maven.archiva.configuration.functors.FiletypeSelectionPredicate;
import org.apache.maven.archiva.configuration.functors.FiletypeToMapClosure;
import org.apache.maven.archiva.security.ArchivaRoleConstants;
-import org.apache.maven.archiva.web.action.PlexusActionSupport;
+import org.apache.maven.archiva.web.action.AbstractActionSupport;
import org.codehaus.plexus.redback.rbac.Resource;
import org.codehaus.plexus.registry.RegistryException;
import org.codehaus.redback.integration.interceptor.SecureAction;
import org.codehaus.redback.integration.interceptor.SecureActionBundle;
import org.codehaus.redback.integration.interceptor.SecureActionException;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
+import javax.inject.Inject;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -50,20 +53,24 @@ import java.util.Map;
* RepositoryScanningAction
*
* @version $Id$
- * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="repositoryScanningAction" instantiation-strategy="per-lookup"
+ * plexus.component role="com.opensymphony.xwork2.Action" role-hint="repositoryScanningAction" instantiation-strategy="per-lookup"
*/
+@Controller( "repositoryScanningAction" )
+@Scope( "prototype" )
public class RepositoryScanningAction
- extends PlexusActionSupport
+ extends AbstractActionSupport
implements Preparable, Validateable, SecureAction, Auditable
{
/**
- * @plexus.requirement
+ * plexus.requirement
*/
+ @Inject
private ArchivaConfiguration archivaConfiguration;
/**
- * @plexus.requirement
+ * plexus.requirement
*/
+ @Inject
private RepositoryContentConsumers repoconsumerUtil;
private Map<String, FileType> fileTypeMap;
@@ -93,17 +100,17 @@ public class RepositoryScanningAction
private String pattern;
private String fileTypeId;
-
+
public void addActionError( String anErrorMessage )
{
super.addActionError( anErrorMessage );
- log.warn( "[ActionError] " + anErrorMessage );
+ log.warn( "[ActionError] {}", anErrorMessage );
}
public void addActionMessage( String aMessage )
{
super.addActionMessage( aMessage );
- log.info( "[ActionMessage] " + aMessage );
+ log.info( "[ActionMessage] {}", aMessage );
}
public String addFiletypePattern()
@@ -133,7 +140,7 @@ public class RepositoryScanningAction
filetype.addPattern( pattern );
addActionMessage( "Added pattern \"" + pattern + "\" to filetype " + id );
-
+
triggerAuditEvent( AuditEvent.ADD_PATTERN + " " + pattern );
return saveConfiguration();
@@ -225,7 +232,7 @@ public class RepositoryScanningAction
}
filetype.removePattern( getPattern() );
-
+
triggerAuditEvent( AuditEvent.REMOVE_PATTERN + " " + pattern );
return saveConfiguration();
@@ -244,16 +251,17 @@ public class RepositoryScanningAction
public String updateInvalidConsumers()
{
addActionMessage( "Update Invalid Consumers" );
-
- List<String> oldConsumers = archivaConfiguration.getConfiguration().getRepositoryScanning().getInvalidContentConsumers();
+
+ List<String> oldConsumers =
+ archivaConfiguration.getConfiguration().getRepositoryScanning().getInvalidContentConsumers();
archivaConfiguration.getConfiguration().getRepositoryScanning().setInvalidContentConsumers(
enabledInvalidContentConsumers );
-
+
if ( enabledInvalidContentConsumers != null )
{
filterAddedConsumers( oldConsumers, enabledInvalidContentConsumers );
- filterRemovedConsumers( oldConsumers, enabledInvalidContentConsumers );
+ filterRemovedConsumers( oldConsumers, enabledInvalidContentConsumers );
}
else
{
@@ -266,16 +274,17 @@ public class RepositoryScanningAction
public String updateKnownConsumers()
{
addActionMessage( "Update Known Consumers" );
-
- List<String> oldConsumers = archivaConfiguration.getConfiguration().getRepositoryScanning().getKnownContentConsumers();
+
+ List<String> oldConsumers =
+ archivaConfiguration.getConfiguration().getRepositoryScanning().getKnownContentConsumers();
archivaConfiguration.getConfiguration().getRepositoryScanning().setKnownContentConsumers(
enabledKnownContentConsumers );
-
+
if ( enabledKnownContentConsumers != null )
{
filterAddedConsumers( oldConsumers, enabledKnownContentConsumers );
- filterRemovedConsumers( oldConsumers, enabledKnownContentConsumers );
+ filterRemovedConsumers( oldConsumers, enabledKnownContentConsumers );
}
else
{
@@ -337,7 +346,7 @@ public class RepositoryScanningAction
}
}
}
-
+
private void filterRemovedConsumers( List<String> oldList, List<String> newList )
{
for ( String consumer : oldList )
@@ -348,7 +357,7 @@ public class RepositoryScanningAction
}
}
}
-
+
private void disableAllEnabledConsumers( List<String> consumers )
{
for ( String consumer : consumers )
@@ -376,12 +385,12 @@ public class RepositoryScanningAction
{
this.enabledKnownContentConsumers = enabledKnownContentConsumers;
}
-
+
public ArchivaConfiguration getArchivaConfiguration()
{
return archivaConfiguration;
}
-
+
public void setArchivaConfiguration( ArchivaConfiguration archivaConfiguration )
{
this.archivaConfiguration = archivaConfiguration;
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/GenerateReportAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/GenerateReportAction.java
index 1037a0aca..7c4f8cd8e 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/GenerateReportAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/GenerateReportAction.java
@@ -38,7 +38,10 @@ import org.codehaus.redback.integration.interceptor.SecureActionBundle;
import org.codehaus.redback.integration.interceptor.SecureActionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
+import javax.inject.Inject;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -54,8 +57,10 @@ import java.util.Map;
import java.util.TreeMap;
/**
- * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="generateReport" instantiation-strategy="per-lookup"
+ * plexus.component role="com.opensymphony.xwork2.Action" role-hint="generateReport" instantiation-strategy="per-lookup"
*/
+@Controller( "generateReport" )
+@Scope( "prototype" )
public class GenerateReportAction
extends AbstractRepositoryBasedAction
implements SecureAction, Preparable
@@ -65,21 +70,23 @@ public class GenerateReportAction
public static final String BLANK = "blank";
private static final String[] datePatterns =
- new String[]{"MM/dd/yy", "MM/dd/yyyy", "MMMMM/dd/yyyy", "MMMMM/dd/yy", "dd MMMMM yyyy", "dd/MM/yy",
- "dd/MM/yyyy", "yyyy/MM/dd", "yyyy-MM-dd", "yyyy-dd-MM", "MM-dd-yyyy", "MM-dd-yy"};
+ new String[]{ "MM/dd/yy", "MM/dd/yyyy", "MMMMM/dd/yyyy", "MMMMM/dd/yy", "dd MMMMM yyyy", "dd/MM/yy",
+ "dd/MM/yyyy", "yyyy/MM/dd", "yyyy-MM-dd", "yyyy-dd-MM", "MM-dd-yyyy", "MM-dd-yy" };
public static final String SEND_FILE = "send-file";
private Logger log = LoggerFactory.getLogger( GenerateReportAction.class );
/**
- * @plexus.requirement
+ * plexus.requirement
*/
+ @Inject
private ArchivaConfiguration archivaConfiguration;
/**
- * @plexus.requirement
+ * plexus.requirement
*/
+ @Inject
private RepositoryStatisticsManager repositoryStatisticsManager;
private String groupId;
@@ -133,14 +140,14 @@ public class GenerateReportAction
/**
* Generate the statistics report.
- *
+ * <p/>
* check whether single repo report or comparison report
* 1. if it is a single repository, get all the statistics for the repository on the specified date
* - if no date is specified, get only the latest
* (total page = 1 --> no pagination since only the most recent stats will be displayed)
* - otherwise, get everything within the date range (total pages = repo stats / rows per page)
* - required params: repository, startDate, endDate
- *
+ * <p/>
* 2. if multiple repositories, get the latest statistics on each repository on the specified date
* - if no date is specified, use the current date endDate
* - required params: repositories, endDate
@@ -190,8 +197,9 @@ public class GenerateReportAction
List<RepositoryStatistics> stats = null;
try
{
- stats = repositoryStatisticsManager.getStatisticsInRange( metadataRepository, repo,
- startDateInDF, endDateInDF );
+ stats =
+ repositoryStatisticsManager.getStatisticsInRange( metadataRepository, repo, startDateInDF,
+ endDateInDF );
}
catch ( MetadataRepositoryException e )
{
@@ -324,8 +332,8 @@ public class GenerateReportAction
}
input = new StringBuffer(
- "Repository,Total File Count,Total Size,Artifact Count,Group Count,Project Count,Plugins,Archetypes," +
- "Jars,Wars\n" );
+ "Repository,Total File Count,Total Size,Artifact Count,Group Count,Project Count,Plugins,Archetypes,"
+ + "Jars,Wars\n" );
// multiple repos
for ( String repo : selectedRepositories )
@@ -333,8 +341,9 @@ public class GenerateReportAction
List<RepositoryStatistics> stats = null;
try
{
- stats = repositoryStatisticsManager.getStatisticsInRange( metadataRepository, repo,
- startDateInDF, endDateInDF );
+ stats =
+ repositoryStatisticsManager.getStatisticsInRange( metadataRepository, repo, startDateInDF,
+ endDateInDF );
}
catch ( MetadataRepositoryException e )
{
@@ -396,8 +405,8 @@ public class GenerateReportAction
}
input = new StringBuffer(
- "Date of Scan,Total File Count,Total Size,Artifact Count,Group Count,Project Count,Plugins," +
- "Archetypes,Jars,Wars\n" );
+ "Date of Scan,Total File Count,Total Size,Artifact Count,Group Count,Project Count,Plugins,"
+ + "Archetypes,Jars,Wars\n" );
for ( RepositoryStatistics repositoryStats : stats )
{
@@ -555,8 +564,10 @@ public class GenerateReportAction
// TODO: improve performance by navigating into a group subtree. Currently group is property, not part of name of item
for ( String name : metadataRepository.getMetadataFacets( repoId, RepositoryProblemFacet.FACET_ID ) )
{
- RepositoryProblemFacet metadataFacet = (RepositoryProblemFacet) metadataRepository.getMetadataFacet(
- repoId, RepositoryProblemFacet.FACET_ID, name );
+ RepositoryProblemFacet metadataFacet =
+ (RepositoryProblemFacet) metadataRepository.getMetadataFacet( repoId,
+ RepositoryProblemFacet.FACET_ID,
+ name );
if ( StringUtils.isEmpty( groupId ) || groupId.equals( metadataFacet.getNamespace() ) )
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/ViewAuditLogReportAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/ViewAuditLogReportAction.java
index 7aa735bbb..896c6ef05 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/ViewAuditLogReportAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/ViewAuditLogReportAction.java
@@ -29,33 +29,39 @@ import org.apache.maven.archiva.security.AccessDeniedException;
import org.apache.maven.archiva.security.ArchivaSecurityException;
import org.apache.maven.archiva.security.PrincipalNotFoundException;
import org.apache.maven.archiva.security.UserRepositories;
-import org.apache.maven.archiva.web.action.PlexusActionSupport;
+import org.apache.maven.archiva.web.action.AbstractActionSupport;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.codehaus.redback.integration.interceptor.SecureAction;
import org.codehaus.redback.integration.interceptor.SecureActionBundle;
import org.codehaus.redback.integration.interceptor.SecureActionException;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
+import javax.inject.Inject;
+import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.List;
-import javax.servlet.http.HttpServletRequest;
/**
- * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="viewAuditLogReport"
+ * plexus.component role="com.opensymphony.xwork2.Action" role-hint="viewAuditLogReport"
* instantiation-strategy="per-lookup"
*/
+@Controller( "viewAuditLogReport" )
+@Scope( "prototype" )
public class ViewAuditLogReportAction
- extends PlexusActionSupport
+ extends AbstractActionSupport
implements SecureAction, ServletRequestAware, Preparable
{
protected HttpServletRequest request;
/**
- * @plexus.requirement
+ * plexus.requirement
*/
+ @Inject
private UserRepositories userRepositories;
private String repository;
@@ -95,12 +101,13 @@ public class ViewAuditLogReportAction
private static final String HEADER_RESULTS = "Results";
private String[] datePatterns =
- new String[]{"MM/dd/yy", "MM/dd/yyyy", "MMMMM/dd/yyyy", "MMMMM/dd/yy", "dd MMMMM yyyy", "dd/MM/yy",
- "dd/MM/yyyy", "yyyy/MM/dd", "yyyy-MM-dd", "yyyy-dd-MM", "MM-dd-yyyy", "MM-dd-yy"};
+ new String[]{ "MM/dd/yy", "MM/dd/yyyy", "MMMMM/dd/yyyy", "MMMMM/dd/yy", "dd MMMMM yyyy", "dd/MM/yy",
+ "dd/MM/yyyy", "yyyy/MM/dd", "yyyy-MM-dd", "yyyy-dd-MM", "MM-dd-yyyy", "MM-dd-yy" };
/**
- * @plexus.requirement
+ * plexus.requirement
*/
+ @Inject
private AuditManager auditManager;
public SecureActionBundle getSecureActionBundle()
@@ -217,8 +224,9 @@ public class ViewAuditLogReportAction
RepositorySession repositorySession = repositorySessionFactory.createSession();
try
{
- auditLogs = auditManager.getAuditEventsInRange( repositorySession.getRepository(), repos, resource,
- startDateInDF, endDateInDF );
+ auditLogs =
+ auditManager.getAuditEventsInRange( repositorySession.getRepository(), repos, resource, startDateInDF,
+ endDateInDF );
}
finally
{
@@ -253,13 +261,13 @@ public class ViewAuditLogReportAction
auditLogs.remove( rowCount );
}
- prev = request.getRequestURL() + "?page=" + ( page - 1 ) + "&rowCount=" + rowCount + "&groupId=" + groupId +
- "&artifactId=" + artifactId + "&repository=" + repository + "&startDate=" + startDate + "&endDate=" +
- endDate;
+ prev = request.getRequestURL() + "?page=" + ( page - 1 ) + "&rowCount=" + rowCount + "&groupId=" + groupId
+ + "&artifactId=" + artifactId + "&repository=" + repository + "&startDate=" + startDate + "&endDate="
+ + endDate;
- next = request.getRequestURL() + "?page=" + ( page + 1 ) + "&rowCount=" + rowCount + "&groupId=" + groupId +
- "&artifactId=" + artifactId + "&repository=" + repository + "&startDate=" + startDate + "&endDate=" +
- endDate;
+ next = request.getRequestURL() + "?page=" + ( page + 1 ) + "&rowCount=" + rowCount + "&groupId=" + groupId
+ + "&artifactId=" + artifactId + "&repository=" + repository + "&startDate=" + startDate + "&endDate="
+ + endDate;
prev = StringUtils.replace( prev, " ", "%20" );
next = StringUtils.replace( next, " ", "%20" );
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/interceptor/ConfigurationInterceptor.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/interceptor/ConfigurationInterceptor.java
index c9afa9a8f..b498c82f9 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/interceptor/ConfigurationInterceptor.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/interceptor/ConfigurationInterceptor.java
@@ -19,11 +19,14 @@ package org.apache.maven.archiva.web.interceptor;
* under the License.
*/
-import org.apache.struts2.ServletActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import org.apache.struts2.ServletActionContext;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+import javax.inject.Inject;
import javax.servlet.ServletContext;
/**
@@ -32,12 +35,15 @@ import javax.servlet.ServletContext;
* @plexus.component role="com.opensymphony.xwork2.interceptor.Interceptor"
* role-hint="configurationInterceptor"
*/
+@Service( "configurationInterceptor" )
+@Scope( "prototype" )
public class ConfigurationInterceptor
implements Interceptor
{
/**
- * @plexus.requirement role-hint="default"
+ * plexus.requirement role-hint="default"
*/
+ @Inject
private ArchivaConfiguration configuration;
public String intercept( ActionInvocation actionInvocation )
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/SecuritySynchronization.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/SecuritySynchronization.java
index d3a920305..6f59721d5 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/SecuritySynchronization.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/SecuritySynchronization.java
@@ -19,12 +19,8 @@ package org.apache.maven.archiva.web.startup;
* under the License.
*/
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.StringUtils;
import org.apache.maven.archiva.common.ArchivaException;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.ConfigurationNames;
@@ -41,27 +37,42 @@ import org.codehaus.plexus.registry.Registry;
import org.codehaus.plexus.registry.RegistryListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.context.ApplicationContext;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+import javax.inject.Named;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
/**
* ConfigurationSynchronization
*
* @version $Id$
- * @plexus.component role="org.apache.maven.archiva.web.startup.SecuritySynchronization"
+ * plexus.component role="org.apache.maven.archiva.web.startup.SecuritySynchronization"
* role-hint="default"
*/
+@Service
public class SecuritySynchronization
implements RegistryListener
{
private Logger log = LoggerFactory.getLogger( SecuritySynchronization.class );
/**
- * @plexus.requirement role-hint="default"
+ * plexus.requirement role-hint="default"
*/
+ @Inject
private RoleManager roleManager;
/**
- * @plexus.requirement role-hint="cached"
+ * plexus.requirement role-hint="cached"
*/
+ @Inject
+ @Named( value = "rBACManager#cached" )
private RBACManager rbacManager;
/**
@@ -70,10 +81,37 @@ public class SecuritySynchronization
private Map<String, EnvironmentCheck> checkers;
/**
- * @plexus.requirement
+ * plexus.requirement
*/
+ @Inject
private ArchivaConfiguration archivaConfiguration;
+ @Inject
+ private ApplicationContext applicationContext;
+
+ @PostConstruct
+ public void initialize()
+ {
+ checkers = getBeansOfType( EnvironmentCheck.class );
+ }
+
+ protected <T> Map<String, T> getBeansOfType( Class<T> clazz )
+ {
+ //TODO do some caching here !!!
+ // olamy : with plexus we get only roleHint
+ // as per convention we named spring bean role#hint remove role# if exists
+ Map<String, T> springBeans = applicationContext.getBeansOfType( clazz );
+
+ Map<String, T> beans = new HashMap<String, T>( springBeans.size() );
+
+ for ( Map.Entry<String, T> entry : springBeans.entrySet() )
+ {
+ String key = StringUtils.substringAfterLast( entry.getKey(), "#" );
+ beans.put( key, entry.getValue() );
+ }
+ return beans;
+ }
+
public void afterConfigurationChange( Registry registry, String propertyName, Object propertyValue )
{
if ( ConfigurationNames.isManagedRepositories( propertyName ) )
@@ -182,8 +220,8 @@ public class SecuritySynchronization
msg.append( "======================================================================" );
log.error( msg.toString() );
- throw new ArchivaException( "Unable to initialize Redback Security Environment, [" + violations.size() +
- "] violation(s) encountered, See log for details." );
+ throw new ArchivaException( "Unable to initialize Redback Security Environment, [" + violations.size()
+ + "] violation(s) encountered, See log for details." );
}
}
@@ -213,9 +251,8 @@ public class SecuritySynchronization
}
catch ( RbacManagerException e )
{
- log.warn(
- "Unable to add role [" + ArchivaRoleConstants.toRepositoryObserverRoleName( repoId ) + "] to " +
- principal + " user.", e );
+ log.warn( "Unable to add role [" + ArchivaRoleConstants.toRepositoryObserverRoleName( repoId ) + "] to "
+ + principal + " user.", e );
}
}
}
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DependencyTree.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DependencyTree.java
index a772c5bd5..fadd061a4 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DependencyTree.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DependencyTree.java
@@ -19,10 +19,6 @@ package org.apache.maven.archiva.web.tags;
* under the License.
*/
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Stack;
-
import com.opensymphony.xwork2.ActionContext;
import org.apache.archiva.dependency.tree.maven2.DependencyTreeBuilder;
import org.apache.commons.lang.StringUtils;
@@ -36,25 +32,33 @@ import org.apache.maven.shared.dependency.tree.DependencyTreeBuilderException;
import org.apache.maven.shared.dependency.tree.traversal.DependencyNodeVisitor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Inject;
+import java.util.ArrayList;
+import java.util.List;
/**
* DependencyTree
*
* @version $Id$
- * @plexus.component role="org.apache.maven.archiva.web.tags.DependencyTree"
+ * plexus.component role="org.apache.maven.archiva.web.tags.DependencyTree"
*/
+@Service
public class DependencyTree
{
private Logger log = LoggerFactory.getLogger( DependencyTree.class );
/**
- * @plexus.requirement role-hint="maven2"
+ * plexus.requirement role-hint="maven2"
*/
+ @Inject
private DependencyTreeBuilder dependencyTreeBuilder;
/**
- * @plexus.requirement
+ * plexus.requirement
*/
+ @Inject
private UserRepositories userRepositories;
public static class TreeEntry
@@ -101,24 +105,24 @@ public class DependencyTree
{
if ( StringUtils.isBlank( groupId ) )
{
- String emsg = "Error generating dependency tree [" + Keys.toKey( groupId, artifactId, modelVersion ) +
- "]: groupId is blank.";
+ String emsg = "Error generating dependency tree [" + Keys.toKey( groupId, artifactId, modelVersion )
+ + "]: groupId is blank.";
log.error( emsg );
throw new ArchivaException( emsg );
}
if ( StringUtils.isBlank( artifactId ) )
{
- String emsg = "Error generating dependency tree [" + Keys.toKey( groupId, artifactId, modelVersion ) +
- "]: artifactId is blank.";
+ String emsg = "Error generating dependency tree [" + Keys.toKey( groupId, artifactId, modelVersion )
+ + "]: artifactId is blank.";
log.error( emsg );
throw new ArchivaException( emsg );
}
if ( StringUtils.isBlank( modelVersion ) )
{
- String emsg = "Error generating dependency tree [" + Keys.toKey( groupId, artifactId, modelVersion ) +
- "]: version is blank.";
+ String emsg = "Error generating dependency tree [" + Keys.toKey( groupId, artifactId, modelVersion )
+ + "]: version is blank.";
log.error( emsg );
throw new ArchivaException( emsg );
}
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/resources/struts.properties b/archiva-modules/archiva-web/archiva-webapp/src/main/resources/struts.properties
index bc06a20de..0aa44b4da 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/resources/struts.properties
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/resources/struts.properties
@@ -19,9 +19,19 @@
# define our own action mapper here
struts.mapper.class = org.apache.maven.archiva.web.mapper.RepositoryActionMapper
-struts.objectFactory = org.codehaus.plexus.spring.Struts2PlexusInSpringObjectFactory
+#struts.objectFactory = org.codehaus.plexus.spring.Struts2PlexusInSpringObjectFactory
+
+## TODO olamy chech fix for https://issues.apache.org/jira/browse/WW-3460
+## upgrade of struts version or use our own hacked ObjectFactory
+struts.objectFactory = org.apache.struts2.spring.StrutsSpringObjectFactory
+struts.objectFactory.spring.autoWire = type
+
struts.url.includeParams = none
+
+## freemarker configuration
struts.freemarker.templatesCache=true
+struts.freemarker.mru.max.strong.size=1000
+struts.freemarker.templatesCache.updateDelay=3600000
#struts.devMode = true
struts.configuration.xml.reload=true
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml
index 0accd645a..2c9859fd0 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml
@@ -1,14 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
+ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context-3.0.xsd">
+
+ <context:property-placeholder location="classpath:application.properties" />
+
<bean id="loggerManager" class="org.codehaus.plexus.logging.slf4j.Slf4jLoggerManager"
init-method="initialize"/>
<alias name="repositorySessionFactory#file" alias="repositorySessionFactory"/>
+ <!--
+ TODO olamy check user agent used in wagon !!
<bean name="wagon#http" class="org.apache.maven.wagon.providers.http.LightweightHttpWagon" scope="prototype">
<property name="httpHeaders">
<map>
@@ -24,11 +32,7 @@
</map>
</property>
</bean>
-
- <bean id="propertyPlaceholder" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
- <property name="location" value="classpath:application.properties"/>
- </bean>
-
+ -->
<bean name="xmlRpcUserRepositories" class="org.apache.archiva.web.xmlrpc.security.XmlRpcUserRepositories">
<constructor-arg ref="userRepositories"/>
<constructor-arg ref="xmlRpcAuthenticator"/>
@@ -92,4 +96,272 @@
<bean name="profileActivator#jdk-prefix" class="org.apache.archiva.web.spring.DummyProfileActivator"/>
<bean name="profileActivator#system-property" class="org.apache.archiva.web.spring.DummyProfileActivator"/>
<bean name="profileActivator#always-on" class="org.apache.archiva.web.spring.DummyProfileActivator"/>
+
+ <bean name="commons-configuration" class="org.codehaus.redback.components.registry.commons.CommonsConfigurationRegistry">
+ <property name="properties">
+ <value>
+ <![CDATA[
+ <configuration>
+ <system/>
+ <jndi prefix="java:comp/env" config-optional="true"/>
+ <xml fileName="${user.home}/.m2/archiva.xml" config-optional="true"
+ config-name="org.apache.maven.archiva.user"
+ config-at="org.apache.maven.archiva"/>
+ <xml fileName="${user.home}/.m2/shared.xml" config-optional="true"
+ config-name="org.apache.maven.shared.app.user" config-at="org.apache.maven.shared.app"
+ config-forceCreate="true"/>
+ <properties fileName="${user.home}/.m2/security.properties" config-optional="true"
+ config-at="org.codehaus.plexus.redback"/>
+ <properties fileName="${user.home}/.m2/archiva.properties" config-optional="true"
+ config-at="org.codehaus.plexus.redback"/>
+ <xml fileName="${appserver.base}/conf/archiva.xml" config-optional="true"
+ config-name="org.apache.maven.archiva.base"
+ config-at="org.apache.maven.archiva"/>
+ <xml fileName="${appserver.base}/conf/shared.xml" config-optional="true"
+ config-name="org.apache.maven.shared.app.base" config-at="org.apache.maven.shared.app"/>
+ <xml fileName="${appserver.base}/conf/common.xml" config-optional="true"/>
+ <properties fileName="${appserver.base}/conf/security.properties" config-optional="true"
+ config-at="org.codehaus.plexus.redback"/>
+ <xml fileName="${appserver.home}/conf/archiva.xml" config-optional="true"
+ config-at="org.apache.maven.archiva"/>
+ <xml fileName="${appserver.home}/conf/shared.xml" config-optional="true"
+ config-at="org.apache.maven.shared.app"/>
+ <xml fileName="${appserver.home}/conf/common.xml" config-optional="true"/>
+ <properties fileName="${appserver.home}/conf/security.properties" config-optional="true"
+ config-at="org.codehaus.plexus.redback"/>
+ <properties fileName="org/apache/maven/archiva/security.properties" config-at="org.codehaus.plexus.redback"/>
+ </configuration>
+ ]]>
+ </value>
+ </property>
+ </bean>
+
+ <bean name="jdoFactory#users" class="org.codehaus.plexus.jdo.DataSourceConfigurableJdoFactory">
+ <property name="connectionFactoryName" value="java:comp/env/jdbc/users"/>
+ <property name="shutdownConnectionFactoryName" value="java:comp/env/jdbc/usersShutdown"/>
+ <property name="persistenceManagerFactoryClass" value="org.jpox.PersistenceManagerFactoryImpl"/>
+ <property name="otherProperties">
+ <props>
+ <prop key="org.jpox.autoCreateSchema">true</prop>
+ <prop key="org.jpox.validateTables">false</prop>
+ <prop key="org.jpox.validateConstraints">false</prop>
+ <prop key="org.jpox.validateColumns">false</prop>
+ <prop key="org.jpox.autoStartMechanism">None</prop>
+ <prop key="org.jpox.transactionIsolation">READ_COMMITTED</prop>
+ <prop key="org.jpox.poid.transactionIsolation">READ_COMMITTED</prop>
+ <prop key="org.jpox.rdbms.dateTimezone">JDK_DEFAULT_TIMEZONE</prop>
+ <!-- NEEDED FOR MYSQL UTF-8 Databases -->
+ <prop key="org.jpox.rdbms.stringDefaultLength">255</prop>
+
+ <!-- NEEDED FOR POSTGRES, But causes problems in other JDBC implementations.
+ <prop key="org.jpox.identifier.case">PreserveCase</prop>
+ -->
+ </props>
+ </property>
+ </bean>
+
+
+
+
+ <!-- <component>
+ <role>org.apache.maven.archiva.webdav.util.MimeTypes</role>
+ <implementation>org.apache.maven.archiva.webdav.util.MimeTypes</implementation>
+ <description>MimeTypes</description>
+ <configuration>
+ <resource>archiva-mime-types.txt</resource>
+ </configuration>
+ </component> -->
+
+
+ <!--
+ olamy TODO check if necessary !!
+ PLXREDBACK-81 bad role hint, redefining here until redback alpha-2 is released.
+
+ <component>
+ <role>org.codehaus.plexus.redback.system.check.EnvironmentCheck</role>
+ <role-hint>locked-admin-check</role-hint>
+ <implementation>org.codehaus.redback.integration.checks.security.LockedAdminEnvironmentCheck</implementation>
+ <description>LockedAdminEnvironmentCheck: checks if accounts marked as system administrator are locked
+ and unlocks them on startup.
+ </description>
+ <requirements>
+ <requirement>
+ <role>org.codehaus.plexus.redback.users.UserManager</role>
+ <role-hint>cached</role-hint>
+ <field-name>userManager</field-name>
+ </requirement>
+ <requirement>
+ <role>org.codehaus.plexus.redback.rbac.RBACManager</role>
+ <role-hint>cached</role-hint>
+ <field-name>rbacManager</field-name>
+ </requirement>
+ </requirements>
+ </component>
+ -->
+
+ <!-- TODO move to spring sample and test it -->
+ <!-- START SNIPPET: ldap -->
+ <!--
+ Ldap Authentication can be enabled by setting enabling these components and setting the following configuration options in your security.properties file
+
+ ============================================================
+ user.manager.impl=ldap
+ ldap.bind.authenticator.enabled=true
+ redback.default.admin=admin
+ security.policy.password.expiration.enabled=false
+
+ ldap.config.hostname=ldap.hostname
+ ldap.config.port=389
+ ldap.config.base.dn=o=com
+ ldap.config.context.factory=com.sun.jndi.ldap.LdapCtxFactory
+ ldap.config.bind.dn=uid=myusername,o=com
+ ldap.config.password=s3cr3t
+ #ldap.config.authentication.method=
+ ============================================================
+
+ * ldap.config.hostname - The hostname of the ldap server
+ * ldap.config.port - The port of the ldap server
+ * ldap.config.base.dn - The baseDn of the ldap system
+ * ldap.config.context.factory - context factory for ldap connections
+ * ldap.config.bind.dn - the core user used for authentication the ldap server, must be able to perform the necessary searches, etc.
+ * ldap.config.password - password for the bindDn for the root ldap connection
+
+ until this process is better documented, the following is the document for configuration ldap with redback
+
+ http://redback.codehaus.org/integration/ldap.html
+ -->
+
+ <!--
+
+ this component manages the connection to the ldap server
+ -->
+
+ <!-- component>
+ <role>org.codehaus.plexus.redback.common.ldap.connection.LdapConnectionFactory</role>
+ <role-hint>configurable</role-hint>
+ <implementation>org.codehaus.plexus.redback.common.ldap.connection.ConfigurableLdapConnectionFactory</implementation>
+ <requirements>
+ <requirement>
+ <role>org.codehaus.plexus.redback.configuration.UserConfiguration</role>
+ </requirement>
+ </requirements>
+ </component-->
+
+ <!--
+
+ this component manages the mapping of attributes in ldap to user information in redback. To configure the mapping, you can add the following properties in your security.properties
+
+ ============================================================
+ ldap.config.mapper.attribute.email=mail
+ ldap.config.mapper.attribute.fullname=givenName
+ ldap.config.mapper.attribute.password=userPassword
+ ldap.config.mapper.attribute.user.id=cn
+ ldap.config.mapper.attribute.user.base.dn=
+ ldap.config.mapper.attribute.user.object.class=inetOrgPerson
+ ldap.config.mapper.attribute.user.filter=(attributeName=value)
+ ============================================================
+
+
+ * email-attribute - The name of the attribute on a user that contains the email address
+ * full-name-attribute - The name of the attribute on a user that contains the users fullName
+ * password-attribute - The name of the attribute containing the users password, used for the authentiction using the user manager and not the ldap bind authenticator
+ * user-id-attribute - The name of the attribute containing the users userId, most commonly cn or sn.
+ * user-base-dn - The base dn that will be subtree searched for users.
+ * user-object-class - the objectClass used in the ldap server for indentifying users, most commonly inetOrgPerson.
+ -->
+
+ <!-- component>
+ <role>org.codehaus.plexus.redback.common.ldap.UserMapper</role>
+ <role-hint>ldap</role-hint>
+ <implementation>org.codehaus.plexus.redback.common.ldap.LdapUserMapper</implementation>
+ <configuration>
+ <email-attribute>email</email-attribute>
+ <full-name-attribute>givenName</full-name-attribute>
+ <password-attribute>userPassword</password-attribute>
+ <user-id-attribute>cn</user-id-attribute>
+ <user-base-dn>o=com</user-base-dn>
+ <user-object-class>inetOrgPerson</user-object-class>
+ </configuration>
+ <requirements>
+ <requirement>
+ <role>org.codehaus.plexus.redback.configuration.UserConfiguration</role>
+ </requirement>
+ </requirements>
+ </component-->
+
+ <!--
+
+ If caching is desired to improve performance then make uncomment this and make sure the following configuration parameter is in the security.properties
+
+ user.manager.impl=cached
+ -->
+
+ <!-- component>
+ <role>org.codehaus.plexus.redback.users.UserManager</role>
+ <role-hint>cached</role-hint>
+ <implementation>org.codehaus.plexus.redback.users.cached.CachedUserManager</implementation>
+ <description>CachedUserManager</description>
+ <requirements>
+ <requirement>
+ <role>org.codehaus.plexus.redback.users.UserManager</role>
+ <role-hint>ldap</role-hint>
+ <field-name>userImpl</field-name>
+ </requirement>
+ <requirement>
+ <role>org.codehaus.plexus.cache.Cache</role>
+ <role-hint>users</role-hint>
+ <field-name>usersCache</field-name>
+ </requirement>
+ </requirements>
+ </component-->
+
+ <!--
+
+ if using the user manager authenticator to authenticate the user and not the ldap bind authenticator make sure
+ this definition has the correct password encoder
+
+ Note: you should probably just use the ldap bind authenticator which is enabled by putting
+
+ ldap.bind.authenticator.enabled=true
+
+ in the security.properties
+ -->
+
+ <!-- component>
+ <role>org.codehaus.plexus.redback.policy.UserSecurityPolicy</role>
+ <role-hint>default</role-hint>
+ <implementation>org.codehaus.plexus.redback.policy.DefaultUserSecurityPolicy</implementation>
+ <description>User Security Policy.</description>
+ <requirements>
+ <requirement>
+ <role>org.codehaus.plexus.redback.configuration.UserConfiguration</role>
+ <field-name>config</field-name>
+ </requirement>
+ <requirement>
+ <role>org.codehaus.plexus.redback.policy.PasswordEncoder</role>
+ <role-hint>sha1</role-hint>
+ <field-name>passwordEncoder</field-name>
+ </requirement>
+ <requirement>
+ <role>org.codehaus.plexus.redback.policy.UserValidationSettings</role>
+ <field-name>userValidationSettings</field-name>
+ </requirement>
+ <requirement>
+ <role>org.codehaus.plexus.redback.policy.CookieSettings</role>
+ <role-hint>rememberMe</role-hint>
+ <field-name>rememberMeCookieSettings</field-name>
+ </requirement>
+ <requirement>
+ <role>org.codehaus.plexus.redback.policy.CookieSettings</role>
+ <role-hint>signon</role-hint>
+ <field-name>signonCookieSettings</field-name>
+ </requirement>
+ <requirement>
+ <role>org.codehaus.plexus.redback.policy.PasswordRule</role>
+ <field-name>rules</field-name>
+ </requirement>
+ </requirements>
+ </component-->
+ <!-- END SNIPPET: ldap -->
+
</beans>
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/web.xml b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/web.xml
index 74d3413f5..fad3f3353 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/web.xml
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/web.xml
@@ -24,10 +24,10 @@
<display-name>Apache Archiva</display-name>
- <filter>
- <filter-name>webwork-cleanup</filter-name>
- <filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
- </filter>
+ <filter>
+ <filter-name>webwork-cleanup</filter-name>
+ <filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
+ </filter>
<filter>
<filter-name>sitemesh</filter-name>
@@ -36,23 +36,23 @@
</filter-class>
</filter>
- <filter>
- <filter-name>struts2</filter-name>
- <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
- </filter>
+ <filter>
+ <filter-name>struts2</filter-name>
+ <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
+ </filter>
- <filter>
- <filter-name>encodingFilter</filter-name>
- <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
- <init-param>
- <param-name>encoding</param-name>
- <param-value>UTF-8</param-value>
- </init-param>
- <init-param>
- <param-name>forceEncoding</param-name>
- <param-value>true</param-value>
- </init-param>
- </filter>
+ <filter>
+ <filter-name>encodingFilter</filter-name>
+ <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
+ <init-param>
+ <param-name>encoding</param-name>
+ <param-value>UTF-8</param-value>
+ </init-param>
+ <init-param>
+ <param-name>forceEncoding</param-name>
+ <param-value>true</param-value>
+ </init-param>
+ </filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
@@ -88,18 +88,9 @@
</listener>
<context-param>
- <param-name>contextClass</param-name>
- <param-value>
- org.codehaus.plexus.spring.PlexusWebApplicationContext
- </param-value>
- </context-param>
-
- <context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
- classpath*:META-INF/plexus/components.xml
classpath*:META-INF/spring-context.xml
- /WEB-INF/application.xml
/WEB-INF/applicationContext.xml
</param-value>
</context-param>
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryActionTest.java
index 3872c1ff7..2b890c499 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryActionTest.java
@@ -27,13 +27,11 @@ import java.util.List;
import java.util.Map;
import com.opensymphony.xwork2.Action;
-import org.apache.archiva.audit.AuditListener;
import org.apache.commons.io.FileUtils;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.Configuration;
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.security.ArchivaRoleConstants;
-import org.apache.maven.archiva.web.action.PlexusActionSupport;
import org.apache.maven.archiva.web.validator.utils.ValidatorUtil;
import org.codehaus.plexus.redback.role.RoleManager;
import org.codehaus.plexus.registry.Registry;
diff --git a/archiva-modules/plugins/maven2-repository/pom.xml b/archiva-modules/plugins/maven2-repository/pom.xml
index e6b3f647d..9b560c6b3 100644
--- a/archiva-modules/plugins/maven2-repository/pom.xml
+++ b/archiva-modules/plugins/maven2-repository/pom.xml
@@ -55,11 +55,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model-builder</artifactId>
</dependency>
@@ -92,6 +87,11 @@
<artifactId>test-repository</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<dependencyManagement>
<dependencies>
diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java
index 2cd5cc426..943fcf7c0 100644
--- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java
+++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java
@@ -109,7 +109,7 @@ public class Maven2RepositoryStorage
public void initialize()
throws PlexusSisuBridgeException
{
- builder = plexusSisuBridge.lookup( ModelBuilder.class );
+ builder = plexusSisuBridge.lookup( ModelBuilder.class, "default" );
}
public ProjectMetadata readProjectMetadata( String repoId, String namespace, String projectId )
diff --git a/pom.xml b/pom.xml
index de9307630..d2337e896 100644
--- a/pom.xml
+++ b/pom.xml
@@ -68,7 +68,7 @@
<wagon.version>1.0-beta-5</wagon.version>
<redback.version>1.3-SNAPSHOT</redback.version>
<jetty.version>6.1.19</jetty.version>
- <slf4j.version>1.5.8</slf4j.version>
+ <slf4j.version>1.6.1</slf4j.version>
<binder.version>0.9</binder.version>
<spring.version>3.0.5.RELEASE</spring.version>
<jackrabbit.version>2.2.5</jackrabbit.version>