dbXML API

org.dbxml.core.filer
Class MemFiler

java.lang.Object
  |
  +--org.dbxml.server.SimpleConfigurable
        |
        +--org.dbxml.core.filer.MemFiler
All Implemented Interfaces:
org.dbxml.server.Configurable, DBObject, Filer, org.dbxml.server.Named

public final class MemFiler
extends org.dbxml.server.SimpleConfigurable
implements Filer

MemFiler is an In-Memory Filer implementation for dbXML. MemFiler can be used for temporary collections and caching. It's basically a layering on top of HashMap.


Constructor Summary
MemFiler()
           
MemFiler(java.util.Map hashTable)
           
MemFiler(java.util.Map hashTable, boolean readOnly)
           
 
Method Summary
 boolean close()
          close closes the DBObject
 boolean create()
          create creates a new DBObject and any associated resources for the new DBObject, such as disk files, etc.
 boolean deleteRecord(Key key)
          deleteRecord removes a Record from the Filer based on the specified Key.
 boolean drop()
          drop instructs the DBObjectimplementation to remove itself from existence.
 boolean exists()
          exists returns whether or not a physical representation of this DBObject actually exists.
 java.lang.String getName()
           
 long getRecordCount()
          getRecordCount returns the number of Records in the Filer.
 RecordSet getRecordSet()
          getRecordSet returns a RecordSet object for the current Filer.
 boolean isOpened()
          isOpened returns whether or not the DBObject is opened for business.
 boolean open()
          open opens the DBObject
 Record readRecord(Key key)
          readRecord returns a Record from the Filer based on the specified Key.
 void setCollection(Collection collection)
          setCollection tells the Filer who its parent is.
 boolean writeRecord(Key key, Value value)
          writeRecord writes a Value to the Filer based on the specified Key.
 
Methods inherited from class org.dbxml.server.SimpleConfigurable
getConfig, setConfig
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.dbxml.server.Configurable
getConfig, setConfig
 

Constructor Detail

MemFiler

public MemFiler()

MemFiler

public MemFiler(java.util.Map hashTable,
                boolean readOnly)

MemFiler

public MemFiler(java.util.Map hashTable)
Method Detail

setCollection

public void setCollection(Collection collection)
Description copied from interface: Filer
setCollection tells the Filer who its parent is.
Specified by:
setCollection in interface Filer
Following copied from interface: org.dbxml.core.filer.Filer
Parameters:
collection - The owner Collection

getName

public java.lang.String getName()
Specified by:
getName in interface org.dbxml.server.Named

create

public boolean create()
create creates a new DBObject and any associated resources for the new DBObject, such as disk files, etc.
Specified by:
create in interface DBObject
Returns:
Whether or not the DBObject was created

open

public boolean open()
open opens the DBObject
Specified by:
open in interface DBObject
Returns:
Whether or not the DBObject was opened

isOpened

public boolean isOpened()
isOpened returns whether or not the DBObject is opened for business.
Specified by:
isOpened in interface DBObject
Returns:
The open status of the DBObject

exists

public boolean exists()
Description copied from interface: DBObject
exists returns whether or not a physical representation of this DBObject actually exists. In the case of a HashFiler, this would check for the file, and in the case of an FTPFiler, it might perform a connection check.
Specified by:
exists in interface DBObject
Following copied from interface: org.dbxml.core.DBObject
Returns:
Whether or not the physical resource exists

drop

public boolean drop()
drop instructs the DBObjectimplementation to remove itself from existence. The DBObject's parent is responsible for removing any references to the DBObject in its own context.
Specified by:
drop in interface DBObject
Returns:
Whether or not the DBObject was dropped

close

public boolean close()
close closes the DBObject
Specified by:
close in interface DBObject
Returns:
Whether or not the DBObject was closed

readRecord

public Record readRecord(Key key)
                  throws DBException
readRecord returns a Record from the Filer based on the specified Key.
Specified by:
readRecord in interface Filer
Parameters:
key - The Record's Key
Returns:
The returned Record

writeRecord

public boolean writeRecord(Key key,
                           Value value)
                    throws DBException
writeRecord writes a Value to the Filer based on the specified Key.
Specified by:
writeRecord in interface Filer
Parameters:
key - The Record's Key
value - The Record's Value
Returns:
Whether or not the Record could be written

deleteRecord

public boolean deleteRecord(Key key)
                     throws DBException
deleteRecord removes a Record from the Filer based on the specified Key.
Specified by:
deleteRecord in interface Filer
Parameters:
key - The Record's Key
Returns:
Whether or not the Record was deleted

getRecordCount

public long getRecordCount()
                    throws DBException
getRecordCount returns the number of Records in the Filer.
Specified by:
getRecordCount in interface Filer
Returns:
The Record count

getRecordSet

public RecordSet getRecordSet()
                       throws DBException
getRecordSet returns a RecordSet object for the current Filer.
Specified by:
getRecordSet in interface Filer
Returns:
The Filer Enumerator

dbXML API

Copyright (c) 1999-2001 The dbXML Group, All rights reserved