org.vrspace.neurogrid
Class DBAdapter

java.lang.Object
  extended byorg.vrspace.neurogrid.DBAdapter
Direct Known Subclasses:
MapDB

public abstract class DBAdapter
extends java.lang.Object

Database adapter. Some methods common for all subclasses should be implemented here.


Field Summary
protected static DBAdapter instance
           
 
Constructor Summary
DBAdapter()
           
 
Method Summary
abstract  int count(java.lang.Class what)
          Count instances of a class
abstract  void delete(NGObject obj)
          Guess what;)
abstract  NGObject get(java.lang.Class what, long id)
          Reload an object from the storage
abstract  NGObject get(java.lang.Class what, NGObject value)
          The same as subSet( What, value, value.next );
static DBAdapter getInstance()
          Get the instance of current database adapter
abstract  void init(Store store)
          Initialize the adapter
abstract  java.util.Iterator iterator(java.lang.Class what)
          Returns iterator on all instances of a class
abstract  void put(NGObject obj)
          Store an object to the database
abstract  long size()
          Total number of rows in the database
abstract  java.util.SortedSet subSet(java.lang.Class what, java.lang.Object start, java.lang.Object end)
          Return subset of a class
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

protected static DBAdapter instance
Constructor Detail

DBAdapter

public DBAdapter()
Method Detail

init

public abstract void init(Store store)
                   throws java.lang.Exception
Initialize the adapter

Throws:
java.lang.Exception
See Also:
Store

getInstance

public static DBAdapter getInstance()
Get the instance of current database adapter


put

public abstract void put(NGObject obj)
                  throws java.lang.Exception
Store an object to the database

Throws:
java.lang.Exception

count

public abstract int count(java.lang.Class what)
Count instances of a class


iterator

public abstract java.util.Iterator iterator(java.lang.Class what)
Returns iterator on all instances of a class


subSet

public abstract java.util.SortedSet subSet(java.lang.Class what,
                                           java.lang.Object start,
                                           java.lang.Object end)
Return subset of a class


get

public abstract NGObject get(java.lang.Class what,
                             long id)
Reload an object from the storage


get

public abstract NGObject get(java.lang.Class what,
                             NGObject value)
The same as subSet( What, value, value.next );


delete

public abstract void delete(NGObject obj)
                     throws java.lang.Exception
Guess what;)

Throws:
java.lang.Exception

size

public abstract long size()
Total number of rows in the database