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

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

public abstract class INSECTDB<TObjectType extends java.io.Serializable>
extends java.lang.Object

This class describes a database interface, that supports categorized objects.


Field Summary
static java.lang.String CATEGORY_TYPE
           
static java.lang.String DOCUMENT_TYPE
           
 
Constructor Summary
INSECTDB()
          Creates a new instance of ObjectDB
 
Method Summary
abstract  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.
 void finalizeDB()
          Finalizes db.
abstract  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.
abstract  TObjectType getStringToObjData(java.lang.String sData)
          Converts a string representation to an object equivalent.
abstract  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.
abstract  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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CATEGORY_TYPE

public static java.lang.String CATEGORY_TYPE

DOCUMENT_TYPE

public static java.lang.String DOCUMENT_TYPE
Constructor Detail

INSECTDB

public INSECTDB()
Creates a new instance of ObjectDB

Method Detail

finalizeDB

public void finalizeDB()
Finalizes db. Descendants should perform finalization operations in this member.


saveObject

public abstract 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.

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 abstract 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.

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 abstract void deleteObject(java.lang.String sObjectName,
                                  java.lang.String sObjectCategory)
Deletes a given object from the database.

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)
Checks whether a given object exists in the database.

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)
Returns an array of object names for a given category.

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

getObjDataToString

public abstract java.lang.String getObjDataToString(java.lang.Object oObject)
Returns a string representation of a given object.

Parameters:
oObject - The object to represent.
Returns:
The string representation of the object.

getStringToObjData

public abstract TObjectType getStringToObjData(java.lang.String sData)
Converts a string representation to an object equivalent.

Parameters:
sData - The string representation of the object.
Returns:
The represented object.