EventEvaluator.Resource
Class Persistence

java.lang.Object
  |
  +--EventEvaluator.Resource.Persistence

public class Persistence
extends java.lang.Object

Encapsulates all the code responsible for saving the state of resource event objects to persistent storage.

This code is based on mySQL relational database and uses JDBC to access the database.


Constructor Summary
Persistence(java.lang.String dbmachine)
          Ask for connection with adapatacao database.
 
Method Summary
 void connect()
          Establish connection with database adaptacao.
 void REDeleteState(java.lang.String eid)
          Deletes the state of resource event evaluator identified by eid from persistent storage.
 boolean REExist(java.lang.String eid)
          Check if the state of resource event evaluator identified by eid is stored on database adaptacao.
 java.lang.String REGetRef(java.lang.String eid)
          Returns the stringified ior of the resource event evaluator identified by eid.
 java.lang.Object[] RELoadState(java.lang.String eid)
          Returns the state of the resource event evaluator identified by eid from database adaptacao.
 void RESaveState(java.lang.String eid, java.lang.String ior, java.lang.String description, java.lang.String expression, int duration_time, java.lang.String ior_metype)
          Saves the state of a resource event 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)
Ask for connection with adapatacao database. 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.

RESaveState

public void RESaveState(java.lang.String eid,
                        java.lang.String ior,
                        java.lang.String description,
                        java.lang.String expression,
                        int duration_time,
                        java.lang.String ior_metype)
Saves the state of a resource event object to database adaptacao. The state of resource event objects are saved to a table called resource_event.
Parameters:
eid - the id of the resource event
ior - the strigified ior of the resource event
description - the string description of the resource event
expression - the expression that defines the resource event
duration_time - the duration time that the expression must stay true in order to trigger the event
ior_metype - the stringified ior of the monitored entity type related with the event

REDeleteState

public void REDeleteState(java.lang.String eid)
Deletes the state of resource event evaluator identified by eid from persistent storage.
Parameters:
eid - identification of the resource event evaluator to be deleted

REExist

public boolean REExist(java.lang.String eid)
Check if the state of resource event evaluator identified by eid is stored on database adaptacao.
Parameters:
eid - identification of the resource event evaluator
Returns:
true if eid is found and false otherwise.

REGetRef

public java.lang.String REGetRef(java.lang.String eid)
Returns the stringified ior of the resource event evaluator identified by eid.
Parameters:
eid - identification of the resource event evaluator
Returns:
the stringified ior of the resource event evaluator

RELoadState

public java.lang.Object[] RELoadState(java.lang.String eid)
Returns the state of the resource event evaluator identified by eid from database adaptacao.
Parameters:
eid - identification of the resource event evaluator
Returns:
an array of objects containing the state of the event evaluator