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.content.RepositoryStorage;
24 import org.apache.archiva.repository.features.RepositoryFeature;
27 import java.nio.file.Path;
28 import java.util.Locale;
33 * Base interface for repositories.
35 * Created by Martin Stockhammer on 21.09.17.
37 public interface Repository extends RepositoryEventHandler, RepositoryStorage {
40 * Return the identifier of the repository. Repository identifier should be unique at least
42 * @return The identifier.
47 * This is the display name of the repository. This string is presented in the user interface.
49 * @return The display name of the repository
54 * Returns the name in the given locale.
58 String getName(Locale locale);
61 * Returns a description of this repository.
62 * @return The description.
64 String getDescription();
67 * Returns the description for the given locale.
71 String getDescription(Locale locale);
74 * This identifies the type of repository. Archiva does only support certain types of repositories.
76 * @return A unique identifier for the repository type.
78 RepositoryType getType();
82 * Returns the location of this repository. For local repositories this might be a file URI, for
83 * remote repositories a http URL or some very repository specific schemes.
84 * Each repository has only one unique location.
86 * @return The repository location.
92 * Returns the local path that this repository uses, if it stores data locally. You should keep in
93 * mind, that repository implementations may not store any data in this directory. E.g. if the
94 * repository data is handled by a database. So the content of this directory is very implementation
95 * specific. Users of this directory must know about the repository file layout if they use this
98 * Repository implementations should always return a valid path, even if there is no locally stored data.
100 * Some extensions may use the path to store their own repository specific data, e.g. statistics, metadata,...
102 * @return the filesystem path to the repository.
108 * A repository may allow additional locations that can be used, if the primary location is not available.
111 Set<URI> getFailoverLocations();
114 * True, if this repository is scanned regularly.
119 * Returns the definition, when the repository jobs are executed.
120 * This must return a valid a cron string.
122 * @See http://www.quartz-scheduler.org/api/2.2.1/org/quartz/CronExpression.html
126 String getSchedulingDefinition();
129 * Returns true, if this repository has a index available
135 * Returns a layout definition. The returned string may be implementation specific and is not
144 * Returns the capabilities of the repository implementation.
147 RepositoryCapabilities getCapabilities();
151 * Extension method that allows to provide different features that are not supported by all
154 * @param clazz The feature class that is requested
155 * @param <T> This is the class of the feature
156 * @return The feature implementation for this repository instance, if it is supported
157 * @throws UnsupportedFeatureException if the feature is not supported by this repository type
159 <T extends RepositoryFeature<T>> RepositoryFeature<T> getFeature(Class<T> clazz) throws UnsupportedFeatureException;
163 * Returns true, if the requested feature is supported by this repository.
165 * @param clazz The requested feature class
166 * @param <T> The requested feature class
167 * @return True, if the feature is supported, otherwise false.
169 <T extends RepositoryFeature<T>> boolean supportsFeature(Class<T> clazz);
173 * Returns a indexing context.
175 * @throws UnsupportedOperationException
177 ArchivaIndexingContext getIndexingContext();
180 * Closes all resources that are opened by this repository.