KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > catalina > Store


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

17
18
19 package org.apache.catalina;
20
21
22 import java.beans.PropertyChangeListener JavaDoc;
23 import java.io.IOException JavaDoc;
24
25
26 /**
27  * A <b>Store</b> is the abstraction of a Catalina component that provides
28  * persistent storage and loading of Sessions and their associated user data.
29  * Implementations are free to save and load the Sessions to any media they
30  * wish, but it is assumed that saved Sessions are persistent across
31  * server or context restarts.
32  *
33  * @author Craig R. McClanahan
34  * @version $Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $
35  */

36
37 public interface Store {
38
39
40     // ------------------------------------------------------------- Properties
41

42
43     /**
44      * Return descriptive information about this Store implementation and
45      * the corresponding version number, in the format
46      * <code>&lt;description&gt;/&lt;version&gt;</code>.
47      */

48     public String JavaDoc getInfo();
49
50
51     /**
52      * Return the Manager instance associated with this Store.
53      */

54     public Manager getManager();
55
56
57     /**
58      * Set the Manager associated with this Store.
59      *
60      * @param manager The Manager which will use this Store.
61      */

62     public void setManager(Manager manager);
63
64
65     /**
66      * Return the number of Sessions present in this Store.
67      *
68      * @exception IOException if an input/output error occurs
69      */

70     public int getSize() throws IOException JavaDoc;
71
72
73     // --------------------------------------------------------- Public Methods
74

75
76     /**
77      * Add a property change listener to this component.
78      *
79      * @param listener The listener to add
80      */

81     public void addPropertyChangeListener(PropertyChangeListener JavaDoc listener);
82
83
84     /**
85      * Return an array containing the session identifiers of all Sessions
86      * currently saved in this Store. If there are no such Sessions, a
87      * zero-length array is returned.
88      *
89      * @exception IOException if an input/output error occurred
90      */

91     public String JavaDoc[] keys() throws IOException JavaDoc;
92
93
94     /**
95      * Load and return the Session associated with the specified session
96      * identifier from this Store, without removing it. If there is no
97      * such stored Session, return <code>null</code>.
98      *
99      * @param id Session identifier of the session to load
100      *
101      * @exception ClassNotFoundException if a deserialization error occurs
102      * @exception IOException if an input/output error occurs
103      */

104     public Session load(String JavaDoc id)
105         throws ClassNotFoundException JavaDoc, IOException JavaDoc;
106
107
108     /**
109      * Remove the Session with the specified session identifier from
110      * this Store, if present. If no such Session is present, this method
111      * takes no action.
112      *
113      * @param id Session identifier of the Session to be removed
114      *
115      * @exception IOException if an input/output error occurs
116      */

117     public void remove(String JavaDoc id) throws IOException JavaDoc;
118
119
120     /**
121      * Remove all Sessions from this Store.
122      */

123     public void clear() throws IOException JavaDoc;
124
125
126     /**
127      * Remove a property change listener from this component.
128      *
129      * @param listener The listener to remove
130      */

131     public void removePropertyChangeListener(PropertyChangeListener JavaDoc listener);
132
133
134     /**
135      * Save the specified Session into this Store. Any previously saved
136      * information for the associated session identifier is replaced.
137      *
138      * @param session Session to be saved
139      *
140      * @exception IOException if an input/output error occurs
141      */

142     public void save(Session session) throws IOException JavaDoc;
143
144
145 }
146
Popular Tags