## org.apache.catalina.session
Class FileStore

    java.lang.Object
      org.apache.catalina.session.StoreBase
          org.apache.catalina.session.FileStore

All Implemented Interfaces:
  Lifecycle, java.lang.Runnable, 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: 466595 $ $Date: 2006-10-21 23:24:41 +0100 (Sat, 21 Oct 2006) $
Author:
  Craig R. McClanahan

Field Summary

Fields inherited from class org.apache.catalina.session.StoreBase
`checkInterval, debug, lifecycle, manager, sm, started, support, thread, threadDone`

Fields inherited from interface org.apache.catalina.Lifecycle
`AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, START_EVENT, STOP_EVENT`

Constructor Summary
`FileStore()`

Method Summary
`void` `clear()` Remove all of the Sessions in this Store.
`java.lang.String` `getDirectory()` Return the directory path for this Store.
`java.lang.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.
`java.lang.String` `getStoreName()` Return the name for this Store, used for logging.
`java.lang.String` `getThreadName()` Return the thread name for this Store.
`java.lang.String[]` `keys()` Return an array containing the session identifiers of all Sessions currently saved in this Store.
`Session` `load(java.lang.String id)` Load and return the Session associated with the specified session identifier from this Store, without removing it.
`void` `remove(java.lang.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(java.lang.String path)` Set the directory path for this Store.

Methods inherited from class org.apache.catalina.session.StoreBase
`addLifecycleListener, addPropertyChangeListener, findLifecycleListeners, getCheckInterval, getDebug, getManager, log, processExpires, removeLifecycleListener, removePropertyChangeListener, run, setCheckInterval, setDebug, setManager, start, stop, threadSleep, threadStart, threadStop`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.apache.catalina.Store
`addPropertyChangeListener, getManager, removePropertyChangeListener, setManager`

Constructor Detail

### FileStore

    public FileStore()

Method Detail

### getDirectory

    public java.lang.String getDirectory()

  Return the directory path for this Store.

### setDirectory

    public void setDirectory(java.lang.String path)

  Set the directory path for this Store.

  Parameters:
    `path` - The new directory path

### getInfo

    public java.lang.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 class `StoreBase`

### getThreadName

    public java.lang.String getThreadName()

  Return the thread name for this Store.

  Overrides:
    `getThreadName` in class `StoreBase`

### getStoreName

    public java.lang.String getStoreName()

  Return the name for this Store, used for logging.

  Overrides:
    `getStoreName` in class `StoreBase`

### getSize

    public int getSize()
                throws java.io.IOException

  Return the number of Sessions present in this Store.

  Specified by:
    `getSize` in interface `Store`
  Throws:
    `java.io.IOException` - if an input/output error occurs

### clear

    public void clear()
               throws java.io.IOException

  Remove all of the Sessions in this Store.

  Specified by:
    `clear` in interface `Store`
  Throws:
    `java.io.IOException` - if an input/output error occurs

### keys

    public java.lang.String[] keys()
                            throws java.io.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`
  Throws:
    `java.io.IOException` - if an input/output error occurred

### load

    public Session load(java.lang.String id)
                 throws java.lang.ClassNotFoundException,
                        java.io.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
  Throws:
    `java.lang.ClassNotFoundException` - if a deserialization error occurs
    `java.io.IOException` - if an input/output error occurs

### remove

    public void remove(java.lang.String id)
                throws java.io.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
  Throws:
    `java.io.IOException` - if an input/output error occurs

### save

    public void save(Session session)
              throws java.io.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
  Throws:
    `java.io.IOException` - if an input/output error occurs

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