1 package org.apache.archiva.repository.maven2;
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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
22 import org.apache.archiva.repository.AbstractManagedRepository;
23 import org.apache.archiva.repository.ReleaseScheme;
24 import org.apache.archiva.repository.RepositoryCapabilities;
25 import org.apache.archiva.repository.RepositoryType;
26 import org.apache.archiva.repository.StandardCapabilities;
27 import org.apache.archiva.repository.UnsupportedFeatureException;
28 import org.apache.archiva.repository.features.ArtifactCleanupFeature;
29 import org.apache.archiva.repository.features.IndexCreationFeature;
30 import org.apache.archiva.repository.features.RepositoryFeature;
31 import org.apache.archiva.repository.features.StagingRepositoryFeature;
33 import java.util.Collections;
34 import java.util.HashSet;
35 import java.util.Locale;
39 * Maven2 managed repository implementation.
41 public class MavenManagedRepository extends AbstractManagedRepository
43 public static final String DEFAULT_LAYOUT = "default";
44 public static final String LEGACY_LAYOUT = "legacy";
45 private ArtifactCleanupFeature artifactCleanupFeature = new ArtifactCleanupFeature( );
46 private IndexCreationFeature indexCreationFeature = new IndexCreationFeature( );
47 private StagingRepositoryFeature stagingRepositoryFeature = new StagingRepositoryFeature( );
49 private static final RepositoryCapabilities CAPABILITIES = new StandardCapabilities(
50 new ReleaseScheme[] { ReleaseScheme.RELEASE, ReleaseScheme.SNAPSHOT },
51 new String[] { DEFAULT_LAYOUT, LEGACY_LAYOUT},
53 new String[] {ArtifactCleanupFeature.class.getName(), IndexCreationFeature.class.getName(),
54 StagingRepositoryFeature.class.getName()},
62 public MavenManagedRepository( String id, String name )
64 super( RepositoryType.MAVEN, id, name );
67 public MavenManagedRepository( Locale primaryLocale, String id, String name )
69 super( primaryLocale, RepositoryType.MAVEN, id, name );
73 public RepositoryCapabilities getCapabilities( )
79 public <T extends RepositoryFeature<T>> RepositoryFeature<T> getFeature( Class<T> clazz ) throws UnsupportedFeatureException
81 if (ArtifactCleanupFeature.class.equals( clazz ))
83 return (RepositoryFeature<T>) artifactCleanupFeature;
84 } else if (IndexCreationFeature.class.equals(clazz)) {
85 return (RepositoryFeature<T>) indexCreationFeature;
86 } else if (StagingRepositoryFeature.class.equals(clazz)) {
87 return (RepositoryFeature<T>) stagingRepositoryFeature;
89 throw new UnsupportedFeatureException( );
94 public <T extends RepositoryFeature<T>> boolean supportsFeature( Class<T> clazz )
96 if (ArtifactCleanupFeature.class.equals(clazz) ||
97 IndexCreationFeature.class.equals(clazz) ||
98 StagingRepositoryFeature.class.equals(clazz)) {