You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ProxyConnectorsAction.java 2.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. package org.apache.maven.archiva.web.action.admin.connectors.proxy;
  2. /*
  3. * Licensed to the Apache Software Foundation (ASF) under one
  4. * or more contributor license agreements. See the NOTICE file
  5. * distributed with this work for additional information
  6. * regarding copyright ownership. The ASF licenses this file
  7. * to you under the Apache License, Version 2.0 (the
  8. * "License"); you may not use this file except in compliance
  9. * with the License. You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing,
  14. * software distributed under the License is distributed on an
  15. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  16. * KIND, either express or implied. See the License for the
  17. * specific language governing permissions and limitations
  18. * under the License.
  19. */
  20. import com.opensymphony.xwork2.Preparable;
  21. import org.apache.maven.archiva.configuration.AbstractRepositoryConfiguration;
  22. import org.apache.maven.archiva.configuration.Configuration;
  23. import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
  24. import java.util.HashMap;
  25. import java.util.List;
  26. import java.util.Map;
  27. /**
  28. * ProxyConnectorsAction
  29. *
  30. * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
  31. * @version $Id$
  32. *
  33. * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="proxyConnectorsAction"
  34. */
  35. public class ProxyConnectorsAction
  36. extends AbstractProxyConnectorAction
  37. implements Preparable
  38. {
  39. private Map<String, AbstractRepositoryConfiguration> repoMap;
  40. /**
  41. * boolean to indicate that remote repo is present. Used for Add Link
  42. */
  43. private boolean remoteRepoExists=false;
  44. /**
  45. * Map of Proxy Connectors.
  46. */
  47. private Map<String, List<ProxyConnectorConfiguration>> proxyConnectorMap;
  48. public void prepare()
  49. {
  50. Configuration config = archivaConfiguration.getConfiguration();
  51. repoMap = new HashMap<String, AbstractRepositoryConfiguration>();
  52. repoMap.putAll( config.getRemoteRepositoriesAsMap() );
  53. repoMap.putAll( config.getManagedRepositoriesAsMap() );
  54. proxyConnectorMap = createProxyConnectorMap();
  55. remoteRepoExists=config.getRemoteRepositories().size()>0;
  56. }
  57. public Map<String, AbstractRepositoryConfiguration> getRepoMap()
  58. {
  59. return repoMap;
  60. }
  61. public Map<String, List<ProxyConnectorConfiguration>> getProxyConnectorMap()
  62. {
  63. return proxyConnectorMap;
  64. }
  65. public boolean getRemoteRepoExists()
  66. {
  67. return remoteRepoExists;
  68. }
  69. }