Example usage for com.liferay.portal.kernel.util PropsKeys PLUGIN_NOTIFICATIONS_PACKAGES_IGNORED

List of usage examples for com.liferay.portal.kernel.util PropsKeys PLUGIN_NOTIFICATIONS_PACKAGES_IGNORED

Introduction

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

Prototype

String PLUGIN_NOTIFICATIONS_PACKAGES_IGNORED

To view the source code for com.liferay.portal.kernel.util PropsKeys PLUGIN_NOTIFICATIONS_PACKAGES_IGNORED.

Click Source Link

Usage

From source file:com.liferay.portlet.plugininstaller.action.InstallPluginAction.java

License:Open Source License

protected void deployConfiguration(ActionRequest actionRequest) throws Exception {

    boolean enabled = ParamUtil.getBoolean(actionRequest, "enabled");
    String deployDir = ParamUtil.getString(actionRequest, "deployDir");
    String destDir = ParamUtil.getString(actionRequest, "destDir");
    long interval = ParamUtil.getLong(actionRequest, "interval");
    int blacklistThreshold = ParamUtil.getInteger(actionRequest, "blacklistThreshold");
    boolean unpackWar = ParamUtil.getBoolean(actionRequest, "unpackWar");
    boolean customPortletXml = ParamUtil.getBoolean(actionRequest, "customPortletXml");
    String jbossPrefix = ParamUtil.getString(actionRequest, "jbossPrefix");
    String tomcatConfDir = ParamUtil.getString(actionRequest, "tomcatConfDir");
    String tomcatLibDir = ParamUtil.getString(actionRequest, "tomcatLibDir");
    String pluginRepositoriesTrusted = ParamUtil.getString(actionRequest, "pluginRepositoriesTrusted");
    String pluginRepositoriesUntrusted = ParamUtil.getString(actionRequest, "pluginRepositoriesUntrusted");
    boolean pluginNotificationsEnabled = ParamUtil.getBoolean(actionRequest, "pluginNotificationsEnabled");
    String pluginPackagesIgnored = ParamUtil.getString(actionRequest, "pluginPackagesIgnored");

    PortletPreferences preferences = PrefsPropsUtil.getPreferences();

    preferences.setValue(PropsKeys.AUTO_DEPLOY_ENABLED, String.valueOf(enabled));
    preferences.setValue(PropsKeys.AUTO_DEPLOY_DEPLOY_DIR, deployDir);
    preferences.setValue(PropsKeys.AUTO_DEPLOY_DEST_DIR, destDir);
    preferences.setValue(PropsKeys.AUTO_DEPLOY_INTERVAL, String.valueOf(interval));
    preferences.setValue(PropsKeys.AUTO_DEPLOY_BLACKLIST_THRESHOLD, String.valueOf(blacklistThreshold));
    preferences.setValue(PropsKeys.AUTO_DEPLOY_UNPACK_WAR, String.valueOf(unpackWar));
    preferences.setValue(PropsKeys.AUTO_DEPLOY_CUSTOM_PORTLET_XML, String.valueOf(customPortletXml));
    preferences.setValue(PropsKeys.AUTO_DEPLOY_JBOSS_PREFIX, jbossPrefix);
    preferences.setValue(PropsKeys.AUTO_DEPLOY_TOMCAT_CONF_DIR, tomcatConfDir);
    preferences.setValue(PropsKeys.AUTO_DEPLOY_TOMCAT_LIB_DIR, tomcatLibDir);
    preferences.setValue(PropsKeys.PLUGIN_REPOSITORIES_TRUSTED, pluginRepositoriesTrusted);
    preferences.setValue(PropsKeys.PLUGIN_REPOSITORIES_UNTRUSTED, pluginRepositoriesUntrusted);
    preferences.setValue(PropsKeys.PLUGIN_NOTIFICATIONS_ENABLED, String.valueOf(pluginNotificationsEnabled));
    preferences.setValue(PropsKeys.PLUGIN_NOTIFICATIONS_PACKAGES_IGNORED, pluginPackagesIgnored);

    preferences.store();/*from   w w  w .  ja  v  a2  s .  c o m*/

    reloadRepositories(actionRequest);

    if (_log.isInfoEnabled()) {
        _log.info("Unregistering auto deploy directories");
    }

    AutoDeployUtil.unregisterDir("defaultAutoDeployDir");

    if (enabled) {
        if (_log.isInfoEnabled()) {
            _log.info("Registering auto deploy directories");
        }

        List<AutoDeployListener> autoDeployListeners = GlobalStartupAction.getAutoDeployListeners();

        AutoDeployDir autoDeployDir = new AutoDeployDir("defaultAutoDeployDir", new File(deployDir),
                new File(destDir), interval, blacklistThreshold, autoDeployListeners);

        AutoDeployUtil.registerDir(autoDeployDir);
    } else {
        if (_log.isInfoEnabled()) {
            _log.info("Not registering auto deploy directories");
        }
    }
}

From source file:com.liferay.portlet.plugininstaller.action.InstallPluginAction.java

License:Open Source License

protected void ignorePackages(ActionRequest actionRequest) throws Exception {

    String pluginPackagesIgnored = ParamUtil.getString(actionRequest, "pluginPackagesIgnored");

    String oldPluginPackagesIgnored = PrefsPropsUtil.getString(PropsKeys.PLUGIN_NOTIFICATIONS_PACKAGES_IGNORED);

    PortletPreferences preferences = PrefsPropsUtil.getPreferences();

    if (Validator.isNotNull(oldPluginPackagesIgnored)) {
        preferences.setValue(PropsKeys.PLUGIN_NOTIFICATIONS_PACKAGES_IGNORED,
                oldPluginPackagesIgnored.concat(StringPool.NEW_LINE).concat(pluginPackagesIgnored));
    } else {//from ww  w  .j  av a  2  s.  co m
        preferences.setValue(PropsKeys.PLUGIN_NOTIFICATIONS_PACKAGES_IGNORED, pluginPackagesIgnored);
    }

    preferences.store();

    PluginPackageUtil.refreshUpdatesAvailableCache();
}

From source file:com.liferay.portlet.plugininstaller.action.InstallPluginAction.java

License:Open Source License

protected void unignorePackages(ActionRequest actionRequest) throws Exception {

    String[] pluginPackagesUnignored = StringUtil
            .splitLines(ParamUtil.getString(actionRequest, "pluginPackagesUnignored"));

    String[] pluginPackagesIgnored = PrefsPropsUtil.getStringArray(
            PropsKeys.PLUGIN_NOTIFICATIONS_PACKAGES_IGNORED, StringPool.NEW_LINE,
            PropsValues.PLUGIN_NOTIFICATIONS_PACKAGES_IGNORED);

    StringBundler sb = new StringBundler();

    for (int i = 0; i < pluginPackagesIgnored.length; i++) {
        String packageId = pluginPackagesIgnored[i];

        if (!ArrayUtil.contains(pluginPackagesUnignored, packageId)) {
            sb.append(packageId);//from w w  w.j av  a  2s  .c  om
            sb.append(StringPool.NEW_LINE);
        }
    }

    PortletPreferences preferences = PrefsPropsUtil.getPreferences();

    preferences.setValue(PropsKeys.PLUGIN_NOTIFICATIONS_PACKAGES_IGNORED, sb.toString());

    preferences.store();

    PluginPackageUtil.refreshUpdatesAvailableCache();
}