This project has retired. For details please refer to its Attic page.
Repository xref
View Javadoc
1   package org.apache.archiva.repository;
2   
3   /*
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
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
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
19   * under the License.
20   */
21  
22  import org.apache.archiva.indexer.ArchivaIndexingContext;
23  import org.apache.archiva.event.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;
27  
28  import java.net.URI;
29  import java.util.Locale;
30  import java.util.Set;
31  
32  /**
33   *
34   * Base interface for repositories.
35   *
36   * Created by Martin Stockhammer on 21.09.17.
37   */
38  public interface Repository extends EventSource, RepositoryStorage {
39  
40      /**
41       * Return the identifier of the repository. Repository identifier should be unique at least
42       * for the same type.
43       * @return The identifier.
44       */
45      String getId();
46  
47      /**
48       * This is the display name of the repository. This string is presented in the user interface.
49       *
50       * @return The display name of the repository
51       */
52      String getName();
53  
54      /**
55       * Returns the name in the given locale.
56       * @param locale
57       * @return
58       */
59      String getName(Locale locale);
60  
61      /**
62       * Returns a description of this repository.
63       * @return The description.
64       */
65      String getDescription();
66  
67      /**
68       * Returns the description for the given locale.
69       * @param locale
70       * @return
71       */
72      String getDescription(Locale locale);
73  
74      /**
75       * This identifies the type of repository. Archiva does only support certain types of repositories.
76       *
77       * @return A unique identifier for the repository type.
78       */
79      RepositoryType getType();
80  
81  
82      /**
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.
86       *
87       * @return The repository location.
88       */
89      URI getLocation();
90  
91  
92      /**
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.
96       *
97       */
98      StorageAsset getLocalPath();
99  
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 }