Package org.apache.openejb.assembler.classic.event

Examples of org.apache.openejb.assembler.classic.event.AssemblerBeforeApplicationDestroyed


            final Context globalContext = containerSystem.getJNDIContext();
            final AppContext appContext = containerSystem.getAppContext(appInfo.appId);
            final ClassLoader classLoader = appContext.getClassLoader();

            SystemInstance.get().fireEvent(new AssemblerBeforeApplicationDestroyed(appInfo, appContext));

            if (null == appContext) {
                logger.warning("Application id '" + appInfo.appId + "' not found in: " + Arrays.toString(containerSystem.getAppContextKeys()));
                return;
            } else {
View Full Code Here


                assertNotNull(Reflections.get(beforeLoader, "parent")); // getParent != parent from WebAppClassLoader
            }

            loader.internalStop();

            server.undeploy(new AssemblerBeforeApplicationDestroyed(info, context));

            {
                final ClassLoader afterLoader = SystemInstance.get().getComponent(ContainerSystem.class).getWebContext("test").getClassLoader();
                assertSame(loader, afterLoader);
                assertNotNull(afterLoader);
                assertNull(Reflections.get(afterLoader, "parent"));
            }

            loader.start();
            // TomcatWebAppBuilder ill catch start event from StandardContext and force a classloader
            Reflections.set(loader, "parent", ParentClassLoaderFinder.Helper.get());

            server.afterApplicationCreated(new AssemblerAfterApplicationCreated(info, context, Collections.<BeanContext>emptyList()));

            {
                final ClassLoader afterLoader = SystemInstance.get().getComponent(ContainerSystem.class).getWebContext("test").getClassLoader();
                assertSame(loader, afterLoader);
                assertNotNull(afterLoader);
                assertNotNull(Reflections.get(afterLoader, "parent"));
            }

            server.undeploy(new AssemblerBeforeApplicationDestroyed(info, context));
        } finally {
            server.stop();
        }
    }
View Full Code Here

    @Override
    public void stop() throws ServiceException {
        if (assembler != null) {
            SystemInstance.get().removeObserver(this);
            for (final AppInfo appInfo : new ArrayList<AppInfo>(deployedApplications)) {
                undeploy(new AssemblerBeforeApplicationDestroyed(appInfo, null));
            }
        }

        for (final DeployedService service : services) {
            undeployRestObject(service.address);
View Full Code Here

    @Override
    public void stop() throws ServiceException {
        if (assembler != null) {
            SystemInstance.get().removeObserver(this);
            for (final AppInfo appInfo : new ArrayList<AppInfo>(deployedApplications)) {
                undeploy(new AssemblerBeforeApplicationDestroyed(appInfo, null));
            }
            assembler = null;
            if (SystemInstance.get().getComponent(WsService.class) == this) {
                SystemInstance.get().removeComponent(WsService.class);
            }
View Full Code Here

            final Context globalContext = containerSystem.getJNDIContext();
            final AppContext appContext = containerSystem.getAppContext(appInfo.appId);
            final ClassLoader classLoader = appContext.getClassLoader();

            SystemInstance.get().fireEvent(new AssemblerBeforeApplicationDestroyed(appInfo, appContext));

            if (null == appContext) {
                logger.warning("Application id '" + appInfo.appId + "' not found in: " + Arrays.toString(containerSystem.getAppContextKeys()));
                return;
            } else {
View Full Code Here

            final Context globalContext = containerSystem.getJNDIContext();
            final AppContext appContext = containerSystem.getAppContext(appInfo.appId);
            final ClassLoader classLoader = appContext.getClassLoader();

            SystemInstance.get().fireEvent(new AssemblerBeforeApplicationDestroyed(appInfo, appContext));

            if (null == appContext) {
                logger.warning("Application id '" + appInfo.appId + "' not found in: " + Arrays.toString(containerSystem.getAppContextKeys()));
                return;
            } else {
View Full Code Here

                assertNotNull(Reflections.get(beforeLoader, "parent"));
            }

            loader.internalStop();

            server.undeploy(new AssemblerBeforeApplicationDestroyed(info, context));

            {
                final URLClassLoader afterLoader = URLClassLoader.class.cast(SystemInstance.get().getComponent(ContainerSystem.class).getWebContext("test").getClassLoader());
                assertSame(loader, afterLoader);
                assertNotNull(afterLoader);
                assertEquals(0, afterLoader.getURLs().length);
                assertEquals(LifecycleState.STOPPED, loader.getState());
            }

            final StandardRoot resources = new StandardRoot();
            loader.setResources(resources);
            resources.setContext(new StandardContext() {
                @Override
                public String getDocBase() {
                    final File file = new File("target/foo");
                    file.mkdirs();
                    return file.getAbsolutePath();
                }

                @Override
                public String getMBeanKeyProperties() {
                    return "foo";
                }
                {}});
            resources.start();
            loader.start();
            // TomcatWebAppBuilder ill catch start event from StandardCo1ntext and force a classloader
            Reflections.set(loader, "parent", ParentClassLoaderFinder.Helper.get());

            server.afterApplicationCreated(new AssemblerAfterApplicationCreated(info, context, Collections.<BeanContext>emptyList()));

            {
                final ClassLoader afterLoader = SystemInstance.get().getComponent(ContainerSystem.class).getWebContext("test").getClassLoader();
                assertSame(loader, afterLoader);
                assertNotNull(afterLoader);
                assertNotNull(Reflections.get(afterLoader, "parent"));
            }

            server.undeploy(new AssemblerBeforeApplicationDestroyed(info, context));
        } finally {
            server.stop();
        }
    }
View Full Code Here

            final Context globalContext = containerSystem.getJNDIContext();
            final AppContext appContext = containerSystem.getAppContext(appInfo.appId);
            final ClassLoader classLoader = appContext.getClassLoader();

            SystemInstance.get().fireEvent(new AssemblerBeforeApplicationDestroyed(appInfo, appContext));

            if (null == appContext) {
                logger.warning("Application id '" + appInfo.appId + "' not found in: " + Arrays.toString(containerSystem.getAppContextKeys()));
                return;
            } else {
View Full Code Here

        try {
            deployedApplications.remove(appInfo.path);
            logger.info("destroyApplication.start", appInfo.path);

            SystemInstance.get().fireEvent(new AssemblerBeforeApplicationDestroyed(appInfo));

            final Context globalContext = containerSystem.getJNDIContext();
            final AppContext appContext = containerSystem.getAppContext(appInfo.appId);
            final ClassLoader classLoader = appContext.getClassLoader();
View Full Code Here

        try {
            deployedApplications.remove(appInfo.path);
            logger.info("destroyApplication.start", appInfo.path);

            SystemInstance.get().fireEvent(new AssemblerBeforeApplicationDestroyed(appInfo));

            final Context globalContext = containerSystem.getJNDIContext();
            final AppContext appContext = containerSystem.getAppContext(appInfo.appId);

            if (null == appContext) {
View Full Code Here

TOP

Related Classes of org.apache.openejb.assembler.classic.event.AssemblerBeforeApplicationDestroyed

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.