01: /*
02: * PJamaSessionManager.java
03: *
04: * Brazil project web application Framework,
05: * export version: 1.1
06: * Copyright (c) 2000 Sun Microsystems, Inc.
07: *
08: * Sun Public License Notice
09: *
10: * The contents of this file are subject to the Sun Public License Version
11: * 1.0 (the "License"). You may not use this file except in compliance with
12: * the License. A copy of the License is included as the file "license.terms",
13: * and also available at http://www.sun.com/
14: *
15: * The Original Code is from:
16: * Brazil project web application Framework release 1.1.
17: * The Initial Developer of the Original Code is: cstevens.
18: * Portions created by cstevens are Copyright (C) Sun Microsystems, Inc.
19: * All Rights Reserved.
20: *
21: * Contributor(s): cstevens, suhler.
22: *
23: * Version: 1.4
24: * Created by cstevens on 00/04/11
25: * Last modified by suhler on 00/05/31 13:51:55
26: */
27:
28: package sunlabs.brazil.session;
29:
30: import java.util.Hashtable;
31: import sunlabs.brazil.util.PJwrapper;
32:
33: /**
34: * Use pJama to implement persistant sessions.
35: * See {@link sunlabs.brazil.util.PJwrapper}.
36: *
37: * @author Stephen Uhler
38: * @version 1.0, 08/20/98
39: */
40:
41: public class PJamaSessionManager extends SessionManager {
42: Hashtable sessions;
43:
44: public PJamaSessionManager() {
45: sessions = (Hashtable) PJwrapper.initStore("BrazilStore",
46: Hashtable.class);
47: if (PJwrapper.isPersistent()) {
48: System.out.println("Using PJama persistent store!");
49: }
50: }
51:
52: /**
53: * Return the object associated with this session. If the session doesn't
54: * already exist, it is created by calling newinstance() with
55: * <code>myClass.</code>
56: *
57: * @param session The object identifying the session
58: * @param ident The session user's identity
59: * @param myClass The class to create a new instance of for a new session
60: */
61: public Object getSessionObject(Object session, Object ident,
62: Class type) {
63: Object obj = super .getSessionObject(session, ident, type);
64:
65: // Stabilize the store every time - for now
66:
67: PJwrapper.stabilize();
68:
69: return obj;
70: }
71: }
|