Class StoreBase

  • All Implemented Interfaces:
    Lifecycle, Store
    Direct Known Subclasses:
    FileStore, HAStoreBase, JDBCStore

    public abstract class StoreBase
    extends Object
    implements Lifecycle, Store
    Abstract implementation of the Store interface to support most of the functionality required by a Store.
    Version:
    $Revision: 1.8 $, $Date: 2007/05/05 05:32:19 $
    Author:
    Bip Thelin
    • Field Detail

      • info

        protected String info
        The descriptive information about this implementation.
      • storeName

        protected String storeName
        Name to register for this Store, used for logging.
      • debug

        protected int debug
        The debugging detail level for this component.
      • started

        protected boolean started
        Has this component been started yet?
      • lifecycle

        protected LifecycleSupport lifecycle
        The lifecycle event support for this component.
      • manager

        protected Manager manager
        The Manager with which this JDBCStore is associated.
    • Constructor Detail

      • StoreBase

        public StoreBase()
    • Method Detail

      • getInfo

        public String getInfo()
        Return the info for this Store.
        Specified by:
        getInfo in interface Store
      • getStoreName

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

        public void setDebug​(int debug)
        Set the debugging detail level for this Store.
        Parameters:
        debug - The new debugging detail level
      • getDebug

        public int getDebug()
        Return the debugging detail level for this Store.
      • setManager

        public void setManager​(Manager manager)
        Set the Manager with which this Store is associated.
        Specified by:
        setManager in interface Store
        Parameters:
        manager - The newly associated Manager
      • getManager

        public Manager getManager()
        Return the Manager with which the Store is associated.
        Specified by:
        getManager in interface Store
      • addLifecycleListener

        public void addLifecycleListener​(LifecycleListener listener)
        Add a lifecycle event listener to this component.
        Specified by:
        addLifecycleListener in interface Lifecycle
        Parameters:
        listener - The listener to add
      • removeLifecycleListener

        public void removeLifecycleListener​(LifecycleListener listener)
        Remove a lifecycle event listener from this component.
        Specified by:
        removeLifecycleListener in interface Lifecycle
        Parameters:
        listener - The listener to add
      • addPropertyChangeListener

        public void addPropertyChangeListener​(PropertyChangeListener listener)
        Add a property change listener to this component.
        Specified by:
        addPropertyChangeListener in interface Store
        Parameters:
        listener - a value of type 'PropertyChangeListener'
      • removePropertyChangeListener

        public void removePropertyChangeListener​(PropertyChangeListener listener)
        Remove a property change listener from this component.
        Specified by:
        removePropertyChangeListener in interface Store
        Parameters:
        listener - The listener to remove
      • writeSession

        public void writeSession​(Session sess,
                                 ObjectOutputStream oos)
                          throws IOException
        Serialize a session into an output stream.
        Parameters:
        sess - The session to be serialized
        oos - The output stream the session should be written to Hercules: added method
        Throws:
        IOException
      • doProcessExpires

        public void doProcessExpires()
        public wrapper for processExpires() don't want to make processExpires() public called from manager background thread Hercules: added method
      • removeFromStoreCache

        public void removeFromStoreCache​(String id)
        no-op method - sub classes will implement to remove a session from the store cache Hercules: added method
      • processExpires

        public void processExpires()
        Called by our background reaper thread to check if Sessions saved in our store are subject of being expired. If so expire the Session and remove it from the Store.
      • log

        protected void log​(String message)
        Log a message on the Logger associated with our Container (if any).
        Parameters:
        message - Message to be logged
      • load

        public Session load​(String id,
                            String version)
                     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.
        Parameters:
        id - Session identifier of the session to load
        version - The requested session version
        Throws:
        ClassNotFoundException - if a deserialization error occurs
        IOException - if an input/output error occurs
      • start

        public void start()
                   throws LifecycleException
        Prepare for the beginning of active use of the public methods of this component. This method should be called after configure(), and before any of the public methods of the component are utilized.
        Specified by:
        start in interface Lifecycle
        Throws:
        LifecycleException - if this component detects a fatal error that prevents this component from being used
      • stop

        public void stop()
                  throws LifecycleException
        Gracefully terminate the active use of the public methods of this component. This method should be the last one called on a given instance of this component.
        Specified by:
        stop in interface Lifecycle
        Throws:
        LifecycleException - if this component detects a fatal error that needs to be reported