001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: package org.apache.catalina;
019:
020: import java.beans.PropertyChangeListener;
021: import java.io.IOException;
022:
023: /**
024: * A <b>Store</b> is the abstraction of a Catalina component that provides
025: * persistent storage and loading of Sessions and their associated user data.
026: * Implementations are free to save and load the Sessions to any media they
027: * wish, but it is assumed that saved Sessions are persistent across
028: * server or context restarts.
029: *
030: * @author Craig R. McClanahan
031: * @version $Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $
032: */
033:
034: public interface Store {
035:
036: // ------------------------------------------------------------- Properties
037:
038: /**
039: * Return descriptive information about this Store implementation and
040: * the corresponding version number, in the format
041: * <code><description>/<version></code>.
042: */
043: public String getInfo();
044:
045: /**
046: * Return the Manager instance associated with this Store.
047: */
048: public Manager getManager();
049:
050: /**
051: * Set the Manager associated with this Store.
052: *
053: * @param manager The Manager which will use this Store.
054: */
055: public void setManager(Manager manager);
056:
057: /**
058: * Return the number of Sessions present in this Store.
059: *
060: * @exception IOException if an input/output error occurs
061: */
062: public int getSize() throws IOException;
063:
064: // --------------------------------------------------------- Public Methods
065:
066: /**
067: * Add a property change listener to this component.
068: *
069: * @param listener The listener to add
070: */
071: public void addPropertyChangeListener(
072: PropertyChangeListener listener);
073:
074: /**
075: * Return an array containing the session identifiers of all Sessions
076: * currently saved in this Store. If there are no such Sessions, a
077: * zero-length array is returned.
078: *
079: * @exception IOException if an input/output error occurred
080: */
081: public String[] keys() throws IOException;
082:
083: /**
084: * Load and return the Session associated with the specified session
085: * identifier from this Store, without removing it. If there is no
086: * such stored Session, return <code>null</code>.
087: *
088: * @param id Session identifier of the session to load
089: *
090: * @exception ClassNotFoundException if a deserialization error occurs
091: * @exception IOException if an input/output error occurs
092: */
093: public Session load(String id) throws ClassNotFoundException,
094: IOException;
095:
096: /**
097: * Remove the Session with the specified session identifier from
098: * this Store, if present. If no such Session is present, this method
099: * takes no action.
100: *
101: * @param id Session identifier of the Session to be removed
102: *
103: * @exception IOException if an input/output error occurs
104: */
105: public void remove(String id) throws IOException;
106:
107: /**
108: * Remove all Sessions from this Store.
109: */
110: public void clear() throws IOException;
111:
112: /**
113: * Remove a property change listener from this component.
114: *
115: * @param listener The listener to remove
116: */
117: public void removePropertyChangeListener(
118: PropertyChangeListener listener);
119:
120: /**
121: * Save the specified Session into this Store. Any previously saved
122: * information for the associated session identifier is replaced.
123: *
124: * @param session Session to be saved
125: *
126: * @exception IOException if an input/output error occurs
127: */
128: public void save(Session session) throws IOException;
129:
130: }
|