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

java.lang.Object
  extended by gr.demokritos.iit.jinsect.storage.INSECTDB
      extended by gr.demokritos.iit.jinsect.storage.INSECTMemoryDB<TObjectType>
Direct Known Subclasses:
INSECTCompressedMemoryDB

public class INSECTMemoryDB<TObjectType extends java.io.Serializable>
extends INSECTDB


Field Summary
protected  java.util.HashMap ObjectMap
          The map object used to look up objects.
 
Fields inherited from class gr.demokritos.iit.jinsect.storage.INSECTDB
CATEGORY_TYPE, DOCUMENT_TYPE
 
Constructor Summary
INSECTMemoryDB()
          Creates a new instance of INSECTMemoryDB
 
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.
protected  java.lang.String getObjectName(java.lang.String sObjectName, java.lang.String sObjectCategory)
           
 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
 

Field Detail

ObjectMap

protected java.util.HashMap ObjectMap
The map object used to look up objects.

Constructor Detail

INSECTMemoryDB

public INSECTMemoryDB()
Creates a new instance of INSECTMemoryDB

Method Detail

getObjectName

protected java.lang.String getObjectName(java.lang.String sObjectName,
                                         java.lang.String sObjectCategory)

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.