gov.nist.nlpir.irf.broker
Class PersistenceBroker

java.lang.Object
  |
  +--gov.nist.nlpir.irf.broker.PersistenceBroker
Direct Known Subclasses:
FileBroker

public abstract class PersistenceBroker
extends java.lang.Object

This is an abstract class which represents what's common to all brokers (object relational, relational, flat file, etc.) for support of persistent objects - their materialization and dematerialization.

Version:
$Revision: 1.1 $
Author:
This software was produced by NIST, an agency of the U.S. government, and by statute is not subject to copyright in the United States. Recipients of this software assume all responsibilities associated with its operation, modification and maintenance.

Constructor Summary
PersistenceBroker()
           
 
Method Summary
 java.lang.String addPath(java.lang.String file)
          Returns the passed file name with the current path (to where persistent objects are kept) prepended.
abstract  Handle dematerialize(Handle oldHandle, java.lang.Object obj)
          Dematerializes the updated object and associate it with the returned handle
abstract  Handle dematerialize(java.lang.Object obj)
          Dematerializes the object and associate it with the returned handle
 java.lang.String getCurrentLocationOfBrokeredStorage()
          Returns the current high-level information about where brokered (persistent) objects are kept.
 Handle handleOf(Handle oldHandle, java.lang.Object obj)
          Saves in persistent storage the updated object passed
 Handle handleOf(java.lang.Object obj)
          Saves in persistent storage the object passed
 java.lang.Object inCache(Handle handle)
          Returns from cache the object associated with the designated handle
abstract  java.lang.Object materializeWith(Handle handle)
          Materializes the object associated with the designated handle
 java.lang.Object objectWith(Handle handle)
          Returns the object associated with the passed handle
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Constructor Detail

PersistenceBroker

public PersistenceBroker()
Method Detail

getCurrentLocationOfBrokeredStorage

public final java.lang.String getCurrentLocationOfBrokeredStorage()
Returns the current high-level information about where brokered (persistent) objects are kept.
Returns:
the location information

addPath

public java.lang.String addPath(java.lang.String file)
Returns the passed file name with the current path (to where persistent objects are kept) prepended.
Parameters:
file - the file name
Returns:
the path + (separator + ) file

objectWith

public java.lang.Object objectWith(Handle handle)
Returns the object associated with the passed handle
Parameters:
handle - The info need to materialize a persistent object
Returns:
The object associated with the handle passed as a parameter

handleOf

public Handle handleOf(java.lang.Object obj)
Saves in persistent storage the object passed
Parameters:
obj - The object to save
Returns:
The handle which allows retrieval of the saved object

handleOf

public Handle handleOf(Handle oldHandle,
                       java.lang.Object obj)
Saves in persistent storage the updated object passed
Parameters:
oldHandle - The handle of the object already saved
obj - The updated object to save
Returns:
The handle which allows retrieval of the saved object

inCache

public java.lang.Object inCache(Handle handle)
Returns from cache the object associated with the designated handle
Parameters:
handle - The info needed to materialize a persistent object
Returns:
The requested object if found in the cache, otherwise return null

materializeWith

public abstract java.lang.Object materializeWith(Handle handle)
Materializes the object associated with the designated handle
Parameters:
handle - The info needed to materialize a persistent object
Returns:
the materialized object

dematerialize

public abstract Handle dematerialize(java.lang.Object obj)
Dematerializes the object and associate it with the returned handle
Parameters:
obj - object to dematerialize.
Returns:
handleThe info needed to materialize a persistent object.

dematerialize

public abstract Handle dematerialize(Handle oldHandle,
                                     java.lang.Object obj)
Dematerializes the updated object and associate it with the returned handle
Parameters:
oldHandle - Handle of the object before update
obj - updated object to dematerialize.
Returns:
handle The info needed to materialize the updated object.