Class SerializedObjectStore

java.lang.Object
ucar.unidata.util.SerializedObjectStore
All Implemented Interfaces:
PersistentStore

public class SerializedObjectStore extends Object implements PersistentStore
Implements the PersistentStore interface for metApps persistent objects. This class stores serialized objects in a HashMap. All objects passed to it must implement the Serializable interface.

Version:
$Revision: 1.16 $
Author:
caron
  • Field Details

    • debugShowHash

      protected boolean debugShowHash
      _more_
    • showGet

      protected boolean showGet
      _more_
    • showPut

      protected boolean showPut
      _more_
    • debugWhichRead

      protected boolean debugWhichRead
      _more_
    • hash

      protected HashMap hash
      _more_
  • Constructor Details

    • SerializedObjectStore

      protected SerializedObjectStore()
      _more_
    • SerializedObjectStore

      public SerializedObjectStore(String systemName, String appName, String storeName)
      Constructor. You can subclass to implement other strategies. In this default implementation, the following files are looked for (in sequence), and if found, are read into the HashMap. Thus, Objects in the later files override ones in the earlier files. If a file doesnt exist, it is skipped.
          /data/config/<app>/<storeName>.ser               CORE configuration files in jar file
          $METAPPS_HOME/config/<app>/<storeName>.ser       SITE configuration files
          $USER_HOME/<app>/<storeName>.ser       USER configuration files
       where:
           $METAPPS_HOME:  check for system property "metapps.home", if none, use current directory
           $USER_HOME:  check for system property "user.home"; if none, use current directory
      
       Notes:
           Check for system property using System.getProperty("property")
           Set system property on command line: java -Dmetapps.home=$METAPPS_HOME
           An applet can read only from the jar file.
       
      Parameters:
      systemName - system name.
      appName - application name.
      storeName - store name.
  • Method Details

    • get

      public Object get(Object key)
      get the value named by the key
      Specified by:
      get in interface PersistentStore
      Parameters:
      key -
      Returns:
      _more_
    • get

      public boolean get(Object key, boolean dflt)
      Wrapper method that retrieves a boolean value form the store If the value does not exist this returns the dflt parameter
      Parameters:
      key -
      dflt -
      Returns:
      _more_
    • put

      public void put(Object key, Object value)
      _more_
      Specified by:
      put in interface PersistentStore
      Parameters:
      key -
      value -
    • save

      public void save()
      save the objects to disk
      Specified by:
      save in interface PersistentStore
    • readConfigFile

      protected void readConfigFile(boolean isCore, String filename)
      _more_
      Parameters:
      isCore -
      filename -
    • readObjectsFromStream

      protected boolean readObjectsFromStream(ObjectInputStream in)
      _more_
      Parameters:
      in -
      Returns:
      _more_
    • writeObjectsToStream

      protected void writeObjectsToStream(ObjectOutputStream out)
      _more_
      Parameters:
      out -
    • printHashMap

      protected void printHashMap(HashMap hm)
      _more_
      Parameters:
      hm -