]> source.dussan.org Git - archiva.git/commitdiff
Adding Network Proxy admin screens.
authorJoakim Erdfelt <joakime@apache.org>
Mon, 7 May 2007 21:30:38 +0000 (21:30 +0000)
committerJoakim Erdfelt <joakime@apache.org>
Mon, 7 May 2007 21:30:38 +0000 (21:30 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@535999 13f79535-47bb-0310-9956-ffa450edef68

14 files changed:
archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/NetworkProxyComparator.java [new file with mode: 0644]
archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/NetworkProxySelectionPredicate.java [new file with mode: 0644]
archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ConfigureProxyConnectorAction.java
archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyAction.java [new file with mode: 0644]
archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/NetworkProxiesAction.java
archiva-web/archiva-webapp/src/main/resources/xwork.xml
archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addNetworkProxy.jsp [new file with mode: 0644]
archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/deleteNetworkProxy.jsp [new file with mode: 0644]
archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/deleteRepository.jsp
archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editNetworkProxy.jsp [new file with mode: 0644]
archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/include/networkProxyForm.jspf [new file with mode: 0644]
archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/networkProxies.jsp [new file with mode: 0644]
archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/repositories.jsp
archiva-web/archiva-webapp/src/main/webapp/css/site.css

diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/NetworkProxyComparator.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/NetworkProxyComparator.java
new file mode 100644 (file)
index 0000000..6acd20f
--- /dev/null
@@ -0,0 +1,62 @@
+package org.apache.maven.archiva.configuration.util;
+
+/*
+ * 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 org.apache.maven.archiva.configuration.NetworkProxyConfiguration;
+
+import java.util.Comparator;
+
+/**
+ * NetworkProxyComparator 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class NetworkProxyComparator
+    implements Comparator
+{
+
+    public int compare( Object o1, Object o2 )
+    {
+        if ( o1 == null && o2 == null )
+        {
+            return 0;
+        }
+
+        if ( o1 == null && o2 != null )
+        {
+            return 1;
+        }
+
+        if ( o1 != null && o2 == null )
+        {
+            return -1;
+        }
+
+        if ( ( o1 instanceof NetworkProxyConfiguration ) && ( o2 instanceof NetworkProxyConfiguration ) )
+        {
+            String id1 = ( (NetworkProxyConfiguration) o1 ).getId();
+            String id2 = ( (NetworkProxyConfiguration) o2 ).getId();
+            return id1.compareToIgnoreCase( id2 );
+        }
+
+        return 0;
+    }
+}
diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/NetworkProxySelectionPredicate.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/NetworkProxySelectionPredicate.java
new file mode 100644 (file)
index 0000000..c216308
--- /dev/null
@@ -0,0 +1,54 @@
+package org.apache.maven.archiva.configuration.util;
+
+/*
+ * 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 org.apache.commons.collections.Predicate;
+import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.configuration.NetworkProxyConfiguration;
+
+/**
+ * NetworkProxySelectionPredicate 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class NetworkProxySelectionPredicate
+    implements Predicate
+{
+    private String proxyId;
+
+    public NetworkProxySelectionPredicate( String id )
+    {
+        this.proxyId = id;
+    }
+
+    public boolean evaluate( Object object )
+    {
+        boolean satisfies = false;
+
+        if ( object instanceof NetworkProxyConfiguration )
+        {
+            NetworkProxyConfiguration proxy = (NetworkProxyConfiguration) object;
+            return ( StringUtils.equals( proxyId, proxy.getId() ) );
+        }
+
+        return satisfies;
+    }
+}
index cca665ae5e66df6eae5f092a18116e070707673a..8b416bc9cae50ca370881524f58801183b879896 100644 (file)
@@ -20,6 +20,7 @@ package org.apache.maven.archiva.web.action.admin.connectors.proxy;
  */
 
 import com.opensymphony.xwork.Preparable;
+import com.opensymphony.xwork.Validateable;
 
 import org.apache.commons.collections.Closure;
 import org.apache.commons.collections.CollectionUtils;
@@ -63,7 +64,7 @@ import java.util.Map.Entry;
  */
 public class ConfigureProxyConnectorAction
     extends PlexusActionSupport
-    implements SecureAction, Preparable, Initializable
+    implements SecureAction, Preparable, Validateable, Initializable
 {
     private static final String DIRECT_CONNECTION = "(direct connection)";
 
@@ -128,26 +129,22 @@ public class ConfigureProxyConnectorAction
 
     public String add()
     {
-        getLogger().info( ".add()" );
         this.mode = "add";
         return INPUT;
     }
 
     public String confirm()
     {
-        getLogger().info( ".confirm()" );
         return INPUT;
     }
 
     public String delete()
     {
-        getLogger().info( ".delete()" );
         return INPUT;
     }
 
     public String addProperty()
     {
-        getLogger().info( ".addProperty()" );
         String key = getPropertyKey();
         String value = getPropertyValue();
 
@@ -173,7 +170,6 @@ public class ConfigureProxyConnectorAction
 
     public String removeProperty()
     {
-        getLogger().info( ".removeProperty()" );
         String key = getPropertyKey();
 
         if ( StringUtils.isBlank( key ) )
@@ -193,7 +189,6 @@ public class ConfigureProxyConnectorAction
 
     public String addWhiteListPattern()
     {
-        getLogger().info( ".addWhiteListPattern()" );
         String pattern = getWhiteListPattern();
 
         if ( StringUtils.isBlank( pattern ) )
@@ -203,10 +198,6 @@ public class ConfigureProxyConnectorAction
 
         if ( !hasActionErrors() )
         {
-            getLogger().info(
-                              "whitelist patterns: (" + getConnector().getWhiteListPatterns().size() + "): "
-                                  + getConnector().getWhiteListPatterns() );
-
             getConnector().getWhiteListPatterns().add( pattern );
             setWhiteListPattern( null );
         }
@@ -217,7 +208,6 @@ public class ConfigureProxyConnectorAction
     public String removeWhiteListPattern()
     {
         String pattern = getPattern();
-        getLogger().info( ".removeWhiteListPattern(" + pattern + ")" );
 
         if ( StringUtils.isBlank( pattern ) )
         {
@@ -235,7 +225,6 @@ public class ConfigureProxyConnectorAction
 
     public String addBlackListPattern()
     {
-        getLogger().info( ".addBlackListPattern()" );
         String pattern = getBlackListPattern();
 
         if ( StringUtils.isBlank( pattern ) )
@@ -254,7 +243,6 @@ public class ConfigureProxyConnectorAction
 
     public String removeBlackListPattern()
     {
-        getLogger().info( ".removeBlackListPattern()" );
         String pattern = getBlackListPattern();
 
         if ( StringUtils.isBlank( pattern ) )
@@ -273,7 +261,6 @@ public class ConfigureProxyConnectorAction
 
     public String edit()
     {
-        getLogger().info( ".edit()" );
         this.mode = "edit";
         return INPUT;
     }
@@ -359,7 +346,6 @@ public class ConfigureProxyConnectorAction
 
     public String input()
     {
-        getLogger().info( "input()" );
         return INPUT;
     }
 
@@ -369,13 +355,10 @@ public class ConfigureProxyConnectorAction
         String sourceId = getSource();
         String targetId = getTarget();
 
-        getLogger().info( ".prepare() - sourceId [" + sourceId + "], targetId [" + targetId + "]" );
-
         if ( StringUtils.isBlank( sourceId ) || StringUtils.isBlank( targetId ) )
         {
             if ( this.connector == null )
             {
-                getLogger().info( "Creating new connector." );
                 this.connector = new ProxyConnectorConfiguration();
             }
         }
@@ -383,7 +366,6 @@ public class ConfigureProxyConnectorAction
         {
             this.connector = findProxyConnector( sourceId, targetId );
         }
-        getLogger().info( "Connector: " + connector );
 
         Configuration config = archivaConfiguration.getConfiguration();
 
@@ -426,13 +408,6 @@ public class ConfigureProxyConnectorAction
         String sourceId = getConnector().getSourceRepoId();
         String targetId = getConnector().getTargetRepoId();
 
-        getLogger().info( ".save(" + mode + ":" + sourceId + "->" + targetId + ")" );
-
-        if ( !isValid( getConnector() ) )
-        {
-            return INPUT;
-        }
-
         if ( StringUtils.equalsIgnoreCase( "edit", mode ) )
         {
             removeConnector( sourceId, targetId );
@@ -527,13 +502,14 @@ public class ConfigureProxyConnectorAction
         ProxyConnectorSelectionPredicate selectedProxy = new ProxyConnectorSelectionPredicate( sourceId, targetId );
         return (ProxyConnectorConfiguration) CollectionUtils.find( config.getProxyConnectors(), selectedProxy );
     }
-
-    private boolean isValid( ProxyConnectorConfiguration proxyConnector )
+    
+    public void validate()
     {
+        ProxyConnectorConfiguration proxyConnector = getConnector();
+        
         if ( proxyConnector.getPolicies() == null )
         {
             addActionError( "Policies must be set." );
-            return false;
         }
 
         Iterator it = policyMap.entrySet().iterator();
@@ -568,13 +544,6 @@ public class ConfigureProxyConnectorAction
                 continue;
             }
         }
-
-        if ( hasActionErrors() || hasActionMessages() )
-        {
-            return false;
-        }
-
-        return true;
     }
 
     private void removeConnector( String sourceId, String targetId )
diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyAction.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyAction.java
new file mode 100644 (file)
index 0000000..5da2144
--- /dev/null
@@ -0,0 +1,211 @@
+package org.apache.maven.archiva.web.action.admin.networkproxies;
+
+/*
+ * 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.commons.collections.CollectionUtils;
+import org.apache.commons.collections.functors.NotPredicate;
+import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.InvalidConfigurationException;
+import org.apache.maven.archiva.configuration.NetworkProxyConfiguration;
+import org.apache.maven.archiva.configuration.util.NetworkProxySelectionPredicate;
+import org.apache.maven.archiva.security.ArchivaRoleConstants;
+import org.codehaus.plexus.registry.RegistryException;
+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 java.io.IOException;
+
+/**
+ * ConfigureNetworkProxyAction 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ * 
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="configureNetworkProxyAction"
+ */
+public class ConfigureNetworkProxyAction
+    extends PlexusActionSupport
+    implements SecureAction, Preparable
+{
+    /**
+     * @plexus.requirement
+     */
+    private ArchivaConfiguration archivaConfiguration;
+
+    private String mode;
+
+    private String proxyid;
+
+    private NetworkProxyConfiguration proxy;
+
+    public String add()
+    {
+        this.mode = "add";
+        return INPUT;
+    }
+
+    public String confirm()
+    {
+        return INPUT;
+    }
+
+    public String delete()
+    {
+        return INPUT;
+    }
+
+    public String edit()
+    {
+        this.mode = "edit";
+        return INPUT;
+    }
+
+    public String getMode()
+    {
+        return mode;
+    }
+
+    public NetworkProxyConfiguration getProxy()
+    {
+        return proxy;
+    }
+    
+    public String getProxyid()
+    {
+        return proxyid;
+    }
+
+    public SecureActionBundle getSecureActionBundle()
+        throws SecureActionException
+    {
+        SecureActionBundle bundle = new SecureActionBundle();
+
+        bundle.setRequiresAuthentication( true );
+        bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION, Resource.GLOBAL );
+
+        return bundle;
+    }
+
+    public String input()
+    {
+        return INPUT;
+    }
+
+    public void prepare()
+        throws Exception
+    {
+        String id = getProxyid();
+
+        if ( StringUtils.isNotBlank( id ) )
+        {
+            proxy = findNetworkProxy( id );
+        }
+
+        if ( proxy == null )
+        {
+            proxy = new NetworkProxyConfiguration();
+        }
+    }
+
+    public String save()
+    {
+        String mode = getMode();
+
+        String id = getProxy().getId();
+
+        if ( StringUtils.equalsIgnoreCase( "edit", mode ) )
+        {
+            removeNetworkProxy( id );
+        }
+
+        try
+        {
+            addNetworkProxy( getProxy() );
+            saveConfiguration();
+        }
+        catch ( IOException e )
+        {
+            addActionError( "I/O Exception: " + e.getMessage() );
+        }
+        catch ( InvalidConfigurationException e )
+        {
+            addActionError( "Invalid Configuration Exception: " + e.getMessage() );
+        }
+        catch ( RegistryException e )
+        {
+            addActionError( "Configuration Registry Exception: " + e.getMessage() );
+        }
+
+        return SUCCESS;
+    }
+
+    public void setMode( String mode )
+    {
+        this.mode = mode;
+    }
+
+    public void setProxy( NetworkProxyConfiguration proxy )
+    {
+        this.proxy = proxy;
+    }
+
+    public void setProxyid( String proxyid )
+    {
+        this.proxyid = proxyid;
+    }
+
+    private void addNetworkProxy( NetworkProxyConfiguration proxy )
+    {
+        archivaConfiguration.getConfiguration().addNetworkProxy( proxy );
+    }
+
+    private NetworkProxyConfiguration findNetworkProxy( String id )
+    {
+        Configuration config = archivaConfiguration.getConfiguration();
+
+        NetworkProxySelectionPredicate selectedProxy = new NetworkProxySelectionPredicate( id );
+
+        return (NetworkProxyConfiguration) CollectionUtils.find( config.getNetworkProxies(), selectedProxy );
+    }
+
+    private void removeNetworkProxy( String id )
+    {
+        NetworkProxySelectionPredicate selectedProxy = new NetworkProxySelectionPredicate( id );
+        NotPredicate notSelectedProxy = new NotPredicate( selectedProxy );
+        CollectionUtils.filter( archivaConfiguration.getConfiguration().getNetworkProxies(), notSelectedProxy );
+    }
+
+    private String saveConfiguration()
+        throws IOException, InvalidConfigurationException, RegistryException
+    {
+        archivaConfiguration.save( archivaConfiguration.getConfiguration() );
+
+        addActionMessage( "Successfully saved configuration" );
+
+        return SUCCESS;
+    }
+}
index 160a93cca0d65afe9366b38d1f13fcb79e1cbe46..84d8974a0dc58b1d688f8ba9ec31421d280a6e0f 100644 (file)
@@ -19,17 +19,17 @@ package org.apache.maven.archiva.web.action.admin.networkproxies;
  * 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.maven.archiva.configuration.ArchivaConfiguration;
+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.List;
 
 /**
  * NetworkProxiesAction 
@@ -40,34 +40,40 @@ import javax.servlet.http.HttpServletRequest;
  * @plexus.component role="com.opensymphony.xwork.Action" role-hint="networkProxiesAction"
  */
 public class NetworkProxiesAction
-extends PlexusActionSupport
-implements ModelDriven, Preparable, Validateable, SecureAction, ServletRequestAware
+    extends PlexusActionSupport
+    implements Preparable, SecureAction
 {
+    /**
+     * @plexus.requirement
+     */
+    private ArchivaConfiguration configuration;
 
-    public Object getModel()
-    {
-        // TODO Auto-generated method stub
-        return null;
-    }
+    private List networkProxies;
 
     public void prepare()
         throws Exception
     {
-        // TODO Auto-generated method stub
-        
+        networkProxies = configuration.getConfiguration().getNetworkProxies();
     }
 
     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 void setServletRequest( HttpServletRequest request )
+    public List getNetworkProxies()
     {
-        // TODO Auto-generated method stub
-        
+        return networkProxies;
     }
 
+    public void setNetworkProxies( List networkProxies )
+    {
+        this.networkProxies = networkProxies;
+    }
 }
index 7bd0cd23b5356ef36edabc0ad067edb41316503c..a60c3c42333f7c8f2b6307fb978557907d5623ad 100644 (file)
       <result name="input">/WEB-INF/jsp/admin/networkProxies.jsp</result>
     </action>
     
+    <action name="addNetworkProxy" class="configureNetworkProxyAction" method="add">
+      <result name="input">/WEB-INF/jsp/admin/addNetworkProxy.jsp</result>
+      <result name="success" type="redirect-action">networkProxies</result>
+      <interceptor-ref name="configuredPrepareParamsStack"/>
+    </action>
+    
+    <action name="editNetworkProxy" class="configureNetworkProxyAction" method="edit">
+      <result name="input">/WEB-INF/jsp/admin/editNetworkProxy.jsp</result>
+      <result name="success" type="redirect-action">networkProxies</result>
+      <interceptor-ref name="configuredPrepareParamsStack"/>
+    </action>
+    
+    <action name="saveNetworkProxy" class="configureNetworkProxyAction" method="save">
+      <result name="input">/WEB-INF/jsp/admin/editNetworkProxy.jsp</result>
+      <result name="success" type="redirect-action">networkProxies</result>
+      <interceptor-ref name="configuredPrepareParamsStack"/>
+    </action>
+    
+    <action name="deleteNetworkProxy" class="configureNetworkProxyAction" method="confirm">
+      <result name="input">/WEB-INF/jsp/admin/deleteNetworkProxy.jsp</result>
+      <result name="success" type="redirect-action">networkProxies</result>
+      <interceptor-ref name="configuredPrepareParamsStack"/>
+    </action>
+    
     <!-- .\ REPOSITORY SCANNING \._____________________________________ -->
     
     <action name="repositoryScanning" class="repositoryScanningAction" method="input">
diff --git a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addNetworkProxy.jsp b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addNetworkProxy.jsp
new file mode 100644 (file)
index 0000000..7561af3
--- /dev/null
@@ -0,0 +1,51 @@
+<%--
+  ~ 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" %>
+
+<html>
+<head>
+  <title>Admin: Add Network Proxy</title>
+  <ww:head/>
+</head>
+
+<body>
+
+<h1>Admin: Add Network Proxy</h1>
+
+<div id="contentArea">
+
+  <h2>Add Network Proxy</h2>
+
+  <ww:actionmessage/>
+  <ww:form method="post" action="saveNetworkProxy" namespace="/admin" validate="true">
+    <ww:hidden name="mode" value="add"/>
+    <ww:textfield name="proxy.id" label="Identifier" size="10" required="true"/>
+    <%@ include file="/WEB-INF/jsp/admin/include/networkProxyForm.jspf" %>
+    <ww:submit value="Add Network Proxy"/>
+  </ww:form>
+
+  <script type="text/javascript">
+    document.getElementById("saveNetworkProxy_id").focus();
+  </script>
+
+</div>
+
+</body>
+</html>
diff --git a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/deleteNetworkProxy.jsp b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/deleteNetworkProxy.jsp
new file mode 100644 (file)
index 0000000..584a99c
--- /dev/null
@@ -0,0 +1,51 @@
+<%--
+  ~ 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" %>
+
+<html>
+<head>
+  <title>Admin: Delete Network Proxy</title>
+  <ww:head/>
+</head>
+
+<body>
+
+<h1>Admin: Delete Network Proxy</h1>
+
+<div id="contentArea">
+
+  <h2>Delete Network Proxy</h2>
+
+  <blockquote>
+    <strong><span class="statusFailed">WARNING:</span> This operation can not be undone.</strong>
+  </blockquote>
+  
+  <p>
+  Are you sure you want to delete network proxy ${proxyid} ?
+  </p>
+
+  <ww:form method="post" action="deleteNetworkProxy!delete" namespace="/admin" validate="true">
+    <ww:hidden name="proxyid"/>
+    <ww:submit value="Delete"/>
+  </ww:form>
+</div>
+
+</body>
+</html>
\ No newline at end of file
index 379b178b33c01caa7a6ae476baa79bc11f4e8f4a..c028c1dd35837d3b00ba6cc05f6f13ad6c9ba5e1 100644 (file)
 
 <html>
 <head>
-  <title>Configuration</title>
+  <title>Admin: Delete Repository</title>
   <ww:head/>
 </head>
 
 <body>
 
-<h1>Configuration</h1>
+<h1>Admin: Delete Repository</h1>
 
 <div id="contentArea">
 
-  <h2>Delete Managed Repository</h2>
+  <h2>Delete Repository</h2>
 
   <blockquote>
     <strong><span class="statusFailed">WARNING:</span> This operation can not be undone.</strong>
diff --git a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editNetworkProxy.jsp b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editNetworkProxy.jsp
new file mode 100644 (file)
index 0000000..73da77a
--- /dev/null
@@ -0,0 +1,51 @@
+<%--
+  ~ 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" %>
+
+<html>
+<head>
+  <title>Admin: Edit Network Proxy</title>
+  <ww:head/>
+</head>
+
+<body>
+
+<h1>Admin: Network Proxy</h1>
+
+<div id="contentArea">
+
+  <h2>Edit Network Proxy</h2>
+
+  <ww:actionmessage/>
+  <ww:form method="post" action="saveNetworkProxy" namespace="/admin" validate="false">
+    <ww:hidden name="mode" value="edit"/>  
+    <ww:hidden name="proxy.id"/>
+    <%@ include file="/WEB-INF/jsp/admin/include/networkProxyForm.jspf" %>
+    <ww:submit value="Save Network Proxy"/>
+  </ww:form>
+
+  <script type="text/javascript">
+    document.getElementById("saveNetworkProxy_host").focus();
+  </script>
+
+</div>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/include/networkProxyForm.jspf b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/include/networkProxyForm.jspf
new file mode 100644 (file)
index 0000000..935c4b1
--- /dev/null
@@ -0,0 +1,26 @@
+<%--
+  ~ 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" %>
+
+<ww:textfield name="proxy.protocol" label="Protocol" size="5" required="true"/>
+<ww:textfield name="proxy.host" label="Hostname" size="50" required="true"/>  
+<ww:textfield name="proxy.port" label="Port" size="5" required="true" />
+<ww:textfield name="proxy.username" label="Username" size="25" required="false" />
+<ww:password name="proxy.password" label="Password" size="25" required="false" />
diff --git a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/networkProxies.jsp b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/networkProxies.jsp
new file mode 100644 (file)
index 0000000..96b59b3
--- /dev/null
@@ -0,0 +1,128 @@
+<%--
+  ~ 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 - Network Proxies</title>
+<ww:head />
+</head>
+
+<body>
+
+<h1>Administration - Network Proxies</h1>
+
+<div id="contentArea">
+
+<ww:actionerror /> <ww:actionmessage />
+
+<div class="admin">
+<div class="controls">
+<pss:ifAuthorized
+  permission="archiva-manage-configuration">
+  <ww:url id="addNetworkProxyUrl" action="addNetworkProxy" />
+  <ww:a href="%{addNetworkProxyUrl}">
+    <img src="<c:url value="/images/icons/create.png" />" />
+        Add Network Proxy</ww:a>
+</pss:ifAuthorized></div>
+<h2>Network Proxies</h2>
+
+<c:choose>
+  <c:when test="${empty(networkProxies)}">
+    <%-- No Local Repositories. --%>
+    <strong>There are no network proxies configured yet.</strong>
+  </c:when>
+  <c:otherwise>
+    <%-- Display the repositories. --%>
+
+    <c:forEach items="${networkProxies}" var="proxy" 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="netproxy ${rowColor}">
+
+      <div class="controls">
+      <pss:ifAnyAuthorized
+        permissions="archiva-manage-configuration">
+        <ww:url id="editNetworkProxyUrl" action="editNetworkProxy">
+          <ww:param name="proxyid" value="%{'${proxy.id}'}" />
+        </ww:url>
+        <ww:url id="deleteNetworkProxyUrl" action="deleteNetworkProxy" method="confirm">
+          <ww:param name="proxyid" value="%{'${proxy.id}'}" />
+        </ww:url>
+        <ww:a href="%{editNetworkProxyUrl}">
+          <img src="<c:url value="/images/icons/edit.png" />" />
+            Edit Network Proxy</ww:a>
+        <ww:a href="%{deleteNetworkProxyUrl}">
+          <img src="<c:url value="/images/icons/delete.gif" />" />
+            Delete Network Proxy</ww:a>
+      </pss:ifAnyAuthorized></div>
+
+      <table class="infoTable">
+        <tr>
+          <th>Identifier</th>
+          <td><code>${proxy.id}</code></td>
+        </tr>
+        <tr>
+          <th>Protocol</th>
+          <td>${proxy.protocol}</td>
+        </tr>
+        <tr>
+          <th>Host</th>
+          <td>${proxy.host}</td>
+        </tr>
+        <tr>
+          <th>Port</th>
+          <td>${proxy.port}</td>
+        </tr>
+        <c:if test="${not empty(proxy.username)}">
+          <tr>
+            <th>Username</th>
+            <td>${proxy.username}</td>
+          </tr>
+          <c:if test="${not empty(proxy.password)}">
+            <tr>
+              <th>Password</th>
+              <td>&#8226;&#8226;&#8226;&#8226;&#8226;&#8226;&#8226;&#8226;</td>
+            </tr>
+          </c:if>
+        </c:if>
+      </table>
+
+      </div>
+    </c:forEach>
+
+  </c:otherwise>
+</c:choose>
+</div>
+
+</div>
+
+</body>
+</html>
index 9c00884d280e991f43483b54f3cf0eaf39f7adf1..e977bc7d6cf45024781d8199043d1e927df7e3da 100644 (file)
 <ww:actionerror />
 <ww:actionmessage />
 
-  <div>
-    <div style="float: right">
-      <%-- TODO replace with icons --%>
-      <pss:ifAuthorized permission="archiva-manage-configuration">
-        <ww:url id="addRepositoryUrl" action="addRepository"/>
-        <ww:a href="%{addRepositoryUrl}">
-        <img src="<c:url value="/images/icons/create.png" />" />
-        Add Repository</ww:a>
-      </pss:ifAuthorized>
-    </div>
-    <h2>Local Repositories</h2>
+<div class="admin">
+  <div class="controls">
+    <pss:ifAuthorized permission="archiva-manage-configuration">
+      <ww:url id="addRepositoryUrl" action="addRepository"/>
+      <ww:a href="%{addRepositoryUrl}">
+      <img src="<c:url value="/images/icons/create.png" />" />
+      Add Repository</ww:a>
+    </pss:ifAuthorized>
   </div>
+  <h2>Local Repositories</h2>
 
 <c:choose>
   <c:when test="${empty(managedRepositories)}">
     <%-- Display the repositories. --%>
     
        <c:forEach items="${managedRepositories}" var="repository" 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="repository">
+      <div class="repository ${rowColor}">
 
-        <div style="float: right">
+        <div class="controls">
           <%-- TODO: make some icons --%>
           <pss:ifAnyAuthorized permissions="archiva-manage-configuration">
             <ww:url id="editRepositoryUrl" action="editRepository">
     <%-- Display the repositories. --%>
     
     <c:forEach items="${remoteRepositories}" var="repository" varStatus="i">
-      <div class="repository">
+      <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="repository ${rowColor}">
 
-        <div style="float: right">
+        <div class="controls">
           <%-- TODO: make some icons --%>
           <pss:ifAnyAuthorized permissions="archiva-manage-configuration">
             <ww:url id="editRepositoryUrl" action="editRepository">
index fcdd9fc844ca2bc59c4d37919310d4938177a4a1..5091385f185f85441afa0c3108da4f546ef9a519 100644 (file)
@@ -284,4 +284,27 @@ tr.proxyConnector td.connector table p {
 
 tr.seperator td {
        border-top: 1px dashed #dddddd !important;
+}
+
+div.admin div.dark,
+div.admin div.lite {
+       border: 1px solid #aaaaaa;      
+       font-size: 11pt;
+       margin-left: 15px;
+       margin-right: 15px;
+       margin-bottom: 5px;
+       padding: 5px;
+}
+
+div.admin div.lite {
+       background-color: white;
+}
+
+div.admin div.dark {
+       background-color: #eeeeee;
+}
+
+div.admin div.controls {
+       float: right;
+       font-size: 8pt !important;
 }
\ No newline at end of file