Example usage for com.liferay.portal.kernel.util SortedProperties SortedProperties

List of usage examples for com.liferay.portal.kernel.util SortedProperties SortedProperties

Introduction

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

Prototype

public SortedProperties(Properties properties) 

Source Link

Usage

From source file:com.liferay.mail.util.MailSessionFactoryBean.java

License:Open Source License

@Override
protected Session createInstance() throws Exception {
    Properties properties = PropsUtil.getProperties(_propertyPrefix, true);

    String jndiName = properties.getProperty("jndi.name");

    if (Validator.isNotNull(jndiName)) {
        try {/*from   w w w . ja v  a 2  s  .c om*/
            return (Session) JNDIUtil.lookup(new InitialContext(), jndiName);
        } catch (Exception e) {
            _log.error("Unable to lookup " + jndiName, e);
        }
    }

    Session session = Session.getInstance(properties);

    if (_log.isDebugEnabled()) {
        session.setDebug(true);

        SortedProperties sortedProperties = new SortedProperties(session.getProperties());

        _log.debug("Properties for prefix " + _propertyPrefix);

        sortedProperties.list(System.out);
    }

    return session;
}