Package org.apache.webbeans.spi

Examples of org.apache.webbeans.spi.ContainerLifecycle


      ClassLoader cl = new ShrinkWrapClassLoader(archive);

      Thread.currentThread().setContextClassLoader(cl);

      final ShrinkWrapMetaDataDiscovery discovery = new ShrinkWrapMetaDataDiscovery(archive);
      ContainerLifecycle lifecycle = new StandaloneLifeCycle()
      {
         // TODO this override method will need to change to afterInitApplication(Properties) after 1.0.0-M4
         @Override
         public void init()
         {
            super.init();
            log.info("Using discovery service impl class adapted to ShrinkWrap archive : [" + discovery.getClass().getName() + "]");
            this.discoveryService = discovery;
         }
      };

      try
      {
         lifecycle.start(null);
      }
      catch (Exception e)
      {
         throw new RuntimeException("Failed to start standalone OpenWebBeans container", e);
      }

      BeanManager manager = lifecycle.getBeanManager();

      // start the application lifecycle
      ContextFactory.initApplicationContext(null);
      // start the session lifecycle
      HttpSession session = new MockHttpSession();
View Full Code Here


        service.endContext(ApplicationScoped.class, null);
    }

    public void beforeMethod(@Observes Before event)
    {
        ContainerLifecycle lc = lifecycle.get();
        if (lc == null)
        {
            // this may happen if there was a DeploymentError during CDI boot
            return;
        }

        ContextsService service = lc.getContextService();

        service.startContext(RequestScoped.class, null);
        service.startContext(SessionScoped.class, null);
        service.startContext(ConversationScoped.class, null);
    }
View Full Code Here

        service.startContext(ConversationScoped.class, null);
    }

    public void afterMethod(@Observes After event)
    {
        ContainerLifecycle lc = lifecycle.get();
        if (lc == null)
        {
            // this may happen if there was a DeploymentError during CDI boot
            return;
        }

        ContextsService service = lc.getContextService();

        service.endContext(ConversationScoped.class, null);
        service.endContext(SessionScoped.class, null);
        service.endContext(RequestScoped.class, null);
    }
View Full Code Here

        webBeansContext = WebBeansContext.getInstance();

        LOG.fine("OpenWebBeans Arquillian starting deployment");

        ContainerLifecycle lifecycle = webBeansContext.getService(ContainerLifecycle.class);

        lifecycleProducer.set(lifecycle);
        beanManagerProducer.set(lifecycle.getBeanManager());

        OwbArquillianScannerService dummyScannerService = (OwbArquillianScannerService) webBeansContext.getScannerService();
        dummyScannerService.setArchive(archive);

        final ClassLoader parentLoader = Thread.currentThread().getContextClassLoader();
        originalLoader.set(parentLoader);
        Thread.currentThread().setContextClassLoader(new OwbSWClassLoader(parentLoader, archive, useOnlyArchiveResources, useOnlyArchiveResourcesExcludes));

        try
        {
            lifecycle.startApplication(null);
        }
        catch (WebBeansDeploymentException e)
        {
            throw new DeploymentException(e.getMessage(), e);
        }
View Full Code Here

    {
        LOG.fine("OpenWebBeans Arquillian undeploying");

        OwbArquillianScannerService dummyScannerService = (OwbArquillianScannerService) webBeansContext.getScannerService();
        dummyScannerService.clear();
        ContainerLifecycle lifecycle = lifecycleProducer.get();
        if (lifecycle != null)
        {
            // end the session lifecycle

            lifecycle.stopApplication(null);
        }

        final ClassLoader current = Thread.currentThread().getContextClassLoader();
        if (OwbSWClassLoader.class.isInstance(current))
        { // should be the case
View Full Code Here

      ClassLoader cl = new ShrinkWrapClassLoader(archive);

      Thread.currentThread().setContextClassLoader(cl);

      final ShrinkWrapMetaDataDiscovery discovery = new ShrinkWrapMetaDataDiscovery(archive);
      ContainerLifecycle lifecycle = new StandaloneLifeCycle()
      {
         // TODO this override method will need to change to afterInitApplication(Properties) after 1.0.0-M4
         @Override
         public void init()
         {
            super.init();
            log.info("Using discovery service impl class adapted to ShrinkWrap archive : [" + discovery.getClass().getName() + "]");
            this.discoveryService = discovery;
         }
      };

      try
      {
         lifecycle.start(null);
      }
      catch (Exception e)
      {
         throw new RuntimeException("Failed to start standalone OpenWebBeans container", e);
      }

      BeanManager manager = lifecycle.getBeanManager();

      // start the application lifecycle
      ContextFactory.initApplicationContext(null);
      // start the session lifecycle
      HttpSession session = new MockHttpSession();
View Full Code Here

        return currentLifecycle;
    }
   
    public ContainerLifecycle getLifecycle()
    {
        ContainerLifecycle lifecycle = ServiceLoader.getService(ContainerLifecycle.class);
       
        return lifecycle;
    }
View Full Code Here

        return currentLifecycle;
    }
   
    public ContainerLifecycle getLifecycle()
    {
        ContainerLifecycle lifecycle = ServiceLoader.getService(ContainerLifecycle.class);
       
        return lifecycle;
    }
View Full Code Here

        webBeansContext = WebBeansContext.getInstance();

        LOG.fine("OpenWebBeans Arquillian starting deployment");

        ContainerLifecycle lifecycle = webBeansContext.getService(ContainerLifecycle.class);

        lifecycleProducer.set(lifecycle);
        beanManagerProducer.set(lifecycle.getBeanManager());

        OwbArquillianScannerService dummyScannerService = (OwbArquillianScannerService) webBeansContext.getScannerService();
        dummyScannerService.setArchive(archive);

        lifecycle.startApplication(null);

        return new ProtocolMetaData();
    }
View Full Code Here

    {
        LOG.fine("OpenWebBeans Arquillian undeploying");

        OwbArquillianScannerService dummyScannerService = (OwbArquillianScannerService) webBeansContext.getScannerService();
        dummyScannerService.clear();
        ContainerLifecycle lifecycle = lifecycleProducer.get();
        if (lifecycle != null)
        {
            // end the session lifecycle

            lifecycle.stopApplication(null);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.webbeans.spi.ContainerLifecycle

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.