1
19
20 package com.liferay.portal.verify;
21
22 import com.liferay.portal.kernel.log.Log;
23 import com.liferay.portal.kernel.log.LogFactoryUtil;
24 import com.liferay.portal.util.PropsUtil;
25 import com.liferay.util.SystemProperties;
26
27
33 public class VerifyProperties extends VerifyProcess {
34
35 public void verify() throws VerifyException {
36 _log.info("Verifying");
37
38 try {
39 verifyProperties();
40 }
41 catch (Exception e) {
42 throw new VerifyException(e);
43 }
44 }
45
46 protected void verifyProperties() throws Exception {
47
48
50 for (String[] keys : _MIGRATED_SYSTEM_KEYS) {
51 String oldKey = keys[0];
52 String newKey = keys[1];
53
54 verifyMigratedSystemProperty(oldKey, newKey);
55 }
56
57 for (String[] keys : _RENAMED_SYSTEM_KEYS) {
58 String oldKey = keys[0];
59 String newKey = keys[1];
60
61 verifyRenamedSystemProperty(oldKey, newKey);
62 }
63
64 for (String key : _OBSOLETE_SYSTEM_KEYS) {
65 verifyObsoleteSystemProperty(key);
66 }
67
68
70 for (String[] keys : _RENAMED_PORTAL_KEYS) {
71 String oldKey = keys[0];
72 String newKey = keys[1];
73
74 verifyRenamedPortalProperty(oldKey, newKey);
75 }
76
77 for (String key : _OBSOLETE_PORTAL_KEYS) {
78 verifyObsoletePortalProperty(key);
79 }
80 }
81
82 protected void verifyMigratedSystemProperty(String oldKey, String newKey)
83 throws Exception {
84
85 String value = SystemProperties.get(oldKey);
86
87 if (value != null) {
88 _log.error(
89 "System property \"" + oldKey +
90 "\" was migrated to the portal property \"" + newKey +
91 "\"");
92 }
93 }
94
95 protected void verifyRenamedPortalProperty(String oldKey, String newKey)
96 throws Exception {
97
98 String value = PropsUtil.get(oldKey);
99
100 if (value != null) {
101 _log.error(
102 "Portal property \"" + oldKey + "\" was renamed to \"" +
103 newKey + "\"");
104 }
105 }
106
107 protected void verifyRenamedSystemProperty(String oldKey, String newKey)
108 throws Exception {
109
110 String value = SystemProperties.get(oldKey);
111
112 if (value != null) {
113 _log.error(
114 "System property \"" + oldKey + "\" was renamed to \"" +
115 newKey + "\"");
116 }
117 }
118
119 protected void verifyObsoletePortalProperty(String key) throws Exception {
120 String value = PropsUtil.get(key);
121
122 if (value != null) {
123 _log.error("Portal property \"" + key + "\" is obsolete");
124 }
125 }
126
127 protected void verifyObsoleteSystemProperty(String key) throws Exception {
128 String value = SystemProperties.get(key);
129
130 if (value != null) {
131 _log.error("System property \"" + key + "\" is obsolete");
132 }
133 }
134
135 private static final String[][] _MIGRATED_SYSTEM_KEYS = new String[][] {
136 new String[] {
137 "com.liferay.filters.compression.CompressionFilter",
138 "com.liferay.portal.servlet.filters.gzip.GZipFilter"
139 },
140 new String[] {
141 "com.liferay.filters.doubleclick.DoubleClickFilter",
142 "com.liferay.portal.servlet.filters.doubleclick.DoubleClickFilter"
143 },
144 new String[] {
145 "com.liferay.filters.strip.StripFilter",
146 "com.liferay.portal.servlet.filters.strip.StripFilter"
147 },
148 new String[] {
149 "com.liferay.util.Http.max.connections.per.host",
150 "com.liferay.portal.util.HttpImpl.max.connections.per.host"
151 },
152 new String[] {
153 "com.liferay.util.Http.max.total.connections",
154 "com.liferay.portal.util.HttpImpl.max.total.connections"
155 },
156 new String[] {
157 "com.liferay.util.Http.proxy.auth.type",
158 "com.liferay.portal.util.HttpImpl.proxy.auth.type"
159 },
160 new String[] {
161 "com.liferay.util.Http.proxy.ntlm.domain",
162 "com.liferay.portal.util.HttpImpl.proxy.ntlm.domain"
163 },
164 new String[] {
165 "com.liferay.util.Http.proxy.ntlm.host",
166 "com.liferay.portal.util.HttpImpl.proxy.ntlm.host"
167 },
168 new String[] {
169 "com.liferay.util.Http.proxy.password",
170 "com.liferay.portal.util.HttpImpl.proxy.password"
171 },
172 new String[] {
173 "com.liferay.util.Http.proxy.username",
174 "com.liferay.portal.util.HttpImpl.proxy.username"
175 },
176 new String[] {
177 "com.liferay.util.Http.timeout",
178 "com.liferay.portal.util.HttpImpl.timeout"
179 },
180 new String[] {
181 "com.liferay.util.servlet.UploadServletRequest.max.size",
182 "com.liferay.portal.upload.UploadServletRequestImpl.max.size"
183 },
184 new String[] {
185 "com.liferay.util.servlet.UploadServletRequest.temp.dir",
186 "com.liferay.portal.upload.UploadServletRequestImpl.temp.dir"
187 },
188 new String[] {
189 "com.liferay.util.servlet.fileupload.LiferayFileItem." +
190 "threshold.size",
191 "com.liferay.portal.upload.LiferayFileItem.threshold.size"
192 },
193 new String[] {
194 "com.liferay.util.servlet.fileupload.LiferayInputStream." +
195 "threshold.size",
196 "com.liferay.portal.upload.LiferayInputStream.threshold.size"
197 }
198 };
199
200 private static final String[] _OBSOLETE_PORTAL_KEYS = new String[] {
201 "auth.simultaneous.logins",
202 "xss.allow"
203 };
204
205 private static final String[] _OBSOLETE_SYSTEM_KEYS = new String[] {
206 "com.liferay.util.Http.proxy.host",
207 "com.liferay.util.Http.proxy.port",
208 "com.liferay.util.XSSUtil.regexp.pattern"
209 };
210
211 private static final String[][] _RENAMED_PORTAL_KEYS = new String[][] {
212 new String[] {
213 "amazon.license.0",
214 "amazon.access.key.id"
215 },
216 new String[] {
217 "amazon.license.1",
218 "amazon.access.key.id"
219 },
220 new String[] {
221 "amazon.license.2",
222 "amazon.access.key.id"
223 },
224 new String[] {
225 "amazon.license.3",
226 "amazon.access.key.id"
227 },
228 new String[] {
229 "com.liferay.portal.servlet.filters.compression.CompressionFilter",
230 "com.liferay.portal.servlet.filters.gzip.GZipFilter"
231 },
232 new String[] {
233 "default.guest.friendly.url",
234 "default.guest.public.layout.friendly.url"
235 },
236 new String[] {
237 "default.guest.layout.column",
238 "default.guest.public.layout.column"
239 },
240 new String[] {
241 "default.guest.layout.name",
242 "default.guest.public.layout.name"
243 },
244 new String[] {
245 "default.guest.layout.template.id",
246 "default.guest.public.layout.template.id"
247 },
248 new String[] {
249 "default.user.layout.column",
250 "default.user.public.layout.column"
251 },
252 new String[] {
253 "default.user.layout.name",
254 "default.user.public.layout.name"
255 },
256 new String[] {
257 "default.user.layout.template.id",
258 "default.user.public.layout.template.id"
259 },
260 new String[] {
261 "default.user.private.layout.lar",
262 "default.user.private.layouts.lar"
263 },
264 new String[] {
265 "default.user.public.layout.lar",
266 "default.user.public.layouts.lar"
267 }
268 };
269
270 private static final String[][] _RENAMED_SYSTEM_KEYS = new String[][] {
271 };
272
273 private static Log _log = LogFactoryUtil.getLog(VerifyProperties.class);
274
275 }