com.softwareag.centrasite.appl.framework.persistence
Interface BeanPool

All Known Subinterfaces:
ManagedBeanPool
All Known Implementing Classes:
BeanPoolImpl

public interface BeanPool

This is the main interface for interaction with the Bean-JAXR Mapper. It provides CRUD interface with additional ability to query the registry. An application would use the following typical pattern

 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 multithreaded enviroment a one pool for each thread.

Version:
1.0

Method Summary
 void addPersistenceListener(PersistenceEventListener listener)
          Method for adding a PersistenceEventListener to listen on events for this BeanPool.
<T extends RegistryBean>
T
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>
T
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>
void
delete(java.util.Collection<T> beans)
          Deletes a Collection of beans from the registry.
<T extends RegistryBean>
void
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 to the beans to the Registry.
 FlushMode getFlushMode()
          Retrieves the current FlushMode
 java.util.Collection<PersistenceEventListener> getPersistenceListeners()
          Retrieves the list of currently registerred PersistenceEventListener instances for this BeanPool.
<T extends RegistryBean>
T
insert(T bean)
          Deprecated. use attach(RegistryBean)
<T extends RegistryBean>
T
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 registerred PersistenceEventListener.
<T extends RegistryBean>
java.util.List<T>
run(Query<T> pQuery)
          Called to perform a registry query.
 void setFlushMode(FlushMode flushMode)
          Sets the FlushMode
<T extends RegistryBean>
void
update(java.util.Collection<T> beans)
          Updates a Collection of beans already managed by the BeanPool.
<T extends RegistryBean>
void
update(T bean)
          Updates a bean already stored in the BeanPool.
 

Method Detail

create

<T extends RegistryBean> T create(java.lang.Class<T> beanClass)
                              throws JBMException
Creates a new bean instance of the given class. The bean is also inserted and from now on managed by the BeanPool.

Type Parameters:
T - type extending the RegistryBean interface.
Parameters:
beanClass -
Returns:
instance of RegistryBean
Throws:
JBMException

insert

<T extends RegistryBean> T insert(T bean)
                              throws JBMException
Deprecated. use attach(RegistryBean)

Insert a bean in the pool. From now on that bean will be managed.

Type Parameters:
T - type extending the RegistryBean interface.
Parameters:
bean -
Returns:
instance of RegistryBean - the bean that is manager by the BeanPool.
Throws:
JBMException

attach

<T extends RegistryBean> T attach(T bean)
                              throws JBMException
Insert a bean in the pool. From now on that bean will be managed.

Type Parameters:
T - type extending the RegistryBean interface.
Parameters:
bean -
Returns:
instance of RegistryBean - the bean that is manager by the BeanPool.
Throws:
JBMException

read

<T extends RegistryBean> T read(java.lang.Class<T> beanClass,
                                java.lang.String id)
                            throws JBMException
Read for the registry a bean of specified type and having a given id.

Type Parameters:
T - type extending the RegistryBean interface.
Parameters:
beanClass -
Throws:
JBMException

update

<T extends RegistryBean> void update(T bean)
            throws JBMException
Updates a bean already stored in the BeanPool.

Type Parameters:
T - type extending the RegistryBean interface.
Parameters:
bean -
Throws:
JBMException

update

<T extends RegistryBean> void update(java.util.Collection<T> beans)
            throws JBMException
Updates a Collection of beans already managed by the BeanPool.

Type Parameters:
T - type extending the RegistryBean interface.
Parameters:
beans -
Throws:
JBMException

delete

<T extends RegistryBean> void delete(T bean)
            throws JBMException
Deletes a bean from the registry.

Type Parameters:
T - type extending the RegistryBean interface.
Parameters:
bean -
Throws:
JBMException

delete

<T extends RegistryBean> void delete(java.util.Collection<T> beans)
            throws JBMException
Deletes a Collection of beans from the registry.

Type Parameters:
T - type extending the RegistryBean interface.
Parameters:
beans -
Throws:
JBMException

run

<T extends RegistryBean> java.util.List<T> run(Query<T> pQuery)
                                           throws CSAppFrameworkException
Called to perform a registry query. The caller will receive the beans, which have been generated by Query.run(com.softwareag.centrasite.appl.framework.persistence.QueryContext).

Throws:
CSAppFrameworkException

flush

void flush()
           throws JBMException
Flushes all changes made to the beans to the Registry.

Throws:
JBMException

clear

void clear()
           throws JBMException
Clears the pool. All managed beans are cleaned. If the beans have any changes, they are discarded.

Throws:
JBMException

getFlushMode

FlushMode getFlushMode()
Retrieves the current FlushMode

Returns:
FlushMode

setFlushMode

void setFlushMode(FlushMode flushMode)
Sets the FlushMode

Parameters:
flushMode -

detach

RegistryBean detach(RegistryBean bean)
This is a method to remove(detach) from the 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.


addPersistenceListener

void addPersistenceListener(PersistenceEventListener listener)
Method for adding a PersistenceEventListener to listen on events for this BeanPool.

Parameters:
listener -

removePersistenceListener

void removePersistenceListener(PersistenceEventListener listener)
Removes a priorly registerred PersistenceEventListener.

Parameters:
listener -

getPersistenceListeners

java.util.Collection<PersistenceEventListener> getPersistenceListeners()
Retrieves the list of currently registerred PersistenceEventListener instances for this BeanPool.

Returns:
List

createSearch

Search createSearch(java.util.List<java.lang.Class<? extends RegistryBean>> beanClasses)
                    throws CSAppFrameworkException
Create a Search instance for the given registry bean types.

Parameters:
beanClasses -
Returns:
Search
Throws:
CSAppFrameworkException

createSearch

Search createSearch(java.lang.Class<? extends RegistryBean> beanClass)
                    throws CSAppFrameworkException
Create a Search instance for the given registry bean type.

Parameters:
beanClass -
Returns:
Search instance.
Throws:
CSAppFrameworkException

createSearch

Search createSearch()
                    throws CSAppFrameworkException
Create a Search instance for all registered bean types.

Returns:
Search instance.
Throws:
CSAppFrameworkException

clearJaxrCache

void clearJaxrCache()
                    throws CSAppFrameworkException
Clears the underlying JAXR object cache.

Throws:
CSAppFrameworkException