Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| dbXML API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.dbxml.db.common.filers
Class MemFiler

    java.lang.Object
      com.dbxml.util.SimpleConfigurable
          com.dbxml.db.common.filers.MemFiler

All Implemented Interfaces:
  Configurable, Filer

public final class MemFiler
extends 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 records)`
`MemFiler(java.util.Map records, boolean readOnly)`

Method Summary
`boolean` | `close()` close closes the Filer
`boolean` | `create()` create creates a new Filer and any associated resources for the new Filer, such as disk files, etc.
`boolean` | `deleteRecord(Transaction tx, Key key)` deleteRecord removes a Record from the Filer based on the specified Key.
`boolean` | `drop()` drop instructs the Filerimplementation to remove itself from existence.
`boolean` | `exists()` exists returns whether or not a physical representation of this Filer actually exists.
`void` | `flush(Transaction tx)` flush forcefully flushes any unwritten buffers to disk.
`java.lang.String` | `getName()` getName returns the name of this Filer.
`long` | `getRecordCount(Transaction tx)` getRecordCount returns the number of Records in the Filer.
`RecordMetaData` | `getRecordMetaData(Transaction tx, Key key)` getRecordMetaData returns metadata about the Record identified by the provided Key.
`RecordSet` | `getRecordSet(Transaction tx)` getRecordSet returns a RecordSet object for the current Filer.
`TransactionLog` | `getTransactionLog()` getTransactionLog returns the Transaction Log for this Filer.
`boolean` | `isOpened()` isOpened returns whether or not the Filer is opened for business.
`boolean` | `open()` open opens the Filer
`Record` | `readRecord(Transaction tx, 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(Transaction tx, Key key, Value value)` writeRecord writes a Value to the Filer based on the specified Key.

Methods inherited from class com.dbxml.util.SimpleConfigurable
`getConfig, setConfig`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface com.dbxml.util.Configurable
`getConfig, setConfig`

Constructor Detail

### MemFiler

    public MemFiler()

### MemFiler

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

### MemFiler

    public MemFiler(java.util.Map records)

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`
  Parameters:
    `collection` - The owner Collection

### getName

    public java.lang.String getName()

  Description copied from interface: `Filer`
  getName returns the name of this Filer.

  Specified by:
    `getName` in interface `Filer`
  Returns:
    the Filer name

### create

    public boolean create()

  Description copied from interface: `Filer`
  create creates a new Filer and any associated resources for the new Filer, such as disk files, etc.

  Specified by:
    `create` in interface `Filer`
  Returns:
    Whether or not the Filer was created

### open

    public boolean open()

  Description copied from interface: `Filer`
  open opens the Filer

  Specified by:
    `open` in interface `Filer`
  Returns:
    Whether or not the Filer was opened

### isOpened

    public boolean isOpened()

  Description copied from interface: `Filer`
  isOpened returns whether or not the Filer is opened for business.

  Specified by:
    `isOpened` in interface `Filer`
  Returns:
    The open status of the Filer

### exists

    public boolean exists()

  Description copied from interface: `Filer`
  exists returns whether or not a physical representation of this Filer actually exists. In the case of a BTreeFiler, this would check for the file, and in the case of an FTPFiler, it might perform a connection check.

  Specified by:
    `exists` in interface `Filer`
  Returns:
    Whether or not the physical resource exists

### drop

    public boolean drop()

  Description copied from interface: `Filer`
  drop instructs the Filerimplementation to remove itself from existence. The Filer's parent is responsible for removing any references to the Filer in its own context.

  Specified by:
    `drop` in interface `Filer`
  Returns:
    Whether or not the Filer was dropped

### close

    public boolean close()

  Description copied from interface: `Filer`
  close closes the Filer

  Specified by:
    `close` in interface `Filer`
  Returns:
    Whether or not the Filer was closed

### flush

    public void flush(Transaction tx)

  Description copied from interface: `Filer`
  flush forcefully flushes any unwritten buffers to disk.

  Specified by:
    `flush` in interface `Filer`
  Parameters:
    `tx` - The controlling Transaction

### getRecordMetaData

    public RecordMetaData getRecordMetaData(Transaction tx,
                                            Key key)
                                     throws DBException

  Description copied from interface: `Filer`
  getRecordMetaData returns metadata about the Record identified by the provided Key. This method should make every attempt to not read the actual record from its original location.

  Specified by:
    `getRecordMetaData` in interface `Filer`
  Parameters:
    `tx` - The controlling Transaction
    `key` - The Record's Key
  Returns:
    The Record's metadata
  Throws:
    `DBException`

### readRecord

    public Record readRecord(Transaction tx,
                             Key key)
                      throws DBException

  Description copied from interface: `Filer`
  readRecord returns a Record from the Filer based on the specified Key.

  Specified by:
    `readRecord` in interface `Filer`
  Parameters:
    `tx` - The controlling Transaction
    `key` - The Record's Key
  Returns:
    The returned Record
  Throws:
    `DBException`

### writeRecord

    public boolean writeRecord(Transaction tx,
                               Key key,
                               Value value)
                        throws DBException

  Description copied from interface: `Filer`
  writeRecord writes a Value to the Filer based on the specified Key.

  Specified by:
    `writeRecord` in interface `Filer`
  Parameters:
    `tx` - The controlling Transaction
    `key` - The Record's Key
    `value` - The Record's Value
  Returns:
    Whether or not the Record could be written
  Throws:
    `DBException`

### deleteRecord

    public boolean deleteRecord(Transaction tx,
                                Key key)
                         throws DBException

  Description copied from interface: `Filer`
  deleteRecord removes a Record from the Filer based on the specified Key.

  Specified by:
    `deleteRecord` in interface `Filer`
  Parameters:
    `tx` - The controlling Transaction
    `key` - The Record's Key
  Returns:
    Whether or not the Record was deleted
  Throws:
    `DBException`

### getRecordCount

    public long getRecordCount(Transaction tx)
                        throws DBException

  Description copied from interface: `Filer`
  getRecordCount returns the number of Records in the Filer.

  Specified by:
    `getRecordCount` in interface `Filer`
  Parameters:
    `tx` - The controlling Transaction
  Returns:
    The Record count
  Throws:
    `DBException`

### getRecordSet

    public RecordSet getRecordSet(Transaction tx)
                           throws DBException

  Description copied from interface: `Filer`
  getRecordSet returns a RecordSet object for the current Filer.

  Specified by:
    `getRecordSet` in interface `Filer`
  Parameters:
    `tx` - The controlling Transaction
  Returns:
    The Filer Enumerator
  Throws:
    `DBException`

### getTransactionLog

    public TransactionLog getTransactionLog()

  Description copied from interface: `Filer`
  getTransactionLog returns the Transaction Log for this Filer. This result may be null if the Filer doesn't support transactional operations.

  Specified by:
    `getTransactionLog` in interface `Filer`
  Returns:
    The Filer's TransactionLog

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| dbXML API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2004 The dbXML Group