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

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

Introduction

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

Prototype

String AUTO_DEPLOY_DEST_DIR

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

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  .j a  v  a  2 s  .c om

    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");
        }
    }
}