org.apache.webbeans.container
Class BeanManagerImpl

java.lang.Object
  extended by org.apache.webbeans.container.BeanManagerImpl
All Implemented Interfaces:
javax.enterprise.inject.spi.BeanManager, Referenceable

public class BeanManagerImpl
extends Object
implements javax.enterprise.inject.spi.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(javax.enterprise.inject.spi.AnnotatedType<?> annotatedType)
           
 void addAdditionalQualifier(Class<? extends Annotation> qualifier)
           
 void addAdditionalScope(ExternalScope additionalScope)
           
 javax.enterprise.inject.spi.BeanManager addBean(javax.enterprise.inject.spi.Bean<?> newBean)
          Add new bean to the BeanManager.
 javax.enterprise.inject.spi.BeanManager addContext(javax.enterprise.context.spi.Context context)
           
 void addCustomDecoratorClass(Class<?> clazz)
           
 void addCustomInterceptorClass(Class<?> clazz)
           
 javax.enterprise.inject.spi.BeanManager addDecorator(javax.enterprise.inject.spi.Decorator decorator)
           
 javax.enterprise.inject.spi.BeanManager addInterceptor(javax.enterprise.inject.spi.Interceptor interceptor)
           
 void addInterceptorBindingType(Class<? extends Annotation> bindingType, Annotation... inheritsArray)
           
 javax.enterprise.inject.spi.BeanManager addInternalBean(javax.enterprise.inject.spi.Bean<?> newBean)
          This method is reserved for adding 'internal beans' like e.g. a BeanManagerBean,
protected  void addPassivationInfo(OwbBean<?> bean)
          Check if the bean is has a passivation id and add it to the id store.
 void clear()
           
 boolean containsCustomDecoratorClass(Class<?> clazz)
           
 boolean containsCustomInterceptorClass(Class<?> clazz)
           
<T> javax.enterprise.inject.spi.AnnotatedType<T>
createAnnotatedType(Class<T> type)
          
<T> javax.enterprise.context.spi.CreationalContext<T>
createCreationalContext(javax.enterprise.context.spi.Contextual<T> contextual)
          
<T> javax.enterprise.inject.spi.InjectionTarget<T>
createInjectionTarget(javax.enterprise.inject.spi.AnnotatedType<T> type)
          
 void fireEvent(Object event, Annotation... bindings)
          
 List<javax.enterprise.inject.spi.AnnotatedType<?>> getAdditionalAnnotatedTypes()
           
 List<Class<? extends Annotation>> getAdditionalQualifiers()
           
 List<ExternalScope> getAdditionalScopes()
           
 Set<javax.enterprise.inject.spi.Bean<?>> getBeans()
           
 Set<javax.enterprise.inject.spi.Bean<?>> getBeans(String name)
           
 Set<javax.enterprise.inject.spi.Bean<?>> getBeans(Type beanType, Annotation... bindings)
          
 Set<javax.enterprise.inject.spi.Bean<?>> getComponents()
           
 javax.enterprise.context.spi.Context getContext(Class<? extends Annotation> scopeType)
          Gets the active context for the given scope type.
 Set<javax.enterprise.inject.spi.Decorator<?>> getDecorators()
           
 javax.el.ELResolver getELResolver()
           
 ErrorStack getErrorStack()
           
 Object getInjectableReference(javax.enterprise.inject.spi.InjectionPoint injectionPoint, javax.enterprise.context.spi.CreationalContext<?> ownerCreationalContext)
          
 InjectionResolver getInjectionResolver()
          Gets injection resolver.
<T> InjectionTargetWrapper<T>
getInjectionTargetWrapper(Class<T> javaEeComponentClass)
           
<T> InjectionTargetWrapper<T>
getInjectionTargetWrapper(javax.enterprise.context.spi.Contextual<T> contextual)
           
<T> T
getInstance(javax.enterprise.inject.spi.Bean<T> bean, javax.enterprise.context.spi.CreationalContext<?> creationalContext)
          Deprecated. 
 Object getInstanceByName(String name, javax.enterprise.context.spi.CreationalContext<?> creationalContext)
          Deprecated. 
<T> T
getInstanceByType(Class<T> type, Annotation... bindingTypes)
          Deprecated. 
<T> T
getInstanceByType(javax.enterprise.util.TypeLiteral<T> type, Annotation... bindingTypes)
          Deprecated. 
 Object getInstanceToInject(javax.enterprise.inject.spi.InjectionPoint injectionPoint)
          Deprecated. 
<T> T
getInstanceToInject(javax.enterprise.inject.spi.InjectionPoint injectionPoint, javax.enterprise.context.spi.CreationalContext<?> context)
          Deprecated. 
 Set<Annotation> getInterceptorBindingDefinition(Class<? extends Annotation> binding)
          
 Set<Annotation> getInterceptorBindingTypeMetaAnnotations(Class<? extends Annotation> interceptorBindingType)
           
 List<javax.enterprise.inject.spi.Interceptor<?>> getInterceptors()
           
<X> javax.enterprise.inject.spi.Bean<? extends X>
getMostSpecializedBean(javax.enterprise.inject.spi.Bean<X> bean)
          Deprecated. 
 NotificationManager getNotificationManager()
          Return manager notification manager.
 javax.enterprise.inject.spi.Bean<?> getPassivationCapableBean(String id)
           
 Reference getReference()
           
 Object getReference(javax.enterprise.inject.spi.Bean<?> bean, Type beanType, javax.enterprise.context.spi.CreationalContext<?> creationalContext)
          
 Set<Annotation> getStereotypeDefinition(Class<? extends Annotation> stereotype)
           
 boolean hasInterceptorBindingType(Class<? extends Annotation> bindingType)
           
 boolean isInterceptorBinding(Class<? extends Annotation> annotationType)
           
 boolean isInUse()
           
 boolean isNormalScope(Class<? extends Annotation> annotationType)
           
 boolean isPassivatingScope(Class<? extends Annotation> annotationType)
           
 boolean isQualifier(Class<? extends Annotation> annotationType)
           
 boolean isScope(Class<? extends Annotation> annotationType)
           
 boolean isStereotype(Class<? extends Annotation> annotationType)
           
 javax.enterprise.inject.spi.BeanManager parse(InputStream xmlStream)
          Parse the given XML input stream for adding XML defined artifacts.
<T> void
putInjectionTargetWrapper(javax.enterprise.context.spi.Contextual<T> contextual, InjectionTargetWrapper<T> wrapper)
           
<T> void
putInjectionTargetWrapperForJavaEeComponents(Class<T> javaEeComponentClass, InjectionTargetWrapper<T> wrapper)
           
<X> javax.enterprise.inject.spi.Bean<? extends X>
resolve(Set<javax.enterprise.inject.spi.Bean<? extends X>> beans)
           
 Set<javax.enterprise.inject.spi.Bean<?>> resolveByName(String name)
          Deprecated. 
 Set<javax.enterprise.inject.spi.Bean<?>> resolveByType(Class<?> apiType, Annotation... bindingTypes)
          Deprecated. 
 Set<javax.enterprise.inject.spi.Bean<?>> resolveByType(javax.enterprise.util.TypeLiteral<?> apiType, Annotation... bindingTypes)
          Deprecated. 
 List<javax.enterprise.inject.spi.Decorator<?>> resolveDecorators(Set<Type> types, Annotation... bindingTypes)
          
 List<javax.enterprise.inject.spi.Interceptor<?>> resolveInterceptors(javax.enterprise.inject.spi.InterceptionType type, Annotation... interceptorBindings)
          
<T> Set<javax.enterprise.inject.spi.ObserverMethod<? super T>>
resolveObserverMethods(T event, Annotation... qualifiers)
           
 void setXMLConfigurator(WebBeansXMLConfigurator xmlConfigurator)
          Sets the xml configurator instance.
 void validate(javax.enterprise.inject.spi.InjectionPoint injectionPoint)
          
 javax.el.ExpressionFactory wrapExpressionFactory(javax.el.ExpressionFactory expressionFactory)
           
 
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

putInjectionTargetWrapper

public <T> void putInjectionTargetWrapper(javax.enterprise.context.spi.Contextual<T> contextual,
                                          InjectionTargetWrapper<T> wrapper)

getInjectionTargetWrapper

public <T> InjectionTargetWrapper<T> getInjectionTargetWrapper(javax.enterprise.context.spi.Contextual<T> contextual)

putInjectionTargetWrapperForJavaEeComponents

public <T> void putInjectionTargetWrapperForJavaEeComponents(Class<T> javaEeComponentClass,
                                                             InjectionTargetWrapper<T> wrapper)

getInjectionTargetWrapper

public <T> InjectionTargetWrapper<T> getInjectionTargetWrapper(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 javax.enterprise.context.spi.Context getContext(Class<? extends Annotation> scopeType)
Gets the active context for the given scope type.

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

addBean

public javax.enterprise.inject.spi.BeanManager addBean(javax.enterprise.inject.spi.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 javax.enterprise.inject.spi.BeanManager addInternalBean(javax.enterprise.inject.spi.Bean<?> newBean)
This method is reserved for adding 'internal beans' like e.g. a BeanManagerBean,

Parameters:
newBean -
Returns:

addPassivationInfo

protected void addPassivationInfo(OwbBean<?> 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 javax.enterprise.inject.spi.BeanManager addContext(javax.enterprise.context.spi.Context context)

addCustomInterceptorClass

public void addCustomInterceptorClass(Class<?> clazz)

addCustomDecoratorClass

public void addCustomDecoratorClass(Class<?> clazz)

containsCustomInterceptorClass

public boolean containsCustomInterceptorClass(Class<?> clazz)

containsCustomDecoratorClass

public boolean containsCustomDecoratorClass(Class<?> clazz)

addInterceptorBindingType

public void addInterceptorBindingType(Class<? extends Annotation> bindingType,
                                      Annotation... inheritsArray)

hasInterceptorBindingType

public boolean hasInterceptorBindingType(Class<? extends Annotation> bindingType)

getInterceptorBindingTypeMetaAnnotations

public Set<Annotation> getInterceptorBindingTypeMetaAnnotations(Class<? extends Annotation> interceptorBindingType)

fireEvent

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

Specified by:
fireEvent in interface javax.enterprise.inject.spi.BeanManager

getInstanceByName

@Deprecated
public Object getInstanceByName(String name,
                                           javax.enterprise.context.spi.CreationalContext<?> creationalContext)
Deprecated. 


getInstanceToInject

@Deprecated
public <T> T getInstanceToInject(javax.enterprise.inject.spi.InjectionPoint injectionPoint,
                                            javax.enterprise.context.spi.CreationalContext<?> context)
Deprecated. 


getInstanceToInject

@Deprecated
public Object getInstanceToInject(javax.enterprise.inject.spi.InjectionPoint injectionPoint)
Deprecated. 


getInstanceByType

@Deprecated
public <T> T getInstanceByType(Class<T> type,
                                          Annotation... bindingTypes)
Deprecated. 


getInstanceByType

@Deprecated
public <T> T getInstanceByType(javax.enterprise.util.TypeLiteral<T> type,
                                          Annotation... bindingTypes)
Deprecated. 


resolveByName

@Deprecated
public Set<javax.enterprise.inject.spi.Bean<?>> resolveByName(String name)
Deprecated. 


resolveByType

@Deprecated
public Set<javax.enterprise.inject.spi.Bean<?>> resolveByType(Class<?> apiType,
                                                                         Annotation... bindingTypes)
Deprecated. 


resolveByType

@Deprecated
public Set<javax.enterprise.inject.spi.Bean<?>> resolveByType(javax.enterprise.util.TypeLiteral<?> apiType,
                                                                         Annotation... bindingTypes)
Deprecated. 


getComponents

public Set<javax.enterprise.inject.spi.Bean<?>> getComponents()

addDecorator

public javax.enterprise.inject.spi.BeanManager addDecorator(javax.enterprise.inject.spi.Decorator decorator)

addInterceptor

public javax.enterprise.inject.spi.BeanManager addInterceptor(javax.enterprise.inject.spi.Interceptor interceptor)

getInstance

@Deprecated
public <T> T getInstance(javax.enterprise.inject.spi.Bean<T> bean,
                                    javax.enterprise.context.spi.CreationalContext<?> creationalContext)
Deprecated. 


resolveDecorators

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

Specified by:
resolveDecorators in interface javax.enterprise.inject.spi.BeanManager

resolveInterceptors

public List<javax.enterprise.inject.spi.Interceptor<?>> resolveInterceptors(javax.enterprise.inject.spi.InterceptionType type,
                                                                            Annotation... interceptorBindings)

Specified by:
resolveInterceptors in interface javax.enterprise.inject.spi.BeanManager

getBeans

public Set<javax.enterprise.inject.spi.Bean<?>> getBeans()

getInterceptors

public List<javax.enterprise.inject.spi.Interceptor<?>> getInterceptors()

getDecorators

public Set<javax.enterprise.inject.spi.Decorator<?>> getDecorators()

getReference

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

parse

public javax.enterprise.inject.spi.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> javax.enterprise.inject.spi.AnnotatedType<T> createAnnotatedType(Class<T> type)

Specified by:
createAnnotatedType in interface javax.enterprise.inject.spi.BeanManager

createCreationalContext

public <T> javax.enterprise.context.spi.CreationalContext<T> createCreationalContext(javax.enterprise.context.spi.Contextual<T> contextual)

Specified by:
createCreationalContext in interface javax.enterprise.inject.spi.BeanManager

getBeans

public Set<javax.enterprise.inject.spi.Bean<?>> getBeans(Type beanType,
                                                         Annotation... bindings)

Specified by:
getBeans in interface javax.enterprise.inject.spi.BeanManager

getBeans

public Set<javax.enterprise.inject.spi.Bean<?>> getBeans(String name)
Specified by:
getBeans in interface javax.enterprise.inject.spi.BeanManager

getELResolver

public javax.el.ELResolver getELResolver()
Specified by:
getELResolver in interface javax.enterprise.inject.spi.BeanManager

getInjectableReference

public Object getInjectableReference(javax.enterprise.inject.spi.InjectionPoint injectionPoint,
                                     javax.enterprise.context.spi.CreationalContext<?> ownerCreationalContext)

Specified by:
getInjectableReference in interface javax.enterprise.inject.spi.BeanManager

getInterceptorBindingDefinition

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

Specified by:
getInterceptorBindingDefinition in interface javax.enterprise.inject.spi.BeanManager

getMostSpecializedBean

@Deprecated
public <X> javax.enterprise.inject.spi.Bean<? extends X> getMostSpecializedBean(javax.enterprise.inject.spi.Bean<X> bean)
Deprecated. 


getPassivationCapableBean

public javax.enterprise.inject.spi.Bean<?> getPassivationCapableBean(String id)
Specified by:
getPassivationCapableBean in interface javax.enterprise.inject.spi.BeanManager

getReference

public Object getReference(javax.enterprise.inject.spi.Bean<?> bean,
                           Type beanType,
                           javax.enterprise.context.spi.CreationalContext<?> creationalContext)

Specified by:
getReference in interface javax.enterprise.inject.spi.BeanManager

getStereotypeDefinition

public Set<Annotation> getStereotypeDefinition(Class<? extends Annotation> stereotype)
Specified by:
getStereotypeDefinition in interface javax.enterprise.inject.spi.BeanManager

isQualifier

public boolean isQualifier(Class<? extends Annotation> annotationType)
Specified by:
isQualifier in interface javax.enterprise.inject.spi.BeanManager

isInterceptorBinding

public boolean isInterceptorBinding(Class<? extends Annotation> annotationType)
Specified by:
isInterceptorBinding in interface javax.enterprise.inject.spi.BeanManager

isScope

public boolean isScope(Class<? extends Annotation> annotationType)
Specified by:
isScope in interface javax.enterprise.inject.spi.BeanManager

isNormalScope

public boolean isNormalScope(Class<? extends Annotation> annotationType)
Specified by:
isNormalScope in interface javax.enterprise.inject.spi.BeanManager

isPassivatingScope

public boolean isPassivatingScope(Class<? extends Annotation> annotationType)
Specified by:
isPassivatingScope in interface javax.enterprise.inject.spi.BeanManager

isStereotype

public boolean isStereotype(Class<? extends Annotation> annotationType)
Specified by:
isStereotype in interface javax.enterprise.inject.spi.BeanManager

resolve

public <X> javax.enterprise.inject.spi.Bean<? extends X> resolve(Set<javax.enterprise.inject.spi.Bean<? extends X>> beans)
Specified by:
resolve in interface javax.enterprise.inject.spi.BeanManager

validate

public void validate(javax.enterprise.inject.spi.InjectionPoint injectionPoint)

Specified by:
validate in interface javax.enterprise.inject.spi.BeanManager

createInjectionTarget

public <T> javax.enterprise.inject.spi.InjectionTarget<T> createInjectionTarget(javax.enterprise.inject.spi.AnnotatedType<T> type)

Specified by:
createInjectionTarget in interface javax.enterprise.inject.spi.BeanManager

resolveObserverMethods

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

wrapExpressionFactory

public javax.el.ExpressionFactory wrapExpressionFactory(javax.el.ExpressionFactory expressionFactory)
Specified by:
wrapExpressionFactory in interface javax.enterprise.inject.spi.BeanManager

addAdditionalQualifier

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

addAdditionalAnnotatedType

public void addAdditionalAnnotatedType(javax.enterprise.inject.spi.AnnotatedType<?> annotatedType)

getAdditionalQualifiers

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

addAdditionalScope

public void addAdditionalScope(ExternalScope additionalScope)

getAdditionalScopes

public List<ExternalScope> getAdditionalScopes()

getAdditionalAnnotatedTypes

public List<javax.enterprise.inject.spi.AnnotatedType<?>> getAdditionalAnnotatedTypes()

clear

public void clear()

isInUse

public boolean isInUse()


Copyright © 2008-2011 The Apache Software Foundation. All Rights Reserved.