Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
ExtensionRepository | 36 | 0 | - | 0 | 0 |
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 org.xwiki.extension.Extension; | |
23 | import org.xwiki.extension.ExtensionDependency; | |
24 | import org.xwiki.extension.ExtensionId; | |
25 | import org.xwiki.extension.ExtensionNotFoundException; | |
26 | import org.xwiki.extension.ResolveException; | |
27 | import org.xwiki.extension.repository.result.IterableResult; | |
28 | import org.xwiki.extension.version.Version; | |
29 | ||
30 | /** | |
31 | * A repository containing extensions. | |
32 | * | |
33 | * @version $Id: 5d9bb33118cae84bc5a00ffe81dda99b037b0630 $ | |
34 | * @since 4.0M1 | |
35 | */ | |
36 | public interface ExtensionRepository | |
37 | { | |
38 | /** | |
39 | * @return the repository descriptor | |
40 | * @since 4.3M1 | |
41 | */ | |
42 | ExtensionRepositoryDescriptor getDescriptor(); | |
43 | ||
44 | /** | |
45 | * Return extension descriptor from the repository. If the extension can't be found a {@link ResolveException} is | |
46 | * thrown. | |
47 | * | |
48 | * @param extensionId the extension identifier | |
49 | * @return the found extension descriptor | |
50 | * @throws ExtensionNotFoundException when the extension does not exist in the repository | |
51 | * @throws ResolveException failed to find extension in the repository | |
52 | */ | |
53 | Extension resolve(ExtensionId extensionId) throws ResolveException; | |
54 | ||
55 | /** | |
56 | * Return extension descriptor from the repository. If the extension can't be found a {@link ResolveException} is | |
57 | * thrown. | |
58 | * | |
59 | * @param extensionDependency the target extension as a dependency | |
60 | * @return the found extension descriptor | |
61 | * @throws ExtensionNotFoundException when the dependency does not match any extension in the repository | |
62 | * @throws ResolveException failed to find extension in the repository | |
63 | */ | |
64 | Extension resolve(ExtensionDependency extensionDependency) throws ResolveException; | |
65 | ||
66 | /** | |
67 | * Return ordered (ascendent) versions for the provided extension id. | |
68 | * | |
69 | * @param id the id of the extensions for which to return versions | |
70 | * @param offset the offset from where to start returning versions | |
71 | * @param nb the maximum number of versions to return | |
72 | * @return the versions of the provided extension id | |
73 | * @throws ExtensionNotFoundException when the extension does not exist in the repository | |
74 | * @throws ResolveException fail to find extension for provided id | |
75 | */ | |
76 | IterableResult<Version> resolveVersions(String id, int offset, int nb) throws ResolveException; | |
77 | ||
78 | /** | |
79 | * @param extensionId the extension identifier | |
80 | * @return true if the extension exists in the repository | |
81 | */ | |
82 | boolean exists(ExtensionId extensionId); | |
83 | ||
84 | // Deprecated | |
85 | ||
86 | /** | |
87 | * @return the repository identifier. | |
88 | * @deprecated since 4.3M1 use {@link #getDescriptor()} instead | |
89 | */ | |
90 | @Deprecated | |
91 | ExtensionRepositoryId getId(); | |
92 | } |