org.apache.webbeans.container
Class BeanManagerImpl

java.lang.Object
  extended by org.apache.webbeans.container.AbstractBeanManager
      extended by org.apache.webbeans.container.BeanManagerImpl
All Implemented Interfaces:
BeanManager, Referenceable

public class BeanManagerImpl
extends AbstractBeanManager
implements BeanManager, Referenceable

Implementation of the BeanManager contract of the web beans container.

It is written as thread-safe.

Version:
$Rev$ $Date$
See Also:
BeanManager

Constructor Summary
BeanManagerImpl(WebBeansContext webBeansContext)
          Creates a new BeanManager instance.
 
Method Summary
 void addAdditionalAnnotatedType(AnnotatedType<?> annotatedType)
           
 void addAdditionalAnnotatedType(AnnotatedType<?> annotatedType, String id)
           
 void addAdditionalInterceptorBindings(Class<? extends Annotation> interceptorBinding)
           
 void addAdditionalQualifier(Class<? extends Annotation> qualifier)
           
 void addAdditionalScope(ExternalScope additionalScope)
           
 BeanManager addBean(Bean<?> newBean)
          Add new bean to the BeanManager.
 BeanManager addContext(Context context)
           
<T> BeanManager
addInternalBean(Bean<T> newBean)
          This method is reserved for adding 'internal beans' like e.g. a BeanManagerBean,
 void addPassivationInfo(Bean<?> bean)
          Check if the bean is has a passivation id and add it to the id store.
 void clear()
           
 void clearCacheProxies()
           
<T> AnnotatedType<T>
createAnnotatedType(Class<T> type)
          
<T> CreationalContextImpl<T>
createCreationalContext(Contextual<T> contextual)
          
<T> InjectionTarget<T>
createInjectionTarget(AnnotatedType<T> type)
          
 void fireEvent(Object event, Annotation... bindings)
          
 void fireEvent(Object event, EventMetadata metadata, boolean isLifecycleEvent)
           
 void fireLifecycleEvent(Object event, Annotation... bindings)
          Like fireEvent(Object, java.lang.annotation.Annotation...) but intended for internal CDI Container lifecycle events.
<T> AnnotatedType<T>
getAdditionalAnnotatedType(Class<T> type, String id)
           
 Collection<AnnotatedType<?>> getAdditionalAnnotatedTypes()
           
 List<Class<? extends Annotation>> getAdditionalQualifiers()
           
 List<ExternalScope> getAdditionalScopes()
           
 Set<Bean<?>> getBeans()
           
 Set<Bean<?>> getBeans(String name)
           
 Set<Bean<?>> getBeans(Type beanType, Annotation... bindings)
          
 Set<Bean<?>> getComponents()
           
 Context getContext(Class<? extends Annotation> scopeType)
          Gets the active context for the given scope type.
 ELResolver getELResolver()
           
 ErrorStack getErrorStack()
           
 Object getInjectableReference(InjectionPoint injectionPoint, CreationalContext<?> ownerCreationalContext)
          
 InjectionResolver getInjectionResolver()
          Gets injection resolver.
 Set<Annotation> getInterceptorBindingDefinition(Class<? extends Annotation> binding)
          
 NotificationManager getNotificationManager()
          Return manager notification manager.
 Bean<?> getPassivationCapableBean(String id)
           
<T> Producer<T>
getProducerForJavaEeComponent(Class<T> javaEeComponentClass)
           
 Reference getReference()
           
 Object getReference(Bean<?> bean, Type beanType, CreationalContext<?> creationalContext)
          
 Set<Annotation> getStereotypeDefinition(Class<? extends Annotation> stereotype)
           
 WebBeansContext getWebBeansContext()
           
 boolean isInterceptorBinding(Class<? extends Annotation> annotationType)
           
 boolean isInUse()
           
 boolean isNormalScope(Class<? extends Annotation> scopeType)
           
 boolean isPassivatingScope(Class<? extends Annotation> annotationType)
           
 boolean isQualifier(Class<? extends Annotation> annotationType)
           
 boolean isScope(Class<? extends Annotation> annotationType)
           
 boolean isStereotype(Class<? extends Annotation> annotationType)
           
 BeanManager parse(InputStream xmlStream)
          Parse the given XML input stream for adding XML defined artifacts.
<T> void
putProducerForJavaEeComponent(Class<T> javaEeComponentClass, Producer<T> wrapper)
           
 void removeAdditionalAnnotatedType(AnnotatedType<?> annotatedType)
           
 void removeAdditionalAnnotatedType(AnnotatedType<?> annotatedType, String id)
           
<X> Bean<? extends X>
resolve(Set<Bean<? extends X>> beans)
           
 List<Decorator<?>> resolveDecorators(Set<Type> types, Annotation... bindingTypes)
          
 List<Interceptor<?>> resolveInterceptors(InterceptionType type, Annotation... interceptorBindings)
          
<T> Set<ObserverMethod<? super T>>
resolveObserverMethods(T event, Annotation... qualifiers)
           
<T> Set<ObserverMethod<? super T>>
resolveObserverMethods(T event, EventMetadata metadata)
           
 void setXMLConfigurator(WebBeansXMLConfigurator xmlConfigurator)
          Sets the xml configurator instance.
 void validate(InjectionPoint injectionPoint)
          
 ExpressionFactory wrapExpressionFactory(ExpressionFactory expressionFactory)
           
 
Methods inherited from class org.apache.webbeans.container.AbstractBeanManager
areInterceptorBindingsEquivalent, areQualifiersEquivalent, createBean, createBean, createBeanAttributes, createBeanAttributes, createInjectionPoint, createInjectionPoint, getExtension, getInjectionTargetFactory, getInterceptorBindingHashCode, getProducerFactory, getProducerFactory, getQualifierHashCode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanManagerImpl

public BeanManagerImpl(WebBeansContext webBeansContext)
Creates a new BeanManager instance. Called by the system. Do not use outside of the system.

Method Detail

getWebBeansContext

public WebBeansContext getWebBeansContext()
Specified by:
getWebBeansContext in class AbstractBeanManager

putProducerForJavaEeComponent

public <T> void putProducerForJavaEeComponent(Class<T> javaEeComponentClass,
                                              Producer<T> wrapper)

getProducerForJavaEeComponent

public <T> Producer<T> getProducerForJavaEeComponent(Class<T> javaEeComponentClass)

getErrorStack

public ErrorStack getErrorStack()

getNotificationManager

public NotificationManager getNotificationManager()
Return manager notification manager.

Returns:
notification manager

getInjectionResolver

public InjectionResolver getInjectionResolver()
Gets injection resolver.

Returns:
injection resolver

setXMLConfigurator

public void setXMLConfigurator(WebBeansXMLConfigurator xmlConfigurator)
Sets the xml configurator instance.

Parameters:
xmlConfigurator - set xml configurator instance.
See Also:
WebBeansXMLConfigurator

getContext

public Context getContext(Class<? extends Annotation> scopeType)
Gets the active context for the given scope type.

Specified by:
getContext in interface BeanManager
Parameters:
scopeType - scope type of the context
Throws:
ContextNotActiveException - if no active context
IllegalStateException - if more than one active context

addBean

public BeanManager addBean(Bean<?> newBean)
Add new bean to the BeanManager. This will also set OWBs inUse status.

Parameters:
newBean - new bean instance
Returns:
the this manager

addInternalBean

public <T> BeanManager addInternalBean(Bean<T> newBean)
This method is reserved for adding 'internal beans' like e.g. a BeanManagerBean,

Parameters:
newBean -
Returns:

addPassivationInfo

public void addPassivationInfo(Bean<?> bean)
                        throws DefinitionException
Check if the bean is has a passivation id and add it to the id store.

Parameters:
bean -
Throws:
DefinitionException - if the id is not unique.

addContext

public BeanManager addContext(Context context)

fireEvent

public void fireEvent(Object event,
                      Annotation... bindings)

Specified by:
fireEvent in interface BeanManager

fireLifecycleEvent

public void fireLifecycleEvent(Object event,
                               Annotation... bindings)
Like fireEvent(Object, java.lang.annotation.Annotation...) but intended for internal CDI Container lifecycle events. The difference is that those events must only be delivered to CDI Extensions and not to normal beans.


fireEvent

public void fireEvent(Object event,
                      EventMetadata metadata,
                      boolean isLifecycleEvent)

getComponents

public Set<Bean<?>> getComponents()

resolveDecorators

public List<Decorator<?>> resolveDecorators(Set<Type> types,
                                            Annotation... bindingTypes)

Specified by:
resolveDecorators in interface BeanManager

resolveInterceptors

public List<Interceptor<?>> resolveInterceptors(InterceptionType type,
                                                Annotation... interceptorBindings)

Specified by:
resolveInterceptors in interface BeanManager

getBeans

public Set<Bean<?>> getBeans()

getReference

public Reference getReference()
                       throws NamingException
Specified by:
getReference in interface Referenceable
Throws:
NamingException

parse

public BeanManager parse(InputStream xmlStream)
Parse the given XML input stream for adding XML defined artifacts.

Parameters:
xmlStream - beans xml definitions
Returns:
BeanManager instance

createAnnotatedType

public <T> AnnotatedType<T> createAnnotatedType(Class<T> type)

Specified by:
createAnnotatedType in interface BeanManager

createCreationalContext

public <T> CreationalContextImpl<T> createCreationalContext(Contextual<T> contextual)

Specified by:
createCreationalContext in interface BeanManager

getBeans

public Set<Bean<?>> getBeans(Type beanType,
                             Annotation... bindings)

Specified by:
getBeans in interface BeanManager

getBeans

public Set<Bean<?>> getBeans(String name)
Specified by:
getBeans in interface BeanManager

getELResolver

public ELResolver getELResolver()
Specified by:
getELResolver in interface BeanManager

getInjectableReference

public Object getInjectableReference(InjectionPoint injectionPoint,
                                     CreationalContext<?> ownerCreationalContext)

Specified by:
getInjectableReference in interface BeanManager

getInterceptorBindingDefinition

public Set<Annotation> getInterceptorBindingDefinition(Class<? extends Annotation> binding)

Specified by:
getInterceptorBindingDefinition in interface BeanManager

getPassivationCapableBean

public Bean<?> getPassivationCapableBean(String id)
Specified by:
getPassivationCapableBean in interface BeanManager

getReference

public Object getReference(Bean<?> bean,
                           Type beanType,
                           CreationalContext<?> creationalContext)

Specified by:
getReference in interface BeanManager

getStereotypeDefinition

public Set<Annotation> getStereotypeDefinition(Class<? extends Annotation> stereotype)
Specified by:
getStereotypeDefinition in interface BeanManager

isQualifier

public boolean isQualifier(Class<? extends Annotation> annotationType)
Specified by:
isQualifier in interface BeanManager

isInterceptorBinding

public boolean isInterceptorBinding(Class<? extends Annotation> annotationType)
Specified by:
isInterceptorBinding in interface BeanManager

isScope

public boolean isScope(Class<? extends Annotation> annotationType)
Specified by:
isScope in interface BeanManager

isNormalScope

public boolean isNormalScope(Class<? extends Annotation> scopeType)
Specified by:
isNormalScope in interface BeanManager

isPassivatingScope

public boolean isPassivatingScope(Class<? extends Annotation> annotationType)
Specified by:
isPassivatingScope in interface BeanManager

isStereotype

public boolean isStereotype(Class<? extends Annotation> annotationType)
Specified by:
isStereotype in interface BeanManager

resolve

public <X> Bean<? extends X> resolve(Set<Bean<? extends X>> beans)
Specified by:
resolve in interface BeanManager

validate

public void validate(InjectionPoint injectionPoint)

Specified by:
validate in interface BeanManager

createInjectionTarget

public <T> InjectionTarget<T> createInjectionTarget(AnnotatedType<T> type)

Specified by:
createInjectionTarget in interface BeanManager

resolveObserverMethods

public <T> Set<ObserverMethod<? super T>> resolveObserverMethods(T event,
                                                                 Annotation... qualifiers)
Specified by:
resolveObserverMethods in interface BeanManager

resolveObserverMethods

public <T> Set<ObserverMethod<? super T>> resolveObserverMethods(T event,
                                                                 EventMetadata metadata)

wrapExpressionFactory

public ExpressionFactory wrapExpressionFactory(ExpressionFactory expressionFactory)
Specified by:
wrapExpressionFactory in interface BeanManager

addAdditionalQualifier

public void addAdditionalQualifier(Class<? extends Annotation> qualifier)

addAdditionalInterceptorBindings

public void addAdditionalInterceptorBindings(Class<? extends Annotation> interceptorBinding)

addAdditionalAnnotatedType

public void addAdditionalAnnotatedType(AnnotatedType<?> annotatedType)

addAdditionalAnnotatedType

public void addAdditionalAnnotatedType(AnnotatedType<?> annotatedType,
                                       String id)

removeAdditionalAnnotatedType

public void removeAdditionalAnnotatedType(AnnotatedType<?> annotatedType)

removeAdditionalAnnotatedType

public void removeAdditionalAnnotatedType(AnnotatedType<?> annotatedType,
                                          String id)

getAdditionalQualifiers

public List<Class<? extends Annotation>> getAdditionalQualifiers()

addAdditionalScope

public void addAdditionalScope(ExternalScope additionalScope)

getAdditionalScopes

public List<ExternalScope> getAdditionalScopes()

getAdditionalAnnotatedTypes

public Collection<AnnotatedType<?>> getAdditionalAnnotatedTypes()

getAdditionalAnnotatedType

public <T> AnnotatedType<T> getAdditionalAnnotatedType(Class<T> type,
                                                       String id)

clear

public void clear()

clearCacheProxies

public void clearCacheProxies()

isInUse

public boolean isInUse()


Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.