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.ArtifactCleanupFeature;
023import org.apache.archiva.repository.features.IndexCreationFeature;
024import org.apache.archiva.repository.features.StagingRepositoryFeature;
025import org.slf4j.Logger;
026import org.slf4j.LoggerFactory;
027
028import java.nio.file.Path;
029import java.util.Locale;
030
031/**
032 *
033 * Just a helper class, mainly used for unit tests.
034 *
035 *
036 */
037public class BasicManagedRepository extends AbstractManagedRepository
038
039{
040    Logger log = LoggerFactory.getLogger(BasicManagedRepository.class);
041    ArtifactCleanupFeature artifactCleanupFeature = new ArtifactCleanupFeature(  );
042    StagingRepositoryFeature stagingRepositoryFeature = new StagingRepositoryFeature( );
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        ArtifactCleanupFeature.class.toString(), IndexCreationFeature.class.toString(),
049        StagingRepositoryFeature.class.toString()
050    }, true, true, true, true, true  );
051
052    public BasicManagedRepository( String id, String name, Path basePath )
053    {
054        super( RepositoryType.MAVEN, id, name, basePath );
055        initFeatures();
056    }
057
058    public BasicManagedRepository( 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        IndexCreationFeature indexCreationFeature = new IndexCreationFeature(this, this);
066        addFeature( artifactCleanupFeature );
067        addFeature( indexCreationFeature );
068        addFeature( stagingRepositoryFeature );
069    }
070
071    @Override
072    public boolean hasIndex( )
073    {
074        return true;
075    }
076
077    @Override
078    public RepositoryCapabilities getCapabilities( )
079    {
080        return CAPABILITIES;
081    }
082
083}