diff options
author | Martin Stockhammer <martin_s@apache.org> | 2019-09-03 14:40:22 +0200 |
---|---|---|
committer | Martin Stockhammer <martin_s@apache.org> | 2019-09-03 14:40:22 +0200 |
commit | ebf95723a5399535ff8175121625e933d99a27c0 (patch) | |
tree | 044ba96be2dd0343e577eaeb740f773f711af113 /archiva-modules/archiva-base/archiva-proxy | |
parent | c7fb08d2cb8b8fac9e36707e03369c5e83def7a6 (diff) | |
download | archiva-ebf95723a5399535ff8175121625e933d99a27c0.tar.gz archiva-ebf95723a5399535ff8175121625e933d99a27c0.zip |
Modifying NetworkProxy class. Adding tests.
Diffstat (limited to 'archiva-modules/archiva-base/archiva-proxy')
4 files changed, 8 insertions, 80 deletions
diff --git a/archiva-modules/archiva-base/archiva-proxy/pom.xml b/archiva-modules/archiva-base/archiva-proxy/pom.xml index 92a535033..e4b2a063b 100644 --- a/archiva-modules/archiva-base/archiva-proxy/pom.xml +++ b/archiva-modules/archiva-base/archiva-proxy/pom.xml @@ -61,10 +61,6 @@ </dependency> <dependency> <groupId>org.apache.archiva</groupId> - <artifactId>archiva-repository-scanner</artifactId> - </dependency> - <dependency> - <groupId>org.apache.archiva</groupId> <artifactId>archiva-scheduler-repository-api</artifactId> </dependency> <dependency> diff --git a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/ArchivaProxyRegistry.java b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/ArchivaProxyRegistry.java index 6869c34bd..0a8a6785a 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/ArchivaProxyRegistry.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/ArchivaProxyRegistry.java @@ -36,10 +36,15 @@ import javax.inject.Inject; import java.util.*; import java.util.stream.Collectors; +/** + * Default proxy registry implementation. Uses the archiva configuration for accessing and storing the + * proxy information. + * + */ @Service("proxyRegistry#default") public class ArchivaProxyRegistry implements ProxyRegistry, ConfigurationListener { - private final Logger log = LoggerFactory.getLogger(ArchivaProxyRegistry.class); + private static final Logger log = LoggerFactory.getLogger(ArchivaProxyRegistry.class); @Inject ArchivaConfiguration archivaConfiguration; @@ -83,7 +88,7 @@ public class ArchivaProxyRegistry implements ProxyRegistry, ConfigurationListene proxy.setHost(networkProxyConfig.getHost()); proxy.setPort(networkProxyConfig.getPort()); proxy.setUsername(networkProxyConfig.getUsername()); - proxy.setPassword(networkProxyConfig.getPassword()); + proxy.setPassword(networkProxyConfig.getPassword().toCharArray()); proxy.setUseNtlm(networkProxyConfig.isUseNtlm()); this.networkProxyMap.put(key, proxy); diff --git a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyHandler.java b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyHandler.java index 1687bcab1..21a981791 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyHandler.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyHandler.java @@ -237,7 +237,7 @@ public abstract class DefaultRepositoryProxyHandler implements RepositoryProxyHa np.setId(p.getId()); np.setUseNtlm(p.isUseNtlm()); np.setUsername(p.getUsername()); - np.setPassword(p.getPassword()); + np.setPassword(p.getPassword() == null ? new char[0] : p.getPassword().toCharArray()); np.setProtocol(p.getProtocol()); np.setHost(p.getHost()); np.setPort(p.getPort()); diff --git a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/ProxyRegistry.java b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/ProxyRegistry.java deleted file mode 100644 index 95c096a23..000000000 --- a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/ProxyRegistry.java +++ /dev/null @@ -1,73 +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.proxy.model.NetworkProxy; -import org.apache.archiva.proxy.model.ProxyConnector; -import org.apache.archiva.proxy.model.RepositoryProxyHandler; -import org.apache.archiva.repository.RepositoryType; - -import java.util.List; -import java.util.Map; - -public interface ProxyRegistry { - - /** - * Returns the network proxy that is configured for the given id (repository id). - * - * @param id The proxy id - * @return The network proxy object if defined, otherwise null. - */ - NetworkProxy getNetworkProxy(String id); - - /** - * Returns a map that contains a list of repository handlers for each repository type. - * @return The map with the repository type as key and a list of handler objects as value. - */ - Map<RepositoryType, List<RepositoryProxyHandler>> getAllHandler(); - - /** - * Returns the repository handler that are defined for the given repository type. - * - * @param type The repository type - * @return Returns the list of the handler objects, or a empty list, if none defined. - */ - List<RepositoryProxyHandler> getHandler(RepositoryType type); - - /** - * Returns true, if there are proxy handler registered for the given type. - * - * @param type The repository type - * @return True, if a handler is registered, otherwise false. - */ - boolean hasHandler(RepositoryType type); - - /** - * Returns the list of all proxy connectors. - * @return - */ - public List<org.apache.archiva.proxy.model.ProxyConnector> getProxyConnectors(); - - /** - * Returns a map of connector lists with the source repository id as key - * @return A map with source repository ids as key and list of corresponding proxy connector objects as value. - */ - public Map<String, List<ProxyConnector>> getProxyConnectorAsMap(); -} |