org.jboss.ha.httpsession.beanimpl.ejb
Class ClusteredHTTPSessionBeanAbstract

java.lang.Object
  extended byorg.jboss.ha.httpsession.beanimpl.ejb.ClusteredHTTPSessionBeanAbstract
All Implemented Interfaces:
ClusteredHTTPSessionBusiness (src) , EnterpriseBean (src) , EntityBean (src) , java.io.Serializable
Direct Known Subclasses:
ClusteredHTTPSessionBeanImpl (src)

public abstract class ClusteredHTTPSessionBeanAbstract
extends java.lang.Object
implements EntityBean (src) , ClusteredHTTPSessionBusiness (src)

Abstract default implementation of the Clustered HTTP session for servlets.

See Also:
ClusteredHTTPSession (src) , ClusteredHTTPSessionBusiness (src) , ClusteredHTTPSessionHome (src) , Serialized Form

Field Summary
protected  EntityContext (src) ejbContext
           
 
Constructor Summary
ClusteredHTTPSessionBeanAbstract()
           
 
Method Summary
 void ejbActivate()
          A container invokes this method when the instance is taken out of the pool of available instances to become associated with a specific EJB object.
 java.lang.String ejbCreate(java.lang.String sessionId)
           
 java.lang.String ejbCreate(java.lang.String sessionId, SerializableHttpSession (src)  session)
           
 void ejbLoad()
          A container invokes this method to instruct the instance to synchronize its state by loading it state from the underlying database.
 void ejbPassivate()
          A container invokes this method on an instance before the instance becomes disassociated with a specific EJB object.
 void ejbPostCreate(java.lang.String sessionId)
           
 void ejbPostCreate(java.lang.String sessionId, SerializableHttpSession (src)  session)
           
 void ejbRemove()
          A container invokes this method before it removes the EJB object that is currently associated with the instance.
 void ejbStore()
          A container invokes this method to instruct the instance to synchronize its state by storing it to the underlying database.
abstract  long getCreationTime()
          Return the time when this session has been created in miliseconds since 1970.
protected  EntityContext (src) getEntityContext()
           
abstract  long getLastAccessedTime()
          Return the last time this session has been accessed in miliseconds since 1970.
abstract  java.io.Serializable getSerializedSession()
           
abstract  SerializableHttpSession (src) getSession()
          Return the HttpSession object associated to its id.
abstract  java.lang.String getSessionId()
          Get the session identifier associated to this HTTPSession.
abstract  boolean isModified()
           
abstract  void setCreationTime(long value)
           
 void setEntityContext(EntityContext (src)  ctx)
          Set the associated entity context.
abstract  void setLastAccessedTime(long value)
           
abstract  void setSerializedSession(java.io.Serializable session)
           
abstract  void setSession(SerializableHttpSession (src)  session)
          Associate a new session (set of attributes, ...) to this id.
abstract  void setSessionId(java.lang.String sessionId)
           
 void unsetEntityContext()
          Unset the associated entity context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ejbContext

protected EntityContext (src)  ejbContext
Constructor Detail

ClusteredHTTPSessionBeanAbstract

public ClusteredHTTPSessionBeanAbstract()
Method Detail

ejbCreate

public java.lang.String ejbCreate(java.lang.String sessionId)
                           throws CreateException (src) 
Throws:
CreateException (src)

ejbPostCreate

public void ejbPostCreate(java.lang.String sessionId)
                   throws CreateException (src) 
Throws:
CreateException (src)

ejbCreate

public java.lang.String ejbCreate(java.lang.String sessionId,
                                  SerializableHttpSession (src)  session)
                           throws CreateException (src) 
Throws:
CreateException (src)

ejbPostCreate

public void ejbPostCreate(java.lang.String sessionId,
                          SerializableHttpSession (src)  session)
                   throws CreateException (src) 
Throws:
CreateException (src)

isModified

public abstract boolean isModified()

ejbStore

public void ejbStore()
              throws EJBException (src) ,
                     java.rmi.RemoteException
Description copied from interface: EntityBean (src)

A container invokes this method to instruct the instance to synchronize its state by storing it to the underlying database.

This method always executes in the transaction context determined by the value of the transaction attribute in the deployment descriptor.

Specified by:
ejbStore in interface EntityBean (src)
Throws:
EJBException (src) - - Thrown by the method to indicate a failure caused by a system-level error.
java.rmi.RemoteException - - This exception is defined in the method signature to provide backward compatibility for enterprise beans written for the EJB 1.0 specification. Enterprise beans written for the EJB 1.1 specification should throw the javax.ejb.EJBException instead of this exception. Enterprise beans written for the EJB2.0 and higher specifications must throw the javax.ejb.EJBException instead of this exception.

ejbActivate

public void ejbActivate()
                 throws EJBException (src) ,
                        java.rmi.RemoteException
Description copied from interface: EntityBean (src)

A container invokes this method when the instance is taken out of the pool of available instances to become associated with a specific EJB object. This method transitions the instance to the ready state.

This method executes in an unspecified transaction context.

Specified by:
ejbActivate in interface EntityBean (src)
Throws:
EJBException (src) - - Thrown by the method to indicate a failure caused by a system-level error.
java.rmi.RemoteException - - This exception is defined in the method signature to provide backward compatibility for enterprise beans written for the EJB 1.0 specification. Enterprise beans written for the EJB 1.1 specification should throw the javax.ejb.EJBException instead of this exception. Enterprise beans written for the EJB2.0 and higher specifications must throw the javax.ejb.EJBException instead of this exception.

ejbPassivate

public void ejbPassivate()
                  throws EJBException (src) ,
                         java.rmi.RemoteException
Description copied from interface: EntityBean (src)

A container invokes this method on an instance before the instance becomes disassociated with a specific EJB object. After this method completes, the container will place the instance into the pool of available instances.

This method executes in an unspecified transaction context.

Specified by:
ejbPassivate in interface EntityBean (src)
Throws:
java.rmi.RemoteException - - This exception is defined in the method signature to provide backward compatibility for enterprise beans written for the EJB 1.0 specification. Enterprise beans written for the EJB 1.1 specification should throw the javax.ejb.EJBException instead of this exception. Enterprise beans written for the EJB2.0 and higher specifications must throw the javax.ejb.EJBException instead of this exception.
EJBException (src) - - Thrown by the method to indicate a failure caused by a system-level error.

ejbLoad

public void ejbLoad()
             throws EJBException (src) ,
                    java.rmi.RemoteException
Description copied from interface: EntityBean (src)

A container invokes this method to instruct the instance to synchronize its state by loading it state from the underlying database.

This method always executes in the transaction context determined by the value of the transaction attribute in the deployment descriptor.

Specified by:
ejbLoad in interface EntityBean (src)
Throws:
java.rmi.RemoteException - - This exception is defined in the method signature to provide backward compatibility for enterprise beans written for the EJB 1.0 specification. Enterprise beans written for the EJB 1.1 specification should throw the javax.ejb.EJBException instead of this exception. Enterprise beans written for the EJB2.0 and higher specifications must throw the javax.ejb.EJBException instead of this exception.
EJBException (src) - - Thrown by the method to indicate a failure caused by a system-level error.

setEntityContext

public void setEntityContext(EntityContext (src)  ctx)
Description copied from interface: EntityBean (src)

Set the associated entity context. The container invokes this method on an instance after the instance has been created.

This method is called in an unspecified transaction context.

Specified by:
setEntityContext in interface EntityBean (src)
Parameters:
ctx - - An EntityContext interface for the instance. The instance should store the reference to the context in an instance variable.

ejbRemove

public void ejbRemove()
               throws RemoveException (src) ,
                      EJBException (src) ,
                      java.rmi.RemoteException
Description copied from interface: EntityBean (src)

A container invokes this method before it removes the EJB object that is currently associated with the instance. This method is invoked when a client invokes a remove operation on the enterprise Bean's home interface or the EJB object's remote interface. This method transitions the instance from the ready state to the pool of available instances.

This method is called in the transaction context of the remove operation.

Specified by:
ejbRemove in interface EntityBean (src)
Throws:
java.rmi.RemoteException - - This exception is defined in the method signature to provide backward compatibility for enterprise beans written for the EJB 1.0 specification. Enterprise beans written for the EJB 1.1 specification should throw the javax.ejb.EJBException instead of this exception. Enterprise beans written for the EJB2.0 and higher specifications must throw the javax.ejb.EJBException instead of this exception.
EJBException (src) - - Thrown by the method to indicate a failure caused by a system-level error.
RemoveException (src)

unsetEntityContext

public void unsetEntityContext()
Description copied from interface: EntityBean (src)

Unset the associated entity context. The container calls this method before removing the instance.

This is the last method that the container invokes on the instance. The Java garbage collector will eventually invoke the finalize() method on the instance.

This method is called in an unspecified transaction context.

Specified by:
unsetEntityContext in interface EntityBean (src)

getSessionId

public abstract java.lang.String getSessionId()
Description copied from interface: ClusteredHTTPSessionBusiness (src)
Get the session identifier associated to this HTTPSession. This is the primary key of the entity bean.

Specified by:
getSessionId in interface ClusteredHTTPSessionBusiness (src)
Returns:
The session id.

setSessionId

public abstract void setSessionId(java.lang.String sessionId)

getSerializedSession

public abstract java.io.Serializable getSerializedSession()

setSerializedSession

public abstract void setSerializedSession(java.io.Serializable session)

getLastAccessedTime

public abstract long getLastAccessedTime()
Description copied from interface: ClusteredHTTPSessionBusiness (src)
Return the last time this session has been accessed in miliseconds since 1970. This method is a shortcut for getSession().getLastAccessedTime (). The reason is that the bean, when directly asked for the time, don't need to deserialize the session representation if not already done (lazy deserialization). If the only thing that changes in an HTTPSession it the last accessed time (and no attributes), the session may not be replicated on other node (to reduce traffic). Nevertheless, the new session is stored in the local bean. Consequently, if a load-balancer with sticky sessions is used, this is no problem (the local, updated, bean is used.

Specified by:
getLastAccessedTime in interface ClusteredHTTPSessionBusiness (src)

setLastAccessedTime

public abstract void setLastAccessedTime(long value)

getCreationTime

public abstract long getCreationTime()
Description copied from interface: ClusteredHTTPSessionBusiness (src)
Return the time when this session has been created in miliseconds since 1970. This method is a shortcut for getSession().getLastAccessedTime (). The reason is that the bean, when directly asked for the time, don't need to deserialize the session representation if not already done (lazy deserialization)

Specified by:
getCreationTime in interface ClusteredHTTPSessionBusiness (src)

setCreationTime

public abstract void setCreationTime(long value)

getSession

public abstract SerializableHttpSession (src)  getSession()
                                            throws EJBException (src) 
Description copied from interface: ClusteredHTTPSessionBusiness (src)
Return the HttpSession object associated to its id. The main difference with the standard class is that this one is Serializable.

Specified by:
getSession in interface ClusteredHTTPSessionBusiness (src)
Throws:
EJBException (src)

setSession

public abstract void setSession(SerializableHttpSession (src)  session)
Description copied from interface: ClusteredHTTPSessionBusiness (src)
Associate a new session (set of attributes, ...) to this id.

Specified by:
setSession in interface ClusteredHTTPSessionBusiness (src)

getEntityContext

protected EntityContext (src)  getEntityContext()