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