Example usage for com.liferay.portal.kernel.deploy.auto AutoDeployUtil unregisterDir

List of usage examples for com.liferay.portal.kernel.deploy.auto AutoDeployUtil unregisterDir

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.deploy.auto AutoDeployUtil unregisterDir.

Prototype

public static void unregisterDir(String name) 

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  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.sqli.liferay.imex.portal.events.ImExShutdownAction.java

License:Open Source License

@Override
public void run(String[] ids) throws ActionException {
    // Auto deploy

    if (this.executed) {
        return;//from  w ww .ja v  a 2s  .com
    }

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

    AutoDeployUtil.unregisterDir(ImExStartupAction.IMEX_AUTO_DEPLOY_DIR);

    this.executed = true;
}

From source file:com.sqli.liferay.imex.portal.events.ImExStartupAction.java

License:Open Source License

@Override
public void run(String[] ids) throws ActionException {
    // Auto deploy

    if (this.executed) {
        return;//w  w w . j  a  v  a  2  s.  c om
    }

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

    AutoDeployUtil.unregisterDir(IMEX_AUTO_DEPLOY_DIR);

    try {
        if (PrefsPropsUtil.getBoolean(ImExPropsKeys.ENABLED, ImExPropsValues.ENABLED)) {

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

            File deployDir = new File(
                    PrefsPropsUtil.getString(ImExPropsKeys.DEPLOY_DIR, ImExPropsValues.DEPLOY_DIR));
            long interval = PrefsPropsUtil.getLong(ImExPropsKeys.INTERVAL, ImExPropsValues.INTERVAL);
            int blacklistThreshold = PrefsPropsUtil.getInteger(ImExPropsKeys.BLACKLIST_THRESHOLD,
                    ImExPropsValues.BLACKLIST_THRESHOLD);

            List<AutoDeployListener> autoDeployListeners = getAutoDeployListeners();

            AutoDeployDir autoDeployDir = new ImExAutoDeployDir(IMEX_AUTO_DEPLOY_DIR, deployDir, interval,
                    blacklistThreshold, autoDeployListeners);

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

    this.executed = true;
}

From source file:com.sqli.liferay.imex.servlet.ImExServletContextListener.java

License:Open Source License

@Override
protected void doPortalDestroy() throws Exception {

    if (_log.isInfoEnabled()) {
        _log.info("Unregistering IMEX auto deploy directories");
    }/* ww  w.jav a2 s. c o m*/

    AutoDeployUtil.unregisterDir(ImExStartupAction.IMEX_AUTO_DEPLOY_DIR);
}

From source file:com.sqli.liferay.imex.servlet.ImExServletContextListener.java

License:Open Source License

@Override
protected void doPortalInit() throws Exception {

    if (_log.isInfoEnabled()) {
        _log.info("Unregistering IMEX auto deploy directories");
    }//  w  w w.j  av  a 2s. c o  m

    AutoDeployUtil.unregisterDir(IMEX_AUTO_DEPLOY_DIR);

    try {
        if (PrefsPropsUtil.getBoolean(ImExPropsKeys.ENABLED, ImExPropsValues.ENABLED)) {

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

            File deployDir = new File(
                    PrefsPropsUtil.getString(ImExPropsKeys.DEPLOY_DIR, ImExPropsValues.DEPLOY_DIR));
            long interval = PrefsPropsUtil.getLong(ImExPropsKeys.INTERVAL, ImExPropsValues.INTERVAL);
            int blacklistThreshold = PrefsPropsUtil.getInteger(ImExPropsKeys.BLACKLIST_THRESHOLD,
                    ImExPropsValues.BLACKLIST_THRESHOLD);

            List<AutoDeployListener> autoDeployListeners = getAutoDeployListeners();

            AutoDeployDir autoDeployDir = new ImExAutoDeployDir(IMEX_AUTO_DEPLOY_DIR, deployDir, interval,
                    blacklistThreshold, autoDeployListeners);

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

}

From source file:eu.ibacz.extlet.tomcatreload.GlobalShutdownAction.java

License:Open Source License

@Override
public void run(String[] arg0) throws ActionException {

    // Invalidate & clear the Cache registry

    try {//from   w  ww .j  ava2  s .  com
        new LiferayKernelReflectionUtil().invalidateCacheRegistry();
    } catch (Exception e) {
        if (_log.isWarnEnabled()) {
            _log.warn(e, e);
        }
    }

    // Invalidate InstancePool

    try {
        new LiferayKernelReflectionUtil().invalidateInstancePool();
    } catch (Exception e) {
        if (_log.isWarnEnabled()) {
            _log.warn(e, e);
        }
    }

    // Remove all jobs from Quartz scheduler
    try {
        ((ExtletJobSchedulerImpl) JobSchedulerUtil.getJobScheduler()).deleteAllJobs();
    } catch (Exception e) {
        if (_log.isWarnEnabled()) {
            _log.warn(e, e);
        }
    }

    // Create new singleton instance of HotDeployUtil
    try {
        new LiferayKernelReflectionUtil().reinitializeHotDeployUtil();
    } catch (Exception e) {
        if (_log.isWarnEnabled()) {
            _log.warn(e, e);
        }
    }

    // Invalidate PortletBagPool's map

    try {
        new LiferayKernelReflectionUtil().invalidatePortletBagPool();
    } catch (Exception e) {
        if (_log.isWarnEnabled()) {
            _log.warn(e, e);
        }
    }

    // Reinitialize MethodCache with new instance

    try {
        new LiferayKernelReflectionUtil().reinitializeMethodCache();
    } catch (Exception e) {
        if (_log.isWarnEnabled()) {
            _log.warn(e, e);
        }
    }

    // Invalidate JNDIUtils's static cache

    try {
        new LiferayKernelReflectionUtil().invalidateJNDIUtil();
    } catch (Exception e) {
        if (_log.isWarnEnabled()) {
            _log.warn(e, e);
        }
    }

    // stop auto deploy scanner
    try {
        AutoDeployUtil.unregisterDir("defaultAutoDeployDir");
    } catch (Exception e) {
        if (_log.isWarnEnabled()) {
            _log.warn(e, e);
        }
    }

}