konark.manager
Class SMSAgent

java.lang.Object
  extended byajanta.agent.Agent
      extended bykonark.manager.BasicMonitoringAgent
          extended bykonark.manager.MonitoringAgent
              extended bykonark.manager.SMSAgent
All Implemented Interfaces:
Monitor, java.rmi.Remote, java.io.Serializable, SMSAgentInterface, Subscriber

public class SMSAgent
extends MonitoringAgent
implements SMSAgentInterface

See Also:
Serialized Form

Field Summary
protected  java.util.Hashtable listOfEventSubscribers
          A hash table of GUI subscriber URLs
protected  java.util.Hashtable urlToEventVector
          A hash table that maintains url to event list mapping
 
Fields inherited from class konark.manager.MonitoringAgent
dbpasswd, dburl, dbuser, monitoringEvents, monitoringInfo, outstandingMonList
 
Fields inherited from class konark.manager.BasicMonitoringAgent
dbModule, defaultSubscriber, eventIDGenerator, eventTable, keepRunning, localTriggerTable, remoteTriggerTable, reportedEventList, sql, subscriberHashtable
 
Fields inherited from class ajanta.agent.Agent
creatorSignature, cred, host, myRef, name, ownerSignature, status
 
Constructor Summary
SMSAgent(ajanta.agent.Credentials cred)
           
SMSAgent(ajanta.agent.Credentials cred, java.util.Hashtable monInfo, java.lang.String dburl, java.lang.String dbuser, java.lang.String dbpasswd, java.lang.Boolean ifSql, ajanta.naming.URN defSubURN)
           
 
Method Summary
 void abortConfig(java.lang.String configHandle)
          Interface method to terminate all agents in a configuration object launched by this SMS Called by proxy object
 void addAndLaunchAgents(java.lang.String filename, java.lang.String configHandle)
          Interface method to launch an agent Called by proxy object
 void addDetector(ajanta.naming.URN agentURN, java.lang.String eventDetector, java.lang.String eventHandler)
          Interface method to install an detector remotely Called by the proxy object
 void addHandlerPostAction(EventHandler handler)
           
 void addNewSubscription(ajanta.naming.URN publisherURN, ajanta.naming.URN subscriberURN, java.lang.String eventName, java.lang.String eventHandler)
          Interface method to add a subscription to an agent Called by the proxy object
 void agentReached(ajanta.naming.URN agentURN)
          Synchronization method: agent informs SMSAgent on reaching destination
 void executeBeforeRun()
          Initial setup before SMSAgent can run: 1) Create the ConfigManager object and set handle 2) Setup the proxy/interface for the GUI to interact 3) Subscribe to Failure detectors
 void forceRun(ajanta.naming.URN agentURN)
          Remote Interface method indicating that an agent would like to start running even though it has not subscribed to all
 java.util.Vector getConfigHandleList()
          Remote Interface method to get a list of config handles from an SMSAgent
 ConfigObject getConfigObject(java.lang.String configHandle)
          Interface method to get configuration object from an agent Called by proxy object
 void launchConfig(java.lang.String configHandle)
          Interface method to launch a configuration given the configuration id Called by the proxy object
 void launchConfigRestartMode(java.lang.String configHandle)
          Interface method to launch a configuration in restart mode called by the proxy object
 void modifyDetectorOnAgent(ajanta.naming.URN agentURN, java.lang.String eventDetector, java.lang.Object[] object)
          Remote Interface method to modify an agent's detector
 void readConfigFile(java.lang.String filename, java.lang.String configHandle)
          Interface method to read a configuration file and set it to a configuration name/id/handle Called by the proxy object
 void registerForEvents(java.lang.String configHandle, java.lang.String url, java.util.Vector eventList)
          Overloaded method for handling events taken from the Event queue of the SMSAgent /** register for interesting events from the default subscriber
 void registerForHostStatusEvents(java.lang.String clientURL, java.util.Vector configHandles)
           
 void registerGUI(java.lang.String url)
           
 void removeDetectorOnAgent(ajanta.naming.URN agentURN, java.lang.String detectorName)
          Remote Interface method to remove a detector from an agent
 void removeSubscribeRelation(ajanta.naming.URN publisherURN, ajanta.naming.URN subscriberURN, java.lang.String eventName)
          Method to remove the publish-subscribe relation
 void setBackupInfoForConfig(java.lang.String configHandle, java.lang.String baseDir, java.lang.String baseFileName)
           
 boolean startRun(ajanta.naming.URN agentURN)
          Synchronization method instructing the agent to start running
 boolean startSubscription(ajanta.naming.URN agentURN)
          Synchronization method instructing the agent to start subscribing to other agents
 void terminateChildAgent(ajanta.naming.URN agentURN)
          Interface method to terminate agent launched by this SMS Called by proxy object
 void test(java.lang.String e)
           
 void unregisterForAllHostStatusEvents(java.lang.String clientURL)
           
 void unregisterForEvents(java.lang.String configHandle, java.lang.String url, java.util.Vector v)
          register for interesting events from the default subscriber
 
Methods inherited from class konark.manager.MonitoringAgent
addSubscription, createObject, handlerAction, removeSubscription, report, resubscribe, startEventMachinery
 
Methods inherited from class konark.manager.BasicMonitoringAgent
addEvent, addEvent, addEventDetector, addEventHandler, addOldSynchornizerObjects, addSubscriber, arrive, deleteEvent, deleteSubscriber, deleteSubscriber, depart, getDefaultSubscriber, getEventIDGenerator, modifyDetector, printRunningThreads, removeDetector, replaceEventDetector, replaceEventHandler, restoreDetector, run, setAlarmLevel, setAlertLevel, showSubscribers, stopAgent, subscribeEvent, subscribeEvent, switchOffPrintRunningThreads, unsubscribeEvent, viewEventTable
 
Methods inherited from class ajanta.agent.Agent
agentEntry, agentExit, colocate, colocate, meet, recallCommand, signCreator, signOwner, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface konark.manager.Monitor
addEvent, addEvent, addEventDetector, addEventHandler, addSubscriber, deleteEvent, deleteSubscriber, modifyDetector, printRunningThreads, removeDetector, replaceEventDetector, replaceEventHandler, restoreDetector, setAlarmLevel, setAlertLevel, stopAgent, switchOffPrintRunningThreads
 
Methods inherited from interface konark.manager.Subscriber
addSubscription, removeSubscription, report, resubscribe, subscribeEvent, subscribeEvent, unsubscribeEvent
 

Field Detail

listOfEventSubscribers

protected java.util.Hashtable listOfEventSubscribers
A hash table of GUI subscriber URLs


urlToEventVector

protected java.util.Hashtable urlToEventVector
A hash table that maintains url to event list mapping

Constructor Detail

SMSAgent

public SMSAgent(ajanta.agent.Credentials cred)
Parameters:
cred -

SMSAgent

public SMSAgent(ajanta.agent.Credentials cred,
                java.util.Hashtable monInfo,
                java.lang.String dburl,
                java.lang.String dbuser,
                java.lang.String dbpasswd,
                java.lang.Boolean ifSql,
                ajanta.naming.URN defSubURN)
Parameters:
cred -
monInfo -
dburl -
dbuser -
dbpasswd -
ifSql -
defSubURN -
Method Detail

executeBeforeRun

public void executeBeforeRun()
Initial setup before SMSAgent can run: 1) Create the ConfigManager object and set handle 2) Setup the proxy/interface for the GUI to interact 3) Subscribe to Failure detectors

Overrides:
executeBeforeRun in class MonitoringAgent

test

public void test(java.lang.String e)
          throws java.rmi.RemoteException
Specified by:
test in interface SMSAgentInterface
Throws:
java.rmi.RemoteException

readConfigFile

public void readConfigFile(java.lang.String filename,
                           java.lang.String configHandle)
                    throws java.lang.Exception
Interface method to read a configuration file and set it to a configuration name/id/handle Called by the proxy object

Specified by:
readConfigFile in interface SMSAgentInterface
Parameters:
filename -
configHandle -
Throws:
java.lang.Exception

setBackupInfoForConfig

public void setBackupInfoForConfig(java.lang.String configHandle,
                                   java.lang.String baseDir,
                                   java.lang.String baseFileName)
                            throws java.lang.Exception
Specified by:
setBackupInfoForConfig in interface SMSAgentInterface
Throws:
java.lang.Exception

launchConfigRestartMode

public void launchConfigRestartMode(java.lang.String configHandle)
                             throws java.lang.Exception
Interface method to launch a configuration in restart mode called by the proxy object

Specified by:
launchConfigRestartMode in interface SMSAgentInterface
Parameters:
configHandle -
Throws:
java.lang.Exception

launchConfig

public void launchConfig(java.lang.String configHandle)
                  throws java.lang.Exception
Interface method to launch a configuration given the configuration id Called by the proxy object

Specified by:
launchConfig in interface SMSAgentInterface
Parameters:
configHandle -
Throws:
java.lang.Exception

addDetector

public void addDetector(ajanta.naming.URN agentURN,
                        java.lang.String eventDetector,
                        java.lang.String eventHandler)
                 throws java.lang.Exception
Interface method to install an detector remotely Called by the proxy object

Specified by:
addDetector in interface SMSAgentInterface
Parameters:
agentURN -
eventDetector -
eventHandler -
Throws:
java.lang.Exception

addNewSubscription

public void addNewSubscription(ajanta.naming.URN publisherURN,
                               ajanta.naming.URN subscriberURN,
                               java.lang.String eventName,
                               java.lang.String eventHandler)
                        throws java.lang.Exception
Interface method to add a subscription to an agent Called by the proxy object

Specified by:
addNewSubscription in interface SMSAgentInterface
Parameters:
publisherURN -
subscriberURN -
eventName -
eventHandler -
Throws:
java.lang.Exception

getConfigObject

public ConfigObject getConfigObject(java.lang.String configHandle)
                             throws java.lang.Exception
Interface method to get configuration object from an agent Called by proxy object

Specified by:
getConfigObject in interface SMSAgentInterface
Parameters:
configHandle -
Throws:
java.lang.Exception

terminateChildAgent

public void terminateChildAgent(ajanta.naming.URN agentURN)
                         throws java.lang.Exception
Interface method to terminate agent launched by this SMS Called by proxy object

Specified by:
terminateChildAgent in interface SMSAgentInterface
Parameters:
agentURN -
Throws:
java.lang.Exception

abortConfig

public void abortConfig(java.lang.String configHandle)
                 throws java.lang.Exception
Interface method to terminate all agents in a configuration object launched by this SMS Called by proxy object

Specified by:
abortConfig in interface SMSAgentInterface
Parameters:
configHandle -
Throws:
java.lang.Exception

addAndLaunchAgents

public void addAndLaunchAgents(java.lang.String filename,
                               java.lang.String configHandle)
                        throws java.lang.Exception
Interface method to launch an agent Called by proxy object

Specified by:
addAndLaunchAgents in interface SMSAgentInterface
Parameters:
filename -
configHandle -
Throws:
java.lang.Exception

agentReached

public void agentReached(ajanta.naming.URN agentURN)
                  throws java.lang.Exception
Synchronization method: agent informs SMSAgent on reaching destination

Specified by:
agentReached in interface SMSAgentInterface
Parameters:
agentURN -
Throws:
java.lang.Exception

startRun

public boolean startRun(ajanta.naming.URN agentURN)
                 throws java.lang.Exception
Synchronization method instructing the agent to start running

Specified by:
startRun in interface SMSAgentInterface
Parameters:
agentURN -
Throws:
java.lang.Exception

startSubscription

public boolean startSubscription(ajanta.naming.URN agentURN)
                          throws java.lang.Exception
Synchronization method instructing the agent to start subscribing to other agents

Specified by:
startSubscription in interface SMSAgentInterface
Parameters:
agentURN -
Throws:
java.lang.Exception

forceRun

public void forceRun(ajanta.naming.URN agentURN)
              throws java.lang.Exception
Description copied from interface: SMSAgentInterface
Remote Interface method indicating that an agent would like to start running even though it has not subscribed to all

Specified by:
forceRun in interface SMSAgentInterface
Throws:
java.lang.Exception

getConfigHandleList

public java.util.Vector getConfigHandleList()
                                     throws java.lang.Exception
Description copied from interface: SMSAgentInterface
Remote Interface method to get a list of config handles from an SMSAgent

Specified by:
getConfigHandleList in interface SMSAgentInterface
Throws:
java.lang.Exception

modifyDetectorOnAgent

public void modifyDetectorOnAgent(ajanta.naming.URN agentURN,
                                  java.lang.String eventDetector,
                                  java.lang.Object[] object)
                           throws java.lang.Exception
Description copied from interface: SMSAgentInterface
Remote Interface method to modify an agent's detector

Specified by:
modifyDetectorOnAgent in interface SMSAgentInterface
Throws:
java.lang.Exception

removeSubscribeRelation

public void removeSubscribeRelation(ajanta.naming.URN publisherURN,
                                    ajanta.naming.URN subscriberURN,
                                    java.lang.String eventName)
                             throws java.lang.Exception
Method to remove the publish-subscribe relation

Specified by:
removeSubscribeRelation in interface SMSAgentInterface
Parameters:
publisherURN -
subscriberURN -
eventName -
Throws:
java.lang.Exception

removeDetectorOnAgent

public void removeDetectorOnAgent(ajanta.naming.URN agentURN,
                                  java.lang.String detectorName)
                           throws java.lang.Exception
Remote Interface method to remove a detector from an agent

Specified by:
removeDetectorOnAgent in interface SMSAgentInterface
Throws:
java.lang.Exception

registerForEvents

public void registerForEvents(java.lang.String configHandle,
                              java.lang.String url,
                              java.util.Vector eventList)
                       throws java.lang.Exception
Overloaded method for handling events taken from the Event queue of the SMSAgent /** register for interesting events from the default subscriber

Specified by:
registerForEvents in interface SMSAgentInterface
Parameters:
url -
eventList -
Throws:
java.lang.Exception

unregisterForEvents

public void unregisterForEvents(java.lang.String configHandle,
                                java.lang.String url,
                                java.util.Vector v)
                         throws java.lang.Exception
register for interesting events from the default subscriber

Specified by:
unregisterForEvents in interface SMSAgentInterface
Parameters:
url -
Throws:
java.lang.Exception

registerForHostStatusEvents

public void registerForHostStatusEvents(java.lang.String clientURL,
                                        java.util.Vector configHandles)
                                 throws java.lang.Exception
Specified by:
registerForHostStatusEvents in interface SMSAgentInterface
Throws:
java.lang.Exception

unregisterForAllHostStatusEvents

public void unregisterForAllHostStatusEvents(java.lang.String clientURL)
                                      throws java.lang.Exception
Specified by:
unregisterForAllHostStatusEvents in interface SMSAgentInterface
Throws:
java.lang.Exception

registerGUI

public void registerGUI(java.lang.String url)

addHandlerPostAction

public void addHandlerPostAction(EventHandler handler)
Overrides:
addHandlerPostAction in class MonitoringAgent