archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joak...@apache.org
Subject svn commit: r548821 - in /maven/archiva/trunk/archiva-web/archiva-webapp/src/main: java/org/apache/maven/archiva/web/action/admin/database/DatabaseAction.java resources/xwork.xml webapp/WEB-INF/jsp/admin/database.jsp
Date Tue, 19 Jun 2007 18:43:31 GMT
Author: joakime
Date: Tue Jun 19 11:43:30 2007
New Revision: 548821

URL: http://svn.apache.org/viewvc?view=rev&rev=548821
Log:
[MRM-358] Update Consumers button in Database - Artifact Scanning doesn't work.
Patch from Napolean Ramirez applied.

Modified:
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/DatabaseAction.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/database.jsp

Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/DatabaseAction.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/DatabaseAction.java?view=diff&rev=548821&r1=548820&r2=548821
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/DatabaseAction.java
(original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/DatabaseAction.java
Tue Jun 19 11:43:30 2007
@@ -19,12 +19,15 @@
  * under the License.
  */
 
-import com.opensymphony.xwork.Preparable;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
 
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.Configuration;
 import org.apache.maven.archiva.configuration.DatabaseScanningConfiguration;
+import org.apache.maven.archiva.configuration.InvalidConfigurationException;
 import org.apache.maven.archiva.database.updater.DatabaseConsumers;
 import org.apache.maven.archiva.security.ArchivaRoleConstants;
 import org.apache.maven.archiva.web.action.admin.scanning.AdminRepositoryConsumerComparator;
@@ -32,10 +35,10 @@
 import org.codehaus.plexus.redback.xwork.interceptor.SecureAction;
 import org.codehaus.plexus.redback.xwork.interceptor.SecureActionBundle;
 import org.codehaus.plexus.redback.xwork.interceptor.SecureActionException;
+import org.codehaus.plexus.registry.RegistryException;
 import org.codehaus.plexus.xwork.action.PlexusActionSupport;
 
-import java.util.Collections;
-import java.util.List;
+import com.opensymphony.xwork.Preparable;
 
 /**
  * DatabaseAction 
@@ -62,14 +65,24 @@
     private String cron;
 
     /**
-     * List of {@link AdminDatabaseConsumer} objects for unprocessed artifacts.
+     * List of available {@link AdminDatabaseConsumer} objects for unprocessed artifacts.
      */
     private List unprocessedConsumers;
-
+    
+    /**
+     * List of enabled {@link AdminDatabaseConsumer} objects for unprocessed artifacts.
+     */
+    private List enabledUnprocessedConsumers;
+    
     /**
      * List of {@link AdminDatabaseConsumer} objects for "to cleanup" artifacts.
      */
     private List cleanupConsumers;
+    
+    /**
+     * List of enabled {@link AdminDatabaseConsumer} objects for "to cleanup" artifacts.
+     */
+    private List enabledCleanupConsumers;
 
     public void prepare()
         throws Exception
@@ -98,19 +111,46 @@
     public String updateUnprocessedConsumers()
     {
         getLogger().info( "updateUnprocesedConsumers()" );
-        return INPUT;
+        
+        archivaConfiguration.getConfiguration().getDatabaseScanning().setUnprocessedConsumers(
enabledUnprocessedConsumers );
+        
+        return saveConfiguration();
     }
-
+    
     public String updateCleanupConsumers()
     {
         getLogger().info( "updateCleanupConsumers()" );
-        return INPUT;
+        
+        archivaConfiguration.getConfiguration().getDatabaseScanning().setCleanupConsumers(
enabledCleanupConsumers );
+        
+        return saveConfiguration();
     }
     
     public String updateSchedule()
     {
         getLogger().info( "updateSchedule()" );
-        return INPUT;
+        
+        archivaConfiguration.getConfiguration().getDatabaseScanning().setCronExpression(
cron );
+        
+        return saveConfiguration();
+    }
+    
+    private String saveConfiguration()
+    {
+        getLogger().info( ".saveConfiguration()" );
+    
+        try
+        {
+            archivaConfiguration.save( archivaConfiguration.getConfiguration() );
+            addActionMessage( "Successfully saved configuration" );
+        }
+        catch ( Exception e)
+        {
+            addActionError( "Error in saving configuration" );
+            return INPUT;
+        }
+    
+        return SUCCESS;
     }
     
     public SecureActionBundle getSecureActionBundle()
@@ -142,5 +182,25 @@
     public List getUnprocessedConsumers()
     {
         return unprocessedConsumers;
+    }
+
+    public List getEnabledUnprocessedConsumers()
+    {
+        return enabledUnprocessedConsumers;
+    }
+
+    public void setEnabledUnprocessedConsumers( List enabledUnprocessedConsumers )
+    {
+        this.enabledUnprocessedConsumers = enabledUnprocessedConsumers;
+    }
+
+    public List getEnabledCleanupConsumers()
+    {
+        return enabledCleanupConsumers;
+    }
+
+    public void setEnabledCleanupConsumers( List enabledCleanupConsumers )
+    {
+        this.enabledCleanupConsumers = enabledCleanupConsumers;
     }
 }

Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml?view=diff&rev=548821&r1=548820&r2=548821
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml (original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml Tue Jun 19
11:43:30 2007
@@ -343,6 +343,9 @@
     
     <action name="database" class="databaseAction" method="input">
       <result name="input">/WEB-INF/jsp/admin/database.jsp</result>
+      <result name="success" type="redirect-action">
+        <param name="actionName">database</param>
+      </result>
     </action>
     
     <action name="updateDatabase" class="schedulerAction" method="updateDatabase">

Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/database.jsp
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/database.jsp?view=diff&rev=548821&r1=548820&r2=548821
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/database.jsp
(original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/database.jsp
Tue Jun 19 11:43:30 2007
@@ -92,7 +92,7 @@
 
         <tr>
           <td class="${bgcolor}">
-            <ww:checkbox name="enabledUnprocessedConsumer[]" theme="simple" value="${consumer.enabled}"
/>
+            <input type="checkbox" name="enabledUnprocessedConsumers" theme="simple" value="${consumer.id}"
<c:if test="${consumer.enabled}">checked</c:if> />
           </td>
           <td class="${bgcolor}">
             <c:if test="${consumer.enabled}">
@@ -147,7 +147,7 @@
 
         <tr>
           <td class="${bgcolor}">
-            <ww:checkbox name="enabledCleanupConsumer[]" theme="simple" value="${consumer.enabled}"
/>
+            <input type="checkbox" name="enabledCleanupConsumers" theme="simple" value="${consumer.id}"
<c:if test="${consumer.enabled}">checked</c:if> />
           </td>
           <td class="${bgcolor}">
             <c:if test="${consumer.enabled}">



Mime
View raw message