]> source.dussan.org Git - archiva.git/commitdiff
PR: MRM-80
authorMaria Odea B. Ching <oching@apache.org>
Fri, 16 Jun 2006 08:37:56 +0000 (08:37 +0000)
committerMaria Odea B. Ching <oching@apache.org>
Fri, 16 Jun 2006 08:37:56 +0000 (08:37 +0000)
Submitted by: Allan Ramirez

Web interface for scheduler.

git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@414776 13f79535-47bb-0310-9956-ffa450edef68

maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/BaseAction.java
maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/SchedulerConfigurationAction.java [new file with mode: 0644]
maven-repository-webapp/src/main/resources/xwork.xml
maven-repository-webapp/src/main/webapp/WEB-INF/jsp/index.jsp
maven-repository-webapp/src/main/webapp/WEB-INF/jsp/schedulerconfig.jsp [new file with mode: 0644]

index d17e93eca7eb521d3ed167f44b1de39b5145adc1..3c64f210cd6f7bd91b2da58affe8b8b9db2baac8 100644 (file)
@@ -79,6 +79,7 @@ public class BaseAction
             parameters.put( ConfigurationManager.MIN_INDEXPATH, config.getMinimalIndexPath() );\r
             parameters.put( ConfigurationManager.DISCOVERY_BLACKLIST_PATTERNS, config.getDiscoveryBlackListPatterns() );\r
             parameters.put( ConfigurationManager.DISCOVER_SNAPSHOTS, new Boolean( config.isDiscoverSnapshots() ) );\r
+            parameters.put( ConfigurationManager.DISCOVERY_CRON_EXPRESSION, config.getDiscoveryCronExpression() );\r
             setParameters( parameters );\r
 \r
             //Configuration configuration = new Configuration(); // TODO!\r
diff --git a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/SchedulerConfigurationAction.java b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/SchedulerConfigurationAction.java
new file mode 100644 (file)
index 0000000..17db63b
--- /dev/null
@@ -0,0 +1,69 @@
+package org.apache.maven.repository.manager.web.action;\r
+\r
+import com.opensymphony.xwork.Action;\r
+import com.opensymphony.webwork.interceptor.ParameterAware;\r
+\r
+import java.util.Map;\r
+import java.util.HashMap;\r
+\r
+import org.apache.maven.repository.manager.web.utils.ConfigurationManager;\r
+\r
+/**\r
+ * @author <a href="mailto:aramirez@apache.org">Allan Ramirez</a>\r
+ *\r
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="org.apache.maven.repository.manager.web.action.SchedulerConfigurationAction"\r
+ */\r
+public class SchedulerConfigurationAction\r
+    implements Action, ParameterAware\r
+{\r
+    /**\r
+     * @plexus.requirement\r
+     */\r
+    private ConfigurationManager plexusConfig;\r
+\r
+    private Map parameters;\r
+\r
+    public Map getParameters()\r
+    {\r
+        return parameters;\r
+    }\r
+\r
+    public void setParameters( Map parameters )\r
+    {\r
+        this.parameters = parameters;\r
+    }\r
+\r
+    /**\r
+     * Execute this method if the action was invoked\r
+     *\r
+     * @return String success or error\r
+     */\r
+    public String execute()\r
+    {\r
+        Map map;\r
+        try\r
+        {\r
+            map = new HashMap();\r
+\r
+            String[] cronExpression = (String[]) parameters.get( ConfigurationManager.DISCOVERY_CRON_EXPRESSION );\r
+\r
+            if( cronExpression[0] != null  )\r
+            {\r
+                map.put( ConfigurationManager.DISCOVERY_CRON_EXPRESSION, cronExpression[0] );\r
+\r
+                plexusConfig.updateConfiguration( map );\r
+\r
+                return SUCCESS;\r
+            }\r
+            else\r
+            {\r
+                return ERROR;\r
+            }\r
+        }\r
+        catch( Exception e )\r
+        {\r
+            e.printStackTrace();\r
+            return ERROR;\r
+        }\r
+    }\r
+}\r
index d4c200439362554a2747a7225736f463ed73d6d0..bbc1fa78265722b13f7178c977fb86fa6936b151 100644 (file)
       <result name="error" type="dispatcher">/WEB-INF/jsp/index.jsp</result>
     </action>
 
+    <action name="configureScheduler" class="org.apache.maven.repository.manager.web.action.SchedulerConfigurationAction">
+      <result name="success" type="dispatcher">/WEB-INF/jsp/indexConfigUpdateSuccess.jsp</result>
+      <result name="error" type="dispatcher">/WEB-INF/jsp/index.jsp</result>
+    </action>    
+
   </package>
 </xwork>
 
index a4cddfae9bdf1c39e47f7c4a58b85745436d0b4a..2f3b75f764a1fb685c583dc433aabaf2a7143487 100644 (file)
@@ -29,5 +29,9 @@
 <%@ include file="indexconfig.jsp" %>
 <p/>
 
+<p/>
+<%@ include file="schedulerconfig.jsp" %>
+<p/>
+
 </body>
 </html>
diff --git a/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/schedulerconfig.jsp b/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/schedulerconfig.jsp
new file mode 100644 (file)
index 0000000..5f27857
--- /dev/null
@@ -0,0 +1,30 @@
+<%--\r
+  ~ Copyright 2006 The Apache Software Foundation.\r
+  ~\r
+  ~ Licensed under the Apache License, Version 2.0 (the "License");\r
+  ~ you may not use this file except in compliance with the License.\r
+  ~ 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, software\r
+  ~ distributed under the License is distributed on an "AS IS" BASIS,\r
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+  ~ See the License for the specific language governing permissions and\r
+  ~ limitations under the License.\r
+  ~\r
+  --%>\r
+\r
+<%@ taglib uri="webwork" prefix="ww" %>\r
+\r
+<br>\r
+<p>\r
+<b>SCHEDULER CONFIGURATION:</b>\r
+</p>\r
+\r
+<form action="configureScheduler.action" method="post">\r
+  Cron Expression: <input type="text" name="discoveryCronExpression" value="<ww:property value="parameters.discoveryCronExpression"/>"/>\r
+  <input type="submit" value="Update"/>\r
+</form>\r
+\r
+\r