org.opennms.netmgt.xmlrpcd
Class XmlRpcNotifier

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

public final class XmlRpcNotifier
extends 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:
Mathew Brozowski, DJ Gregor, Mike Huot, Tarus Balog, James Zuo, OpenNMS.org

Constructor Summary
XmlRpcNotifier(XmlrpcServer[] rpcServers, int retries, int elapseTime, boolean verifyServer, 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.
 boolean notifyFailure(long txNo, String uei, String reason)
           Notify the external xmlrpc server the occurance of failure during processing an event.
 boolean notifyReceivedEvent(long txNo, String uei, String message)
           Notify the external xmlrpc server the request has been received.
 boolean notifySuccess(long txNo, String uei, String message)
           Notify the external xmlrpc server the success of processing an event.
 boolean sendEvent(Event event)
           Notify the external event xmlrpc server of the occurrence of a generic event -- ie.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlRpcNotifier

public XmlRpcNotifier(XmlrpcServer[] rpcServers,
                      int retries,
                      int elapseTime,
                      boolean verifyServer,
                      String localServer)
The constructor

Method Detail

notifySuccess

public boolean notifySuccess(long txNo,
                             String uei,
                             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,
                             String uei,
                             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,
                                   String uei,
                                   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.


sendEvent

public boolean sendEvent(Event event)

Notify the external event xmlrpc server of the occurrence of a generic event -- ie. an event that's been configured for XMLRPC forwarding, but which does not correspond to one of the specific event methods of this class


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.



Copyright © 2009. All Rights Reserved.