org.apache.catalina.session

Class FileStore

Implemented Interfaces:
Lifecycle, Store

public final class FileStore
extends StoreBase
implements Store

Concrete implementation of the Store interface that utilizes a file per saved Session in a configured directory. Sessions that are saved are still subject to being expired based on inactivity.

Version:
$Revision: 1.4.2.1 $ $Date: 2004/11/17 14:54:04 $

Author:
Craig R. McClanahan

Field Summary

Fields inherited from class org.apache.catalina.session.StoreBase

debug, info, lifecycle, manager, sm, started, storeName, support

Fields inherited from interface org.apache.catalina.Lifecycle

AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, START_EVENT, STOP_EVENT

Method Summary

void
clear()
Remove all of the Sessions in this Store.
String
getDirectory()
Return the directory path for this Store.
String
getInfo()
Return descriptive information about this Store implementation and the corresponding version number, in the format <description>/<version>.
int
getSize()
Return the number of Sessions present in this Store.
String
getStoreName()
Return the name for this Store, used for logging.
String
getThreadName()
Return the thread name for this Store.
String[]
keys()
Return an array containing the session identifiers of all Sessions currently saved in this Store.
Session
load(String id)
Load and return the Session associated with the specified session identifier from this Store, without removing it.
void
remove(String id)
Remove the Session with the specified session identifier from this Store, if present.
void
save(Session session)
Save the specified Session into this Store.
void
setDirectory(String path)
Set the directory path for this Store.

Methods inherited from class org.apache.catalina.session.StoreBase

addLifecycleListener, addPropertyChangeListener, findLifecycleListeners, getDebug, getInfo, getManager, getStoreName, log, processExpires, removeLifecycleListener, removePropertyChangeListener, setDebug, setManager, start, stop

Method Details

clear

public void clear()
            throws IOException
Remove all of the Sessions in this Store.
Specified by:
clear in interface Store


getDirectory

public String getDirectory()
Return the directory path for this Store.


getInfo

public String getInfo()
Return descriptive information about this Store implementation and the corresponding version number, in the format <description>/<version>.
Specified by:
getInfo in interface Store
Overrides:
getInfo in interface StoreBase


getSize

public int getSize()
            throws IOException
Return the number of Sessions present in this Store.
Specified by:
getSize in interface Store


getStoreName

public String getStoreName()
Return the name for this Store, used for logging.
Overrides:
getStoreName in interface StoreBase


getThreadName

public String getThreadName()
Return the thread name for this Store.


keys

public String[] keys()
            throws IOException
Return an array containing the session identifiers of all Sessions currently saved in this Store. If there are no such Sessions, a zero-length array is returned.
Specified by:
keys in interface Store


load

public Session load(String id)
            throws ClassNotFoundException,
                   IOException
Load and return the Session associated with the specified session identifier from this Store, without removing it. If there is no such stored Session, return null.
Specified by:
load in interface Store

Parameters:
id - Session identifier of the session to load


remove

public void remove(String id)
            throws IOException
Remove the Session with the specified session identifier from this Store, if present. If no such Session is present, this method takes no action.
Specified by:
remove in interface Store

Parameters:
id - Session identifier of the Session to be removed


save

public void save(Session session)
            throws IOException
Save the specified Session into this Store. Any previously saved information for the associated session identifier is replaced.
Specified by:
save in interface Store

Parameters:
session - Session to be saved


setDirectory

public void setDirectory(String path)
Set the directory path for this Store.

Parameters:
path - The new directory path


Copyright B) 2000-2003 Apache Software Foundation. All Rights Reserved.