org.edg.info
Class CleanableInstance

java.lang.Object
  extended byorg.edg.info.InstanceBase
      extended byorg.edg.info.DeclarableInstance
          extended byorg.edg.info.InsertableInstance
              extended byorg.edg.info.CleanableInstance
Direct Known Subclasses:
DBProducerInstance, LatestProducerInstance

public abstract class CleanableInstance
extends InsertableInstance

Base class for database (history and latest) producers.


Nested Class Summary
 class CleanableInstance.CleanUpThread
          Thread used to clean up database in DBProducer
 
Field Summary
static java.lang.String s_dbAdminDriver
          Driver for the admin database.
static java.lang.String s_dbAdminPassword
          Password of the admin user.
static java.lang.String s_dbAdminURL
          DB URL of the main admin user (required to create new databases).
static java.lang.String s_dbAdminUserName
          Username of the admin user.
 
Fields inherited from class org.edg.info.InstanceBase
DEFAULT_TERMINATION_INTERVAL_MS, s_maxTerminationInterval, s_minTerminationInterval
 
Method Summary
 void abort(java.lang.String consumerURL, int consumerId)
          Aborts the one-time query belonging to the specified consumer.
 void declareTable(java.lang.String tableName, java.lang.String predicate, int hrpSec, int lrpSec)
          Declares table in Registry (via call to supertype) and creates table in database.
 void declareTable(java.lang.String tableName, java.lang.String predicate, java.lang.String cleanUpPredicate, long cleanUpInterval, int hrpSec, int lrpSec)
          Declares a table in this producer.
 void destroy()
          Destroys a CleanableInstance.
 org.glite.rgma.system.ResultSet execute(java.lang.String select)
          Deprecated.  
 void execute(java.lang.String select, java.lang.String consumerURL, int consumerId, java.lang.String streamingUrl, int streamingPort, long timeoutMS, int consumerBufferSize)
          Executes the specified SQL SELECT statement on this producer and sends the results to the specified consumer via streaming.
 void undeclareTable(java.lang.String tableName)
          Deprecated.  
 
Methods inherited from class org.edg.info.InsertableInstance
canDestroy, declareAsArchiver, getConsumerConnections, getHistoryRetentionPeriod, getLatestRetentionPeriod, getMaxBufferSize, getMinRetentionPeriod, getQueueTracker, getRetentionPeriods, insert, isAutoInsertTimestampEnabled, setAutoInsertTimestamp, setMinRetentionPeriod, startStreaming, stopStreaming, streamTuples
 
Methods inherited from class org.edg.info.DeclarableInstance
declareTable, getProducerType, updateRegistry
 
Methods inherited from class org.edg.info.InstanceBase
disconnect, getLastRegistryUpdateTimeMillis, getRegistryUpdateIntervalMillis, getResourceId, getStatus, getTerminationInterval, getTerminationIntervalMillis, getUserLastContactTimeMillis, isDestroyed, isTupleCheckingEnabled, notifyRegistrationThread, reconnect, setCloseCalled, setDestroyed, setRegistrationThread, setTerminationInterval, showSignOfLife, updateLastContactTime, wasCloseCalled
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

s_dbAdminURL

public static java.lang.String s_dbAdminURL
DB URL of the main admin user (required to create new databases).


s_dbAdminPassword

public static java.lang.String s_dbAdminPassword
Password of the admin user.


s_dbAdminUserName

public static java.lang.String s_dbAdminUserName
Username of the admin user.


s_dbAdminDriver

public static java.lang.String s_dbAdminDriver
Driver for the admin database.

Method Detail

declareTable

public void declareTable(java.lang.String tableName,
                         java.lang.String predicate,
                         int hrpSec,
                         int lrpSec)
                  throws org.glite.rgma.system.RGMAUserException,
                         org.glite.rgma.system.RGMAInternalException
Declares table in Registry (via call to supertype) and creates table in database.

Overrides:
declareTable in class InsertableInstance
Parameters:
tableName - Name of table to declare
predicate - Predicate (can be empty string)
hrpSec - History retention period (in seconds).
lrpSec - Latest retention period (in seconds).
Throws:
org.glite.rgma.system.RGMAUserException
org.glite.rgma.system.RGMAInternalException
See Also:
DeclarableInstance.declareTable(String, String)

execute

public void execute(java.lang.String select,
                    java.lang.String consumerURL,
                    int consumerId,
                    java.lang.String streamingUrl,
                    int streamingPort,
                    long timeoutMS,
                    int consumerBufferSize)
             throws org.glite.rgma.system.RGMAException
Executes the specified SQL SELECT statement on this producer and sends the results to the specified consumer via streaming.

Parameters:
select - SQL SELECT query
consumerURL - URL of Consumer; used to uniquely identify this execution.
consumerId - ID of consumer to send data.
streamingUrl - URL to stream data.
streamingPort - Port to stream data.
Throws:
org.glite.rgma.system.RGMAException

execute

public org.glite.rgma.system.ResultSet execute(java.lang.String select)
                                        throws org.glite.rgma.system.RGMAException
Deprecated.  

Executes a select query. This has been synchronized in case a close() occurs.

Parameters:
select - the sql select query
Returns:
a ResultSet
Throws:
org.glite.rgma.system.RGMAException - if the instance is disconnected; if there's a problem with the query.

destroy

public void destroy()
Destroys a CleanableInstance. This method will also close the dbConnection. If undeclareTable() is called while close is removing all the CleanupThread Objects an order must be forced.

Overrides:
destroy in class InsertableInstance

declareTable

public void declareTable(java.lang.String tableName,
                         java.lang.String predicate,
                         java.lang.String cleanUpPredicate,
                         long cleanUpInterval,
                         int hrpSec,
                         int lrpSec)
                  throws org.glite.rgma.system.RGMAException
Declares a table in this producer.

Parameters:
tableName - Name of table.
predicate - SQL WHERE clause.
cleanUpPredicate - Clean-up WHERE clause.
cleanUpInterval - Clean-up interval (in millis).
hrpSec - History retention period (in seconds).
lrpSec - Latest retention period (in seconds).
Throws:
org.glite.rgma.system.RGMAException

undeclareTable

public void undeclareTable(java.lang.String tableName)
                    throws org.glite.rgma.system.RGMAException
Deprecated.  

Stops the cleanUp thread.

Overrides:
undeclareTable in class DeclarableInstance
Parameters:
tableName - Name of table to undeclare
Throws:
org.glite.rgma.system.RGMAException

abort

public void abort(java.lang.String consumerURL,
                  int consumerId)
Aborts the one-time query belonging to the specified consumer.

Parameters:
consumerURL -
consumerId -