List of usage examples for com.liferay.portal.kernel.util PropsUtil get
public static String get(String key)
From source file:com.rivetlogic.hangouts.service.ClpSerializer.java
License:Open Source License
public static String getServletContextName() { if (Validator.isNotNull(_servletContextName)) { return _servletContextName; }//from ww w . j ava2 s .c om synchronized (ClpSerializer.class) { if (Validator.isNotNull(_servletContextName)) { return _servletContextName; } try { ClassLoader classLoader = ClpSerializer.class.getClassLoader(); Class<?> portletPropsClass = classLoader.loadClass("com.liferay.util.portlet.PortletProps"); Method getMethod = portletPropsClass.getMethod("get", new Class<?>[] { String.class }); String portletPropsServletContextName = (String) getMethod.invoke(null, "hangouts-portlet-deployment-context"); if (Validator.isNotNull(portletPropsServletContextName)) { _servletContextName = portletPropsServletContextName; } } catch (Throwable t) { if (_log.isInfoEnabled()) { _log.info("Unable to locate deployment context from portlet properties"); } } if (Validator.isNull(_servletContextName)) { try { String propsUtilServletContextName = PropsUtil.get("hangouts-portlet-deployment-context"); if (Validator.isNotNull(propsUtilServletContextName)) { _servletContextName = propsUtilServletContextName; } } catch (Throwable t) { if (_log.isInfoEnabled()) { _log.info("Unable to locate deployment context from portal properties"); } } } if (Validator.isNull(_servletContextName)) { _servletContextName = "hangouts-portlet"; } return _servletContextName; } }
From source file:com.rivetlogic.jobsboard.service.ClpSerializer.java
License:Open Source License
public static String getServletContextName() { if (Validator.isNotNull(_servletContextName)) { return _servletContextName; }/*from www . j av a 2 s . c om*/ synchronized (ClpSerializer.class) { if (Validator.isNotNull(_servletContextName)) { return _servletContextName; } try { ClassLoader classLoader = ClpSerializer.class.getClassLoader(); Class<?> portletPropsClass = classLoader.loadClass("com.liferay.util.portlet.PortletProps"); Method getMethod = portletPropsClass.getMethod("get", new Class<?>[] { String.class }); String portletPropsServletContextName = (String) getMethod.invoke(null, "jobs-board-portlet-deployment-context"); if (Validator.isNotNull(portletPropsServletContextName)) { _servletContextName = portletPropsServletContextName; } } catch (Throwable t) { if (_log.isInfoEnabled()) { _log.info("Unable to locate deployment context from portlet properties"); } } if (Validator.isNull(_servletContextName)) { try { String propsUtilServletContextName = PropsUtil.get("jobs-board-portlet-deployment-context"); if (Validator.isNotNull(propsUtilServletContextName)) { _servletContextName = propsUtilServletContextName; } } catch (Throwable t) { if (_log.isInfoEnabled()) { _log.info("Unable to locate deployment context from portal properties"); } } } if (Validator.isNull(_servletContextName)) { _servletContextName = "jobs-board-portlet"; } return _servletContextName; } }
From source file:com.rivetlogic.microsite.service.ClpSerializer.java
License:Open Source License
public static String getServletContextName() { if (Validator.isNotNull(_servletContextName)) { return _servletContextName; }//from w w w .jav a 2 s . co m synchronized (ClpSerializer.class) { if (Validator.isNotNull(_servletContextName)) { return _servletContextName; } try { ClassLoader classLoader = ClpSerializer.class.getClassLoader(); Class<?> portletPropsClass = classLoader.loadClass("com.liferay.util.portlet.PortletProps"); Method getMethod = portletPropsClass.getMethod("get", new Class<?>[] { String.class }); String portletPropsServletContextName = (String) getMethod.invoke(null, "micro-site-portlet-deployment-context"); if (Validator.isNotNull(portletPropsServletContextName)) { _servletContextName = portletPropsServletContextName; } } catch (Throwable t) { if (_log.isInfoEnabled()) { _log.info("Unable to locate deployment context from portlet properties"); } } if (Validator.isNull(_servletContextName)) { try { String propsUtilServletContextName = PropsUtil.get("micro-site-portlet-deployment-context"); if (Validator.isNotNull(propsUtilServletContextName)) { _servletContextName = propsUtilServletContextName; } } catch (Throwable t) { if (_log.isInfoEnabled()) { _log.info("Unable to locate deployment context from portal properties"); } } } if (Validator.isNull(_servletContextName)) { _servletContextName = "micro-site-portlet"; } return _servletContextName; } }
From source file:com.rivetlogic.microsites.service.ClpSerializer.java
License:Open Source License
public static String getServletContextName() { if (Validator.isNotNull(_servletContextName)) { return _servletContextName; }//from w w w . j a v a 2 s .com synchronized (ClpSerializer.class) { if (Validator.isNotNull(_servletContextName)) { return _servletContextName; } try { ClassLoader classLoader = ClpSerializer.class.getClassLoader(); Class<?> portletPropsClass = classLoader.loadClass("com.liferay.util.portlet.PortletProps"); Method getMethod = portletPropsClass.getMethod("get", new Class<?>[] { String.class }); String portletPropsServletContextName = (String) getMethod.invoke(null, "micro-sites-portlet-deployment-context"); if (Validator.isNotNull(portletPropsServletContextName)) { _servletContextName = portletPropsServletContextName; } } catch (Throwable t) { if (_log.isInfoEnabled()) { _log.info("Unable to locate deployment context from portlet properties"); } } if (Validator.isNull(_servletContextName)) { try { String propsUtilServletContextName = PropsUtil.get("micro-sites-portlet-deployment-context"); if (Validator.isNotNull(propsUtilServletContextName)) { _servletContextName = propsUtilServletContextName; } } catch (Throwable t) { if (_log.isInfoEnabled()) { _log.info("Unable to locate deployment context from portal properties"); } } } if (Validator.isNull(_servletContextName)) { _servletContextName = "micro-sites-portlet"; } return _servletContextName; } }
From source file:com.rivetlogic.portal.search.elasticsearch.util.ElasticsearchConnector.java
License:Open Source License
/** * Inits the transport client./*from ww w.j av a2 s . c o m*/ */ public void initESSetup() { try { String esServerHome = PropsUtil.get(ElasticsearchIndexerConstants.ES_KEY_HOME_PATH); String esClusterName = PropsUtil.get(ElasticsearchIndexerConstants.ES_KEY_CLUSTERNAME); if (Validator.isNull(esServerHome) || esServerHome.isEmpty()) { throw new ElasticsearchException("Elasticsearch server home folder is not configured..."); } /** Create a settings object with custom attributes and build */ ImmutableSettings.Builder settingsBuilder = ImmutableSettings.settingsBuilder() .classLoader(Settings.class.getClassLoader()) .put(ElasticsearchIndexerConstants.ES_SETTING_PATH_HOME, esServerHome) .put(ElasticsearchIndexerConstants.ES_SETTING_CLIENT_SNIFF, true); if (Validator.isNotNull(esClusterName) && !esClusterName.isEmpty() && !ElasticsearchIndexerConstants.ELASTIC_SEARCH.equalsIgnoreCase(esClusterName)) { settingsBuilder.put(ElasticsearchIndexerConstants.ES_SETTING_CLUSTERNAME, esClusterName); if (_log.isDebugEnabled()) { _log.debug("Elasticsearch cluster name is not configured to default:" + esClusterName); } } String csElasticsearchNodes = PropsUtil.get(ElasticsearchIndexerConstants.ES_KEY_NODE); if (Validator.isNull(csElasticsearchNodes) || csElasticsearchNodes.isEmpty()) { throw new ElasticsearchException("Elasticsearch server node is not configured..."); } String[] nodeList = csElasticsearchNodes.split(StringPool.COMMA); InetSocketTransportAddress[] transportAddresses = new InetSocketTransportAddress[nodeList.length]; /** Prepare a list of Hosts */ for (int i = 0; i < nodeList.length; i++) { String[] hostnames = nodeList[i].split(StringPool.COLON); InetSocketTransportAddress transportAddress = new InetSocketTransportAddress(hostnames[0], Integer.parseInt(hostnames[1])); transportAddresses[i] = transportAddress; } client = new TransportClient(settingsBuilder.build()).addTransportAddresses(transportAddresses); _log.info("Successfully created Transport client........"); /** * Check if Liferay index already exists, else create one with * default mapping The Index creation is one time setup, so it is * important to check if index already exists before creation */ if (!isLiferayIndexExists()) { createLiferayIndexInESServer(); } } catch (FailedToResolveConfigException configEx) { _log.error("Error while connecting to Elasticsearch server:" + configEx.getMessage()); } }
From source file:com.rivetlogic.portlet.GoogleDriveKeys.java
License:Open Source License
/** * Gets the client id.// w ww. jav a2s . c o m * * @param companyId the company id * @return the client id * @throws SystemException the system exception */ public static String getClientId(long companyId) throws SystemException { return PrefsPropsUtil.getString(companyId, GOOGLE_DRIVE_CLIENTID, GetterUtil.getString(PropsUtil.get(GOOGLE_DRIVE_CLIENTID))); }
From source file:com.rivetlogic.portlet.GoogleDriveKeys.java
License:Open Source License
/** * Gets the dev key.//from w ww . ja v a 2 s .co m * * @param companyId the company id * @return the dev key * @throws SystemException the system exception */ public static String getDevKey(long companyId) throws SystemException { return PrefsPropsUtil.getString(companyId, GOOGLE_DRIVE_DEVKEY, GetterUtil.getString(PropsUtil.get(GOOGLE_DRIVE_DEVKEY))); }
From source file:com.rivetlogic.portlet.service.ClpSerializer.java
License:Open Source License
public static String getServletContextName() { if (Validator.isNotNull(_servletContextName)) { return _servletContextName; }/*w w w . j a va2 s. c om*/ synchronized (ClpSerializer.class) { if (Validator.isNotNull(_servletContextName)) { return _servletContextName; } try { ClassLoader classLoader = ClpSerializer.class.getClassLoader(); Class<?> portletPropsClass = classLoader.loadClass("com.liferay.util.portlet.PortletProps"); Method getMethod = portletPropsClass.getMethod("get", new Class<?>[] { String.class }); String portletPropsServletContextName = (String) getMethod.invoke(null, "google-drive-quick-links-portlet-deployment-context"); if (Validator.isNotNull(portletPropsServletContextName)) { _servletContextName = portletPropsServletContextName; } } catch (Throwable t) { if (_log.isInfoEnabled()) { _log.info("Unable to locate deployment context from portlet properties"); } } if (Validator.isNull(_servletContextName)) { try { String propsUtilServletContextName = PropsUtil .get("google-drive-quick-links-portlet-deployment-context"); if (Validator.isNotNull(propsUtilServletContextName)) { _servletContextName = propsUtilServletContextName; } } catch (Throwable t) { if (_log.isInfoEnabled()) { _log.info("Unable to locate deployment context from portal properties"); } } } if (Validator.isNull(_servletContextName)) { _servletContextName = "google-drive-quick-links-portlet"; } return _servletContextName; } }
From source file:com.rivetlogic.portlet.todo.service.ClpSerializer.java
License:Open Source License
public static String getServletContextName() { if (Validator.isNotNull(_servletContextName)) { return _servletContextName; }//from w ww . ja v a 2 s . com synchronized (ClpSerializer.class) { if (Validator.isNotNull(_servletContextName)) { return _servletContextName; } try { ClassLoader classLoader = ClpSerializer.class.getClassLoader(); Class<?> portletPropsClass = classLoader.loadClass("com.liferay.util.portlet.PortletProps"); Method getMethod = portletPropsClass.getMethod("get", new Class<?>[] { String.class }); String portletPropsServletContextName = (String) getMethod.invoke(null, "todo-portlet-deployment-context"); if (Validator.isNotNull(portletPropsServletContextName)) { _servletContextName = portletPropsServletContextName; } } catch (Throwable t) { if (_log.isInfoEnabled()) { _log.info("Unable to locate deployment context from portlet properties"); } } if (Validator.isNull(_servletContextName)) { try { String propsUtilServletContextName = PropsUtil.get("todo-portlet-deployment-context"); if (Validator.isNotNull(propsUtilServletContextName)) { _servletContextName = propsUtilServletContextName; } } catch (Throwable t) { if (_log.isInfoEnabled()) { _log.info("Unable to locate deployment context from portal properties"); } } } if (Validator.isNull(_servletContextName)) { _servletContextName = "todo-portlet"; } return _servletContextName; } }
From source file:com.rivetlogic.service.ClpSerializer.java
License:Open Source License
public static String getServletContextName() { if (Validator.isNotNull(_servletContextName)) { return _servletContextName; }//from w w w .ja v a2 s .c o m synchronized (ClpSerializer.class) { if (Validator.isNotNull(_servletContextName)) { return _servletContextName; } try { ClassLoader classLoader = ClpSerializer.class.getClassLoader(); Class<?> portletPropsClass = classLoader.loadClass("com.liferay.util.portlet.PortletProps"); Method getMethod = portletPropsClass.getMethod("get", new Class<?>[] { String.class }); String portletPropsServletContextName = (String) getMethod.invoke(null, "tip-of-the-day-portlet-deployment-context"); if (Validator.isNotNull(portletPropsServletContextName)) { _servletContextName = portletPropsServletContextName; } } catch (Throwable t) { if (_log.isInfoEnabled()) { _log.info("Unable to locate deployment context from portlet properties"); } } if (Validator.isNull(_servletContextName)) { try { String propsUtilServletContextName = PropsUtil.get("tip-of-the-day-portlet-deployment-context"); if (Validator.isNotNull(propsUtilServletContextName)) { _servletContextName = propsUtilServletContextName; } } catch (Throwable t) { if (_log.isInfoEnabled()) { _log.info("Unable to locate deployment context from portal properties"); } } } if (Validator.isNull(_servletContextName)) { _servletContextName = "tip-of-the-day-portlet"; } return _servletContextName; } }