gr.demokritos.iit.jinsect.storage
Class INSECTFileDB<TObjectType extends java.io.Serializable>

java.lang.Object
  extended by gr.demokritos.iit.jinsect.storage.INSECTDB
      extended by gr.demokritos.iit.jinsect.storage.INSECTFileDB<TObjectType>
All Implemented Interfaces:
java.io.Serializable

public class INSECTFileDB<TObjectType extends java.io.Serializable>
extends INSECTDB
implements java.io.Serializable

A file database that uses a single file per stored object.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class gr.demokritos.iit.jinsect.storage.INSECTDB
CATEGORY_TYPE, DOCUMENT_TYPE
 
Constructor Summary
INSECTFileDB()
           
INSECTFileDB(java.lang.String sPrefix, java.lang.String sBaseDir)
          Creates a new instance of INSECTFileDB
 
Method Summary
 void deleteObject(java.lang.String sObjectName, java.lang.String sObjectCategory)
          Deletes a given object from the database.
 boolean existsObject(java.lang.String sObjectName, java.lang.String sObjectCategory)
          Checks whether a given object exists in the database.
 java.lang.String getObjDataToString(java.lang.Object oObject)
          Returns a string representation of a given object.
 java.lang.String[] getObjectList(java.lang.String sObjectCategory)
          Returns an array of object names for a given category.
 TObjectType getStringToObjData(java.lang.String sData)
          Converts a string representation to an object equivalent.
 TObjectType loadObject(java.lang.String sObjectName, java.lang.String sObjectCategory)
          Loads a given Serializable object, with a given name and a given category from the database.
 void saveObject(java.io.Serializable oObj, java.lang.String sObjectName, java.lang.String sObjectCategory)
          Saves a given Serializable object, with a given name and a given category.
 
Methods inherited from class gr.demokritos.iit.jinsect.storage.INSECTDB
finalizeDB
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

INSECTFileDB

public INSECTFileDB()

INSECTFileDB

public INSECTFileDB(java.lang.String sPrefix,
                    java.lang.String sBaseDir)
Creates a new instance of INSECTFileDB

Method Detail

saveObject

public void saveObject(java.io.Serializable oObj,
                       java.lang.String sObjectName,
                       java.lang.String sObjectCategory)
Description copied from class: INSECTDB
Saves a given Serializable object, with a given name and a given category.

Specified by:
saveObject in class INSECTDB
Parameters:
oObj - The object to save.
sObjectName - The name (and unique identifier within the category) of the object.
sObjectCategory - The category of the object.

loadObject

public TObjectType loadObject(java.lang.String sObjectName,
                              java.lang.String sObjectCategory)
Description copied from class: INSECTDB
Loads a given Serializable object, with a given name and a given category from the database.

Specified by:
loadObject in class INSECTDB
Parameters:
sObjectName - The name (and unique identifier within the category) of the object.
sObjectCategory - The category of the saved object.
Returns:
The loaded object.

deleteObject

public void deleteObject(java.lang.String sObjectName,
                         java.lang.String sObjectCategory)
Description copied from class: INSECTDB
Deletes a given object from the database.

Specified by:
deleteObject in class INSECTDB
Parameters:
sObjectName - The name (and unique identifier within the category) of the object.
sObjectCategory - The category of the saved object.

existsObject

public boolean existsObject(java.lang.String sObjectName,
                            java.lang.String sObjectCategory)
Description copied from class: INSECTDB
Checks whether a given object exists in the database.

Overrides:
existsObject in class INSECTDB
Parameters:
sObjectName - The name (and unique identifier within the category) of the object.
sObjectCategory - The category of the saved object.
Returns:
True if the object exists, otherwise false.

getObjectList

public java.lang.String[] getObjectList(java.lang.String sObjectCategory)
Description copied from class: INSECTDB
Returns an array of object names for a given category.

Overrides:
getObjectList in class INSECTDB
Parameters:
sObjectCategory - The required category of the objects.
Returns:
An String array, with all the saved objects corresponding to the given category.

getObjDataToString

public java.lang.String getObjDataToString(java.lang.Object oObject)
Description copied from class: INSECTDB
Returns a string representation of a given object.

Specified by:
getObjDataToString in class INSECTDB
Parameters:
oObject - The object to represent.
Returns:
The string representation of the object.

getStringToObjData

public TObjectType getStringToObjData(java.lang.String sData)
Description copied from class: INSECTDB
Converts a string representation to an object equivalent.

Specified by:
getStringToObjData in class INSECTDB
Parameters:
sData - The string representation of the object.
Returns:
The represented object.