public interface BeanPool
RegistryProvider registryProvider = new StandaloneRegistryProvider(); SessionContext sessionContext = SessionContext.createInstance(registryProvider); BeanPool beanPool = sessionContext.getBeanPool(); Finding finding = beanPool.create(Finding.class); finding.setComment("Brand new finding"); finding.setCorrectiveMeasure("Some corrective measure"); beanPool.update(finding);Have in mind that the
BeanPool
is not thread-safe. It should be used
by one thread only. In multi-threaded environment a one pool for each thread.Modifier and Type | Method and Description |
---|---|
void |
addPersistenceListener(PersistenceEventListener listener)
Method for adding a
PersistenceEventListener to listen on events
for this BeanPool . |
<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> beanClass)
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.
|
FlushMode |
getFlushMode()
Retrieves the current
FlushMode . |
java.util.Collection<PersistenceEventListener> |
getPersistenceListeners()
Retrieves the list of currently registered
PersistenceEventListener instances for this BeanPool . |
<T extends RegistryBean> |
insert(T bean)
Deprecated.
|
<T extends RegistryBean> |
read(java.lang.Class<T> beanClass,
java.lang.String id)
Read for the registry a bean of specified type and having a given id.
|
void |
removePersistenceListener(PersistenceEventListener listener)
Removes a priorly registered
PersistenceEventListener . |
<T extends RegistryBean> |
run(Query<T> pQuery)
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 . |
<T extends RegistryBean> T create(java.lang.Class<T> beanClass) throws JBMException
BeanPool
.T
- type extending the RegistryBean
interface.beanClass
- The bean Class
instance which should be createdRegistryBean
JBMException
- If an error occurs in creating the bean instance<T extends RegistryBean> T insert(T bean) throws JBMException
attach(RegistryBean)
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 bean<T extends RegistryBean> T attach(T bean) throws JBMException
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 bean<T extends RegistryBean> T read(java.lang.Class<T> beanClass, java.lang.String id) throws JBMException
T
- type extending the RegistryBean
interface.beanClass
- The class for the bean typeid
- The id for the beanRegistryBean
- the bean that is managed by
the BeanPool
.JBMException
- If an error is encountered during the read operation<T extends RegistryBean> void update(T bean) throws JBMException
BeanPool
.T
- type extending the RegistryBean
interface.bean
- The bean object to updateJBMException
- If an error occurs in updating<T extends RegistryBean> void update(java.util.Collection<T> beans) throws JBMException
Collection
of beans already managed by the
BeanPool
.T
- type extending the RegistryBean
interface.beans
- The Collection
of bean objects to updateJBMException
- If an error is encountered during the collective update operation<T extends RegistryBean> void delete(T bean) throws JBMException
T
- type extending the RegistryBean
interface.bean
- The bean object to deleteJBMException
- If an error is encountered while deleting<T extends RegistryBean> void delete(java.util.Collection<T> beans) throws JBMException
Collection
of beans from the registry.T
- type extending the RegistryBean
interface.beans
- The Collection
of bean objects to deleteJBMException
- If an error is encountered during the delete operation<T extends RegistryBean> java.util.List<T> run(Query<T> pQuery) throws CSAppFrameworkException
Query.run(com.softwareag.centrasite.appl.framework.persistence.QueryContext)
.T
- type extending the RegistryBean
interface.pQuery
- The Query
which should be executedList
of RegistryBean
instances obtained after executing the callCSAppFrameworkException
- If an error occurs while executing the queryvoid flush() throws JBMException
JBMException
- If an error occurs while executing this callvoid clear() throws JBMException
JBMException
- If an error occurs while clearing the beansvoid setFlushMode(FlushMode flushMode)
FlushMode
.flushMode
- The FlushMode
to setRegistryBean detach(RegistryBean bean)
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
update(RegistryBean)
method.bean
- The RegistryBean
to detachvoid addPersistenceListener(PersistenceEventListener listener)
PersistenceEventListener
to listen on events
for this BeanPool
.listener
- The PersistenceEventListener
instance to addvoid removePersistenceListener(PersistenceEventListener listener)
PersistenceEventListener
.listener
- The PersistenceEventListener
instance to removejava.util.Collection<PersistenceEventListener> getPersistenceListeners()
PersistenceEventListener
instances for this BeanPool
.Collection
of registered PersistenceEventListener
objectsSearch createSearch(java.util.List<java.lang.Class<? extends RegistryBean>> beanClasses) throws CSAppFrameworkException
Search
instance for the given registry bean types.beanClasses
- The List
of RegistryBean
classesSearch
instanceCSAppFrameworkException
- If an error occurs while creating the searchSearch createSearch(java.lang.Class<? extends RegistryBean> beanClass) throws CSAppFrameworkException
Search
instance for the given registry bean type.beanClass
- The RegistryBean
classSearch
instance.CSAppFrameworkException
- If an error occurs while creating the searchSearch createSearch() throws CSAppFrameworkException
Search
instance for all registered bean types.Search
instance.CSAppFrameworkException
- If an error occurs while creating the searchvoid clearJaxrCache() throws CSAppFrameworkException
CSAppFrameworkException
- If an error occurs while clearing the JAXR cache