com.softwareag.centrasite.appl.framework.persistence.impl
Class BeanPoolImpl

java.lang.Object
  extended by com.softwareag.centrasite.appl.framework.persistence.impl.BeanPoolImpl
All Implemented Interfaces:
BeanPool, ManagedBeanPool

public class BeanPoolImpl
extends java.lang.Object
implements ManagedBeanPool

Default implementation of the BeanPool interface.

Version:
1.0

Constructor Summary
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.
 
Method Summary
 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>
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> 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>
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.
 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 registerred 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>
T
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 managed by the pool bean is modified.
<T extends RegistryBean>
T
read(java.lang.Class<T> beanClass, javax.xml.registry.infomodel.RegistryObject ro)
          Read a registry bean of the specified type and for the specified RegistryObject.
<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.
 void removeRelation(RelationInfo relation)
          Removes the given RelationInfo from the pool.
<T extends RegistryBean>
java.util.List<T>
run(Query<T> query)
          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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanPoolImpl

public BeanPoolImpl(RegistryProvider registryProvider,
                    ConfigurationManager confManager)
Creates a new instance with the given registry provider.


BeanPoolImpl

public BeanPoolImpl(BeanFactory factory,
                    RegistryProvider registryProvider,
                    ConfigurationManager confManager)
Creates a new instance with the given bean factory and registry provider.

Method Detail

getConfigurationManager

public ConfigurationManager getConfigurationManager()
Description copied from interface: ManagedBeanPool
Retrieves the ConfigurationManager

Specified by:
getConfigurationManager in interface ManagedBeanPool
Returns:
ConfigurationManager

create

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

Specified by:
create in interface BeanPool
Type Parameters:
T - type extending the RegistryBean interface.
Returns:
instance of RegistryBean
Throws:
JBMException

insert

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

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

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

read

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

Specified by:
read in interface BeanPool
Type Parameters:
T - type extending the RegistryBean interface.
Throws:
JBMException

run

public <T extends RegistryBean> java.util.List<T> run(Query<T> query)
                                           throws CSAppFrameworkException
Description copied from interface: BeanPool
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).

Specified by:
run in interface BeanPool
Throws:
CSAppFrameworkException

update

public <T extends RegistryBean> void update(T bean)
            throws JBMException
Description copied from interface: BeanPool
Updates a bean already stored in the BeanPool.

Specified by:
update in interface BeanPool
Type Parameters:
T - type extending the RegistryBean interface.
Throws:
JBMException

update

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

Specified by:
update in interface BeanPool
Type Parameters:
T - type extending the RegistryBean interface.
Throws:
JBMException

flush

public void flush()
           throws JBMException
Description copied from interface: BeanPool
Flushes all changes made to the beans to the Registry.

Specified by:
flush in interface BeanPool
Throws:
JBMException

delete

public <T extends RegistryBean> void delete(T bean)
            throws JBMException
Description copied from interface: BeanPool
Deletes a bean from the registry.

Specified by:
delete in interface BeanPool
Type Parameters:
T - type extending the RegistryBean interface.
Throws:
JBMException

delete

public <T extends RegistryBean> void delete(java.util.Collection<T> beans)
            throws JBMException
Description copied from interface: BeanPool
Deletes a Collection of beans from the registry.

Specified by:
delete in interface BeanPool
Type Parameters:
T - type extending the RegistryBean interface.
Throws:
JBMException

getFlushMode

public FlushMode getFlushMode()
Description copied from interface: BeanPool
Retrieves the current FlushMode

Specified by:
getFlushMode in interface BeanPool
Returns:
FlushMode

setFlushMode

public void setFlushMode(FlushMode flushMode)
Description copied from interface: BeanPool
Sets the FlushMode

Specified by:
setFlushMode in interface BeanPool

getBeanInfo

public BeanInfo getBeanInfo(RegistryBean bean)
Description copied from interface: ManagedBeanPool
Retrieves the BeanInfo for a bean.

Specified by:
getBeanInfo in interface ManagedBeanPool
Returns:
BeanInfo

isManaged

public boolean isManaged(RegistryBean bean)
Description copied from interface: ManagedBeanPool
Check if a given bean is being managed by the pool.

Specified by:
isManaged in interface ManagedBeanPool
Returns:
boolean

isModified

public boolean isModified(RegistryBean bean)
Description copied from interface: ManagedBeanPool
Check if a given managed by the pool bean is modified.

Specified by:
isModified in interface ManagedBeanPool
Returns:
boolean

getBeanFactory

public BeanFactory getBeanFactory()
Description copied from interface: ManagedBeanPool
Retrieves the bean factory.

Specified by:
getBeanFactory in interface ManagedBeanPool
Returns:
BeanFactory

clear

public void clear()
           throws JBMException
Description copied from interface: BeanPool
Clears the pool. All managed beans are cleaned. If the beans have any changes, they are discarded.

Specified by:
clear in interface BeanPool
Throws:
JBMException

detach

public RegistryBean detach(RegistryBean bean)
Description copied from interface: BeanPool
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 BeanPool.update(RegistryBean) method.

Specified by:
detach in interface BeanPool

addPersistenceListener

public void addPersistenceListener(PersistenceEventListener listener)
Description copied from interface: BeanPool
Method for adding a PersistenceEventListener to listen on events for this BeanPool.

Specified by:
addPersistenceListener in interface BeanPool

getPersistenceListeners

public java.util.Collection<PersistenceEventListener> getPersistenceListeners()
Description copied from interface: BeanPool
Retrieves the list of currently registerred PersistenceEventListener instances for this BeanPool.

Specified by:
getPersistenceListeners in interface BeanPool
Returns:
List

removePersistenceListener

public void removePersistenceListener(PersistenceEventListener listener)
Description copied from interface: BeanPool
Removes a priorly registerred PersistenceEventListener.

Specified by:
removePersistenceListener in interface BeanPool

getPersistenceContext

public PersistenceContext getPersistenceContext()
Description copied from interface: ManagedBeanPool
Retrieves the PersistenceContext

Specified by:
getPersistenceContext in interface ManagedBeanPool
Returns:
PersistenceContext

addRelation

public void addRelation(RelationInfo relation)
Registers relation to the given bean.

Specified by:
addRelation in interface ManagedBeanPool

removeRelation

public void removeRelation(RelationInfo relation)
Removes the given RelationInfo from the pool.

Specified by:
removeRelation in interface ManagedBeanPool

getSourceRelations

public java.util.Set<RelationInfo> getSourceRelations(RegistryBean bean)
Retrieves all registered relations inside the pool where the given bean is the source.

Specified by:
getSourceRelations in interface ManagedBeanPool
Returns:
Set

getTargetRelations

public java.util.Set<RelationInfo> getTargetRelations(RegistryBean bean)
Retrieves all registered relations inside the pool where the given bean is the target.

Specified by:
getTargetRelations in interface ManagedBeanPool
Returns:
Set

getBeanType

public BeanType getBeanType(RegistryBean bean)
Retrieves the BeanType meta-information for the given bean.

Specified by:
getBeanType in interface ManagedBeanPool
Returns:
BeanType

attach

public <T extends RegistryBean> T attach(T bean)
                              throws JBMException
Description copied from interface: BeanPool
Insert a bean in the pool. From now on that bean will be managed.

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

createSearch

public Search createSearch(java.util.List<java.lang.Class<? extends RegistryBean>> beanClasses)
                    throws CSAppFrameworkException
Description copied from interface: BeanPool
Create a Search instance for the given registry bean types.

Specified by:
createSearch in interface BeanPool
Returns:
Search
Throws:
CSAppFrameworkException

getRegistryObjectModel

public RegistryObjectModel getRegistryObjectModel()
Description copied from interface: ManagedBeanPool
Retrieves the RegistryObjectModel instance for this bean pool..

Specified by:
getRegistryObjectModel in interface ManagedBeanPool
Returns:
RegistryObjectModel

createSearch

public Search createSearch(java.lang.Class<? extends RegistryBean> beanClass)
                    throws CSAppFrameworkException
Description copied from interface: BeanPool
Create a Search instance for the given registry bean type.

Specified by:
createSearch in interface BeanPool
Returns:
Search instance.
Throws:
CSAppFrameworkException

createSearch

public Search createSearch()
                    throws CSAppFrameworkException
Description copied from interface: BeanPool
Create a Search instance for all registered bean types.

Specified by:
createSearch in interface BeanPool
Returns:
Search instance.
Throws:
CSAppFrameworkException

clearJaxrCache

public void clearJaxrCache()
                    throws CSAppFrameworkException
Description copied from interface: BeanPool
Clears the underlying JAXR object cache.

Specified by:
clearJaxrCache in interface BeanPool
Throws:
CSAppFrameworkException

read

public <T extends RegistryBean> T read(java.lang.Class<T> beanClass,
                                       javax.xml.registry.infomodel.RegistryObject ro)
                            throws JBMException
Description copied from interface: ManagedBeanPool
Read a registry bean of the specified type and for the specified RegistryObject. Does not add the result to the bean pool. This can be done by calling BeanPool.attach(RegistryBean).

Specified by:
read in interface ManagedBeanPool
Type Parameters:
T - type extending the RegistryBean interface.
Throws:
JBMException