gov.nist.nlpir.irf.proxy
Class AnySizeHandlesByOid
java.lang.Object
|
+--gov.nist.nlpir.irf.proxy.HandlesByOid
|
+--gov.nist.nlpir.irf.proxy.AnySizeHandlesByOid
- public class AnySizeHandlesByOid
- extends HandlesByOid
The HandlesByOid table is responsible for keeping track of the
handle of each persistent object by its object identifier (Oid).
Oids are assigned by IRF and handles may vary according to the
persistence mechanism used.
- Version:
- $Revision: 1.3 $
- 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.
- See Also:
Oid
,
Handle
, Serialized Form
Fields inherited from class gov.nist.nlpir.irf.proxy.HandlesByOid |
fileSeparator,
handlesByOidAdds,
handlesByOidCache,
handlesByOidDataFile,
handlesByOidDataFileLocation,
handlesByOidGets,
handlesByOidGetsFromCache,
handlesByOidRemoves,
handlesByOidUpdates,
maxHandlesByOidCacheEntries,
serialVersionUID |
Methods inherited from class java.lang.Object |
,
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
registerNatives,
toString,
wait,
wait,
wait |
handlesByOidIndexFile
private static BufferedRandomAccessFile handlesByOidIndexFile
- The file used to keep track of handles by Oid.
handlesByOidIndexFileLocation
private static java.lang.String handlesByOidIndexFileLocation
- Used to find the file associating Handles to Oids.
handlesByOidIndexEntrySize
private static int handlesByOidIndexEntrySize
- In the Index file, every entry is only the offset of the handle in
the data file, so it's only a long that has to be stored.
AnySizeHandlesByOid
public AnySizeHandlesByOid()
openHandlesByOid
public void openHandlesByOid(java.lang.String directory)
- Opens the handles-by-oid files
- Parameters:
directory
- directory in which to open the files- Overrides:
- openHandlesByOid in class HandlesByOid
setHandlesByOidIndexFileLocation
public final void setHandlesByOidIndexFileLocation(java.lang.String location)
- Sets the location of the handlesByOidIndexFile
- Parameters:
location
- location of the handlesByOidIndexFile
writeHandleForOid
protected void writeHandleForOid(Oid oid,
Handle handle)
- Writes the given Handle in the data file, and keeps track of its
starting offset in the index file. This method will always write
a Handle at the end of the data file. It will never attempt to
write it in place if a former Handle had already been written for
OID. Thus, this class will work even with handles changing size for
a given OID, and there are two ways to optimize it:
- Trying to rewrite a Handle in place. This can be done by
remembering the size of the former Hande somewhere.
- If one can assume that the Handle associated to a given OID
will never change in size, then Handles can always ne written in
place.
- Overrides:
- writeHandleForOid in class HandlesByOid
readHandleForOid
protected Handle readHandleForOid(Oid oid)
- Reads a Handle back in memory from disk. From the OID, it computes
the offset in the index file where the offset of the handle in the
data file is written. It then accesses the index file, retrieves
the offset of the handle, and read it from the datafile.
- Overrides:
- readHandleForOid in class HandlesByOid
getHandlesByOidSize
public long getHandlesByOidSize()
- Gets the size of the table
- Returns:
- the number of keys (Oids) in the table
- Overrides:
- getHandlesByOidSize in class HandlesByOid
shutdown
public void shutdown()
- Makes sure modifications to cache entries are reflected in their
persistent analogues.
- Overrides:
- shutdown in class HandlesByOid