AgentDE
Class IRR_QMonitor

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--AgentDE.IRR_QMonitor
Direct Known Subclasses:
iRR_RoostQMonitor, iRR_TAM_TankQMonitor

public class IRR_QMonitor
extends java.lang.Thread

Overview -- An IMPACT Object Server (IOS) typically consists of three main components:

The IRR_QMonitor base class provides a runnable thread with all the methods necessary to monitor IMPACT message queue (IA_MessageQueue object) traffic. It prompts "Out-going" message delivery messages via the transferMessage() method and calls the processAgentMessages() method for "In-bound" message processing.

Developers who need to insert their own "call-back" functionality need only render a class extenstion from this base class, and overload the processAgentMessages() method as necessary.


Field Summary
private  boolean bLooping
          Monitor loop switch.
private  IA_Global gRef
          System "Global" data class.
private  long lIterations
          Current monitor loop iteration count.
private  long lMaxIterations
          Maximum monitor loop iterations.
private  javax.swing.DefaultListModel lmvData
          Container for passing agent registry data into the QMonitor.
private  IAD_Location monitorLoc
          Current monitor RMI port address.
private  IA_MessageQueue msgQueue
          IMPACT message queue object reference.
private  int nSleepDuration_MS
          Monitor loop delay time (milliseconds).
private static java.lang.String szBHEAD
          A simple class reference string for debug output.
private  java.lang.String szIMPACT_Password
          Current password for IMPACT RMI communications.
private  java.lang.String szName
          Working name for the QMonitor
private  IAD_YPageInfo tempYPInfo
          Working copy of IAD_YPageInfo objects used during message address match processing.
 
Fields inherited from class java.lang.Thread
contextClassLoader, daemon, eetop, group, inheritedAccessControlContext, MAX_PRIORITY, MIN_PRIORITY, name, NORM_PRIORITY, priority, single_step, stillborn, stopThreadPermission, target, threadInitNumber, threadQ, values
 
Constructor Summary
IRR_QMonitor(java.lang.String szTgtName)
          Build an IRR_QMonitor object.
 
Method Summary
 IA_Global getGlobalRef()
          Get the QMonitor "Global" object reference.
 IAD_Location getLocation()
          Get the QMonitors RMI address location reference.
 IA_MessageQueue getMessageQueue()
          Get the QMonitors message queue object reference.
 java.lang.String getMonitorName()
          Get the QMonitor working name string.
 javax.swing.DefaultListModel getRegistryListModel()
          Get the QMonitors agent registry list object reference.
 boolean isEchoDebug()
          Get the underlying QMonitor Global Ref debug flag.
 boolean isTerminated()
          Get the QMonitor loop status.
 void noteRunStart(int nDepth)
          The base class run() method calls this just prior to starting the monitor loop.
 boolean postMessage(IA_Message srcMsg, int nDepth)
          Deprecated. -- (pending replacement)
 boolean processAgentMessages(IAD_YPageInfo tgtAgentYPInfo, int nDepth)
          Extract the target agent messages from the queue; Process (invoke call-back methods) as desired.
 boolean processLocalMessages(int nDepth)
          Extract agent identifications (ID's) for all "local" (in-coming) messages; Invoke the processAgentMessages() method for all such agent ID's.
 boolean processOutGoingMessages(int nDepth)
          Extract "Out-Going" messages from the message queue; Prompt delivery via the transferMessage() method call.

NOTE: This method currently moves messages one-by-one.
 void run()
          The QMonitor run code loop.

This cycles between processing local (in-coming) messages, processing out-going messages, and then sleeps for a specified interval.
 void setDebug(boolean bMode)
          Deprecated. -- (What? Should be addressed via the control frame reference)
 void setGlobalRef(IA_Global srcGRef)
          Set the QMonitor "Global" object reference.
 void setLocation(IAD_Location srcLoc)
          Set the QMonitors RMI address location reference.
 void setMaxIterations(long lTgtMax)
          Set the QMonitors Max-Iiteration trap (useful sometimes for debugging).
 void setMessageQueue(IA_MessageQueue srcQueue)
          Set the QMonitors message queue object reference.
 void setPassword(java.lang.String szPassword)
          Set the QMonitors current IMPACT communications password string.
 void setRegistryListModel(javax.swing.DefaultListModel srcLMVData)
          Set the QMonitors agent registry list object reference.
 void setSleepDuration(int nDuration_MS)
          Set the monitor loop delay interval.
 void terminateLoop()
          Terminates the current QMonitor loop.
private  boolean transferMessage(IA_Message srcMsg, int nDepth)
          Prompt message delivery to the remote IOS (Roost or alternate server) site.
 
Methods inherited from class java.lang.Thread
, activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, exit, getContextClassLoader, getName, getPriority, getThreadGroup, init, interrupt, interrupt0, interrupted, isAlive, isDaemon, isInterrupted, isInterrupted, join, join, join, nextThreadNum, registerNatives, resume, resume0, setContextClassLoader, setDaemon, setName, setPriority, setPriority0, sleep, sleep, start, stop, stop, stop0, suspend, suspend0, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

szBHEAD

private static final java.lang.String szBHEAD
A simple class reference string for debug output.

szIMPACT_Password

private java.lang.String szIMPACT_Password
Current password for IMPACT RMI communications.

msgQueue

private IA_MessageQueue msgQueue
IMPACT message queue object reference.

nSleepDuration_MS

private int nSleepDuration_MS
Monitor loop delay time (milliseconds).

bLooping

private boolean bLooping
Monitor loop switch.

lIterations

private long lIterations
Current monitor loop iteration count.

lMaxIterations

private long lMaxIterations
Maximum monitor loop iterations.

gRef

private IA_Global gRef
System "Global" data class. Allows common access to various run-time flags, error and message repositorys, and more :-)

monitorLoc

private IAD_Location monitorLoc
Current monitor RMI port address.

tempYPInfo

private IAD_YPageInfo tempYPInfo
Working copy of IAD_YPageInfo objects used during message address match processing.

lmvData

private javax.swing.DefaultListModel lmvData
Container for passing agent registry data into the QMonitor.

szName

private java.lang.String szName
Working name for the QMonitor
Constructor Detail

IRR_QMonitor

public IRR_QMonitor(java.lang.String szTgtName)
Build an IRR_QMonitor object.
Parameters:
szTgtName - -- The target QMonitor working name (shows on console).
Method Detail

getMonitorName

public final java.lang.String getMonitorName()
Get the QMonitor working name string.
Returns:
The working name (String) for the monitor.

setMessageQueue

public final void setMessageQueue(IA_MessageQueue srcQueue)
Set the QMonitors message queue object reference.
Parameters:
srcQueue - -- The source queue object reference.

getMessageQueue

public final IA_MessageQueue getMessageQueue()
Get the QMonitors message queue object reference.
Returns:
IA_MessageQueue object reference.

setMaxIterations

public final void setMaxIterations(long lTgtMax)
Set the QMonitors Max-Iiteration trap (useful sometimes for debugging).
Parameters:
lTgtMax - -- the maximum number of loop iterations desired.

setSleepDuration

public final void setSleepDuration(int nDuration_MS)
Set the monitor loop delay interval.
Parameters:
nDuration_MS - -- The target interval (milliseconds).

setDebug

public final void setDebug(boolean bMode)
Deprecated. -- (What? Should be addressed via the control frame reference)

Set the global-reference debug flag.
Parameters:
bMode - -- The desired debug mode.

setGlobalRef

public final void setGlobalRef(IA_Global srcGRef)
Set the QMonitor "Global" object reference.
Parameters:
srcGRef - -- The target IA_Global object reference.

getGlobalRef

public final IA_Global getGlobalRef()
Get the QMonitor "Global" object reference.
Returns:
The QMonitors IA_Global object reference.

setLocation

public final void setLocation(IAD_Location srcLoc)
Set the QMonitors RMI address location reference.
Parameters:
srcLoc - -- The source IAD_Location object reference.

getLocation

public final IAD_Location getLocation()
Get the QMonitors RMI address location reference.
Returns:
The QMonitors IAD_Location object reference.

setPassword

public final void setPassword(java.lang.String szPassword)
Set the QMonitors current IMPACT communications password string.
Parameters:
szPassword - -- The target password string.

terminateLoop

public final void terminateLoop()
Terminates the current QMonitor loop.

isTerminated

public final boolean isTerminated()
Get the QMonitor loop status.
Returns:
Active -- true.
Stopped -- False.

isEchoDebug

public final boolean isEchoDebug()
Get the underlying QMonitor Global Ref debug flag.
Returns:
Debug -- true.
Non-Debug -- False.

setRegistryListModel

public final void setRegistryListModel(javax.swing.DefaultListModel srcLMVData)
Set the QMonitors agent registry list object reference.
Parameters:
srcLMVData - -- The source agent registry DefaultListModel object.

getRegistryListModel

public final javax.swing.DefaultListModel getRegistryListModel()
Get the QMonitors agent registry list object reference.
Returns:
The QMonitors agent registry list (DefaultListModel) object.

processAgentMessages

public boolean processAgentMessages(IAD_YPageInfo tgtAgentYPInfo,
                                    int nDepth)
Extract the target agent messages from the queue; Process (invoke call-back methods) as desired.
Parameters:
tgtAgentYPInfo - The agent info reference for which there are queued messages.
nDepth - -- The method call stack depth integer for the debug echo display.
Returns:
Success -- true.
Failure -- False.

processLocalMessages

public final boolean processLocalMessages(int nDepth)
Extract agent identifications (ID's) for all "local" (in-coming) messages; Invoke the processAgentMessages() method for all such agent ID's.
Parameters:
nDepth - -- The method call stack depth integer for the debug echo display.
Returns:
Success -- true.
Failure -- False.

processOutGoingMessages

public final boolean processOutGoingMessages(int nDepth)
Extract "Out-Going" messages from the message queue; Prompt delivery via the transferMessage() method call.

NOTE: This method currently moves messages one-by-one. Future enhancements should allow message delivery by common remote location groups.
Parameters:
nDepth - -- The method call stack depth integer for the debug echo display.
Returns:
Success -- true.
Failure -- False.

transferMessage

private final boolean transferMessage(IA_Message srcMsg,
                                      int nDepth)
Prompt message delivery to the remote IOS (Roost or alternate server) site.
Parameters:
srcMsg - -- The target "remote" message.
nDepth - -- The method call stack depth integer for the debug echo display.
Returns:
Success -- true.
Failure -- False.

postMessage

public final boolean postMessage(IA_Message srcMsg,
                                 int nDepth)
Deprecated. -- (pending replacement)

Post a message into the queue.
Parameters:
srcMsg - -- The source message object reference.
nDepth - -- The method call stack depth integer for the debug echo display.
Returns:
Success -- true.
Failure -- False.

noteRunStart

public void noteRunStart(int nDepth)
The base class run() method calls this just prior to starting the monitor loop. While this base class method does nothing; Extension classes might want to over-load this with application call-back functions which note when the IOS is initialized (the monitor is running).
Parameters:
nDepth - -- The method call stack depth integer for the debug echo display.

run

public final void run()
The QMonitor run code loop.

This cycles between processing local (in-coming) messages, processing out-going messages, and then sleeps for a specified interval.
Overrides:
run in class java.lang.Thread