org.openmobileis.database.fastobjectdb.db
Class FODBCollection

java.lang.Object
  extended byorg.openmobileis.database.fastobjectdb.db.FODBCollection

public class FODBCollection
extends java.lang.Object

FODBCollection is the class that represents each collection. It offers simple functions that are mainly called by FastObjectDB. The unique index that index collection object ids, must be added first.


Method Summary
 boolean addElement(java.lang.Object obj)
          Add an Element to the collection.
 boolean addIndex(FODBIndexDescriptor descriptor)
          Add an index.
static FODBCollection createCollection(FastObjectDB db, FODBCollectionDescriptor descriptor)
          Function that is called to create a new collection.
 boolean deleteObjectWithId(java.lang.Object id)
          Delete an object of the Collection with its ID.
 boolean deleteSingleElement(java.lang.Object obj)
          Delete an element of the Collection.
 BackwardUniqueIndexIterator getBackwardIndexIterator(java.lang.String memberName)
           
 FODBCypher getCollectionCypher()
          return the collection cypher if any, null otherwise.
 FODBUniqueIndex getCollectionIdIndex()
           
 FODBIndex[] getCollectionIndexList()
           
 java.lang.Class getCollectionObjectClass()
           
 FastObjectDB getDatabase()
           
 FODBCollectionDescriptor getDescriptor()
           
 java.lang.Object getElementAtPos(long pos)
          Returns the element at position 'pos'
 ForwardUniqueIndexIterator getForwardIndexIterator(java.lang.String memberName)
           
 FODBIndex getIndexByMember(java.lang.String member)
           
 java.lang.String getName()
           
protected  java.lang.Object getNodeAtPos(long pos)
          Returns the node at position 'pos'
 boolean isSynchronized()
           
static FODBCollection openCollection(FastObjectDB db, java.lang.String colName)
          Function that is called to open an existing collection.
 boolean replaceElement(java.lang.Object obj)
          Replace an existing element of the Collection.
 void setCollectionCypher(FODBCypher cypher)
          Init collection encryption with the specified cypher.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getDescriptor

public FODBCollectionDescriptor getDescriptor()

getCollectionObjectClass

public java.lang.Class getCollectionObjectClass()

getIndexByMember

public FODBIndex getIndexByMember(java.lang.String member)

isSynchronized

public boolean isSynchronized()

createCollection

public static FODBCollection createCollection(FastObjectDB db,
                                              FODBCollectionDescriptor descriptor)
                                       throws FODBException
Function that is called to create a new collection.

Parameters:
db - - FastObjectDB instance that refers to it.
Returns:
the object created.
Throws:
FODBException

openCollection

public static FODBCollection openCollection(FastObjectDB db,
                                            java.lang.String colName)
                                     throws FODBException
Function that is called to open an existing collection.

Parameters:
db - - FastObjectDB instance that refers to it.
colName - - Collection name.
Returns:
the object created.
Throws:
FODBException

getName

public java.lang.String getName()

setCollectionCypher

public void setCollectionCypher(FODBCypher cypher)
                         throws FODBException
Init collection encryption with the specified cypher. Must be call just after collection initialization before storing/reading any data. Same cypher must be provided to read already stored object.

Parameters:
cypher - : cypher to be use to encrypt data.
Throws:
FODBException

getCollectionCypher

public FODBCypher getCollectionCypher()
                               throws FODBException
return the collection cypher if any, null otherwise.

Returns:
cypher use to encrypt data, null otherwise.
Throws:
FODBException

addIndex

public boolean addIndex(FODBIndexDescriptor descriptor)
                 throws FODBException
Add an index.

Parameters:
descriptor - - index descriptor.
Returns:
true if it succeded, false otherwise.
Throws:
FODBException

getCollectionIndexList

public FODBIndex[] getCollectionIndexList()

getCollectionIdIndex

public FODBUniqueIndex getCollectionIdIndex()
                                     throws FODBException
Throws:
FODBException

addElement

public boolean addElement(java.lang.Object obj)
                   throws FODBException
Add an Element to the collection.

Parameters:
obj - - object to add.
Returns:
true if it succeded, false otherwise.
Throws:
FODBException

replaceElement

public boolean replaceElement(java.lang.Object obj)
                       throws FODBException
Replace an existing element of the Collection.

Parameters:
obj - - object that will replace an existing one.
Returns:
true if it succeded, false otherwise.
Throws:
FODBException

deleteSingleElement

public boolean deleteSingleElement(java.lang.Object obj)
                            throws FODBException
Delete an element of the Collection.

Parameters:
obj - - object to Delete.
Returns:
- true if it succeded, false otherwise.
Throws:
FODBException

deleteObjectWithId

public boolean deleteObjectWithId(java.lang.Object id)
                           throws FODBException
Delete an object of the Collection with its ID. The first index in the collection is use as ID unique index.

Parameters:
id - - id of object to Delete.
Returns:
- object position or NODE.NO_NODE if not found.
Throws:
FODBException

getForwardIndexIterator

public ForwardUniqueIndexIterator getForwardIndexIterator(java.lang.String memberName)
                                                   throws FODBException
Throws:
FODBException

getBackwardIndexIterator

public BackwardUniqueIndexIterator getBackwardIndexIterator(java.lang.String memberName)
                                                     throws FODBException
Throws:
FODBException

getElementAtPos

public java.lang.Object getElementAtPos(long pos)
                                 throws FODBException
Returns the element at position 'pos'

Parameters:
pos - - postion of the element to retrieve.
Returns:
- the element retrieved.
Throws:
FODBException

getNodeAtPos

protected java.lang.Object getNodeAtPos(long pos)
                                 throws FODBException
Returns the node at position 'pos'

Parameters:
pos - - postion of the element to retrieve.
Returns:
- the element retrieved.
Throws:
FODBException

getDatabase

public FastObjectDB getDatabase()
Returns:


Copyright 2005 e-Care. All Rights Reserved.