1 package org.apache.archiva.repository.maven2;
3 import org.apache.archiva.indexer.ArchivaIndexingContext;
4 import org.apache.archiva.repository.AbstractRemoteRepository;
5 import org.apache.archiva.repository.ReleaseScheme;
6 import org.apache.archiva.repository.RemoteRepository;
7 import org.apache.archiva.repository.RepositoryCapabilities;
8 import org.apache.archiva.repository.RepositoryType;
9 import org.apache.archiva.repository.StandardCapabilities;
10 import org.apache.archiva.repository.UnsupportedFeatureException;
11 import org.apache.archiva.repository.features.IndexCreationFeature;
12 import org.apache.archiva.repository.features.RemoteIndexFeature;
13 import org.apache.archiva.repository.features.RepositoryFeature;
14 import org.slf4j.Logger;
15 import org.slf4j.LoggerFactory;
17 import java.io.IOException;
18 import java.nio.file.Path;
19 import java.util.Locale;
22 * Licensed to the Apache Software Foundation (ASF) under one
23 * or more contributor license agreements. See the NOTICE file
24 * distributed with this work for additional information
25 * regarding copyright ownership. The ASF licenses this file
26 * to you under the Apache License, Version 2.0 (the
27 * "License"); you may not use this file except in compliance
28 * with the License. You may obtain a copy of the License at
30 * http://www.apache.org/licenses/LICENSE-2.0
32 * Unless required by applicable law or agreed to in writing,
33 * software distributed under the License is distributed on an
34 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
35 * KIND, either express or implied. See the License for the
36 * specific language governing permissions and limitations
41 * Maven2 remote repository implementation
43 public class MavenRemoteRepository extends AbstractRemoteRepository
44 implements RemoteRepository
47 Logger log = LoggerFactory.getLogger(MavenRemoteRepository.class);
49 final private RemoteIndexFeature remoteIndexFeature = new RemoteIndexFeature();
50 final private IndexCreationFeature indexCreationFeature;
52 private static final RepositoryCapabilities CAPABILITIES = new StandardCapabilities(
53 new ReleaseScheme[] { ReleaseScheme.RELEASE, ReleaseScheme.SNAPSHOT },
54 new String[] { MavenManagedRepository.DEFAULT_LAYOUT, MavenManagedRepository.LEGACY_LAYOUT},
56 new String[] {RemoteIndexFeature.class.getName(), IndexCreationFeature.class.getName()},
64 public MavenRemoteRepository( String id, String name, Path basePath )
66 super( RepositoryType.MAVEN, id, name, basePath );
67 this.indexCreationFeature = new IndexCreationFeature(id, this);
71 public MavenRemoteRepository( Locale primaryLocale, String id, String name, Path basePath )
73 super( primaryLocale, RepositoryType.MAVEN, id, name, basePath );
74 this.indexCreationFeature = new IndexCreationFeature(id, this);
78 public boolean hasIndex( )
80 return remoteIndexFeature.hasIndex();
84 public RepositoryCapabilities getCapabilities( )
90 public <T extends RepositoryFeature<T>> RepositoryFeature<T> getFeature( Class<T> clazz ) throws UnsupportedFeatureException
92 if (RemoteIndexFeature.class.equals( clazz )) {
93 return (RepositoryFeature<T>) remoteIndexFeature;
94 } else if (IndexCreationFeature.class.equals(clazz)) {
95 return (RepositoryFeature<T>) indexCreationFeature;
97 throw new UnsupportedFeatureException( );
102 public <T extends RepositoryFeature<T>> boolean supportsFeature( Class<T> clazz )
104 if ( RemoteIndexFeature.class.equals(clazz) || IndexCreationFeature.class.equals(clazz)) {