01: // ========================================================================
02: // $Id: Store.java,v 1.3 2004/05/09 20:30:47 gregwilkins Exp $
03: // Copyright 2002-2004 Mort Bay Consulting Pty. Ltd.
04: // ------------------------------------------------------------------------
05: // Licensed under the Apache License, Version 2.0 (the "License");
06: // you may not use this file except in compliance with the License.
07: // You may obtain a copy of the License at
08: // http://www.apache.org/licenses/LICENSE-2.0
09: // Unless required by applicable law or agreed to in writing, software
10: // distributed under the License is distributed on an "AS IS" BASIS,
11: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: // See the License for the specific language governing permissions and
13: // limitations under the License.
14: // ========================================================================
15:
16: package org.mortbay.j2ee.session;
17:
18: import javax.servlet.http.HttpServletRequest;
19:
20: //----------------------------------------
21: // a store provides 3 APIs :
22: // It's own start/stop methods. These will e.g. start/stop the session GC thread
23: // State LifeCyle methods - The Store encapsulates the LifeCycle of the State
24: // Session ID management methods - The session ID is a responsibility attribute of the store...
25: // Stores manage State, and will have to notify the Session Manager
26: // when they believe that this has timed-out.
27:
28: public interface Store extends Cloneable {
29: Manager getManager();
30:
31: void setManager(Manager manager);
32:
33: // Store LifeCycle
34: void start() throws Exception;
35:
36: void stop();
37:
38: void destroy(); // corresponds to ctor
39:
40: // Store accessors
41: void setScavengerPeriod(int secs);
42:
43: void setScavengerExtraTime(int secs);
44:
45: void setActualMaxInactiveInterval(int secs);
46:
47: int getActualMaxInactiveInterval();
48:
49: boolean isDistributed();
50:
51: // ID allocation
52: String allocateId(HttpServletRequest request) throws Exception;
53:
54: void deallocateId(String id) throws Exception;
55:
56: // State LifeCycle
57: State newState(String id, int maxInactiveInterval) throws Exception;
58:
59: State loadState(String id) throws Exception;
60:
61: void storeState(State state) throws Exception;
62:
63: void removeState(State state) throws Exception;
64:
65: // Store misc
66: void scavenge() throws Exception;
67:
68: void passivateSession(StateAdaptor sa);
69:
70: public Object clone();
71: }
|