/** * Gets singleton instance for deployment. * @return signelton instance for this deployment */ @Override public WebBeansContext get(Object key) { assertClassLoaderKey(key); ClassLoader classLoader = (ClassLoader) key; synchronized (singletonMap) { //util.Track.sync(key); WebBeansContext webBeansContext = singletonMap.get(classLoader); //util.Track.get(key); if (webBeansContext == null) { webBeansContext = new WebBeansContext(); singletonMap.put(classLoader, webBeansContext); } return webBeansContext; } }
public synchronized void initOwb(Properties initialConfig) { ScannerService dummyScannerService = new OwbArquillianScannerService(); Map<Class<?>, Object> initialServices = new HashMap<>(); initialServices.put(ScannerService.class, dummyScannerService); // this is needed because of a dirty hack in the OpenWebBeansConfiguration initialServices.put(SecurityService.class, new SimpleSecurityService()); webBeansContext = new WebBeansContext(initialServices, initialConfig); webBeansContext.getOpenWebBeansConfiguration().parseConfiguration(); }
WebBeansContext context = new WebBeansContext(preparedServices, properties);
private void ensureWebBeansContext(final AppContext appContext) { WebBeansContext webBeansContext = appContext.get(WebBeansContext.class); if (webBeansContext == null) { webBeansContext = appContext.getWebBeansContext(); }else{ if (null == appContext.getWebBeansContext()){ appContext.setWebBeansContext(webBeansContext); } return; } if (webBeansContext == null) { final Map<Class<?>, Object> services = new HashMap<Class<?>, Object>(); services.put(JNDIService.class, new OpenEJBJndiService()); services.put(AppContext.class, appContext); services.put(ScannerService.class, new CdiScanner()); services.put(BeanArchiveService.class, new OpenEJBBeanInfoService()); services.put(ELAdaptor.class, new CustomELAdapter(appContext)); services.put(LoaderService.class, new OptimizedLoaderService(appContext.getProperties())); final Properties properties = new Properties(); properties.setProperty(org.apache.webbeans.spi.SecurityService.class.getName(), ManagedSecurityService.class.getName()); properties.setProperty(ContextsService.class.getName(), CdiAppContextsService.class.getName()); properties.setProperty(ResourceInjectionService.class.getName(), CdiResourceInjectionService.class.getName()); properties.setProperty(TransactionService.class.getName(), OpenEJBTransactionService.class.getName()); webBeansContext = new WebBeansContext(services, properties); appContext.setCdiEnabled(false); appContext.set(WebBeansContext.class, webBeansContext); appContext.setWebBeansContext(webBeansContext); } }
properties.setProperty(org.apache.webbeans.spi.SecurityService.class.getName(), ManagedSecurityService.class.getName()); webBeansContext = new WebBeansContext(services, properties);
services.put(ResourceInjectionService.class, new CdiResourceInjectionService()); services.put(ScannerService.class, new CdiScanner()); WebBeansContext webBeansContext = new WebBeansContext(services, properties);
try { if (startupObject.getWebContext() == null) { webBeansContext = new WebBeansContext(services, properties); appContext.set(WebBeansContext.class, webBeansContext); } else {
try { if (startupObject.getWebContext() == null) { webBeansContext = new WebBeansContext(services, properties); appContext.set(WebBeansContext.class, webBeansContext); } else {