gov.nist.nlpir.irf.broker
Class FileBroker

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

public abstract class FileBroker
extends PersistenceBroker

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

Version:
$Revision: 1.2 $
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
FileBroker()
           
 
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.
 Handle currentObjectAsRecord(Handle oldHandle, java.lang.Object obj)
          Dematerializes the object.
abstract  Handle currentObjectAsRecord(java.lang.Object obj)
          Dematerializes the object.
abstract  java.lang.Object currentRecordAsObject(java.lang.Object arg)
          Materializes the object associated with the designated Oid.
 Handle dematerialize(Handle oldHandle, java.lang.Object obj)
          Dematerializes the updated object passed Handle any part of the materialization that is common to all objects using this type of broker.
 Handle dematerialize(java.lang.Object obj)
          Dematerializes the object associated with the returned handle.
 java.lang.Object materializeWith(Handle handle)
          Materializes the object associated with the designated Oid.
 
Methods inherited from class gov.nist.nlpir.irf.broker.PersistenceBroker
getCurrentLocationOfBrokeredStorage, handleOf, handleOf, inCache, objectWith
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Constructor Detail

FileBroker

public FileBroker()
Method Detail

addPath

public final java.lang.String addPath(java.lang.String file)
Returns the passed file name with the current path (to where persistent objects are kept) prepended. Handle case where path is null or the null string
Parameters:
file - the file name
Returns:
the path + (separator + ) file
Overrides:
addPath in class PersistenceBroker

materializeWith

public java.lang.Object materializeWith(Handle handle)
Materializes the object associated with the designated Oid. Handle any part of the materialization that is common to all objects using this type of broker.
Parameters:
handle - The identifier unique of the object with the handle
Returns:
Materialize the designated object
Overrides:
materializeWith in class PersistenceBroker

dematerialize

public Handle dematerialize(java.lang.Object obj)
Dematerializes the object associated with the returned handle. Handle any part of the materialization that is common to all objects using this type of broker.
Parameters:
object - to be dematerialized
Returns:
handle with which to recover object
Overrides:
dematerialize in class PersistenceBroker

dematerialize

public Handle dematerialize(Handle oldHandle,
                            java.lang.Object obj)
Dematerializes the updated object passed Handle any part of the materialization that is common to all objects using this type of broker.
Parameters:
oldHandle - handle of the object before update
object - to be dematerialized
Returns:
handle with which to recover the updated object
Overrides:
dematerialize in class PersistenceBroker

currentRecordAsObject

public abstract java.lang.Object currentRecordAsObject(java.lang.Object arg)
Materializes the object associated with the designated Oid. The concrete version will handle any part of the materialization which is specific to the object.
Parameters:
arg - The information needed to get the desired object
Returns:
Materialize the designated object

currentObjectAsRecord

public abstract Handle currentObjectAsRecord(java.lang.Object obj)
Dematerializes the object. The concrete version will handle any part of the materialization which is specific to the object.
Parameters:
obj - The object
Returns:
handle The information needed to recover the object

currentObjectAsRecord

public Handle currentObjectAsRecord(Handle oldHandle,
                                    java.lang.Object obj)
Dematerializes the object. The concrete version will handle any part of the materialization which is specific to the object.
Parameters:
obj - The object
Returns:
handle The information needed to recover the object