Example usage for com.liferay.portal.kernel.deploy.hot HotDeployEvent HotDeployEvent

List of usage examples for com.liferay.portal.kernel.deploy.hot HotDeployEvent HotDeployEvent

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.deploy.hot HotDeployEvent HotDeployEvent.

Prototype

public HotDeployEvent(ServletContext servletContext, ClassLoader contextClassLoader) 

Source Link

Usage

From source file:com.liferay.application.list.deploy.hot.test.LegacyPortletPanelAppHotDeployListenerTest.java

License:Open Source License

protected HotDeployEvent getHotDeployEvent(String location) throws Exception {

    Class<?> clazz = getClass();

    ClassLoader classLoader = clazz.getClassLoader();

    ResourceLoader resourceLoader = new TestResourceLoader(location, classLoader);

    ServletContext servletContext = new TestServletContext("/", resourceLoader);

    return new HotDeployEvent(servletContext, classLoader);
}

From source file:com.liferay.web.extender.internal.WebPluginDeployer.java

License:Open Source License

public void doStart(Bundle bundle, String servletContextName) throws Exception {

    sendEvent(bundle, "org/osgi/service/web/DEPLOYING", null, false);

    ServletContext servletContext = ServletContextPool.get(servletContextName);

    if (servletContext != null) {
        sendEvent(bundle, "org/osgi/service/web/FAILED", null, true);

        _collidedWabs.add(bundle);//from w  w  w . ja v  a 2s .c o  m

        return;
    }

    BundleServletContext bundleServletContext = null;

    try {
        servletContext = _servletContextTracker.getService();

        bundleServletContext = new BundleServletContext(servletContext, _portletServlet);

        bundleServletContext.setAttribute(OSGiConstants.OSGI_BUNDLE, bundle);
        bundleServletContext.setAttribute(OSGiConstants.OSGI_BUNDLECONTEXT, _bundleContext);

        HotDeployUtil.fireDeployEvent(
                new HotDeployEvent(bundleServletContext, bundleServletContext.getClassLoader()));

        bundleServletContext.open();

        sendEvent(bundle, "org/osgi/service/web/DEPLOYED", null, false);
    } catch (Exception e) {
        destroy(bundleServletContext);

        sendEvent(bundle, "org/osgi/service/web/FAILED", e, false);
    }
}

From source file:com.liferay.web.extender.internal.WebPluginDeployer.java

License:Open Source License

public void doStop(Bundle bundle, String servletContextName) throws Exception {

    sendEvent(bundle, "org/osgi/service/web/UNDEPLOYING", null, false);

    ServletContext servletContext = ServletContextPool.get(servletContextName);

    if (servletContext == null) {
        sendEvent(bundle, "org/osgi/service/web/FAILED", null, false);

        return;/*w  ww.j a v  a 2  s. co m*/
    }

    ClassLoader classLoader = (ClassLoader) servletContext.getAttribute("bundle.classloader");

    HotDeployUtil.fireUndeployEvent(new HotDeployEvent(servletContext, classLoader));

    destroy(servletContext);

    sendEvent(bundle, "org/osgi/service/web/UNDEPLOYED", null, false);

    handleCollidedWabs(servletContextName);
}