--- /dev/null
+package org.apache.maven.archiva.web.action.admin.legacy;\r
+\r
+/*\r
+ * Licensed to the Apache Software Foundation (ASF) under one\r
+ * or more contributor license agreements. See the NOTICE file\r
+ * distributed with this work for additional information\r
+ * regarding copyright ownership. The ASF licenses this file\r
+ * to you under the Apache License, Version 2.0 (the\r
+ * "License"); you may not use this file except in compliance\r
+ * with the License. You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing,\r
+ * software distributed under the License is distributed on an\r
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r
+ * KIND, either express or implied. See the License for the\r
+ * specific language governing permissions and limitations\r
+ * under the License.\r
+ */\r
+\r
+import org.apache.maven.archiva.configuration.ArchivaConfiguration;\r
+import org.apache.maven.archiva.configuration.Configuration;\r
+import org.apache.maven.archiva.configuration.IndeterminateConfigurationException;\r
+import org.apache.maven.archiva.configuration.LegacyArtifactPath;\r
+import org.apache.maven.archiva.repository.ManagedRepositoryContent;\r
+import org.codehaus.plexus.registry.RegistryException;\r
+import org.codehaus.plexus.xwork.action.PlexusActionSupport;\r
+\r
+import com.opensymphony.xwork.Preparable;\r
+\r
+/**\r
+ * Add a LegacyArtifactPath to archiva configuration\r
+ *\r
+ *\r
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="addLegacyArtifactPathAction"\r
+ */\r
+public class AddLegacyArtifactPathAction\r
+ extends PlexusActionSupport\r
+ implements Preparable\r
+{\r
+ /**\r
+ * @plexus.requirement\r
+ */\r
+ private ArchivaConfiguration archivaConfiguration;\r
+\r
+ /**\r
+ * @plexus.requirement role-hint="legacy"\r
+ */\r
+ private ManagedRepositoryContent repositoryContent;\r
+\r
+\r
+ private LegacyArtifactPath legacyArtifactPath;\r
+\r
+\r
+ public void prepare()\r
+ {\r
+ this.legacyArtifactPath = new LegacyArtifactPath();\r
+ }\r
+\r
+ public String input()\r
+ {\r
+ return INPUT;\r
+ }\r
+\r
+ public String commit()\r
+ {\r
+ ArtifactReference artifact = this.legacyArtifactPath.getArtifactReference();\r
+ String path = repositoryContent.toPath( artifact );\r
+ if ( ! path.equals( this.legacyArtifactPath.getPath() ) )\r
+ {\r
+ addActionError( "artifact reference does not match the initial path : " + path );\r
+ return ERROR;\r
+ }\r
+\r
+ Configuration configuration = archivaConfiguration.getConfiguration();\r
+ configuration.addLegacyArtifactPath( legacyArtifactPath );\r
+ return saveConfiguration( configuration );\r
+ }\r
+\r
+ public LegacyArtifactPath getLegacyArtifactPath()\r
+ {\r
+ return legacyArtifactPath;\r
+ }\r
+\r
+ public void setLegacyArtifactPath( LegacyArtifactPath legacyArtifactPath )\r
+ {\r
+ this.legacyArtifactPath = legacyArtifactPath;\r
+ }\r
+\r
+ protected String saveConfiguration( Configuration configuration )\r
+ {\r
+ try\r
+ {\r
+ archivaConfiguration.save( configuration );\r
+ addActionMessage( "Successfully saved configuration" );\r
+ }\r
+ catch ( IndeterminateConfigurationException e )\r
+ {\r
+ addActionError( e.getMessage() );\r
+ return INPUT;\r
+ }\r
+ catch ( RegistryException e )\r
+ {\r
+ addActionError( "Configuration Registry Exception: " + e.getMessage() );\r
+ return INPUT;\r
+ }\r
+\r
+ return SUCCESS;\r
+ }\r
+}\r
--- /dev/null
+package org.apache.maven.archiva.web.action.admin.legacy;\r
+\r
+/*\r
+ * Licensed to the Apache Software Foundation (ASF) under one\r
+ * or more contributor license agreements. See the NOTICE file\r
+ * distributed with this work for additional information\r
+ * regarding copyright ownership. The ASF licenses this file\r
+ * to you under the Apache License, Version 2.0 (the\r
+ * "License"); you may not use this file except in compliance\r
+ * with the License. You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing,\r
+ * software distributed under the License is distributed on an\r
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r
+ * KIND, either express or implied. See the License for the\r
+ * specific language governing permissions and limitations\r
+ * under the License.\r
+ */\r
+\r
+import java.util.Iterator;\r
+\r
+import org.apache.maven.archiva.configuration.ArchivaConfiguration;\r
+import org.apache.maven.archiva.configuration.Configuration;\r
+import org.apache.maven.archiva.configuration.IndeterminateConfigurationException;\r
+import org.apache.maven.archiva.configuration.LegacyArtifactPath;\r
+import org.codehaus.plexus.registry.RegistryException;\r
+import org.codehaus.plexus.xwork.action.PlexusActionSupport;\r
+\r
+/**\r
+ * Delete a LegacyArtifactPath to archiva configuration\r
+ *\r
+ *\r
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="deleteLegacyArtifactPathAction"\r
+ */\r
+public class DeleteLegacyArtifactPathAction\r
+ extends PlexusActionSupport\r
+{\r
+ /**\r
+ * @plexus.requirement\r
+ */\r
+ private ArchivaConfiguration archivaConfiguration;\r
+\r
+ private String path;\r
+\r
+ public String delete()\r
+ {\r
+ getLogger().info( "remove [" + path + "] from legacy artifact path resolution" );\r
+ Configuration configuration = archivaConfiguration.getConfiguration();\r
+ for ( Iterator iterator = configuration.getLegacyArtifactPaths().iterator(); iterator.hasNext(); )\r
+ {\r
+ LegacyArtifactPath legacyArtifactPath = (LegacyArtifactPath) iterator.next();\r
+ if (legacyArtifactPath.match( path ))\r
+ {\r
+ iterator.remove();\r
+ }\r
+ }\r
+ return saveConfiguration( configuration );\r
+ }\r
+\r
+ protected String saveConfiguration( Configuration configuration )\r
+ {\r
+ try\r
+ {\r
+ archivaConfiguration.save( configuration );\r
+ addActionMessage( "Successfully saved configuration" );\r
+ }\r
+ catch ( IndeterminateConfigurationException e )\r
+ {\r
+ addActionError( e.getMessage() );\r
+ return INPUT;\r
+ }\r
+ catch ( RegistryException e )\r
+ {\r
+ addActionError( "Configuration Registry Exception: " + e.getMessage() );\r
+ return INPUT;\r
+ }\r
+\r
+ return SUCCESS;\r
+ }\r
+\r
+ public String getPath()\r
+ {\r
+ return path;\r
+ }\r
+\r
+ public void setPath( String path )\r
+ {\r
+ this.path = path;\r
+ }\r
+}\r
--- /dev/null
+package org.apache.maven.archiva.web.action.admin.legacy;\r
+\r
+/*\r
+ * Licensed to the Apache Software Foundation (ASF) under one\r
+ * or more contributor license agreements. See the NOTICE file\r
+ * distributed with this work for additional information\r
+ * regarding copyright ownership. The ASF licenses this file\r
+ * to you under the Apache License, Version 2.0 (the\r
+ * "License"); you may not use this file except in compliance\r
+ * with the License. You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing,\r
+ * software distributed under the License is distributed on an\r
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r
+ * KIND, either express or implied. See the License for the\r
+ * specific language governing permissions and limitations\r
+ * under the License.\r
+ */\r
+\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+\r
+import javax.servlet.http.HttpServletRequest;\r
+\r
+import org.apache.maven.archiva.configuration.ArchivaConfiguration;\r
+import org.apache.maven.archiva.configuration.Configuration;\r
+import org.apache.maven.archiva.configuration.LegacyArtifactPath;\r
+import org.apache.maven.archiva.security.ArchivaRoleConstants;\r
+import org.apache.maven.archiva.web.util.ContextUtils;\r
+import org.codehaus.plexus.redback.rbac.Resource;\r
+import org.codehaus.plexus.redback.xwork.interceptor.SecureAction;\r
+import org.codehaus.plexus.redback.xwork.interceptor.SecureActionBundle;\r
+import org.codehaus.plexus.redback.xwork.interceptor.SecureActionException;\r
+import org.codehaus.plexus.xwork.action.PlexusActionSupport;\r
+\r
+import com.opensymphony.webwork.interceptor.ServletRequestAware;\r
+import com.opensymphony.xwork.Preparable;\r
+\r
+/**\r
+ * Shows the LegacyArtifactPath Tab for the administrator.\r
+ *\r
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="legacyArtifactPathAction"\r
+ */\r
+public class LegacyArtifactPathAction\r
+ extends PlexusActionSupport\r
+ implements SecureAction, ServletRequestAware, Preparable\r
+{\r
+ /**\r
+ * @plexus.requirement\r
+ */\r
+ private ArchivaConfiguration archivaConfiguration;\r
+\r
+ private List<LegacyArtifactPath> legacyArtifactPaths;\r
+\r
+ /**\r
+ * Used to construct the repository WebDAV URL in the repository action.\r
+ */\r
+ private String baseUrl;\r
+\r
+ public void setServletRequest( HttpServletRequest request )\r
+ {\r
+ // TODO: is there a better way to do this?\r
+ this.baseUrl = ContextUtils.getBaseURL( request, "repository" );\r
+ }\r
+\r
+ public SecureActionBundle getSecureActionBundle()\r
+ throws SecureActionException\r
+ {\r
+ SecureActionBundle bundle = new SecureActionBundle();\r
+\r
+ bundle.setRequiresAuthentication( true );\r
+ bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION,\r
+ Resource.GLOBAL );\r
+\r
+ return bundle;\r
+ }\r
+\r
+ public void prepare()\r
+ {\r
+ Configuration config = archivaConfiguration.getConfiguration();\r
+\r
+ legacyArtifactPaths = new ArrayList<LegacyArtifactPath>( config.getLegacyArtifactPaths() );\r
+ }\r
+\r
+ public List<LegacyArtifactPath> getLegacyArtifactPaths()\r
+ {\r
+ return legacyArtifactPaths;\r
+ }\r
+\r
+ public String getBaseUrl()\r
+ {\r
+ return baseUrl;\r
+ }\r
+}\r
<global-results>
<!-- The following security-* result names arrive from the plexus-security package -->
-
+
<result name="security-login-success" type="redirect-action">index</result>
<result name="security-login-cancel" type="redirect-action">index</result>
<result name="security-login-locked" type="redirect-action">
<result name="success" type="redirect-action">proxyConnectors</result>
<interceptor-ref name="configuredPrepareParamsStack"/>
</action>
-
+
<action name="sortDownProxyConnector" class="sortProxyConnectorsAction" method="sortDown">
<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="deleteProxyConnectorAction" method="confirm">
<result name="input">/WEB-INF/jsp/admin/deleteProxyConnector.jsp</result>
<result name="success" type="redirect-action">proxyConnectors</result>
<param name="namespace">/admin</param>
</result>
</action>
+
+ <!-- .\ LEGACY SUPPORT \.__________________________________________ -->
+
+ <action name="legacyArtifactPath" class="legacyArtifactPathAction" method="input">
+ <result name="input">/WEB-INF/jsp/admin/legacyArtifactPath.jsp</result>
+ <result name="success" type="redirect-action">
+ <param name="actionName">legacyArtifactPath</param>
+ </result>
+ </action>
+
+ <action name="addLegacyArtifactPath" class="addLegacyArtifactPathAction" method="input">
+ <result name="input">/WEB-INF/jsp/admin/addLegacyArtifactPath.jsp</result>
+ <result name="error">/WEB-INF/jsp/admin/addLegacyArtifactPath.jsp</result>
+ <result name="success" type="redirect-action">legacyArtifactPath</result>
+ <interceptor-ref name="configuredPrepareParamsStack"/>
+ </action>
+
+ <action name="deleteLegacyArtifactPath" class="deleteLegacyArtifactPathAction" method="delete">
+ <result name="input">/WEB-INF/jsp/admin/legacyArtifactPath.jsp</result>
+ <result name="error">/WEB-INF/jsp/admin/legacyArtifactPath.jsp</result>
+ <result name="success" type="redirect-action">legacyArtifactPath</result>
+ <interceptor-ref name="configuredPrepareParamsStack"/>
+ </action>
+
</package>
<package name="report" namespace="/report" extends="base">
--- /dev/null
+<%--\r
+ ~ Licensed to the Apache Software Foundation (ASF) under one\r
+ ~ or more contributor license agreements. See the NOTICE file\r
+ ~ distributed with this work for additional information\r
+ ~ regarding copyright ownership. The ASF licenses this file\r
+ ~ to you under the Apache License, Version 2.0 (the\r
+ ~ "License"); you may not use this file except in compliance\r
+ ~ with the License. You may obtain a copy of the License at\r
+ ~\r
+ ~ http://www.apache.org/licenses/LICENSE-2.0\r
+ ~\r
+ ~ Unless required by applicable law or agreed to in writing,\r
+ ~ software distributed under the License is distributed on an\r
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r
+ ~ KIND, either express or implied. See the License for the\r
+ ~ specific language governing permissions and limitations\r
+ ~ under the License.\r
+ --%>\r
+\r
+<%@ taglib prefix="ww" uri="/webwork" %>\r
+\r
+<html>\r
+<head>\r
+ <title>Admin: Add Legacy artifact path</title>\r
+ <ww:head/>\r
+</head>\r
+\r
+<body>\r
+\r
+<h1>Admin: Add Legacy artifact path</h1>\r
+\r
+<div id="contentArea">\r
+\r
+ <script type="text/javascript">\r
+ function parse( path )\r
+ {\r
+ var group = path.indexOf( "/" );\r
+ if ( group > 0 )\r
+ {\r
+ document.getElementById( "addLegacyArtifactPath_groupId" ).value\r
+ = path.substring( 0, group );\r
+ group += 1;\r
+ var type = path.indexOf( "/", group );\r
+ if ( type > 0 )\r
+ {\r
+ document.getElementById( "addLegacyArtifactPath_type" ).value\r
+ = path.substring( group, type - 1 );\r
+ }\r
+ type += 1;\r
+ var version = path.indexOf( "-", type );\r
+ var ext = path.lastIndexOf( "." );\r
+ if ( version > 0 )\r
+ {\r
+ document.getElementById( "addLegacyArtifactPath_artifactId" ).value\r
+ = path.substring( type, version );\r
+ document.getElementById( "addLegacyArtifactPath_version" ).value\r
+ = path.substring( version + 1, ext );\r
+ }\r
+\r
+ }\r
+ }\r
+ function computeArtifactReference()\r
+ {\r
+ document.getElementById("addLegacyArtifactPath_legacyArtifactPath_artifact").value\r
+ = document.getElementById("addLegacyArtifactPath_groupId").value\r
+ + ":"\r
+ + document.getElementById("addLegacyArtifactPath_artifactId").value\r
+ + ":"\r
+ + document.getElementById("addLegacyArtifactPath_version").value\r
+ + ":"\r
+ + document.getElementById("addLegacyArtifactPath_classifier").value\r
+ + ":"\r
+ + document.getElementById("addLegacyArtifactPath_type").value;\r
+ }\r
+ </script>\r
+\r
+ <ww:actionmessage/>\r
+ <ww:actionerror/>\r
+ <ww:form method="post" action="addLegacyArtifactPath!commit" namespace="/admin" validate="true" onsubmit="computeArtifactReference()">\r
+ <ww:textfield name="legacyArtifactPath.path" label="Path" size="50" required="true" onchange="parse( this.value )"/>\r
+ <ww:textfield name="groupId" label="GroupId" size="20" required="true" disabled="true"/>\r
+ <ww:textfield name="artifactId" label="ArtifactId" size="20" required="true"/>\r
+ <ww:textfield name="version" label="Version" size="20" required="true"/>\r
+ <ww:textfield name="classifier" label="Classifier" size="20" required="false"/>\r
+ <ww:textfield name="type" label="Type" size="20" required="true" disabled="true"/>\r
+ <ww:hidden name="legacyArtifactPath.artifact"/>\r
+ <ww:submit value="Add Legacy Artifact Path"/>\r
+ </ww:form>\r
+\r
+ <script type="text/javascript">\r
+ var ref = document.getElementById("addLegacyArtifactPath_legacyArtifactPath_artifact").value;\r
+ var i = ref.indexOf( ":" );\r
+ document.getElementById("addLegacyArtifactPath_groupId").value = ref.substring( 0, i );\r
+ var j = i + 1;\r
+ var i = ref.indexOf( ":", j );\r
+ document.getElementById("addLegacyArtifactPath_artifactId").value = ref.substring( j, i );\r
+ var j = i + 1;\r
+ var i = ref.indexOf( ":", j );\r
+ document.getElementById("addLegacyArtifactPath_version").value = ref.substring( j, i );\r
+ var j = i + 1;\r
+ var i = ref.indexOf( ":", j );\r
+ document.getElementById("addLegacyArtifactPath_classifier").value = ref.substring( j, i );\r
+\r
+ document.getElementById("addLegacyArtifactPath_legacyArtifactPath_path").focus();\r
+ </script>\r
+\r
+</div>\r
+\r
+</body>\r
+</html>\r
--- /dev/null
+<%--\r
+ ~ Licensed to the Apache Software Foundation (ASF) under one\r
+ ~ or more contributor license agreements. See the NOTICE file\r
+ ~ distributed with this work for additional information\r
+ ~ regarding copyright ownership. The ASF licenses this file\r
+ ~ to you under the Apache License, Version 2.0 (the\r
+ ~ "License"); you may not use this file except in compliance\r
+ ~ with the License. You may obtain a copy of the License at\r
+ ~\r
+ ~ http://www.apache.org/licenses/LICENSE-2.0\r
+ ~\r
+ ~ Unless required by applicable law or agreed to in writing,\r
+ ~ software distributed under the License is distributed on an\r
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r
+ ~ KIND, either express or implied. See the License for the\r
+ ~ specific language governing permissions and limitations\r
+ ~ under the License.\r
+ --%>\r
+\r
+<%@ taglib prefix="ww" uri="/webwork" %>\r
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>\r
+<%@ taglib prefix="redback" uri="http://plexus.codehaus.org/redback/taglib-1.0" %>\r
+<%@ taglib prefix="archiva" uri="http://maven.apache.org/archiva" %>\r
+\r
+<html>\r
+<head>\r
+ <title>Administration - Legacy support</title>\r
+ <ww:head/>\r
+</head>\r
+\r
+<body>\r
+\r
+<h1>Administration - Legacy artifacts path resolution</h1>\r
+\r
+<div id="contentArea">\r
+\r
+<ww:actionerror/>\r
+<ww:actionmessage/>\r
+\r
+<div class="admin">\r
+<div class="controls">\r
+ <redback:ifAuthorized permission="archiva-manage-configuration">\r
+ <ww:url id="addLegacyArtifactPathUrl" action="addLegacyArtifactPath"/>\r
+ <ww:a href="%{addLegacyArtifactPathUrl}">\r
+ <img src="<c:url value="/images/icons/create.png" />" alt="" width="16" height="16"/>\r
+ Add\r
+ </ww:a>\r
+ </redback:ifAuthorized>\r
+</div>\r
+<h2>Legacy artifacts path resolution</h2>\r
+\r
+<c:choose>\r
+<c:when test="${empty(legacyArtifactPaths)}">\r
+ <%-- No Managed Repositories. --%>\r
+ <strong>There are no legacy artifact path configured yet.</strong>\r
+</c:when>\r
+<c:otherwise>\r
+<%-- Display the repositories. --%>\r
+\r
+<c:forEach items="${legacyArtifactPaths}" var="legacyArtifactPath" varStatus="i">\r
+<c:choose>\r
+ <c:when test='${(i.index)%2 eq 0}'>\r
+ <c:set var="rowColor" value="dark" scope="page"/>\r
+ </c:when>\r
+ <c:otherwise>\r
+ <c:set var="rowColor" value="lite" scope="page"/>\r
+ </c:otherwise>\r
+</c:choose>\r
+\r
+<div class="legacyArtifactPath ${rowColor}">\r
+\r
+<div class="controls">\r
+ <%-- TODO: make some icons --%>\r
+ <redback:ifAnyAuthorized permissions="archiva-manage-configuration">\r
+ <ww:url id="deleteLegacyArtifactPath" action="deleteLegacyArtifactPath">\r
+ <ww:param name="path" value="%{'${legacyArtifactPath.path}'}"/>\r
+ </ww:url>\r
+ <ww:a href="%{deleteLegacyArtifactPath}">\r
+ <img src="<c:url value="/images/icons/delete.gif" />" alt="" width="16" height="16"/>\r
+ Delete\r
+ </ww:a>\r
+ </redback:ifAnyAuthorized>\r
+</div>\r
+\r
+<div style="float: left">\r
+ <img src="<c:url value="/images/archiva-splat-32.gif"/>" alt="" width="32" height="32"/>\r
+</div>\r
+\r
+<table class="infoTable">\r
+<tr>\r
+ <th>Path</th>\r
+ <td>\r
+ <code>${legacyArtifactPath.path}</code>\r
+ </td>\r
+</tr>\r
+<tr>\r
+ <th>Artifact</th>\r
+ <td>\r
+ <code>${legacyArtifactPath.artifact}</code>\r
+ </td>\r
+</tr>\r
+</table>\r
+\r
+</div>\r
+</c:forEach>\r
+\r
+</c:otherwise>\r
+</c:choose>\r
+\r
+\r
+\r
+</div>\r
+\r
+</div>\r
+\r
+</body>\r
+</html>\r
<li class="none">
<my:currentWWUrl action="proxyConnectors" namespace="/admin">Proxy Connectors</my:currentWWUrl>
</li>
+ <li class="none">
+ <my:currentWWUrl action="legacyArtifactPath" namespace="/admin">Legacy support</my:currentWWUrl>
+ </li>
<li class="none">
<my:currentWWUrl action="networkProxies" namespace="/admin">Network Proxies</my:currentWWUrl>
</li>