Store (Apache Tomcat 9.0.71 API Documentation)

Package org.apache.catalina

## Interface Store

- All Known Implementing Classes:
    `DataSourceStore`, `FileStore`, `JDBCStore`, `StoreBase`

      public interface Store

  A Store is the abstraction of a Catalina component that provides persistent storage and loading of Sessions and their associated user data. Implementations are free to save and load the Sessions to any media they wish, but it is assumed that saved Sessions are persistent across server or context restarts.
  Author:
    Craig R. McClanahan

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addPropertyChangeListener​(java.beans.PropertyChangeListener listener)` | Add a property change listener to this component.
    `void` | `clear()` | Remove all Sessions from this Store.
    `Manager` | `getManager()` |
    `int` | `getSize()` |
    `java.lang.String[]` | `keys()` |
    `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` | `removePropertyChangeListener​(java.beans.PropertyChangeListener listener)` | Remove a property change listener from this component.
    `void` | `save​(Session session)` | Save the specified Session into this Store.
    `void` | `setManager​(Manager manager)` | Set the Manager associated with this Store.

- - ### Method Detail

    - #### getManager

          Manager getManager()

      Returns:
        the Manager instance associated with this Store.

    - #### setManager

          void setManager​(Manager manager)

      Set the Manager associated with this Store.
      Parameters:
        `manager` - The Manager which will use this Store.

    - #### getSize

          int getSize()
               throws java.io.IOException

      Returns:
        the number of Sessions present in this Store.
      Throws:
        `java.io.IOException` - if an input/output error occurs

    - #### addPropertyChangeListener

          void addPropertyChangeListener​(java.beans.PropertyChangeListener listener)

      Add a property change listener to this component.
      Parameters:
        `listener` - The listener to add

    - #### keys

          java.lang.String[] keys()
                           throws java.io.IOException

      Returns:
        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:
        `java.io.IOException` - if an input/output error occurred

    - #### load

          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`.
      Parameters:
        `id` - Session identifier of the session to load
      Returns:
        the loaded Session instance
      Throws:
        `java.lang.ClassNotFoundException` - if a deserialization error occurs
        `java.io.IOException` - if an input/output error occurs

    - #### remove

          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.
      Parameters:
        `id` - Session identifier of the Session to be removed
      Throws:
        `java.io.IOException` - if an input/output error occurs

    - #### clear

          void clear()
              throws java.io.IOException

      Remove all Sessions from this Store.
      Throws:
        `java.io.IOException` - if an input/output error occurs

    - #### removePropertyChangeListener

          void removePropertyChangeListener​(java.beans.PropertyChangeListener listener)

      Remove a property change listener from this component.
      Parameters:
        `listener` - The listener to remove

    - #### save

          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.
      Parameters:
        `session` - Session to be saved
      Throws:
        `java.io.IOException` - if an input/output error occurs