1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
package info.magnolia.module.resources.setup; |
35 |
|
|
36 |
|
import info.magnolia.cms.util.ClasspathResourcesUtil; |
37 |
|
import info.magnolia.module.InstallContext; |
38 |
|
import info.magnolia.module.delta.ArrayDelegateTask; |
39 |
|
import info.magnolia.module.delta.TaskExecutionException; |
40 |
|
|
41 |
|
import org.apache.commons.lang3.StringUtils; |
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
@deprecated@link@link |
47 |
|
|
|
|
| 0% |
Uncovered Elements: 37 (37) |
Complexity: 14 |
Complexity Density: 0.67 |
|
48 |
|
public class InstallResourcesTask extends ArrayDelegateTask { |
49 |
|
protected String pattern; |
50 |
|
|
51 |
|
protected String template; |
52 |
|
|
53 |
|
private final String modelClass; |
54 |
|
|
55 |
|
private final boolean binary; |
56 |
|
|
57 |
|
private final boolean preserveResourcesParameters; |
58 |
|
|
59 |
|
|
60 |
|
@deprecated@link |
61 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
62 |
0 |
public InstallResourcesTask(String pattern, String template) {... |
63 |
0 |
this(pattern, template, false); |
64 |
|
} |
65 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
66 |
0 |
public InstallResourcesTask(String pattern, String template, boolean binary) {... |
67 |
0 |
this(pattern, template, binary, null); |
68 |
|
} |
69 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
70 |
0 |
public InstallResourcesTask(String pattern, String template, boolean binary, boolean preserveResourcesParameters) {... |
71 |
0 |
this(pattern, template, binary, null, preserveResourcesParameters); |
72 |
|
} |
73 |
|
|
74 |
|
|
75 |
|
@deprecated@link |
76 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
77 |
0 |
public InstallResourcesTask(String pattern, String template, String modelClass) {... |
78 |
0 |
this(pattern, template, false, modelClass); |
79 |
|
} |
80 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
81 |
0 |
public InstallResourcesTask(String pattern, String template, boolean binary, String modelClass) {... |
82 |
0 |
this("Install resources", "Installs all resources matching the " + pattern + " pattern.", pattern, template, binary, modelClass); |
83 |
|
} |
84 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
85 |
0 |
public InstallResourcesTask(String pattern, String template, boolean binary, String modelClass, boolean preserveTemplate) {... |
86 |
0 |
this("Install resources", "Installs all resources matching the " + pattern + " pattern.", pattern, template, binary, modelClass, preserveTemplate); |
87 |
|
} |
88 |
|
|
89 |
|
|
90 |
|
@deprecated@link |
91 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
92 |
0 |
public InstallResourcesTask(String taskName, String taskDescription, String pattern, String template, String modelClass) {... |
93 |
0 |
this(taskName, taskDescription, pattern, template, false, modelClass); |
94 |
|
} |
95 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
96 |
0 |
public InstallResourcesTask(String taskName, String taskDescription, String pattern, String template, boolean binary, String modelClass) {... |
97 |
0 |
this(taskName, taskDescription, pattern, template, binary, modelClass, false); |
98 |
|
} |
99 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
100 |
0 |
public InstallResourcesTask(String taskName, String taskDescription, String pattern, String template, boolean binary, String modelClass, boolean preserveResourcesParameters) {... |
101 |
0 |
super(taskName, taskDescription); |
102 |
0 |
this.pattern = pattern; |
103 |
0 |
this.template = template; |
104 |
0 |
this.modelClass = modelClass; |
105 |
0 |
this.binary = binary; |
106 |
0 |
this.preserveResourcesParameters = preserveResourcesParameters; |
107 |
|
} |
108 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
109 |
0 |
@Override... |
110 |
|
public void execute(InstallContext ctx) throws TaskExecutionException { |
111 |
0 |
final String[] resources = findResources(); |
112 |
|
|
113 |
0 |
for (int i = 0; i < resources.length; i++) { |
114 |
0 |
String resource = resources[i]; |
115 |
0 |
String template = determineTemplate(resource); |
116 |
0 |
new InstallResourceTask(resource, template, binary, modelClass, preserveResourcesParameters).execute(ctx); |
117 |
|
} |
118 |
|
} |
119 |
|
|
120 |
|
|
121 |
|
|
122 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
123 |
0 |
protected String determineTemplate(String resource) {... |
124 |
0 |
return template != null ? template : StringUtils.substringAfterLast(resource, "."); |
125 |
|
} |
126 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
127 |
0 |
protected String[] findResources() {... |
128 |
0 |
return ClasspathResourcesUtil.findResources(pattern); |
129 |
|
} |
130 |
|
|
131 |
|
} |