Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
ExtensionRequest | 39 | 7 | 0% | 4 | 4 |
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; | |
21 | ||
22 | import java.beans.Transient; | |
23 | import java.util.Arrays; | |
24 | import java.util.Collection; | |
25 | import java.util.List; | |
26 | ||
27 | import org.xwiki.extension.Extension; | |
28 | import org.xwiki.extension.ExtensionRewriter; | |
29 | import org.xwiki.extension.ExtensionId; | |
30 | import org.xwiki.job.Request; | |
31 | import org.xwiki.stability.Unstable; | |
32 | ||
33 | /** | |
34 | * Extension manipulation related {@link Request}. | |
35 | * | |
36 | * @version $Id: b22e5d403060bb91e548438ddb49b09c0c04dc9c $ | |
37 | * @since 4.0M1 | |
38 | */ | |
39 | public interface ExtensionRequest extends Request | |
40 | { | |
41 | /** | |
42 | * The prefix put behind all job ids. | |
43 | * | |
44 | * @since 8.2RC1 | |
45 | */ | |
46 | String JOBID_PREFIX = "extension"; | |
47 | ||
48 | /** | |
49 | * The prefix put behind all job ids which are actual actions. | |
50 | * | |
51 | * @since 8.2RC1 | |
52 | */ | |
53 | String JOBID_ACTION_PREFIX = "action"; | |
54 | ||
55 | /** | |
56 | * The prefix put behind all job ids which are information gathering. | |
57 | * | |
58 | * @since 8.2RC1 | |
59 | */ | |
60 | String JOBID_PLAN_PREFIX = "plan"; | |
61 | ||
62 | /** | |
63 | * @param prefix the prefix, usually {@link ExtensionRequest#JOBID_ACTION_PREFIX} or | |
64 | * {@link ExtensionRequest#JOBID_PLAN_PREFIX} | |
65 | * @param extensionId the id of the extension for which to create a job id | |
66 | * @param namespace the namespace for which to create a job id | |
67 | * @return the job id | |
68 | * @since 8.2RC1 | |
69 | */ | |
70 | 4139 | static List<String> getJobId(String prefix, String extensionId, String namespace) |
71 | { | |
72 | 4139 | List<String> jobId; |
73 | ||
74 | 4139 | if (namespace != null) { |
75 | 2101 | jobId = Arrays.asList(JOBID_PREFIX, prefix, extensionId, namespace); |
76 | } else { | |
77 | 2038 | jobId = Arrays.asList(JOBID_PREFIX, prefix, extensionId); |
78 | } | |
79 | ||
80 | 4139 | return jobId; |
81 | } | |
82 | ||
83 | /** | |
84 | * @return the extension on which to apply the task. | |
85 | */ | |
86 | Collection<ExtensionId> getExtensions(); | |
87 | ||
88 | /** | |
89 | * @return the namespaces on which to apply the task. | |
90 | */ | |
91 | Collection<String> getNamespaces(); | |
92 | ||
93 | /** | |
94 | * @return indicate if the request is applied on specific namespace or all of them | |
95 | */ | |
96 | boolean hasNamespaces(); | |
97 | ||
98 | /** | |
99 | * @return indicate if it's allowed to do modifications on root namespace during the job execution (not taken into | |
100 | * account if the target of the request is root namespace) | |
101 | * @since 8.1M1 | |
102 | */ | |
103 | 0 | default boolean isRootModificationsAllowed() |
104 | { | |
105 | 0 | return true; |
106 | } | |
107 | ||
108 | /** | |
109 | * Allow modifying manipulated {@link Extension}s on the fly (change allowed namespaces, dependencies, etc.). | |
110 | * | |
111 | * @return the filter | |
112 | * @since 8.4.2 | |
113 | * @since 9.0RC1 | |
114 | */ | |
115 | 0 | @Transient |
116 | @Unstable | |
117 | default ExtensionRewriter getRewriter() | |
118 | { | |
119 | 0 | return null; |
120 | } | |
121 | } |