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

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

Introduction

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

Prototype

public static Object get(String className) 

Source Link

Usage

From source file:com.labimo.Oauth2Filter.java

License:Open Source License

public Oauth2Filter() {
    for (String autoLoginClassName : PropsValues.AUTO_LOGIN_HOOKS) {
        AutoLogin autoLogin = (AutoLogin) InstancePool.get(autoLoginClassName);

        _autoLogins.add(autoLogin);/*from www.  ja  v  a2  s .co  m*/
    }
}

From source file:com.liferay.document.library.convert.test.DocumentLibraryConvertProcessTest.java

License:Open Source License

@Before
public void setUp() throws Exception {
    _sourceStore = _storeFactory.getStore(_CLASS_NAME_FILE_SYSTEM_STORE);

    _storeFactory.setStore(_CLASS_NAME_FILE_SYSTEM_STORE);

    _group = GroupTestUtil.addGroup();//from  ww w.j a  va  2  s .c  o m

    _convertProcess = (ConvertProcess) InstancePool.get(DocumentLibraryConvertProcess.class.getName());

    _convertProcess.setParameterValues(new String[] { _CLASS_NAME_DB_STORE, Boolean.TRUE.toString() });
}

From source file:com.liferay.portlet.admin.action.EditServerAction.java

License:Open Source License

protected String convertProcess(ActionRequest actionRequest, ActionResponse actionResponse, String cmd)
        throws Exception {

    ActionResponseImpl actionResponseImpl = (ActionResponseImpl) actionResponse;

    PortletSession portletSession = actionRequest.getPortletSession();

    String className = StringUtil.replaceFirst(cmd, "convertProcess.", StringPool.BLANK);

    ConvertProcess convertProcess = (ConvertProcess) InstancePool.get(className);

    String[] parameters = convertProcess.getParameterNames();

    if (parameters != null) {
        String[] values = new String[parameters.length];

        for (int i = 0; i < parameters.length; i++) {
            String parameter = className + StringPool.PERIOD + parameters[i];

            if (parameters[i].contains(StringPool.EQUAL)) {
                String[] parameterPair = StringUtil.split(parameters[i], CharPool.EQUAL);

                parameter = className + StringPool.PERIOD + parameterPair[0];
            }//from   ww w  .  j ava  2  s  .c  o m

            values[i] = ParamUtil.getString(actionRequest, parameter);
        }

        convertProcess.setParameterValues(values);
    }

    String path = convertProcess.getPath();

    if (path != null) {
        PortletURL portletURL = actionResponseImpl.createRenderURL();

        portletURL.setWindowState(WindowState.MAXIMIZED);

        portletURL.setParameter("struts_action", path);

        return portletURL.toString();
    } else {
        MaintenanceUtil.maintain(portletSession.getId(), className);

        MessageBusUtil.sendMessage(DestinationNames.CONVERT_PROCESS, className);

        return null;
    }
}

From source file:com.liferay.portlet.asset.service.impl.AssetEntryLocalServiceImpl.java

License:Open Source License

@Override
public void validate(long groupId, String className, long[] categoryIds, String[] tagNames)
        throws PortalException, SystemException {
    if (ExportImportThreadLocal.isImportInProcess()) {
        return;//from  w  w  w .  java 2  s  .  co  m
    }

    AssetEntryValidator validator = (AssetEntryValidator) InstancePool.get(PropsValues.ASSET_ENTRY_VALIDATOR);

    validator.validate(groupId, className, categoryIds, tagNames);
}

From source file:com.liferay.portlet.documentlibrary.antivirus.AntivirusScannerImpl.java

License:Open Source License

public AntivirusScannerImpl() {
    super((AntivirusScanner) InstancePool.get(PropsValues.DL_STORE_ANTIVIRUS_IMPL));
}

From source file:com.liferay.portlet.documentlibrary.util.DLProcessorRegistryImpl.java

License:Open Source License

public void cleanUp(FileEntry fileEntry) {
    if (!DLProcessorThreadLocal.isEnabled()) {
        return;/*from   www  .j  a v  a2s .co  m*/
    }

    for (String dlProcessorClassName : _DL_FILE_ENTRY_PROCESSORS) {
        DLProcessor dlProcessor = (DLProcessor) InstancePool.get(dlProcessorClassName);

        dlProcessor.cleanUp(fileEntry);
    }

    for (DLProcessor dlProcessor : _dlProcessors) {
        dlProcessor.cleanUp(fileEntry);
    }
}

From source file:com.liferay.portlet.documentlibrary.util.DLProcessorRegistryImpl.java

License:Open Source License

public void cleanUp(FileVersion fileVersion) {
    if (!DLProcessorThreadLocal.isEnabled()) {
        return;//from w ww. j ava 2s  .  c o m
    }

    for (String dlProcessorClassName : _DL_FILE_ENTRY_PROCESSORS) {
        DLProcessor dlProcessor = (DLProcessor) InstancePool.get(dlProcessorClassName);

        dlProcessor.cleanUp(fileVersion);
    }

    for (DLProcessor dlProcessor : _dlProcessors) {
        dlProcessor.cleanUp(fileVersion);
    }
}

From source file:com.liferay.portlet.documentlibrary.util.DLProcessorRegistryImpl.java

License:Open Source License

public void trigger(FileEntry fileEntry) {
    if (!DLProcessorThreadLocal.isEnabled()) {
        return;//w w  w  .  j a v  a  2s  . co m
    }

    if ((fileEntry == null) || (fileEntry.getSize() == 0)) {
        return;
    }

    FileVersion latestFileVersion = null;

    try {
        if (fileEntry.getModel() instanceof DLFileEntry) {
            DLFileEntry dlFileEntry = (DLFileEntry) fileEntry.getModel();

            latestFileVersion = new LiferayFileVersion(dlFileEntry.getLatestFileVersion(false));
        } else {
            latestFileVersion = fileEntry.getLatestFileVersion();
        }
    } catch (Exception e) {
        _log.error(e, e);

        return;
    }

    for (String dlProcessorClassName : _DL_FILE_ENTRY_PROCESSORS) {
        DLProcessor dlProcessor = (DLProcessor) InstancePool.get(dlProcessorClassName);

        if (dlProcessor.isSupported(latestFileVersion)) {
            dlProcessor.trigger(latestFileVersion);
        }
    }

    for (DLProcessor dlProcessor : _dlProcessors) {
        if (dlProcessor.isSupported(latestFileVersion)) {
            dlProcessor.trigger(latestFileVersion);
        }
    }
}

From source file:com.liferay.portlet.tags.service.impl.TagsAssetLocalServiceImpl.java

License:Open Source License

public void validate(String className, String[] entryNames) throws PortalException {

    TagsAssetValidator validator = (TagsAssetValidator) InstancePool.get(PropsValues.TAGS_ASSET_VALIDATOR);

    validator.validate(className, entryNames);
}

From source file:com.liferay.portlet.wiki.service.impl.WikiNodeLocalServiceImpl.java

License:Open Source License

protected WikiImporter getWikiImporter(String importer) throws SystemException {

    WikiImporter wikiImporter = _wikiImporters.get(importer);

    if (wikiImporter == null) {
        String importerClass = PropsUtil.get(PropsKeys.WIKI_IMPORTERS_CLASS, new Filter(importer));

        if (importerClass != null) {
            wikiImporter = (WikiImporter) InstancePool.get(importerClass);

            _wikiImporters.put(importer, wikiImporter);
        }//from  w w w .  j  av a  2 s.c o m

        if (importer == null) {
            throw new SystemException("Unable to instantiate wiki importer class " + importerClass);
        }
    }

    return wikiImporter;
}