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.repository.features.RepositoryFeature;
25 import java.util.List;
26 import java.util.Locale;
31 * Base interface for repositories.
33 * Created by Martin Stockhammer on 21.09.17.
35 public interface Repository {
38 * Return the identifier of the repository. Repository identifier should be unique at least
40 * @return The identifier.
45 * This is the display name of the repository. This string is presented in the user interface.
47 * @return The display name of the repository
52 * Returns the name in the given locale.
56 String getName(Locale locale);
59 * Returns a description of this repository.
60 * @return The description.
62 String getDescription();
65 * Returns the description for the given locale.
69 String getDescription(Locale locale);
72 * This identifies the type of repository. Archiva does only support certain types of repositories.
74 * @return A unique identifier for the repository type.
76 RepositoryType getType();
80 * Returns the location of this repository. For local repositories this might be a file URI, for
81 * remote repositories a http URL or some very repository specific schemes.
82 * Each repository has only one unique location.
84 * @return The repository location.
89 * This returns the absolute location uri of this repository. Some repository locations may be relative to
90 * the base repository directory or uri. This returns the absolute path of the repository.
91 * If the location is absolute already this method returns the same URI as getLocation().
93 * @return the absolute uri of the location.
95 URI getAbsoluteLocation();
98 * A repository may allow additional locations that can be used, if the primary location is not available.
101 Set<URI> getFailoverLocations();
104 * True, if this repository is scanned regularly.
109 * Returns the definition, when the repository jobs are executed.
110 * This must return a valid a cron string.
112 * @See http://www.quartz-scheduler.org/api/2.2.1/org/quartz/CronExpression.html
116 String getSchedulingDefinition();
119 * Returns true, if this repository has a index available
125 * Returns a layout definition. The returned string may be implementation specific and is not
134 * Returns the capabilities of the repository implementation.
137 RepositoryCapabilities getCapabilities();
141 * Extension method that allows to provide different features that are not supported by all
144 * @param clazz The feature class that is requested
145 * @param <T> This is the class of the feature
146 * @return The feature implementation for this repository instance, if it is supported
147 * @throws UnsupportedFeatureException if the feature is not supported by this repository type
149 <T extends RepositoryFeature<T>> RepositoryFeature<T> getFeature(Class<T> clazz) throws UnsupportedFeatureException;
153 * Returns true, if the requested feature is supported by this repository.
155 * @param clazz The requested feature class
156 * @param <T> The requested feature class
157 * @return True, if the feature is supported, otherwise false.
159 <T extends RepositoryFeature<T>> boolean supportsFeature(Class<T> clazz);