KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > directwebremoting > extend > ScriptSessionManager


1 /*
2  * Copyright 2005 Joe Walker
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.directwebremoting.extend;
17
18 import java.util.Collection JavaDoc;
19
20 /**
21  * A ScriptSessionManager looks after a number of sessions (keyed using a
22  * Javascript variable)
23  * @author Joe Walker [joe at getahead dot ltd dot uk]
24  */

25 public interface ScriptSessionManager
26 {
27     /**
28      * Get a list of all the currently known ScriptSessions by id.
29      * Note that the list of known sessions is continually changing so it is
30      * possible that the list will be out of date by the time it is used. For
31      * this reason you should check that getScriptSession(String id) returns
32      * something non null.
33      * @return An iterator over the currently known sessions, by id
34      */

35     Collection JavaDoc getAllScriptSessions();
36
37     /**
38      * For a given script session id, either create a new ScriptSession object
39      * or retrieve an existing one if one exists.
40      * @param url The URL including 'http://', up to (but not including) '?' or '#'
41      * @return A ScriptSession.
42      */

43     Collection JavaDoc getScriptSessionsByPage(String JavaDoc url);
44
45     /**
46      * For a given script session id, either create a new ScriptSession object
47      * or retrieve an existing one if one exists.
48      * @param id The id to get a ScriptSession object for
49      * @return A ScriptSession.
50      */

51     RealScriptSession getScriptSession(String JavaDoc id);
52
53     /**
54      * Locate the given script session on a page
55      * @param scriptSession The session to locate on a page
56      * @param url The URL including 'http://', up to (but not including) '?' or '#'
57      */

58     void setPageForScriptSession(RealScriptSession scriptSession, String JavaDoc url);
59
60     /**
61      * Accessor for the time (in milliseconds) when unused ScriptSessions will expire
62      * @return the scriptSessionTimeout
63      */

64     public long getScriptSessionTimeout();
65
66     /**
67      * Accessor for the time (in milliseconds) when unused ScriptSessions will expire
68      * @param scriptSessionTimeout the timeout to set
69      */

70     public void setScriptSessionTimeout(long scriptSessionTimeout);
71
72     /**
73      * The default length of time a session can go unused before it
74      * automatically becomes invalid and is recycled.
75      * The default is 5mins
76      */

77     public static final long DEFAULT_TIMEOUT_MILLIS = 300000;
78 }
79
Popular Tags