Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/ConfigureRepositoryScanningAction.java URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/ConfigureRepositoryScanningAction.java?view=auto&rev=536233 ============================================================================== --- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/ConfigureRepositoryScanningAction.java (added) +++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/ConfigureRepositoryScanningAction.java Tue May 8 09:05:18 2007 @@ -0,0 +1,62 @@ +package org.apache.maven.archiva.web.action.admin.scanning; + +/* + * 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.Preparable; + +import org.apache.maven.archiva.security.ArchivaRoleConstants; +import org.codehaus.plexus.security.rbac.Resource; +import org.codehaus.plexus.security.ui.web.interceptor.SecureAction; +import org.codehaus.plexus.security.ui.web.interceptor.SecureActionBundle; +import org.codehaus.plexus.security.ui.web.interceptor.SecureActionException; +import org.codehaus.plexus.xwork.action.PlexusActionSupport; + +/** + * ConfigureRepositoryScanningAction + * + * @author <a href="mailto:[EMAIL PROTECTED]">Joakim Erdfelt</a> + * @version $Id$ + * + * @plexus.component role="com.opensymphony.xwork.Action" role-hint="configureRepositoryScanningAction" + */ +public class ConfigureRepositoryScanningAction +extends PlexusActionSupport +implements SecureAction, Preparable +{ + + public SecureActionBundle getSecureActionBundle() + throws SecureActionException + { + SecureActionBundle bundle = new SecureActionBundle(); + + bundle.setRequiresAuthentication( true ); + bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION, Resource.GLOBAL ); + + return bundle; + } + + public void prepare() + throws Exception + { + // TODO Auto-generated method stub + + } + +}
Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/ConfigureRepositoryScanningAction.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/ConfigureRepositoryScanningAction.java ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/ConfigureRepositoryScanningAction.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/RepositoryScanningAction.java URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/RepositoryScanningAction.java?view=diff&rev=536233&r1=536232&r2=536233 ============================================================================== --- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/RepositoryScanningAction.java (original) +++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/RepositoryScanningAction.java Tue May 8 09:05:18 2007 @@ -19,17 +19,23 @@ * under the License. */ -import com.opensymphony.webwork.interceptor.ServletRequestAware; -import com.opensymphony.xwork.ModelDriven; import com.opensymphony.xwork.Preparable; import com.opensymphony.xwork.Validateable; +import org.apache.commons.collections.CollectionUtils; +import org.apache.maven.archiva.configuration.ArchivaConfiguration; +import org.apache.maven.archiva.configuration.Configuration; +import org.apache.maven.archiva.configuration.functors.FiletypeToMapClosure; +import org.apache.maven.archiva.security.ArchivaRoleConstants; +import org.codehaus.plexus.security.rbac.Resource; import org.codehaus.plexus.security.ui.web.interceptor.SecureAction; import org.codehaus.plexus.security.ui.web.interceptor.SecureActionBundle; import org.codehaus.plexus.security.ui.web.interceptor.SecureActionException; import org.codehaus.plexus.xwork.action.PlexusActionSupport; -import javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; /** * RepositoryScanningAction @@ -40,34 +46,74 @@ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="repositoryScanningAction" */ public class RepositoryScanningAction -extends PlexusActionSupport -implements ModelDriven, Preparable, Validateable, SecureAction, ServletRequestAware + extends PlexusActionSupport + implements Preparable, Validateable, SecureAction { + /** + * @plexus.requirement + */ + private ArchivaConfiguration archivaConfiguration; - public Object getModel() - { - // TODO Auto-generated method stub - return null; - } + private Map fileTypeMap; + + private List goodConsumers = new ArrayList(); + + private List badConsumers = new ArrayList(); public void prepare() throws Exception { - // TODO Auto-generated method stub - + Configuration config = archivaConfiguration.getConfiguration(); + FiletypeToMapClosure filetypeToMapClosure = new FiletypeToMapClosure(); + + CollectionUtils.forAllDo( config.getRepositoryScanning().getFileTypes(), filetypeToMapClosure ); + fileTypeMap = filetypeToMapClosure.getMap(); + + goodConsumers.clear(); + goodConsumers.addAll( config.getRepositoryScanning().getGoodConsumers() ); + + badConsumers.clear(); + badConsumers.addAll( config.getRepositoryScanning().getBadConsumers() ); } public SecureActionBundle getSecureActionBundle() throws SecureActionException { - // TODO Auto-generated method stub - return null; + SecureActionBundle bundle = new SecureActionBundle(); + + bundle.setRequiresAuthentication( true ); + bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION, Resource.GLOBAL ); + + return bundle; + } + + public List getBadConsumers() + { + return badConsumers; } - public void setServletRequest( HttpServletRequest request ) + public void setBadConsumers( List badConsumers ) { - // TODO Auto-generated method stub - + this.badConsumers = badConsumers; } + public Map getFileTypeMap() + { + return fileTypeMap; + } + + public void setFileTypeMap( Map fileTypeMap ) + { + this.fileTypeMap = fileTypeMap; + } + + public List getGoodConsumers() + { + return goodConsumers; + } + + public void setGoodConsumers( List goodConsumers ) + { + this.goodConsumers = goodConsumers; + } } Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml?view=diff&rev=536233&r1=536232&r2=536233 ============================================================================== --- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml (original) +++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml Tue May 8 09:05:18 2007 @@ -336,6 +336,30 @@ <result name="input">/WEB-INF/jsp/admin/repositoryScanning.jsp</result> </action> + <action name="addRepositoryScanning" class="configureScanningAction" method="add"> + <result name="input">/WEB-INF/jsp/admin/addRepositoryScanning.jsp</result> + <result name="success" type="redirect-action">repositoryScanning</result> + <interceptor-ref name="configuredPrepareParamsStack"/> + </action> + + <action name="editRepositoryScanning" class="configureScanningAction" method="edit"> + <result name="input">/WEB-INF/jsp/admin/editRepositoryScanning.jsp</result> + <result name="success" type="redirect-action">repositoryScanning</result> + <interceptor-ref name="configuredPrepareParamsStack"/> + </action> + + <action name="saveRepositoryScanning" class="configureScanningAction" method="save"> + <result name="input">/WEB-INF/jsp/admin/editRepositoryScanning.jsp</result> + <result name="success" type="redirect-action">repositoryScanning</result> + <interceptor-ref name="configuredPrepareParamsStack"/> + </action> + + <action name="deleteRepositoryScanning" class="configureScanningAction" method="confirm"> + <result name="input">/WEB-INF/jsp/admin/deleteRepositoryScanning.jsp</result> + <result name="success" type="redirect-action">repositoryScanning</result> + <interceptor-ref name="configuredPrepareParamsStack"/> + </action> + <!-- .\ DATABASE \.________________________________________________ --> <action name="database" class="databaseAction" method="input"> Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/repositoryScanning.jsp URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/repositoryScanning.jsp?view=auto&rev=536233 ============================================================================== --- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/repositoryScanning.jsp (added) +++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/repositoryScanning.jsp Tue May 8 09:05:18 2007 @@ -0,0 +1,159 @@ +<%-- + ~ 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="pss" uri="/plexusSecuritySystem" %> +<%@ taglib prefix="archiva" uri="http://maven.apache.org/archiva" %> + +<html> +<head> + <title>Administration - Repository Scanning</title> + <ww:head/> +</head> + +<body> + +<h1>Administration - Repository Scanning</h1> + +<div id="contentArea"> + +<ww:actionerror /> +<ww:actionmessage /> + +<div class="admin"> + <h2>Repository Scanning - File Types</h2> + +<c:choose> + <c:when test="${empty(fileTypeMap)}"> + <%-- No File Types. Eeek! --%> + <strong>There are no file types configured.</strong> + </c:when> + <c:otherwise> + <%-- Display the filetypes. --%> + + <c:forEach items="${fileTypeMap}" var="filetype" varStatus="i"> + <c:choose> + <c:when test='${(i.index)%2 eq 0}'> + <c:set var="rowColor" value="dark" scope="page" /> + </c:when> + <c:otherwise> + <c:set var="rowColor" value="lite" scope="page" /> + </c:otherwise> + </c:choose> + + <div class="filetype ${rowColor}"> + + <div class="controls"> + <%-- Does this even make sense for file types? --%> + </div> + + <h3 class="filetype">${filetype.key}</h3> + + <table> + <c:forEach items="${filetype.value.patterns}" var="pattern" varStatus="i"> + <tr> + <td> + <code>${pattern}</code> + </td> + <td> + <img src="<c:url value="/images/icons/delete.gif" />" /> + </td> + </tr> + </c:forEach> + </table> + + </div> + </c:forEach> + + </c:otherwise> +</c:choose> + + <h2>Repository Scanning - Consumers of Good Content</h2> + +<c:choose> + <c:when test="${empty(goodConsumers)}"> + <%-- No Good Consumers. Eeek! --%> + <strong>There are no good consumers configured.</strong> + </c:when> + <c:otherwise> + <%-- Display the consumers. --%> + + <table> + <c:forEach items="${goodConsumers}" var="consumer" varStatus="i"> + <c:choose> + <c:when test='${(i.index)%2 eq 0}'> + <c:set var="rowColor" value="dark" scope="page" /> + </c:when> + <c:otherwise> + <c:set var="rowColor" value="lite" scope="page" /> + </c:otherwise> + </c:choose> + + <tr> + <td><code>${consumer}</code></td> + <td> + <img src="<c:url value="/images/icons/delete.gif" />" /> + </td> + </tr> + </c:forEach> + </table> + + </c:otherwise> +</c:choose> + + + <h2>Repository Scanning - Consumers of Bad Content</h2> + +<c:choose> + <c:when test="${empty(badConsumers)}"> + <%-- No Bad Consumers. Eeek! --%> + <strong>There are no bad consumers configured.</strong> + </c:when> + <c:otherwise> + <%-- Display the consumers. --%> + + <table> + <c:forEach items="${badConsumers}" var="consumer" varStatus="i"> + <c:choose> + <c:when test='${(i.index)%2 eq 0}'> + <c:set var="rowColor" value="dark" scope="page" /> + </c:when> + <c:otherwise> + <c:set var="rowColor" value="lite" scope="page" /> + </c:otherwise> + </c:choose> + + <tr> + <td><code>${consumer}</code></td> + <td> + <img src="<c:url value="/images/icons/delete.gif" />" /> + </td> + </tr> + </c:forEach> + </table> + + </c:otherwise> +</c:choose> + + +</div> + +</body> +</html> Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/repositoryScanning.jsp ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/repositoryScanning.jsp ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision"