@Override public String toString() { return "Weld instance for deployment " + BeanManagerProxy.unwrap(rootBeanManager).getContextId(); }
/** * Creates a new Jersey-specific {@link javax.enterprise.inject.spi.Bean} instance. * * @param binding {@link javax.enterprise.inject.spi.BeanAttributes} part of the bean. */ @SuppressWarnings("unchecked") SupplierThreadScopeBean(SupplierInstanceBinding binding, BeanManagerImpl manager) { super(binding); this.binding = binding; this.beanInstance = new ThreadScopeBeanInstance<>(binding.getSupplier(), this, manager.getContextId()); this.proxy = createClientProxy(beanInstance, manager.getContextId()); }
getBeanManager().getContextId(), getInstantiator(), getBean(), decorators));
public ProxyClassConstructorInjectionPointWrapper(Bean<T> declaringBean, Class<?> declaringComponentClass, EnhancedAnnotatedConstructor<T> weldConstructor, ConstructorInjectionPoint<T> originalConstructorInjectionPoint, BeanManagerImpl manager) { super(weldConstructor, declaringBean, declaringComponentClass, InjectionPointFactory.silentInstance(), manager); this.contextId = manager.getContextId(); this.decorator = (declaringBean instanceof javax.enterprise.inject.spi.Decorator); this.originalConstructorInjectionPoint = originalConstructorInjectionPoint; this.bean = declaringBean; this.delegateInjectionPointPosition = initDelegateInjectionPointPosition(); }
@Override protected InjectionPoint newInstance(InjectionPoint ip, CreationalContext<InjectionPoint> creationalContext) { if (ip instanceof SerializableForwardingInjectionPoint || ip == null) { return ip; } ip = new SerializableForwardingInjectionPoint(getBeanManager().getContextId(), ip); return ip; }
@Override protected Interceptor<?> newInstance(InjectionPoint ip, CreationalContext<Interceptor<?>> creationalContext) { Contextual<?> bean = getParentCreationalContext(creationalContext).getContextual(); if (bean instanceof Interceptor<?>) { return SerializableProxy.of(getBeanManager().getContextId(), (Interceptor<?>) bean); } throw new IllegalArgumentException("Unable to inject " + bean + " into " + ip); }
@Override protected Decorator<?> newInstance(InjectionPoint ip, CreationalContext<Decorator<?>> creationalContext) { Contextual<?> bean = getParentCreationalContext(creationalContext).getContextual(); if (bean instanceof Decorator<?>) { return SerializableProxy.of(getBeanManager().getContextId(), (Decorator<?>) bean); } throw new IllegalArgumentException("Unable to inject " + bean + " into " + ip); }
@Override protected Interceptor<?> newInstance(InjectionPoint ip, CreationalContext<Interceptor<?>> creationalContext) { Contextual<?> bean = getParentCreationalContext(creationalContext).getContextual(); if (bean instanceof Interceptor<?>) { return SerializableProxy.of(getBeanManager().getContextId(), (Interceptor<?>) bean); } throw new IllegalArgumentException("Unable to inject " + bean + " into " + ip); }
@Override protected Class<T> createEnhancedSubclass(EnhancedAnnotatedType<T> type, Bean<?> bean, BeanManagerImpl manager) { return new DecoratorProxyFactory<T>(manager.getContextId(), type.getJavaClass(), delegateInjectionPoint, bean).getProxyClass(); } };
@Override protected InjectionPoint newInstance(InjectionPoint ip, CreationalContext<InjectionPoint> creationalContext) { if (ip instanceof SerializableForwardingInjectionPoint || ip == null) { return ip; } ip = new SerializableForwardingInjectionPoint(getBeanManager().getContextId(), ip); ip = SessionBeanInjectionPoint.wrapIfNecessary(ip); return ip; }
@Override protected Class<T> createEnhancedSubclass(EnhancedAnnotatedType<T> type, Bean<?> bean, BeanManagerImpl manager) { return new DecoratorProxyFactory<T>(manager.getContextId(), type.getJavaClass(), delegateInjectionPoint, bean).getProxyClass(); } };
@Override protected Decorator<?> newInstance(InjectionPoint ip, CreationalContext<Decorator<?>> creationalContext) { Contextual<?> bean = getParentCreationalContext(creationalContext).getContextual(); if (bean instanceof Decorator<?>) { return SerializableProxy.of(getBeanManager().getContextId(), (Decorator<?>) bean); } throw new IllegalArgumentException("Unable to inject " + bean + " into " + ip); }
private T createProxy(InjectionPoint injectionPoint, CreationalContext<?> creationalContext) { final T proxy = (System.getSecurityManager() == null) ? run() : AccessController.doPrivileged(this); TargetBeanInstance newTargetBeanInstance = new TargetBeanInstance(targetBeanInstance); Decorator<Object> decorator = Reflections.cast(decorators.get(counter++)); DecoratorProxyMethodHandler methodHandler = createMethodHandler(injectionPoint, creationalContext, decorator); newTargetBeanInstance.setInterceptorsHandler(methodHandler); ProxyFactory.setBeanInstance(beanManager.getContextId(), proxy, newTargetBeanInstance, bean); return proxy; }
private T createProxy(InjectionPoint injectionPoint, CreationalContext<?> creationalContext) { final T proxy = (System.getSecurityManager() == null) ? run() : AccessController.doPrivileged(this); TargetBeanInstance newTargetBeanInstance = new TargetBeanInstance(targetBeanInstance); Decorator<Object> decorator = Reflections.cast(decorators.get(counter++)); DecoratorProxyMethodHandler methodHandler = createMethodHandler(injectionPoint, creationalContext, decorator); newTargetBeanInstance.setInterceptorsHandler(methodHandler); ProxyFactory.setBeanInstance(beanManager.getContextId(), proxy, newTargetBeanInstance, bean); return proxy; }
public void registerWeldSEContexts(@Observes AfterBeanDiscovery event, BeanManager manager) { if (ignoreEvent(event)) { return; } final String contextId = BeanManagerProxy.unwrap(manager).getContextId(); this.threadContext = new ThreadContext(contextId); event.addContext(threadContext); // Register WeldContainer as a singleton event.addBean(new WeldContainerBean(contextId)); }
@Override public void initializeAfterBeanDiscovery() { this.decorators = beanManager.resolveDecorators(getTypes(), getQualifiers()); if (!decorators.isEmpty()) { this.proxyClass = new ProxyFactory<T>(getBeanManager().getContextId(), getType(), getTypes(), this).getProxyClass(); } } }
@Override public void internalInitialize(BeanDeployerEnvironment environment) { super.internalInitialize(environment); checkEEResource(); proxyFactory = new ProxyFactory<T>(getBeanManager().getContextId(), getType(), getTypes(), this); }
@Override public void internalInitialize(BeanDeployerEnvironment environment) { super.internalInitialize(environment); checkEEResource(); proxyFactory = new ProxyFactory<T>(getBeanManager().getContextId(), getType(), getTypes(), this); }
public void registerWeldSEContexts(@Observes AfterBeanDiscovery event, BeanManager manager) { if (ignoreEvent(event)) { return; } final String contextId = BeanManagerProxy.unwrap(manager).getContextId(); this.threadContext = new ThreadContext(contextId); event.addContext(threadContext); // Register WeldContainer as a singleton event.addBean().addType(WeldContainer.class).addQualifier(Default.Literal.INSTANCE).scope(Singleton.class) .produceWith((i) -> WeldContainer.instance(contextId)); }
/** * Produces a factory for a specific bean implementation. * * @param proxiedBeanType the actual enterprise bean */ public EnterpriseProxyFactory(Class<T> proxiedBeanType, SessionBean<T> bean) { super(bean.getBeanManager().getContextId(), proxiedBeanType, ImmutableSet.<Type> builder().addAll(bean.getTypes()) .addAll(bean.getEjbDescriptor().getRemoteBusinessInterfacesAsClasses()).build(), bean); }