private void configureAllowProxying(URL url, List<String> allowProxyingClasses) { OpenWebBeansConfiguration owbConfiguration = webBeansContext.getOpenWebBeansConfiguration(); for (String allowProxyingClass : allowProxyingClasses) { owbConfiguration.addConfigListValue(OpenWebBeansConfiguration.ALLOW_PROXYING_PARAM, allowProxyingClass); } }
protected AbstractContextsService(WebBeansContext webBeansContext) { this.webBeansContext = webBeansContext; supportsConversation = webBeansContext.getOpenWebBeansConfiguration().supportsConversation(); }
public ConversationImpl(WebBeansContext webBeansContext) { this.webBeansContext = webBeansContext; try { timeout = Long.parseLong(this.webBeansContext.getOpenWebBeansConfiguration(). getProperty(OpenWebBeansConfiguration.CONVERSATION_TIMEOUT_INTERVAL, "1800000")); } catch (NumberFormatException e) { timeout = 30 * 60 * 1000; } }
private Set<String> getIgnoredDecoratorInterfaces() { return webBeansContext.getOpenWebBeansConfiguration().getIgnoredInterfaces(); }
@PostConstruct private void init() { // not sexy but the simplest ATM accepted.addAll(asList( WebBeansContext.currentInstance() .getOpenWebBeansConfiguration().getProperty(AlertCDIBridge.class.getName() + ".accepted", "*").split(" *, *"))); }
/** * Lifycycle methods like {@link javax.annotation.PostConstruct} and * {@link javax.annotation.PreDestroy} must not define a checked Exception * regarding to the spec. But this is often unnecessary restrictive so we * allow to disable this check application wide. * * @return <code>true</code> if the spec rule of having no checked exception should be enforced */ private boolean isNoCheckedExceptionEnforced() { if (enforceCheckedException == null) { enforceCheckedException = Boolean.parseBoolean(webBeansContext.getOpenWebBeansConfiguration(). getProperty(OpenWebBeansConfiguration.INTERCEPTOR_FORCE_NO_CHECKED_EXCEPTIONS, "true")); } return enforceCheckedException; }
protected void configureEagerSessionInitialisation(WebBeansContext webBeansContext) { String val = webBeansContext.getOpenWebBeansConfiguration().getProperty(OpenWebBeansConfiguration.EAGER_SESSION_INITIALISATION); if (val == null || val.isEmpty() || "false".equalsIgnoreCase(val)) { eagerSessionInitialisation = Boolean.FALSE; logger.fine("EagerSessionInitialisation is configured to FALSE (Session will get created lazily on first use)"); } else if ("true".equalsIgnoreCase(val)) { eagerSessionInitialisation = Boolean.TRUE; logger.fine("EagerSessionInitialisation is configured to TRUE (Session will get created at the beginning of a request)"); } else { logger.fine("EagerSessionInitialisation used for all URIs with RegExp " + val); eagerSessionPattern = Pattern.compile(val); } }
/** * Creates a new bean metadata bean. * @return new bean */ public PrincipalBean getPrincipalBean() { return new PrincipalBean(webBeansContext, Boolean.parseBoolean(webBeansContext.getOpenWebBeansConfiguration() .getProperty("org.apache.webbeans.component.PrincipalBean.proxy", "true"))); }
@Override public void init(Object object) { // set per BDA beans.xml flag here because setting it in constructor // occurs before // properties are loaded. String usage = webBeansContext.getOpenWebBeansConfiguration().getProperty(OpenWebBeansConfiguration.USE_BDA_BEANSXML_SCANNER); this.isBDAScannerEnabled = Boolean.parseBoolean(usage); if (isBDAScannerEnabled) { bdaBeansXmlScanner = new DefaultBDABeansXmlScanner(); } }
@Override public void defineInterceptorStack(Bean<T> bean, AnnotatedType<T> annotatedType, WebBeansContext webBeansContext) { if (webBeansContext.getOpenWebBeansConfiguration().supportsInterceptionOnProducers()) { super.defineInterceptorStack(bean, annotatedType, webBeansContext); } }
public AnnotationManager(WebBeansContext context) { webBeansContext = context; beanManagerImpl = context.getBeanManagerImpl(); strictValidation = context.getOpenWebBeansConfiguration().strictDynamicValidation(); }
/** * Default constructor * * @param webBeansContext the OWB context */ public EndWebBeansListener(WebBeansContext webBeansContext) { this.webBeansContext = webBeansContext; if (webBeansContext != null) { this.contextsService = CdiAppContextsService.class.cast(webBeansContext.getService(ContextsService.class)); this.cleanUpSession = Boolean.parseBoolean(webBeansContext.getOpenWebBeansConfiguration() .getProperty("tomee.session.remove-cdi-beans-on-passivate", "false")); } else { this.contextsService = null; this.cleanUpSession = false; // ignored anyway } }
public void initScanningExcludes() { if (scanningExcludes == null) { OpenWebBeansConfiguration owbConfiguration = WebBeansContext.currentInstance().getOpenWebBeansConfiguration(); String scanningExcludesProperty = owbConfiguration.getProperty(OpenWebBeansConfiguration.SCAN_EXCLUSION_PATHS); List<String> excludes = owbConfiguration.splitValues(scanningExcludesProperty); scanningExcludes = excludes.toArray(new String[excludes.size()]); } }
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(); }
@Override public void init(Object object) { // set per BDA beans.xml flag here because setting it in constructor // occurs before // properties are loaded. String usage = WebBeansContext.currentInstance().getOpenWebBeansConfiguration().getProperty(OpenWebBeansConfiguration.USE_BDA_BEANSXML_SCANNER); isBDAScannerEnabled = Boolean.parseBoolean(usage); initScanningExcludes(); }
public void cdiToContainerSetup(final @Observes WebBeansContextCreated webBeansContextCreated) throws Exception { final WebBeansContext context = webBeansContextCreated.getContext(); context.getOpenWebBeansConfiguration().setProperty(AlertCDIBridge.class.getName() + ".accepted", accepted.isEmpty() ? "*" : Join.join(",", accepted)); CdiScanner.class.cast(context.getScannerService()).getBeanClasses().add(DefaultObserver.class); }
public static ConnectionFactory getConnectionFactory() { String connectionFactoryJndiName = WebBeansContext.getInstance().getOpenWebBeansConfiguration().getProperty(JNDIService.JMS_CONNECTION_FACTORY_JNDI_KEY); if(connectionFactoryJndiName == null || connectionFactoryJndiName.equals("")) { connectionFactoryJndiName = JNDIService.JMS_CONNECTION_FACTORY_JNDI_DEFAULT_VALUE; } return getJNDIService().lookup(connectionFactoryJndiName, ConnectionFactory.class); }
public CdiAppContextsService() { this(WebBeansContext.currentInstance(), WebBeansContext.currentInstance().getOpenWebBeansConfiguration().supportsConversation()); }
public static void initializeServletContext(final ServletContext servletContext, final WebBeansContext context) { if (context == null || !context.getBeanManagerImpl().isInUse()) { return; } final ELAdaptor elAdaptor = context.getService(ELAdaptor.class); final ELResolver resolver = elAdaptor.getOwbELResolver(); //Application is configured as JSP if (context.getOpenWebBeansConfiguration().isJspApplication()) { logger.debug("Application is configured as JSP. Adding EL Resolver."); setJspELFactory(servletContext, resolver); } // Add BeanManager to the 'javax.enterprise.inject.spi.BeanManager' servlet context attribute servletContext.setAttribute(BeanManager.class.getName(), context.getBeanManagerImpl()); }
/** * Creates a new deployer with given xml configurator. * * @param webBeansContext */ public BeansDeployer(WebBeansContext webBeansContext) { this.webBeansContext = webBeansContext; beanArchiveService = webBeansContext.getBeanArchiveService(); scannerService = webBeansContext.getScannerService(); decoratorsManager = webBeansContext.getDecoratorsManager(); interceptorsManager = webBeansContext.getInterceptorsManager(); String usage = this.webBeansContext.getOpenWebBeansConfiguration().getProperty(OpenWebBeansConfiguration.USE_EJB_DISCOVERY); discoverEjb = Boolean.parseBoolean(usage); defaultBeanArchiveInformation = new DefaultBeanArchiveInformation("default"); defaultBeanArchiveInformation.setBeanDiscoveryMode(BeanDiscoveryMode.ALL); }