From: Maria Odea B. Ching Date: Fri, 16 Jun 2006 08:37:56 +0000 (+0000) Subject: PR: MRM-80 X-Git-Tag: archiva-0.9-alpha-1~802 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=88a2365636ecc1c412ba72a8748d367c3a0bbe55;p=archiva.git PR: MRM-80 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 --- diff --git a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/BaseAction.java b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/BaseAction.java index d17e93eca..3c64f210c 100644 --- a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/BaseAction.java +++ b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/BaseAction.java @@ -79,6 +79,7 @@ public class BaseAction parameters.put( ConfigurationManager.MIN_INDEXPATH, config.getMinimalIndexPath() ); parameters.put( ConfigurationManager.DISCOVERY_BLACKLIST_PATTERNS, config.getDiscoveryBlackListPatterns() ); parameters.put( ConfigurationManager.DISCOVER_SNAPSHOTS, new Boolean( config.isDiscoverSnapshots() ) ); + parameters.put( ConfigurationManager.DISCOVERY_CRON_EXPRESSION, config.getDiscoveryCronExpression() ); setParameters( parameters ); //Configuration configuration = new Configuration(); // TODO! 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 index 000000000..17db63baf --- /dev/null +++ b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/SchedulerConfigurationAction.java @@ -0,0 +1,69 @@ +package org.apache.maven.repository.manager.web.action; + +import com.opensymphony.xwork.Action; +import com.opensymphony.webwork.interceptor.ParameterAware; + +import java.util.Map; +import java.util.HashMap; + +import org.apache.maven.repository.manager.web.utils.ConfigurationManager; + +/** + * @author Allan Ramirez + * + * @plexus.component role="com.opensymphony.xwork.Action" role-hint="org.apache.maven.repository.manager.web.action.SchedulerConfigurationAction" + */ +public class SchedulerConfigurationAction + implements Action, ParameterAware +{ + /** + * @plexus.requirement + */ + private ConfigurationManager plexusConfig; + + private Map parameters; + + public Map getParameters() + { + return parameters; + } + + public void setParameters( Map parameters ) + { + this.parameters = parameters; + } + + /** + * Execute this method if the action was invoked + * + * @return String success or error + */ + public String execute() + { + Map map; + try + { + map = new HashMap(); + + String[] cronExpression = (String[]) parameters.get( ConfigurationManager.DISCOVERY_CRON_EXPRESSION ); + + if( cronExpression[0] != null ) + { + map.put( ConfigurationManager.DISCOVERY_CRON_EXPRESSION, cronExpression[0] ); + + plexusConfig.updateConfiguration( map ); + + return SUCCESS; + } + else + { + return ERROR; + } + } + catch( Exception e ) + { + e.printStackTrace(); + return ERROR; + } + } +} diff --git a/maven-repository-webapp/src/main/resources/xwork.xml b/maven-repository-webapp/src/main/resources/xwork.xml index d4c200439..bbc1fa782 100644 --- a/maven-repository-webapp/src/main/resources/xwork.xml +++ b/maven-repository-webapp/src/main/resources/xwork.xml @@ -52,6 +52,11 @@ /WEB-INF/jsp/index.jsp + + /WEB-INF/jsp/indexConfigUpdateSuccess.jsp + /WEB-INF/jsp/index.jsp + + diff --git a/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/index.jsp b/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/index.jsp index a4cddfae9..2f3b75f76 100644 --- a/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/index.jsp +++ b/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/index.jsp @@ -29,5 +29,9 @@ <%@ include file="indexconfig.jsp" %>

+

+<%@ include file="schedulerconfig.jsp" %> +

+ 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 index 000000000..5f278578f --- /dev/null +++ b/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/schedulerconfig.jsp @@ -0,0 +1,30 @@ +<%-- + ~ Copyright 2006 The Apache Software Foundation. + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + ~ + --%> + +<%@ taglib uri="webwork" prefix="ww" %> + +
+

+SCHEDULER CONFIGURATION: +

+ +
+ Cron Expression: "/> + +
+ +