This project has retired. For details please refer to its Attic page.
ProxyConnector xref
View Javadoc
1   package org.apache.archiva.proxy.model;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.archiva.repository.ManagedRepositoryContent;
23  import org.apache.archiva.repository.RemoteRepositoryContent;
24  import org.apache.archiva.repository.connector.RepositoryConnector;
25  
26  import java.util.Iterator;
27  import java.util.List;
28  import java.util.Map;
29  
30  /**
31   * This represents a connector for a repository to repository proxy.
32   */
33  public class ProxyConnector
34      implements RepositoryConnector
35  {
36      private ManagedRepositoryContent sourceRepository;
37  
38      private RemoteRepositoryContent targetRepository;
39  
40      private List<String> blacklist;
41  
42      private List<String> whitelist;
43  
44      private String proxyId;
45  
46      private int order;
47  
48      private Map<String, String> policies;
49  
50      private boolean disabled;
51  
52      public ProxyConnector()
53      {
54          // no op
55      }
56  
57      @Override
58      public boolean isDisabled()
59      {
60          return disabled;
61      }
62  
63      @Override
64      public void setDisabled( boolean disabled )
65      {
66          this.disabled = disabled;
67      }
68  
69      @Override
70      public List<String> getBlacklist()
71      {
72          return blacklist;
73      }
74  
75      public void setBlacklist( List<String> blacklist )
76      {
77          this.blacklist = blacklist;
78      }
79  
80      @Override
81      public ManagedRepositoryContent getSourceRepository()
82      {
83          return sourceRepository;
84      }
85  
86      public void setSourceRepository( ManagedRepositoryContent sourceRepository )
87      {
88          this.sourceRepository = sourceRepository;
89      }
90  
91      @Override
92      public RemoteRepositoryContent getTargetRepository()
93      {
94          return targetRepository;
95      }
96  
97      public void setTargetRepository( RemoteRepositoryContent targetRepository )
98      {
99          this.targetRepository = targetRepository;
100     }
101 
102     @Override
103     public List<String> getWhitelist()
104     {
105         return whitelist;
106     }
107 
108     public void setWhitelist( List<String> whitelist )
109     {
110         this.whitelist = whitelist;
111     }
112 
113     public Map<String, String> getPolicies()
114     {
115         return policies;
116     }
117 
118     public void setPolicies( Map<String, String> policies )
119     {
120         this.policies = policies;
121     }
122 
123     public String getProxyId()
124     {
125         return proxyId;
126     }
127 
128     public void setProxyId( String proxyId )
129     {
130         this.proxyId = proxyId;
131     }
132 
133     @Override
134     public String toString()
135     {
136         StringBuilder sb = new StringBuilder();
137 
138         sb.append( "ProxyConnector[\n" );
139         sb.append( "  source: [managed] " ).append( this.sourceRepository.getRepoRoot() ).append( "\n" );
140         sb.append( "  target: [remote] " ).append( this.targetRepository.getRepository().getUrl() ).append( "\n" );
141         sb.append( "  proxyId:" ).append( this.proxyId ).append( "\n" );
142 
143         Iterator<String> keys = this.policies.keySet().iterator();
144         while ( keys.hasNext() )
145         {
146             String name = keys.next();
147             sb.append( "  policy[" ).append( name ).append( "]:" );
148             sb.append( this.policies.get( name ) ).append( "\n" );
149         }
150 
151         sb.append( "]" );
152 
153         return sb.toString();
154     }
155 
156     public void setPolicy( String policyId, String policySetting )
157     {
158         this.policies.put( policyId, policySetting );
159     }
160 
161     public int getOrder()
162     {
163         return order;
164     }
165 
166     public void setOrder( int order )
167     {
168         this.order = order;
169     }
170 }