public class BeanPoolImpl extends java.lang.Object implements ManagedBeanPool
BeanPool
interface.Constructor and Description |
---|
BeanPoolImpl(BeanFactory factory,
RegistryProvider registryProvider,
ConfigurationManager confManager)
Creates a new instance with the given bean factory and registry provider.
|
BeanPoolImpl(RegistryProvider registryProvider,
ConfigurationManager confManager)
Creates a new instance with the given registry provider.
|
Modifier and Type | Method and Description |
---|---|
void |
addPersistenceListener(PersistenceEventListener listener)
Method for adding a
PersistenceEventListener to listen on events
for this BeanPool . |
void |
addRelation(RelationInfo relation)
Registers relation to the given bean.
|
<T extends RegistryBean> |
attach(T bean)
Insert a bean in the pool.
|
void |
clear()
Clears the pool.
|
void |
clearJaxrCache()
Clears the underlying JAXR object cache.
|
<T extends RegistryBean> |
create(java.lang.Class<T> interfaceClass)
Creates a new bean instance of the given class.
|
Search |
createSearch()
Create a
Search instance for all registered bean types. |
Search |
createSearch(java.lang.Class<? extends RegistryBean> beanClass)
Create a
Search instance for the given registry bean type. |
Search |
createSearch(java.util.List<java.lang.Class<? extends RegistryBean>> beanClasses)
Create a
Search instance for the given registry bean types. |
<T extends RegistryBean> |
delete(java.util.Collection<T> beans)
Deletes a
Collection of beans from the registry. |
<T extends RegistryBean> |
delete(T bean)
Deletes a bean from the registry.
|
RegistryBean |
detach(RegistryBean bean)
This is a method to remove(detach) from the
BeanPool . |
void |
flush()
Flushes all changes made by the beans to the Registry.
|
BeanFactory |
getBeanFactory()
Retrieves the bean factory.
|
BeanInfo |
getBeanInfo(RegistryBean bean)
Retrieves the
BeanInfo for a bean. |
BeanType |
getBeanType(RegistryBean bean)
Retrieves the
BeanType meta-information for the given bean. |
ConfigurationManager |
getConfigurationManager()
Retrieves the
ConfigurationManager . |
FlushMode |
getFlushMode()
Retrieves the current
FlushMode . |
PersistenceContext |
getPersistenceContext()
Retrieves the
PersistenceContext . |
java.util.Collection<PersistenceEventListener> |
getPersistenceListeners()
Retrieves the list of currently registered
PersistenceEventListener instances for this BeanPool . |
RegistryObjectModel |
getRegistryObjectModel()
Retrieves the
RegistryObjectModel instance for this bean pool.. |
java.util.Set<RelationInfo> |
getSourceRelations(RegistryBean bean)
Retrieves all registered relations inside the pool where the given bean
is the source.
|
java.util.Set<RelationInfo> |
getTargetRelations(RegistryBean bean)
Retrieves all registered relations inside the pool where the given bean
is the target.
|
<T extends RegistryBean> |
insert(T bean)
Deprecated.
|
boolean |
isManaged(RegistryBean bean)
Check if a given bean is being managed by the pool.
|
boolean |
isModified(RegistryBean bean)
Check if a given bean managed by the pool bean is modified.
|
<T extends RegistryBean> |
read(java.lang.Class<T> beanClass,
RegistryObject ro)
Read a registry bean of the specified type and for the specified RegistryObject.
|
<T extends RegistryBean> |
read(java.lang.Class<T> beanClass,
java.lang.String id)
Read a registry bean of the specified type and for the specified RegistryObject.
|
void |
removePersistenceListener(PersistenceEventListener listener)
Removes a priorly registered
PersistenceEventListener . |
void |
removeRelation(RelationInfo relation)
Removes the given
RelationInfo from the pool. |
<T extends RegistryBean> |
run(Query<T> query)
Called to perform a registry query.
|
void |
setFlushMode(FlushMode flushMode)
Sets the
FlushMode . |
<T extends RegistryBean> |
update(java.util.Collection<T> beans)
Updates a
Collection of beans already managed by the
BeanPool . |
<T extends RegistryBean> |
update(T bean)
Updates a bean already stored in the
BeanPool . |
public BeanPoolImpl(RegistryProvider registryProvider, ConfigurationManager confManager)
registryProvider
- The RegistryProvider
instanceconfManager
- The ConfigurationManager
instancepublic BeanPoolImpl(BeanFactory factory, RegistryProvider registryProvider, ConfigurationManager confManager)
factory
- The BeanFactory
instanceregistryProvider
- The RegistryProvider
instanceconfManager
- The ConfigurationManager
instancepublic ConfigurationManager getConfigurationManager()
ManagedBeanPool
ConfigurationManager
.getConfigurationManager
in interface ManagedBeanPool
ConfigurationManager
instancepublic <T extends RegistryBean> T create(java.lang.Class<T> interfaceClass) throws JBMException
BeanPool
BeanPool
.create
in interface BeanPool
T
- type extending the RegistryBean
interface.interfaceClass
- The bean Class
instance which should be createdRegistryBean
JBMException
- If an error occurs in creating the bean instancepublic <T extends RegistryBean> T insert(T bean) throws JBMException
insert
in interface BeanPool
T
- type extending the RegistryBean
interface.bean
- The bean object to insertRegistryBean
- the bean that is managed by
the BeanPool
.JBMException
- If there is an error in inserting the beanpublic <T extends RegistryBean> T read(java.lang.Class<T> beanClass, java.lang.String id) throws JBMException
ManagedBeanPool
BeanPool.attach(RegistryBean)
.read
in interface BeanPool
read
in interface ManagedBeanPool
T
- type extending the RegistryBean
interface.beanClass
- The bean Class
specifying the typeid
- The RegistryObject
to be readRegistryBean
object read from the bean poolJBMException
- If an error occurs while doing the read operationpublic <T extends RegistryBean> java.util.List<T> run(Query<T> query) throws CSAppFrameworkException
BeanPool
Query.run(com.softwareag.centrasite.appl.framework.persistence.QueryContext)
.run
in interface BeanPool
T
- type extending the RegistryBean
interface.query
- The Query
which should be executedList
of RegistryBean
instances obtained after executing the callCSAppFrameworkException
- If an error occurs while executing the querypublic <T extends RegistryBean> void update(T bean) throws JBMException
BeanPool
BeanPool
.update
in interface BeanPool
T
- type extending the RegistryBean
interface.bean
- The bean object to updateJBMException
- If an error occurs in updatingpublic <T extends RegistryBean> void update(java.util.Collection<T> beans) throws JBMException
BeanPool
Collection
of beans already managed by the
BeanPool
.update
in interface BeanPool
T
- type extending the RegistryBean
interface.beans
- The Collection
of bean objects to updateJBMException
- If an error is encountered during the collective update operationpublic void flush() throws JBMException
BeanPool
flush
in interface BeanPool
JBMException
- If an error occurs while executing this callpublic <T extends RegistryBean> void delete(T bean) throws JBMException
BeanPool
delete
in interface BeanPool
T
- type extending the RegistryBean
interface.bean
- The bean object to deleteJBMException
- If an error is encountered while deletingpublic <T extends RegistryBean> void delete(java.util.Collection<T> beans) throws JBMException
BeanPool
Collection
of beans from the registry.delete
in interface BeanPool
T
- type extending the RegistryBean
interface.beans
- The Collection
of bean objects to deleteJBMException
- If an error is encountered during the delete operationpublic FlushMode getFlushMode()
BeanPool
FlushMode
.getFlushMode
in interface BeanPool
FlushMode
instancepublic void setFlushMode(FlushMode flushMode)
BeanPool
FlushMode
.setFlushMode
in interface BeanPool
flushMode
- The FlushMode
to setpublic BeanInfo getBeanInfo(RegistryBean bean)
ManagedBeanPool
BeanInfo
for a bean.getBeanInfo
in interface ManagedBeanPool
bean
- The RegistryBean
instance whose bean info is requiredBeanInfo
for the given beanpublic boolean isManaged(RegistryBean bean)
ManagedBeanPool
isManaged
in interface ManagedBeanPool
bean
- The RegistryBean
instance to checktrue
if bean is managed by the pool and false
otherwisepublic boolean isModified(RegistryBean bean)
ManagedBeanPool
isModified
in interface ManagedBeanPool
bean
- The RegistryBean
to check for modificationtrue
if the bean is modified and false
otherwisepublic BeanFactory getBeanFactory()
ManagedBeanPool
getBeanFactory
in interface ManagedBeanPool
BeanFactory
instancepublic void clear() throws JBMException
BeanPool
clear
in interface BeanPool
JBMException
- If an error occurs while clearing the beanspublic RegistryBean detach(RegistryBean bean)
BeanPool
BeanPool
. Its
lifecycle will not be managed by the pool anymore. The bean can be
attached back to the pool at anytime by invoking the
BeanPool.update(RegistryBean)
method.detach
in interface BeanPool
bean
- The RegistryBean
to detachpublic void addPersistenceListener(PersistenceEventListener listener)
BeanPool
PersistenceEventListener
to listen on events
for this BeanPool
.addPersistenceListener
in interface BeanPool
listener
- The PersistenceEventListener
instance to addpublic java.util.Collection<PersistenceEventListener> getPersistenceListeners()
BeanPool
PersistenceEventListener
instances for this BeanPool
.getPersistenceListeners
in interface BeanPool
Collection
of registered PersistenceEventListener
objectspublic void removePersistenceListener(PersistenceEventListener listener)
BeanPool
PersistenceEventListener
.removePersistenceListener
in interface BeanPool
listener
- The PersistenceEventListener
instance to removepublic PersistenceContext getPersistenceContext()
ManagedBeanPool
PersistenceContext
.getPersistenceContext
in interface ManagedBeanPool
PersistenceContext
instancepublic void addRelation(RelationInfo relation)
addRelation
in interface ManagedBeanPool
relation
- The RelationInfo
to registerpublic void removeRelation(RelationInfo relation)
RelationInfo
from the pool.removeRelation
in interface ManagedBeanPool
relation
- The RelationInfo
to removepublic java.util.Set<RelationInfo> getSourceRelations(RegistryBean bean)
getSourceRelations
in interface ManagedBeanPool
bean
- The source RegistryBean
objectSet
of registered RelationInfo
objectspublic java.util.Set<RelationInfo> getTargetRelations(RegistryBean bean)
getTargetRelations
in interface ManagedBeanPool
bean
- The target RegistryBean
objectSet
of registered RelationInfo
objectspublic BeanType getBeanType(RegistryBean bean)
BeanType
meta-information for the given bean.getBeanType
in interface ManagedBeanPool
bean
- The RegistryBean
objectBeanType
meta information for beanpublic <T extends RegistryBean> T attach(T bean) throws JBMException
BeanPool
attach
in interface BeanPool
T
- type extending the RegistryBean
interface.bean
- The bean object to attachRegistryBean
- the bean that is managed by
the BeanPool
.JBMException
- If there is an error in attaching the beanpublic Search createSearch(java.util.List<java.lang.Class<? extends RegistryBean>> beanClasses) throws CSAppFrameworkException
BeanPool
Search
instance for the given registry bean types.createSearch
in interface BeanPool
beanClasses
- The List
of RegistryBean
classesSearch
instanceCSAppFrameworkException
- If an error occurs while creating the searchpublic RegistryObjectModel getRegistryObjectModel()
ManagedBeanPool
RegistryObjectModel
instance for this bean pool..getRegistryObjectModel
in interface ManagedBeanPool
RegistryObjectModel
objectpublic Search createSearch(java.lang.Class<? extends RegistryBean> beanClass) throws CSAppFrameworkException
BeanPool
Search
instance for the given registry bean type.createSearch
in interface BeanPool
beanClass
- The RegistryBean
classSearch
instance.CSAppFrameworkException
- If an error occurs while creating the searchpublic Search createSearch() throws CSAppFrameworkException
BeanPool
Search
instance for all registered bean types.createSearch
in interface BeanPool
Search
instance.CSAppFrameworkException
- If an error occurs while creating the searchpublic void clearJaxrCache() throws CSAppFrameworkException
BeanPool
clearJaxrCache
in interface BeanPool
CSAppFrameworkException
- If an error occurs while clearing the JAXR cachepublic <T extends RegistryBean> T read(java.lang.Class<T> beanClass, RegistryObject ro) throws JBMException
ManagedBeanPool
BeanPool.attach(RegistryBean)
.read
in interface BeanPool
read
in interface ManagedBeanPool
T
- type extending the RegistryBean
interface.beanClass
- The bean Class
specifying the typero
- The RegistryObject
to be readRegistryBean
object read from the bean poolJBMException
- If an error occurs while doing the read operation