OpenNMS API 1.2.9

## org.opennms.netmgt.xmlrpcd
Class XmlRpcNotifier

    java.lang.Object
      org.opennms.netmgt.xmlrpcd.XmlRpcNotifier

public final class XmlRpcNotifier
extends java.lang.Object

This class create an XMLRPC client and provide methods to notify the external XMLRPC server if a failure occurs during processing an event.

Author:
  James Zuo , OpenNMS.org

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

### XMLRPC_SERVER_SUCCESS_COMMAND

    private static final java.lang.String XMLRPC_SERVER_SUCCESS_COMMAND

  The external xmlrpc server procedure to process an event success.

  See Also:
    Constant Field Values

### XMLRPC_SERVER_FAILURE_COMMAND

    private static final java.lang.String XMLRPC_SERVER_FAILURE_COMMAND

  The external xmlrpc server procedure to process an event failure.

  See Also:
    Constant Field Values

### XMLRPC_SERVER_RECEIVE_EVENT_COMMAND

    private static final java.lang.String XMLRPC_SERVER_RECEIVE_EVENT_COMMAND

  The external xmlrpc server procedure to listen to the receiving event notice.

  See Also:
    Constant Field Values

### XMLRPC_SERVICE_UP_COMMAND

    private static final java.lang.String XMLRPC_SERVICE_UP_COMMAND

  The external xmlrpc server procedure to process a nodeRegainedService event.

  See Also:
    Constant Field Values

### XMLRPC_SERVICE_DOWN_COMMAND

    private static final java.lang.String XMLRPC_SERVICE_DOWN_COMMAND

  The external xmlrpc server procedure to process a nodeLostService event.

  See Also:
    Constant Field Values

### XMLRPC_NODE_UP_COMMAND

    private static final java.lang.String XMLRPC_NODE_UP_COMMAND

  The external xmlrpc server procedure to process a nodeUp event.

  See Also:
    Constant Field Values

### XMLRPC_NODE_DOWN_COMMAND

    private static final java.lang.String XMLRPC_NODE_DOWN_COMMAND

  The external xmlrpc server procedure to process a nodeDown event.

  See Also:
    Constant Field Values

### XMLRPC_INTERFACE_UP_COMMAND

    private static final java.lang.String XMLRPC_INTERFACE_UP_COMMAND

  The external xmlrpc server procedure to process an interfaceUp event.

  See Also:
    Constant Field Values

### XMLRPC_INTERFACE_DOWN_COMMAND

    private static final java.lang.String XMLRPC_INTERFACE_DOWN_COMMAND

  The external xmlrpc server procedure to process an interfaceDown event.

  See Also:
    Constant Field Values

### m_rpcServers

    private XmlrpcServer[] m_rpcServers

  The external xmlrpc servers.

### m_retries

    private int m_retries

  The retry number to setup xmlrpc communication.

### m_elapseTime

    private int m_elapseTime

  The elapse-time between retries.

### m_xmlrpcClient

    private org.apache.xmlrpc.XmlRpcClient m_xmlrpcClient

  The working xmlrpc client.

### m_verifyServer

    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().

### m_localServer

    private java.lang.String m_localServer

  The host NMS server name

Constructor Detail

### XmlRpcNotifier

    public XmlRpcNotifier(XmlrpcServer[] rpcServers,
                          int retries,
                          int elapseTime,
                          boolean verifyServer,
                          java.lang.String localServer)

  The constructor

Method Detail

### notifySuccess

    public boolean notifySuccess(long txNo,
                                 java.lang.String uei,
                                 java.lang.String message)

  Notify the external xmlrpc server the success of processing an event.

  Parameters:
    `txNo` - the external transaction number for an event.
    `uei` - the event uei.
    `message` - the text message to indicate the success.

### notifyFailure

    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.

  Parameters:
    `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.

### notifyReceivedEvent

    public boolean notifyReceivedEvent(long txNo,
                                       java.lang.String uei,
                                       java.lang.String message)

  Notify the external xmlrpc server the request has been received.

  Parameters:
    `txNo` - the external transaction number for an event.
    `uei` - the event uei.
    `message` - text message to notify the external xmlrpc server.

### sendServiceDownEvent

    public boolean sendServiceDownEvent(Event event)

  Notify the external xmlrpc server the occurance of the 'nodeLostService' event.

### sendServiceUpEvent

    public boolean sendServiceUpEvent(Event event)

  Notify the external xmlrpc server the occurance of the 'nodeRegainedService' event.

### sendInterfaceDownEvent

    public boolean sendInterfaceDownEvent(Event event)

  Notify the external xmlrpc server the occurance of the 'interfaceDown' event.

### sendInterfaceUpEvent

    public boolean sendInterfaceUpEvent(Event event)

  Notify the external xmlrpc server the occurance of the 'interfaceUp' event.

### sendNodeDownEvent

    public boolean sendNodeDownEvent(Event event)

  Notify the external xmlrpc server the occurance of the 'nodeDown' event.

### sendNodeUpEvent

    public boolean sendNodeUpEvent(Event event)

  Notify the external xmlrpc server the occurance of the 'nodeUp' event.

### getNodeLabel

    private java.lang.String getNodeLabel(long nodeId)

  This method retrieves the nodeLable from the database for a given nodeId.

  Parameters:
    `nodeId` - the nodeId to retrieve the node label for.

### sendXmlrpcRequest

    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.

  Parameters:
    `command` - The server command to process the request.
    `params` - a list of parameters need for the external server command to process the request.

### createConnection

    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.9

Generated by ranger on May 19 2007 2335.