MonitoredEntities
Class Persistence

java.lang.Object
  |
  +--MonitoredEntities.Persistence

public class Persistence
extends java.lang.Object

Store and restore the state of entity, entity type and parameter objects on persistent storage. Encapsultes all the code necessary for storing and restoring the state of entity, entity type and parameters objects on persistent storage. This version uses jdbc to connect to mm, a driver to my_sql database.


Constructor Summary
Persistence(java.lang.String dbmachine)
          Store the machine where the database must be running and conects to it.
 
Method Summary
 void connect()
          Establish connection with database adaptacao.
 void EDeleteState(java.lang.String meid)
          Deletes the state of entity object identified by meid from persistent storage.
 boolean EExist(java.lang.String meid)
          Check if the state of entity identified by meid is stored on database adaptacao.
 java.lang.String EGetRef(java.lang.String meid)
          Returns the stringified ior of the entity identified by meid.
 java.util.Vector ELoadState(java.lang.String meid)
          Returns the state of the entity identified by meid from database adaptacao.
 void ESaveState(java.lang.String meid, java.lang.String ior, java.lang.String metid, java.lang.String description, java.lang.String[] attributes)
          Saves the state of a entity object to database adaptacao.
 void ETDeleteState(java.lang.String metid)
          Deletes the state of entity type object identified by metid from persistent storage.
 boolean ETExist(java.lang.String metid)
          Check if the state of entity type identified by metid is stored on database adaptacao.
 java.lang.String ETGetRef(java.lang.String metid)
          Returns the stringified ior of the entity type identified by metid.
 java.lang.Object[] ETLoadState(java.lang.String metid)
          Returns the state of the entity type identified by metid from database adaptacao.
 boolean ETRIViolate(java.lang.String metid)
          Checks if there is entity or parameter objects related to entity type metid.
 void ETSaveState(java.lang.String metid, java.lang.String ior, java.lang.String description)
          Saves the state of a entity type object to database adaptacao.
 void PDeleteState(java.lang.String pid)
          Deletes the state of parameter object identified by pid from persistent storage.
 boolean PExist(java.lang.String pid)
          Check if the state of the parameter identified by pid is stored on database adaptacao.
 java.lang.String PGetRef(java.lang.String pid)
          Returns the stringified ior of the parameter identified by pid.
 java.util.Vector PLoadState(java.lang.String pid)
          Returns the state of the parameter identified by pid from database adaptacao.
 void PSaveState(java.lang.String pid, java.lang.String ior, java.lang.String metid, java.lang.String description, MonitoredEntities.range[] range_list)
          Saves the state of a parameter object to database adaptacao.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Persistence

public Persistence(java.lang.String dbmachine)
Store the machine where the database must be running and conects to it. Receives the name of the machine where mySQL server must be running and then calls the method responsible for connecting with the database adaptacao that stores the state of resource event objects
Parameters:
dbmachine - the name of the machine where database adaptacao resides
Method Detail

connect

public void connect()
Establish connection with database adaptacao. Database adaptacao must reside on the machine specified by dbmachine variable. This database must have a defined user called fssilva, password AdAptA with access rights to READ, UPDATE, DELETE and ADD tuples to the database tables.

ETSaveState

public void ETSaveState(java.lang.String metid,
                        java.lang.String ior,
                        java.lang.String description)
Saves the state of a entity type object to database adaptacao. The state of entity type objects are saved to a table called entity_type.

ETRIViolate

public boolean ETRIViolate(java.lang.String metid)
Checks if there is entity or parameter objects related to entity type metid. This method is used to verify if there will be an relational integrity violation if entity type identified by metid is deleted. This is done by verifying if there is entity or parameter objects related to entity type meid.
Parameters:
metid - the identification of the entity type object
Returns:
true, if there is entity or parameter objects related to entity type metid, false otherwise.

ETDeleteState

public void ETDeleteState(java.lang.String metid)
Deletes the state of entity type object identified by metid from persistent storage.
Parameters:
metid - identification of the entity type object to be deleted

ETExist

public boolean ETExist(java.lang.String metid)
Check if the state of entity type identified by metid is stored on database adaptacao.
Parameters:
metid - identification of the entity type
Returns:
true if metid is found and false otherwise.

ETGetRef

public java.lang.String ETGetRef(java.lang.String metid)
Returns the stringified ior of the entity type identified by metid.
Parameters:
metid - identification of the entity type
Returns:
the stringified ior of the entity type

ETLoadState

public java.lang.Object[] ETLoadState(java.lang.String metid)
Returns the state of the entity type identified by metid from database adaptacao.
Parameters:
metid - identification of the entity type
Returns:
an array of objects containing the state of the entity type

ESaveState

public void ESaveState(java.lang.String meid,
                       java.lang.String ior,
                       java.lang.String metid,
                       java.lang.String description,
                       java.lang.String[] attributes)
Saves the state of a entity object to database adaptacao. The state of entity objects are saved to a table called entity.

EDeleteState

public void EDeleteState(java.lang.String meid)
Deletes the state of entity object identified by meid from persistent storage.
Parameters:
meid - identification of the entity object to be deleted

EExist

public boolean EExist(java.lang.String meid)
Check if the state of entity identified by meid is stored on database adaptacao.
Parameters:
meid - identification of the entity
Returns:
true if meid is found and false otherwise.

EGetRef

public java.lang.String EGetRef(java.lang.String meid)
Returns the stringified ior of the entity identified by meid.
Parameters:
meid - identification of the entity
Returns:
the stringified ior of the entity

ELoadState

public java.util.Vector ELoadState(java.lang.String meid)
Returns the state of the entity identified by meid from database adaptacao.
Parameters:
meid - identification of the entity
Returns:
an vector of objects containing the state of the entity

PSaveState

public void PSaveState(java.lang.String pid,
                       java.lang.String ior,
                       java.lang.String metid,
                       java.lang.String description,
                       MonitoredEntities.range[] range_list)
Saves the state of a parameter object to database adaptacao. The state of parameter objects are saved to a table called parameter.

PDeleteState

public void PDeleteState(java.lang.String pid)
Deletes the state of parameter object identified by pid from persistent storage.
Parameters:
pid - identification of the parameter object to be deleted

PExist

public boolean PExist(java.lang.String pid)
Check if the state of the parameter identified by pid is stored on database adaptacao.
Parameters:
pid - identification of the parameter
Returns:
true if pid is found and false otherwise.

PGetRef

public java.lang.String PGetRef(java.lang.String pid)
Returns the stringified ior of the parameter identified by pid.
Parameters:
pid - identification of the parameter
Returns:
the stringified ior of the parameter

PLoadState

public java.util.Vector PLoadState(java.lang.String pid)
Returns the state of the parameter identified by pid from database adaptacao.
Parameters:
pid - identification of the parameter
Returns:
an vector of objects containing the state of the parameter