PageRenderTime 151ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/portal-impl/src/com/liferay/portlet/admin/action/EditServerAction.java

https://github.com/viktorkovacs/liferay-portal-trunk
Java | 622 lines | 492 code | 114 blank | 16 comment | 63 complexity | 922829ec97c71565796aa57234f5cb34 MD5 | raw file
  1. /**
  2. * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
  3. *
  4. * This library is free software; you can redistribute it and/or modify it under
  5. * the terms of the GNU Lesser General Public License as published by the Free
  6. * Software Foundation; either version 2.1 of the License, or (at your option)
  7. * any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  11. * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
  12. * details.
  13. */
  14. package com.liferay.portlet.admin.action;
  15. import com.liferay.mail.service.MailServiceUtil;
  16. import com.liferay.portal.captcha.CaptchaImpl;
  17. import com.liferay.portal.captcha.recaptcha.ReCaptchaImpl;
  18. import com.liferay.portal.captcha.simplecaptcha.SimpleCaptchaImpl;
  19. import com.liferay.portal.convert.ConvertProcess;
  20. import com.liferay.portal.kernel.cache.CacheRegistryUtil;
  21. import com.liferay.portal.kernel.cache.MultiVMPoolUtil;
  22. import com.liferay.portal.kernel.captcha.Captcha;
  23. import com.liferay.portal.kernel.captcha.CaptchaUtil;
  24. import com.liferay.portal.kernel.io.unsync.UnsyncByteArrayOutputStream;
  25. import com.liferay.portal.kernel.io.unsync.UnsyncPrintWriter;
  26. import com.liferay.portal.kernel.log.Log;
  27. import com.liferay.portal.kernel.log.LogFactoryUtil;
  28. import com.liferay.portal.kernel.mail.Account;
  29. import com.liferay.portal.kernel.messaging.DestinationNames;
  30. import com.liferay.portal.kernel.messaging.MessageBusUtil;
  31. import com.liferay.portal.kernel.scripting.ScriptingException;
  32. import com.liferay.portal.kernel.scripting.ScriptingUtil;
  33. import com.liferay.portal.kernel.search.Indexer;
  34. import com.liferay.portal.kernel.search.SearchEngineUtil;
  35. import com.liferay.portal.kernel.servlet.SessionErrors;
  36. import com.liferay.portal.kernel.servlet.SessionMessages;
  37. import com.liferay.portal.kernel.util.Constants;
  38. import com.liferay.portal.kernel.util.InstancePool;
  39. import com.liferay.portal.kernel.util.ParamUtil;
  40. import com.liferay.portal.kernel.util.PropsKeys;
  41. import com.liferay.portal.kernel.util.StringPool;
  42. import com.liferay.portal.kernel.util.StringUtil;
  43. import com.liferay.portal.kernel.util.ThreadUtil;
  44. import com.liferay.portal.kernel.util.Time;
  45. import com.liferay.portal.kernel.util.Validator;
  46. import com.liferay.portal.kernel.webcache.WebCachePoolUtil;
  47. import com.liferay.portal.model.Portlet;
  48. import com.liferay.portal.search.lucene.LuceneIndexer;
  49. import com.liferay.portal.security.auth.PrincipalException;
  50. import com.liferay.portal.security.permission.PermissionChecker;
  51. import com.liferay.portal.service.PortletLocalServiceUtil;
  52. import com.liferay.portal.service.ServiceComponentLocalServiceUtil;
  53. import com.liferay.portal.struts.PortletAction;
  54. import com.liferay.portal.theme.ThemeDisplay;
  55. import com.liferay.portal.upload.UploadServletRequestImpl;
  56. import com.liferay.portal.util.MaintenanceUtil;
  57. import com.liferay.portal.util.PortalInstances;
  58. import com.liferay.portal.util.PrefsPropsUtil;
  59. import com.liferay.portal.util.ShutdownUtil;
  60. import com.liferay.portal.util.WebKeys;
  61. import com.liferay.portlet.ActionResponseImpl;
  62. import com.liferay.util.log4j.Log4JUtil;
  63. import java.io.File;
  64. import java.util.Enumeration;
  65. import java.util.Map;
  66. import javax.portlet.ActionRequest;
  67. import javax.portlet.ActionResponse;
  68. import javax.portlet.PortletConfig;
  69. import javax.portlet.PortletContext;
  70. import javax.portlet.PortletPreferences;
  71. import javax.portlet.PortletSession;
  72. import javax.portlet.PortletURL;
  73. import javax.portlet.WindowState;
  74. import org.apache.log4j.Level;
  75. import org.apache.log4j.Logger;
  76. import org.apache.struts.action.ActionForm;
  77. import org.apache.struts.action.ActionMapping;
  78. /**
  79. * @author Brian Wing Shun Chan
  80. */
  81. public class EditServerAction extends PortletAction {
  82. public void processAction(
  83. ActionMapping mapping, ActionForm form, PortletConfig portletConfig,
  84. ActionRequest actionRequest, ActionResponse actionResponse)
  85. throws Exception {
  86. ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(
  87. WebKeys.THEME_DISPLAY);
  88. PermissionChecker permissionChecker =
  89. themeDisplay.getPermissionChecker();
  90. if (!permissionChecker.isOmniadmin()) {
  91. SessionErrors.add(
  92. actionRequest, PrincipalException.class.getName());
  93. setForward(actionRequest, "portlet.admin.error");
  94. return;
  95. }
  96. PortletPreferences preferences = PrefsPropsUtil.getPreferences();
  97. String cmd = ParamUtil.getString(actionRequest, Constants.CMD);
  98. String redirect = null;
  99. if (cmd.equals("addLogLevel")) {
  100. addLogLevel(actionRequest);
  101. }
  102. else if (cmd.equals("cacheDb")) {
  103. cacheDb();
  104. }
  105. else if (cmd.equals("cacheMulti")) {
  106. cacheMulti();
  107. }
  108. else if (cmd.equals("cacheSingle")) {
  109. cacheSingle();
  110. }
  111. else if (cmd.startsWith("convertProcess.")) {
  112. redirect = convertProcess(actionRequest, actionResponse, cmd);
  113. }
  114. else if (cmd.equals("gc")) {
  115. gc();
  116. }
  117. else if (cmd.equals("reindex")) {
  118. reindex(actionRequest);
  119. }
  120. else if (cmd.equals("runScript")) {
  121. runScript(portletConfig, actionRequest, actionResponse);
  122. }
  123. else if (cmd.equals("shutdown")) {
  124. shutdown(actionRequest);
  125. }
  126. else if (cmd.equals("threadDump")) {
  127. threadDump();
  128. }
  129. else if (cmd.equals("updateCaptcha")) {
  130. updateCaptcha(actionRequest, preferences);
  131. }
  132. else if (cmd.equals("updateFileUploads")) {
  133. updateFileUploads(actionRequest, preferences);
  134. }
  135. else if (cmd.equals("updateLogLevels")) {
  136. updateLogLevels(actionRequest);
  137. }
  138. else if (cmd.equals("updateMail")) {
  139. updateMail(actionRequest, preferences);
  140. }
  141. else if (cmd.equals("updateOpenOffice")) {
  142. updateOpenOffice(actionRequest, preferences);
  143. }
  144. else if (cmd.equals("verifyPluginTables")) {
  145. verifyPluginTables();
  146. }
  147. sendRedirect(actionRequest, actionResponse, redirect);
  148. }
  149. protected void addLogLevel(ActionRequest actionRequest) throws Exception {
  150. String loggerName = ParamUtil.getString(actionRequest, "loggerName");
  151. String priority = ParamUtil.getString(actionRequest, "priority");
  152. Logger logger = Logger.getLogger(loggerName);
  153. logger.setLevel(Level.toLevel(priority));
  154. }
  155. protected void cacheDb() throws Exception {
  156. CacheRegistryUtil.clear();
  157. }
  158. protected void cacheMulti() throws Exception {
  159. MultiVMPoolUtil.clear();
  160. }
  161. protected void cacheSingle() throws Exception {
  162. WebCachePoolUtil.clear();
  163. }
  164. protected String convertProcess(
  165. ActionRequest actionRequest, ActionResponse actionResponse,
  166. String cmd)
  167. throws Exception {
  168. ActionResponseImpl actionResponseImpl =
  169. (ActionResponseImpl)actionResponse;
  170. PortletSession portletSession = actionRequest.getPortletSession();
  171. String className = StringUtil.replaceFirst(
  172. cmd, "convertProcess.", StringPool.BLANK);
  173. ConvertProcess convertProcess = (ConvertProcess)InstancePool.get(
  174. className);
  175. String[] parameters = convertProcess.getParameterNames();
  176. if (parameters != null) {
  177. String[] values = new String[parameters.length];
  178. for (int i = 0; i < parameters.length; i++) {
  179. String parameter =
  180. className + StringPool.PERIOD + parameters[i];
  181. if (parameters[i].contains(StringPool.EQUAL)) {
  182. String[] parameterPair = StringUtil.split(
  183. parameters[i], StringPool.EQUAL);
  184. parameter =
  185. className + StringPool.PERIOD + parameterPair[0];
  186. }
  187. values[i] = ParamUtil.getString(actionRequest, parameter);
  188. }
  189. convertProcess.setParameterValues(values);
  190. }
  191. String path = convertProcess.getPath();
  192. if (path != null) {
  193. PortletURL portletURL = actionResponseImpl.createRenderURL();
  194. portletURL.setWindowState(WindowState.MAXIMIZED);
  195. portletURL.setParameter("struts_action", path);
  196. return portletURL.toString();
  197. }
  198. else {
  199. MaintenanceUtil.maintain(portletSession.getId(), className);
  200. MessageBusUtil.sendMessage(
  201. DestinationNames.CONVERT_PROCESS, className);
  202. return null;
  203. }
  204. }
  205. protected void gc() throws Exception {
  206. Runtime.getRuntime().gc();
  207. }
  208. protected String getFileExtensions(
  209. ActionRequest actionRequest, String name) {
  210. String value = ParamUtil.getString(actionRequest, name);
  211. return value.replace(", .", ",.");
  212. }
  213. protected void reindex(ActionRequest actionRequest) throws Exception {
  214. String portletId = ParamUtil.getString(actionRequest, "portletId");
  215. long[] companyIds = PortalInstances.getCompanyIds();
  216. if (Validator.isNull(portletId)) {
  217. for (long companyId : companyIds) {
  218. try {
  219. LuceneIndexer indexer = new LuceneIndexer(companyId);
  220. indexer.reindex();
  221. }
  222. catch (Exception e) {
  223. _log.error(e, e);
  224. }
  225. }
  226. }
  227. else {
  228. Portlet portlet = PortletLocalServiceUtil.getPortletById(
  229. companyIds[0], portletId);
  230. if (portlet == null) {
  231. return;
  232. }
  233. Indexer indexer = portlet.getIndexerInstance();
  234. if (indexer == null) {
  235. return;
  236. }
  237. for (long companyId : companyIds) {
  238. try {
  239. SearchEngineUtil.deletePortletDocuments(
  240. companyId, portletId);
  241. indexer.reindex(new String[] {String.valueOf(companyId)});
  242. }
  243. catch (Exception e) {
  244. _log.error(e, e);
  245. }
  246. }
  247. }
  248. }
  249. protected void runScript(
  250. PortletConfig portletConfig, ActionRequest actionRequest,
  251. ActionResponse actionResponse)
  252. throws Exception {
  253. String language = ParamUtil.getString(actionRequest, "language");
  254. String script = ParamUtil.getString(actionRequest, "script");
  255. PortletContext portletContext = portletConfig.getPortletContext();
  256. Map<String, Object> portletObjects = ScriptingUtil.getPortletObjects(
  257. portletConfig, portletContext, actionRequest, actionResponse);
  258. UnsyncByteArrayOutputStream unsyncByteArrayOutputStream =
  259. new UnsyncByteArrayOutputStream();
  260. UnsyncPrintWriter unsyncPrintWriter = new UnsyncPrintWriter(
  261. unsyncByteArrayOutputStream);
  262. portletObjects.put("out", unsyncPrintWriter);
  263. try {
  264. SessionMessages.add(actionRequest, "script", script);
  265. ScriptingUtil.exec(null, portletObjects, language, script);
  266. unsyncPrintWriter.flush();
  267. SessionMessages.add(
  268. actionRequest, "script_output",
  269. unsyncByteArrayOutputStream.toString());
  270. }
  271. catch (ScriptingException se) {
  272. SessionErrors.add(
  273. actionRequest, ScriptingException.class.getName(), se);
  274. _log.error(se.getMessage());
  275. }
  276. }
  277. protected void shutdown(ActionRequest actionRequest) throws Exception {
  278. long minutes =
  279. ParamUtil.getInteger(actionRequest, "minutes") * Time.MINUTE;
  280. String message = ParamUtil.getString(actionRequest, "message");
  281. if (minutes <= 0) {
  282. ShutdownUtil.cancel();
  283. }
  284. else {
  285. ShutdownUtil.shutdown(minutes, message);
  286. }
  287. }
  288. protected void threadDump() throws Exception {
  289. if (_log.isInfoEnabled()) {
  290. _log.info(ThreadUtil.threadDump());
  291. }
  292. else {
  293. _log.error(
  294. "Thread dumps require the log level to be at least INFO for " +
  295. getClass().getName());
  296. }
  297. }
  298. protected void updateCaptcha(
  299. ActionRequest actionRequest, PortletPreferences preferences)
  300. throws Exception {
  301. boolean reCaptchaEnabled = ParamUtil.getBoolean(
  302. actionRequest, "reCaptchaEnabled");
  303. String reCaptchaPrivateKey = ParamUtil.getString(
  304. actionRequest, "reCaptchaPrivateKey");
  305. String reCaptchaPublicKey = ParamUtil.getString(
  306. actionRequest, "reCaptchaPublicKey");
  307. Captcha captcha = null;
  308. if (reCaptchaEnabled) {
  309. captcha = new ReCaptchaImpl();
  310. }
  311. else {
  312. captcha = new SimpleCaptchaImpl();
  313. }
  314. validateCaptcha(actionRequest);
  315. if (SessionErrors.isEmpty(actionRequest)) {
  316. preferences.setValue(
  317. PropsKeys.CAPTCHA_ENGINE_IMPL, captcha.getClass().getName());
  318. preferences.setValue(
  319. PropsKeys.CAPTCHA_ENGINE_RECAPTCHA_KEY_PRIVATE,
  320. reCaptchaPrivateKey);
  321. preferences.setValue(
  322. PropsKeys.CAPTCHA_ENGINE_RECAPTCHA_KEY_PUBLIC,
  323. reCaptchaPublicKey);
  324. preferences.store();
  325. CaptchaImpl captchaImpl = (CaptchaImpl)CaptchaUtil.getCaptcha();
  326. captchaImpl.setCaptcha(captcha);
  327. }
  328. }
  329. protected void updateFileUploads(
  330. ActionRequest actionRequest, PortletPreferences preferences)
  331. throws Exception {
  332. String dlFileExtensions = getFileExtensions(
  333. actionRequest, "dlFileExtensions");
  334. long dlFileMaxSize = ParamUtil.getLong(actionRequest, "dlFileMaxSize");
  335. String igImageExtensions = getFileExtensions(
  336. actionRequest, "igImageExtensions");
  337. long igImageMaxSize = ParamUtil.getLong(
  338. actionRequest, "igImageMaxSize");
  339. long igThumbnailMaxDimension = ParamUtil.getLong(
  340. actionRequest, "igImageThumbnailMaxDimensions");
  341. String journalImageExtensions = getFileExtensions(
  342. actionRequest, "journalImageExtensions");
  343. long journalImageSmallMaxSize = ParamUtil.getLong(
  344. actionRequest, "journalImageSmallMaxSize");
  345. String shoppingImageExtensions = getFileExtensions(
  346. actionRequest, "shoppingImageExtensions");
  347. long scImageMaxSize = ParamUtil.getLong(
  348. actionRequest, "scImageMaxSize");
  349. long scImageThumbnailMaxHeight = ParamUtil.getLong(
  350. actionRequest, "scImageThumbnailMaxHeight");
  351. long scImageThumbnailMaxWidth = ParamUtil.getLong(
  352. actionRequest, "scImageThumbnailMaxWidth");
  353. long shoppingImageLargeMaxSize = ParamUtil.getLong(
  354. actionRequest, "shoppingImageLargeMaxSize");
  355. long shoppingImageMediumMaxSize = ParamUtil.getLong(
  356. actionRequest, "shoppingImageMediumMaxSize");
  357. long shoppingImageSmallMaxSize = ParamUtil.getLong(
  358. actionRequest, "shoppingImageSmallMaxSize");
  359. long uploadServletRequestImplMaxSize = ParamUtil.getLong(
  360. actionRequest, "uploadServletRequestImplMaxSize");
  361. String uploadServletRequestImplTempDir = ParamUtil.getString(
  362. actionRequest, "uploadServletRequestImplTempDir");
  363. long usersImageMaxSize = ParamUtil.getLong(
  364. actionRequest, "usersImageMaxSize");
  365. preferences.setValue(
  366. PropsKeys.DL_FILE_EXTENSIONS, dlFileExtensions);
  367. preferences.setValue(
  368. PropsKeys.DL_FILE_MAX_SIZE, String.valueOf(dlFileMaxSize));
  369. preferences.setValue(
  370. PropsKeys.IG_IMAGE_EXTENSIONS, igImageExtensions);
  371. preferences.setValue(
  372. PropsKeys.IG_IMAGE_MAX_SIZE, String.valueOf(igImageMaxSize));
  373. preferences.setValue(
  374. PropsKeys.IG_IMAGE_THUMBNAIL_MAX_DIMENSION,
  375. String.valueOf(igThumbnailMaxDimension));
  376. preferences.setValue(
  377. PropsKeys.JOURNAL_IMAGE_EXTENSIONS, journalImageExtensions);
  378. preferences.setValue(
  379. PropsKeys.JOURNAL_IMAGE_SMALL_MAX_SIZE,
  380. String.valueOf(journalImageSmallMaxSize));
  381. preferences.setValue(
  382. PropsKeys.SHOPPING_IMAGE_EXTENSIONS, shoppingImageExtensions);
  383. preferences.setValue(
  384. PropsKeys.SHOPPING_IMAGE_LARGE_MAX_SIZE,
  385. String.valueOf(shoppingImageLargeMaxSize));
  386. preferences.setValue(
  387. PropsKeys.SHOPPING_IMAGE_MEDIUM_MAX_SIZE,
  388. String.valueOf(shoppingImageMediumMaxSize));
  389. preferences.setValue(
  390. PropsKeys.SHOPPING_IMAGE_SMALL_MAX_SIZE,
  391. String.valueOf(shoppingImageSmallMaxSize));
  392. preferences.setValue(
  393. PropsKeys.SC_IMAGE_MAX_SIZE, String.valueOf(scImageMaxSize));
  394. preferences.setValue(
  395. PropsKeys.SC_IMAGE_THUMBNAIL_MAX_HEIGHT,
  396. String.valueOf(scImageThumbnailMaxHeight));
  397. preferences.setValue(
  398. PropsKeys.SC_IMAGE_THUMBNAIL_MAX_WIDTH,
  399. String.valueOf(scImageThumbnailMaxWidth));
  400. preferences.setValue(
  401. PropsKeys.UPLOAD_SERVLET_REQUEST_IMPL_MAX_SIZE,
  402. String.valueOf(uploadServletRequestImplMaxSize));
  403. if (Validator.isNotNull(uploadServletRequestImplTempDir)) {
  404. preferences.setValue(
  405. PropsKeys.UPLOAD_SERVLET_REQUEST_IMPL_TEMP_DIR,
  406. uploadServletRequestImplTempDir);
  407. UploadServletRequestImpl.setTempDir(
  408. new File(uploadServletRequestImplTempDir));
  409. }
  410. preferences.setValue(
  411. PropsKeys.USERS_IMAGE_MAX_SIZE, String.valueOf(usersImageMaxSize));
  412. preferences.store();
  413. }
  414. protected void updateLogLevels(ActionRequest actionRequest)
  415. throws Exception {
  416. Enumeration<String> enu = actionRequest.getParameterNames();
  417. while (enu.hasMoreElements()) {
  418. String name = enu.nextElement();
  419. if (name.startsWith("logLevel")) {
  420. String loggerName = name.substring(8, name.length());
  421. String priority = ParamUtil.getString(
  422. actionRequest, name, Level.INFO.toString());
  423. Log4JUtil.setLevel(loggerName, priority);
  424. }
  425. }
  426. }
  427. protected void updateMail(
  428. ActionRequest actionRequest, PortletPreferences preferences)
  429. throws Exception {
  430. String advancedProperties = ParamUtil.getString(
  431. actionRequest, "advancedProperties");
  432. String pop3Host = ParamUtil.getString(actionRequest, "pop3Host");
  433. String pop3Password = ParamUtil.getString(
  434. actionRequest, "pop3Password");
  435. int pop3Port = ParamUtil.getInteger(actionRequest, "pop3Port");
  436. boolean pop3Secure = ParamUtil.getBoolean(actionRequest, "pop3Secure");
  437. String pop3User = ParamUtil.getString(actionRequest, "pop3User");
  438. String smtpHost = ParamUtil.getString(actionRequest, "smtpHost");
  439. String smtpPassword = ParamUtil.getString(
  440. actionRequest, "smtpPassword");
  441. int smtpPort = ParamUtil.getInteger(actionRequest, "smtpPort");
  442. boolean smtpSecure = ParamUtil.getBoolean(actionRequest, "smtpSecure");
  443. String smtpUser = ParamUtil.getString(actionRequest, "smtpUser");
  444. String storeProtocol = Account.PROTOCOL_POP;
  445. if (pop3Secure) {
  446. storeProtocol = Account.PROTOCOL_POPS;
  447. }
  448. String transportProtocol = Account.PROTOCOL_SMTP;
  449. if (smtpSecure) {
  450. transportProtocol = Account.PROTOCOL_SMTPS;
  451. }
  452. preferences.setValue(PropsKeys.MAIL_SESSION_MAIL, "true");
  453. preferences.setValue(
  454. PropsKeys.MAIL_SESSION_MAIL_ADVANCED_PROPERTIES,
  455. advancedProperties);
  456. preferences.setValue(PropsKeys.MAIL_SESSION_MAIL_POP3_HOST, pop3Host);
  457. preferences.setValue(
  458. PropsKeys.MAIL_SESSION_MAIL_POP3_PASSWORD, pop3Password);
  459. preferences.setValue(
  460. PropsKeys.MAIL_SESSION_MAIL_POP3_PORT, String.valueOf(pop3Port));
  461. preferences.setValue(PropsKeys.MAIL_SESSION_MAIL_POP3_USER, pop3User);
  462. preferences.setValue(PropsKeys.MAIL_SESSION_MAIL_SMTP_HOST, smtpHost);
  463. preferences.setValue(
  464. PropsKeys.MAIL_SESSION_MAIL_SMTP_PASSWORD, smtpPassword);
  465. preferences.setValue(
  466. PropsKeys.MAIL_SESSION_MAIL_SMTP_PORT, String.valueOf(smtpPort));
  467. preferences.setValue(PropsKeys.MAIL_SESSION_MAIL_SMTP_USER, smtpUser);
  468. preferences.setValue(
  469. PropsKeys.MAIL_SESSION_MAIL_STORE_PROTOCOL, storeProtocol);
  470. preferences.setValue(
  471. PropsKeys.MAIL_SESSION_MAIL_TRANSPORT_PROTOCOL, transportProtocol);
  472. preferences.store();
  473. MailServiceUtil.clearSession();
  474. }
  475. protected void updateOpenOffice(
  476. ActionRequest actionRequest, PortletPreferences preferences)
  477. throws Exception {
  478. boolean enabled = ParamUtil.getBoolean(actionRequest, "enabled");
  479. int port = ParamUtil.getInteger(actionRequest, "port");
  480. preferences.setValue(
  481. PropsKeys.OPENOFFICE_SERVER_ENABLED, String.valueOf(enabled));
  482. preferences.setValue(
  483. PropsKeys.OPENOFFICE_SERVER_PORT, String.valueOf(port));
  484. preferences.store();
  485. }
  486. protected void validateCaptcha(ActionRequest actionRequest)
  487. throws Exception {
  488. boolean reCaptchaEnabled = ParamUtil.getBoolean(
  489. actionRequest, "reCaptchaEnabled");
  490. if (!reCaptchaEnabled) {
  491. return;
  492. }
  493. String reCaptchaPrivateKey = ParamUtil.getString(
  494. actionRequest, "reCaptchaPrivateKey");
  495. String reCaptchaPublicKey = ParamUtil.getString(
  496. actionRequest, "reCaptchaPublicKey");
  497. if (Validator.isNull(reCaptchaPublicKey)) {
  498. SessionErrors.add(actionRequest, "reCaptchaPublicKey");
  499. }
  500. else if (Validator.isNull(reCaptchaPrivateKey)) {
  501. SessionErrors.add(actionRequest, "reCaptchaPrivateKey");
  502. }
  503. }
  504. protected void verifyPluginTables() throws Exception {
  505. ServiceComponentLocalServiceUtil.verifyDB();
  506. }
  507. private static Log _log = LogFactoryUtil.getLog(EditServerAction.class);
  508. }