Refine search
/** * Create a new, root, manager * * @param serviceRegistry * @return */ public static BeanManagerImpl newRootManager(String contextId, String id, ServiceRegistry serviceRegistry) { Map<Class<? extends Annotation>, List<Context>> contexts = new ConcurrentHashMap<Class<? extends Annotation>, List<Context>>(); return new BeanManagerImpl(serviceRegistry, new CopyOnWriteArrayList<Bean<?>>(), new CopyOnWriteArrayList<Bean<?>>(), new CopyOnWriteArrayList<Decorator<?>>(), new CopyOnWriteArrayList<Interceptor<?>>(), new CopyOnWriteArrayList<ObserverMethod<?>>(), new CopyOnWriteArrayList<String>(), new ConcurrentHashMap<EjbDescriptor<?>, SessionBean<?>>(), new ClientProxyProvider(contextId), contexts, ModuleEnablement.EMPTY_ENABLEMENT, id, new AtomicInteger(), new HashSet<BeanManagerImpl>(), contextId); }
/** * Creates a Javassist scope adaptor (client proxy) for a bean * <p/> * Creates a Javassist proxy factory. Gets the type info. Sets the interfaces * and superclass to the factory. Hooks in the MethodHandler and creates the * proxy. * * @param bean The bean to proxy * @param beanIndex The index to the bean in the manager bean list * @return A Javassist proxy * @throws InstantiationException When the proxy couldn't be created * @throws IllegalAccessException When the proxy couldn't be created */ private <T> T createClientProxy(Bean<T> bean) throws RuntimeException { return createClientProxy(bean, bean.getTypes()); }
/** * Gets a client proxy for a bean * <p/> * Looks for a proxy in the pool. If not found, one is created and added to * the pool if the create argument is true. * * @param bean The bean to get a proxy to * @return the client proxy for the bean */ public <T> T getClientProxy(final Bean<T> bean, Type requestedType) { // let's first try to use the proxy that implements all the bean types T proxy = beanTypeClosureProxyPool.getCastValue(bean); if (proxy == BEAN_NOT_PROXYABLE_MARKER) { /* * the bean may have a type that is not proxyable - this is not a problem as long as the unproxyable * type is not in the type closure of the requested type * https://issues.jboss.org/browse/WELD-1052 */ proxy = requestedTypeClosureProxyPool.getCastValue(new RequestedTypeHolder(requestedType, bean)); if (proxy == BEAN_NOT_PROXYABLE_MARKER) { throw Proxies.getUnproxyableTypeException(requestedType, services()); } } BeanLogger.LOG.lookedUpClientProxy(proxy.getClass(), bean); return proxy; }
public <T> T getClientProxy(final Bean<T> bean) { T proxy = beanTypeClosureProxyPool.getCastValue(bean); if (proxy == BEAN_NOT_PROXYABLE_MARKER) { throw Proxies.getUnproxyableTypesException(bean, services()); } BeanLogger.LOG.lookedUpClientProxy(proxy.getClass(), bean); return proxy; } /**
/** * Always returns the original proxy object that was serialized. * * @return the proxy object * @throws java.io.ObjectStreamException */ Object readResolve() throws ObjectStreamException { Bean<?> bean = Container.instance(contextId).services().get(ContextualStore.class).<Bean<Object>, Object>getContextual(beanId); if (bean == null) { throw BeanLogger.LOG.proxyDeserializationFailure(beanId); } return Container.instance(contextId).deploymentManager().getClientProxyProvider().getClientProxy(bean); }
public Object getReference(Bean<?> bean, Type requestedType, CreationalContext<?> creationalContext, boolean noProxy) { if (creationalContext instanceof CreationalContextImpl<?>) { creationalContext = ((CreationalContextImpl<?>) creationalContext).getCreationalContext(bean); } if (!noProxy && isProxyRequired(bean)) { if (creationalContext != null || ContextualInstance.getIfExists(bean, this) != null) { if (requestedType == null) { return clientProxyProvider.getClientProxy(bean); } else { return clientProxyProvider.getClientProxy(bean, requestedType); } } else { return null; } } else { return ContextualInstance.get(bean, this, creationalContext); } }
public void cleanup() { services.cleanup(); this.accessibleManagers.clear(); this.managers.clear(); this.beanResolver.clear(); this.enabledBeans.clear(); this.clientProxyProvider.clear(); this.contexts.clear(); this.decoratorResolver.clear(); this.decorators.clear(); this.enterpriseBeans.clear(); this.interceptorResolver.clear(); this.interceptors.clear(); this.nameBasedResolver.clear(); this.namespaces.clear(); this.accessibleLenientObserverNotifier.clear(); this.observers.clear(); }
public <T> T getClientProxy(final Bean<T> bean) { T proxy = beanTypeClosureProxyPool.getCastValue(bean); if (proxy == BEAN_NOT_PROXYABLE_MARKER) { throw Proxies.getUnproxyableTypesException(bean, services()); } BeanLogger.LOG.lookedUpClientProxy(proxy.getClass(), bean); return proxy; } /**
/** * Always returns the original proxy object that was serialized. * * @return the proxy object * @throws java.io.ObjectStreamException */ Object readResolve() throws ObjectStreamException { Bean<?> bean = Container.instance(contextId).services().get(ContextualStore.class).<Bean<Object>, Object>getContextual(beanId); if (bean == null) { throw BeanLogger.LOG.proxyDeserializationFailure(beanId); } return Container.instance(contextId).deploymentManager().getClientProxyProvider().getClientProxy(bean); }
public Object getReference(Bean<?> bean, Type requestedType, CreationalContext<?> creationalContext, boolean noProxy) { if (creationalContext instanceof CreationalContextImpl<?>) { creationalContext = ((CreationalContextImpl<?>) creationalContext).getCreationalContext(bean); } if (!noProxy && isProxyRequired(bean)) { if (creationalContext != null || ContextualInstance.getIfExists(bean, this) != null) { if (requestedType == null) { return clientProxyProvider.getClientProxy(bean); } else { return clientProxyProvider.getClientProxy(bean, requestedType); } } else { return null; } } else { return ContextualInstance.get(bean, this, creationalContext); } }
public void cleanup() { services.cleanup(); this.accessibleManagers.clear(); this.managers.clear(); this.beanResolver.clear(); this.enabledBeans.clear(); this.childActivities.clear(); this.clientProxyProvider.clear(); this.contexts.clear(); this.currentActivities.clear(); this.decoratorResolver.clear(); this.decorators.clear(); this.enterpriseBeans.clear(); this.interceptorResolver.clear(); this.interceptors.clear(); this.nameBasedResolver.clear(); this.namespaces.clear(); this.accessibleLenientObserverNotifier.clear(); this.observers.clear(); }
/** * Gets a client proxy for a bean * <p/> * Looks for a proxy in the pool. If not found, one is created and added to * the pool if the create argument is true. * * @param bean The bean to get a proxy to * @return the client proxy for the bean */ public <T> T getClientProxy(final Bean<T> bean, Type requestedType) { // let's first try to use the proxy that implements all the bean types T proxy = beanTypeClosureProxyPool.getCastValue(bean); if (proxy == BEAN_NOT_PROXYABLE_MARKER) { /* * the bean may have a type that is not proxyable - this is not a problem as long as the unproxyable * type is not in the type closure of the requested type * https://issues.jboss.org/browse/WELD-1052 */ proxy = requestedTypeClosureProxyPool.getCastValue(new RequestedTypeHolder(requestedType, bean)); if (proxy == BEAN_NOT_PROXYABLE_MARKER) { throw Proxies.getUnproxyableTypeException(requestedType, services()); } } BeanLogger.LOG.lookedUpClientProxy(proxy.getClass(), bean); return proxy; }
public <T> T getClientProxy(final Bean<T> bean) { T proxy = beanTypeClosureProxyPool.getCastValue(bean); if (proxy == BEAN_NOT_PROXYABLE_MARKER) { throw Proxies.getUnproxyableTypesException(bean, services()); } BeanLogger.LOG.lookedUpClientProxy(proxy.getClass(), bean); return proxy; } /**
/** * Always returns the original proxy object that was serialized. * * @return the proxy object * @throws java.io.ObjectStreamException */ Object readResolve() throws ObjectStreamException { Bean<?> bean = Container.instance(contextId).services().get(ContextualStore.class).<Bean<Object>, Object>getContextual(beanId); if (bean == null) { throw BeanLogger.LOG.proxyDeserializationFailure(beanId); } return Container.instance(contextId).deploymentManager().getClientProxyProvider().getClientProxy(bean); }
/** * Create a new, root, manager * * @param serviceRegistry * @return */ public static BeanManagerImpl newRootManager(String contextId, String id, ServiceRegistry serviceRegistry) { Map<Class<? extends Annotation>, List<Context>> contexts = new ConcurrentHashMap<Class<? extends Annotation>, List<Context>>(); return new BeanManagerImpl(serviceRegistry, new CopyOnWriteArrayList<Bean<?>>(), new CopyOnWriteArrayList<Bean<?>>(), new CopyOnWriteArrayList<Decorator<?>>(), new CopyOnWriteArrayList<Interceptor<?>>(), new CopyOnWriteArrayList<ObserverMethod<?>>(), new CopyOnWriteArrayList<String>(), new ConcurrentHashMap<EjbDescriptor<?>, SessionBean<?>>(), new ClientProxyProvider(contextId), contexts, ModuleEnablement.EMPTY_ENABLEMENT, id, new AtomicInteger(), new HashSet<BeanManagerImpl>(), contextId); }
public Object getReference(Bean<?> bean, Type requestedType, CreationalContext<?> creationalContext, boolean noProxy) { if (creationalContext instanceof CreationalContextImpl<?>) { creationalContext = ((CreationalContextImpl<?>) creationalContext).getCreationalContext(bean); } if (!noProxy && isProxyRequired(bean)) { if (creationalContext != null || ContextualInstance.getIfExists(bean, this) != null) { if (requestedType == null) { return clientProxyProvider.getClientProxy(bean); } else { return clientProxyProvider.getClientProxy(bean, requestedType); } } else { return null; } } else { return ContextualInstance.get(bean, this, creationalContext); } }
/** * Creates a Javassist scope adaptor (client proxy) for a bean * <p/> * Creates a Javassist proxy factory. Gets the type info. Sets the interfaces * and superclass to the factory. Hooks in the MethodHandler and creates the * proxy. * * @param bean The bean to proxy * @param beanIndex The index to the bean in the manager bean list * @return A Javassist proxy * @throws InstantiationException When the proxy couldn't be created * @throws IllegalAccessException When the proxy couldn't be created */ private <T> T createClientProxy(Bean<T> bean) throws RuntimeException { return createClientProxy(bean, bean.getTypes()); }
public void cleanup() { services.cleanup(); this.accessibleManagers.clear(); this.managers.clear(); this.beanResolver.clear(); this.enabledBeans.clear(); this.clientProxyProvider.clear(); this.contexts.clear(); this.decoratorResolver.clear(); this.decorators.clear(); this.enterpriseBeans.clear(); this.interceptorResolver.clear(); this.interceptors.clear(); this.nameBasedResolver.clear(); this.namespaces.clear(); this.accessibleLenientObserverNotifier.clear(); this.observers.clear(); }
/** * Gets a client proxy for a bean * <p/> * Looks for a proxy in the pool. If not found, one is created and added to * the pool if the create argument is true. * * @param bean The bean to get a proxy to * @return the client proxy for the bean */ public <T> T getClientProxy(final Bean<T> bean, Type requestedType) { // let's first try to use the proxy that implements all the bean types T proxy = beanTypeClosureProxyPool.getCastValue(bean); if (proxy == BEAN_NOT_PROXYABLE_MARKER) { /* * the bean may have a type that is not proxyable - this is not a problem as long as the unproxyable * type is not in the type closure of the requested type * https://issues.jboss.org/browse/WELD-1052 */ proxy = requestedTypeClosureProxyPool.getCastValue(new RequestedTypeHolder(requestedType, bean)); if (proxy == BEAN_NOT_PROXYABLE_MARKER) { throw Proxies.getUnproxyableTypeException(requestedType, services()); } } BeanLogger.LOG.lookedUpClientProxy(proxy.getClass(), bean); return proxy; }
public <T> T getClientProxy(final Bean<T> bean) { T proxy = beanTypeClosureProxyPool.getCastValue(bean); if (proxy == BEAN_NOT_PROXYABLE_MARKER) { throw Proxies.getUnproxyableTypesException(bean, services()); } BeanLogger.LOG.lookedUpClientProxy(proxy.getClass(), bean); return proxy; } /**