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

org.openmobileis.database.fastobjectdb.db.store.FODBCollectionFile Class Reference

List of all members.

Detailed Description

FODBCollectionFile is a Class that defines simple functions access our data file.

Definition at line 47 of file FODBCollectionFile.java.

Public Member Functions

boolean isSynchronized ()
FODBCypher getCollectionCypher () throws FODBException
 return the collection cypher if any, null otherwise.
void setCollectionCypher (FODBCypher cypher) throws FODBException
 Init collection encryption with the specified cypher.
void setSynchronized (boolean sync) throws IOException, ClassNotFoundException
synchronized long addIndex (long indexPos) throws IOException, ClassNotFoundException
 Add an index to the indexs table.
Object readNode (long pos) throws IOException, ClassNotFoundException
 Read Object at pos.
long writeNode (Object obj) throws IOException, ClassNotFoundException
 Write an object.
void rewriteNode (Object obj, long pos) throws IOException, ClassNotFoundException
 Rewrite an object The object has to be the same size it used to be.
Object readObject (long pos) throws IOException, ClassNotFoundException
 Read Object at pos.
long writeObject (Object obj) throws IOException, ClassNotFoundException
 Write an object.
void rewriteObjectt (Object obj, long pos) throws IOException, ClassNotFoundException
 Rewrite an object The object has to be the same size it used to be.
void deleteObject (long pos) throws IOException, ClassNotFoundException
 Delete an Object.
void writeHeader () throws IOException, ClassNotFoundException
 Write the header at the beginning of the collection file.
void rewriteHeader () throws IOException, ClassNotFoundException
FODBCollectionFileHeader readHeader () throws IOException, ClassNotFoundException
 Read the header which is situated at the beginning of the collection file and return it.
Class getObjectType ()
FODBIndexHeader[] getIndexsHeaders () throws IOException, ClassNotFoundException
 Read the indexs table.
String toString ()
 Used for debugging.

Static Public Member Functions

static FODBCollectionFile createCollection (String filePath, Class objType, String colname, FastObjectDB db) throws IOException, ClassNotFoundException
 The function that is called to create a new Collection file.
static FODBCollectionFile openCollection (String filePath, String colname, FastObjectDB db) throws IOException, ClassNotFoundException
 The function that is called to open an existing Collection file.


Member Function Documentation

synchronized long org.openmobileis.database.fastobjectdb.db.store.FODBCollectionFile.addIndex long  indexPos  )  throws IOException, ClassNotFoundException
 

Add an index to the indexs table.

Parameters:
indexPos - position of the new index in the file.
Returns:
indexPos (might be suppressed).
Exceptions:
FODBDataFileException 

Definition at line 188 of file FODBCollectionFile.java.

References org.openmobileis.database.fastobjectdb.db.index.FODBIndexTable.add().

Referenced by org.openmobileis.database.fastobjectdb.db.store.FODBCollectionIndexFile.addIndexPointerToTable().

static FODBCollectionFile org.openmobileis.database.fastobjectdb.db.store.FODBCollectionFile.createCollection String  filePath,
Class  objType,
String  colname,
FastObjectDB  db
throws IOException, ClassNotFoundException [static]
 

The function that is called to create a new Collection file.

It just calls the constructor with the argument ACTION_CREATE.

Parameters:
filePath - same as constructor
objType - same as constructor
Returns:
the object created.
Exceptions:
FODBDataFileException 

Definition at line 162 of file FODBCollectionFile.java.

void org.openmobileis.database.fastobjectdb.db.store.FODBCollectionFile.deleteObject long  pos  )  throws IOException, ClassNotFoundException
 

Delete an Object.

Parameters:
pos - position of the object to delete.
Exceptions:
FODBDataFileException 

Definition at line 324 of file FODBCollectionFile.java.

References org.openmobileis.database.fastobjectdb.db.store.FODBObjectDatabaseFile.delete(), and org.openmobileis.database.fastobjectdb.db.store.FODBObjectDatabaseFile.seek().

Referenced by org.openmobileis.database.fastobjectdb.db.store.FODBCollectionIndexFile.deleteLongPtr(), org.openmobileis.database.fastobjectdb.db.store.FODBCollectionIndexFile.deleteNode(), and org.openmobileis.database.fastobjectdb.db.FODBCollection.deleteObjectWithId().

FODBCypher org.openmobileis.database.fastobjectdb.db.store.FODBCollectionFile.getCollectionCypher  )  throws FODBException
 

return the collection cypher if any, null otherwise.

Returns:
cypher use to encrypt data, null otherwise.

Definition at line 122 of file FODBCollectionFile.java.

Referenced by org.openmobileis.database.fastobjectdb.db.FODBCollection.getCollectionCypher().

FODBIndexHeader [] org.openmobileis.database.fastobjectdb.db.store.FODBCollectionFile.getIndexsHeaders  )  throws IOException, ClassNotFoundException
 

Read the indexs table.

Then get all indexs header, and return them as a table.

Returns:
- a table of indexsHeader.
Exceptions:
FODBDataFileException 

Definition at line 378 of file FODBCollectionFile.java.

References org.openmobileis.database.fastobjectdb.db.index.FODBIndexTable.getPosByPlace(), org.openmobileis.database.fastobjectdb.db.store.FODBObjectDatabaseFile.readObject(), org.openmobileis.database.fastobjectdb.db.store.FODBObjectDatabaseFile.seek(), and org.openmobileis.database.fastobjectdb.db.index.FODBIndexTable.size().

static FODBCollectionFile org.openmobileis.database.fastobjectdb.db.store.FODBCollectionFile.openCollection String  filePath,
String  colname,
FastObjectDB  db
throws IOException, ClassNotFoundException [static]
 

The function that is called to open an existing Collection file.

It just calls the constructor with the argument ACTION_OPEN.

Parameters:
filePath - same as constructor
Returns:
the object created or null if the file does not exist.
Exceptions:
FODBDataFileException 

Definition at line 173 of file FODBCollectionFile.java.

FODBCollectionFileHeader org.openmobileis.database.fastobjectdb.db.store.FODBCollectionFile.readHeader  )  throws IOException, ClassNotFoundException
 

Read the header which is situated at the beginning of the collection file and return it.

Returns:
- The header of the file.
Exceptions:
FODBDataFileException 

Definition at line 351 of file FODBCollectionFile.java.

References org.openmobileis.database.fastobjectdb.db.store.FODBObjectDatabaseFile.readObject(), and org.openmobileis.database.fastobjectdb.db.store.FODBObjectDatabaseFile.rewind().

Object org.openmobileis.database.fastobjectdb.db.store.FODBCollectionFile.readNode long  pos  )  throws IOException, ClassNotFoundException
 

Read Object at pos.

Parameters:
pos - position of the object to read.
Returns:
the read object.
Exceptions:
FODBDataFileException 

Definition at line 223 of file FODBCollectionFile.java.

References org.openmobileis.database.fastobjectdb.db.store.FODBObjectDatabaseFile.readObject(), and org.openmobileis.database.fastobjectdb.db.store.FODBObjectDatabaseFile.seek().

Referenced by org.openmobileis.database.fastobjectdb.db.FODBCollection.getNodeAtPos(), org.openmobileis.database.fastobjectdb.db.store.FODBCollectionIndexFile.readLongPtr(), and org.openmobileis.database.fastobjectdb.db.store.FODBCollectionIndexFile.readNode().

Object org.openmobileis.database.fastobjectdb.db.store.FODBCollectionFile.readObject long  pos  )  throws IOException, ClassNotFoundException
 

Read Object at pos.

Parameters:
pos - position of the object to read.
Returns:
the read object.
Exceptions:
FODBDataFileException 

Definition at line 260 of file FODBCollectionFile.java.

References org.openmobileis.database.fastobjectdb.db.crypto.FODBCypher.decryptObject(), org.openmobileis.database.fastobjectdb.db.store.FODBObjectDatabaseFile.readObject(), and org.openmobileis.database.fastobjectdb.db.store.FODBObjectDatabaseFile.seek().

Referenced by org.openmobileis.database.fastobjectdb.db.FODBCollection.getElementAtPos().

void org.openmobileis.database.fastobjectdb.db.store.FODBCollectionFile.rewriteNode Object  obj,
long  pos
throws IOException, ClassNotFoundException
 

Rewrite an object The object has to be the same size it used to be.

The function doesn't check this. It is the role of the developper.

Parameters:
obj - object to write
pos - position in the collection file.
Exceptions:
FODBDataFileException 

Definition at line 248 of file FODBCollectionFile.java.

References org.openmobileis.database.fastobjectdb.db.store.FODBObjectDatabaseFile.rewriteObject(), and org.openmobileis.database.fastobjectdb.db.store.FODBObjectDatabaseFile.seek().

Referenced by org.openmobileis.database.fastobjectdb.db.store.FODBCollectionIndexFile.rewriteHeader(), org.openmobileis.database.fastobjectdb.db.store.FODBCollectionIndexFile.rewriteLongPtr(), org.openmobileis.database.fastobjectdb.db.store.FODBCollectionIndexFile.rewriteNode(), and org.openmobileis.database.fastobjectdb.db.store.FODBCollectionIndexFile.writeNode().

void org.openmobileis.database.fastobjectdb.db.store.FODBCollectionFile.rewriteObjectt Object  obj,
long  pos
throws IOException, ClassNotFoundException
 

Rewrite an object The object has to be the same size it used to be.

The function doesn't check this. It is the role of the developper.

Parameters:
obj - object to write
pos - position in the collection file.
Exceptions:
FODBDataFileException 

Definition at line 303 of file FODBCollectionFile.java.

References org.openmobileis.database.fastobjectdb.db.crypto.FODBCypher.encryptObject(), org.openmobileis.database.fastobjectdb.db.store.FODBObjectDatabaseFile.rewriteObject(), and org.openmobileis.database.fastobjectdb.db.store.FODBObjectDatabaseFile.seek().

void org.openmobileis.database.fastobjectdb.db.store.FODBCollectionFile.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.

Definition at line 133 of file FODBCollectionFile.java.

References org.openmobileis.database.fastobjectdb.db.store.FODBObjectDatabaseFile.close(), org.openmobileis.database.fastobjectdb.db.store.FODBObjectDatabaseFile.open(), and org.openmobileis.database.fastobjectdb.db.store.FODBCollectionFile.rewriteHeader().

Referenced by org.openmobileis.database.fastobjectdb.db.FODBCollection.setCollectionCypher().

void org.openmobileis.database.fastobjectdb.db.store.FODBCollectionFile.writeHeader  )  throws IOException, ClassNotFoundException
 

Write the header at the beginning of the collection file.

Exceptions:
FODBDataFileException 

Definition at line 334 of file FODBCollectionFile.java.

References org.openmobileis.database.fastobjectdb.db.store.FODBObjectDatabaseFile.rewind(), and org.openmobileis.database.fastobjectdb.db.store.FODBObjectDatabaseFile.writeObject().

long org.openmobileis.database.fastobjectdb.db.store.FODBCollectionFile.writeNode Object  obj  )  throws IOException, ClassNotFoundException
 

Write an object.

Parameters:
obj - object to wright.
Returns:
- the position of the object written.
Exceptions:
FODBDataFileException 

Definition at line 235 of file FODBCollectionFile.java.

References org.openmobileis.database.fastobjectdb.db.store.FODBObjectDatabaseFile.writeObject().

Referenced by org.openmobileis.database.fastobjectdb.db.store.FODBCollectionIndexFile.writeHeader(), org.openmobileis.database.fastobjectdb.db.store.FODBCollectionIndexFile.writeLongPtr(), and org.openmobileis.database.fastobjectdb.db.store.FODBCollectionIndexFile.writeNode().

long org.openmobileis.database.fastobjectdb.db.store.FODBCollectionFile.writeObject Object  obj  )  throws IOException, ClassNotFoundException
 

Write an object.

Parameters:
obj - object to wright.
Returns:
- the position of the object written.
Exceptions:
FODBDataFileException 

Definition at line 280 of file FODBCollectionFile.java.

References org.openmobileis.database.fastobjectdb.db.crypto.FODBCypher.encryptObject(), and org.openmobileis.database.fastobjectdb.db.store.FODBObjectDatabaseFile.writeObject().

Referenced by org.openmobileis.database.fastobjectdb.db.FODBCollection.addElement().


The documentation for this class was generated from the following file:
Generated on Thu Oct 6 10:06:40 2005 for OpenMobileIS by  doxygen 1.4.3