org.jboss.resource.connectionmanager
Class CachedConnectionInterceptor

java.lang.Object
  extended byorg.jboss.ejb.plugins.AbstractInterceptor (src) 
      extended byorg.jboss.resource.connectionmanager.CachedConnectionInterceptor
All Implemented Interfaces:
AllowedOperationsFlags (src) , ContainerPlugin (src) , EntityPersistenceManager (src) , Interceptor (src) , Service (src)

public class CachedConnectionInterceptor
extends AbstractInterceptor (src)
implements EntityPersistenceManager (src)

CachedConnectionInterceptor.java Created: Sat Jan 12 01:22:06 2002


Field Summary
 
Fields inherited from class org.jboss.ejb.plugins.AbstractInterceptor (src)
nextInterceptor
 
Fields inherited from interface org.jboss.ejb.AllowedOperationsFlags (src)
IN_AFTER_BEGIN, IN_AFTER_COMPLETION, IN_BEFORE_COMPLETION, IN_BUSINESS_METHOD, IN_EJB_ACTIVATE, IN_EJB_CREATE, IN_EJB_FIND, IN_EJB_HOME, IN_EJB_LOAD, IN_EJB_PASSIVATE, IN_EJB_POST_CREATE, IN_EJB_REMOVE, IN_EJB_STORE, IN_EJB_TIMEOUT, IN_INTERCEPTOR_METHOD, IN_SERVICE_ENDPOINT_METHOD, IN_SET_ENTITY_CONTEXT, IN_SET_MESSAGE_DRIVEN_CONTEXT, IN_SET_SESSION_CONTEXT, IN_UNSET_ENTITY_CONTEXT, NOT_ALLOWED
 
Constructor Summary
CachedConnectionInterceptor()
           
 
Method Summary
 void activateEntity(EntityEnterpriseContext (src)  instance)
          This method is called when an entity shall be activated.
 void create()
          create the service, do expensive operations etc
 java.lang.Object createBeanClassInstance()
          Returns a new instance of the bean class or a subclass of the bean class.
 void createEntity(java.lang.reflect.Method m, java.lang.Object[] args, EntityEnterpriseContext (src)  instance)
          This method is called whenever an entity is to be created.
 void destroy()
          destroy the service, tear down
 java.util.Collection findEntities(java.lang.reflect.Method finderMethod, java.lang.Object[] args, EntityEnterpriseContext (src)  instance, GenericEntityObjectFactory (src)  factory)
          This method is called when collections of entities are to be found.
 java.lang.Object findEntity(java.lang.reflect.Method finderMethod, java.lang.Object[] args, EntityEnterpriseContext (src)  instance, GenericEntityObjectFactory (src)  factory)
          This method is called when single entities are to be found.
 Container (src) getContainer()
           
 java.lang.Object invoke(Invocation (src)  mi)
          ???
 void invokeEjbStore(EntityEnterpriseContext (src)  ctx)
          Invokes ejbStore on the instance.
 java.lang.Object invokeHome(Invocation (src)  mi)
          ???
 boolean isModified(EntityEnterpriseContext (src)  ctx)
          This method is used to determined whether the instance was modified.
 boolean isStoreRequired(EntityEnterpriseContext (src)  instance)
          This method is used to determine if an entity should be stored.
 void loadEntity(EntityEnterpriseContext (src)  instance)
          This method is called whenever an entity shall be load from the underlying storage.
 void passivateEntity(EntityEnterpriseContext (src)  instance)
          This method is called when an entity shall be passivate.
 void postCreateEntity(java.lang.reflect.Method m, java.lang.Object[] args, EntityEnterpriseContext (src)  instance)
          This method is called whenever an entity is to be created.
 void removeEntity(EntityEnterpriseContext (src)  instance)
          This method is called when an entity shall be removed from the underlying storage.
 void setContainer(Container (src)  container)
          This callback is set by the container so that the plugin may access it
 void start()
          start the service, create is already called
 void stop()
          stop the service
 void storeEntity(EntityEnterpriseContext (src)  ctx)
          This method is called whenever an entity shall be stored to the underlying storage.
 
Methods inherited from class org.jboss.ejb.plugins.AbstractInterceptor (src)
getNext, setNext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachedConnectionInterceptor

public CachedConnectionInterceptor()
                            throws java.lang.Exception
Method Detail

start

public void start()
           throws java.lang.Exception
Description copied from interface: Service (src)
start the service, create is already called

Specified by:
start in interface Service (src)
Overrides:
start in class AbstractInterceptor (src)
Throws:
java.lang.Exception -

stop

public void stop()
Description copied from interface: Service (src)
stop the service

Specified by:
stop in interface Service (src)
Overrides:
stop in class AbstractInterceptor (src)

destroy

public void destroy()
Description copied from interface: Service (src)
destroy the service, tear down

Specified by:
destroy in interface Service (src)
Overrides:
destroy in class AbstractInterceptor (src)

create

public void create()
            throws java.lang.Exception
Description copied from interface: Service (src)
create the service, do expensive operations etc

Specified by:
create in interface Service (src)
Overrides:
create in class AbstractInterceptor (src)
Throws:
java.lang.Exception -

invoke

public java.lang.Object invoke(Invocation (src)  mi)
                        throws java.lang.Exception
Description copied from interface: Interceptor (src)
???

Specified by:
invoke in interface Interceptor (src)
Overrides:
invoke in class AbstractInterceptor (src)
Returns:
Throws:
java.lang.Exception -

invokeHome

public java.lang.Object invokeHome(Invocation (src)  mi)
                            throws java.lang.Exception
Description copied from interface: Interceptor (src)
???

Specified by:
invokeHome in interface Interceptor (src)
Overrides:
invokeHome in class AbstractInterceptor (src)
Returns:
Throws:
java.lang.Exception -

setContainer

public void setContainer(Container (src)  container)
Description copied from interface: ContainerPlugin (src)
This callback is set by the container so that the plugin may access it

Specified by:
setContainer in interface ContainerPlugin (src)
Overrides:
setContainer in class AbstractInterceptor (src)

getContainer

public Container (src)  getContainer()
Overrides:
getContainer in class AbstractInterceptor (src)

createBeanClassInstance

public java.lang.Object createBeanClassInstance()
                                         throws java.lang.Exception
Returns a new instance of the bean class or a subclass of the bean class.

Specified by:
createBeanClassInstance in interface EntityPersistenceManager (src)
Returns:
the new instance
Throws:
java.lang.Exception

createEntity

public void createEntity(java.lang.reflect.Method m,
                         java.lang.Object[] args,
                         EntityEnterpriseContext (src)  instance)
                  throws java.lang.Exception
This method is called whenever an entity is to be created. The persistence manager is responsible for calling the ejbCreate methods on the instance and to handle the results properly wrt the persistent store.

Specified by:
createEntity in interface EntityPersistenceManager (src)
Parameters:
m - the create method in the home interface that was called
args - any create parameters
instance - the instance being used for this create call
Throws:
java.lang.Exception

postCreateEntity

public void postCreateEntity(java.lang.reflect.Method m,
                             java.lang.Object[] args,
                             EntityEnterpriseContext (src)  instance)
                      throws java.lang.Exception
Description copied from interface: EntityPersistenceManager (src)
This method is called whenever an entity is to be created. The persistence manager is responsible for calling the ejbPostCreate method on the instance and to handle the results properly wrt the persistent store.

Specified by:
postCreateEntity in interface EntityPersistenceManager (src)
Parameters:
m - the create method in the home interface that was called
args - any create parameters
instance - the instance being used for this create call
Throws:
java.lang.Exception

findEntity

public java.lang.Object findEntity(java.lang.reflect.Method finderMethod,
                                   java.lang.Object[] args,
                                   EntityEnterpriseContext (src)  instance,
                                   GenericEntityObjectFactory (src)  factory)
                            throws java.lang.Exception
This method is called when single entities are to be found. The persistence manager must find out whether the wanted instance is available in the persistence store, and if so it shall use the ContainerInvoker plugin to create an EJBObject to the instance, which is to be returned as result.

Specified by:
findEntity in interface EntityPersistenceManager (src)
Parameters:
finderMethod - the find method in the home interface that was called
args - any finder parameters
instance - the instance to use for the finder call
Returns:
an EJBObject representing the found entity
Throws:
java.lang.Exception

findEntities

public java.util.Collection findEntities(java.lang.reflect.Method finderMethod,
                                         java.lang.Object[] args,
                                         EntityEnterpriseContext (src)  instance,
                                         GenericEntityObjectFactory (src)  factory)
                                  throws java.lang.Exception
This method is called when collections of entities are to be found. The persistence manager must find out whether the wanted instances are available in the persistence store, and if so it shall use the ContainerInvoker plugin to create EJBObjects to the instances, which are to be returned as result.

Specified by:
findEntities in interface EntityPersistenceManager (src)
Parameters:
finderMethod - the find method in the home interface that was called
args - any finder parameters
instance - the instance to use for the finder call
Returns:
an EJBObject collection representing the found entities
Throws:
java.lang.Exception

activateEntity

public void activateEntity(EntityEnterpriseContext (src)  instance)
                    throws java.rmi.RemoteException
This method is called when an entity shall be activated. The persistence manager must call the ejbActivate method on the instance.

Specified by:
activateEntity in interface EntityPersistenceManager (src)
Parameters:
instance - the instance to use for the activation
Throws:
java.rmi.RemoteException - thrown if some system exception occurs

loadEntity

public void loadEntity(EntityEnterpriseContext (src)  instance)
                throws java.rmi.RemoteException
This method is called whenever an entity shall be load from the underlying storage. The persistence manager must load the state from the underlying storage and then call ejbLoad on the supplied instance.

Specified by:
loadEntity in interface EntityPersistenceManager (src)
Parameters:
instance - the instance to synchronize
Throws:
java.rmi.RemoteException - thrown if some system exception occurs

isStoreRequired

public boolean isStoreRequired(EntityEnterpriseContext (src)  instance)
                        throws java.lang.Exception
This method is used to determine if an entity should be stored.

Specified by:
isStoreRequired in interface EntityPersistenceManager (src)
Parameters:
instance - the instance to check
Returns:
true, if the entity has been modified
Throws:
java.lang.Exception - thrown if some system exception occurs

isModified

public boolean isModified(EntityEnterpriseContext (src)  ctx)
                   throws java.lang.Exception
Description copied from interface: EntityPersistenceManager (src)
This method is used to determined whether the instance was modified. NOTE, even if the method returns true the isStoreRequired for this same instance might return false, e.g. a CMR field that doesn't have a foreign key was modified.

Specified by:
isModified in interface EntityPersistenceManager (src)
Parameters:
ctx -
Returns:
Throws:
java.lang.Exception

storeEntity

public void storeEntity(EntityEnterpriseContext (src)  ctx)
                 throws java.rmi.RemoteException
This method is called whenever an entity shall be stored to the underlying storage. The persistence manager must call ejbStore on the supplied instance and then store the state to the underlying storage.

Specified by:
storeEntity in interface EntityPersistenceManager (src)
Parameters:
ctx - the instance to synchronize
Throws:
java.rmi.RemoteException - thrown if some system exception occurs

invokeEjbStore

public void invokeEjbStore(EntityEnterpriseContext (src)  ctx)
                    throws java.rmi.RemoteException
Description copied from interface: EntityPersistenceManager (src)
Invokes ejbStore on the instance.

Specified by:
invokeEjbStore in interface EntityPersistenceManager (src)
Parameters:
ctx -
Throws:
java.rmi.RemoteException

passivateEntity

public void passivateEntity(EntityEnterpriseContext (src)  instance)
                     throws java.rmi.RemoteException
This method is called when an entity shall be passivate. The persistence manager must call the ejbPassivate method on the instance.

Specified by:
passivateEntity in interface EntityPersistenceManager (src)
Parameters:
instance - the instance to passivate
Throws:
java.rmi.RemoteException - thrown if some system exception occurs

removeEntity

public void removeEntity(EntityEnterpriseContext (src)  instance)
                  throws java.rmi.RemoteException,
                         RemoveException (src) 
This method is called when an entity shall be removed from the underlying storage. The persistence manager must call ejbRemove on the instance and then remove its state from the underlying storage.

Specified by:
removeEntity in interface EntityPersistenceManager (src)
Parameters:
instance - the instance to remove
Throws:
java.rmi.RemoteException - thrown if some system exception occurs
RemoveException (src) - thrown if the instance could not be removed