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.

ProxyConnector.java 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. package org.apache.archiva.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 org.apache.archiva.repository.ManagedRepositoryContent;
  21. import org.apache.archiva.repository.RemoteRepositoryContent;
  22. import org.apache.archiva.repository.connector.RepositoryConnector;
  23. import java.util.Iterator;
  24. import java.util.List;
  25. import java.util.Map;
  26. /**
  27. * This represents a connector for a repository to repository proxy.
  28. *
  29. *
  30. */
  31. public class ProxyConnector
  32. implements RepositoryConnector
  33. {
  34. private ManagedRepositoryContent sourceRepository;
  35. private RemoteRepositoryContent targetRepository;
  36. private List<String> blacklist;
  37. private List<String> whitelist;
  38. private String proxyId;
  39. private int order;
  40. private Map<String, String> policies;
  41. private boolean disabled;
  42. public boolean isDisabled()
  43. {
  44. return disabled;
  45. }
  46. public void setDisabled(boolean disabled)
  47. {
  48. this.disabled = disabled;
  49. }
  50. public List<String> getBlacklist()
  51. {
  52. return blacklist;
  53. }
  54. public void setBlacklist( List<String> blacklist )
  55. {
  56. this.blacklist = blacklist;
  57. }
  58. public ManagedRepositoryContent getSourceRepository()
  59. {
  60. return sourceRepository;
  61. }
  62. public void setSourceRepository( ManagedRepositoryContent sourceRepository )
  63. {
  64. this.sourceRepository = sourceRepository;
  65. }
  66. public RemoteRepositoryContent getTargetRepository()
  67. {
  68. return targetRepository;
  69. }
  70. public void setTargetRepository( RemoteRepositoryContent targetRepository )
  71. {
  72. this.targetRepository = targetRepository;
  73. }
  74. public List<String> getWhitelist()
  75. {
  76. return whitelist;
  77. }
  78. public void setWhitelist( List<String> whitelist )
  79. {
  80. this.whitelist = whitelist;
  81. }
  82. public Map<String, String> getPolicies()
  83. {
  84. return policies;
  85. }
  86. public void setPolicies( Map<String, String> policies )
  87. {
  88. this.policies = policies;
  89. }
  90. public String getProxyId()
  91. {
  92. return proxyId;
  93. }
  94. public void setProxyId( String proxyId )
  95. {
  96. this.proxyId = proxyId;
  97. }
  98. @Override
  99. public String toString()
  100. {
  101. StringBuffer sb = new StringBuffer();
  102. sb.append( "ProxyConnector[\n" );
  103. sb.append( " source: [managed] " ).append( this.sourceRepository.getRepoRoot() ).append( "\n" );
  104. sb.append( " target: [remote] " ).append( this.targetRepository.getRepository().getUrl() ).append( "\n" );
  105. sb.append( " proxyId:" ).append( this.proxyId ).append( "\n" );
  106. Iterator<String> keys = this.policies.keySet().iterator();
  107. while ( keys.hasNext() )
  108. {
  109. String name = keys.next();
  110. sb.append( " policy[" ).append( name ).append( "]:" );
  111. sb.append( this.policies.get( name ) ).append( "\n" );
  112. }
  113. sb.append( "]" );
  114. return sb.toString();
  115. }
  116. public void setPolicy( String policyId, String policySetting )
  117. {
  118. this.policies.put( policyId, policySetting );
  119. }
  120. public int getOrder()
  121. {
  122. return order;
  123. }
  124. public void setOrder( int order )
  125. {
  126. this.order = order;
  127. }
  128. }