public ScannerService getScannerService() { if (scannerService == null) { // lazy init scannerService = getService(ScannerService.class); } return scannerService; }
public ContextsService getContextsService() { if (contextsService == null) { contextsService = getService(ContextsService.class); } return contextsService; }
/** * Default constructor * * @param webBeansContext */ public WebBeansListener(WebBeansContext webBeansContext) { this.webBeansContext = webBeansContext; this.failoverService = this.webBeansContext.getService(FailOverService.class); }
/** * Default constructor * * @param webBeansContext the OWB context */ public BeginWebBeansListener(final WebBeansContext webBeansContext) { this.webBeansContext = webBeansContext; this.failoverService = this.webBeansContext.getService(FailOverService.class); this.contextKey = "org.apache.tomee.catalina.WebBeansListener@" + webBeansContext.hashCode(); }
public AsynContextWrapper(final AsyncContext asyncContext, final ServletRequest request, final WebBeansContext webBeansContext) { this.delegate = asyncContext; this.service = CdiAppContextsService.class.cast(webBeansContext.getService(ContextsService.class)); this.event = null; this.request = request; }
/** * Default constructor * * @param webBeansContext the OWB context */ public BeginWebBeansListener(final WebBeansContext webBeansContext) { this.webBeansContext = webBeansContext; this.contextsService = webBeansContext != null ? CdiAppContextsService.class.cast(webBeansContext.getService(ContextsService.class)) : null; this.contextKey = "org.apache.tomee.catalina.WebBeansListener@" + webBeansContext.hashCode(); }
@Override public ELResolver getELResolver() { ELAdaptor elAdaptor = webBeansContext.getService(ELAdaptor.class); return elAdaptor.getOwbELResolver(); }
/** * Default constructor. */ public FailOverFilter() { WebBeansContext webBeansContext = WebBeansContext.currentInstance(); failoverService = webBeansContext.getService(FailOverService.class); }
public FailOverBag(String sessionId, String jvmId) { WebBeansContext webBeansContext = WebBeansContext.currentInstance(); this.failOverService = webBeansContext.getService(FailOverService.class); this.items = new HashMap<String, Object>(); this.sessionId = sessionId; this.jvmId = jvmId; }
@SuppressWarnings("deprecated") public void init(Properties properties) { log.info(OWBLogConst.INFO_0006); //this relies on DefaultSingletonService to instantiate the WebBeansContext containerLifecycle = WebBeansContext.getInstance().getService(ContainerLifecycle.class); this.properties = properties; }
private Executor getDefaultExecutor() { // here it would be nice to support to use a produced bean like @Named("openwebbeansCdiExecutor") // instead of a direct spi // // logic is: if an Executor is registered as a spi use it, otherwise use JVM default one Executor service = webBeansContext.getService(Executor.class); return service != null ? service : new CloseableExecutor(); }
protected SeContainer newContainer(final WebBeansContext context) { Object startObj = new Object(); context.getService(ContainerLifecycle.class).startApplication(startObj); return new OWBContainer(context, startObj); }
public void setFilter(final JarScanFilter filter, final ServletContext ctx) { this.filter = filter; super.init(ctx); final Meecrowave.Builder config = Meecrowave.Builder.class.cast(ServletContext.class.cast(ctx).getAttribute("meecrowave.configuration")); if (this.filter == null) { this.filter = new KnownJarsFilter(config); } final Filter userFilter = webBeansContext().getService(Filter.class); if (KnownClassesFilter.class.isInstance(userFilter)) { KnownClassesFilter.class.cast(userFilter).init(config); } }
@Override public ExpressionFactory getExpressionFactory() { if (expressionFactory == null) { final ELAdaptor elAdaptor = webBeansContext.getService(ELAdaptor.class); expressionFactory = elAdaptor.getOwbWrappedExpressionFactory(application.getExpressionFactory()); } return expressionFactory; }
@Override protected T produce(Map<Interceptor<?>, ?> interceptors, CreationalContextImpl<T> creationalContext) { if (!isStatic) { return super.produce(interceptors, creationalContext); } return (T) webBeansContext.getService(ResourceInjectionService.class).getResourceReference(ref); } }
@Override public void sessionWillPassivate(HttpSessionEvent event) { WebBeansContext webBeansContext = WebBeansContext.currentInstance(); FailOverService failOverService = webBeansContext.getService(FailOverService.class); if (failOverService != null && failOverService.isSupportPassivation()) { HttpSession session = event.getSession(); failOverService.sessionWillPassivate(session); } }
protected void afterStopApplication(final Object stopObject) throws Exception { //Clear the resource injection service final ResourceInjectionService injectionServices = webBeansContext.getService(ResourceInjectionService.class); if (injectionServices != null) { injectionServices.clear(); } //Comment out for commit OWB-502 //ContextFactory.cleanUpContextFactory(); CdiAppContextsService.class.cast(contextsService).removeThreadLocals(); WebBeansFinder.clearInstances(WebBeansUtil.getCurrentClassLoader()); }
@Override public synchronized void boot() { lifecycle = WebBeansContext.currentInstance().getService(ContainerLifecycle.class); Object mockServletContextEvent = null; if (OpenWebBeansContextControl.isServletApiAvailable()) { mockServletContextEvent = OwbHelper.getMockServletContextEvent(); } lifecycle.startApplication(mockServletContextEvent); }
@Before public void setUp() { event = new ServletContextEvent(mock(ServletContext.class)); lifecycle = WebBeansContext.currentInstance().getService(ContainerLifecycle.class); lifecycle.startApplication(event); bus = getBeanReference(Bus.class); }
@BeforeClass public static void startContainer() { final WebBeansContext webBeansContext = WebBeansContext.currentInstance(); lifecycle = webBeansContext.getService(ContainerLifecycle.class); lifecycle.startApplication(null); bm = webBeansContext.getBeanManagerImpl(); }