001    // =================== DO NOT EDIT THIS FILE ====================
002    // Generated by Modello 1.7,
003    // any modifications will be overwritten.
004    // ==============================================================
005    
006    package org.apache.archiva.configuration;
007    
008    /**
009     * Class AbstractRepositoryConnectorConfiguration.
010     * 
011     * @version $Revision$ $Date$
012     */
013    @SuppressWarnings( "all" )
014    public class AbstractRepositoryConnectorConfiguration
015        implements java.io.Serializable
016    {
017    
018          //--------------------------/
019         //- Class/Member Variables -/
020        //--------------------------/
021    
022        /**
023         * 
024         *             The Repository Source for this connector.
025         *           
026         */
027        private String sourceRepoId;
028    
029        /**
030         * 
031         *             The Repository Target for this connector.
032         *           
033         */
034        private String targetRepoId;
035    
036        /**
037         * 
038         *             The network proxy ID to use for this connector.
039         *           
040         */
041        private String proxyId;
042    
043        /**
044         * Field blackListPatterns.
045         */
046        private java.util.List<String> blackListPatterns;
047    
048        /**
049         * Field whiteListPatterns.
050         */
051        private java.util.List<String> whiteListPatterns;
052    
053        /**
054         * Field policies.
055         */
056        private java.util.Map policies;
057    
058        /**
059         * Field properties.
060         */
061        private java.util.Map properties;
062    
063        /**
064         * 
065         *             If the the repository proxy connector is
066         * disabled or not
067         *           .
068         */
069        private boolean disabled = false;
070    
071    
072          //-----------/
073         //- Methods -/
074        //-----------/
075    
076        /**
077         * Method addBlackListPattern.
078         * 
079         * @param string
080         */
081        public void addBlackListPattern( String string )
082        {
083            getBlackListPatterns().add( string );
084        } //-- void addBlackListPattern( String )
085    
086        /**
087         * Method addPolicy.
088         * 
089         * @param key
090         * @param value
091         */
092        public void addPolicy( Object key, String value )
093        {
094            getPolicies().put( key, value );
095        } //-- void addPolicy( Object, String )
096    
097        /**
098         * Method addProperty.
099         * 
100         * @param key
101         * @param value
102         */
103        public void addProperty( Object key, String value )
104        {
105            getProperties().put( key, value );
106        } //-- void addProperty( Object, String )
107    
108        /**
109         * Method addWhiteListPattern.
110         * 
111         * @param string
112         */
113        public void addWhiteListPattern( String string )
114        {
115            getWhiteListPatterns().add( string );
116        } //-- void addWhiteListPattern( String )
117    
118        /**
119         * Method getBlackListPatterns.
120         * 
121         * @return List
122         */
123        public java.util.List<String> getBlackListPatterns()
124        {
125            if ( this.blackListPatterns == null )
126            {
127                this.blackListPatterns = new java.util.ArrayList<String>();
128            }
129    
130            return this.blackListPatterns;
131        } //-- java.util.List<String> getBlackListPatterns()
132    
133        /**
134         * Method getPolicies.
135         * 
136         * @return Map
137         */
138        public java.util.Map getPolicies()
139        {
140            if ( this.policies == null )
141            {
142                this.policies = new java.util.HashMap();
143            }
144    
145            return this.policies;
146        } //-- java.util.Map getPolicies()
147    
148        /**
149         * Method getProperties.
150         * 
151         * @return Map
152         */
153        public java.util.Map getProperties()
154        {
155            if ( this.properties == null )
156            {
157                this.properties = new java.util.HashMap();
158            }
159    
160            return this.properties;
161        } //-- java.util.Map getProperties()
162    
163        /**
164         * Get the network proxy ID to use for this connector.
165         * 
166         * @return String
167         */
168        public String getProxyId()
169        {
170            return this.proxyId;
171        } //-- String getProxyId()
172    
173        /**
174         * Get the Repository Source for this connector.
175         * 
176         * @return String
177         */
178        public String getSourceRepoId()
179        {
180            return this.sourceRepoId;
181        } //-- String getSourceRepoId()
182    
183        /**
184         * Get the Repository Target for this connector.
185         * 
186         * @return String
187         */
188        public String getTargetRepoId()
189        {
190            return this.targetRepoId;
191        } //-- String getTargetRepoId()
192    
193        /**
194         * Method getWhiteListPatterns.
195         * 
196         * @return List
197         */
198        public java.util.List<String> getWhiteListPatterns()
199        {
200            if ( this.whiteListPatterns == null )
201            {
202                this.whiteListPatterns = new java.util.ArrayList<String>();
203            }
204    
205            return this.whiteListPatterns;
206        } //-- java.util.List<String> getWhiteListPatterns()
207    
208        /**
209         * Get if the the repository proxy connector is disabled or
210         * not.
211         * 
212         * @return boolean
213         */
214        public boolean isDisabled()
215        {
216            return this.disabled;
217        } //-- boolean isDisabled()
218    
219        /**
220         * Method removeBlackListPattern.
221         * 
222         * @param string
223         */
224        public void removeBlackListPattern( String string )
225        {
226            getBlackListPatterns().remove( string );
227        } //-- void removeBlackListPattern( String )
228    
229        /**
230         * Method removeWhiteListPattern.
231         * 
232         * @param string
233         */
234        public void removeWhiteListPattern( String string )
235        {
236            getWhiteListPatterns().remove( string );
237        } //-- void removeWhiteListPattern( String )
238    
239        /**
240         * Set the list of blacklisted patterns for this connector.
241         * 
242         * @param blackListPatterns
243         */
244        public void setBlackListPatterns( java.util.List<String> blackListPatterns )
245        {
246            this.blackListPatterns = blackListPatterns;
247        } //-- void setBlackListPatterns( java.util.List )
248    
249        /**
250         * Set if the the repository proxy connector is disabled or
251         * not.
252         * 
253         * @param disabled
254         */
255        public void setDisabled( boolean disabled )
256        {
257            this.disabled = disabled;
258        } //-- void setDisabled( boolean )
259    
260        /**
261         * Set policy configuration for the connector.
262         * 
263         * @param policies
264         */
265        public void setPolicies( java.util.Map policies )
266        {
267            this.policies = policies;
268        } //-- void setPolicies( java.util.Map )
269    
270        /**
271         * Set configuration for the connector.
272         * 
273         * @param properties
274         */
275        public void setProperties( java.util.Map properties )
276        {
277            this.properties = properties;
278        } //-- void setProperties( java.util.Map )
279    
280        /**
281         * Set the network proxy ID to use for this connector.
282         * 
283         * @param proxyId
284         */
285        public void setProxyId( String proxyId )
286        {
287            this.proxyId = proxyId;
288        } //-- void setProxyId( String )
289    
290        /**
291         * Set the Repository Source for this connector.
292         * 
293         * @param sourceRepoId
294         */
295        public void setSourceRepoId( String sourceRepoId )
296        {
297            this.sourceRepoId = sourceRepoId;
298        } //-- void setSourceRepoId( String )
299    
300        /**
301         * Set the Repository Target for this connector.
302         * 
303         * @param targetRepoId
304         */
305        public void setTargetRepoId( String targetRepoId )
306        {
307            this.targetRepoId = targetRepoId;
308        } //-- void setTargetRepoId( String )
309    
310        /**
311         * Set the list of whitelisted patterns for this connector.
312         * 
313         * @param whiteListPatterns
314         */
315        public void setWhiteListPatterns( java.util.List<String> whiteListPatterns )
316        {
317            this.whiteListPatterns = whiteListPatterns;
318        } //-- void setWhiteListPatterns( java.util.List )
319    
320        
321        /**
322         * Obtain a specific policy from the underlying connector.
323         *
324         * @param policyId the policy id to fetch.
325         * @param defaultValue the default value for the policy id.
326         * @return the configured policy value (or default value if not found).
327         */
328        public String getPolicy( String policyId, String defaultValue )
329        {
330            if ( this.getPolicies() == null )
331            {
332                return null;
333            }
334    
335            Object value = this.getPolicies().get( policyId );
336    
337            if ( value == null )
338            {
339                return defaultValue;
340            }
341    
342            return (String) value;
343        }
344              
345    }