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 org.apache.archiva.repository.features.IndexCreationFeature;
023import org.apache.archiva.repository.features.RemoteIndexFeature;
024import org.slf4j.Logger;
025import org.slf4j.LoggerFactory;
026
027import java.nio.file.Path;
028import java.util.Locale;
029
030/**
031 *
032 * Just a helper class, mainly used for unit tests.
033 *
034 *
035 */
036public class BasicRemoteRepository extends AbstractRemoteRepository
037
038{
039    Logger log = LoggerFactory.getLogger(BasicRemoteRepository.class);
040
041    RemoteIndexFeature remoteIndexFeature = new RemoteIndexFeature();
042    IndexCreationFeature indexCreationFeature = new IndexCreationFeature(true);
043
044
045    static final StandardCapabilities CAPABILITIES = new StandardCapabilities( new ReleaseScheme[] {
046        ReleaseScheme.RELEASE, ReleaseScheme.SNAPSHOT
047    }, new String[] {"default"}, new String[0], new String[] {
048        RemoteIndexFeature.class.toString(),
049            IndexCreationFeature.class.toString()
050    }, true, true, true, true, true  );
051
052    public BasicRemoteRepository( String id, String name, Path basePath )
053    {
054        super( RepositoryType.MAVEN, id, name, basePath);
055        initFeatures();
056    }
057
058    public BasicRemoteRepository( Locale primaryLocale, RepositoryType type, String id, String name, Path basePath )
059    {
060        super( primaryLocale, type, id, name, basePath );
061        initFeatures();
062    }
063
064    private void initFeatures() {
065        addFeature( remoteIndexFeature );
066        addFeature( indexCreationFeature );
067    }
068
069    @Override
070    public boolean hasIndex( )
071    {
072        return true;
073    }
074
075    @Override
076    public RepositoryCapabilities getCapabilities( )
077    {
078        return CAPABILITIES;
079    }
080
081
082}