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.Locale;
36 * Maven2 managed repository implementation.
38 public class MavenManagedRepository extends AbstractManagedRepository
40 public static final String DEFAULT_LAYOUT = "default";
41 public static final String LEGACY_LAYOUT = "legacy";
42 private ArtifactCleanupFeature artifactCleanupFeature = new ArtifactCleanupFeature( );
43 private IndexCreationFeature indexCreationFeature = new IndexCreationFeature( );
44 private StagingRepositoryFeature stagingRepositoryFeature = new StagingRepositoryFeature( );
46 private static final RepositoryCapabilities CAPABILITIES = new StandardCapabilities(
47 new ReleaseScheme[] { ReleaseScheme.RELEASE, ReleaseScheme.SNAPSHOT },
48 new String[] { DEFAULT_LAYOUT, LEGACY_LAYOUT},
50 new String[] {ArtifactCleanupFeature.class.getName(), IndexCreationFeature.class.getName(),
51 StagingRepositoryFeature.class.getName()},
59 public MavenManagedRepository( String id, String name )
61 super( RepositoryType.MAVEN, id, name );
64 public MavenManagedRepository( Locale primaryLocale, String id, String name )
66 super( primaryLocale, RepositoryType.MAVEN, id, name );
70 public RepositoryCapabilities getCapabilities( )
76 public <T extends RepositoryFeature<T>> RepositoryFeature<T> getFeature( Class<T> clazz ) throws UnsupportedFeatureException
78 if (ArtifactCleanupFeature.class.equals( clazz ))
80 return (RepositoryFeature<T>) artifactCleanupFeature;
81 } else if (IndexCreationFeature.class.equals(clazz)) {
82 return (RepositoryFeature<T>) indexCreationFeature;
83 } else if (StagingRepositoryFeature.class.equals(clazz)) {
84 return (RepositoryFeature<T>) stagingRepositoryFeature;
86 throw new UnsupportedFeatureException( );
91 public <T extends RepositoryFeature<T>> boolean supportsFeature( Class<T> clazz )
93 if (ArtifactCleanupFeature.class.equals(clazz) ||
94 IndexCreationFeature.class.equals(clazz) ||
95 StagingRepositoryFeature.class.equals(clazz)) {