org.apache.catalina.session

Class FileStore

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: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (Tue, 24 Oct 2006) $

Author: Craig R. McClanahan

Method Summary
voidclear()
Remove all of the Sessions in this Store.
StringgetDirectory()
Return the directory path for this Store.
StringgetInfo()
Return descriptive information about this Store implementation and the corresponding version number, in the format <description>/<version>.
intgetSize()
Return the number of Sessions present in this Store.
StringgetStoreName()
Return the name for this Store, used for logging.
StringgetThreadName()
Return the thread name for this Store.
String[]keys()
Return an array containing the session identifiers of all Sessions currently saved in this Store.
Sessionload(String id)
Load and return the Session associated with the specified session identifier from this Store, without removing it.
voidremove(String id)
Remove the Session with the specified session identifier from this Store, if present.
voidsave(Session session)
Save the specified Session into this Store.
voidsetDirectory(String path)
Set the directory path for this Store.

Method Detail

clear

public void clear()
Remove all of the Sessions in this Store.

Throws: IOException if an input/output error occurs

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>.

getSize

public int getSize()
Return the number of Sessions present in this Store.

Throws: IOException if an input/output error occurs

getStoreName

public String getStoreName()
Return the name for this Store, used for logging.

getThreadName

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

keys

public String[] keys()
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.

Throws: IOException if an input/output error occurred

load

public Session load(String id)
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.

Parameters: id Session identifier of the session to load

Throws: ClassNotFoundException if a deserialization error occurs IOException if an input/output error occurs

remove

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

Parameters: id Session identifier of the Session to be removed

Throws: IOException if an input/output error occurs

save

public void save(Session session)
Save the specified Session into this Store. Any previously saved information for the associated session identifier is replaced.

Parameters: session Session to be saved

Throws: IOException if an input/output error occurs

setDirectory

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

Parameters: path The new directory path

Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.