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.simultaneous.logins",
193 "xss.allow"
194 };
195
196 private static final String[] _OBSOLETE_SYSTEM_KEYS = new String[] {
197 "com.liferay.util.Http.proxy.host",
198 "com.liferay.util.Http.proxy.port",
199 "com.liferay.util.XSSUtil.regexp.pattern"
200 };
201
202 private static final String[][] _RENAMED_PORTAL_KEYS = new String[][] {
203 new String[] {
204 "amazon.license.0",
205 "amazon.access.key.id"
206 },
207 new String[] {
208 "amazon.license.1",
209 "amazon.access.key.id"
210 },
211 new String[] {
212 "amazon.license.2",
213 "amazon.access.key.id"
214 },
215 new String[] {
216 "amazon.license.3",
217 "amazon.access.key.id"
218 },
219 new String[] {
220 "cdn.host",
221 "cdn.host.http"
222 },
223 new String[] {
224 "com.liferay.portal.servlet.filters.compression.CompressionFilter",
225 "com.liferay.portal.servlet.filters.gzip.GZipFilter"
226 },
227 new String[] {
228 "default.guest.friendly.url",
229 "default.guest.public.layout.friendly.url"
230 },
231 new String[] {
232 "default.guest.layout.column",
233 "default.guest.public.layout.column"
234 },
235 new String[] {
236 "default.guest.layout.name",
237 "default.guest.public.layout.name"
238 },
239 new String[] {
240 "default.guest.layout.template.id",
241 "default.guest.public.layout.template.id"
242 },
243 new String[] {
244 "default.user.layout.column",
245 "default.user.public.layout.column"
246 },
247 new String[] {
248 "default.user.layout.name",
249 "default.user.public.layout.name"
250 },
251 new String[] {
252 "default.user.layout.template.id",
253 "default.user.public.layout.template.id"
254 },
255 new String[] {
256 "default.user.private.layout.lar",
257 "default.user.private.layouts.lar"
258 },
259 new String[] {
260 "default.user.public.layout.lar",
261 "default.user.public.layouts.lar"
262 }
263 };
264
265 private static final String[][] _RENAMED_SYSTEM_KEYS = new String[][] {
266 };
267
268 private static Log _log = LogFactoryUtil.getLog(VerifyProperties.class);
269
270 }