Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
InstalledExtension | 33 | 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; | |
21 | ||
22 | import java.util.Collection; | |
23 | import java.util.Date; | |
24 | ||
25 | /** | |
26 | * Represent a local extension. | |
27 | * <p> | |
28 | * An installed extension. | |
29 | * | |
30 | * @version $Id: aa8143c4be0c26cf0e5a998d14f154e35ba5f73d $ | |
31 | * @since 4.0M2 | |
32 | */ | |
33 | public interface InstalledExtension extends LocalExtension | |
34 | { | |
35 | /** | |
36 | * The prefix that should be used by all custom extension properties that are specific to installed extensions. | |
37 | * | |
38 | * @since 7.0M2 | |
39 | */ | |
40 | String PKEY_PREFIX = "installed."; | |
41 | ||
42 | /** | |
43 | * Custom property key containing {@link #isInstalled()}. | |
44 | */ | |
45 | String PKEY_INSTALLED = PKEY_PREFIX + "installed"; | |
46 | ||
47 | /** | |
48 | * Custom property key containing {@link #getNamespaces()}. | |
49 | * <p> | |
50 | * Since 4.3M1 it's a {@code Map<String, Object>}. | |
51 | */ | |
52 | String PKEY_NAMESPACES = PKEY_PREFIX + "namespaces"; | |
53 | ||
54 | /** | |
55 | * Custom property key containing the namespace. | |
56 | */ | |
57 | String PKEY_NAMESPACES_NAMESPACE = PKEY_NAMESPACES + ".namespace"; | |
58 | ||
59 | /** | |
60 | * Custom property key containing {@link #isDependency(String)}. | |
61 | */ | |
62 | String PKEY_NAMESPACES_DEPENDENCY = PKEY_NAMESPACES + ".dependency"; | |
63 | ||
64 | /** | |
65 | * Custom property key containing {@link #isDependency(String)} with <code>null</code> namespace. | |
66 | */ | |
67 | String PKEY_DEPENDENCY = PKEY_PREFIX + "dependency"; | |
68 | ||
69 | /** | |
70 | * @return the actual extension | |
71 | */ | |
72 | LocalExtension getLocalExtension(); | |
73 | ||
74 | /** | |
75 | * @return indicate if the extension is installed | |
76 | */ | |
77 | boolean isInstalled(); | |
78 | ||
79 | /** | |
80 | * Indicate if the extension is installed in the provided namespace. | |
81 | * | |
82 | * @param namespace the namespace to look at, if null it means the extension is installed on the root namespace | |
83 | * @return true if the extension is installed in the provided namespace | |
84 | */ | |
85 | boolean isInstalled(String namespace); | |
86 | ||
87 | /** | |
88 | * Indicate if the extension is working. | |
89 | * <p> | |
90 | * An installed extension can be invalid for example when one of the core extensions has been changed and is now | |
91 | * incompatible with this installed extension. | |
92 | * | |
93 | * @param namespace the namespace to look at, if null it means the extension is installed on the root namespace | |
94 | * @return true is valid | |
95 | * @since 4.2M1 | |
96 | */ | |
97 | boolean isValid(String namespace); | |
98 | ||
99 | /** | |
100 | * @return the namespaces in which this extension is enabled. null means root namespace (i.e all namespaces). | |
101 | */ | |
102 | Collection<String> getNamespaces(); | |
103 | ||
104 | /** | |
105 | * Indicate if the extension as been installed as a dependency of another one. | |
106 | * <p> | |
107 | * The idea is to be able to make the difference between extension specifically installed by a user so that it's | |
108 | * possible to know which extension are not really required anymore. | |
109 | * | |
110 | * @param namespace the namespace to look at, null indicate the root namespace | |
111 | * @return true if the the extension has been installed only because it was a dependency of another extension | |
112 | */ | |
113 | boolean isDependency(String namespace); | |
114 | ||
115 | /** | |
116 | * @param namespace the namespace to look at, {@code null} indicates the root namespace | |
117 | * @return the date when this extension has been installed on the specified namespace, {@code null} if the install | |
118 | * date is not available or if this extension is not installed on the specified namespace | |
119 | * @since 7.0M2 | |
120 | */ | |
121 | Date getInstallDate(String namespace); | |
122 | ||
123 | /** | |
124 | * An installed extension can have different values for its properties depending on the namespace where it is | |
125 | * installed. This method allows us to access the value of a specific extension property on a given namespace. | |
126 | * | |
127 | * @param key the name of the property to look for | |
128 | * @param namespace the namespace to look at, {@code null} indicates the root namespace | |
129 | * @return the value of the specified extension property on the given namespace | |
130 | * @since 7.0M2 | |
131 | */ | |
132 | Object getNamespaceProperty(String key, String namespace); | |
133 | ||
134 | // Deprecated | |
135 | ||
136 | /** | |
137 | * Indicate if the extension as been installed as a dependency of another one. | |
138 | * <p> | |
139 | * The idea is to be able to make the difference between extension specifically installed by a user so that it's | |
140 | * possible to know which extension are not really required anymore. | |
141 | * | |
142 | * @return true if the the extension has been installed only because it was a dependency of another extension | |
143 | * @deprecated since 4.3M1 use {@link #isDependency(String)} with <code>null</code> namespace instead | |
144 | */ | |
145 | @Deprecated | |
146 | boolean isDependency(); | |
147 | } |