Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
ExtensionPlanAction | 34 | 1 | 0% | 1 | 2 | ||
ExtensionPlanAction.Action | 41 | 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.job.plan; | |
21 | ||
22 | import java.util.Collection; | |
23 | ||
24 | import org.xwiki.extension.Extension; | |
25 | import org.xwiki.extension.ExtensionRewriter; | |
26 | import org.xwiki.extension.InstalledExtension; | |
27 | ||
28 | /** | |
29 | * An action to perform as part of an extension plan. | |
30 | * | |
31 | * @version $Id: cf0e598a8b8a732f44705a887916cfcf67e0f532 $ | |
32 | * @since 4.0M1 | |
33 | */ | |
34 | public interface ExtensionPlanAction | |
35 | { | |
36 | /** | |
37 | * The action to execute. | |
38 | * | |
39 | * @version $Id: cf0e598a8b8a732f44705a887916cfcf67e0f532 $ | |
40 | */ | |
41 | enum Action | |
42 | { | |
43 | /** | |
44 | * Nothing to do. Just here for information as why nothing is done here. | |
45 | */ | |
46 | NONE, | |
47 | ||
48 | /** | |
49 | * Install the extension. | |
50 | */ | |
51 | INSTALL, | |
52 | ||
53 | /** | |
54 | * Upgrade the extension. | |
55 | */ | |
56 | UPGRADE, | |
57 | ||
58 | /** | |
59 | * Downgrade the extension. | |
60 | */ | |
61 | DOWNGRADE, | |
62 | ||
63 | /** | |
64 | * Uninstall the extension. | |
65 | */ | |
66 | UNINSTALL, | |
67 | ||
68 | /** | |
69 | * Repair the extension. | |
70 | * <p> | |
71 | * Mostly mean mark the extension as valid. | |
72 | * | |
73 | * @since 8.1M1 | |
74 | */ | |
75 | REPAIR | |
76 | } | |
77 | ||
78 | /** | |
79 | * @return the extension on which to perform the action | |
80 | */ | |
81 | Extension getExtension(); | |
82 | ||
83 | /** | |
84 | * @return the result of {@link ExtensionRewriter#rewrite(Extension)} on the extension on which to perform the | |
85 | * action | |
86 | * @since 8.4.2 | |
87 | * @since 9.0RC1 | |
88 | */ | |
89 | 0 | default Extension getRewrittenExtension() |
90 | { | |
91 | 0 | return getExtension(); |
92 | } | |
93 | ||
94 | /** | |
95 | * @return the currently installed extension. Used when upgrading. | |
96 | * @deprecated since 5.0RC1 used {@link #getPreviousExtensions()} instead | |
97 | */ | |
98 | @Deprecated | |
99 | InstalledExtension getPreviousExtension(); | |
100 | ||
101 | /** | |
102 | * @return the currently installed extensions. Used when upgrading. | |
103 | */ | |
104 | Collection<InstalledExtension> getPreviousExtensions(); | |
105 | ||
106 | /** | |
107 | * @return the action to perform | |
108 | */ | |
109 | Action getAction(); | |
110 | ||
111 | /** | |
112 | * @return the namespace in which the action should be executed | |
113 | */ | |
114 | String getNamespace(); | |
115 | ||
116 | /** | |
117 | * @return indicate indicate if the extension is a dependency of another one only in the plan | |
118 | */ | |
119 | boolean isDependency(); | |
120 | ||
121 | } |