org.gcube.messaging.common.consumer.db
Class MonitoringDBManager

java.lang.Object
  extended by org.gcube.messaging.common.consumer.db.DBManager
      extended by org.gcube.messaging.common.consumer.db.MonitoringDBManager
All Implemented Interfaces:
java.lang.Runnable

public class MonitoringDBManager
extends DBManager
implements java.lang.Runnable

Author:
Andrea Manzi(CERN)

Nested Class Summary
 
Nested classes/interfaces inherited from class org.gcube.messaging.common.consumer.db.DBManager
DBManager.BaseConsumer
 
Constructor Summary
MonitoringDBManager()
          Constructor
 
Method Summary
 void associateUserAndDomain(java.lang.String userMail, java.lang.String domain, java.lang.String scope)
          Associate a user to a domain
 void cleanMonitoringConf(java.lang.String scope)
          clean the given table
 java.sql.ResultSet getDomains()
           
 void insertDomain(java.lang.String domain, java.lang.String siteName)
          Insert a domain on the DB
 void InsertGHNMessage(org.gcube.messaging.common.messages.GHNMessage<?> message)
          Insert a GHNMessage on the DB
 void insertNotification(Notification not)
          insert a Notification on the DB
 void InsertRIMessage(org.gcube.messaging.common.messages.RIMessage<?> message)
          Insert a RIMessage
 void insertUser(MailRecipientHelper.MonitorUser user)
          Insert a user on the DB
 void open()
          Load the HSQL Database Engine JDBC driver and open the connection to the db.
 void run()
          
 
Methods inherited from class org.gcube.messaging.common.consumer.db.DBManager
backup, close, query, queryAndConsume, queryDBRS, queryJSON, toJSon, update
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MonitoringDBManager

public MonitoringDBManager()
Constructor

Method Detail

open

public void open()
          throws java.lang.ClassNotFoundException,
                 java.sql.SQLException,
                 java.lang.Exception
Load the HSQL Database Engine JDBC driver and open the connection to the db.

Specified by:
open in class DBManager
Throws:
java.lang.ClassNotFoundException - if the HSQL Database Engine JDBC driver is not loaded
java.sql.SQLException - if the connection to the db fails
java.lang.Exception - if the tables creation fails

insertUser

public void insertUser(MailRecipientHelper.MonitorUser user)
Insert a user on the DB

Parameters:
user - the user to add

getDomains

public java.sql.ResultSet getDomains()
Returns:
the domains

insertDomain

public void insertDomain(java.lang.String domain,
                         java.lang.String siteName)
Insert a domain on the DB

Parameters:
domain - the domain to add

associateUserAndDomain

public void associateUserAndDomain(java.lang.String userMail,
                                   java.lang.String domain,
                                   java.lang.String scope)
Associate a user to a domain

Parameters:
userMail - the userMail to add
domain - the domain to add

cleanMonitoringConf

public void cleanMonitoringConf(java.lang.String scope)
clean the given table

Parameters:
tableName -

InsertGHNMessage

public void InsertGHNMessage(org.gcube.messaging.common.messages.GHNMessage<?> message)
Insert a GHNMessage on the DB

Parameters:
message - the Message

InsertRIMessage

public void InsertRIMessage(org.gcube.messaging.common.messages.RIMessage<?> message)
Insert a RIMessage

Parameters:
message - message

insertNotification

public void insertNotification(Notification not)
insert a Notification on the DB

Parameters:
notification - the notification

run

public void run()

Specified by:
run in interface java.lang.Runnable