Example usage for com.liferay.portal.kernel.util InstancePool contains

List of usage examples for com.liferay.portal.kernel.util InstancePool contains

Introduction

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

Prototype

public static boolean contains(String className) 

Source Link

Usage

From source file:com.liferay.portlet.wiki.util.WikiUtil.java

License:Open Source License

private WikiEngine _getEngine(String format) throws WikiFormatException {
    WikiEngine engine = _engines.get(format);

    if (engine != null) {
        return engine;
    }/*from w  w w . j a v  a2 s  .  com*/

    synchronized (_engines) {
        engine = _engines.get(format);

        if (engine != null) {
            return engine;
        }

        try {
            String engineClass = PropsUtil.get(PropsKeys.WIKI_FORMATS_ENGINE, new Filter(format));

            if (engineClass == null) {
                throw new WikiFormatException(format);
            }

            if (!InstancePool.contains(engineClass)) {
                engine = (WikiEngine) InstancePool.get(engineClass);

                engine.setMainConfiguration(
                        _readConfigurationFile(PropsKeys.WIKI_FORMATS_CONFIGURATION_MAIN, format));

                engine.setInterWikiConfiguration(
                        _readConfigurationFile(PropsKeys.WIKI_FORMATS_CONFIGURATION_INTERWIKI, format));
            } else {
                engine = (WikiEngine) InstancePool.get(engineClass);
            }

            _engines.put(format, engine);

            return engine;
        } catch (Exception e) {
            throw new WikiFormatException(e);
        }
    }
}