Example usage for com.liferay.portal.kernel.messaging DestinationNames HOT_DEPLOY

List of usage examples for com.liferay.portal.kernel.messaging DestinationNames HOT_DEPLOY

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.messaging DestinationNames HOT_DEPLOY.

Prototype

String HOT_DEPLOY

To view the source code for com.liferay.portal.kernel.messaging DestinationNames HOT_DEPLOY.

Click Source Link

Usage

From source file:com.liferay.calendar.servlet.CalendarServletContextListener.java

License:Open Source License

@Override
protected void doPortalDestroy() throws Exception {
    MessageBusUtil.unregisterMessageListener(DestinationNames.HOT_DEPLOY, _messageListener);
}

From source file:com.liferay.calendar.servlet.CalendarServletContextListener.java

License:Open Source License

@Override
protected void doPortalInit() throws Exception {
    _messageListener = new HotDeployMessageListener(ClpSerializer.getServletContextName()) {

        @Override/*from  w  ww.j  a v  a  2s  .co m*/
        protected void onDeploy(Message message) throws Exception {
            if (!PortletPropsValues.CALENDAR_SYNC_CALEVENTS_ON_STARTUP) {
                return;
            }

            StopWatch stopWatch = null;

            if (_log.isInfoEnabled()) {
                stopWatch = new StopWatch();

                stopWatch.start();
            }

            CalendarImporterLocalServiceUtil.importCalEvents();

            if (_log.isInfoEnabled()) {
                StringBundler sb = new StringBundler(6);

                sb.append("Calendar events synchronization takes ");
                sb.append(stopWatch.getTime());
                sb.append(" ms. Set the property ");
                sb.append("\"calendar.sync.calevents.on.startup\" ");
                sb.append("to \"false\" to disable calendar events ");
                sb.append("synchronization.");

                _log.info(sb.toString());
            }
        }

    };

    MessageBusUtil.registerMessageListener(DestinationNames.HOT_DEPLOY, _messageListener);
}

From source file:com.liferay.chat.servlet.ChatServletContextListener.java

License:Open Source License

@Override
protected void doPortalInit() {
    _messageListener = new HotDeployMessageListener(ClpSerializer.getServletContextName(), "contacts-portlet") {

        @Override/*from  w w w.  j a  v a2s .  com*/
        protected void onUndeploy(Message message) throws Exception {
            ChatExtensionsUtil.unregister(message.getString("servletContextName"));
        }

    };

    MessageBusUtil.registerMessageListener(DestinationNames.HOT_DEPLOY, _messageListener);
}

From source file:com.liferay.contacts.servlet.ContactsServletContextListener.java

License:Open Source License

@Override
protected void doPortalInit() {
    _messageListener = new HotDeployMessageListener(ClpSerializer.getServletContextName(), "chat-portlet") {

        @Override//from  w w w .  j a va2  s . c om
        protected void onDeploy(Message message) throws Exception {
            registerChatExtension();
        }

        @Override
        protected void onUndeploy(Message message) throws Exception {
            ContactsExtensionsUtil.unregister(message.getString("servletContextName"));
        }

    };

    MessageBusUtil.registerMessageListener(DestinationNames.HOT_DEPLOY, _messageListener);
}

From source file:com.liferay.content.targeting.deploy.hot.extender.internal.activator.HotDeployTrackerComponent.java

License:Open Source License

@Activate
protected void activate(final BundleContext bundleContext) {
    _serviceTracker = new ServiceTracker<ServletContext, ServletContext>(bundleContext, ServletContext.class,
            new ServletContextTrackerCustomizer());

    _serviceTracker.open();/*from   w ww .j  av a2s.  c  om*/

    _messageBus.registerMessageListener(DestinationNames.HOT_DEPLOY, _serviceRegistratorMessageListener);
}

From source file:com.liferay.content.targeting.deploy.hot.extender.internal.activator.HotDeployTrackerComponent.java

License:Open Source License

@Deactivate
protected void deactivate(final BundleContext bundleContext) {
    _serviceTracker.close();/*  ww  w .  ja  v  a  2  s. c o m*/

    _serviceTracker = null;

    _messageBus.unregisterMessageListener(DestinationNames.HOT_DEPLOY, _serviceRegistratorMessageListener);
}

From source file:com.liferay.exportimport.resources.importer.internal.messaging.ResourcesImporterHotDeployMessageListener.java

License:Open Source License

@Reference(target = "(destination.name=" + DestinationNames.HOT_DEPLOY + ")", unbind = "-")
protected void setDestination(Destination destination) {
}

From source file:com.liferay.resourcesimporter.servlet.ResourcesImporterServletContextListener.java

License:Open Source License

protected void doPortalDestroy() throws Exception {
    MessageBusUtil.unregisterMessageListener(DestinationNames.HOT_DEPLOY, _messageListener);
}

From source file:com.liferay.resourcesimporter.servlet.ResourcesImporterServletContextListener.java

License:Open Source License

protected void doPortalInit() {
    _messageListener = new HotDeployMessageListener() {

        protected void onDeploy(Message message) throws Exception {
            initialize(message);/* w ww  .  j  a  v  a2 s . c  o m*/
        }

    };

    MessageBusUtil.registerMessageListener(DestinationNames.HOT_DEPLOY, _messageListener);
}

From source file:com.liferay.scriptingexecutor.servlet.ScriptingExecutorServletContextListener.java

License:Open Source License

@Override
protected void doPortalInit() {
    _messageListener = new HotDeployMessageListener() {

        @Override/*from  w w w  .j a  va2s .c om*/
        protected void onDeploy(Message message) throws Exception {
            ServletContext servletContext = ServletContextPool.get(message.getString("servletContextName"));

            URL url = servletContext.getResource(_SCRIPTS_DIR);

            if (url == null) {
                return;
            }

            Set<String> supportedLanguages = ScriptingUtil.getSupportedLanguages();

            Properties pluginPackageProperties = getPluginPackageProperties(servletContext);

            String language = getLanguage(pluginPackageProperties);

            if (!supportedLanguages.contains(language)) {
                if (_log.isWarnEnabled()) {
                    _log.warn("Unsupported language " + language);
                }

                return;
            }

            String requiredDeploymentContexts = pluginPackageProperties
                    .getProperty("required-deployment-contexts");

            if (Validator.isNull(requiredDeploymentContexts)) {
                return;
            }

            ClassLoader classLoader = ClassLoaderUtil
                    .getAggregatePluginsClassLoader(StringUtil.split(requiredDeploymentContexts), false);

            executeScripts(servletContext, language, classLoader);
        }

        @Override
        protected void onUndeploy(Message message) throws Exception {
            ServletContext servletContext = ServletContextPool.get(message.getString("servletContextName"));

            if (servletContext != null) {
                Properties pluginPackageProperties = getPluginPackageProperties(servletContext);

                String language = getLanguage(pluginPackageProperties);

                ScriptingUtil.clearCache(language);
            } else {
                Set<String> supportedLanguages = ScriptingUtil.getSupportedLanguages();

                for (String supportedLanguage : supportedLanguages) {
                    ScriptingUtil.clearCache(supportedLanguage);
                }
            }
        }

    };

    MessageBusUtil.registerMessageListener(DestinationNames.HOT_DEPLOY, _messageListener);
}