Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
ExtensionHandler | 40 | 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.handler; | |
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.ExtensionException; | |
27 | import org.xwiki.extension.InstallException; | |
28 | import org.xwiki.extension.InstalledExtension; | |
29 | import org.xwiki.extension.LocalExtension; | |
30 | import org.xwiki.extension.UninstallException; | |
31 | import org.xwiki.job.Request; | |
32 | ||
33 | /** | |
34 | * Handle extension related tasks depending of the type (install, uninstall, etc...). | |
35 | * | |
36 | * @version $Id: d9c3dd8352957f07c51a9b1f24eae1df42764aea $ | |
37 | * @since 4.0M1 | |
38 | */ | |
39 | @Role | |
40 | public interface ExtensionHandler | |
41 | { | |
42 | /** | |
43 | * Install the provided local extension. | |
44 | * | |
45 | * @param localExtension the extension to install | |
46 | * @param namespace the namespace where to install the extension | |
47 | * @param request extra parameters | |
48 | * @throws InstallException error when trying to install the extension | |
49 | */ | |
50 | void install(LocalExtension localExtension, String namespace, Request request) throws InstallException; | |
51 | ||
52 | /** | |
53 | * Uninstall the provided local extension. | |
54 | * | |
55 | * @param localExtension the extension to uninstall | |
56 | * @param namespace the namespace from where to uninstall the extension | |
57 | * @param request extra parameters | |
58 | * @throws UninstallException error when trying to uninstall the extension | |
59 | * @deprecated starting with 5.ORC1 use {@link #uninstall(InstalledExtension, String, Request)} instead | |
60 | */ | |
61 | @Deprecated | |
62 | void uninstall(LocalExtension localExtension, String namespace, Request request) throws UninstallException; | |
63 | ||
64 | /** | |
65 | * Uninstall the provided local extension. | |
66 | * | |
67 | * @param localExtension the extension to uninstall | |
68 | * @param namespace the namespace from where to uninstall the extension | |
69 | * @param request extra parameters | |
70 | * @throws UninstallException error when trying to uninstall the extension | |
71 | * @since 5.0RC1 | |
72 | */ | |
73 | void uninstall(InstalledExtension localExtension, String namespace, Request request) throws UninstallException; | |
74 | ||
75 | /** | |
76 | * Upgrade the provided local extension. | |
77 | * | |
78 | * @param previousLocalExtension the previous installed version of the extension | |
79 | * @param newLocalExtension the extension to install | |
80 | * @param namespace the namespace from where to uninstall the extension | |
81 | * @param request extra parameters | |
82 | * @throws InstallException error when trying to upgrade the extension | |
83 | * @deprecated starting with 5.0RC1 use {@link #upgrade(Collection, LocalExtension, String, Request)} | |
84 | */ | |
85 | @Deprecated | |
86 | void upgrade(LocalExtension previousLocalExtension, LocalExtension newLocalExtension, String namespace, | |
87 | Request request) throws InstallException; | |
88 | ||
89 | /** | |
90 | * Upgrade the provided local extension. | |
91 | * | |
92 | * @param previousLocalExtensions the previous installed versions of the extension | |
93 | * @param newLocalExtension the extension to install | |
94 | * @param namespace the namespace from where to uninstall the extension | |
95 | * @param request extra parameters | |
96 | * @throws InstallException error when trying to upgrade the extension | |
97 | * @since 5.0RC1 | |
98 | */ | |
99 | void upgrade(Collection<InstalledExtension> previousLocalExtensions, LocalExtension newLocalExtension, | |
100 | String namespace, Request request) throws InstallException; | |
101 | ||
102 | /** | |
103 | * Initialize the provided local extension (during application startup, re-initialization...). | |
104 | * | |
105 | * @param localExtension the extension to install | |
106 | * @param namespace the namespace where to install the extension | |
107 | * @throws ExtensionException error when trying to install the extension | |
108 | */ | |
109 | void initialize(LocalExtension localExtension, String namespace) throws ExtensionException; | |
110 | ||
111 | /** | |
112 | * Check if installing the passed extension is allowed. | |
113 | * <p> | |
114 | * It is generally used to do some non generic checking of whether or not it is possible to install the passed | |
115 | * extension (not the right environment, not enough rights, etc.). | |
116 | * | |
117 | * @param extension the extension to install | |
118 | * @param namespace the namespace from where to install | |
119 | * @param request extra parameters | |
120 | * @throws InstallException installing the extension will fail | |
121 | * @since 4.2M2 | |
122 | */ | |
123 | void checkInstall(Extension extension, String namespace, Request request) throws InstallException; | |
124 | ||
125 | /** | |
126 | * Check if uninstalling the passed extension is allowed. | |
127 | * <p> | |
128 | * It is generally used to do some non generic checking of whether or not it is possible to uninstall the passed | |
129 | * extension (not the right environment, not enough rights, etc.). | |
130 | * | |
131 | * @param extension the extension to uninstall | |
132 | * @param namespace the namespace from where to uninstall | |
133 | * @param request extra parameters | |
134 | * @throws UninstallException uninstalling the extension will fail | |
135 | * @since 4.2M2 | |
136 | */ | |
137 | void checkUninstall(InstalledExtension extension, String namespace, Request request) throws UninstallException; | |
138 | } |