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

java.lang.Object
  extended byorg.openmobileis.database.fastobjectdb.FastObjectDB
      extended byorg.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

Field Summary
 
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(FODBCollectionDescriptor descriptor)
          Add a new collection to the database.
 boolean createCollection(java.lang.String collectionName, java.lang.Class objectType)
          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.
 boolean isObjectInCollection(java.lang.String colName, java.lang.Object obj)
          return true if the specified object from the specified collection is in the collection.
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 registerJournalLogRenderer(java.lang.String collectionName, java.lang.String journalinfo)
          Register a a simpe journal log renderer to the synchro journal manager for the specified collection.
static void registerSynchroFODBConnector(SynchroFODBConnector connector)
           
 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
FODBException

registerSynchroFODBConnector

public static void registerSynchroFODBConnector(SynchroFODBConnector connector)

createCollection

public boolean createCollection(FODBCollectionDescriptor descriptor)
                         throws java.io.IOException,
                                java.lang.ClassNotFoundException,
                                BadDataFormatException,
                                FODBException
Add a new collection to the database.

Overrides:
createCollection in class FastObjectDB
Returns:
true if it succeded, false otherwise.
Throws:
java.io.IOException
java.lang.ClassNotFoundException
BadDataFormatException
FODBDataFileException
FODBCollectionException
FODBException

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
FODBException

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
FODBException

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 -

registerJournalLogRenderer

public void registerJournalLogRenderer(java.lang.String collectionName,
                                       java.lang.String journalinfo)
Register a a simpe journal log renderer to the synchro journal manager for the specified collection. journalinfo message will be displayed in the journal to identify the collection. The listener is not persistent, so it must be registered at each application start.

Parameters:
collectionName -

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
Returns:
true if the object is found.
Throws:
DatabaseException

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.
Throws:
DatabaseException

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
FODBException

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
FODBException

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
FODBException

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
FODBException


Copyright 2006 OpenMobileIS. All Rights Reserved.