summaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-base/archiva-proxy/src
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2012-10-29 21:00:51 +0000
committerOlivier Lamy <olamy@apache.org>2012-10-29 21:00:51 +0000
commit6f95f668fcb8c766d83d0b5caa4a02d3e02d20a9 (patch)
tree01b4d1c7bc77ba18ba938fb1761fb5a7496dc2e0 /archiva-modules/archiva-base/archiva-proxy/src
parentc7b2d0af209c5515125571b715a7ca1190425e11 (diff)
downloadarchiva-6f95f668fcb8c766d83d0b5caa4a02d3e02d20a9.tar.gz
archiva-6f95f668fcb8c766d83d0b5caa4a02d3e02d20a9.zip
[MRM-1704] Refactor to remove maven specific part from various repository/metadata apis
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1403507 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-base/archiva-proxy/src')
-rw-r--r--archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java2
-rw-r--r--archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/ProxyConnector.java164
-rw-r--r--archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/ProxyConnectorOrderComparator.java2
-rw-r--r--archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/RepositoryProxyConnectors.java91
-rw-r--r--archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java1
-rw-r--r--archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java1
6 files changed, 6 insertions, 255 deletions
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java
index d9f1ea640..d31d7bea4 100644
--- a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java
+++ b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java
@@ -45,6 +45,8 @@ import org.apache.archiva.policies.urlcache.UrlFailureCache;
import org.apache.archiva.proxy.common.WagonFactory;
import org.apache.archiva.proxy.common.WagonFactoryException;
import org.apache.archiva.proxy.common.WagonFactoryRequest;
+import org.apache.archiva.proxy.model.ProxyConnector;
+import org.apache.archiva.proxy.model.RepositoryProxyConnectors;
import org.apache.archiva.redback.components.registry.Registry;
import org.apache.archiva.redback.components.registry.RegistryListener;
import org.apache.archiva.redback.components.taskqueue.TaskQueueException;
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/ProxyConnector.java b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/ProxyConnector.java
deleted file mode 100644
index 79ff9da45..000000000
--- a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/ProxyConnector.java
+++ /dev/null
@@ -1,164 +0,0 @@
-package org.apache.archiva.proxy;
-
-/*
- * 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.archiva.repository.ManagedRepositoryContent;
-import org.apache.archiva.repository.RemoteRepositoryContent;
-import org.apache.archiva.repository.connector.RepositoryConnector;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-/**
- * This represents a connector for a repository to repository proxy.
- */
-public class ProxyConnector
- implements RepositoryConnector
-{
- private ManagedRepositoryContent sourceRepository;
-
- private RemoteRepositoryContent targetRepository;
-
- private List<String> blacklist;
-
- private List<String> whitelist;
-
- private String proxyId;
-
- private int order;
-
- private Map<String, String> policies;
-
- private boolean disabled;
-
- public ProxyConnector()
- {
- // no op
- }
-
- public boolean isDisabled()
- {
- return disabled;
- }
-
- public void setDisabled( boolean disabled )
- {
- this.disabled = disabled;
- }
-
- public List<String> getBlacklist()
- {
- return blacklist;
- }
-
- public void setBlacklist( List<String> blacklist )
- {
- this.blacklist = blacklist;
- }
-
- public ManagedRepositoryContent getSourceRepository()
- {
- return sourceRepository;
- }
-
- public void setSourceRepository( ManagedRepositoryContent sourceRepository )
- {
- this.sourceRepository = sourceRepository;
- }
-
- public RemoteRepositoryContent getTargetRepository()
- {
- return targetRepository;
- }
-
- public void setTargetRepository( RemoteRepositoryContent targetRepository )
- {
- this.targetRepository = targetRepository;
- }
-
- public List<String> getWhitelist()
- {
- return whitelist;
- }
-
- public void setWhitelist( List<String> whitelist )
- {
- this.whitelist = whitelist;
- }
-
- public Map<String, String> getPolicies()
- {
- return policies;
- }
-
- public void setPolicies( Map<String, String> policies )
- {
- this.policies = policies;
- }
-
- public String getProxyId()
- {
- return proxyId;
- }
-
- public void setProxyId( String proxyId )
- {
- this.proxyId = proxyId;
- }
-
- @Override
- public String toString()
- {
- StringBuilder sb = new StringBuilder();
-
- sb.append( "ProxyConnector[\n" );
- sb.append( " source: [managed] " ).append( this.sourceRepository.getRepoRoot() ).append( "\n" );
- sb.append( " target: [remote] " ).append( this.targetRepository.getRepository().getUrl() ).append( "\n" );
- sb.append( " proxyId:" ).append( this.proxyId ).append( "\n" );
-
- Iterator<String> keys = this.policies.keySet().iterator();
- while ( keys.hasNext() )
- {
- String name = keys.next();
- sb.append( " policy[" ).append( name ).append( "]:" );
- sb.append( this.policies.get( name ) ).append( "\n" );
- }
-
- sb.append( "]" );
-
- return sb.toString();
- }
-
- public void setPolicy( String policyId, String policySetting )
- {
- this.policies.put( policyId, policySetting );
- }
-
- public int getOrder()
- {
- return order;
- }
-
- public void setOrder( int order )
- {
- this.order = order;
- }
-}
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/ProxyConnectorOrderComparator.java b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/ProxyConnectorOrderComparator.java
index 36f3b0bc5..de3b9c84c 100644
--- a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/ProxyConnectorOrderComparator.java
+++ b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/ProxyConnectorOrderComparator.java
@@ -19,6 +19,8 @@ package org.apache.archiva.proxy;
* under the License.
*/
+import org.apache.archiva.proxy.model.ProxyConnector;
+
import java.util.Comparator;
/**
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/RepositoryProxyConnectors.java b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/RepositoryProxyConnectors.java
deleted file mode 100644
index 144f48c31..000000000
--- a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/RepositoryProxyConnectors.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package org.apache.archiva.proxy;
-
-/*
- * 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.archiva.model.ArtifactReference;
-import org.apache.archiva.policies.ProxyDownloadException;
-import org.apache.archiva.repository.ManagedRepositoryContent;
-
-import java.io.File;
-import java.util.List;
-
-/**
- * Handler for potential repository proxy connectors.
- *
- *
- */
-public interface RepositoryProxyConnectors
-{
- /**
- * Performs the artifact fetch operation against the target repositories
- * of the provided source repository.
- *
- * If the artifact is found, it is downloaded and placed into the source repository
- * filesystem.
- *
- * @param repository the source repository to use. (must be a managed repository)
- * @param artifact the artifact to fetch.
- * @return the file that was obtained, or null if no content was obtained
- * @throws ProxyDownloadException if there was a problem fetching the content from the target repositories.
- */
- public File fetchFromProxies( ManagedRepositoryContent repository, ArtifactReference artifact )
- throws ProxyDownloadException;
-
- /**
- * Performs the metadata fetch operation against the target repositories
- * of the provided source repository.
- *
- * If the metadata is found, it is downloaded and placed into the source repository
- * filesystem.
- *
- * @param repository the source repository to use. (must be a managed repository)
- * @param metadata the metadata to fetch.
- * @return the file that was obtained, or null if no content was obtained
- */
- public File fetchMetatadaFromProxies( ManagedRepositoryContent repository, String logicalPath );
-
- /**
- * Performs the fetch operation against the target repositories
- * of the provided source repository.
- *
- * @param repository the source repository to use. (must be a managed repository)
- * @param path the path of the resource to fetch
- * @return the file that was obtained, or null if no content was obtained
- */
- public File fetchFromProxies( ManagedRepositoryContent managedRepository, String path );
-
- /**
- * Get the List of {@link ProxyConnector} objects of the source repository.
- *
- * @param repository the source repository to look for.
- * @return the List of {@link ProxyConnector} objects.
- */
- public List<ProxyConnector> getProxyConnectors( ManagedRepositoryContent repository );
-
- /**
- * Tests to see if the provided repository is a source repository for
- * any {@link ProxyConnector} objects.
- *
- * @param repository the source repository to look for.
- * @return true if there are proxy connectors that use the provided
- * repository as a source repository.
- */
- public boolean hasProxies( ManagedRepositoryContent repository );
-}
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java
index fb2ec922b..ddefd39ec 100644
--- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java
+++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java
@@ -34,6 +34,7 @@ import org.apache.archiva.policies.PropagateErrorsDownloadPolicy;
import org.apache.archiva.policies.PropagateErrorsOnUpdateDownloadPolicy;
import org.apache.archiva.policies.ReleasesPolicy;
import org.apache.archiva.policies.SnapshotsPolicy;
+import org.apache.archiva.proxy.model.RepositoryProxyConnectors;
import org.apache.archiva.repository.ManagedRepositoryContent;
import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
import org.apache.commons.io.FileUtils;
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java
index 4273bf3d3..b8647c6a3 100644
--- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java
+++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java
@@ -22,6 +22,7 @@ package org.apache.archiva.proxy;
import org.apache.archiva.admin.model.beans.ManagedRepository;
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin;
+import org.apache.archiva.proxy.model.RepositoryProxyConnectors;
import org.apache.commons.io.FileUtils;
import org.apache.archiva.configuration.ArchivaConfiguration;
import org.apache.archiva.configuration.NetworkProxyConfiguration;