Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.vrspace.server
Class DB  view DB download DB.java

java.lang.Object
  extended byorg.vrspace.server.DB

public abstract class DB
extends java.lang.Object

Database class


Field Summary
 org.vrspace.server.db.DBCache cache
          this keeps reference to cache
 
Constructor Summary
DB()
           
 
Method Summary
abstract  void commit()
          Commit changes.
abstract  void connect(java.lang.String url)
          connect to the database
abstract  java.lang.String create(java.lang.String name)
          create a new database if does not exist
abstract  void delete(java.lang.Object obj)
          From the table obj.getClass().getName() deletes the row having db_id == obj.db_id
abstract  void disconnect()
          Disconnect from the database
abstract  java.lang.Object get(java.lang.Object obj)
          Return database object from table obj.getClass().getName() having db_id = obj.db_id
abstract  java.lang.Object get(java.lang.String className, long id)
          Returns the object having id == obj.db_id
abstract  java.lang.Object get(java.lang.String className, java.lang.String field, java.lang.Object value)
          Returns the object of className class having field == value
abstract  java.lang.Object[] getAll(java.lang.String className)
          Returns all members of the class
abstract  java.lang.Object[] getRange(java.lang.Object o1, java.lang.Object o2)
          Returns Object[] between o1 and o2 Class must have comparator() method to be searchable.
abstract  java.lang.Object[] getRange(java.lang.String className, java.lang.String field, java.lang.Object value)
          Returns the object of className class having field == value
 void load(java.io.File file)
          Loads file content into the database
 void load(java.io.Reader in)
          Loads stream content into the database
 void load(java.lang.String url)
          Loads file content into the db.
abstract  void put(java.lang.Object obj)
          Stores obj into database Logic: - all the public fields are stored - database table: obj.getClass().getName() - create table if does not exist
abstract  void update(Request r)
          A request is a change to one field.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cache

public org.vrspace.server.db.DBCache cache
this keeps reference to cache

Constructor Detail

DB

public DB()
Method Detail

create

public abstract java.lang.String create(java.lang.String name)
                                 throws java.lang.Exception
create a new database if does not exist


connect

public abstract void connect(java.lang.String url)
                      throws java.lang.Exception
connect to the database


disconnect

public abstract void disconnect()
Disconnect from the database


commit

public abstract void commit()
Commit changes. Should NOT be synchronized.


get

public abstract java.lang.Object get(java.lang.Object obj)
                              throws java.lang.Exception
Return database object from table obj.getClass().getName() having db_id = obj.db_id


get

public abstract java.lang.Object get(java.lang.String className,
                                     long id)
                              throws java.lang.Exception
Returns the object having id == obj.db_id


get

public abstract java.lang.Object get(java.lang.String className,
                                     java.lang.String field,
                                     java.lang.Object value)
                              throws java.lang.Exception
Returns the object of className class having field == value


getRange

public abstract java.lang.Object[] getRange(java.lang.String className,
                                            java.lang.String field,
                                            java.lang.Object value)
                                     throws java.lang.Exception
Returns the object of className class having field == value


getRange

public abstract java.lang.Object[] getRange(java.lang.Object o1,
                                            java.lang.Object o2)
                                     throws java.lang.Exception
Returns Object[] between o1 and o2 Class must have comparator() method to be searchable.


getAll

public abstract java.lang.Object[] getAll(java.lang.String className)
                                   throws java.lang.Exception
Returns all members of the class


delete

public abstract void delete(java.lang.Object obj)
                     throws java.lang.Exception
From the table obj.getClass().getName() deletes the row having db_id == obj.db_id


put

public abstract void put(java.lang.Object obj)
                  throws java.lang.Exception
Stores obj into database Logic: - all the public fields are stored - database table: obj.getClass().getName() - create table if does not exist


update

public abstract void update(Request r)
                     throws java.lang.Exception
A request is a change to one field. This method allows optimal database update.


load

public void load(java.lang.String url)
          throws java.lang.Exception
Loads file content into the db. Default protocol for url is 'file'


load

public void load(java.io.Reader in)
          throws java.lang.Exception
Loads stream content into the database


load

public void load(java.io.File file)
          throws java.lang.Exception
Loads file content into the database