Example usage for com.liferay.portal.kernel.util PropsUtil get

List of usage examples for com.liferay.portal.kernel.util PropsUtil get

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util PropsUtil get.

Prototype

public static String get(String key) 

Source Link

Usage

From source file:com.evolveum.liferay.usercreatehook.ws.WSConfig.java

License:Apache License

public static int getMidpointPasswordMinLenght() {
    int result = -1;
    try {//from www. ja  v  a  2  s  .co  m
        String resultStr = PropsUtil.get(PROPERTY_MIDPOINT_PASSWORD_MIN_LENGHT);
        if (!StringUtils.isEmpty(resultStr)) {
            result = Integer.parseInt(resultStr);
        }
    } catch (Exception e) {
        LOG.warn(e);
    }
    if (result < 1) {
        result = DEFAULT_PASSWORD_MIN_LENGTH;
        LOG.info("Property '" + PROPERTY_MIDPOINT_PASSWORD_MIN_LENGHT
                + "' not found or not valid in hook's portal.properties - using default value '" + result
                + "'");
    } else {
        LOG.debug("Property '" + PROPERTY_MIDPOINT_PASSWORD_MIN_LENGHT + "'  value: '" + result + "'");
    }
    return result;
}

From source file:com.evolveum.liferay.usercreatehook.ws.WSConfig.java

License:Apache License

public static List<String> getAllwaysPermittedEmailDomains() {
    List<String> result = new ArrayList<String>();
    String value = PropsUtil.get(PROPERTY_EMAIL_DOMAINS_ALLWAYS_PERMITTED);
    if (!StringUtils.isBlank(value)) {
        StringTokenizer st = new StringTokenizer(value, ",");
        while (st.hasMoreTokens()) {
            String domain = st.nextToken().trim().toLowerCase();
            result.add(domain);//from  w  w  w  .j a v  a2s . co m
        }
    }
    LOG.debug("Property '" + PROPERTY_EMAIL_DOMAINS_ALLWAYS_PERMITTED + "'  value: '" + value
            + "'. Used domains from list: '" + result + "'");
    return result;
}

From source file:com.evolveum.liferay.usercreatehook.ws.WSConfig.java

License:Apache License

public static List<String> getReservedScreennames() {
    List<String> result = new ArrayList<String>();
    String value = PropsUtil.get(PROPERTY_SCREENNAME_RESERVED);
    if (!StringUtils.isBlank(value)) {
        StringTokenizer st = new StringTokenizer(value, ",");
        while (st.hasMoreTokens()) {
            String reservedScreenname = st.nextToken().trim().toLowerCase();
            result.add(reservedScreenname);
        }//  w  ww  .  j  a v a  2 s. c om
    }
    LOG.debug("Property '" + PROPERTY_SCREENNAME_RESERVED + "'  value: '" + value
            + "'. Used reserved screennames from list: '" + result + "'");
    return result;
}

From source file:com.excilys.service.ClpSerializer.java

License:Open Source License

public static String getServletContextName() {
    if (Validator.isNotNull(_servletContextName)) {
        return _servletContextName;
    }/*from www .  ja  va2s . 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,
                    "searchTask-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("searchTask-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 = "searchTask-portlet";
        }

        return _servletContextName;
    }
}

From source file:com.ext.portlet.halcon.service.ClpSerializer.java

License:Open Source License

public static String getServletContextName() {
    if (Validator.isNotNull(_servletContextName)) {
        return _servletContextName;
    }/*from  w w w.jav  a 2s.  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,
                    "capa-halcon-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("capa-halcon-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 = "capa-halcon-portlet";
        }

        return _servletContextName;
    }
}

From source file:com.ext.portlet.models.CollaboratoriumModelingService.java

License:Open Source License

public static ClientRepository repository() throws SystemException {
    if (instance == null) {

        synchronized (mutex) {

            if (instance == null) {
                // start in separate thread as container can block waiting
                // for this and if there is no roma-server available it will
                // block forever
                new Thread(new Runnable() {

                    @Override//  w ww. ja  v  a2  s  . c  om
                    public void run() {
                        // TODO Auto-generated method stub
                        // try to read configuration from default location
                        // (portal-ext.properties)
                        String host = PropsUtil.get("edu.mit.roma.address");
                        if (host == null) {
                            _log.error(
                                    "Can't find edu.mit.roma.address property, it has to be set in portal-ext.properties");
                        }

                        _log.info("Starting up modeling client (" + host + ")");
                        try {
                            instance = ClientRepository.instance(host);

                            for (Simulation s : ClientRepository.instance().getAllSimulations()) {
                                _log.info("Loaded... " + s.getName());
                            }
                            _log.info("Modeling client initialized");
                        } catch (Exception e) {
                            _log.error(e);
                        }
                    }
                }).start();
            }
        }

    }
    return instance;
}

From source file:com.ext.portlet.models.StartupAction.java

License:Open Source License

protected void doRun(long companyId) throws Exception {
    _log.info("Starting up modeling client ");
    String host = PropsUtil.get("edu.mit.roma.address");
    ClientRepository.instance(host);/*from   www.j  av a 2 s  .  c  o m*/

    for (Simulation s : ClientRepository.instance().getAllSimulations()) {
        _log.info("Loaded... " + s.getName());
    }
    _log.info("Modeling client initialized");

}

From source file:com.ext.portlet.pin.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 .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,
                    "Servicios-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("Servicios-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 = "Servicios-portlet";
        }

        return _servletContextName;
    }
}

From source file:com.felixchristy.service.service.ClpSerializer.java

License:Open Source License

public static String getServletContextName() {
    if (Validator.isNotNull(_servletContextName)) {
        return _servletContextName;
    }//w  w  w.  java  2s.  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,
                    "faq-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("faq-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 = "faq-portlet";
        }

        return _servletContextName;
    }
}

From source file:com.fl.uploadfile.service.ClpSerializer.java

License:Open Source License

public static String getServletContextName() {
    if (Validator.isNotNull(_servletContextName)) {
        return _servletContextName;
    }/* w w  w.  j a  v a 2 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,
                    "UploadFile-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("UploadFile-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 = "UploadFile-portlet";
        }

        return _servletContextName;
    }
}