]> source.dussan.org Git - archiva.git/commitdiff
remove use of plexus-spring all struts actions are spring beans now. Note still have...
authorOlivier Lamy <olamy@apache.org>
Thu, 9 Jun 2011 15:23:21 +0000 (15:23 +0000)
committerOlivier Lamy <olamy@apache.org>
Thu, 9 Jun 2011 15:23:21 +0000 (15:23 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1133928 13f79535-47bb-0310-9956-ffa450edef68

56 files changed:
archiva-modules/archiva-base/archiva-plexus-bridge/src/main/java/org/apache/archiva/common/plexusbridge/PlexusSisuBridge.java
archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContent.java
archiva-modules/archiva-web/archiva-webapp/pom.xml
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/AbstractActionSupport.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/AbstractRepositoryBasedAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/DeleteArtifactAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/MergeAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/PlexusActionSupport.java [deleted file]
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/SchedulerAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/SystemStatusAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/appearance/AbstractAppearanceAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/appearance/EditOrganisationInfoAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/appearance/OrganisationInfoAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AbstractProxyConnectorAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AbstractProxyConnectorFormAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AddProxyConnectorAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/DeleteProxyConnectorAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/DisableProxyConnectorAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/EditProxyConnectorAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/EnableProxyConnectorAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ProxyConnectorsAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/SortProxyConnectorsAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/DeleteLegacyArtifactPathAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/LegacyArtifactPathAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/NetworkProxiesAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractManagedRepositoriesAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractRepositoriesAdminAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRemoteRepositoryAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRepositoryGroupAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditRemoteRepositoryAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryGroupsAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/SortRepositoriesAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/RepositoryScanningAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/GenerateReportAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/ViewAuditLogReportAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/interceptor/ConfigurationInterceptor.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/SecuritySynchronization.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DependencyTree.java
archiva-modules/archiva-web/archiva-webapp/src/main/resources/struts.properties
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/web.xml
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryActionTest.java
archiva-modules/plugins/maven2-repository/pom.xml
archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java
pom.xml

index 5de3cc7de6a7583ecce6e85286b66c669d8bbade..9ad8030493c852c75c45cd23674f47c85c382c9f 100644 (file)
@@ -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 );
index 0ba6d1869acaa0d0b00682b6228aa42184a553e4..6bbd615270a09deddfe88a5e368de0f13754040c 100644 (file)
@@ -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"
index 849a626c9647680cf275491fdac7524e4e5dccfb..e70751fdcf6196159b569f1467a9b52786155850 100644 (file)
       <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>
           </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/AbstractActionSupport.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/AbstractActionSupport.java
new file mode 100644 (file)
index 0000000..9b54c99
--- /dev/null
@@ -0,0 +1,180 @@
+package org.apache.maven.archiva.web.action;\r
+\r
+/*\r
+ * Licensed to the Apache Software Foundation (ASF) under one\r
+ * or more contributor license agreements.  See the NOTICE file\r
+ * distributed with this work for additional information\r
+ * regarding copyright ownership.  The ASF licenses this file\r
+ * to you under the Apache License, Version 2.0 (the\r
+ * "License"); you may not use this file except in compliance\r
+ * with the License.  You may obtain a copy of the License at\r
+ *\r
+ *  http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing,\r
+ * software distributed under the License is distributed on an\r
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r
+ * KIND, either express or implied.  See the License for the\r
+ * specific language governing permissions and limitations\r
+ * under the License.\r
+ */\r
+\r
+import com.google.common.collect.Lists;\r
+import com.opensymphony.xwork2.ActionContext;\r
+import com.opensymphony.xwork2.ActionSupport;\r
+import org.apache.archiva.audit.AuditEvent;\r
+import org.apache.archiva.audit.AuditListener;\r
+import org.apache.archiva.audit.Auditable;\r
+import org.apache.archiva.metadata.repository.RepositorySessionFactory;\r
+import org.apache.commons.lang.StringUtils;\r
+import org.apache.maven.archiva.security.ArchivaXworkUser;\r
+import org.apache.struts2.ServletActionContext;\r
+import org.apache.struts2.interceptor.SessionAware;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+import org.springframework.context.ApplicationContext;\r
+\r
+import javax.annotation.PostConstruct;\r
+import javax.inject.Inject;\r
+import javax.servlet.http.HttpServletRequest;\r
+import java.util.ArrayList;\r
+import java.util.HashMap;\r
+import java.util.List;\r
+import java.util.Map;\r
+\r
+/**\r
+ * LogEnabled and SessionAware ActionSupport\r
+ */\r
+public abstract class AbstractActionSupport\r
+    extends ActionSupport\r
+    implements SessionAware, Auditable\r
+{\r
+    protected Map<?, ?> session;\r
+\r
+    protected Logger log = LoggerFactory.getLogger( getClass() );\r
+\r
+    /**\r
+     * plexus.requirement role="org.apache.archiva.audit.AuditListener"\r
+     */\r
+    private List<AuditListener> auditListeners = new ArrayList<AuditListener>();\r
+\r
+    /**\r
+     * plexus.requirement\r
+     */\r
+    @Inject\r
+    protected RepositorySessionFactory repositorySessionFactory;\r
+\r
+    @Inject\r
+    protected ApplicationContext applicationContext;\r
+\r
+    private String principal;\r
+\r
+    @PostConstruct\r
+    public void initialize()\r
+    {\r
+        // TODO some caching here\r
+        this.auditListeners = Lists.newArrayList( applicationContext.getBeansOfType( AuditListener.class ).values() );\r
+    }\r
+\r
+    @SuppressWarnings( "unchecked" )\r
+    public void setSession( Map map )\r
+    {\r
+        this.session = map;\r
+    }\r
+\r
+    public void addAuditListener( AuditListener listener )\r
+    {\r
+        this.auditListeners.add( listener );\r
+    }\r
+\r
+    public void clearAuditListeners()\r
+    {\r
+        this.auditListeners.clear();\r
+    }\r
+\r
+    public void removeAuditListener( AuditListener listener )\r
+    {\r
+        this.auditListeners.remove( listener );\r
+    }\r
+\r
+    protected void triggerAuditEvent( String repositoryId, String resource, String action )\r
+    {\r
+        AuditEvent event = new AuditEvent( repositoryId, getPrincipal(), resource, action );\r
+        event.setRemoteIP( getRemoteAddr() );\r
+\r
+        for ( AuditListener listener : auditListeners )\r
+        {\r
+            listener.auditEvent( event );\r
+        }\r
+    }\r
+\r
+    protected void triggerAuditEvent( String resource, String action )\r
+    {\r
+        AuditEvent event = new AuditEvent( null, getPrincipal(), resource, action );\r
+        event.setRemoteIP( getRemoteAddr() );\r
+\r
+        for ( AuditListener listener : auditListeners )\r
+        {\r
+            listener.auditEvent( event );\r
+        }\r
+    }\r
+\r
+    protected void triggerAuditEvent( String action )\r
+    {\r
+        AuditEvent event = new AuditEvent( null, getPrincipal(), null, action );\r
+        event.setRemoteIP( getRemoteAddr() );\r
+\r
+        for ( AuditListener listener : auditListeners )\r
+        {\r
+            listener.auditEvent( event );\r
+        }\r
+    }\r
+\r
+    private String getRemoteAddr()\r
+    {\r
+        HttpServletRequest request = ServletActionContext.getRequest();\r
+        return request != null ? request.getRemoteAddr() : null;\r
+    }\r
+\r
+    @SuppressWarnings( "unchecked" )\r
+    protected String getPrincipal()\r
+    {\r
+        if ( principal != null )\r
+        {\r
+            return principal;\r
+        }\r
+        return ArchivaXworkUser.getActivePrincipal( ActionContext.getContext().getSession() );\r
+    }\r
+\r
+    void setPrincipal( String principal )\r
+    {\r
+        this.principal = principal;\r
+    }\r
+\r
+    public void setAuditListeners( List<AuditListener> auditListeners )\r
+    {\r
+        this.auditListeners = auditListeners;\r
+    }\r
+\r
+    public void setRepositorySessionFactory( RepositorySessionFactory repositorySessionFactory )\r
+    {\r
+        this.repositorySessionFactory = repositorySessionFactory;\r
+    }\r
+\r
+    protected <T> Map<String, T> getBeansOfType( Class<T> clazz )\r
+    {\r
+        //TODO do some caching here !!!\r
+        // olamy : with plexus we get only roleHint\r
+        // as per convention we named spring bean role#hint remove role# if exists\r
+        Map<String, T> springBeans = applicationContext.getBeansOfType( clazz );\r
+\r
+        Map<String, T> beans = new HashMap<String, T>( springBeans.size() );\r
+\r
+        for ( Map.Entry<String, T> entry : springBeans.entrySet() )\r
+        {\r
+            String key = StringUtils.substringAfterLast( entry.getKey(), "#" );\r
+            beans.put( key, entry.getValue() );\r
+        }\r
+        return beans;\r
+    }\r
+}\r
index 835c285d667d542c1146775bd36e61ddc44454e3..709a8cd81f777f03d2dae012c107816794193c90 100644 (file)
@@ -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()
index c1da5be9f91c3f48e83917ae96656d0b1c3cad0b..961839766b126188853e6b1ebadc0de61ae5fd9f 100644 (file)
@@ -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 );
                 }
index 177f6b247d26c22ee3ee75c0da310bbee3754c5e..dc619c21234ca9a15d3480b6d5d22fc155f3e7a1 100644 (file)
@@ -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();
         }
index c985f0e5b7df60f00829240fdf3a6583b12110c2..1c86afd14f5d120eb2be29ed254986a105bdee30 100644 (file)
@@ -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/PlexusActionSupport.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/PlexusActionSupport.java
deleted file mode 100644 (file)
index d42d782..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-package org.apache.maven.archiva.web.action;\r
-\r
-/*\r
- * Licensed to the Apache Software Foundation (ASF) under one\r
- * or more contributor license agreements.  See the NOTICE file\r
- * distributed with this work for additional information\r
- * regarding copyright ownership.  The ASF licenses this file\r
- * to you under the Apache License, Version 2.0 (the\r
- * "License"); you may not use this file except in compliance\r
- * with the License.  You may obtain a copy of the License at\r
- *\r
- *  http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing,\r
- * software distributed under the License is distributed on an\r
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r
- * KIND, either express or implied.  See the License for the\r
- * specific language governing permissions and limitations\r
- * under the License.\r
- */\r
-\r
-import com.opensymphony.xwork2.ActionContext;\r
-import com.opensymphony.xwork2.ActionSupport;\r
-import org.apache.archiva.audit.AuditEvent;\r
-import org.apache.archiva.audit.AuditListener;\r
-import org.apache.archiva.audit.Auditable;\r
-import org.apache.archiva.metadata.repository.RepositorySessionFactory;\r
-import org.apache.maven.archiva.security.ArchivaXworkUser;\r
-import org.apache.struts2.ServletActionContext;\r
-import org.apache.struts2.interceptor.SessionAware;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-import java.util.Map;\r
-import javax.servlet.http.HttpServletRequest;\r
-\r
-/**\r
- * LogEnabled and SessionAware ActionSupport\r
- */\r
-public abstract class PlexusActionSupport\r
-    extends ActionSupport\r
-    implements SessionAware, Auditable\r
-{\r
-    protected Map<?, ?> session;\r
-\r
-    protected Logger log = LoggerFactory.getLogger( getClass() );\r
-\r
-    /**\r
-     * @plexus.requirement role="org.apache.archiva.audit.AuditListener"\r
-     */\r
-    private List<AuditListener> auditListeners = new ArrayList<AuditListener>();\r
-\r
-    /**\r
-     * @plexus.requirement\r
-     */\r
-    protected RepositorySessionFactory repositorySessionFactory;\r
-\r
-    private String principal;\r
-\r
-    @SuppressWarnings( "unchecked" )\r
-    public void setSession( Map map )\r
-    {\r
-        this.session = map;\r
-    }\r
-\r
-    public void addAuditListener( AuditListener listener )\r
-    {\r
-        this.auditListeners.add( listener );\r
-    }\r
-\r
-    public void clearAuditListeners()\r
-    {\r
-        this.auditListeners.clear();\r
-    }\r
-\r
-    public void removeAuditListener( AuditListener listener )\r
-    {\r
-        this.auditListeners.remove( listener );\r
-    }\r
-\r
-    protected void triggerAuditEvent( String repositoryId, String resource, String action )\r
-    {\r
-        AuditEvent event = new AuditEvent( repositoryId, getPrincipal(), resource, action );\r
-        event.setRemoteIP( getRemoteAddr() );\r
-\r
-        for ( AuditListener listener : auditListeners )\r
-        {\r
-            listener.auditEvent( event );\r
-        }\r
-    }\r
-\r
-    protected void triggerAuditEvent( String resource, String action )\r
-    {\r
-        AuditEvent event = new AuditEvent( null, getPrincipal(), resource, action );\r
-        event.setRemoteIP( getRemoteAddr() );\r
-\r
-        for ( AuditListener listener : auditListeners )\r
-        {\r
-            listener.auditEvent( event );\r
-        }\r
-    }\r
-\r
-    protected void triggerAuditEvent( String action )\r
-    {\r
-        AuditEvent event = new AuditEvent( null, getPrincipal(), null, action );\r
-        event.setRemoteIP( getRemoteAddr() );\r
-\r
-        for ( AuditListener listener : auditListeners )\r
-        {\r
-            listener.auditEvent( event );\r
-        }\r
-    }\r
-\r
-    private String getRemoteAddr()\r
-    {\r
-        HttpServletRequest request = ServletActionContext.getRequest();\r
-        return request != null ? request.getRemoteAddr() : null;\r
-    }\r
-\r
-    @SuppressWarnings( "unchecked" )\r
-    protected String getPrincipal()\r
-    {\r
-        if ( principal != null )\r
-        {\r
-            return principal;\r
-        }\r
-        return ArchivaXworkUser.getActivePrincipal( ActionContext.getContext().getSession() );\r
-    }\r
-\r
-    void setPrincipal( String principal )\r
-    {\r
-        this.principal = principal;\r
-    }\r
-\r
-    public void setAuditListeners( List<AuditListener> auditListeners )\r
-    {\r
-        this.auditListeners = auditListeners;\r
-    }\r
-\r
-    public void setRepositorySessionFactory( RepositorySessionFactory repositorySessionFactory )\r
-    {\r
-        this.repositorySessionFactory = repositorySessionFactory;\r
-    }\r
-}\r
index c3c17048d71347b65a8c042d3245320a66c90ec8..818f5e0db1e0afaf1ba88f651c24bee409af9a81 100644 (file)
@@ -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;
index 92fb80c885c229be275de1675c52f687f7066c1f..30e134ff384fcbec9b6c7e8657d8cbef60ecb6a5 100644 (file)
@@ -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;
 
index 62c4c71ca852e0a19711bc934fa7b4f6c0c4592f..46d09dd46c559649c4d60e54b3e74595ae39cddf 100644 (file)
@@ -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()
+                           + "']." );
         }
     }
 
index 350609979ab2031e21f419db0a71a352ea94bf4b..9871e4d5aa4f9d3718891188975542a6d26dfd81 100644 (file)
@@ -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;
index 52fd372579186ebc56b536162daa66d3d52dbabf..50e6b30e46881d1084e81d3063e12f1e71f592c8 100644 (file)
@@ -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()
index e55ee68413357b7db6bdeddb4e8f9e7eb7294e66..d232be262fde68a96bbfcd8e6634591a191cb84e 100644 (file)
@@ -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() );
             }
         }
     }
index c32b8233a38eed35bbb5ceb32dc7f8d124dd6423..d721c79148a2f2293bcef94dea25ebb4f50e44e0 100644 (file)
@@ -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() );
         }
     }
 }
index 4298c4d25235d04ba4229b9782b5cf197b0e655a..9c5925b06bf8f0331a3d2743d22c9cd0215a9b8e 100644 (file)
@@ -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
 }
index ec89a9bb2f865763cd2d03b52232057c850cac33..bee78a0c96fe390d3927169ca42fd50e1885ad94 100644 (file)
@@ -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()
index fddf47e3c0573fa4de906a21789ca5e5d823585c..57baffa581cf59b465936e588bb839a707e46a1f 100644 (file)
@@ -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>();
index 02511a13e180e64bc619c8a2fe799cd46b83f9b3..7509cc651f5d2b0201a68ae98d12b42015b87b1b 100644 (file)
@@ -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();
     }
index 48947d07617335b0496a43705214143a76e2667b..8ca1b97c4b10be4707a8e8231405f8608cb3331b 100644 (file)
@@ -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
 {
index f2fbfee2e250ae4b4a70b1acbb44cf6c360fd0ce..022e7b3a72fa223a55536bf1867a3c5c701cdaf1 100644 (file)
@@ -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;
     }
index 6ea3bd8d97a698e0c109386696390d854d6430db..288db7330692ad6b77ddfa006365494b4dd17ea3 100644 (file)
@@ -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
 {
index eb3002b6063e50b6ce9fef0e6488e61d9f4f990c..5af6c8fae90af9bb1aba73c40299353d28b2de0a 100644 (file)
@@ -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;
     }
index 8745d949779227c7932d8eadc167baef2e8adc1b..7dffb70676e49c977e2cfdf6a111d719b6328084 100644 (file)
@@ -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
index 315f958d98cf32ccc049d33949e15b83e0024812..adfd6c0b7fee9f18cfbd3ec783bd660f5e268944 100644 (file)
@@ -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
 {
index 18a266ccdedecaa52f5d21d97a3b4f5df24909e5..1907a2399e2d6b79a5dee51fc41cb1b5cccebdc6 100644 (file)
@@ -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;
 
 
index f85f57cff964f19aa3cd0e96191fabe91ab6ceff..c9aab90e312b76ea7709a5a865d9b4c80ee8004b 100644 (file)
@@ -19,28 +19,33 @@ package org.apache.maven.archiva.web.action.admin.legacy;
  * under the License.\r
  */\r
 \r
-import java.util.Iterator;\r
-\r
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;\r
 import org.apache.maven.archiva.configuration.Configuration;\r
 import org.apache.maven.archiva.configuration.IndeterminateConfigurationException;\r
 import org.apache.maven.archiva.configuration.LegacyArtifactPath;\r
-import org.apache.maven.archiva.web.action.PlexusActionSupport;\r
+import org.apache.maven.archiva.web.action.AbstractActionSupport;\r
 import org.codehaus.plexus.registry.RegistryException;\r
+import org.springframework.context.annotation.Scope;\r
+import org.springframework.stereotype.Controller;\r
+\r
+import javax.inject.Inject;\r
+import java.util.Iterator;\r
 \r
 /**\r
  * Delete a LegacyArtifactPath to archiva configuration\r
  *\r
- *\r
  * @since 1.1\r
- * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="deleteLegacyArtifactPathAction" instantiation-strategy="per-lookup"\r
+ *        plexus.component role="com.opensymphony.xwork2.Action" role-hint="deleteLegacyArtifactPathAction" instantiation-strategy="per-lookup"\r
  */\r
+@Controller( "deleteLegacyArtifactPathAction" )\r
+@Scope( "prototype" )\r
 public class DeleteLegacyArtifactPathAction\r
-    extends PlexusActionSupport\r
+    extends AbstractActionSupport\r
 {\r
     /**\r
-     * @plexus.requirement\r
+     * plexus.requirement\r
      */\r
+    @Inject\r
     private ArchivaConfiguration archivaConfiguration;\r
 \r
     private String path;\r
@@ -49,10 +54,11 @@ public class DeleteLegacyArtifactPathAction
     {\r
         log.info( "remove [" + path + "] from legacy artifact path resolution" );\r
         Configuration configuration = archivaConfiguration.getConfiguration();\r
-        for ( Iterator<LegacyArtifactPath> iterator = configuration.getLegacyArtifactPaths().iterator(); iterator.hasNext(); )\r
+        for ( Iterator<LegacyArtifactPath> iterator = configuration.getLegacyArtifactPaths().iterator();\r
+              iterator.hasNext(); )\r
         {\r
             LegacyArtifactPath legacyArtifactPath = (LegacyArtifactPath) iterator.next();\r
-            if (legacyArtifactPath.match( path ))\r
+            if ( legacyArtifactPath.match( path ) )\r
             {\r
                 iterator.remove();\r
             }\r
index d6964a20076ca6803a89fa5c7f5b2427e676cf6a..fc2fffb288107b9902cccc0be03fafe97b122c7c 100644 (file)
@@ -19,38 +19,42 @@ package org.apache.maven.archiva.web.action.admin.legacy;
  * under the License.\r
  */\r
 \r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import javax.servlet.http.HttpServletRequest;\r
-\r
+import com.opensymphony.xwork2.Preparable;\r
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;\r
 import org.apache.maven.archiva.configuration.Configuration;\r
 import org.apache.maven.archiva.configuration.LegacyArtifactPath;\r
 import org.apache.maven.archiva.security.ArchivaRoleConstants;\r
+import org.apache.maven.archiva.web.action.AbstractActionSupport;\r
 import org.apache.maven.archiva.web.util.ContextUtils;\r
-import org.codehaus.plexus.redback.rbac.Resource;\r
-\r
 import org.apache.struts2.interceptor.ServletRequestAware;\r
-import com.opensymphony.xwork2.Preparable;\r
-import org.apache.maven.archiva.web.action.PlexusActionSupport;\r
+import org.codehaus.plexus.redback.rbac.Resource;\r
 import org.codehaus.redback.integration.interceptor.SecureAction;\r
 import org.codehaus.redback.integration.interceptor.SecureActionBundle;\r
 import org.codehaus.redback.integration.interceptor.SecureActionException;\r
+import org.springframework.context.annotation.Scope;\r
+import org.springframework.stereotype.Controller;\r
+\r
+import javax.inject.Inject;\r
+import javax.servlet.http.HttpServletRequest;\r
+import java.util.ArrayList;\r
+import java.util.List;\r
 \r
 /**\r
  * Shows the LegacyArtifactPath Tab for the administrator.\r
  *\r
  * @since 1.1\r
- * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="legacyArtifactPathAction" instantiation-strategy="per-lookup"\r
+ *        plexus.component role="com.opensymphony.xwork2.Action" role-hint="legacyArtifactPathAction" instantiation-strategy="per-lookup"\r
  */\r
+@Controller( "legacyArtifactPathAction" )\r
+@Scope( "prototype" )\r
 public class LegacyArtifactPathAction\r
-    extends PlexusActionSupport\r
+    extends AbstractActionSupport\r
     implements SecureAction, ServletRequestAware, Preparable\r
 {\r
     /**\r
-     * @plexus.requirement\r
+     * plexus.requirement\r
      */\r
+    @Inject\r
     private ArchivaConfiguration archivaConfiguration;\r
 \r
     private List<LegacyArtifactPath> legacyArtifactPaths;\r
@@ -72,8 +76,7 @@ public class LegacyArtifactPathAction
         SecureActionBundle bundle = new SecureActionBundle();\r
 \r
         bundle.setRequiresAuthentication( true );\r
-        bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION,\r
-            Resource.GLOBAL );\r
+        bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION, Resource.GLOBAL );\r
 \r
         return bundle;\r
     }\r
index 3299bc3b78775ba0ed7eacf4e1925a50163e54ef..d9cb4b2ef2714b849b1228cef7759198620be265 100644 (file)
@@ -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() );
         }
     }
 }
index dcbbe42494a8e108ecb2e85bc05b2e61d2447390..5bfdd510d1d72ba1e9c4708ba02e264d14fcf57d 100644 (file)
@@ -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;
index ce821deddec7ca9c91d76e2210836175820a499a..356ca6a991e351bb06bcdd3b9b538bb2a6bd91b5 100644 (file)
@@ -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;
     }
 }
index aad944204b84da415443fe919493a215271119f6..f8e8eaf80bf35dcd8d76d3afd0597bcc8bf75ef0 100644 (file)
@@ -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() );
     }
 }
index 8634ba1764edcfa9e29c1372006e6da80ced04f2..d8996f886f0fb926fb33976f38f40fb9cc2caee9 100644 (file)
@@ -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;
index b2f7182946783a213babc32a78f428e3af23d491..48761e1f87f695e641d2fed0d7e7a092f16ed2fa 100644 (file)
@@ -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;
index 3112a56d61f04462bc9ea1e689b5b6001eda1f4f..bd72df5420ea810fd456f952538f30ce4af856c4 100644 (file)
@@ -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" );
         }
     }
 
index 8d0dc5afbbd8a9f40b8ba79fa73b170ca8d5c21a..e7f30e0b3da04dbf2ece1e8f07bc32b8a704139c 100644 (file)
@@ -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 )
         {
index 98230a9ba05853fd085b0df4e4d9eeb65e4e7cee..b8e6ba5269893120f05752c5044173176f138735 100644 (file)
@@ -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;
index aa5b54527973de041b85aef73e6fdb6b9e13df9a..0937d82a4d0951bffae7f3072a375658cfd96bc3 100644 (file)
@@ -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()
index 771789a024056c84889b4e10844efb31b51da765..0442c1aef79bafd9c34bb3e542b065188c5ca39d 100644 (file)
@@ -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;
index edd7cf82056765590a346d193a5e3479eab1907e..5cf201d97973d2b9c7f7616c75e0420fc60d0bbb 100644 (file)
@@ -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 )
index 2cb4094afb1b87dc74c0a3cf4796277551220da1..e28d2f9c06904601fa76de3381a67598aeaac6b4 100644 (file)
@@ -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;
index 0794a8ca5c03f67b74dd7ae302e86f95f9f85959..25fa66c2a7ed9d92b5dd0abdae17b3efaf753955 100644 (file)
@@ -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() );
+    }
 }
index 6916d6529aba7e40249d1279df50ffb51cf36a45..04006431c502df03e5f5895ce57d088ac3f1f116 100644 (file)
@@ -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;
index 1037a0aca3f39b7c92ac1b97cf819a2d4d1677d0..7c4f8cd8e0c55a5c2eb73e3086c955dba6ccadf9 100644 (file)
@@ -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() ) )
                     {
index 7aa735bbb1623f8f3e8eeb3ffb5cfffc56fb3d25..896c6ef057d1517d2edf260619be743a7cc4ab06 100644 (file)
@@ -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" );
index c9afa9a8fe43fd77000534f13a6bb913ac0b64cf..b498c82f988de32f18d09a7a7dfd43489f5c184b 100644 (file)
@@ -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 )
index d3a920305b9ff67f3bc27043555fdb56dabe2762..6f59721d5e6cccf9a813876b1b02db32910bd055 100644 (file)
@@ -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 );
             }
         }
     }
index a772c5bd517bee6a792ba47a69b8264a31dfc406..fadd061a474701ef03653f1c3628c32b858051a8 100644 (file)
@@ -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 );
         }
index bc06a20de665052fe9407da44a7b1b12b5731cbc..0aa44b4dac27b20000eb603559cf1b53cc7e5927 100644 (file)
 
 # 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
index 0accd645ae56acfd9584c1dd682d9642966f0631..2c9859fd086a05fa490a044f5421b4f3a2e7ff9e 100644 (file)
@@ -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>
       </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"/>
   <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>
index 74d3413f51043477744a965f9fae1864034f2891..fad3f335377312367371ce49867c633bfb419931 100644 (file)
 
        <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>
                </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>
                </listener-class>
        </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>
index 3872c1ff70a00f7d23dcc1dd877454440f48b740..2b890c499af32a83f8fb60282bca01e4f1e5c46b 100644 (file)
@@ -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;
index e6b3f647d7b9368099d1128a0db49d1f93b1ef00..9b560c6b3381267972837ff9b4e6b7b0582e2289 100644 (file)
       <artifactId>commons-logging-api</artifactId>
       <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>
       <artifactId>test-repository</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
   <dependencyManagement>
     <dependencies>
index 2cd5cc426b6cddaa0704212a5eb621f62f038ef5..943fcf7c00f7ea44206820da2f8146d7770f8fff 100644 (file)
@@ -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 de9307630fd7bffe990d859c1d8726207cdb9896..d2337e8966e54f034dcb934915c32debf0e497f6 100644 (file)
--- 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>