This project has retired. For details please refer to its Attic page.
Source code
001package org.apache.archiva.repository;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *  http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022import org.apache.archiva.indexer.ArchivaIndexingContext;
023import org.apache.archiva.event.EventSource;
024import org.apache.archiva.repository.storage.RepositoryStorage;
025import org.apache.archiva.repository.features.RepositoryFeature;
026import org.apache.archiva.repository.storage.StorageAsset;
027
028import java.net.URI;
029import java.util.Locale;
030import java.util.Set;
031
032/**
033 *
034 * Base interface for repositories.
035 *
036 * Created by Martin Stockhammer on 21.09.17.
037 */
038public interface Repository extends EventSource, RepositoryStorage {
039
040    /**
041     * Return the identifier of the repository. Repository identifier should be unique at least
042     * for the same type.
043     * @return The identifier.
044     */
045    String getId();
046
047    /**
048     * This is the display name of the repository. This string is presented in the user interface.
049     *
050     * @return The display name of the repository
051     */
052    String getName();
053
054    /**
055     * Returns the name in the given locale.
056     * @param locale
057     * @return
058     */
059    String getName(Locale locale);
060
061    /**
062     * Returns a description of this repository.
063     * @return The description.
064     */
065    String getDescription();
066
067    /**
068     * Returns the description for the given locale.
069     * @param locale
070     * @return
071     */
072    String getDescription(Locale locale);
073
074    /**
075     * This identifies the type of repository. Archiva does only support certain types of repositories.
076     *
077     * @return A unique identifier for the repository type.
078     */
079    RepositoryType getType();
080
081
082    /**
083     * Returns the location of this repository. For local repositories this might be a file URI, for
084     * remote repositories a http URL or some very repository specific schemes.
085     * Each repository has only one unique location.
086     *
087     * @return The repository location.
088     */
089    URI getLocation();
090
091
092    /**
093     * Returns a storage representation to the local data stored for this repository.
094     * The repository implementation may not store the real artifacts in this path. The directory structure
095     * is completely implementation dependant.
096     *
097     */
098    StorageAsset getLocalPath();
099
100
101    /**
102     * A repository may allow additional locations that can be used, if the primary location is not available.
103     * @return
104     */
105    Set<URI> getFailoverLocations();
106
107    /**
108     * True, if this repository is scanned regularly.
109     */
110    boolean isScanned();
111
112    /**
113     * Returns the definition, when the repository jobs are executed.
114     * This must return a valid a cron string.
115     *
116     * @See http://www.quartz-scheduler.org/api/2.2.1/org/quartz/CronExpression.html
117     *
118     * @return
119     */
120    String getSchedulingDefinition();
121
122    /**
123     * Returns true, if this repository has a index available
124     * @return
125     */
126    boolean hasIndex();
127
128    /**
129     * Returns a layout definition. The returned string may be implementation specific and is not
130     * standardized.
131     *
132     * @return
133     */
134    String getLayout();
135
136
137    /**
138     * Returns the capabilities of the repository implementation.
139     * @return
140     */
141    RepositoryCapabilities getCapabilities();
142
143
144    /**
145     * Extension method that allows to provide different features that are not supported by all
146     * repository types.
147     *
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
152     */
153    <T extends RepositoryFeature<T>> RepositoryFeature<T> getFeature(Class<T> clazz) throws UnsupportedFeatureException;
154
155
156    /**
157     * Returns true, if the requested feature is supported by this repository.
158     *
159     * @param clazz The requested feature class
160     * @param <T> The requested feature class
161     * @return True, if the feature is supported, otherwise false.
162     */
163    <T extends RepositoryFeature<T>> boolean supportsFeature(Class<T> clazz);
164
165
166    /**
167     * Returns a indexing context.
168     * @return
169     * @throws UnsupportedOperationException
170     */
171    ArchivaIndexingContext getIndexingContext();
172
173    /**
174     * Closes all resources that are opened by this repository.
175     */
176    void close();
177
178    /**
179     * Returns the current status of this repository.
180     *
181     * @return <code>true</code>, if repository has not been closed, otherwise <code>false</code>
182     */
183    boolean isOpen();
184
185
186}