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