From: Brett Porter Date: Wed, 12 Jul 2006 05:39:51 +0000 (+0000) Subject: add a configuration interceptor that sends you to the configuration page if the app... X-Git-Tag: archiva-0.9-alpha-1~785 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=cd7b693b8ee9dec67c542f9dd1a31a23a67a4a4e;p=archiva.git add a configuration interceptor that sends you to the configuration page if the app is not yet properly configured git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@421137 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/maven-repository-configuration/src/main/mdo/configuration.mdo b/maven-repository-configuration/src/main/mdo/configuration.mdo index 32501f53d..189a3f6af 100644 --- a/maven-repository-configuration/src/main/mdo/configuration.mdo +++ b/maven-repository-configuration/src/main/mdo/configuration.mdo @@ -75,6 +75,17 @@ Blacklisted patterns in the discovery process + + + 1.0.0 + + + diff --git a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/admin/ConfigureAction.java b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/admin/ConfigureAction.java new file mode 100644 index 000000000..f19b1baa9 --- /dev/null +++ b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/admin/ConfigureAction.java @@ -0,0 +1,72 @@ +package org.apache.maven.repository.manager.web.action.admin; + +/* + * Copyright 2005-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. + */ + +import com.opensymphony.xwork.ActionSupport; +import com.opensymphony.xwork.ModelDriven; +import com.opensymphony.xwork.Preparable; +import org.apache.maven.repository.configuration.Configuration; +import org.apache.maven.repository.configuration.ConfigurationStore; +import org.apache.maven.repository.configuration.ConfigurationStoreException; +import org.apache.maven.repository.indexing.RepositoryIndexException; +import org.apache.maven.repository.indexing.RepositoryIndexSearchException; + +import java.net.MalformedURLException; + +/** + * Configures the application. + * + * @plexus.component role="com.opensymphony.xwork.Action" role-hint="configureAction" + */ +public class ConfigureAction + extends ActionSupport + implements ModelDriven, Preparable +{ + /** + * @plexus.requirement + */ + private ConfigurationStore configurationStore; + + /** + * The configuration. + */ + private Configuration configuration; + + public String execute() + throws MalformedURLException, RepositoryIndexException, RepositoryIndexSearchException, + ConfigurationStoreException + { + // TODO! not yet implemented + return ERROR; + } + + public String doInput() + { + return INPUT; + } + + public Object getModel() + { + return configuration; + } + + public void prepare() + throws Exception + { + configuration = configurationStore.getConfigurationFromStore(); + } +} \ No newline at end of file diff --git a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/interceptor/ConfigurationInterceptor.java b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/interceptor/ConfigurationInterceptor.java new file mode 100644 index 000000000..2e332e3b0 --- /dev/null +++ b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/interceptor/ConfigurationInterceptor.java @@ -0,0 +1,63 @@ +package org.apache.maven.repository.manager.web.interceptor; + +/* + * Copyright 2005-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. + */ + +import com.opensymphony.xwork.ActionInvocation; +import com.opensymphony.xwork.interceptor.Interceptor; +import org.apache.maven.repository.configuration.Configuration; +import org.apache.maven.repository.configuration.ConfigurationStore; + +/** + * An interceptor that makes the application configuration available + * + * @author Brett Porter + * @todo might be a generally useful thing in plexus-xwork-integration + * @plexus.component role="com.opensymphony.xwork.interceptor.Interceptor" role-hint="configurationInterceptor" + */ +public class ConfigurationInterceptor + implements Interceptor +{ + /** + * @plexus.requirement + */ + private ConfigurationStore configurationStore; + + public String intercept( ActionInvocation actionInvocation ) + throws Exception + { + Configuration configuration = configurationStore.getConfigurationFromStore(); + + if ( !configuration.isValid() ) + { + return "config-needed"; + } + else + { + return actionInvocation.invoke(); + } + } + + public void destroy() + { + // This space left intentionally blank + } + + public void init() + { + // This space left intentionally blank + } +} diff --git a/maven-repository-webapp/src/main/resources/org/apache/maven/repository/manager/web/action/admin/ConfigureAction-validation.xml b/maven-repository-webapp/src/main/resources/org/apache/maven/repository/manager/web/action/admin/ConfigureAction-validation.xml new file mode 100644 index 000000000..1a58a6aa8 --- /dev/null +++ b/maven-repository-webapp/src/main/resources/org/apache/maven/repository/manager/web/action/admin/ConfigureAction-validation.xml @@ -0,0 +1,26 @@ + + + + + + + + You must enter the repository directory. + + + \ No newline at end of file diff --git a/maven-repository-webapp/src/main/resources/org/apache/maven/repository/manager/web/action/quickSearchAction-validation.xml b/maven-repository-webapp/src/main/resources/org/apache/maven/repository/manager/web/action/quickSearchAction-validation.xml new file mode 100644 index 000000000..961cb7c8d --- /dev/null +++ b/maven-repository-webapp/src/main/resources/org/apache/maven/repository/manager/web/action/quickSearchAction-validation.xml @@ -0,0 +1,26 @@ + + + + + + + + You must enter some search terms. + + + \ No newline at end of file diff --git a/maven-repository-webapp/src/main/resources/xwork.xml b/maven-repository-webapp/src/main/resources/xwork.xml index 813ecda2b..635ec2da6 100644 --- a/maven-repository-webapp/src/main/resources/xwork.xml +++ b/maven-repository-webapp/src/main/resources/xwork.xml @@ -14,8 +14,8 @@ ~ limitations under the License. --> - + @@ -23,18 +23,29 @@ + + + + + + + + - + + + + + /admin/configure.action + - /WEB-INF/jsp/quickSearch.jsp - + /WEB-INF/jsp/quickSearch.jsp - /WEB-INF/jsp/quickSearch.jsp - /WEB-INF/jsp/results.jsp - + /WEB-INF/jsp/quickSearch.jsp + /WEB-INF/jsp/results.jsp + + + + + + + /WEB-INF/jsp/admin/configure.jsp + + + + /WEB-INF/jsp/admin/configure.jsp + + + diff --git a/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/admin/configure.jsp b/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/admin/configure.jsp new file mode 100644 index 000000000..0c6f9ed9d --- /dev/null +++ b/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/admin/configure.jsp @@ -0,0 +1,39 @@ +<%@ taglib prefix="ww" uri="/webwork" %> +<%-- + ~ Copyright 2005-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. + --%> + + + + Configuration + + + + + +

Configuration

+ +
+ +
+ + + \ No newline at end of file diff --git a/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp b/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp index 9c513c408..10750a8a9 100644 --- a/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp +++ b/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp @@ -20,11 +20,11 @@ Maven Repository Manager :: <decorator:title default="Maven Repository Manager" /> - +