de.mindmatters.faces.spring.factory.context
Class AbstractManagedBeanFactory
java.lang.Object
org.springframework.beans.factory.support.AbstractBeanFactory
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
org.springframework.beans.factory.support.DefaultListableBeanFactory
de.mindmatters.faces.spring.factory.DefaultConfigurableBeanFactory
de.mindmatters.faces.spring.factory.context.AbstractManagedBeanFactory
- All Implemented Interfaces:
- AutowireCapableBeanFactory, BeanDefinitionRegistry, BeanFactory, ConfigurableBeanFactory, ConfigurableBeanFactory, ConfigurableListableBeanFactory, HierarchicalBeanFactory, ListableBeanFactory, ManagedBeanFactory
- Direct Known Subclasses:
- FacesDelegatingManagedBeanFactory, SpringManagedBeanFactory
- public abstract class AbstractManagedBeanFactory
- extends DefaultConfigurableBeanFactory
- implements ManagedBeanFactory
ManagedBeanFactory
implementation used as internal bean factory for the implementation of the
used FacesWebApplicationContext
.
Inherits from
DefaultConfigurableBeanFactory
and overrides the createBean(String, RootBeanDefinition, Object[])
method in such a manner that the creation and faces specific scope-caching of
beans declared in a faces configuration file could be done by subclasses of
this implementation.
- Author:
- Andreas Kuhrwahl
- See Also:
DefaultListableBeanFactory
,
ManagedBeanDefinition
Method Summary |
protected java.lang.Object |
createBean(java.lang.String beanName,
RootBeanDefinition mergedBeanDefinition,
java.lang.Object[] args)
Checks whether the given RootBeanDefinition
mergedBeanDefinition is of type
ScopedBeanDefinition or not. |
protected abstract java.lang.Object |
createManagedBean(java.lang.String beanName,
ManagedBeanDefinition beanDefinition)
Creates a managed bean declared in a faces configuration file. |
protected java.lang.Object |
createNonManagedBean(java.lang.String beanName,
RootBeanDefinition mergedBeanDefinition,
java.lang.Object[] args)
Creates and populates a non managed bean (bean defined in a spring beans
compliant XML document). |
java.lang.String[] |
getBeanNamesForType(java.lang.Class type,
boolean includePrototypes,
boolean includeFactoryBeans)
|
java.lang.String[] |
getBeanNamesForType(java.lang.Class type,
java.lang.String scope)
Returns the names of beans matching the given type (including subclasses)
and given scope. |
java.util.Map |
getBeansOfType(java.lang.Class type,
java.lang.String scope,
boolean createBeanIfNecessary)
Returns the bean instances that match the given object type (including
subclasses) and given scope. If the requested beans are not created yet
they will be created if createBeanIfNecessary is
true . |
protected RootBeanDefinition |
getMergedBeanDefinition(java.lang.String beanName,
BeanDefinition bd)
|
protected ScopedBeanStorage |
getScopedBeanStorage()
|
void |
setScopedBeanStorage(ScopedBeanStorage scopedBeanStorage)
Sets the appropriate storage to use. |
Methods inherited from class org.springframework.beans.factory.support.DefaultListableBeanFactory |
containsBeanDefinition, findMatchingBeans, getBeanDefinition, getBeanDefinitionCount, getBeanDefinitionNames, getBeanDefinitionNames, getBeanNamesForType, getBeansOfType, getBeansOfType, preInstantiateSingletons, registerBeanDefinition, setAllowBeanDefinitionOverriding, toString |
Methods inherited from class org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory |
applyBeanPostProcessorsAfterInitialization, applyBeanPostProcessorsBeforeInitialization, applyBeanPostProcessorsBeforeInstantiation, applyBeanPropertyValues, autowire, autowireBeanProperties, autowireByName, autowireByType, autowireConstructor, checkDependencies, getIgnoredDependencyInterfaces, getIgnoredDependencyTypes, getInstantiationStrategy, getTypeForFactoryMethod, ignoreDependencyInterface, ignoreDependencyType, instantiateBean, instantiateUsingFactoryMethod, invokeCustomInitMethod, invokeInitMethods, isExcludedFromDependencyCheck, populateBean, unsatisfiedNonSimpleProperties |
Methods inherited from class org.springframework.beans.factory.support.AbstractBeanFactory |
addBeanPostProcessor, addSingleton, checkMergedBeanDefinition, containsBean, containsSingleton, destroyBean, destroySingletons, doTypeConversionIfNecessary, getAliases, getBean, getBean, getBean, getBean, getBeanPostProcessorCount, getBeanPostProcessors, getCustomEditors, getMergedBeanDefinition, getMergedBeanDefinition, getObjectForSharedInstance, getParentBeanFactory, getSingletonCount, getSingletonNames, getType, hasDestructionAwareBeanPostProcessors, initBeanWrapper, invokeCustomDestroyMethod, isFactoryBean, isFactoryDereference, isSingleton, isSingletonCurrentlyInCreation, registerAlias, registerCustomEditor, registerDependentBean, registerDisposableBean, registerDisposableBeanIfNecessary, registerSingleton, removeSingleton, setParentBeanFactory, transformedBeanName |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
AbstractManagedBeanFactory
public AbstractManagedBeanFactory(ConfigurableInstantiationStrategy strategy,
BeanFactory parentBeanFactory)
- Creates a Factory with the given ConfigurableInstantiationStrategy
strategy
and the given parent BeanFactory
parentBeanFactory
.
- Parameters:
strategy
- the InstantiationStrategy to useparentBeanFactory
- the parent factory
createBean
protected final java.lang.Object createBean(java.lang.String beanName,
RootBeanDefinition mergedBeanDefinition,
java.lang.Object[] args)
- Checks whether the given RootBeanDefinition
mergedBeanDefinition
is of type
ScopedBeanDefinition
or not. If not the default creation process
will be started. Otherwise the configured storage is checked for a bean
with name beanName
and delivered or (if not found in the
storage) newly created. This creation process is delegated to appropriate
subclasses.
- Parameters:
beanName
- the name of the requested beanmergedBeanDefinition
- the bean definition for the beanargs
- arguments to use if creating a prototype using explicit
arguments to a static factory method. This parameter must be
null
except in this case.
- Returns:
- a new instance of the bean
- Throws:
BeanCreationException
- if the bean could not be created
createNonManagedBean
protected final java.lang.Object createNonManagedBean(java.lang.String beanName,
RootBeanDefinition mergedBeanDefinition,
java.lang.Object[] args)
- Creates and populates a non managed bean (bean defined in a spring beans
compliant XML document). Delegates to the
createBean(String, RootBeanDefinition, Object[])
method of the
superclass.
- Parameters:
beanName
- the name of the requested beanmergedBeanDefinition
- the bean definition for the beanargs
- arguments to use if creating a prototype using explicit
arguments to a static factory method. This parameter must be
null
except in this case.
- Returns:
- a new instance of the bean
- Throws:
BeanCreationException
- if the bean could not be created- See Also:
AbstractBeanFactory.createBean(java.lang.String,
org.springframework.beans.factory.support.RootBeanDefinition,
java.lang.Object[])
createManagedBean
protected abstract java.lang.Object createManagedBean(java.lang.String beanName,
ManagedBeanDefinition beanDefinition)
- Creates a managed bean declared in a faces configuration file.
- Parameters:
beanName
- the name of the requested beanbeanDefinition
- the bean definition for the bean
- Returns:
- a new instance of the bean
- Throws:
BeanCreationException
- if the bean could not be created
getScopedBeanStorage
protected final ScopedBeanStorage getScopedBeanStorage()
- Returns:
- Returns the ScopedBeanStorage.
setScopedBeanStorage
public final void setScopedBeanStorage(ScopedBeanStorage scopedBeanStorage)
- Sets the appropriate storage to use.
- Specified by:
setScopedBeanStorage
in interface ManagedBeanFactory
- Parameters:
scopedBeanStorage
- The scopedBeanStorage to set.- See Also:
ScopedBeanStorage
getMergedBeanDefinition
protected final RootBeanDefinition getMergedBeanDefinition(java.lang.String beanName,
BeanDefinition bd)
-
getBeanNamesForType
public final java.lang.String[] getBeanNamesForType(java.lang.Class type,
boolean includePrototypes,
boolean includeFactoryBeans)
-
- Specified by:
getBeanNamesForType
in interface ListableBeanFactory
getBeanNamesForType
public final java.lang.String[] getBeanNamesForType(java.lang.Class type,
java.lang.String scope)
- Returns the names of beans matching the given type (including subclasses)
and given scope.
- Specified by:
getBeanNamesForType
in interface ManagedBeanFactory
- Parameters:
type
- the class or interface to match, or null
for
all bean namesscope
- the scope to match, or null
for all scopes
- Returns:
- the names of beans matching the given object type (including
subclasses) and given scope, or an empty array if none
getBeansOfType
public final java.util.Map getBeansOfType(java.lang.Class type,
java.lang.String scope,
boolean createBeanIfNecessary)
- Returns the bean instances that match the given object type (including
subclasses) and given scope. If the requested beans are not created yet
they will be created if
createBeanIfNecessary
is
true
.
- Specified by:
getBeansOfType
in interface ManagedBeanFactory
- Parameters:
type
- the class or interface to match, or null
for
all concrete beansscope
- the scope to match, or null
for all scopescreateBeanIfNecessary
- whether to create beans not created yet and return them, or
not
- Returns:
- a Map with the matching beans, containing the bean names as keys
and the corresponding bean instances as values
Copyright © 2002 mindmatters GmbH & Co. KG