1 package org.apache.archiva.repository;
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.indexer.ArchivaIndexingContext;
23 import org.apache.archiva.repository.events.EventSource;
24 import org.apache.archiva.repository.storage.RepositoryStorage;
25 import org.apache.archiva.repository.features.RepositoryFeature;
26 import org.apache.archiva.repository.storage.StorageAsset;
29 import java.util.Locale;
34 * Base interface for repositories.
36 * Created by Martin Stockhammer on 21.09.17.
38 public interface Repository extends EventSource, RepositoryStorage {
41 * Return the identifier of the repository. Repository identifier should be unique at least
43 * @return The identifier.
48 * This is the display name of the repository. This string is presented in the user interface.
50 * @return The display name of the repository
55 * Returns the name in the given locale.
59 String getName(Locale locale);
62 * Returns a description of this repository.
63 * @return The description.
65 String getDescription();
68 * Returns the description for the given locale.
72 String getDescription(Locale locale);
75 * This identifies the type of repository. Archiva does only support certain types of repositories.
77 * @return A unique identifier for the repository type.
79 RepositoryType getType();
83 * Returns the location of this repository. For local repositories this might be a file URI, for
84 * remote repositories a http URL or some very repository specific schemes.
85 * Each repository has only one unique location.
87 * @return The repository location.
93 * Returns a storage representation to the local data stored for this repository.
94 * The repository implementation may not store the real artifacts in this path. The directory structure
95 * is completely implementation dependant.
98 StorageAsset getLocalPath();
102 * A repository may allow additional locations that can be used, if the primary location is not available.
105 Set<URI> getFailoverLocations();
108 * True, if this repository is scanned regularly.
113 * Returns the definition, when the repository jobs are executed.
114 * This must return a valid a cron string.
116 * @See http://www.quartz-scheduler.org/api/2.2.1/org/quartz/CronExpression.html
120 String getSchedulingDefinition();
123 * Returns true, if this repository has a index available
129 * Returns a layout definition. The returned string may be implementation specific and is not
138 * Returns the capabilities of the repository implementation.
141 RepositoryCapabilities getCapabilities();
145 * Extension method that allows to provide different features that are not supported by all
148 * @param clazz The feature class that is requested
149 * @param <T> This is the class of the feature
150 * @return The feature implementation for this repository instance, if it is supported
151 * @throws UnsupportedFeatureException if the feature is not supported by this repository type
153 <T extends RepositoryFeature<T>> RepositoryFeature<T> getFeature(Class<T> clazz) throws UnsupportedFeatureException;
157 * Returns true, if the requested feature is supported by this repository.
159 * @param clazz The requested feature class
160 * @param <T> The requested feature class
161 * @return True, if the feature is supported, otherwise false.
163 <T extends RepositoryFeature<T>> boolean supportsFeature(Class<T> clazz);
167 * Returns a indexing context.
169 * @throws UnsupportedOperationException
171 ArchivaIndexingContext getIndexingContext();
174 * Closes all resources that are opened by this repository.
179 * Returns the current status of this repository.
181 * @return <code>true</code>, if repository has not been closed, otherwise <code>false</code>