public abstract class AbstractEventUtil extends Object implements EventUtil
Modifier and Type | Field and Description |
---|---|
protected static String |
ASSET_BEGIN
The string that starts the expansion for an asset field - used to lookup values
of asset fields by their names
|
protected static String |
ASSET_END_SUFFIX
The string that ends the expansion of a parm
|
protected static char |
ATTRIB_DELIM
The values and the corresponding attributes of an element are added
delimited by ATTRIB_DELIM
|
protected static String |
HARDWARE_BEGIN
The string that starts the expansion for a hardware field - used to lookup values
of hardware attributes by their index|name
|
protected static String |
HARDWARE_END_SUFFIX
The string that ends the expansion of a hardware
|
protected static char |
NAME_VAL_DELIM
For expansion of the '%parms[all]%' - the parm name and value are added
as delimiter separated list of '
|
protected static String |
NUM_PARMS_STR
The string that should be expanded to the number of parms
|
protected static String |
PARM_BEGIN
The string that starts the expansion for a parm - used to lookup values
of parameters by their names
|
protected static int |
PARM_BEGIN_LENGTH
The length of PARM_BEGIN
|
protected static String |
PARM_END_SUFFIX
The string that ends the expansion of a parm
|
protected static String |
PARM_NAME_NUMBERED_PREFIX
The string that starts a request for the name of a numbered parm
|
protected static int |
PARM_NAME_NUMBERED_PREFIX_LENGTH
The length of PARM_NAME_NUMBERED_PREFIX
|
protected static String |
PARM_NUM_PREFIX
The string that starts a parm number - used to lookup values of
parameters by their position
|
protected static int |
PARM_NUM_PREFIX_LENGTH
The length of PARM_NUM_PREFIX
|
protected static String |
PARMS_ALL
The string that should be expanded to a list of all parms
|
protected static String |
PARMS_NAMES
The string that should be expanded to a list of all parm names
|
protected static String |
PARMS_VALUES
The string that should be expanded to a list of all parm values
|
protected static char |
PERCENT
The '%' sign used to indicate parms to be expanded
|
protected static char |
SPACE_DELIM |
protected static String |
TAG_DESCR
The event descr xml tag
|
protected static String |
TAG_DPNAME
The event dpname xml tag
|
protected static String |
TAG_EVENT_DB_ID
The Event ID xml
|
protected static String |
TAG_FOREIGNID
The foreignid for the event's nodeid xml tag
|
protected static String |
TAG_FOREIGNSOURCE
The foreignsource for the event's nodeid xml tag
|
protected static String |
TAG_HOST
The event host xml tag
|
protected static String |
TAG_IFALIAS
The reverse DNS lookup of the interface
|
protected static String |
TAG_IFINDEX
The event ifindex xml tag
|
protected static String |
TAG_INTERFACE
The event interface xml tag
|
protected static String |
TAG_INTERFACE_RESOLVE
The reverse DNS lookup of the interface
|
protected static String |
TAG_LOGMSG
The event logmsg xml tag
|
protected static String |
TAG_MOUSEOVERTEXT
The event mouseovertext xml tag
|
protected static String |
TAG_NODEID
The event nodeid xml tag
|
protected static String |
TAG_NODELABEL
The event nodelabel xml tag
|
protected static String |
TAG_OPERINSTR
The event operinstruct xml tag
|
protected static String |
TAG_PERCENT_SIGN
Substitute the actual percent sign
|
protected static String |
TAG_SERVICE
The event service xml tag
|
protected static String |
TAG_SEVERITY
The event severity xml tag
|
protected static String |
TAG_SHORT_TIME
The event time xml tag, short format
|
protected static String |
TAG_SNMP
The SNMP xml tag
|
protected static String |
TAG_SNMP_COMMUNITY
The event snmp community xml tag
|
protected static String |
TAG_SNMP_GENERIC
The event snmp generic xml tag
|
protected static String |
TAG_SNMP_ID
The event snmp id xml tag
|
protected static String |
TAG_SNMP_IDTEXT
The event snmp idtext xml tag
|
protected static String |
TAG_SNMP_SPECIFIC
The event snmp specific xml tag
|
protected static String |
TAG_SNMP_VERSION
The event snmp version xml tag
|
protected static String |
TAG_SNMPHOST
The event snmp host xml tag
|
protected static String |
TAG_SOURCE
The event source xml tag
|
protected static String |
TAG_TIME
The event time xml tag
|
protected static Object |
TAG_TTICKET_ID |
protected static String |
TAG_UEI
The UEI xml tag
|
Constructor and Description |
---|
AbstractEventUtil() |
Modifier and Type | Method and Description |
---|---|
static String |
escape(String inStr,
char delimchar)
This method is used to escape required values from strings that may
contain those values.
|
void |
expandMapValues(Map<String,String> map,
Event event)
expandMapValues
|
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[
|
String |
expandParms(String inp,
Event event,
Map<String,Map<String,String>> decode)
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[
|
protected static String |
getAllParamValues(Event event)
Helper method.
|
protected static String |
getAllParmNames(Event event)
Helper method.
|
protected static String |
getAllParmValues(Event event)
Helper method.
|
protected abstract String |
getAssetFieldValue(String parm,
long nodeId)
Helper method.
|
String |
getEventHost(Event event)
getEventHost
|
protected abstract String |
getForeignId(long nodeId)
Retrieve foreign id from the node table of the database given a particular nodeId.
|
protected abstract String |
getForeignSource(long nodeId)
Retrieve foreign source from the node table of the database given a particular
nodeId.
|
protected abstract String |
getIfAlias(long nodeId,
String ipaddr)
Retrieve ifAlias from the snmpinterface table of the database given a particular
nodeId and ipAddr.
|
static EventUtil |
getInstance() |
String |
getNamedParmValue(String parm,
Event event)
Helper method.
|
protected abstract String |
getNodeLabel(long nodeId)
Retrieve nodeLabel from the node table of the database given a particular
nodeId.
|
protected static String |
getNumParmName(String parm,
Event event)
Helper method.
|
protected static String |
getNumParmValue(String parm,
Event event)
Helper method.
|
String |
getValueOfParm(String parm,
Event event)
Get the value of the parm for the event
|
static void |
setInstance(EventUtil instance)
Used only for unit testing.
|
static String |
splitAndExtract(String src,
String sep,
int offset,
boolean doRange,
int rangeLen) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getHardwareFieldValue, getHostName
protected static final String TAG_EVENT_DB_ID
protected static final String TAG_UEI
protected static final String TAG_SOURCE
protected static final String TAG_DESCR
protected static final String TAG_LOGMSG
protected static final String TAG_TIME
protected static final String TAG_SHORT_TIME
protected static final String TAG_DPNAME
protected static final String TAG_NODEID
protected static final String TAG_NODELABEL
protected static final String TAG_HOST
protected static final String TAG_INTERFACE
protected static final String TAG_FOREIGNSOURCE
protected static final String TAG_FOREIGNID
protected static final String TAG_IFINDEX
protected static final String TAG_INTERFACE_RESOLVE
protected static final String TAG_IFALIAS
protected static final String TAG_SNMP_ID
protected static final String TAG_SNMP
protected static final String TAG_SNMP_IDTEXT
protected static final String TAG_SNMP_VERSION
protected static final String TAG_SNMP_SPECIFIC
protected static final String TAG_SNMP_GENERIC
protected static final String TAG_SNMP_COMMUNITY
protected static final String TAG_SNMPHOST
protected static final String TAG_SERVICE
protected static final String TAG_SEVERITY
protected static final String TAG_OPERINSTR
protected static final String TAG_MOUSEOVERTEXT
protected static final Object TAG_TTICKET_ID
protected static final String ASSET_BEGIN
protected static final String ASSET_END_SUFFIX
protected static final char PERCENT
protected static final String PARMS_NAMES
protected static final String PARMS_VALUES
protected static final String PARMS_ALL
protected static final String PARM_BEGIN
protected static final int PARM_BEGIN_LENGTH
protected static final String NUM_PARMS_STR
protected static final String PARM_NUM_PREFIX
protected static final int PARM_NUM_PREFIX_LENGTH
protected static final String PARM_NAME_NUMBERED_PREFIX
protected static final int PARM_NAME_NUMBERED_PREFIX_LENGTH
protected static final String PARM_END_SUFFIX
protected static final char NAME_VAL_DELIM
protected static final char SPACE_DELIM
protected static final char ATTRIB_DELIM
protected static final String TAG_PERCENT_SIGN
protected static final String HARDWARE_BEGIN
protected static final String HARDWARE_END_SUFFIX
public static EventUtil getInstance()
public static void setInstance(EventUtil instance)
instance
- 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.
inStr
- string that might contain the delimiterdelimchar
- delimiter to escapeATTRIB_DELIM
public String getValueOfParm(String parm, Event event)
getValueOfParm
in interface EventUtil
parm
- the parm for which value is needed from the eventevent
- the event whose parm value is requiredprotected static String getAllParmValues(Event event)
event
- protected static String getAllParmNames(Event event)
event
- protected static String getAllParamValues(Event event)
event
- protected static String getNumParmName(String parm, Event event)
parm
- event
- public static String splitAndExtract(String src, String sep, int offset, boolean doRange, int rangeLen)
protected static String getNumParmValue(String parm, Event event)
parm
- event
- public String getNamedParmValue(String parm, Event event)
getNamedParmValue
in interface EventUtil
parm
- a String
object.event
- a Event
object.public void expandMapValues(Map<String,String> map, Event event)
expandMapValues
expandMapValues
in interface EventUtil
map
- a Map
object.event
- a Event
object.public String expandParms(String inp, Event event)
expandParms
in interface EventUtil
inp
- the input string in which parm values are to be expandedevent
- a Event
object.public String expandParms(String inp, Event event, Map<String,Map<String,String>> decode)
expandParms
in interface EventUtil
inp
- the input string in which parm values are to be expandeddecode
- the varbind decode for thisevent
- a Event
object.public String getEventHost(Event event)
getEventHost
getEventHost
in interface EventUtil
event
- a Event
object.connection
- a Connection
object.String
object.protected abstract String getNodeLabel(long nodeId) throws SQLException
nodeId
- Node identifierSQLException
- if database error encounteredprotected abstract String getForeignSource(long nodeId) throws SQLException
nodeId
- Node identifierSQLException
- if database error encounteredprotected abstract String getForeignId(long nodeId) throws SQLException
nodeId
- Node identifierSQLException
- if database error encounteredprotected abstract String getIfAlias(long nodeId, String ipaddr) throws SQLException
nodeId
- Node identifieripAddr
- Interface IP addressSQLException
- if database error encounteredCopyright © 2017. All rights reserved.