|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opennms.netmgt.xmlrpcd.XmlRpcNotifier
This class create an XMLRPC client and provide methods to notify the external XMLRPC server if a failure occurs during processing an event.
Field Summary | |
private int |
m_elapseTime
The elapse-time between retries. |
private java.lang.String |
m_localServer
The host NMS server name |
private int |
m_retries
The retry number to setup xmlrpc communication. |
private XmlrpcServer[] |
m_rpcServers
The external xmlrpc servers. |
private boolean |
m_verifyServer
A boolean flag configurated to indicate to how to set the NMS server Name: From user opennms server configuration or simply take from InetAddress.getLocalHost(). |
private org.apache.xmlrpc.XmlRpcClient |
m_xmlrpcClient
The working xmlrpc client. |
private static java.lang.String |
XMLRPC_INTERFACE_DOWN_COMMAND
The external xmlrpc server procedure to process an interfaceDown event. |
private static java.lang.String |
XMLRPC_INTERFACE_UP_COMMAND
The external xmlrpc server procedure to process an interfaceUp event. |
private static java.lang.String |
XMLRPC_NODE_DOWN_COMMAND
The external xmlrpc server procedure to process a nodeDown event. |
private static java.lang.String |
XMLRPC_NODE_UP_COMMAND
The external xmlrpc server procedure to process a nodeUp event. |
private static java.lang.String |
XMLRPC_SERVER_FAILURE_COMMAND
The external xmlrpc server procedure to process an event failure. |
private static java.lang.String |
XMLRPC_SERVER_RECEIVE_EVENT_COMMAND
The external xmlrpc server procedure to listen to the receiving event notice. |
private static java.lang.String |
XMLRPC_SERVER_SUCCESS_COMMAND
The external xmlrpc server procedure to process an event success. |
private static java.lang.String |
XMLRPC_SERVICE_DOWN_COMMAND
The external xmlrpc server procedure to process a nodeLostService event. |
private static java.lang.String |
XMLRPC_SERVICE_UP_COMMAND
The external xmlrpc server procedure to process a nodeRegainedService event. |
Constructor Summary | |
XmlRpcNotifier(XmlrpcServer[] rpcServers,
int retries,
int elapseTime,
boolean verifyServer,
java.lang.String localServer)
The constructor |
Method Summary | |
void |
createConnection()
This method try to find an external xmlrpc server which is alive and and can communicate with. |
private java.lang.String |
getNodeLabel(long nodeId)
This method retrieves the nodeLable from the database for a given nodeId. |
boolean |
notifyFailure(long txNo,
java.lang.String uei,
java.lang.String reason)
Notify the external xmlrpc server the occurance of failure during processing an event. |
boolean |
notifyReceivedEvent(long txNo,
java.lang.String uei,
java.lang.String message)
Notify the external xmlrpc server the request has been received. |
boolean |
notifySuccess(long txNo,
java.lang.String uei,
java.lang.String message)
Notify the external xmlrpc server the success of processing an event. |
boolean |
sendInterfaceDownEvent(Event event)
Notify the external xmlrpc server the occurance of the 'interfaceDown' event. |
boolean |
sendInterfaceUpEvent(Event event)
Notify the external xmlrpc server the occurance of the 'interfaceUp' event. |
boolean |
sendNodeDownEvent(Event event)
Notify the external xmlrpc server the occurance of the 'nodeDown' event. |
boolean |
sendNodeUpEvent(Event event)
Notify the external xmlrpc server the occurance of the 'nodeUp' event. |
boolean |
sendServiceDownEvent(Event event)
Notify the external xmlrpc server the occurance of the 'nodeLostService' event. |
boolean |
sendServiceUpEvent(Event event)
Notify the external xmlrpc server the occurance of the 'nodeRegainedService' event. |
private boolean |
sendXmlrpcRequest(java.lang.String command,
java.util.Vector params)
This method sends an xmlrpc request to an external xmlrpc server and gets the response from the xmlrpc server as a String. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final java.lang.String XMLRPC_SERVER_SUCCESS_COMMAND
private static final java.lang.String XMLRPC_SERVER_FAILURE_COMMAND
private static final java.lang.String XMLRPC_SERVER_RECEIVE_EVENT_COMMAND
private static final java.lang.String XMLRPC_SERVICE_UP_COMMAND
private static final java.lang.String XMLRPC_SERVICE_DOWN_COMMAND
private static final java.lang.String XMLRPC_NODE_UP_COMMAND
private static final java.lang.String XMLRPC_NODE_DOWN_COMMAND
private static final java.lang.String XMLRPC_INTERFACE_UP_COMMAND
private static final java.lang.String XMLRPC_INTERFACE_DOWN_COMMAND
private XmlrpcServer[] m_rpcServers
private int m_retries
private int m_elapseTime
private org.apache.xmlrpc.XmlRpcClient m_xmlrpcClient
private boolean m_verifyServer
private java.lang.String m_localServer
Constructor Detail |
public XmlRpcNotifier(XmlrpcServer[] rpcServers, int retries, int elapseTime, boolean verifyServer, java.lang.String localServer)
Method Detail |
public boolean notifySuccess(long txNo, java.lang.String uei, java.lang.String message)
Notify the external xmlrpc server the success of processing an event.
txNo
- the external transaction number for an event.uei
- the event uei.message
- the text message to indicate the success.public boolean notifyFailure(long txNo, java.lang.String uei, java.lang.String reason)
Notify the external xmlrpc server the occurance of failure during processing an event.
txNo
- the external transaction number for an event.uei
- the event uei.reason
- the text message to explain the reason of the failure to the
external xmlrpc server.public boolean notifyReceivedEvent(long txNo, java.lang.String uei, java.lang.String message)
Notify the external xmlrpc server the request has been received.
txNo
- the external transaction number for an event.uei
- the event uei.message
- text message to notify the external xmlrpc server.public boolean sendServiceDownEvent(Event event)
Notify the external xmlrpc server the occurance of the 'nodeLostService' event.
public boolean sendServiceUpEvent(Event event)
Notify the external xmlrpc server the occurance of the 'nodeRegainedService' event.
public boolean sendInterfaceDownEvent(Event event)
Notify the external xmlrpc server the occurance of the 'interfaceDown' event.
public boolean sendInterfaceUpEvent(Event event)
Notify the external xmlrpc server the occurance of the 'interfaceUp' event.
public boolean sendNodeDownEvent(Event event)
Notify the external xmlrpc server the occurance of the 'nodeDown' event.
public boolean sendNodeUpEvent(Event event)
Notify the external xmlrpc server the occurance of the 'nodeUp' event.
private java.lang.String getNodeLabel(long nodeId)
This method retrieves the nodeLable from the database for a given nodeId.
nodeId
- the nodeId to retrieve the node label for.private boolean sendXmlrpcRequest(java.lang.String command, java.util.Vector params)
This method sends an xmlrpc request to an external xmlrpc server and gets the response from the xmlrpc server as a String.
command
- The server command to process the request.params
- a list of parameters need for the external server command to
process the request.public void createConnection()
This method try to find an external xmlrpc server which is alive and and can communicate with.
Note: If an xmlrpc server is found alive and could communicate with, an xmlrpc client is created to communicate with this server. The created xmlrpc client is kept for all the xmlrpc communications until the server is no longer available.
|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |