Thread.currentThread().setContextClassLoader(appClassLoader); WebBeansContext wbc = WebBeansContext.currentInstance(); NormalScopeProxyFactory proxyFactory = wbc.getNormalScopeProxyFactory(); Set<Bean<?>> beans = wbc.getBeanManagerImpl().getBeans(beanClass); if (beans != null) { boolean recreateIt = false;
WebBeansContext wbc = beanManager.getWebBeansContext(); AnnotatedElementFactory annotatedElementFactory = wbc.getAnnotatedElementFactory(); Map<AnnotatedType<?>, ExtendedBeanAttributes<?>> annotatedTypes = new HashMap<>(); BeansDeployer beansDeployer = new BeansDeployer(wbc);
/** * Will re-inject any managed beans in the target. Will not call any other life-cycle methods * * @param ctx * @param managedBean */ @SuppressWarnings("unchecked") static void reinitialize(Context ctx, Contextual<Object> contextual) { try { ManagedBean<Object> managedBean = ManagedBean.class.cast(contextual); LOGGER.debug("Re-Initializing bean '{}' in context '{}'", managedBean, ctx); Object get = ctx.get(managedBean); if (get != null) { LOGGER.debug("Bean injection points are reinitialized '{}'", managedBean); CreationalContextImpl<Object> creationalContext = managedBean.getWebBeansContext().getCreationalContextFactory().getCreationalContext(managedBean); managedBean.getProducer().inject(get, creationalContext); } } catch (Exception e) { LOGGER.error("Error reinitializing bean '{}' in context '{}'", e, contextual, ctx); } } }
/** * 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(); }
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 AfterBeanDiscoveryImpl(WebBeansContext webBeansContext) { this.webBeansContext = webBeansContext; beanManager = this.webBeansContext.getBeanManagerImpl(); }
public AnnotationManager(WebBeansContext context) { webBeansContext = context; beanManagerImpl = context.getBeanManagerImpl(); strictValidation = context.getOpenWebBeansConfiguration().strictDynamicValidation(); }
public CdiAppContextsService() { this(WebBeansContext.currentInstance(), WebBeansContext.currentInstance().getOpenWebBeansConfiguration().supportsConversation()); }
public ScannerService getScannerService() { if (scannerService == null) { // lazy init scannerService = getService(ScannerService.class); } return scannerService; }
protected AbstractContextsService(WebBeansContext webBeansContext) { this.webBeansContext = webBeansContext; supportsConversation = webBeansContext.getOpenWebBeansConfiguration().supportsConversation(); }
protected WebBeansContext webBeansContext() { if (webBeansContext == null) { webBeansContext = WebBeansContext.getInstance(); } return WebBeansContext.getInstance(); } }
private void setProperty(final OpenWebBeansConfiguration configuration, final String name, final String value) { if (configuration.getProperty(name) == null) { configuration.setProperty(name, value); } }
private void configureAllowProxying(URL url, List<String> allowProxyingClasses) { OpenWebBeansConfiguration owbConfiguration = webBeansContext.getOpenWebBeansConfiguration(); for (String allowProxyingClass : allowProxyingClasses) { owbConfiguration.addConfigListValue(OpenWebBeansConfiguration.ALLOW_PROXYING_PARAM, allowProxyingClass); } }
private Set<String> getIgnoredDecoratorInterfaces() { return webBeansContext.getOpenWebBeansConfiguration().getIgnoredInterfaces(); }
@SuppressWarnings({ "rawtypes", "unchecked" }) private static void createAnnotatedTypeForExistingBeanClass(BeanManagerImpl beanManager, InjectionTargetBean bean) { WebBeansContext wbc = beanManager.getWebBeansContext(); AnnotatedElementFactory annotatedElementFactory = wbc.getAnnotatedElementFactory(); // Clear AnnotatedElementFactory caches annotatedElementFactory.clear(); AnnotatedType annotatedType = annotatedElementFactory.newAnnotatedType(bean.getBeanClass()); ReflectionHelper.set(bean, InjectionTargetBean.class, "annotatedType", annotatedType); // Updated members that were set by bean attributes BeanAttributesImpl attributes = BeanAttributesBuilder.forContext(wbc).newBeanAttibutes(annotatedType).build(); ReflectionHelper.set(bean, BeanAttributesImpl.class, "types", attributes.getTypes()); ReflectionHelper.set(bean, BeanAttributesImpl.class, "qualifiers", attributes.getQualifiers()); ReflectionHelper.set(bean, BeanAttributesImpl.class, "scope", attributes.getScope()); ReflectionHelper.set(bean, BeanAttributesImpl.class, "name", attributes.getName()); ReflectionHelper.set(bean, BeanAttributesImpl.class, "stereotypes", attributes.getStereotypes()); ReflectionHelper.set(bean, BeanAttributesImpl.class, "alternative", attributes.isAlternative()); InjectionTargetFactory factory = new InjectionTargetFactoryImpl(annotatedType, bean.getWebBeansContext()); InjectionTarget injectionTarget = factory.createInjectionTarget(bean); ReflectionHelper.set(bean, InjectionTargetBean.class, "injectionTarget", injectionTarget); LOGGER.debug("New annotated type created for bean '{}'", bean.getBeanClass()); }
beanManager.getWebBeansContext().getBeanArchiveService().getBeanArchiveInformation(beanArchiveUrl);
/** * Parse configuration. */ public OpenWebBeansConfiguration() { parseConfiguration(); }
public static WebBeansContext getInstance() { WebBeansContext webBeansContext = WebBeansFinder.getSingletonInstance(); return webBeansContext; }
/** * Creates a new loader instance. * @param webBeansContext */ public ExtensionLoader(WebBeansContext webBeansContext) { this.webBeansContext = webBeansContext; manager = this.webBeansContext.getBeanManagerImpl(); }
public ContextsService getContextsService() { if (contextsService == null) { contextsService = getService(ContextsService.class); } return contextsService; }