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

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 50 of file FODBCollectionFile.java.

Public Member Functions

boolean isSynchronized ()
FODBCypher getCollectionCypher () throws FODBException
 return the collection cypher if any, null otherwise.
boolean isCompressed ()
 if isCompressed return true, all stored data object are zipped.
void setCollectionCypher (FODBCypher cypher) throws FODBException
 Init collection encryption with the specified cypher.
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.
FODBCollectionDescriptor getDescriptor ()
String toString ()
 Used for debugging.

Static Public Member Functions

static FODBCollectionFile createCollection (String filePath, FODBCollectionDescriptor descriptor, 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 197 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,
FODBCollectionDescriptor  descriptor,
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 171 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 366 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 125 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 420 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().

boolean org.openmobileis.database.fastobjectdb.db.store.FODBCollectionFile.isCompressed  ) 
 

if isCompressed return true, all stored data object are zipped.

The compressed behaviour is defined by the FODBCollection descriptor. To gzip collection allow to gain around 25% of the collection file length but increase the synhro file size for complete synchro.

Parameters:
gzip 

Definition at line 136 of file FODBCollectionFile.java.

References org.openmobileis.database.fastobjectdb.db.store.FODBCollectionFileHeader.getDescriptor(), and org.openmobileis.database.fastobjectdb.FODBCollectionDescriptor.isCompressed().

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 182 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 393 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 232 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 269 of file FODBCollectionFile.java.

References org.openmobileis.database.fastobjectdb.db.crypto.FODBCypher.decryptObject(), org.openmobileis.database.fastobjectdb.db.store.FODBCollectionFileHeader.getDescriptor(), org.openmobileis.database.fastobjectdb.FODBCollectionDescriptor.isCompressed(), 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 257 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 345 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 147 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 376 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 244 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 303 of file FODBCollectionFile.java.

References org.openmobileis.database.fastobjectdb.db.crypto.FODBCypher.encryptObject(), org.openmobileis.database.fastobjectdb.db.store.FODBCollectionFileHeader.getDescriptor(), org.openmobileis.database.fastobjectdb.FODBCollectionDescriptor.isCompressed(), 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 Wed Dec 14 21:05:38 2005 for OpenMobileIS by  doxygen 1.4.4