Java Code Examples for org.apache.webbeans.config.WebBeansContext#getContextsService()

The following examples show how to use org.apache.webbeans.config.WebBeansContext#getContextsService() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HAOpenWebBeansTestLifeCycle.java    From HotswapAgent with GNU General Public License v2.0 6 votes vote down vote up
public void beforeStopApplication(Object endObject)
{
    WebBeansContext webBeansContext = getWebBeansContext();
    ContextsService contextsService = webBeansContext.getContextsService();
    contextsService.endContext(Singleton.class, null);
    contextsService.endContext(ApplicationScoped.class, null);
    contextsService.endContext(RequestScoped.class, null);
    contextsService.endContext(SessionScoped.class, mockHttpSession);

    ELContextStore elStore = ELContextStore.getInstance(false);
    if (elStore == null)
    {
        return;
    }
    elStore.destroyELContextStore();
}
 
Example 2
Source File: RequestScopedThreadContextListener.java    From tomee with Apache License 2.0 6 votes vote down vote up
@Override
public void contextEntered(final ThreadContext oldContext, final ThreadContext newContext) {

    final BeanContext beanContext = newContext.getBeanContext();

    final WebBeansContext webBeansContext = beanContext.getModuleContext().getAppContext().getWebBeansContext();
    if (webBeansContext == null) {
        return;
    }

    final ContextsService contextsService = webBeansContext.getContextsService();

    final Context requestContext = CdiAppContextsService.class.cast(contextsService).getRequestContext(false);

    if (requestContext == null) {
        contextsService.startContext(RequestScoped.class, CdiAppContextsService.EJB_REQUEST_EVENT);
        newContext.set(DestroyContext.class, new DestroyContext(contextsService, newContext));
    }
}
 
Example 3
Source File: HAOpenWebBeansTestLifeCycle.java    From HotswapAgent with GNU General Public License v2.0 5 votes vote down vote up
public void beforeStartApplication(Object object)
{
    WebBeansContext webBeansContext = getWebBeansContext();
    ContextsService contextsService = webBeansContext.getContextsService();
    contextsService.startContext(Singleton.class, null);
    contextsService.startContext(ApplicationScoped.class, null);
}
 
Example 4
Source File: OpenEJBLifecycle.java    From tomee with Apache License 2.0 5 votes vote down vote up
/**
 * Manages unused conversations
 */

public OpenEJBLifecycle(final WebBeansContext webBeansContext) {
    this.webBeansContext = webBeansContext;

    this.beanManager = webBeansContext.getBeanManagerImpl();
    this.deployer = new BeansDeployer(webBeansContext);
    this.jndiService = webBeansContext.getService(JNDIService.class);
    this.scannerService = webBeansContext.getScannerService();
    this.contextsService = webBeansContext.getContextsService();
}
 
Example 5
Source File: WebBeansThreadBindingListener.java    From tomee with Apache License 2.0 4 votes vote down vote up
public WebBeansThreadBindingListener(WebBeansContext webBeansContext, ThreadBindingListener delegate) {
    this.contextsService = webBeansContext.getContextsService();
    this.delegate = delegate;
}
 
Example 6
Source File: OpenWebBeansContextControl.java    From deltaspike with Apache License 2.0 4 votes vote down vote up
private ContextsService getContextsService()
{
    WebBeansContext webBeansContext = WebBeansContext.currentInstance();
    return webBeansContext.getContextsService();
}