KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > ha > httpsession > beanimpl > ejb > ClusteredHTTPSessionBeanAbstract


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7
8 package org.jboss.ha.httpsession.beanimpl.ejb;
9
10 import javax.ejb.CreateException JavaDoc;
11 import javax.ejb.EJBException JavaDoc;
12 import javax.ejb.RemoveException JavaDoc;
13
14 import java.rmi.RemoteException JavaDoc;
15 import java.io.Serializable JavaDoc;
16
17 import org.jboss.ha.httpsession.beanimpl.interfaces.ClusteredHTTPSessionBusiness;
18 import org.jboss.ha.httpsession.interfaces.SerializableHttpSession;
19
20 /**
21  * Abstract default implementation of the Clustered HTTP session for servlets.
22  *
23  * @see org.jboss.ha.httpsession.beanimpl.interfaces.ClusteredHTTPSession
24  * @see org.jboss.ha.httpsession.beanimpl.interfaces.ClusteredHTTPSessionBusiness
25  * @see org.jboss.ha.httpsession.beanimpl.interfaces.ClusteredHTTPSessionHome
26  *
27  * @author <a HREF="mailto:sacha.labourey@cogito-info.ch">Sacha Labourey</a>.
28  * @version $Revision: 1.3 $
29  *
30  * <p><b>Revisions:</b>
31  *
32  * <p><b>31. decembre 2001 Sacha Labourey:</b>
33  * <ul>
34  * <li> First implementation </li>
35  * </ul>
36  */

37
38 public abstract class ClusteredHTTPSessionBeanAbstract implements javax.ejb.EntityBean JavaDoc, ClusteredHTTPSessionBusiness
39 {
40
41    // Constants -----------------------------------------------------
42

43    // Attributes ----------------------------------------------------
44

45    protected javax.ejb.EntityContext JavaDoc ejbContext;
46
47    // Static --------------------------------------------------------
48

49    // Constructors --------------------------------------------------
50

51    // Public --------------------------------------------------------
52

53    public String JavaDoc ejbCreate (String JavaDoc sessionId) throws CreateException JavaDoc
54    {
55       this.setSessionId (sessionId);
56       return null;
57    }
58    public void ejbPostCreate (String JavaDoc sessionId) throws CreateException JavaDoc
59    {}
60
61    public String JavaDoc ejbCreate (String JavaDoc sessionId, SerializableHttpSession session) throws CreateException JavaDoc
62    {
63       this.setSessionId (sessionId);
64       this.setSession (session);
65       return null;
66    }
67    public void ejbPostCreate (String JavaDoc sessionId, SerializableHttpSession session) throws CreateException JavaDoc
68    {}
69
70    // Optimisation: called by the CMP engine
71
//
72
public abstract boolean isModified ();
73
74    // EntityBean implementation ----------------------------------------------
75

76    public void ejbStore () throws EJBException JavaDoc, RemoteException JavaDoc
77    {}
78    public void ejbActivate () throws EJBException JavaDoc, RemoteException JavaDoc
79    {}
80    public void ejbPassivate () throws EJBException JavaDoc, RemoteException JavaDoc
81    {}
82    public void ejbLoad () throws EJBException JavaDoc, RemoteException JavaDoc
83    {}
84    public void setEntityContext (javax.ejb.EntityContext JavaDoc ctx)
85    {
86       ejbContext = ctx;
87    }
88    public void ejbRemove () throws RemoveException JavaDoc, EJBException JavaDoc, RemoteException JavaDoc
89    {}
90    public void unsetEntityContext ()
91    {
92       ejbContext = null;
93    }
94
95    // ClusteredHTTPSessionBusiness implementation ----------------------------------------------
96

97    public abstract String JavaDoc getSessionId ();
98    public abstract void setSessionId (String JavaDoc sessionId);
99
100    public abstract Serializable JavaDoc getSerializedSession ();
101    public abstract void setSerializedSession (Serializable JavaDoc session);
102
103    public abstract long getLastAccessedTime ();
104    public abstract void setLastAccessedTime (long value);
105    public abstract long getCreationTime ();
106    public abstract void setCreationTime (long value);
107
108    // This field is not directly stored by the CMP engine
109
//
110
public abstract SerializableHttpSession getSession () throws EJBException JavaDoc;
111    public abstract void setSession (SerializableHttpSession session);
112
113    // Y overrides ---------------------------------------------------
114

115    // Package protected ---------------------------------------------
116

117    // Protected -----------------------------------------------------
118

119    protected javax.ejb.EntityContext JavaDoc getEntityContext ()
120    {
121       return ejbContext;
122    }
123
124    // Private -------------------------------------------------------
125

126    // Inner classes -------------------------------------------------
127

128 }
129
Popular Tags