org.apache.webbeans.container
Class BeanManagerImpl

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

public class BeanManagerImpl
extends Object
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()
          Creates a new BeanManager instance.
 
Method Summary
 void addAdditionalAnnotatedType(AnnotatedType<?> annotatedType)
           
 void addAdditionalQualifier(Class<? extends Annotation> qualifier)
           
 void addAdditionalScope(ExternalScope additionalScope)
           
 BeanManager addBean(Bean<?> newBean)
          Add new bean.
 BeanManager addContext(Context context)
           
 void addCustomDecoratorClass(Class<?> clazz)
           
 void addCustomInterceptorClass(Class<?> clazz)
           
 BeanManager addDecorator(Decorator decorator)
           
 BeanManager addInterceptor(Interceptor interceptor)
           
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> AnnotatedType<T>
createAnnotatedType(Class<T> type)
          
<T> CreationalContext<T>
createCreationalContext(Contextual<T> contextual)
          
<T> InjectionTarget<T>
createInjectionTarget(AnnotatedType<T> type)
          
 void fireEvent(Object event, Annotation... bindings)
          
 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.
 Set<Decorator<?>> getDecorators()
           
 ELResolver getELResolver()
           
 ErrorStack getErrorStack()
           
 Object getInjectableReference(InjectionPoint injectionPoint, CreationalContext<?> ownerCreationalContext)
          
 InjectionResolver getInjectionResolver()
          Gets injection resolver.
<T> InjectionTargetWrapper<T>
getInjectionTargetWrapper(Class<T> javaEeComponentClass)
           
<T> InjectionTargetWrapper<T>
getInjectionTargetWrapper(Contextual<T> contextual)
           
<T> T
getInstance(Bean<T> bean, CreationalContext<?> creationalContext)
          Deprecated. 
 Object getInstanceByName(String name, CreationalContext<?> creationalContext)
          Deprecated. 
<T> T
getInstanceByType(Class<T> type, Annotation... bindingTypes)
          Deprecated. 
<T> T
getInstanceByType(TypeLiteral<T> type, Annotation... bindingTypes)
          Deprecated. 
 Object getInstanceToInject(InjectionPoint injectionPoint)
          Deprecated. 
<T> T
getInstanceToInject(InjectionPoint injectionPoint, CreationalContext<?> context)
          Deprecated. 
 Set<Annotation> getInterceptorBindingDefinition(Class<? extends Annotation> binding)
          
 Set<Interceptor<?>> getInterceptors()
           
static BeanManagerImpl getManager()
          Gets current activity.
<X> Bean<? extends X>
getMostSpecializedBean(Bean<X> bean)
          Deprecated. 
 NotificationManager getNotificationManager()
          Return manager notification manager.
 Bean<?> getPassivationCapableBean(String id)
           
 Reference getReference()
           
 Object getReference(Bean<?> bean, Type beanType, CreationalContext<?> creationalContext)
          
 Set<Annotation> getStereotypeDefinition(Class<? extends Annotation> stereotype)
           
 boolean isInterceptorBinding(Class<? extends Annotation> annotationType)
           
 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)
           
 BeanManager parse(InputStream xmlStream)
          Parse the given XML input stream for adding XML defined artifacts.
<T> void
putInjectionTargetWrapper(Contextual<T> contextual, InjectionTargetWrapper<T> wrapper)
           
<T> void
putInjectionTargetWrapperForJavaEeComponents(Class<T> javaEeComponentClass, InjectionTargetWrapper<T> wrapper)
           
<X> Bean<? extends X>
resolve(Set<Bean<? extends X>> beans)
           
 Set<Bean<?>> resolveByName(String name)
          Deprecated. 
 Set<Bean<?>> resolveByType(Class<?> apiType, Annotation... bindingTypes)
          Deprecated. 
 Set<Bean<?>> resolveByType(TypeLiteral<?> apiType, Annotation... bindingTypes)
          Deprecated. 
 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)
           
 void setXMLConfigurator(WebBeansXMLConfigurator xmlConfigurator)
          Sets the xml configurator instance.
 void validate(InjectionPoint injectionPoint)
          
 ExpressionFactory wrapExpressionFactory(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()
Creates a new BeanManager instance. Called by the system. Do not use outside of the system.

Method Detail

putInjectionTargetWrapper

public <T> void putInjectionTargetWrapper(Contextual<T> contextual,
                                          InjectionTargetWrapper<T> wrapper)

getInjectionTargetWrapper

public <T> InjectionTargetWrapper<T> getInjectionTargetWrapper(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

getManager

public static BeanManagerImpl getManager()
Gets current activity.

Returns:
the current activity

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.

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

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 BeanManager addContext(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)

fireEvent

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

Specified by:
fireEvent in interface BeanManager

getInstanceByName

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


getInstanceToInject

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


getInstanceToInject

@Deprecated
public Object getInstanceToInject(InjectionPoint injectionPoint)
Deprecated. 


getInstanceByType

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


getInstanceByType

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


resolveByName

@Deprecated
public Set<Bean<?>> resolveByName(String name)
Deprecated. 


resolveByType

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


resolveByType

@Deprecated
public Set<Bean<?>> resolveByType(TypeLiteral<?> apiType,
                                             Annotation... bindingTypes)
Deprecated. 


getComponents

public Set<Bean<?>> getComponents()

addDecorator

public BeanManager addDecorator(Decorator decorator)

addInterceptor

public BeanManager addInterceptor(Interceptor interceptor)

getInstance

@Deprecated
public <T> T getInstance(Bean<T> bean,
                                    CreationalContext<?> creationalContext)
Deprecated. 


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()

getInterceptors

public Set<Interceptor<?>> getInterceptors()

getDecorators

public Set<Decorator<?>> getDecorators()

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> CreationalContext<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

getMostSpecializedBean

@Deprecated
public <X> Bean<? extends X> getMostSpecializedBean(Bean<X> bean)
Deprecated. 


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> annotationType)
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

wrapExpressionFactory

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

addAdditionalQualifier

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

addAdditionalAnnotatedType

public void addAdditionalAnnotatedType(AnnotatedType<?> annotatedType)

getAdditionalQualifiers

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

addAdditionalScope

public void addAdditionalScope(ExternalScope additionalScope)

getAdditionalScopes

public List<ExternalScope> getAdditionalScopes()

clear

public void clear()


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