maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r421137 - in /maven/repository-manager/trunk: maven-repository-configuration/src/main/mdo/ maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/admin/ maven-repository-webapp/src/main/java/org/apache/maven/re...
Date Wed, 12 Jul 2006 05:39:52 GMT
Author: brett
Date: Tue Jul 11 22:39:51 2006
New Revision: 421137

URL: http://svn.apache.org/viewvc?rev=421137&view=rev
Log:
add a configuration interceptor that sends you to the configuration page if the app is not
yet properly configured

Added:
    maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/admin/
    maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/admin/ConfigureAction.java
  (with props)
    maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/interceptor/
    maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/interceptor/ConfigurationInterceptor.java
  (with props)
    maven/repository-manager/trunk/maven-repository-webapp/src/main/resources/org/apache/maven/repository/manager/web/action/admin/
    maven/repository-manager/trunk/maven-repository-webapp/src/main/resources/org/apache/maven/repository/manager/web/action/admin/ConfigureAction-validation.xml
  (with props)
    maven/repository-manager/trunk/maven-repository-webapp/src/main/resources/org/apache/maven/repository/manager/web/action/quickSearchAction-validation.xml
    maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/admin/
    maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/admin/configure.jsp
  (with props)
Modified:
    maven/repository-manager/trunk/maven-repository-configuration/src/main/mdo/configuration.mdo
    maven/repository-manager/trunk/maven-repository-webapp/src/main/resources/xwork.xml
    maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp

Modified: maven/repository-manager/trunk/maven-repository-configuration/src/main/mdo/configuration.mdo
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-configuration/src/main/mdo/configuration.mdo?rev=421137&r1=421136&r2=421137&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-configuration/src/main/mdo/configuration.mdo
(original)
+++ maven/repository-manager/trunk/maven-repository-configuration/src/main/mdo/configuration.mdo
Tue Jul 11 22:39:51 2006
@@ -75,6 +75,17 @@
           <description>Blacklisted patterns in the discovery process</description>
         </field>
       </fields>
+      <codeSegments>
+        <codeSegment>
+          <version>1.0.0</version>
+          <code><![CDATA[
+    public boolean isValid()
+    {
+        return indexPath != null & repositoryDirectory != null;
+    }
+          ]]></code>
+        </codeSegment>
+      </codeSegments>
     </class>
   </classes>
 </model>

Added: maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/admin/ConfigureAction.java
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/admin/ConfigureAction.java?rev=421137&view=auto
==============================================================================
--- maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/admin/ConfigureAction.java
(added)
+++ maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/admin/ConfigureAction.java
Tue Jul 11 22:39:51 2006
@@ -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

Propchange: maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/admin/ConfigureAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/admin/ConfigureAction.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/interceptor/ConfigurationInterceptor.java
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/interceptor/ConfigurationInterceptor.java?rev=421137&view=auto
==============================================================================
--- maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/interceptor/ConfigurationInterceptor.java
(added)
+++ maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/interceptor/ConfigurationInterceptor.java
Tue Jul 11 22:39:51 2006
@@ -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 <a href="mailto:brett@apache.org">Brett Porter</a>
+ * @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
+    }
+}

Propchange: maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/interceptor/ConfigurationInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/interceptor/ConfigurationInterceptor.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/repository-manager/trunk/maven-repository-webapp/src/main/resources/org/apache/maven/repository/manager/web/action/admin/ConfigureAction-validation.xml
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-webapp/src/main/resources/org/apache/maven/repository/manager/web/action/admin/ConfigureAction-validation.xml?rev=421137&view=auto
==============================================================================
--- maven/repository-manager/trunk/maven-repository-webapp/src/main/resources/org/apache/maven/repository/manager/web/action/admin/ConfigureAction-validation.xml
(added)
+++ maven/repository-manager/trunk/maven-repository-webapp/src/main/resources/org/apache/maven/repository/manager/web/action/admin/ConfigureAction-validation.xml
Tue Jul 11 22:39:51 2006
@@ -0,0 +1,26 @@
+<!--
+  ~ 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.
+  -->
+
+<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
+    "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+
+<validators>
+  <field name="repositoryDirectory">
+    <field-validator type="requiredstring">
+      <message>You must enter the repository directory.</message>
+    </field-validator>
+  </field>
+</validators>
\ No newline at end of file

Propchange: maven/repository-manager/trunk/maven-repository-webapp/src/main/resources/org/apache/maven/repository/manager/web/action/admin/ConfigureAction-validation.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/repository-manager/trunk/maven-repository-webapp/src/main/resources/org/apache/maven/repository/manager/web/action/admin/ConfigureAction-validation.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/repository-manager/trunk/maven-repository-webapp/src/main/resources/org/apache/maven/repository/manager/web/action/quickSearchAction-validation.xml
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-webapp/src/main/resources/org/apache/maven/repository/manager/web/action/quickSearchAction-validation.xml?rev=421137&view=auto
==============================================================================
--- maven/repository-manager/trunk/maven-repository-webapp/src/main/resources/org/apache/maven/repository/manager/web/action/quickSearchAction-validation.xml
(added)
+++ maven/repository-manager/trunk/maven-repository-webapp/src/main/resources/org/apache/maven/repository/manager/web/action/quickSearchAction-validation.xml
Tue Jul 11 22:39:51 2006
@@ -0,0 +1,26 @@
+<!--
+  ~ 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.
+  -->
+
+<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
+    "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+
+<validators>
+  <field name="q">
+    <field-validator type="requiredstring">
+      <message>You must enter some search terms.</message>
+    </field-validator>
+  </field>
+</validators>
\ No newline at end of file

Modified: maven/repository-manager/trunk/maven-repository-webapp/src/main/resources/xwork.xml
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-webapp/src/main/resources/xwork.xml?rev=421137&r1=421136&r2=421137&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-webapp/src/main/resources/xwork.xml (original)
+++ maven/repository-manager/trunk/maven-repository-webapp/src/main/resources/xwork.xml Tue
Jul 11 22:39:51 2006
@@ -14,8 +14,8 @@
   ~ limitations under the License.
   -->
 
-<!DOCTYPE xwork PUBLIC "-//OpenSymphony Group//XWork 1.0//EN"
-    "http://www.opensymphony.com/xwork/xwork-1.0.dtd">
+<!DOCTYPE xwork PUBLIC "-//OpenSymphony Group//XWork 1.1//EN"
+    "http://www.opensymphony.com/xwork/xwork-1.1.dtd">
 
 <xwork>
   <!-- Include webwork defaults (from WebWork JAR). -->
@@ -23,18 +23,29 @@
 
   <!-- Configuration for the default package. -->
   <package name="default" extends="webwork-default">
+    <interceptors>
+      <interceptor name="configuration" class="configurationInterceptor"/>
+      <interceptor-stack name="configuredStack">
+        <interceptor-ref name="defaultStack"/>
+        <interceptor-ref name="configuration"/>
+      </interceptor-stack>
+    </interceptors>
+
     <!-- Default interceptor stack. -->
-    <default-interceptor-ref name="defaultStack"/>
+    <default-interceptor-ref name="configuredStack"/>
+
+    <global-results>
+      <!-- TODO: might want an extra message on the configure page when this first happens
-->
+      <result name="config-needed" type="redirect">/admin/configure.action</result>
+    </global-results>
 
     <action name="index" class="quickSearchAction" method="input">
-      <result name="success" type="dispatcher">/WEB-INF/jsp/quickSearch.jsp</result>
-      <interceptor-ref name="validationWorkflowStack"/>
+      <result name="input">/WEB-INF/jsp/quickSearch.jsp</result>
     </action>
 
     <action name="quickSearch" class="quickSearchAction">
-      <result name="input" type="dispatcher">/WEB-INF/jsp/quickSearch.jsp</result>
-      <result name="success" type="dispatcher">/WEB-INF/jsp/results.jsp</result>
-      <interceptor-ref name="validationWorkflowStack"/>
+      <result name="input">/WEB-INF/jsp/quickSearch.jsp</result>
+      <result>/WEB-INF/jsp/results.jsp</result>
     </action>
 
     <!-- TODO! old actions
@@ -73,6 +84,20 @@
       <result name="error" type="dispatcher">/WEB-INF/jsp/index.jsp</result>
     </action>
     -->
+  </package>
+
+  <!-- Configuration for the admin package. -->
+  <package name="admin" namespace="/admin" extends="webwork-default">
+    <default-interceptor-ref name="defaultStack"/>
+
+    <action name="configure" class="configureAction" method="input">
+      <result name="input">/WEB-INF/jsp/admin/configure.jsp</result>
+    </action>
+
+    <action name="saveConfiguration" class="configureAction">
+      <result name="input">/WEB-INF/jsp/admin/configure.jsp</result>
+      <!-- TODO: need a SUCCESS handler! -->
+    </action>
   </package>
 </xwork>
 

Added: maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/admin/configure.jsp
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/admin/configure.jsp?rev=421137&view=auto
==============================================================================
--- maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/admin/configure.jsp
(added)
+++ maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/admin/configure.jsp
Tue Jul 11 22:39:51 2006
@@ -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.
+  --%>
+
+<html>
+<head>
+  <title>Configuration</title>
+  <ww:head />
+</head>
+
+<body>
+
+<h1>Configuration</h1>
+
+<div id="contentArea">
+  <div id="searchBox">
+    <ww:form method="post" action="saveConfiguration" namespace="/admin" validate="true">
+      <ww:textfield name="repositoryDirectory" label="Repository Directory" />
+      <ww:textfield name="discoveryCronExpression" label="Discovery Cron Expression" />
+      <ww:submit value="Save Configuration" />
+    </ww:form>
+  </div>
+</div>
+
+</body>
+</html>
\ No newline at end of file

Propchange: maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/admin/configure.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/admin/configure.jsp
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp?rev=421137&r1=421136&r2=421137&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp
(original)
+++ maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp
Tue Jul 11 22:39:51 2006
@@ -20,11 +20,11 @@
   <title>Maven Repository Manager :: <decorator:title default="Maven Repository
Manager" /></title>
 
   <style type="text/css" media="all">
-    @import url( "./css/maven-base.css" );
-    @import url( "./css/maven-theme.css" );
-    @import url( "./css/site.css" );
+    @import url( "<%= request.getContextPath() %>/css/maven-base.css" );
+    @import url( "<%= request.getContextPath() %>/css/maven-theme.css" );
+    @import url( "<%= request.getContextPath() %>/css/site.css" );
   </style>
-  <link rel="stylesheet" href="./css/print.css" type="text/css" media="print" />
+  <link rel="stylesheet" href="<%= request.getContextPath() %>/css/print.css" type="text/css"
media="print" />
   <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
 </head>
 



Mime
View raw message