PersistentDB
Keywords: uk.ac.ic.doc.automed.util.persist.PersistentDB class

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

## uk.ac.ic.doc.automed.util.persist
Class PersistentDB

    java.lang.Object
      uk.ac.ic.doc.automed.util.persist.PersistentDB

All Implemented Interfaces:
  DuplicatePersistentHandler, PersistentHandler

    public class PersistentDB

extends java.lang.Object
implements DuplicatePersistentHandler

PersistentDB.java
Provide standard method calls for maintaining the SleepCat database

Author:
  Duc M Le dmle@doc.ic.ac.uk
  Created on August 2, 2006
  Department of Computing, Imperial College

Constructor Summary
`PersistentDB(java.lang.String dbName, com.sleepycat.je.Database db, com.sleepycat.bind.EntryBinding valBinder)` Creates a new instance of PersistentDB

Method Summary
`void` | `close()` Close the database
`java.lang.Object` | `get(PersistentKey pkey)` Get the first (or unique) data entry found for key
`java.lang.String` | `getDatabaseName()` Return the database name
`java.lang.Object[]` | `getDuplicates(PersistentKey pkey)` Use the database cursor to obtain all values corresponding to a key
`com.sleepycat.bind.EntryBinding` | `getObjectBinding()` Return reference to the object binder
`java.util.Iterator` | `iterator()` Return an iterator of the entry set
`void` | `put(PersistentKey pkey, java.lang.Object value)` Place a data object into db
`void` | `remove(PersistentKey pkey)` Remove a single record identified by a common key from the database
`void` | `removeAll()` Clear database content
`void` | `removeDuplicates(PersistentKey pkey)` Remove all entries associated to a key from the database

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

Constructor Detail

### PersistentDB

    public PersistentDB(java.lang.String dbName,
                        com.sleepycat.je.Database db,
                        com.sleepycat.bind.EntryBinding valBinder)

  Creates a new instance of PersistentDB

  Parameters:
    `db` - the persistent db object
    `valueCls` - the base class of the value object

Method Detail

### getDatabaseName

    public java.lang.String getDatabaseName()

  Return the database name

### getObjectBinding

    public com.sleepycat.bind.EntryBinding getObjectBinding()

  Return reference to the object binder

### put

    public void put(PersistentKey pkey,
                    java.lang.Object value)

  Place a data object into db

  Specified by:
    `put` in interface `PersistentHandler`

### get

    public java.lang.Object get(PersistentKey pkey)

  Get the first (or unique) data entry found for key

  Specified by:
    `get` in interface `PersistentHandler`

### getDuplicates

    public java.lang.Object[] getDuplicates(PersistentKey pkey)

  Use the database cursor to obtain all values corresponding to a key

  Specified by:
    `getDuplicates` in interface `DuplicatePersistentHandler`
  Parameters:
    `key` - the key object
  Returns:
    Object[]

### removeDuplicates

    public void removeDuplicates(PersistentKey pkey)

  Remove all entries associated to a key from the database

  Specified by:
    `removeDuplicates` in interface `DuplicatePersistentHandler`

### remove

    public void remove(PersistentKey pkey)

  Remove a single record identified by a common key from the database

  Specified by:
    `remove` in interface `PersistentHandler`

### iterator

    public java.util.Iterator iterator()

  Return an iterator of the entry set

  Specified by:
    `iterator` in interface `PersistentHandler`

### removeAll

    public void removeAll()

  Clear database content

  Specified by:
    `removeAll` in interface `PersistentHandler`

### close

    public void close()

  Close the database

  Specified by:
    `close` in interface `PersistentHandler`

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