]> source.dussan.org Git - archiva.git/blob
0a41c049742e0fb602b62bc458e1832a5325dbd4
[archiva.git] /
1 package org.apache.archiva.repository;
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 java.util.Collections;
23 import java.util.HashSet;
24 import java.util.Set;
25
26 /**
27  * Capability implementation.
28  */
29 public class StandardCapabilities implements RepositoryCapabilities
30 {
31     private final Set<ReleaseScheme> supportedReleaseSchemes;
32     private final Set<ReleaseScheme> uSupportedReleaseSchemes;
33     private final Set<String> supportedLayouts;
34     private final Set<String> uSupportedLayouts;
35     private final Set<String> customCapabilities;
36     private final Set<String> uCustomCapabilities;
37     private final Set<String> supportedFeatures;
38     private final Set<String> uSupportedFeatures;
39     private final boolean indexable;
40     private final boolean fileBased;
41     private final boolean canBlockRedeployments;
42     private final boolean scannable;
43     private final boolean allowsFailover;
44
45
46     public StandardCapabilities( ReleaseScheme[] supportedReleaseSchemes, String[] supportedLayouts,
47                                  String[] customCapabilities, String[] supportedFeatures,
48                                  boolean indexable, boolean fileBased,
49                                  boolean canBlockRedeployments, boolean scannable, boolean allowsFailover )
50     {
51         this.supportedReleaseSchemes = new HashSet();
52         for (ReleaseScheme scheme : supportedReleaseSchemes) {
53             this.supportedReleaseSchemes.add(scheme);
54         }
55         this.uSupportedReleaseSchemes = Collections.unmodifiableSet( this.supportedReleaseSchemes);
56         this.supportedLayouts = new HashSet<>(  );
57         for (String layout : supportedLayouts) {
58             this.supportedLayouts.add(layout);
59         }
60         this.uSupportedLayouts = Collections.unmodifiableSet( this.supportedLayouts );
61         this.customCapabilities = new HashSet<>(  );
62         for (String cap : customCapabilities) {
63             this.customCapabilities.add(cap);
64         }
65         this.uCustomCapabilities = Collections.unmodifiableSet( this.customCapabilities );
66         this.supportedFeatures = new HashSet<>(  );
67         for (String feature : supportedFeatures) {
68             this.supportedFeatures.add(feature);
69         }
70         this.uSupportedFeatures = Collections.unmodifiableSet( this.supportedFeatures );
71         this.indexable = indexable;
72         this.fileBased = fileBased;
73         this.canBlockRedeployments = canBlockRedeployments;
74         this.scannable = scannable;
75         this.allowsFailover = allowsFailover;
76     }
77
78     @Override
79     public Set<ReleaseScheme> supportedReleaseSchemes( )
80     {
81         return uSupportedReleaseSchemes;
82     }
83
84     @Override
85     public Set<String> supportedLayouts( )
86     {
87         return uSupportedLayouts;
88     }
89
90     @Override
91     public Set<String> customCapabilities( )
92     {
93         return uCustomCapabilities;
94     }
95
96     @Override
97     public Set<String> supportedFeatures( )
98     {
99         return uSupportedFeatures;
100     }
101
102     @Override
103     public boolean isIndexable( )
104     {
105         return indexable;
106     }
107
108     @Override
109     public boolean isFileBased( )
110     {
111         return fileBased;
112     }
113
114     @Override
115     public boolean canBlockRedeployments( )
116     {
117         return canBlockRedeployments;
118     }
119
120     @Override
121     public boolean isScannable( )
122     {
123         return scannable;
124     }
125
126     @Override
127     public boolean allowsFailover( )
128     {
129         return allowsFailover;
130     }
131 }