1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.extension.repository

File ExtensionRepositoryManager.java

 

Coverage histogram

../../../../img/srcFileCovDistChart0.png
83% of files have more coverage

Code metrics

0
2
2
1
195
45
2
1
1
2
1

Classes

Class Line # Actions
ExtensionRepositoryManager 43 2 0% 2 4
0.00%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.extension.repository;
21   
22    import java.util.Collection;
23   
24    import org.xwiki.component.annotation.Role;
25    import org.xwiki.extension.Extension;
26    import org.xwiki.extension.ExtensionDependency;
27    import org.xwiki.extension.ExtensionId;
28    import org.xwiki.extension.ExtensionNotFoundException;
29    import org.xwiki.extension.ResolveException;
30    import org.xwiki.extension.repository.result.IterableResult;
31    import org.xwiki.extension.repository.search.AdvancedSearchable;
32    import org.xwiki.extension.repository.search.ExtensionQuery;
33    import org.xwiki.extension.repository.search.SearchException;
34    import org.xwiki.extension.version.Version;
35   
36    /**
37    * Proxy repository in to make easier to search in all remove extension repositories.
38    *
39    * @version $Id: 946a78518d15ab1b203d46b40df0bff4e348b1d9 $
40    * @since 4.0M1
41    */
42    @Role
 
43    public interface ExtensionRepositoryManager extends ExtensionRepository, AdvancedSearchable
44    {
45    /**
46    * The default priority for extension repository ordering.
47    *
48    * @since 8.3M1
49    */
50    int DEFAULT_PRIORITY = 500;
51   
52    /**
53    * Create and add a new repository.
54    *
55    * @param repositoryId the repository identifier
56    * @return the newly created repository
57    * @throws ExtensionRepositoryException failed to create {@link ExtensionRepository} for provided identifier
58    * @deprecated since 4.3M1 use {@link #addRepository(ExtensionRepositoryDescriptor)} instead
59    */
60    @Deprecated
61    ExtensionRepository addRepository(ExtensionRepositoryId repositoryId) throws ExtensionRepositoryException;
62   
63    /**
64    * Create and add a new repository.
65    *
66    * @param repositoryDescriptor the repository descriptor
67    * @return the newly created repository
68    * @throws ExtensionRepositoryException failed to create {@link ExtensionRepository} for provided identifier
69    * @since 4.3M1
70    */
71    ExtensionRepository addRepository(ExtensionRepositoryDescriptor repositoryDescriptor)
72    throws ExtensionRepositoryException;
73   
74    /**
75    * Create and add a new repository.
76    *
77    * @param priority the priority in the list of repositories
78    * @param repositoryDescriptor the repository descriptor
79    * @return the newly created repository
80    * @throws ExtensionRepositoryException failed to create {@link ExtensionRepository} for provided identifier
81    * @since 8.3M1
82    */
 
83  0 toggle default ExtensionRepository addRepository(ExtensionRepositoryDescriptor repositoryDescriptor, int priority)
84    throws ExtensionRepositoryException
85    {
86  0 return addRepository(repositoryDescriptor);
87    }
88   
89    /**
90    * @param repository add an existing repository
91    */
92    void addRepository(ExtensionRepository repository);
93   
94    /**
95    * @param priority the priority in the list of repositories
96    * @param repository add an existing repository
97    * @since 8.3M1
98    */
 
99  0 toggle default void addRepository(ExtensionRepository repository, int priority)
100    {
101  0 addRepository(repository);
102    }
103   
104    /**
105    * Remove a repository form the list.
106    *
107    * @param repositoryId the repository unique identifier
108    * @see ExtensionRepository#getId()
109    */
110    void removeRepository(String repositoryId);
111   
112    /**
113    * @param repositoryId the repository unique identifier
114    * @return the repository, null if none could be found
115    * @see ExtensionRepository#getId()
116    */
117    ExtensionRepository getRepository(String repositoryId);
118   
119    /**
120    * @return the repositories
121    */
122    Collection<ExtensionRepository> getRepositories();
123   
124    // ExtensionRepository
125   
126    /**
127    * Get extension descriptor found in one of the repositories.
128    * <p>
129    * The proxy search in all repositories and return the first extension it could find.
130    *
131    * @param extensionId the extension identifier
132    * @return the found extension descriptor
133    * @throws ExtensionNotFoundException when the extension does not exist in any of the repositories
134    * @throws ResolveException failed to find extension in the repository
135    */
136    @Override
137    Extension resolve(ExtensionId extensionId) throws ResolveException;
138   
139    /**
140    * Get extension descriptor found in one of the repositories.
141    * <p>
142    * The proxy search in all repositories and return the first extension it could find.
143    * <p>
144    * This method takes {@link ExtensionDependency} instead of {@link ExtensionId} to allow any implementation of
145    * {@link ExtensionRepository} to extension dependencies with filter not supported yet by Extension Manage. As an
146    * example Aether implementation add support from classifiers, excludes and version ranges.
147    *
148    * @param extensionDependency the extension dependency
149    * @return the found extension descriptor
150    * @throws ExtensionNotFoundException when the dependency does not match any extension in any of the repositories
151    * @throws ResolveException failed to find extension in the repository
152    */
153    @Override
154    Extension resolve(ExtensionDependency extensionDependency) throws ResolveException;
155   
156    /**
157    * Return ordered (ascendent) versions for the provided extension id.
158    *
159    * @param id the id of the extensions for which to return versions
160    * @param offset the offset from where to start returning versions
161    * @param nb the maximum number of versions to return
162    * @return the versions of the provided extension id
163    * @throws ExtensionNotFoundException when the extension does not exist in any of the repositories
164    * @throws ResolveException fail to find extension for provided id
165    */
166    @Override
167    IterableResult<Version> resolveVersions(String id, int offset, int nb) throws ResolveException;
168   
169    // AdvancedSearchable
170   
171    /**
172    * Search among all repositories implementing {@link org.xwiki.extension.repository.search.Searchable} interface.
173    *
174    * @param pattern the pattern to search
175    * @param offset the offset from where to start returning search results, 0-based
176    * @param nb the maximum number of search results to return. -1 indicate no limit. 0 indicate that no result will be
177    * returned but it can be used to get the total hits.
178    * @return the found extensions descriptors, empty list if nothing could be found
179    * @see org.xwiki.extension.repository.search.Searchable
180    */
181    @Override
182    IterableResult<Extension> search(String pattern, int offset, int nb) throws SearchException;
183   
184    /**
185    * Search among all repositories implementing {@link org.xwiki.extension.repository.search.AdvancedSearchable}
186    * interface.
187    *
188    * @param query the query
189    * @return the found extensions descriptors, empty list if nothing could be found
190    * @see org.xwiki.extension.repository.search.AdvancedSearchable
191    * @since 7.1M1
192    */
193    @Override
194    IterableResult<Extension> search(ExtensionQuery query) throws SearchException;
195    }