Main Page | Packages | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

org.openmobileis.database.fastobjectdb.FastObjectDB Class Reference

Inheritance diagram for org.openmobileis.database.fastobjectdb.FastObjectDB:

org.openmobileis.database.fastobjectdb.synchro.client.SynchroFastObjectDB List of all members.

Detailed Description

Author:
Philippe Delrieu
FastObjectDB is the main class of the librairie. All base function are accessed by this class

FastObjectDB is an Object collection based database. Object are stored in collection. Object are retrieved using Index that are attached to collections. A SODA like API is use to request collection.

FODB creation : db = FastObjectDB.open(dbdir, "testdb"); if (!FODBCollection.isCollectionExist(db, "TESTSEARCH")) { // if not created create it. db.createCollection("TESTSEARCH", TestSearchData.class); FODBUniqueIntIndexDescriptor KeyDescriptor = new FODBUniqueIntIndexDescriptor("KEY", "getKey()", 5); db.addIndex("TESTSEARCH", KeyDescriptor); FODBMultipleIntIndexDescriptor debKeyDescriptor = new FODBMultipleIntIndexDescriptor("DIZ", "getDizaine()", 5, 5); db.addIndex("TESTSEARCH", debKeyDescriptor); }

Definition at line 70 of file FastObjectDB.java.

Public Member Functions

String getRootDir ()
String getName ()
FODBCollection getCollection (String name)
boolean isCollectionExist (String colName)
boolean createCollection (FODBCollectionDescriptor descriptor) throws IOException, ClassNotFoundException, BadDataFormatException, FODBException
 Add a new collection to the database.
boolean createCollection (String collectionName, Class objectType) throws IOException, ClassNotFoundException, BadDataFormatException, FODBException
 Add a new collection to the database.
boolean isCollectionEmpty (String colName) throws DatabaseException
boolean addIndex (String colName, FODBIndexDescriptor descriptor) throws BadDataFormatException, FODBException
 Add an index to a Collection of the Database.
boolean add (String colName, Object obj) throws FODBException
 Add an element to a Collection of the database.
boolean replace (String colName, Object obj) throws FODBException
 Replace an existing element in a Collection of the database.
Query query ()
 use to get base class to query FODB.
boolean delete (String colName, Object obj) throws FODBException
 Delete an element of a Collection.
boolean deleteWithId (String colName, Object id) throws FODBException
 Delete an object of a Collection with its id.
String toString ()
FODBCollection[] getDatabaseCollectionArray ()
TransactionManager getTransactionManager ()

Static Public Member Functions

static FastObjectDB open (String dbRootDir, String dbName) throws IOException, ClassNotFoundException, BadDataFormatException, FODBException
 The function is called to open a database.

Protected Member Functions

 FastObjectDB (String dbRootDir, String dbName, FODBMainFile fmf, int action) throws BadDataFormatException, FODBException
 The Constructor.
boolean openCollection (String collectionName) throws IOException, ClassNotFoundException, BadDataFormatException, FODBException
 Open an existing collection.

Protected Attributes

CollectionManager colManager

Static Protected Attributes

static final int ACTION_CREATE = 0
static final int ACTION_OPEN = 1


Constructor & Destructor Documentation

org.openmobileis.database.fastobjectdb.FastObjectDB.FastObjectDB String  dbRootDir,
String  dbName,
FODBMainFile  fmf,
int  action
throws BadDataFormatException, FODBException [protected]
 

The Constructor.

It is private, it is called by local methods create and open

Parameters:
dbRootDir - database root directory
dbName - database name.
fmf - database main file.
action - ACTION_CREATE or ACTION_OPEN
Exceptions:
BadDataFormatException 
FODBException 

Definition at line 94 of file FastObjectDB.java.

References org.openmobileis.database.fastobjectdb.FastObjectDB.ACTION_OPEN, org.openmobileis.database.fastobjectdb.FastObjectDB.colManager, org.openmobileis.database.fastobjectdb.db.store.FODBMainFile.getCollectionsList(), and org.openmobileis.database.fastobjectdb.FastObjectDB.openCollection().

Referenced by org.openmobileis.database.fastobjectdb.FastObjectDB.open().


Member Function Documentation

boolean org.openmobileis.database.fastobjectdb.FastObjectDB.add String  colName,
Object  obj
throws FODBException
 

Add an element to a Collection of the database.

Parameters:
colName - Name of the collection
obj - object to add.
Returns:
- true if it succeded, false otherwise.
Exceptions:
FODBException 

Reimplemented in org.openmobileis.database.fastobjectdb.synchro.client.SynchroFastObjectDB.

Definition at line 273 of file FastObjectDB.java.

References org.openmobileis.database.fastobjectdb.db.FODBCollection.addElement(), org.openmobileis.database.fastobjectdb.FastObjectDB.colManager, org.openmobileis.database.fastobjectdb.db.CollectionManager.getCollectionByName(), and org.openmobileis.database.fastobjectdb.db.FODBCollection.getName().

Referenced by org.openmobileis.modules.crm.database.common.fodb.FODBLabelFactory.storeLabel(), org.openmobileis.database.fastobjectdb.db.test.TestFastObjectDB.testDataWithArray(), org.openmobileis.database.fastobjectdb.db.test.TestFastObjectDB.TestDBAndIndex(), org.openmobileis.database.fastobjectdb.db.test.TestFastObjectDB.testDBSearch(), and org.openmobileis.database.fastobjectdb.db.test.TestFastObjectDB.testMultithread().

boolean org.openmobileis.database.fastobjectdb.FastObjectDB.addIndex String  colName,
FODBIndexDescriptor  descriptor
throws BadDataFormatException, FODBException
 

Add an index to a Collection of the Database.

Parameters:
colName - name of the Collection
descriptor - descriptor representing the index to add.
Returns:
true if it succeded, false otherwise.
Exceptions:
BadDataFormatException 
FODBException 

Definition at line 256 of file FastObjectDB.java.

References org.openmobileis.database.fastobjectdb.db.FODBCollection.addIndex(), org.openmobileis.database.fastobjectdb.FastObjectDB.colManager, org.openmobileis.database.fastobjectdb.db.CollectionManager.getCollectionByName(), and org.openmobileis.database.fastobjectdb.db.FODBCollection.getName().

Referenced by org.openmobileis.synchro.journal.JournalQueryManager.createJournalTable(), org.openmobileis.modules.crm.database.common.fodb.FODBLabelFactory.FODBLabelFactory(), org.openmobileis.modules.crm.database.common.fodb.FODBRepresentantFactory.FODBRepresentantFactory(), org.openmobileis.database.fastobjectdb.synchro.client.FODBSyncActionDBQueryManager.initDB(), org.openmobileis.database.fastobjectdb.db.test.TestFastObjectDB.openDB(), and org.openmobileis.database.fastobjectdb.db.test.TestFastObjectDB.testDBSearch().

boolean org.openmobileis.database.fastobjectdb.FastObjectDB.createCollection String  collectionName,
Class  objectType
throws IOException, ClassNotFoundException, BadDataFormatException, FODBException
 

Add a new collection to the database.

the synchro parameter is set to true.

Parameters:
collectionName - name of the new colletion
objectType - type of objects stored in this collection.
Returns:
true if it succeded, false otherwise.
Exceptions:
IOException 
ClassNotFoundException 
BadDataFormatException 
FODBDataFileException 
FODBCollectionException 

Reimplemented in org.openmobileis.database.fastobjectdb.synchro.client.SynchroFastObjectDB.

Definition at line 202 of file FastObjectDB.java.

boolean org.openmobileis.database.fastobjectdb.FastObjectDB.createCollection FODBCollectionDescriptor  descriptor  )  throws IOException, ClassNotFoundException, BadDataFormatException, FODBException
 

Add a new collection to the database.

Parameters:
collectionName - name of the new colletion
objectType - type of objects stored in this collection.
synchro - if set to false the collection wont be synchronized when FODB is in synchro mode.
Returns:
true if it succeded, false otherwise.
Exceptions:
IOException 
ClassNotFoundException 
BadDataFormatException 
FODBException 

Reimplemented in org.openmobileis.database.fastobjectdb.synchro.client.SynchroFastObjectDB.

Definition at line 177 of file FastObjectDB.java.

References org.openmobileis.database.fastobjectdb.db.store.FODBMainFile.addCollection(), org.openmobileis.database.fastobjectdb.db.CollectionManager.addCollection(), org.openmobileis.database.fastobjectdb.FastObjectDB.colManager, org.openmobileis.database.fastobjectdb.db.FODBCollection.createCollection(), and org.openmobileis.database.fastobjectdb.db.CollectionManager.getCollectionByName().

Referenced by org.openmobileis.synchro.journal.JournalQueryManager.createJournalTable(), org.openmobileis.modules.crm.database.common.fodb.FODBLabelFactory.FODBLabelFactory(), org.openmobileis.modules.crm.database.common.fodb.FODBRepresentantFactory.FODBRepresentantFactory(), org.openmobileis.database.fastobjectdb.synchro.client.FODBSyncActionDBQueryManager.initDB(), org.openmobileis.database.fastobjectdb.db.test.TestFastObjectDB.openDB(), and org.openmobileis.database.fastobjectdb.db.test.TestFastObjectDB.testDBSearch().

boolean org.openmobileis.database.fastobjectdb.FastObjectDB.delete String  colName,
Object  obj
throws FODBException
 

Delete an element of a Collection.

Parameters:
colName - name of the Collection.
obj - object to delete.
Returns:
true if it succeded, false otherwise.
Exceptions:
FODBException 

Reimplemented in org.openmobileis.database.fastobjectdb.synchro.client.SynchroFastObjectDB.

Definition at line 392 of file FastObjectDB.java.

References org.openmobileis.database.fastobjectdb.FastObjectDB.colManager, org.openmobileis.database.fastobjectdb.db.FODBCollection.deleteSingleElement(), org.openmobileis.database.fastobjectdb.db.CollectionManager.getCollectionByName(), and org.openmobileis.database.fastobjectdb.db.FODBCollection.getName().

Referenced by org.openmobileis.database.fastobjectdb.db.test.TestFastObjectDB.testDBSearch().

boolean org.openmobileis.database.fastobjectdb.FastObjectDB.deleteWithId String  colName,
Object  id
throws FODBException
 

Delete an object of a Collection with its id.

Parameters:
colName - name of the Collection.
id - id of the object to delete.
Returns:
true if it succeded, false otherwise.
Exceptions:
FODBException 

Reimplemented in org.openmobileis.database.fastobjectdb.synchro.client.SynchroFastObjectDB.

Definition at line 411 of file FastObjectDB.java.

References org.openmobileis.database.fastobjectdb.FastObjectDB.colManager, org.openmobileis.database.fastobjectdb.db.FODBCollection.deleteObjectWithId(), org.openmobileis.database.fastobjectdb.db.CollectionManager.getCollectionByName(), and org.openmobileis.database.fastobjectdb.db.FODBCollection.getName().

Referenced by org.openmobileis.modules.crm.database.common.fodb.FODBLabelFactory.deleteLabel(), and org.openmobileis.database.fastobjectdb.db.test.TestFastObjectDB.testDataWithArray().

static FastObjectDB org.openmobileis.database.fastobjectdb.FastObjectDB.open String  dbRootDir,
String  dbName
throws IOException, ClassNotFoundException, BadDataFormatException, FODBException [static]
 

The function is called to open a database.

If the database does not exist, It's created.

Parameters:
dbRootDir - database directory
dbName - database name
Returns:
the database object that has been created.
Exceptions:
IOException 
ClassNotFoundException 
BadDataFormatException 
FODBException 

Reimplemented in org.openmobileis.database.fastobjectdb.synchro.client.SynchroFastObjectDB.

Definition at line 128 of file FastObjectDB.java.

References org.openmobileis.database.fastobjectdb.FastObjectDB.ACTION_CREATE, org.openmobileis.database.fastobjectdb.FastObjectDB.ACTION_OPEN, and org.openmobileis.database.fastobjectdb.FastObjectDB.FastObjectDB().

Referenced by org.openmobileis.database.fastobjectdb.synchro.client.SynchroFastObjectDBManager.getCurrentFODB(), org.openmobileis.database.fastobjectdb.FastObjectDBManager.getCurrentFODB(), and org.openmobileis.database.fastobjectdb.db.test.TestFastObjectDB.openDB().

boolean org.openmobileis.database.fastobjectdb.FastObjectDB.openCollection String  collectionName  )  throws IOException, ClassNotFoundException, BadDataFormatException, FODBException [protected]
 

Open an existing collection.

This is not used and should be suppressed.

Parameters:
collectionName - name of the collection
Returns:
true if it succeded, false otherwise.
Exceptions:
IOException 
ClassNotFoundException 
BadDataFormatException 
FODBException 

Reimplemented in org.openmobileis.database.fastobjectdb.synchro.client.SynchroFastObjectDB.

Definition at line 217 of file FastObjectDB.java.

References org.openmobileis.database.fastobjectdb.db.CollectionManager.addCollection(), org.openmobileis.database.fastobjectdb.FastObjectDB.colManager, org.openmobileis.database.fastobjectdb.db.CollectionManager.getCollectionByName(), and org.openmobileis.database.fastobjectdb.db.FODBCollection.openCollection().

Referenced by org.openmobileis.database.fastobjectdb.FastObjectDB.FastObjectDB().

Query org.openmobileis.database.fastobjectdb.FastObjectDB.query  ) 
 

use to get base class to query FODB.

The FODB query API use the SODA API (http://http://odbms.org/soda) as a base API. From Soda specification the differences are : * only query on FODB collection : use query.constrain(MyCollectionObject.class) to declare it. * only query using index. use query.descend("IndexedFieldName") to specify an index.

Exemple of use: Data class :TestSearchData class signature public final class TestSearchData implements Serializable { public int getKey(); public int getDizaine(); }

FODB creation : db = FastObjectDB.open(dbdir, "testdb"); if (!FODBCollection.isCollectionExist(db, "TESTSEARCH")) { // if not created create it. db.createCollection("TESTSEARCH", TestSearchData.class); FODBUniqueIntIndexDescriptor KeyDescriptor = new FODBUniqueIntIndexDescriptor("KEY", "getKey()", 5); db.addIndex("TESTSEARCH", KeyDescriptor); FODBMultipleIntIndexDescriptor debKeyDescriptor = new FODBMultipleIntIndexDescriptor("DIZ", "getDizaine()", 5, 5); db.addIndex("TESTSEARCH", debKeyDescriptor); } The collection TestData where keys are in the interval [0..30]. for (int i=0; i<NB_SEARCH_CREATED_DATA; i++) { db.add("TESTSEARCH", new TestSearchData(i)); }

Exemple of query :

//query SELECT * FROM TESTSEARCH Query q = db.query(); q.constrain(TestSearchData.class); Query subq = q.descend("getKey()"); //specify an index to request. ObjectSet set = q.execute();

//query SELECT * FROM TESTSEARCH where getKey<14 q = db.query(); q.constrain(TestSearchData.class); subq = q.descend("getKey()"); subq.constrain(new Integer(14)).smaller(); set = q.execute();

//query SELECT * FROM TESTSEARCH where getKey>16 AND getKey<23 q = db.query(); q.constrain(TestSearchData.class); subq = q.descend("getKey()"); Constraint c = subq.constrain(new Integer(16)).greater(); Constraint d = subq.constrain(new Integer(23)).smaller(); c.and(d); set = q.execute();

//query SELECT * FROM TESTSEARCH where getKey>16 AND getDizaine=2 q = db.query(); q.constrain(TestSearchData.class); subq = q.descend("getKey()"); c = subq.constrain(new Integer(16)).greater(); Query subq2 = subq.descend("getDizaine()"); d = subq2.constrain(new Integer(2)).equal(); c.and(d); set = q.execute();

See also:
org.odbms.Constraint

org.odbms.ObjectSet

org.odbms.Query

org.openmobileis.database.fastobjectdb.db.query.soda.FODBSodaQuery

Author:
Philippe Delrieu
Since:
JDK 1.1
Version:
1.0.

Definition at line 380 of file FastObjectDB.java.

References org.openmobileis.database.fastobjectdb.FastObjectDB.colManager.

Referenced by org.openmobileis.database.fastobjectdb.db.test.TestThreadRequest2.run(), org.openmobileis.database.fastobjectdb.db.test.TestThreadRequest.run(), org.openmobileis.database.fastobjectdb.db.test.TestFastObjectDB.testDataWithArray(), org.openmobileis.database.fastobjectdb.db.test.TestFastObjectDB.testDBSearch(), org.openmobileis.database.fastobjectdb.db.test.TestFastObjectDB.testFindLike(), org.openmobileis.database.fastobjectdb.db.test.TestFastObjectDB.testMultipleIndex(), org.openmobileis.database.fastobjectdb.db.test.TestFastObjectDB.testRomvedTree(), and org.openmobileis.database.fastobjectdb.db.test.TestFastObjectDB.testTree().

boolean org.openmobileis.database.fastobjectdb.FastObjectDB.replace String  colName,
Object  obj
throws FODBException
 

Replace an existing element in a Collection of the database.

Parameters:
colName - Name of the Collection
obj - Object to replace.
Returns:
true if it succeded, false otherwise.
Exceptions:
FODBException 

Reimplemented in org.openmobileis.database.fastobjectdb.synchro.client.SynchroFastObjectDB.

Definition at line 291 of file FastObjectDB.java.

References org.openmobileis.database.fastobjectdb.FastObjectDB.colManager, org.openmobileis.database.fastobjectdb.db.CollectionManager.getCollectionByName(), org.openmobileis.database.fastobjectdb.db.FODBCollection.getName(), and org.openmobileis.database.fastobjectdb.db.FODBCollection.replaceElement().

Referenced by org.openmobileis.modules.crm.database.common.fodb.FODBLabelFactory.storeLabel().


The documentation for this class was generated from the following file:
Generated on Wed Dec 14 21:05:38 2005 for OpenMobileIS by  doxygen 1.4.4