org.opennms.bb.dp.events
Class EventForward

java.lang.Object
  |
  +--org.opennms.bb.dp.events.EventAttributeStateOnOff
        |
        +--org.opennms.bb.dp.events.EventForward
All Implemented Interfaces:
Serializable

public class EventForward
extends EventAttributeStateOnOff
implements Serializable

This class is designed to encapsulate all the relavant information for the forward element of the Event DTD. The forward element contains the forwarding destination as its data and two attributes: state & mechanism. This class groups all the information about the XML elemement into a single class.

Version:
CVS $Revision: 1.4 $
Author:
Brian Weaver, OpenNMS
See Also:
Serialized Form

Field Summary
static int FWD_SNMP_TCP
          Forward the event using TCP/IP protocol with the message encoded using SNMP/BER
static int FWD_SNMP_UDP
          Forward the event using UDP/IP protocol with the message encodied using SNMP/BER
static int FWD_XML_TCP
          Forward the event using TCP/IP protocol with the message encoded using XML.
static int FWD_XML_UDP
          Forward the event using the UDP/IP protocol with the message encoded using XML.
private  int m_fwdhow
          The protocol to use when forwarding the event.
private  String m_fwdto
          The forwarding destination.
 
Fields inherited from class org.opennms.bb.dp.events.EventAttributeStateOnOff
m_state, STATE_OFF, STATE_ON
 
Constructor Summary
EventForward()
          Constructs a new instance of the class and sets all the fields to the default values.
EventForward(EventForward second)
          Constructs a new forwarding instance that is a duplicate copy of the passed instance.
EventForward(String destination)
          Constructs a new forwarding instance with the specific destination.
EventForward(String destination, int how)
          Constructs a new instance of this with the passed destination and protocol.
EventForward(String destination, int how, int state)
          Constructs a new instance of the class that contains the appropriate forwarding information.
 
Method Summary
 String getDestination()
          Returns the forwarding destination that is currently set for this instance.
 int getForwardType()
          Returns the currently set forwarding mechinism.
(package private)  void serializeToXML(PrintStream ps)
          Writes self to event stream
 void set(String destination, int how)
          Sets the information contained in the forwarding instance.
 void set(String destination, int how, int state)
          Sets the information contained in this instance.
 void setDestination(String destination)
          Sets the forwarding destination for the instance.
 void setForwardType(int how)
          Sets the forwarding mechinism type for the instance.
 
Methods inherited from class org.opennms.bb.dp.events.EventAttributeStateOnOff
getState, setState
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

FWD_SNMP_UDP

public static final int FWD_SNMP_UDP
Forward the event using UDP/IP protocol with the message encodied using SNMP/BER

FWD_SNMP_TCP

public static final int FWD_SNMP_TCP
Forward the event using TCP/IP protocol with the message encoded using SNMP/BER

FWD_XML_TCP

public static final int FWD_XML_TCP
Forward the event using TCP/IP protocol with the message encoded using XML.

FWD_XML_UDP

public static final int FWD_XML_UDP
Forward the event using the UDP/IP protocol with the message encoded using XML.

m_fwdhow

private int m_fwdhow
The protocol to use when forwarding the event.

m_fwdto

private String m_fwdto
The forwarding destination.
Constructor Detail

EventForward

public EventForward()
Constructs a new instance of the class and sets all the fields to the default values.

EventForward

public EventForward(EventForward second)
Constructs a new forwarding instance that is a duplicate copy of the passed instance. This allows for the passed copy to be modified without affecting the data in the new instance.
Parameters:
second - The instance to copy.

EventForward

public EventForward(String destination)
Constructs a new forwarding instance with the specific destination. The forwarding protocol and state are set to the default values as defined by the Event DTD.
Parameters:
destination - The forwarding destination.

EventForward

public EventForward(String destination,
                    int how)
Constructs a new instance of this with the passed destination and protocol.
Parameters:
destination - The forwarding destination.
how - The forwarding protocol.

EventForward

public EventForward(String destination,
                    int how,
                    int state)
Constructs a new instance of the class that contains the appropriate forwarding information.
Parameters:
destination - The forwarding destination.
how - The forwarding protocol.
state - The forwarding state.
Method Detail

serializeToXML

void serializeToXML(PrintStream ps)
Writes self to event stream

set

public void set(String destination,
                int how)
Sets the information contained in the forwarding instance. The destination information and forwarding protocol can be set using this method.
Parameters:
destination - The forwarding destination.
how - The forwarding protocol

set

public void set(String destination,
                int how,
                int state)
Sets the information contained in this instance. It allows the destination, protocol, and forwarding state to be set in a single call.
Parameters:
destination - The forwarding destination.
how - The forwarding protocol.
state - The forwarding state.

getDestination

public String getDestination()
Returns the forwarding destination that is currently set for this instance.
Returns:
The forwarding destination.

setDestination

public void setDestination(String destination)
Sets the forwarding destination for the instance.
Parameters:
destination - The forwarding destination.

getForwardType

public int getForwardType()
Returns the currently set forwarding mechinism.
Returns:
The forwarding protocol.

setForwardType

public void setForwardType(int how)
Sets the forwarding mechinism type for the instance.
Parameters:
how - The protocol used to forward the event.