|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--hypercast.MonitorAndControl.Monitor
For full description of the Monitor class follow the "see"
links. From an implementation standpoint, many methods are
delegated to either the PortalListManager
or the
MCSocket
. This class does implemented the send
methods. Also, this class implements the
CallbackManager
mechanism that is responsible for
matching responses to requests and for issuing timeouts.
I_Monitor
,
PortalListManager
,
From the Monitor and Control design doc:
"A monitor set to silent mode does not set entries in the portal list as inactive."
Constructor Summary | |
Monitor(hypercast.HyperCastConfig config)
Construct a Monitor with a config object |
Method Summary | |
void |
clearPortalList()
Clear the portal list. |
void |
closeMonitor()
Explicitly close monitor. |
void |
compactPortalList()
Compact the portal list Remove all inactive portals from Monitor data structures. |
hypercast.MonitorAndControl.MonMessage |
createGetRequest()
create a GetRequest message "GetRequest" message is used to query for one or more statistics on a Portal. |
hypercast.MonitorAndControl.MonMessage |
createReadSchemaRequest()
create a ReadSchema request "ReadSchema" message is used to query the schemas of a list of the readable statistics on a Portal. |
hypercast.MonitorAndControl.MonMessage |
createSetRequest()
create a SetRequest message "SetRequest" message is used to set the values of a list of statistics on a Portal. |
hypercast.MonitorAndControl.MonMessage |
createWriteSchemaRequest()
create a WriteSchema request "WriteSchema" message is used to query the schemas of a list of the writable statistics on a Portal. |
int[] |
getActivePortalIndices()
Get an integer array containing the indices of active portals. |
int[] |
getAllPortalIndices()
Get An integer array containing the indexes of all. |
int[] |
getInactivePortalIndices()
Get an integer array containing the indices of inactive portals. |
hypercast.I_LogicalAddress |
getPortalAddress(int portalIndex)
Get the logical address of a Portal |
org.w3c.dom.Element[] |
getReadSchema(org.w3c.dom.Document doc,
org.apache.xpath.XPath xpath)
Dynamically generates a subtree of the Readable Schema rooted at the path specified by the xpath. |
org.w3c.dom.Element[] |
getStats(org.w3c.dom.Document doc,
org.apache.xpath.XPath xpath)
Gets statistics information from an object which implements this interface. |
java.lang.String |
getStatsName()
Gets the element name of this I_Stats instance. |
org.w3c.dom.Element[] |
getWriteSchema(org.w3c.dom.Document doc,
org.apache.xpath.XPath xpath)
Dynamically generates a subtree of the Writable Schema rooted at the path specified by the xpath. |
int |
indexOfPortal(hypercast.I_LogicalAddress logicalAddress)
Get the index of a portal by its logical address. |
boolean |
isPortalActive(int portalIndex)
Check if a portal is still active |
void |
openMonitor()
Explicitly open monitor. |
void |
receiveMCRawMessage(hypercast.MonitorAndControl.MCRawMessage message)
Receives an MC Raw message. |
void |
sendTo(int portalIndex,
hypercast.MonitorAndControl.MonMessage message,
hypercast.MonitorAndControl.I_ReceiveCallback receiveCallback,
hypercast.MonitorAndControl.I_TimeoutCallback timeoutCallback)
Sends an MonMessage to a single
Portal . |
void |
sendToAll(hypercast.MonitorAndControl.MonMessage message,
hypercast.MonitorAndControl.I_ReceiveCallback receiveCallback,
hypercast.MonitorAndControl.I_TimeoutCallback timeoutCallback)
Send a MC message to all portals by multicast. |
void |
setSilentOff()
Causes a Monitor to begin sending MonitorAdvertise messages to Portals |
void |
setSilentOn()
Causes a Monitor to cease sending MonitorAdvertise messages to Portals |
org.w3c.dom.Element[] |
setStats(org.w3c.dom.Document doc,
org.apache.xpath.XPath xpath,
org.w3c.dom.Element setValue)
Sets statistics information for an object which implements this interface. |
void |
setStatsName(java.lang.String name)
Assigns a name to this I_Stats instance. |
void |
startTranscript(java.lang.String filename)
Causes MCMessages to be recorded in a transcript
file. |
void |
stopTranscript()
Stops transcripting. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Monitor(hypercast.HyperCastConfig config)
config
- the config object to read configuration attributes fromMethod Detail |
public void startTranscript(java.lang.String filename) throws java.io.FileNotFoundException
I_Monitor
MCMessages
to be recorded in a transcript
file. Depending on the options present in the configuration
file either messages that are sent, received, or both will be
recorded.
startTranscript
in interface I_Monitor
filename
- The name of the transcript file.
java.io.FileNotFoundException
- If the specified file cannot be accessedI_Monitor.startTranscript(String)
public void stopTranscript()
I_Monitor
stopTranscript
in interface I_Monitor
I_Monitor.startTranscript(String)
public hypercast.I_LogicalAddress getPortalAddress(int portalIndex) throws NoSuchPortalException
I_Monitor
getPortalAddress
in interface I_Monitor
portalIndex
- The index of the Portal.
NoSuchPortalException
- If the portal doesn't exist.I_Monitor.getPortalAddress(int)
public int[] getActivePortalIndices()
I_Monitor
getActivePortalIndices
in interface I_Monitor
null
. The length of this array is at most
the number of Portals.I_Monitor.getActivePortalIndices()
public int[] getAllPortalIndices()
I_Monitor
getAllPortalIndices
in interface I_Monitor
null
. The length of this array is the number
of Portals.I_Monitor.getAllPortalIndices()
public boolean isPortalActive(int portalIndex) throws NoSuchPortalException
I_Monitor
isPortalActive
in interface I_Monitor
portalIndex
- the index of the portal
NoSuchPortalException
- if this portal doesn't exist.I_Monitor.isPortalActive(int)
public int indexOfPortal(hypercast.I_LogicalAddress logicalAddress) throws NoSuchPortalException
I_Monitor
indexOfPortal
in interface I_Monitor
logicalAddress
- the logical address of the portal
NoSuchPortalException
- if no portal exists with that logical addressI_Monitor.indexOfPortal(I_LogicalAddress)
public void clearPortalList()
I_Monitor
clearPortalList
in interface I_Monitor
I_Monitor.clearPortalList()
public void sendTo(int portalIndex, hypercast.MonitorAndControl.MonMessage message, hypercast.MonitorAndControl.I_ReceiveCallback receiveCallback, hypercast.MonitorAndControl.I_TimeoutCallback timeoutCallback) throws NoSuchPortalException
I_Monitor
MonMessage
to a single
Portal
. A reply message from the
Portal
having the same message ID as the request
message sent from the Monitor
will be the
parameter of the receiveCallback
for handling by
the application. The application need not provide a
receiveCallback
(can be null) if it is
uninterested in the response. If no reply is received during
the timeout time (configured in the config file), the
timeoutCallback
will be invoked with the request
message as a parameter (a copy of the request message is made
by the Monitor to ensure that the original request message is
given to the caller in the timeoutCallback
, this
is because a caller is free to use a message object many times,
possibly changing the contents between uses). A
timeoutCallback
need not be specified if the
application is not interested in timeouts (in this case no copy
of the original message is made).
Note that a caller may use the same message object again and
again as a parameter to this method and each invocation will be
interpreted as a new request so long as the message id field
is cleared before each call of this method
In the case of a timeoutCallback
invocation, an
application that wants to retransmit a request can call
sendTo()
again with the message reference that is
passed via the timeoutCallback
(this reference
points to a copy of the original message that was made when it
was sent). Doing this invokes a retransmission using the same
message id as the original transmission. Do not clear the
message id before calling sendTo()
for
retransmission.The subsequent call to sendTo()
will detect that the message was aready sent and not assign a
new message id to the request.
Be careful not to change the state of the message after calling
sendTo()
for a retransmission because in that
situation the Monitor implementation and the application both
have a pointer to the same data structure. Remember the the
Monitor made a copy of the message on the first send so that it
could give a pointer to the copy to the application on a
timeout. By calling sendTo()
with this reference
you are simply passing a pointer to an object that should be
considered internal state of the Monitor.
sendTo
in interface I_Monitor
portalIndex
- index of destination portalmessage
- message to send, cannot be nullreceiveCallback
- callback object handling the reply message, can be nulltimeoutCallback
- callback to handle the timeout event, can be null
NoSuchPortalException
I_Monitor.sendTo(int, MonMessage, I_ReceiveCallback, I_TimeoutCallback)
public void sendToAll(hypercast.MonitorAndControl.MonMessage message, hypercast.MonitorAndControl.I_ReceiveCallback receiveCallback, hypercast.MonitorAndControl.I_TimeoutCallback timeoutCallback)
I_Monitor
sendToAll
in interface I_Monitor
message
- message to send, cannot be nullreceiveCallback
- callback to handle reply messagetimeoutCallback
- callback to handle situation when no portal repliesI_Monitor.sendToAll(MonMessage, I_ReceiveCallback, I_TimeoutCallback)
public hypercast.MonitorAndControl.MonMessage createGetRequest()
I_Monitor
createGetRequest
in interface I_Monitor
I_Monitor.createGetRequest()
public hypercast.MonitorAndControl.MonMessage createSetRequest()
I_Monitor
createSetRequest
in interface I_Monitor
I_Monitor.createSetRequest()
public hypercast.MonitorAndControl.MonMessage createReadSchemaRequest()
I_Monitor
createReadSchemaRequest
in interface I_Monitor
I_Monitor.createReadSchemaRequest()
public hypercast.MonitorAndControl.MonMessage createWriteSchemaRequest()
I_Monitor
createWriteSchemaRequest
in interface I_Monitor
I_Monitor.createWriteSchemaRequest()
public void compactPortalList()
I_Monitor
compactPortalList
in interface I_Monitor
I_Monitor.compactPortalList()
public void setSilentOn()
I_Monitor
setSilentOn
in interface I_Monitor
I_Monitor.setSilentOff()
public void setSilentOff()
I_Monitor
setSilentOff
in interface I_Monitor
I_Monitor.setSilentOff()
public void openMonitor()
I_Monitor
openMonitor
in interface I_Monitor
I_Monitor.openMonitor()
public void closeMonitor()
closeMonitor
in interface I_Monitor
public java.lang.String getStatsName()
I_Stats
getStatsName
in interface I_Stats
I_Stats.getStatsName()
public void setStatsName(java.lang.String name)
I_Stats
setStatsName
in interface I_Stats
name
- the name assigned to the I_Stats instance.I_Stats.setStatsName(String)
public org.w3c.dom.Element[] getStats(org.w3c.dom.Document doc, org.apache.xpath.XPath xpath) throws HyperCastStatsException
I_Stats
getStats
in interface I_Stats
xpath
- Specifies the statistic subtree to query.doc
- The document is used as a factory to create XML
objects such as Nodes and Elements as needed. TODO: describe
how the XML document in the doc is used.
HyperCastStatsException
- If the xpath does not specify a valid subtree.I_Stats.getStats(org.w3c.dom.Document,
org.apache.xpath.XPath)
public org.w3c.dom.Element[] setStats(org.w3c.dom.Document doc, org.apache.xpath.XPath xpath, org.w3c.dom.Element setValue) throws HyperCastStatsException
I_Stats
setStats
in interface I_Stats
xpath
- Specifies the statistic subtree to use when updating values.doc
- The document is used as a factory to create XML
objects such as Nodes and Elements as needed. TODO: describe
how the XML document in the doc is used.
HyperCastStatsException
- If the xpath does not specify a
valid subtree or if any part of the the subtree is read-only,
or if the newValue
does not conform with the
expected format.I_Stats.setStats(org.w3c.dom.Document,
org.apache.xpath.XPath, org.w3c.dom.Element)
public org.w3c.dom.Element[] getReadSchema(org.w3c.dom.Document doc, org.apache.xpath.XPath xpath) throws HyperCastStatsException
I_Stats
getReadSchema
in interface I_Stats
HyperCastStatsException
- If some part of the specified
subtree does not correctly implement this interface method.I_Stats.getReadSchema(org.w3c.dom.Document,
org.apache.xpath.XPath)
public org.w3c.dom.Element[] getWriteSchema(org.w3c.dom.Document doc, org.apache.xpath.XPath xpath) throws HyperCastStatsException
I_Stats
getWriteSchema
in interface I_Stats
HyperCastStatsException
- If some part of the specified
subtree does not correctly implement this interface method.I_Stats.getWriteSchema(org.w3c.dom.Document,
org.apache.xpath.XPath)
public void receiveMCRawMessage(hypercast.MonitorAndControl.MCRawMessage message)
hypercast.MonitorAndControl.I_MCRaw_Callback
receiveMCRawMessage
in interface hypercast.MonitorAndControl.I_MCRaw_Callback
message
- Raw message that is passed to the callbackpublic int[] getInactivePortalIndices()
I_Monitor
getInactivePortalIndices
in interface I_Monitor
null
. The length of this array is at most
the number of Portals.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |