org.openmobileis.database.fastobjectdb.synchro.client
Class SynchroFastObjectDB

java.lang.Object
  |
  +--org.openmobileis.database.fastobjectdb.FastObjectDB
        |
        +--org.openmobileis.database.fastobjectdb.synchro.client.SynchroFastObjectDB

public class SynchroFastObjectDB
extends FastObjectDB

Title: OpenMobileIS project source
Description: Synchronisable version of FastDBObject

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

Fields inherited from class org.openmobileis.database.fastobjectdb.FastObjectDB
ACTION_CREATE, ACTION_OPEN, colManager
 
Method Summary
 boolean add(java.lang.String colName, java.lang.Object obj)
          Add an element to a Collection of the database.
 boolean addFODB(java.lang.String colName, java.lang.Object obj)
          Add an element to a Collection of the database without saving modification data needed to synchronize synchronizable collection.
 boolean createCollection(java.lang.String collectionName, java.lang.Class objectType)
          Add a new collection to the database. the synchro parameter is set to true.
 boolean createCollection(java.lang.String collectionName, java.lang.Class objectType, boolean synchro)
          Add a new collection to the database.
 boolean delete(java.lang.String colName, java.lang.Object obj)
          Delete an element of a Collection
 boolean deleteWithId(java.lang.String colName, java.lang.Object id)
          Delete an object of a Collection with its id
 boolean deleteWithIdFODB(java.lang.String colName, java.lang.Object id)
          Delete an object of a Collection with its id Doas not generate syncho action.
 java.lang.Object getObjectFromCollectionWithId(java.lang.String colName, java.lang.String id)
          return the object from the specified collection with specified id. id is the string format of the id object.
 boolean isObjectInCollection(java.lang.String colName, java.lang.Object obj)
          return true if the specified object from the specified collection is in the collection. return false otherwise
static FastObjectDB open(java.lang.String dbRootDir, java.lang.String dbName)
          The function is called to open a database.
protected  boolean openCollection(java.lang.String collectionName)
          Open an existing collection.
 void registerSynchroFODBReturnListener(java.lang.String collectionName, SynchroFODBReturnListener listener)
          Register a synchroListener call during synchronisation processus.
 boolean replace(java.lang.String colName, java.lang.Object obj)
          Replace an existing element in a Collection of the database.
 boolean replaceFODB(java.lang.String colName, java.lang.Object obj)
          Replace an existing element in a Collection of the database without saving modification data needed to synchronize synchronizable collection.
 
Methods inherited from class org.openmobileis.database.fastobjectdb.FastObjectDB
addIndex, getCollection, getDatabaseCollectionArray, getName, getRootDir, getTransactionManager, isCollectionEmpty, isCollectionExist, query, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

open

public static FastObjectDB open(java.lang.String dbRootDir,
                                java.lang.String dbName)
                         throws java.io.IOException,
                                java.lang.ClassNotFoundException,
                                BadDataFormatException,
                                FODBException
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.
Throws:
java.io.IOException -  
java.lang.ClassNotFoundException -  
BadDataFormatException -  
FODBDataFileException -  
FODBCollectionException -  

createCollection

public boolean createCollection(java.lang.String collectionName,
                                java.lang.Class objectType,
                                boolean synchro)
                         throws java.io.IOException,
                                java.lang.ClassNotFoundException,
                                BadDataFormatException,
                                FODBException
Add a new collection to the database.
Overrides:
createCollection in class FastObjectDB
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.
Throws:
java.io.IOException -  
java.lang.ClassNotFoundException -  
BadDataFormatException -  
FODBDataFileException -  
FODBCollectionException -  

createCollection

public boolean createCollection(java.lang.String collectionName,
                                java.lang.Class objectType)
                         throws java.io.IOException,
                                java.lang.ClassNotFoundException,
                                BadDataFormatException,
                                FODBException
Add a new collection to the database. the synchro parameter is set to true.
Overrides:
createCollection in class FastObjectDB
Parameters:
collectionName - - name of the new colletion
objectType - - type of objects stored in this collection.
Returns:
true if it succeded, false otherwise.
Throws:
java.io.IOException -  
java.lang.ClassNotFoundException -  
BadDataFormatException -  
FODBDataFileException -  
FODBCollectionException -  

openCollection

protected boolean openCollection(java.lang.String collectionName)
                          throws java.io.IOException,
                                 java.lang.ClassNotFoundException,
                                 BadDataFormatException,
                                 FODBException
Open an existing collection. This is not used and should be suppressed.
Overrides:
openCollection in class FastObjectDB
Parameters:
collectionName - - name of the collection
Returns:
true if it succeded, false otherwise.
Throws:
java.io.IOException -  
java.lang.ClassNotFoundException -  
BadDataFormatException -  
FODBDataFileException -  
FODBCollectionException -  

registerSynchroFODBReturnListener

public void registerSynchroFODBReturnListener(java.lang.String collectionName,
                                              SynchroFODBReturnListener listener)
Register a synchroListener call during synchronisation processus. The listener is not persistent, so it must be registered at each application start.
Parameters:
collectionName -  
listener -  

isObjectInCollection

public boolean isObjectInCollection(java.lang.String colName,
                                    java.lang.Object obj)
                             throws DatabaseException
return true if the specified object from the specified collection is in the collection. return false otherwise
Parameters:
colName - - name of the Collection
object - - object to look for.
Returns:
true if the object is found.

getObjectFromCollectionWithId

public java.lang.Object getObjectFromCollectionWithId(java.lang.String colName,
                                                      java.lang.String id)
                                               throws DatabaseException
return the object from the specified collection with specified id. id is the string format of the id object. If id is an int for exemple. The specified parameter is converted to an int.
Parameters:
colName - - name of the Collection
id - - object id.
Returns:
the object with specified id or null if not found.

addFODB

public boolean addFODB(java.lang.String colName,
                       java.lang.Object obj)
                throws FODBException
Add an element to a Collection of the database without saving modification data needed to synchronize synchronizable collection. Use by synchro to add data that come from the server.
Parameters:
colName - - Name of the collection
obj - - object to add.
Returns:
- true if it succeded, false otherwise.
Throws:
FODBDataFileException -  
FODBCollectionException -  
FODBIndexException -  
BTreeException -  

add

public boolean add(java.lang.String colName,
                   java.lang.Object obj)
            throws FODBException
Add an element to a Collection of the database.
Overrides:
add in class FastObjectDB
Parameters:
colName - - Name of the collection
obj - - object to add.
Returns:
- true if it succeded, false otherwise.
Throws:
FODBException -  

replaceFODB

public boolean replaceFODB(java.lang.String colName,
                           java.lang.Object obj)
                    throws FODBException
Replace an existing element in a Collection of the database without saving modification data needed to synchronize synchronizable collection. Use by synchro to replace data that come from the server.
Parameters:
colName - - Name of the Collection
obj - - Object to replace.
Returns:
true if it succeded, false otherwise.
Throws:
FODBException -  

replace

public boolean replace(java.lang.String colName,
                       java.lang.Object obj)
                throws FODBException
Replace an existing element in a Collection of the database.
Overrides:
replace in class FastObjectDB
Parameters:
colName - - Name of the Collection
obj - - Object to replace.
Returns:
true if it succeded, false otherwise.
Throws:
FODBException -  

delete

public boolean delete(java.lang.String colName,
                      java.lang.Object obj)
               throws FODBException
Delete an element of a Collection
Overrides:
delete in class FastObjectDB
Parameters:
colName - - name of the Collection.
obj - - object to delete.
Returns:
true if it succeded, false otherwise.
Throws:
FODBCollectionException -  
FODBIndexException -  

deleteWithIdFODB

public boolean deleteWithIdFODB(java.lang.String colName,
                                java.lang.Object id)
                         throws FODBException
Delete an object of a Collection with its id Doas not generate syncho action.
Parameters:
colName - - name of the Collection.
id - - id of the object to delete.
Returns:
true if it succeded, false otherwise.
Throws:
FODBCollectionException -  
FODBIndexException -  

deleteWithId

public boolean deleteWithId(java.lang.String colName,
                            java.lang.Object id)
                     throws FODBException
Delete an object of a Collection with its id
Overrides:
deleteWithId in class FastObjectDB
Parameters:
colName - - name of the Collection.
id - - id of the object to delete.
Returns:
true if it succeded, false otherwise.
Throws:
FODBCollectionException -  
FODBIndexException -  


Copyright 2005 e-Care. All Rights Reserved.