This project has retired. For details please refer to its Attic page.
Source code
001package org.apache.archiva.repository;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *  http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022import java.util.Collections;
023import java.util.HashSet;
024import java.util.Set;
025
026/**
027 * Capability implementation.
028 */
029public class StandardCapabilities implements RepositoryCapabilities
030{
031    private final Set<ReleaseScheme> supportedReleaseSchemes;
032    private final Set<ReleaseScheme> uSupportedReleaseSchemes;
033    private final Set<String> supportedLayouts;
034    private final Set<String> uSupportedLayouts;
035    private final Set<String> customCapabilities;
036    private final Set<String> uCustomCapabilities;
037    private final Set<String> supportedFeatures;
038    private final Set<String> uSupportedFeatures;
039    private final boolean indexable;
040    private final boolean fileBased;
041    private final boolean canBlockRedeployments;
042    private final boolean scannable;
043    private final boolean allowsFailover;
044
045
046    public StandardCapabilities( ReleaseScheme[] supportedReleaseSchemes, String[] supportedLayouts,
047                                 String[] customCapabilities, String[] supportedFeatures,
048                                 boolean indexable, boolean fileBased,
049                                 boolean canBlockRedeployments, boolean scannable, boolean allowsFailover )
050    {
051        this.supportedReleaseSchemes = new HashSet<>();
052        for (ReleaseScheme scheme : supportedReleaseSchemes) {
053            this.supportedReleaseSchemes.add(scheme);
054        }
055        this.uSupportedReleaseSchemes = Collections.unmodifiableSet( this.supportedReleaseSchemes);
056        this.supportedLayouts = new HashSet<>(  );
057        for (String layout : supportedLayouts) {
058            this.supportedLayouts.add(layout);
059        }
060        this.uSupportedLayouts = Collections.unmodifiableSet( this.supportedLayouts );
061        this.customCapabilities = new HashSet<>(  );
062        for (String cap : customCapabilities) {
063            this.customCapabilities.add(cap);
064        }
065        this.uCustomCapabilities = Collections.unmodifiableSet( this.customCapabilities );
066        this.supportedFeatures = new HashSet<>(  );
067        for (String feature : supportedFeatures) {
068            this.supportedFeatures.add(feature);
069        }
070        this.uSupportedFeatures = Collections.unmodifiableSet( this.supportedFeatures );
071        this.indexable = indexable;
072        this.fileBased = fileBased;
073        this.canBlockRedeployments = canBlockRedeployments;
074        this.scannable = scannable;
075        this.allowsFailover = allowsFailover;
076    }
077
078    @Override
079    public Set<ReleaseScheme> supportedReleaseSchemes( )
080    {
081        return uSupportedReleaseSchemes;
082    }
083
084    @Override
085    public Set<String> supportedLayouts( )
086    {
087        return uSupportedLayouts;
088    }
089
090    @Override
091    public Set<String> customCapabilities( )
092    {
093        return uCustomCapabilities;
094    }
095
096    @Override
097    public Set<String> supportedFeatures( )
098    {
099        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}