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