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

Quick Search    Search Deep

org.javahispano.canyamo.services.persistence
Class DbManager  view DbManager download DbManager.java

java.lang.Object
  extended byorg.javahispano.canyamo.services.persistence.DbManager

public class DbManager
extends java.lang.Object

Entry point to Persistence service
Persistence is made upon OREO (http://www.niggle.org)

Version:

Field Summary
private  CanyamoDataSource data
          OREO's datasource
private static DbManager instance
          Stores the unique allowed instance of this class
private  DataRegistry registry
          OREOs registry
 
Constructor Summary
private DbManager()
          Loads Canyamo's datasource and global record defs.
 
Method Summary
 void deleteDbObject(DbObject record)
          Removes the given object
 void deleteDbObject(DbObject record, java.lang.String table)
          Removes the given object from the given table
 void deleteDbObject(java.lang.String type, java.lang.Object id)
          Removes the object with the given id of the given type
 void deleteDbObject(java.lang.String type, java.lang.Object id, java.lang.String table)
          Removes the object with the given id of the given type from the given table
static DbManager getInstance()
          Gets the unique instance of this class
 DbObject getNewDbObject(java.lang.String type)
          Gets a new DbObject.
 DbObject loadDbObject(java.lang.String type, java.lang.Object key)
          Loads a DbObject from DB
 DbObject loadDbObject(java.lang.String type, java.lang.Object key, java.lang.String table)
          Loads a DbObject from DB from the given table
 void loadRecordDefs(java.lang.String name)
          Loads an XML file containing record definitios
See OREO's documentation for more info.
 void saveDbObject(DbObject record)
          Saves a new DbObject in the DB.
 void saveDbObject(DbObject record, java.lang.String table)
          Saves a new DbObject in the DB in the given table.
 java.util.List select(DbCondition condition)
          Select all records which satisfied the given Condition
 java.util.List select(DbCondition condition, DbOrder order)
          Select all records which satisfied the given DbCondition following the given DbOrder
 java.util.List select(DbCondition condition, DbOrder order, int size)
          Select size records which satisfied the given DbCondition following the given DbOrder
 java.util.List select(DbCondition condition, DbOrder order, int pos, int size)
          Select size records from position pos which satisfied the given DbCondition following the given DbOrder
 java.util.List select(DbCondition condition, DbOrder order, int pos, int size, java.lang.String table)
          Select size records from position pos which satisfied the given DbCondition following the given DbOrder from the given table
 java.util.List select(DbCondition condition, DbOrder order, int size, java.lang.String table)
          Select size records which satisfied the given DbCondition following the given DbOrder from the given table
 java.util.List select(DbCondition condition, DbOrder order, java.lang.String table)
          Select all records which satisfied the given DbCondition following the given DbOrder from the given table
 java.util.List select(DbCondition condition, java.lang.String table)
          Select all records which satisfied the given Condition from the given table
 java.util.List select(java.lang.String type)
          Selects all records of the given type
 java.util.List select(java.lang.String type, DbOrder order)
          Selects all records of the given type following the given DbOrder
 java.util.List select(java.lang.String type, DbOrder order, int size)
          Select size records of the given type following the given DbOrder
 java.util.List select(java.lang.String type, DbOrder order, int pos, int size)
          Select size records from position pos of the give type following the given DbOrder
 java.util.List select(java.lang.String type, DbOrder order, int pos, int size, java.lang.String table)
          Select size records from position pos of the give type following the given DbOrder from the given table
 java.util.List select(java.lang.String type, DbOrder order, int size, java.lang.String table)
          Select size records of the given type following the given DbOrder from the given table
 java.util.List select(java.lang.String type, DbOrder order, java.lang.String table)
          Selects all records of the given type following the given DbOrder from the given table
 java.util.List select(java.lang.String type, java.lang.String table)
          Selects all records of the given type from the given table
 int selectCount(java.lang.String type)
          Counbts the number of objects of the given type
 int selectCount(java.lang.String type, DbCondition condition)
          Counts the number of objects of the given types which satisfied the given condition
 int selectCount(java.lang.String type, DbCondition condition, java.lang.String table)
          Counts the number of objects of the given types which satisfied the given condition from the given table
 int selectCount(java.lang.String type, java.lang.String table)
          Counbts the number of objects of the given type from the given table
 java.lang.Object selectMax(java.lang.String type, java.lang.String field)
          Select the max value for a given fieldm of a given record type
 java.lang.Object selectMax(java.lang.String type, java.lang.String field, DbCondition condition)
          Select the max value for a given fieldm of a given record type, which satisfied the given condition
 java.lang.Object selectMax(java.lang.String type, java.lang.String field, DbCondition condition, java.lang.String table)
          Select the max value for a given fieldm of a given record type, which satisfied the given condition from the given table
 java.lang.Object selectMax(java.lang.String type, java.lang.String field, java.lang.String table)
          Select the max value for a given fieldm of a given record type from the given table
 java.lang.Object selectMin(java.lang.String type, java.lang.String field)
          Select the min value for a given fieldm of a given record type
 java.lang.Object selectMin(java.lang.String type, java.lang.String field, DbCondition condition)
          Select the min value for a given fieldm of a given record type, which satisfied the given condition
 java.lang.Object selectMin(java.lang.String type, java.lang.String field, DbCondition condition, java.lang.String table)
          Select the min value for a given fieldm of a given record type, which satisfied the given condition from the given table
 java.lang.Object selectMin(java.lang.String type, java.lang.String field, java.lang.String table)
          Select the min value for a given fieldm of a given record type from the given table
 void shutdown()
          Description of the Method
 void updateDbObject(DbObject record)
          Update an manipulated DbObject in the DB
 void updateDbObject(DbObject record, java.lang.String table)
          Update an manipulated DbObject in the DB in the given table
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

private static DbManager instance
Stores the unique allowed instance of this class


registry

private DataRegistry registry
OREOs registry


data

private CanyamoDataSource data
OREO's datasource

Constructor Detail

DbManager

private DbManager()
Loads Canyamo's datasource and global record defs.
Persistence uses OREO as object-rational mapping tool

Method Detail

getInstance

public static DbManager getInstance()
Gets the unique instance of this class


getNewDbObject

public DbObject getNewDbObject(java.lang.String type)
                        throws java.io.IOException
Gets a new DbObject.
this method creates the object in memory. You are required to use saveDbObject to really save the object after you given it it's values.


shutdown

public void shutdown()
Description of the Method


loadRecordDefs

public void loadRecordDefs(java.lang.String name)
Loads an XML file containing record definitios
See OREO's documentation for more info.


loadDbObject

public DbObject loadDbObject(java.lang.String type,
                             java.lang.Object key)
                      throws java.io.IOException
Loads a DbObject from DB


loadDbObject

public DbObject loadDbObject(java.lang.String type,
                             java.lang.Object key,
                             java.lang.String table)
                      throws java.io.IOException
Loads a DbObject from DB from the given table


updateDbObject

public void updateDbObject(DbObject record)
                    throws java.io.IOException
Update an manipulated DbObject in the DB


updateDbObject

public void updateDbObject(DbObject record,
                           java.lang.String table)
                    throws java.io.IOException
Update an manipulated DbObject in the DB in the given table


saveDbObject

public void saveDbObject(DbObject record)
                  throws java.io.IOException
Saves a new DbObject in the DB.
Method newDbObject doesn't create the record in DB. Use this method to do it!

Since:

saveDbObject

public void saveDbObject(DbObject record,
                         java.lang.String table)
                  throws java.io.IOException
Saves a new DbObject in the DB in the given table.
Method newDbObject doesn't create the record in DB. Use this method to do it!

Since:

deleteDbObject

public void deleteDbObject(DbObject record)
                    throws java.io.IOException
Removes the given object


deleteDbObject

public void deleteDbObject(DbObject record,
                           java.lang.String table)
                    throws java.io.IOException
Removes the given object from the given table


deleteDbObject

public void deleteDbObject(java.lang.String type,
                           java.lang.Object id)
                    throws java.io.IOException
Removes the object with the given id of the given type


deleteDbObject

public void deleteDbObject(java.lang.String type,
                           java.lang.Object id,
                           java.lang.String table)
                    throws java.io.IOException
Removes the object with the given id of the given type from the given table


select

public java.util.List select(java.lang.String type)
                      throws java.io.IOException
Selects all records of the given type


select

public java.util.List select(java.lang.String type,
                             java.lang.String table)
                      throws java.io.IOException
Selects all records of the given type from the given table


select

public java.util.List select(java.lang.String type,
                             DbOrder order)
                      throws java.io.IOException
Selects all records of the given type following the given DbOrder


select

public java.util.List select(java.lang.String type,
                             DbOrder order,
                             java.lang.String table)
                      throws java.io.IOException
Selects all records of the given type following the given DbOrder from the given table


select

public java.util.List select(java.lang.String type,
                             DbOrder order,
                             int size)
                      throws java.io.IOException
Select size records of the given type following the given DbOrder


select

public java.util.List select(java.lang.String type,
                             DbOrder order,
                             int size,
                             java.lang.String table)
                      throws java.io.IOException
Select size records of the given type following the given DbOrder from the given table


select

public java.util.List select(java.lang.String type,
                             DbOrder order,
                             int pos,
                             int size)
                      throws java.io.IOException
Select size records from position pos of the give type following the given DbOrder


select

public java.util.List select(java.lang.String type,
                             DbOrder order,
                             int pos,
                             int size,
                             java.lang.String table)
                      throws java.io.IOException
Select size records from position pos of the give type following the given DbOrder from the given table


select

public java.util.List select(DbCondition condition)
                      throws java.io.IOException
Select all records which satisfied the given Condition


select

public java.util.List select(DbCondition condition,
                             java.lang.String table)
                      throws java.io.IOException
Select all records which satisfied the given Condition from the given table


select

public java.util.List select(DbCondition condition,
                             DbOrder order)
                      throws java.io.IOException
Select all records which satisfied the given DbCondition following the given DbOrder


select

public java.util.List select(DbCondition condition,
                             DbOrder order,
                             java.lang.String table)
                      throws java.io.IOException
Select all records which satisfied the given DbCondition following the given DbOrder from the given table


select

public java.util.List select(DbCondition condition,
                             DbOrder order,
                             int size)
                      throws java.io.IOException
Select size records which satisfied the given DbCondition following the given DbOrder


select

public java.util.List select(DbCondition condition,
                             DbOrder order,
                             int size,
                             java.lang.String table)
                      throws java.io.IOException
Select size records which satisfied the given DbCondition following the given DbOrder from the given table


select

public java.util.List select(DbCondition condition,
                             DbOrder order,
                             int pos,
                             int size)
                      throws java.io.IOException
Select size records from position pos which satisfied the given DbCondition following the given DbOrder


select

public java.util.List select(DbCondition condition,
                             DbOrder order,
                             int pos,
                             int size,
                             java.lang.String table)
                      throws java.io.IOException
Select size records from position pos which satisfied the given DbCondition following the given DbOrder from the given table


selectCount

public int selectCount(java.lang.String type,
                       DbCondition condition)
                throws java.io.IOException
Counts the number of objects of the given types which satisfied the given condition


selectCount

public int selectCount(java.lang.String type,
                       DbCondition condition,
                       java.lang.String table)
                throws java.io.IOException
Counts the number of objects of the given types which satisfied the given condition from the given table


selectMax

public java.lang.Object selectMax(java.lang.String type,
                                  java.lang.String field,
                                  DbCondition condition)
                           throws java.io.IOException
Select the max value for a given fieldm of a given record type, which satisfied the given condition


selectMax

public java.lang.Object selectMax(java.lang.String type,
                                  java.lang.String field,
                                  DbCondition condition,
                                  java.lang.String table)
                           throws java.io.IOException
Select the max value for a given fieldm of a given record type, which satisfied the given condition from the given table


selectMin

public java.lang.Object selectMin(java.lang.String type,
                                  java.lang.String field,
                                  DbCondition condition)
                           throws java.io.IOException
Select the min value for a given fieldm of a given record type, which satisfied the given condition


selectMin

public java.lang.Object selectMin(java.lang.String type,
                                  java.lang.String field,
                                  DbCondition condition,
                                  java.lang.String table)
                           throws java.io.IOException
Select the min value for a given fieldm of a given record type, which satisfied the given condition from the given table


selectCount

public int selectCount(java.lang.String type)
                throws java.io.IOException
Counbts the number of objects of the given type


selectCount

public int selectCount(java.lang.String type,
                       java.lang.String table)
                throws java.io.IOException
Counbts the number of objects of the given type from the given table


selectMax

public java.lang.Object selectMax(java.lang.String type,
                                  java.lang.String field)
                           throws java.io.IOException
Select the max value for a given fieldm of a given record type


selectMax

public java.lang.Object selectMax(java.lang.String type,
                                  java.lang.String field,
                                  java.lang.String table)
                           throws java.io.IOException
Select the max value for a given fieldm of a given record type from the given table


selectMin

public java.lang.Object selectMin(java.lang.String type,
                                  java.lang.String field)
                           throws java.io.IOException
Select the min value for a given fieldm of a given record type


selectMin

public java.lang.Object selectMin(java.lang.String type,
                                  java.lang.String field,
                                  java.lang.String table)
                           throws java.io.IOException
Select the min value for a given fieldm of a given record type from the given table