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.delta;
35
36 import info.magnolia.cms.util.WorkspaceXmlUtil;
37
38 import java.util.List;
39
40
41
42
43
44 public class WorkspaceXmlConditionsUtil {
45 private final List<Condition> conditions;
46
47 public WorkspaceXmlConditionsUtil(List<Condition> conditions) {
48 this.conditions = conditions;
49 }
50
51
52
53
54 public void workspaceHasOldIndexer() {
55 textFilterClassesAreNotSet();
56 }
57
58 public void textFilterClassesAreNotSet() {
59 List<String> names = WorkspaceXmlUtil.getWorkspaceNamesMatching("/Workspace/SearchIndex/param[@name='textFilterClasses']/@value");
60
61 if (names.size() > 0) {
62 for (int i = 0; i < names.size(); i++) {
63 conditions.add(new FalseCondition("workspace.xml updates",
64 "Workspace definition in workspace " + names.get(i) +
65 " references indexer which has changed; please remove the parameter 'textFilterClasses'."));
66 }
67 }
68 }
69
70
71
72
73 public void paramAnalyzerIsNotSet() {
74 List<String> names = WorkspaceXmlUtil.getWorkspaceNamesMatching("/Workspace/SearchIndex/param[@name='analyzer']/@value");
75 if (names.size() > 0) {
76 for (int i = 0; i < names.size(); i++) {
77 conditions.add(new WarnCondition("workspace.xml updates",
78 "Workspace definition in workspace " + names.get(i) +
79 " Should not have an analyzer set - this will lead to error-logs when strarting up your server."));
80 }
81 }
82 }
83
84 public void accessControlProviderIsSet() {
85 List<String> names = WorkspaceXmlUtil.getWorkspaceNames("/Workspace/WorkspaceSecurity/AccessControlProvider/@class", null);
86 if (names.size() > 0) {
87 for (int i = 0; i < names.size(); i++) {
88 conditions.add(new FalseCondition("workspace.xml updates",
89 "Workspace definition in workspace " + names.get(i) +
90 " must have an AccessControlProvider set."));
91 }
92 }
93 }
94 }