maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r428785 - in /maven/repository-manager/trunk/maven-repository-webapp/src/main: java/org/apache/maven/repository/manager/web/action/admin/ resources/ webapp/WEB-INF/jsp/admin/ webapp/WEB-INF/jsp/admin/include/ webapp/template/ webapp/templat...
Date Fri, 04 Aug 2006 17:03:55 GMT
Author: brett
Date: Fri Aug  4 10:03:54 2006
New Revision: 428785

URL: http://svn.apache.org/viewvc?rev=428785&view=rev
Log:
[MRM-138] add repository deletion

Added:
    maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/admin/DeleteRepositoryAction.java
  (with props)
    maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/admin/deleteRepository.jsp
  (with props)
    maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/template/
    maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/template/repository-manager/
    maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/template/repository-manager/radiomap.ftl
    maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/template/repository-manager/theme.properties
  (with props)
Modified:
    maven/repository-manager/trunk/maven-repository-webapp/src/main/resources/webwork.properties
    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/admin/include/managedRepositoryForm.jspf
    maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/admin/index.jsp

Added: maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/admin/DeleteRepositoryAction.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/DeleteRepositoryAction.java?rev=428785&view=auto
==============================================================================
--- maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/admin/DeleteRepositoryAction.java
(added)
+++ maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/admin/DeleteRepositoryAction.java
Fri Aug  4 10:03:54 2006
@@ -0,0 +1,109 @@
+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 org.apache.maven.repository.configuration.Configuration;
+import org.apache.maven.repository.configuration.ConfigurationChangeException;
+import org.apache.maven.repository.configuration.ConfigurationStore;
+import org.apache.maven.repository.configuration.ConfigurationStoreException;
+import org.apache.maven.repository.configuration.InvalidConfigurationException;
+import org.apache.maven.repository.configuration.RepositoryConfiguration;
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.xwork.action.PlexusActionSupport;
+
+import java.io.IOException;
+
+/**
+ * Configures the application repositories.
+ *
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="deleteRepositoryAction"
+ */
+public class DeleteRepositoryAction
+    extends PlexusActionSupport
+{
+    /**
+     * @plexus.requirement
+     */
+    private ConfigurationStore configurationStore;
+
+    /**
+     * The repository ID to lookup when editing a repository.
+     */
+    private String repoId;
+
+    /**
+     * Which operation to select.
+     */
+    private String operation = "unmodified";
+
+    public String execute()
+        throws ConfigurationStoreException, IOException, InvalidConfigurationException, ConfigurationChangeException
+    {
+        // TODO: if this didn't come from the form, go to configure.action instead of going
through with re-saving what was just loaded
+
+        if ( "delete-entry".equals( operation ) || "delete-contents".equals( operation )
)
+        {
+            Configuration configuration = configurationStore.getConfigurationFromStore();
+
+            RepositoryConfiguration existingRepository = configuration.getRepositoryById(
repoId );
+            if ( existingRepository == null )
+            {
+                addActionError( "A repository with that id does not exist" );
+                return ERROR;
+            }
+
+            // TODO: remove from index too!
+
+            configuration.removeRepository( existingRepository );
+
+            configurationStore.storeConfiguration( configuration );
+
+            if ( "delete-contents".equals( operation ) )
+            {
+                getLogger().info( "Removing " + existingRepository.getDirectory() );
+                FileUtils.deleteDirectory( existingRepository.getDirectory() );
+            }
+        }
+
+        return SUCCESS;
+    }
+
+    public String input()
+    {
+        return INPUT;
+    }
+
+    public String getRepoId()
+    {
+        return repoId;
+    }
+
+    public void setRepoId( String repoId )
+    {
+        this.repoId = repoId;
+    }
+
+    public String getOperation()
+    {
+        return operation;
+    }
+
+    public void setOperation( String operation )
+    {
+        this.operation = operation;
+    }
+}

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

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

Modified: maven/repository-manager/trunk/maven-repository-webapp/src/main/resources/webwork.properties
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-webapp/src/main/resources/webwork.properties?rev=428785&r1=428784&r2=428785&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-webapp/src/main/resources/webwork.properties
(original)
+++ maven/repository-manager/trunk/maven-repository-webapp/src/main/resources/webwork.properties
Fri Aug  4 10:03:54 2006
@@ -1,3 +1,5 @@
 # define our own action mapper here
 webwork.mapper.class=org.apache.maven.repository.manager.web.mapper.RepositoryActionMapper
 webwork.objectFactory = org.codehaus.plexus.xwork.PlexusObjectFactory
+
+# TODO! package up a theme and share with Continuum. Should contain everything from xhtml,
and set templateDir to WEB-INF/themes
\ 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=428785&r1=428784&r2=428785&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 Fri
Aug  4 10:03:54 2006
@@ -137,6 +137,11 @@
       <result type="redirect-action">index</result>
     </action>
 
+    <action name="deleteRepository" class="deleteRepositoryAction">
+      <result name="input">/WEB-INF/jsp/admin/deleteRepository.jsp</result>
+      <result type="redirect-action">index</result>
+    </action>
+
     <action name="configure" class="configureAction" method="input">
       <result name="input">/WEB-INF/jsp/admin/configure.jsp</result>
       <interceptor-ref name="defaultStack"/>

Added: maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/admin/deleteRepository.jsp
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/admin/deleteRepository.jsp?rev=428785&view=auto
==============================================================================
--- maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/admin/deleteRepository.jsp
(added)
+++ maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/admin/deleteRepository.jsp
Fri Aug  4 10:03:54 2006
@@ -0,0 +1,47 @@
+<%--
+  ~ 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.
+  --%>
+
+<%@ taglib prefix="ww" uri="/webwork" %>
+
+<html>
+<head>
+  <title>Configuration</title>
+  <ww:head />
+</head>
+
+<body>
+
+<h1>Configuration</h1>
+
+<div id="contentArea">
+
+  <h2>Delete Managed Repository</h2>
+
+  <blockquote>
+    <strong><span class="statusFailed">WARNING:</span> This operation can
not be undone.</strong>
+  </blockquote>
+
+  <ww:form method="post" action="deleteRepository" namespace="/admin" validate="true">
+    <ww:hidden name="repoId" />
+    <ww:radio list="#@java.util.LinkedHashMap@{'delete-contents' : 'Remove the repository
and delete its contents from disk',
+    'delete-entry' : 'Remove the repository from the management list, but leave the contents
unmodified',
+    'unmodified' : 'Leave the repository unmodified'}" name="operation" theme="repository-manager"
/>
+    <ww:submit value="Go" />
+  </ww:form>
+</div>
+
+</body>
+</html>
\ No newline at end of file

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

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

Modified: maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/admin/include/managedRepositoryForm.jspf
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/admin/include/managedRepositoryForm.jspf?rev=428785&r1=428784&r2=428785&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/admin/include/managedRepositoryForm.jspf
(original)
+++ maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/admin/include/managedRepositoryForm.jspf
Fri Aug  4 10:03:54 2006
@@ -18,6 +18,6 @@
 
 <ww:textfield name="name" label="Name" size="50" />
 <ww:textfield name="directory" label="Directory" size="100" />
-<ww:select list="#@java.util.HashMap@{'default' : 'Maven 2.x Repository', 'legacy' : 'Maven
1.x Repository'}"
+<ww:select list="#@java.util.LinkedHashMap@{'default' : 'Maven 2.x Repository', 'legacy'
: 'Maven 1.x Repository'}"
            name="layout" label="Type" />
 <ww:checkbox name="includeSnapshots" fieldValue="true" label="Snapshots Included" />

Modified: maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/admin/index.jsp
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/admin/index.jsp?rev=428785&r1=428784&r2=428785&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/admin/index.jsp
(original)
+++ maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/admin/index.jsp
Fri Aug  4 10:03:54 2006
@@ -64,8 +64,9 @@
       <div style="float: right">
           <%-- TODO! replace with icons --%>
         <a href="<ww:url action="editRepository" method="input"><ww:param name="repoId"
value="%{'${repository.id}'}" /></ww:url>">Edit
-          Repository</a> | <a href="#">Delete Repository</a>
-          <%-- TODO! serious confirmation, implement, prompt whether to delete contents
too, remember index --%>
+          Repository</a> | <a
+          href="<ww:url action="deleteRepository" method="input"><ww:param name="repoId"
value="%{'${repository.id}'}" /></ww:url>">Delete
+        Repository</a>
       </div>
       <h3>${repository.name}</h3>
       <table>

Added: maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/template/repository-manager/radiomap.ftl
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/template/repository-manager/radiomap.ftl?rev=428785&view=auto
==============================================================================
--- maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/template/repository-manager/radiomap.ftl
(added)
+++ maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/template/repository-manager/radiomap.ftl
Fri Aug  4 10:03:54 2006
@@ -0,0 +1,39 @@
+<@ww.iterator value="parameters.list">
+    <#if parameters.listKey?exists>
+        <#assign itemKey = stack.findValue(parameters.listKey)/>
+    <#else>
+        <#assign itemKey = stack.findValue('top')/>
+    </#if>
+    <#if parameters.listValue?exists>
+        <#assign itemValue = stack.findString(parameters.listValue)/>
+    <#else>
+        <#assign itemValue = stack.findString('top')/>
+    </#if>
+<input type="radio" name="${parameters.name?html}" id="${parameters.id?html}${itemKey?html}"<#rt/>
+<#if tag.contains(parameters.nameValue, itemKey)>
+ checked="checked"<#rt/>
+</#if>
+<#if itemKey?exists>
+ value="${itemKey?html}"<#rt/>
+</#if>
+<#if parameters.disabled?default(false)>
+ disabled="disabled"<#rt/>
+</#if>
+<#if parameters.tabindex?exists>
+ tabindex="${parameters.tabindex?html}"<#rt/>
+</#if>
+<#if parameters.cssClass?exists>
+ class="${parameters.cssClass?html}"<#rt/>
+</#if>
+<#if parameters.cssStyle?exists>
+ style="${parameters.cssStyle?html}"<#rt/>
+</#if>
+<#if parameters.title?exists>
+ title="${parameters.title?html}"<#rt/>
+</#if>
+<#include "/${parameters.templateDir}/simple/scripting-events.ftl" />
+/><#rt/>
+<label for="${parameters.id?html}${itemKey?html}"><#rt/>
+    ${itemValue}<#t/>
+</label><br/>
+</@ww.iterator>

Added: maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/template/repository-manager/theme.properties
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/template/repository-manager/theme.properties?rev=428785&view=auto
==============================================================================
--- maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/template/repository-manager/theme.properties
(added)
+++ maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/template/repository-manager/theme.properties
Fri Aug  4 10:03:54 2006
@@ -0,0 +1,17 @@
+#
+# 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.
+#
+
+parent = xhtml

Propchange: maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/template/repository-manager/theme.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/template/repository-manager/theme.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision



Mime
View raw message