KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mortbay > j2ee > session > Store


1 // ========================================================================
2
// $Id: Store.java,v 1.3 2004/05/09 20:30:47 gregwilkins Exp $
3
// Copyright 2002-2004 Mort Bay Consulting Pty. Ltd.
4
// ------------------------------------------------------------------------
5
// Licensed under the Apache License, Version 2.0 (the "License");
6
// you may not use this file except in compliance with the License.
7
// You may obtain a copy of the License at
8
// http://www.apache.org/licenses/LICENSE-2.0
9
// 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 JavaDoc;
19
20 //----------------------------------------
21

22 // a store provides 3 APIs :
23

24 // It's own start/stop methods. These will e.g. start/stop the session GC thread
25

26 // State LifeCyle methods - The Store encapsulates the LifeCycle of the State
27

28 // Session ID management methods - The session ID is a responsibility attribute of the store...
29

30 // Stores manage State, and will have to notify the Session Manager
31
// when they believe that this has timed-out.
32

33 public interface
34   Store
35   extends Cloneable JavaDoc
36 {
37   Manager getManager();
38   void setManager(Manager manager);
39
40   // Store LifeCycle
41
void start() throws Exception JavaDoc;
42   void stop();
43   void destroy(); // corresponds to ctor
44

45   // Store accessors
46
void setScavengerPeriod(int secs);
47   void setScavengerExtraTime(int secs);
48   void setActualMaxInactiveInterval(int secs);
49   int getActualMaxInactiveInterval();
50   boolean isDistributed();
51
52   // ID allocation
53
String JavaDoc allocateId(HttpServletRequest JavaDoc request) throws Exception JavaDoc;
54   void deallocateId(String JavaDoc id) throws Exception JavaDoc;
55
56   // State LifeCycle
57
State newState(String JavaDoc id, int maxInactiveInterval) throws Exception JavaDoc;
58   State loadState(String JavaDoc id) throws Exception JavaDoc;
59   void storeState(State state) throws Exception JavaDoc;
60   void removeState(State state) throws Exception JavaDoc;
61
62   // Store misc
63
void scavenge() throws Exception JavaDoc;
64   void passivateSession(StateAdaptor sa);
65
66   public Object JavaDoc clone();
67 }
68
69
Popular Tags