archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdu...@apache.org
Subject svn commit: r686984 - in /archiva/branches/MRM-541/archiva-modules: archiva-base/archiva-configuration/src/main/mdo/ archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ archiva-base/archiva-repository-layer/src/main/java/org/apache...
Date Tue, 19 Aug 2008 08:45:49 GMT
Author: jdumay
Date: Tue Aug 19 01:45:45 2008
New Revision: 686984

URL: http://svn.apache.org/viewvc?rev=686984&view=rev
Log:
MRM-541 - convenient way to take Archiva proxies "offline"

* Implemented UI for enabling/disabling proxy connectors
* changes to RepositoryProxyConnectors to skip offline connectors


Added:
    archiva/branches/MRM-541/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/DisableProxyConnectorAction.java
    archiva/branches/MRM-541/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/EnableProxyConnectorAction.java
    archiva/branches/MRM-541/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/disableProxyConnector.jsp
    archiva/branches/MRM-541/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/enableProxyConnector.jsp
Modified:
    archiva/branches/MRM-541/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo
    archiva/branches/MRM-541/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java
    archiva/branches/MRM-541/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ProxyConnector.java
    archiva/branches/MRM-541/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/connector/RepositoryConnector.java
    archiva/branches/MRM-541/archiva-modules/archiva-web/archiva-webapp/src/main/resources/xwork.xml
    archiva/branches/MRM-541/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/proxyConnectors.jsp

Modified: archiva/branches/MRM-541/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-541/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo?rev=686984&r1=686983&r2=686984&view=diff
==============================================================================
--- archiva/branches/MRM-541/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo
(original)
+++ archiva/branches/MRM-541/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo
Tue Aug 19 01:45:45 2008
@@ -725,6 +725,15 @@
             <multiplicity>*</multiplicity>
           </association>
         </field>
+        <field>
+          <name>disabled</name>
+          <version>1.2+</version>
+          <description>
+            If the the repository proxy connector is disabled or not
+          </description>
+          <type>boolean</type>
+          <defaultValue>false</defaultValue>
+        </field>
       </fields>
       <codeSegments>
         <codeSegment>

Modified: archiva/branches/MRM-541/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-541/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java?rev=686984&r1=686983&r2=686984&view=diff
==============================================================================
--- archiva/branches/MRM-541/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java
(original)
+++ archiva/branches/MRM-541/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java
Tue Aug 19 01:45:45 2008
@@ -151,6 +151,11 @@
             Map<String, Exception> previousExceptions = new LinkedHashMap<String,
Exception>();
             for ( ProxyConnector connector : connectors )
             {
+                if (connector.isDisabled())
+                {
+                    continue;
+                }
+                
                 RemoteRepositoryContent targetRepository = connector.getTargetRepository();
                 requestProperties.setProperty( "remoteRepositoryId", targetRepository.getId()
);
 
@@ -221,6 +226,11 @@
             List<ProxyConnector> connectors = getProxyConnectors( repository );
             for ( ProxyConnector connector : connectors )
             {
+                if (connector.isDisabled())
+                {
+                    continue;
+                }
+                
                 RemoteRepositoryContent targetRepository = connector.getTargetRepository();
                 requestProperties.setProperty( "remoteRepositoryId", targetRepository.getId()
);
 
@@ -280,6 +290,11 @@
             List<ProxyConnector> connectors = getProxyConnectors( repository );
             for ( ProxyConnector connector : connectors )
             {
+                if (connector.isDisabled())
+                {
+                    continue;
+                }
+                
                 RemoteRepositoryContent targetRepository = connector.getTargetRepository();
 
                 File localRepoFile = toLocalRepoFile( repository, targetRepository, logicalPath
);

Modified: archiva/branches/MRM-541/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ProxyConnector.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-541/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ProxyConnector.java?rev=686984&r1=686983&r2=686984&view=diff
==============================================================================
--- archiva/branches/MRM-541/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ProxyConnector.java
(original)
+++ archiva/branches/MRM-541/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ProxyConnector.java
Tue Aug 19 01:45:45 2008
@@ -49,6 +49,18 @@
     private int order;
 
     private Map<String, String> policies;
+    
+    private boolean disabled;
+
+    public boolean isDisabled()
+    {
+        return disabled;
+    }
+
+    public void setDisabled(boolean disabled) 
+    {
+        this.disabled = disabled;
+    }
 
     public List<String> getBlacklist()
     {
@@ -110,6 +122,7 @@
         this.proxyId = proxyId;
     }
 
+    @Override
     public String toString()
     {
         StringBuffer sb = new StringBuffer();

Modified: archiva/branches/MRM-541/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/connector/RepositoryConnector.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-541/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/connector/RepositoryConnector.java?rev=686984&r1=686983&r2=686984&view=diff
==============================================================================
--- archiva/branches/MRM-541/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/connector/RepositoryConnector.java
(original)
+++ archiva/branches/MRM-541/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/connector/RepositoryConnector.java
Tue Aug 19 01:45:45 2008
@@ -39,4 +39,8 @@
     public List<String> getBlacklist();
     
     public List<String> getWhitelist();
+    
+    public boolean isDisabled();
+    
+    public void setDisabled(boolean disabled);
 }

Added: archiva/branches/MRM-541/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/DisableProxyConnectorAction.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-541/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/DisableProxyConnectorAction.java?rev=686984&view=auto
==============================================================================
--- archiva/branches/MRM-541/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/DisableProxyConnectorAction.java
(added)
+++ archiva/branches/MRM-541/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/DisableProxyConnectorAction.java
Tue Aug 19 01:45:45 2008
@@ -0,0 +1,98 @@
+package org.apache.maven.archiva.web.action.admin.connectors.proxy;
+
+import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
+
+/*
+ * 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.
+ */
+
+/**
+ * DisableProxyConnectorAction 
+ * 
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="disableProxyConnectorAction"
+ */
+public class DisableProxyConnectorAction extends AbstractProxyConnectorAction
+{
+    private String source;
+    
+    private String target;
+    
+    private ProxyConnectorConfiguration proxyConfig;
+    
+    public String confirmDisable()
+    {
+        this.proxyConfig = findProxyConnector( source, target );
+
+        // Not set? Then there is nothing to delete.
+        if ( this.proxyConfig == null )
+        {
+            addActionError( "Unable to disable proxy configuration, configuration with source
[" + source
+                + "], and target [" + target + "] does not exist." );
+            return ERROR;
+        }
+
+        return INPUT;
+    }
+    
+    public String disable()
+    {   
+        this.proxyConfig = findProxyConnector( source, target );
+
+        // Not set? Then there is nothing to delete.
+        if ( this.proxyConfig == null )
+        {
+            addActionError( "Unable to disable proxy configuration, configuration with source
[" + source
+                + "], and target [" + target + "] does not exist." );
+            return ERROR;
+        }
+
+        if ( hasActionErrors() )
+        {
+            return ERROR;
+        }
+        
+        proxyConfig.setDisabled(true);
+        
+        addActionMessage( "Successfully disabled proxy connector [" + source + " , " + target
+ " ]" );
+
+        setSource( null );
+        setTarget( null );
+        
+        return saveConfiguration();
+    }
+
+    public String getSource()
+    {
+        return source;
+    }
+
+    public void setSource(String source) 
+    {
+        this.source = source;
+    }
+
+    public String getTarget() 
+    {
+        return target;
+    }
+
+    public void setTarget(String target)
+    {
+        this.target = target;
+    }
+}

Added: archiva/branches/MRM-541/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/EnableProxyConnectorAction.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-541/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/EnableProxyConnectorAction.java?rev=686984&view=auto
==============================================================================
--- archiva/branches/MRM-541/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/EnableProxyConnectorAction.java
(added)
+++ archiva/branches/MRM-541/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/EnableProxyConnectorAction.java
Tue Aug 19 01:45:45 2008
@@ -0,0 +1,98 @@
+package org.apache.maven.archiva.web.action.admin.connectors.proxy;
+
+import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
+
+/*
+ * 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.
+ */
+
+/**
+ * EnableProxyConnectorAction 
+ * 
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="enableProxyConnectorAction"
+ */
+public class EnableProxyConnectorAction extends AbstractProxyConnectorAction
+{
+    private String source;
+    
+    private String target;
+    
+    private ProxyConnectorConfiguration proxyConfig;
+    
+    public String confirmEnable()
+    {
+        this.proxyConfig = findProxyConnector( source, target );
+
+        // Not set? Then there is nothing to delete.
+        if ( this.proxyConfig == null )
+        {
+            addActionError( "Unable to enable proxy configuration, configuration with source
[" + source
+                + "], and target [" + target + "] does not exist." );
+            return ERROR;
+        }
+
+        return INPUT;
+    }
+    
+    public String enable()
+    {
+        this.proxyConfig = findProxyConnector( source, target );
+
+        // Not set? Then there is nothing to delete.
+        if ( this.proxyConfig == null )
+        {
+            addActionError( "Unable to enabled proxy configuration, configuration with source
[" + source
+                + "], and target [" + target + "] does not exist." );
+            return ERROR;
+        }
+
+        if ( hasActionErrors() )
+        {
+            return ERROR;
+        }
+        
+        proxyConfig.setDisabled(true);
+        
+        addActionMessage( "Successfully enabled proxy connector [" + source + " , " + target
+ " ]" );
+
+        setSource( null );
+        setTarget( null );
+        
+        return saveConfiguration();
+    }
+
+    public String getSource()
+    {
+        return source;
+    }
+
+    public void setSource(String source) 
+    {
+        this.source = source;
+    }
+
+    public String getTarget() 
+    {
+        return target;
+    }
+
+    public void setTarget(String target)
+    {
+        this.target = target;
+    }
+}

Modified: archiva/branches/MRM-541/archiva-modules/archiva-web/archiva-webapp/src/main/resources/xwork.xml
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-541/archiva-modules/archiva-web/archiva-webapp/src/main/resources/xwork.xml?rev=686984&r1=686983&r2=686984&view=diff
==============================================================================
--- archiva/branches/MRM-541/archiva-modules/archiva-web/archiva-webapp/src/main/resources/xwork.xml
(original)
+++ archiva/branches/MRM-541/archiva-modules/archiva-web/archiva-webapp/src/main/resources/xwork.xml
Tue Aug 19 01:45:45 2008
@@ -377,6 +377,19 @@
       <result name="success" type="redirect-action">proxyConnectors</result>
       <interceptor-ref name="configuredPrepareParamsStack"/>
     </action>
+    
+    <action name="enableProxyConnector" class="enableProxyConnectorAction" method="confirm">
+      <result name="input">/WEB-INF/jsp/admin/enableProxyConnector.jsp</result>
+      <result name="success" type="redirect-action">proxyConnectors</result>
+      <interceptor-ref name="configuredPrepareParamsStack"/>
+    </action>
+
+    <action name="disableProxyConnector" class="disableProxyConnectorAction" method="confirm">
+      <result name="input">/WEB-INF/jsp/admin/disableProxyConnector.jsp</result>
+      <result name="success" type="redirect-action">proxyConnectors</result>
+      <interceptor-ref name="configuredPrepareParamsStack"/>
+    </action>
+
 
     <!-- .\ NETWORK PROXIES \._________________________________________ -->
 

Added: archiva/branches/MRM-541/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/disableProxyConnector.jsp
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-541/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/disableProxyConnector.jsp?rev=686984&view=auto
==============================================================================
--- archiva/branches/MRM-541/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/disableProxyConnector.jsp
(added)
+++ archiva/branches/MRM-541/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/disableProxyConnector.jsp
Tue Aug 19 01:45:45 2008
@@ -0,0 +1,50 @@
+<%--
+  ~ 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: Disable Proxy Connector</title>
+  <ww:head/>
+</head>
+
+<body>
+
+<h1>Admin: Disable Proxy Connector</h1>
+
+<ww:actionerror/>
+
+<div id="contentArea">
+
+  <h2>Disable Proxy Connector</h2>
+  
+  <p>
+    Are you sure you want to disable proxy connector <code>[ ${source} , ${target}
]</code> ?
+  </p>
+
+  <ww:form method="post" action="disableProxyConnector!disable" namespace="/admin" validate="true">
+    <ww:hidden name="target"/>
+    <ww:hidden name="source"/>
+    <ww:submit value="Disable"/>
+  </ww:form>
+</div>
+
+</body>
+</html>
\ No newline at end of file

Added: archiva/branches/MRM-541/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/enableProxyConnector.jsp
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-541/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/enableProxyConnector.jsp?rev=686984&view=auto
==============================================================================
--- archiva/branches/MRM-541/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/enableProxyConnector.jsp
(added)
+++ archiva/branches/MRM-541/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/enableProxyConnector.jsp
Tue Aug 19 01:45:45 2008
@@ -0,0 +1,50 @@
+<%--
+  ~ 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: Enable Proxy Connector</title>
+  <ww:head/>
+</head>
+
+<body>
+
+<h1>Admin: Enable Proxy Connector</h1>
+
+<ww:actionerror/>
+
+<div id="contentArea">
+
+  <h2>Enable Proxy Connector</h2>
+
+  <p>
+    Are you sure you want to enable proxy connector <code>[ ${source} , ${target} ]</code>
?
+  </p>
+
+  <ww:form method="post" action="enableProxyConnector!enable" namespace="/admin" validate="true">
+    <ww:hidden name="target"/>
+    <ww:hidden name="source"/>
+    <ww:submit value="Enable"/>
+  </ww:form>
+</div>
+
+</body>
+</html>
\ No newline at end of file

Modified: archiva/branches/MRM-541/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/proxyConnectors.jsp
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-541/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/proxyConnectors.jsp?rev=686984&r1=686983&r2=686984&view=diff
==============================================================================
--- archiva/branches/MRM-541/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/proxyConnectors.jsp
(original)
+++ archiva/branches/MRM-541/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/proxyConnectors.jsp
Tue Aug 19 01:45:45 2008
@@ -105,6 +105,24 @@
           <ww:param name="source" value="%{'${connector.sourceRepoId}'}"/>
           <ww:param name="target" value="%{'${connector.targetRepoId}'}"/>
         </ww:url>
+        <ww:url id="enableProxyConnectorUrl" action="enableProxyConnector" method="confirmEnable">
+          <ww:param name="source" value="%{'${connector.sourceRepoId}'}"/>
+          <ww:param name="target" value="%{'${connector.targetRepoId}'}"/>
+        </ww:url>
+        <ww:url id="disableProxyConnectorUrl" action="disableProxyConnector" method="confirmDisable">
+          <ww:param name="source" value="%{'${connector.sourceRepoId}'}"/>
+          <ww:param name="target" value="%{'${connector.targetRepoId}'}"/>
+        </ww:url>
+        <c:if test="${connector.disabled}">
+            <ww:a href="%{enableProxyConnectorUrl}" label="Enable Proxy Connector">
+                Enable
+            </ww:a>
+        </c:if>
+        <c:if test="${connector.disabled == false}">
+            <ww:a href="%{disableProxyConnectorUrl}" title="Disable Proxy Connector">
+                Disable
+            </ww:a>
+        </c:if>
         <c:if test="${pc.count > 1}">
           <ww:a href="%{sortUpProxyConnectorUrl}" cssClass="up" title="Move Proxy Connector
Up">
             <img src="${iconUpUrl}"/>



Mime
View raw message