remove outdated configuration action

git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@562494 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Porter 2007-08-03 15:01:58 +00:00
parent 19800f99da
commit a84578e55b
4 changed files with 27 additions and 384 deletions

View File

@ -1,162 +0,0 @@
package org.apache.maven.archiva.web.action.admin;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
import com.opensymphony.xwork.ModelDriven;
import com.opensymphony.xwork.Preparable;
import com.opensymphony.xwork.Validateable;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.Configuration;
import org.apache.maven.archiva.configuration.IndeterminateConfigurationException;
import org.apache.maven.archiva.configuration.InvalidConfigurationException;
import org.apache.maven.archiva.indexer.RepositoryIndexException;
import org.apache.maven.archiva.indexer.RepositoryIndexSearchException;
import org.apache.maven.archiva.security.ArchivaRoleConstants;
import org.codehaus.plexus.redback.rbac.Resource;
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.io.IOException;
/**
* Configures the application.
*
* @plexus.component role="com.opensymphony.xwork.Action" role-hint="configureAction"
*/
public class ConfigureAction
extends PlexusActionSupport
implements ModelDriven, Preparable, Validateable, SecureAction
{
/**
* @plexus.requirement
*/
private ArchivaConfiguration archivaConfiguration;
/**
* The configuration.
*/
private Configuration configuration;
public void validate()
{
getLogger().info( "validate()" );
//validate cron expression
}
public String execute()
throws IOException, RepositoryIndexException, RepositoryIndexSearchException, InvalidConfigurationException,
RegistryException
{
getLogger().info( "execute()" );
// TODO: if this didn't come from the form, go to configure.action instead of going through with re-saving what was just loaded
// TODO: if this is changed, do we move the index or recreate it?
try
{
archivaConfiguration.save( configuration );
// TODO: if the repository has changed, we need to check if indexing is needed!
addActionMessage( "Successfully saved configuration" );
}
catch ( IndeterminateConfigurationException e )
{
addActionError( e.getMessage() );
}
return SUCCESS;
}
// public String input()
// {
//// String[] cronEx = configuration.getDataRefreshCronExpression().split( " " );
// String[] cronEx = new String[]{"0","0","*","*","*","*","*"};
// int i = 0;
//
// while ( i < cronEx.length )
// {
// switch ( i )
// {
// case 0:
// second = cronEx[i];
// break;
// case 1:
// minute = cronEx[i];
// break;
// case 2:
// hour = cronEx[i];
// break;
// case 3:
// dayOfMonth = cronEx[i];
// break;
// case 4:
// month = cronEx[i];
// break;
// case 5:
// dayOfWeek = cronEx[i];
// break;
// case 6:
// year = cronEx[i];
// break;
// }
// i++;
// }
//
//// if ( activeRepositories.getLastDataRefreshTime() != 0 )
//// {
//// lastIndexingTime = new Date( activeRepositories.getLastDataRefreshTime() ).toString();
//// }
//// else
// {
// lastIndexingTime = "Never been run.";
// }
//
// return INPUT;
// }
public Object getModel()
{
return configuration;
}
public void prepare()
{
configuration = archivaConfiguration.getConfiguration();
}
// private String getCronExpression()
// {
// return ( second + " " + minute + " " + hour + " " + dayOfMonth + " " + month + " " + dayOfWeek + " " +
// year ).trim();
// }
public SecureActionBundle getSecureActionBundle()
throws SecureActionException
{
SecureActionBundle bundle = new SecureActionBundle();
bundle.setRequiresAuthentication( true );
bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION, Resource.GLOBAL );
return bundle;
}
}

View File

@ -37,8 +37,8 @@
<interceptor name="redbackAutoLogin" class="redbackAutoLoginInterceptor"/>
<interceptor name="redbackPolicyEnforcement" class="redbackPolicyEnforcementInterceptor"/>
<interceptor name="redbackEnvironmentChecker" class="redbackEnvironmentCheckInterceptor"/>
<interceptor name="paramFilter" class="com.opensymphony.xwork.interceptor.ParameterFilterInterceptor" />
<interceptor name="paramFilter" class="com.opensymphony.xwork.interceptor.ParameterFilterInterceptor"/>
<interceptor-stack name="configuredArchivaStack">
<interceptor-ref name="redbackForceAdminUser"/>
<interceptor-ref name="redbackEnvironmentChecker"/>
@ -74,7 +74,7 @@
<interceptor-stack name="configuredPrepareParamsStack">
<!-- <interceptor-ref name="prepare" /> -->
<interceptor-ref name="params" />
<interceptor-ref name="params"/>
<interceptor-ref name="configuredArchivaStack"/>
</interceptor-stack>
@ -203,7 +203,7 @@
<action name="showArtifactReports" class="showArtifactAction" method="reports">
<result>/WEB-INF/jsp/showArtifact.jsp</result>
</action>
<action name="showArtifactDependencies" class="showArtifactAction" method="dependencies">
<result>/WEB-INF/jsp/showArtifact.jsp</result>
</action>
@ -227,18 +227,18 @@
<!-- Configuration for the admin package. -->
<package name="admin" namespace="/admin" extends="base">
<action name="index" class="repositoriesAction" method="input">
<result name="input">/WEB-INF/jsp/admin/repositories.jsp</result>
</action>
<!-- .\ REPOSITORIES \.____________________________________________ -->
<action name="repositories" class="repositoriesAction" method="input">
<result name="input">/WEB-INF/jsp/admin/repositories.jsp</result>
<result name="confirm" type="redirect-action">deleteRepository</result>
</action>
<action name="indexRepository" class="schedulerAction" method="scanRepository">
<result type="redirect-action">repositories</result>
</action>
@ -255,7 +255,7 @@
<result name="success" type="redirect-action">repositories</result>
<interceptor-ref name="configuredPrepareParamsStack"/>
</action>
<action name="saveRepository" class="configureRepositoryAction" method="save">
<result name="success" type="redirect-action">repositories</result>
<result name="input">/WEB-INF/jsp/admin/addRepository.jsp</result>
@ -270,105 +270,94 @@
</action>
<!-- .\ PROXY CONNECTORS \.________________________________________ -->
<action name="proxyConnectors" class="proxyConnectorsAction" method="input">
<result name="input">/WEB-INF/jsp/admin/proxyConnectors.jsp</result>
</action>
<action name="addProxyConnector" class="configureProxyConnectorAction" method="add">
<result name="input">/WEB-INF/jsp/admin/editProxyConnector.jsp</result>
<result name="success" type="redirect-action">proxyConnectors</result>
<interceptor-ref name="configuredPrepareParamsStack"/>
</action>
<action name="configureProxyConnector" class="configureProxyConnectorAction" method="input">
<result name="input">/WEB-INF/jsp/admin/editProxyConnector.jsp</result>
<result name="success" type="redirect-action">proxyConnectors</result>
<interceptor-ref name="configuredPrepareParamsStack"/>
</action>
<action name="editProxyConnector" class="configureProxyConnectorAction" method="edit">
<result name="input">/WEB-INF/jsp/admin/editProxyConnector.jsp</result>
<result name="success" type="redirect-action">proxyConnectors</result>
<interceptor-ref name="configuredPrepareParamsStack"/>
</action>
<action name="saveProxyConnector" class="configureProxyConnectorAction" method="save">
<result name="input">/WEB-INF/jsp/admin/editProxyConnector.jsp</result>
<result name="success" type="redirect-action">proxyConnectors</result>
<interceptor-ref name="configuredPrepareParamsStack"/>
</action>
<action name="deleteProxyConnector" class="configureProxyConnectorAction" method="confirm">
<result name="input">/WEB-INF/jsp/admin/deleteProxyConnector.jsp</result>
<result name="success" type="redirect-action">proxyConnectors</result>
<interceptor-ref name="configuredPrepareParamsStack"/>
</action>
<!-- .\ NETWORK PROXIES \._________________________________________ -->
<action name="networkProxies" class="networkProxiesAction" method="input">
<result name="input">/WEB-INF/jsp/admin/networkProxies.jsp</result>
</action>
<action name="addNetworkProxy" class="configureNetworkProxyAction" method="add">
<result name="input">/WEB-INF/jsp/admin/editNetworkProxy.jsp</result>
<result name="success" type="redirect-action">networkProxies</result>
<interceptor-ref name="configuredPrepareParamsStack"/>
</action>
<action name="editNetworkProxy" class="configureNetworkProxyAction" method="edit">
<result name="input">/WEB-INF/jsp/admin/editNetworkProxy.jsp</result>
<result name="success" type="redirect-action">networkProxies</result>
<interceptor-ref name="configuredPrepareParamsStack"/>
</action>
<action name="saveNetworkProxy" class="configureNetworkProxyAction" method="save">
<result name="input">/WEB-INF/jsp/admin/editNetworkProxy.jsp</result>
<result name="success" type="redirect-action">networkProxies</result>
<interceptor-ref name="configuredPrepareParamsStack"/>
</action>
<action name="deleteNetworkProxy" class="configureNetworkProxyAction" method="confirm">
<result name="input">/WEB-INF/jsp/admin/deleteNetworkProxy.jsp</result>
<result name="success" type="redirect-action">networkProxies</result>
<interceptor-ref name="configuredPrepareParamsStack"/>
</action>
<!-- .\ REPOSITORY SCANNING \._____________________________________ -->
<action name="repositoryScanning" class="repositoryScanningAction" method="input">
<result name="input">/WEB-INF/jsp/admin/repositoryScanning.jsp</result>
<result name="success" type="redirect-action">
<param name="actionName">repositoryScanning</param>
</result>
</action>
<!-- .\ DATABASE \.________________________________________________ -->
<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">
<result type="redirect-action">database</result>
</action>
<!-- .\ CONFIGURATION \.___________________________________________ -->
<action name="configure" class="configureAction" method="input">
<result name="input">/WEB-INF/jsp/admin/configure.jsp</result>
<interceptor-ref name="unconfiguredArchivaStack"/>
</action>
<action name="saveConfiguration" class="configureAction">
<result name="input">/WEB-INF/jsp/admin/configure.jsp</result>
<result>/WEB-INF/jsp/admin/index.jsp</result>
<interceptor-ref name="unconfiguredArchivaStack"/>
</action>
<!-- .\ CONFIGURATION \.___________________________________________ -->
<!-- The following are needed by the maven-app-configuration-web artifact -->

View File

@ -1,83 +0,0 @@
<%--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you 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 prefix="ww" uri="/webwork" %>
<html>
<head>
<title>Configuration</title>
<ww:head/>
</head>
<body>
<h1>Configuration</h1>
<div class="errors">
<ww:actionerror/>
</div>
<div id="contentArea">
<ww:actionmessage/>
<ww:form method="post" action="saveConfiguration" namespace="/admin" validate="true">
<ww:textfield name="indexPath" label="Index Directory" size="100" required="true"/>
<!--ww:textfield name="indexerCronExpression" label="Indexing Schedule"/-->
<ww:label value="Indexing Schedule" labelposition="top"/>
<ww:div>
<ww:textfield name="second" label="Second" size="2"/>
<ww:textfield name="minute" label="Minute" labelposition="left" size="2"/>
<ww:textfield name="hour" label="Hour" size="2"/>
<ww:textfield name="dayOfMonth" label="Day Of Month" size="2"/>
<ww:textfield name="month" label="Month" size="2"/>
<ww:textfield name="dayOfWeek" label="Day Of Week" size="2"/>
<ww:textfield name="year" label="Year" size="4"/>
</ww:div>
<ww:hidden name="proxy.protocol" value="http"/>
<ww:textfield name="proxy.host" label="HTTP Proxy Host"/>
<ww:textfield name="proxy.port" label="HTTP Proxy Port"/>
<ww:textfield name="proxy.username" label="HTTP Proxy Username"/>
<ww:password name="proxy.password" label="HTTP Proxy Password"/>
<ww:submit value="Save Configuration"/>
<ww:div>
<ww:label value="Indexing Schedule Keys:" labelposition="top"/>
<ww:label value="* = every" labelposition="top"/>
<ww:label value="? = any" labelposition="top"/>
<ww:label value="- = ranges" labelposition="top"/>
<ww:label value="/ = increments" labelposition="top"/>
</ww:div>
</ww:form>
<ww:div>
<p><i>For valid cron expression values for the Indexing Schedule, see
<ww:a href="http://www.opensymphony.com/quartz/api/org/quartz/CronExpression.html">here</ww:a>
</i></p>
</ww:div>
<script type="text/javascript">
document.getElementById("saveConfiguration_indexPath").focus();
</script>
</div>
</body>
</html>

View File

@ -1,101 +0,0 @@
<%--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you 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 prefix="ww" uri="/webwork" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="redback" uri="http://plexus.codehaus.org/redback/taglib-1.0" %>
<html>
<head>
<title>Administration</title>
<ww:head/>
</head>
<body>
<h1>Administration</h1>
<div id="contentArea">
<div>
<div style="float: right">
<%-- TODO replace with icons --%>
<redback:ifAuthorized permission="archiva-manage-configuration">
<a href="<ww:url action="configure" />">Edit Configuration</a>
</redback:ifAuthorized>
</div>
<h2>Configuration</h2>
</div>
<table class="infoTable">
<tr>
<th>Index Directory</th>
<td>
<ww:property value="indexPath"/>
</td>
<td></td>
</tr>
<tr>
<th>Indexing Schedule</th>
<td>
<ww:property value="indexerCronExpression"/>
</td>
<%-- TODO: a "delete index and run now" operation should be here too (really clean, remove deletions that didn't get picked up) --%>
</tr>
<tr>
<th>Last Indexing Time</th>
<td>
<ww:property value="lastIndexingTime"/>
</td>
<td></td>
</tr>
</table>
<table class="infoTable">
<tr>
<td>
<redback:ifAuthorized permission="archiva-run-indexer">
<a href="<ww:url action="runIndexer" />">Run Now</a>
</redback:ifAuthorized>
</td>
</tr>
</table>
<ww:set name="proxy" value="proxy"/>
<c:if test="${!empty(proxy.host)}">
<h3>HTTP Proxy</h3>
<table class="infoTable">
<tr>
<th>Host</th>
<td>${proxy.host}</td>
</tr>
<tr>
<th>Port</th>
<td>${proxy.port}</td>
</tr>
<tr>
<th>Username</th>
<td>${proxy.username}</td>
</tr>
</table>
</c:if>
</div>
</body>
</html>