org.opennms.netmgt.eventd
Class EventUtil

java.lang.Object
  extended by org.opennms.netmgt.eventd.EventUtil

public final class EventUtil
extends Object

EventUtil is used primarily for the event parm expansion - has methods used by all the event components to send in the event and the element to expanded and have the 'expanded' value sent back

Author:
Sowmya Kumaraswamy , Brain Weaver , OpenNMS

Constructor Summary
EventUtil()
           
 
Method Summary
static Event cloneEvent(Event orig)
           
static String escape(String inStr, char delimchar)
           This method is used to escape required values from strings that may contain those values.
static String expandParms(String inp, Event event)
          Expand the value if it has parms in one of the following formats - %element% values are expanded to have the value of the element where 'element' is an element in the event DTD - %parm[values-all]% is expanded to a delimited list of all parmblock values - %parm[names-all]% is expanded to a list of all parm names - %parm[all]% is expanded to a full dump of all parmblocks - %parm[name]% is expanded to the value of the parameter named 'name' - %parm[ ]% is replaced by the value of the parameter named 'name', if present - %parm[# ]% is replaced by the value of the parameter number 'num', if present - %parm[##]% is replaced by the number of parameters
static String getNamedParmValue(String parm, Event event)
          Helper method.
static String getValueAsString(Value pvalue)
          Converts the value of a parm ('Value') of the instance to a string
static String getValueOfParm(String parm, Event event)
          Get the value of the parm for the event
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventUtil

public EventUtil()
Method Detail

getValueAsString

public static String getValueAsString(Value pvalue)
Converts the value of a parm ('Value') of the instance to a string


escape

public static String escape(String inStr,
                            char delimchar)

This method is used to escape required values from strings that may contain those values. If the passed string contains the passed value then the character is reformatted into its %dd format.

Parameters:
inStr - string that might contain the delimiter
delimchar - delimiter to escape
Returns:
The string with the delimiter escaped as in URLs
See Also:
ATTRIB_DELIM

getValueOfParm

public static String getValueOfParm(String parm,
                                    Event event)
Get the value of the parm for the event

Parameters:
parm - the parm for which value is needed from the event
event - the event whose parm value is required
Returns:
value of the event parm/element

getNamedParmValue

public static String getNamedParmValue(String parm,
                                       Event event)
Helper method.

Parameters:
parm -
event -
Returns:
A parameter's value as a String using the parameter's name..

expandParms

public static String expandParms(String inp,
                                 Event event)
Expand the value if it has parms in one of the following formats - %element% values are expanded to have the value of the element where 'element' is an element in the event DTD - %parm[values-all]% is expanded to a delimited list of all parmblock values - %parm[names-all]% is expanded to a list of all parm names - %parm[all]% is expanded to a full dump of all parmblocks - %parm[name]% is expanded to the value of the parameter named 'name' - %parm[ ]% is replaced by the value of the parameter named 'name', if present - %parm[# ]% is replaced by the value of the parameter number 'num', if present - %parm[##]% is replaced by the number of parameters

Parameters:
inp - the input string in which parm values are to be expanded
Returns:
expanded value if the value had any parameter to expand, null otherwise

cloneEvent

public static Event cloneEvent(Event orig)


Copyright © 2009. All Rights Reserved.