"WEBNMS_5 API Docs"

com.adventnet.nms.eventdb
Class Event

java.lang.Object
  extended by com.adventnet.nms.eventdb.Event
All Implemented Interfaces:
com.adventnet.nms.eventdb.corba.Event_CIOperations, DBExtendedInterface, DBInterface, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
InputEvent

public class Event
extends java.lang.Object
implements java.io.Serializable, DBExtendedInterface, com.adventnet.nms.eventdb.corba.Event_CIOperations

This class represents the events generated within Web NMS. Events are the complete set of notifications from the network and Events in Web NMS represent an important repository of management information within Web NMS. Every happening within the Web NMS system, like Managed Objects discovery, status update, Data collection exceeding Thresholds, processing traps etc., are registered as an Event. For every event reported or generated within Web NMS system, a corresponding instance of this class or its derived class will be created.

They are also involved in Event to Alert Correlation (Alert generation). Events can also be generated by the Users and added to Web NMS using Event API methods.

The Event class has a basic set of data fields (or standard properties) to hold values that are vital for Web NMS Management. Apart from these standard properties, additional properties (data) can also be added into the Event object either by extending the object or using the concept of User Properties.

Often applications do not need to create their own subclasses of Event, since it allows for easily storing custom properties in Event itself. Event contains a member field userProperties and methods setUserProperty(String,Object) and getUserProperty(String) which allow applications to store their data in an instance of this class, and access the data efficiently.

Like event.setUserProperty("userProp","NMS"); and retrieve it using the property by doing a call String nmsString = event.getUserProperty("userProp");

Every Event object generated or added within the Web NMS will be uniquely identified (equivalent to primary key) by an numeric identifier, known as id. This id will be automatically generated by the Web NMS system and the user has no control over its assignment. The ids are continuous positive integers starting from 1.

Users could only add Events and could not modify existing Events. Once the properties of an Event is set and added into the server cannot be modified. Events should be deleted only by Web NMS.

See Also:
EventAPI, Serialized Form

Constructor Summary
Event()
          This is the default Constructor of the Class.
 
Method Summary
 java.lang.Object clone()
          Creates and returns a copy of this object.
 void decodeObj(byte[] bytes)
          This method sets the properties of the Event object from the byte[] passed as an argument.
 byte[] encodeObj()
          This method converts all the properties of the Event Object along with their corresponding values into a byte stream and returns the stream as a byte[].
 java.lang.String getCategory()
          Accessor method to get the Category of the event.
 java.lang.Object getDeviceNotification()
          Returns the notification object with which the Event is generated.
 java.lang.String getDomain()
          Accessor method to get the Domain of the event.
 java.lang.Object getDynamicUserProperty(java.lang.String nam)
           
 java.lang.String getEntity()
          Accessor method to get the Entity of the Event.
 java.lang.String getGroupName()
          Accessor method to get the Group Name to which this event belongs.
 java.lang.String getHelpURL()
          Accessor method to get the Help URL set for this Event Object.
 int getId()
          Gets the unique id of this event object.
 java.lang.String getKey()
          Accessor method to get the key value of this Event.
 java.lang.String getKeyName()
          Returns the field names used as the unique key of this Event object.
 java.util.Map getMappedProperties()
           
 java.lang.String getNetwork()
          Accessor method to get the Network of this event.
 java.lang.String getNode()
          Accessor method to get the Node field of the Event.
 java.lang.String getOwnerName()
          Accessor method to get the name of the owner to which the corresponding Event object belongs.
 com.adventnet.nms.common.corba.Property_CT[] getProperties_CT()
          corba : corba implementation of getProperties()
 java.util.Properties getProperties()
          This method returns the values of all the fields in this event object as a key,value pair in a java.util.Properties object.
 int getSeverity()
          Accessor method to Get the Severity of the Event object.
 com.adventnet.snmp.snmp2.SnmpPDU getSnmpPDU()
          This method will return the Snmp Trap PDU reference associated with this event.
 java.lang.String getSource()
          Accessor method to get the Source of the event.
 java.lang.String getText()
          Accessor method to get the descriptive text message of the event.
 long getTime()
          Accessor method to get the time stamp at which the Event object is generated.
 com.adventnet.nms.common.corba.Property_CT[] getUserProperties_CT()
          corba: Event_CIOperations interface method
 java.util.Properties getUserProperties()
          The method returns all the user properties set in this event object as a key,value pair in a java.lang.Properties object.
 java.lang.String getUserProperty(java.lang.String nam)
          The method returns the value of user property present matching the name passed as argument.
 java.lang.String getWebNMS()
          Accessor method to Get the WebNMS server that owns this Event Object.
 java.lang.String removeUserProperty(java.lang.String nam)
          The method removes any user property present in the Event object matching the name passed as an argument and returns the value of the property if it exists, else null is returned.
 void setCategory(java.lang.String category)
          Modifier method to set the category of the event, like Topology event or Threshold event etc.
 void setDeviceNotification(java.lang.Object obj)
          This method will set the device notification object reference in Event with which this Event got generated.
 void setDomain(java.lang.String domain)
          Modifier method to set the Domain of the event.
 void setDynamicUserProperty(java.lang.String key, java.lang.Object value)
           
 void setEntity(java.lang.String entity)
          Modifier method to set the Entity of the Event.
 void setGroupName(java.lang.String group)
          Modifier method to set the Group Name to which this event belongs.
 void setHelpURL(java.lang.String helpURL)
          Modifier method to set the Help URL for this Event Object.
 void setId(int id)
          Sets the unique id of this event object.
 void setMappedProperties(java.util.Map mappedProps)
           
 void setNetwork(java.lang.String network)
          Modifier method to set the Network of the event.
 void setNode(java.lang.String node)
          Modifier method to set the Node field of the Event.
 void setOwnerName(java.lang.String owner)
          Modifier method to set the owner to which the corresponding Event object belongs.
 void setProperties_CT(com.adventnet.nms.common.corba.Property_CT[] properties)
          corba : corba implementation of setProperties()
 void setProperties(java.util.Properties p)
          This method sets the properties of the Event Object.
 void setSeverity(int severity)
          Modifier method to set the Severity of the Event object.
 void setSnmpPDU(com.adventnet.snmp.snmp2.SnmpPDU pdu)
          This method will set the Snmp Trap PDU reference that is to be associated with this event.
 void setSource(java.lang.String source)
          Modifier method to get the Source of the event.
 void setText(java.lang.String text)
          Modifier method used to set the descriptive text message of the event.
 void setTime(long time)
          Modifier method to set the time stamp at which the Event object is generated.
 void setUserProperty(java.lang.String nam, java.lang.String val)
          This method sets a user property to the Event Object.
 void setWebNMS(java.lang.String webNMS)
          Modifier method to set the Web NMS server that owns this Event Object.
 java.lang.String toLogString()
          This method returns a concatenated string, seperated by colon (:) containing the values of all the properties of this Event Object.
 java.lang.String toString()
          This method overrides the corresponding method in the java.lang.Object class.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Event

public Event()
This is the default Constructor of the Class. Every property of the object will be initialized with the value that is equal to the default initial value of the corresponding java data type to which the property belongs. The users should explicitly set the values for the properties, using the corresponding modifier methods present in this class, if they need to override the default settings.

Method Detail

getId

public int getId()
Gets the unique id of this event object. This is the key field of the Event Object. Id is a positive integer starting from 1 which is automatically generated and set by the Web NMS system. The Ids are allocated in sequence and all the event ids in the Event Database are continuous.

Specified by:
getId in interface com.adventnet.nms.eventdb.corba.Event_CIOperations
Returns:
The unique id of this event object.
See Also:
setId(int)

setId

public void setId(int id)
Sets the unique id of this event object. This is the primary key of the Event Object. Id is a positive integer starting from 1 which is automatically generated and set by the Web NMS system. Ids are allocated in sequence and all the event ids in the Event Database are assumed to be continuous.

Note: This method is for internal purpose. Even if the user sets the id for the Event using this method, the id field of the Event will be overridden by Web NMS. Since setting the id field is of no use, the users are suggested not to set id for Event.

Specified by:
setId in interface com.adventnet.nms.eventdb.corba.Event_CIOperations
Parameters:
id - The unique id of this event object.
See Also:
getId()

getText

public java.lang.String getText()
Accessor method to get the descriptive text message of the event.

Specified by:
getText in interface com.adventnet.nms.eventdb.corba.Event_CIOperations
Returns:
The text string of this event.
See Also:
setText(String)

setText

public void setText(java.lang.String text)
Modifier method used to set the descriptive text message of the event. This text (or message) field could be used to hold meaningfull information about the Event object created.

Specified by:
setText in interface com.adventnet.nms.eventdb.corba.Event_CIOperations
Parameters:
text - The text string to be set for the Event.
See Also:
getText()

getCategory

public java.lang.String getCategory()
Accessor method to get the Category of the event. The category field could help in the useful categorization of Events. This method will return 'null' if the 'category' field is not set.

Specified by:
getCategory in interface com.adventnet.nms.eventdb.corba.Event_CIOperations
Returns:
The category to which this event belongs too.
See Also:
setCategory(String)

setCategory

public void setCategory(java.lang.String category)
Modifier method to set the category of the event, like Topology event or Threshold event etc. The category field could help in the useful categorization of Events. Users could set the category for the Events generated from traps at the level of trap parsers or trap filters. They could also set the category at the level of Event parsers and Event Filters.

The 'category' field once set and added to the server cannot be modified.

Specified by:
setCategory in interface com.adventnet.nms.eventdb.corba.Event_CIOperations
Parameters:
category - The category to which this event belongs.
See Also:
getCategory()

setDeviceNotification

public void setDeviceNotification(java.lang.Object obj)
This method will set the device notification object reference in Event with which this Event got generated.

This method can be used to hold the notification object if the Event has been constructed through some notification type like Snmp Trap, TL1 Autonomous message, etc. The user should be informed that the notification reference set to this event object will not be stored in persistent storage of Web NMS, and is transient. Hence, when this event is retrieved back from the Data Store, the notification reference within the event object will be 'null'.

Parameters:
obj - - The Object reference with which the Event is generated.

getDeviceNotification

public java.lang.Object getDeviceNotification()
Returns the notification object with which the Event is generated. For example it could be SnmpPDU object for SnmpTrap notification or TL1AutonomousMessage for TL1 notification. Explicit type casting should be done according to the type of Object.

This method will return 'null', if the Event is generated by WebNMS status polling and no explicit Object reference is set using setDeviceNotification(Object ).

Returns:
Object - The Object reference with which the Event is generated or 'null' if no explicit reference is set.

getDomain

public java.lang.String getDomain()
Accessor method to get the Domain of the event. The use of this field could be Application specific. The Domain field could be used to hold any information that reflects the domain of the network element for which this event has been generated.

The corresponding modifier method present in this class can be used to set the domain of the Event. This method will return 'null' when the 'domain' field is not set.

Specified by:
getDomain in interface com.adventnet.nms.eventdb.corba.Event_CIOperations
Returns:
The domain of this event.
See Also:
setDomain(String)

setDomain

public void setDomain(java.lang.String domain)
Modifier method to set the Domain of the event. The use of this field could be Application specific. The domain field could be used to hold any information that reflects the domain of the network element for which this event has been generated. Users could set the 'domain' field for the Event generated at the level of Trap Filter,Trap Parsers, Event Parsers or Event Filters. The 'domain' field once set and added to the server cannot be modified.

Specified by:
setDomain in interface com.adventnet.nms.eventdb.corba.Event_CIOperations
Parameters:
domain - The domain of this event.
See Also:
getDomain()

getNetwork

public java.lang.String getNetwork()
Accessor method to get the Network of this event. The use of this field could be Application specific. The Network field could be used to hold any information that reflects the Network of the Managed object for which this event has been generated.

Users could set the Network for the Event generated at the level of Trap Filter, Trap Parsers, Event Parsers and Event Filters. The corresponding modifier method present in this class can be used to set the Network of the Event.

This method will return 'null' when the 'network' field is not set.

Specified by:
getNetwork in interface com.adventnet.nms.eventdb.corba.Event_CIOperations
Returns:
The Network information of this event.
See Also:
setNetwork(String)

setNetwork

public void setNetwork(java.lang.String network)
Modifier method to set the Network of the event. The use of this field could be Application specific. The Network field could be used to hold any information that reflects the Network of the Managed object for which this event has been generated.

Users could also set the Network for the Event generated even at the level of Trap Filter, Trap Parsers, Event Parsers and Event Filters. The 'network' field once set added to the server cannot be modified.

Specified by:
setNetwork in interface com.adventnet.nms.eventdb.corba.Event_CIOperations
Parameters:
network - The Network information of this event.
See Also:
getNetwork()

getNode

public java.lang.String getNode()
Accessor method to get the Node field of the Event. This field could be used to identify the corresponding network element for which this event is being generated. For the events that are generated by Web NMS, this field holds the key of the node object for which this event has been generated.

Users could set the Node for the Event generated at the level of Trap Filters, Trap Parsers, Event Parsers and Event Filters. The corresponding modifier method present in this class can be used to modify or set the Node field.

This method will return 'null' when the 'node' field is not set.

Specified by:
getNode in interface com.adventnet.nms.eventdb.corba.Event_CIOperations
Returns:
The Node value of this event.
See Also:
setNode(String)

setNode

public void setNode(java.lang.String node)
Modifier method to set the Node field of the Event. This field could be used to identify the corresponding network element for which this event is being generated. For the events that are generated by Web NMS, this field holds the key of the node object for which this event has been generated.

Users could set the Node for the Event generated, at the level of Trap Filters, Trap Parsers, Event Parsers and Event Filters. The 'node' field once set and added to the server cannot be modified.

Specified by:
setNode in interface com.adventnet.nms.eventdb.corba.Event_CIOperations
Parameters:
node - The Node string that has to be set for the Event.
See Also:
getNode()

getEntity

public java.lang.String getEntity()
Accessor method to get the Entity of the Event. This is an important field which holds the name of the entity for which this Event has been generated.

This is a key field, based on which Event Correlation into Alerts is achieved in Web NMS. All Events with the same Entity will result in only one Alert (i.e. entity is the primary key for an Alert Object).

They could use the corresponding modifier method present to set the entity field of an Event.

For events that are generated during discovery and status polling by Web NMS, this field holds the key of the Managed Object for which this event has been generated.

This method will return 'null' if the 'entity' field is not set. Events will be correlated into Alerts based on the 'entity' field and Alerts will update the corresponding Managed Object based on the 'source' field. The 'entity' field is more specific towards identifying the problem domain and 'source' field will be used to correlate the problem with the Managed object. The 'node' field could correspond to the node object. For example: The Agent in the printer could be configured to send notification to the server on the following cases: when the Printer Toner level goes below 10%, when the paper count goes below 50 and when Interface for the printer has problems. When Events are generated based on the notification for toner level the entity, source, node fields could be set with entity - printer_toner source - printer node - printer When Events are generated based on the notification for Interface going down, the fields could be set with entity - IF-printer_down source - IF-printer node - printer Here entity specifies the problem domain, source identifies the Managed object and node corresponds to the network object.

Specified by:
getEntity in interface com.adventnet.nms.eventdb.corba.Event_CIOperations
Returns:
The 'entity' field of this event.
See Also:
setEntity(String)

setEntity

public void setEntity(java.lang.String entity)
Modifier method to set the Entity of the Event. This is an important field which holds the name of the entity for which this Event has been generated.

This field is the key, based on which Event Correlation into Alerts is achieved in Web NMS. All Events with the same Entity will result in only one Alert (i.e. entity is the primary key for an Alert Object). For events that are generated during discovery and status polling by Web NMS, this field holds the key of the Managed Object for which this event has been generated.

Users could set the Entity of the Event generated at the level of Trap Filters, Trap Parsers, Event Parsers and Event Filters.

The 'entity' field once set and added to the server cannot be modified.

Specified by:
setEntity in interface com.adventnet.nms.eventdb.corba.Event_CIOperations
Parameters:
entity - The entity to be set for the Event generated.
See Also:
#getEntity(String)

getSeverity

public int getSeverity()
Accessor method to Get the Severity of the Event object. The Severity field stands as an indicator to the criticality of the Event. This field could hold any one of the severities defined in Web NMS system (refer the SeverityInfo.conf file under the WebNMS/conf directory to know about the severities defined in the Web NMS system).

By default, SpecialPurposeSeverity severity defined in the SeverityInfo.conf file will be set as the value of this field. The user could set the severity of the Event at the level of Trap Parser, Trap Filter, Event Parser and Event Filter. The corresponding modifier method present in this class can be used to set or modify the severity.

Specified by:
getSeverity in interface com.adventnet.nms.eventdb.corba.Event_CIOperations
Returns:
Returns the corresponding integer value of the severity set for the Event.
See Also:
setSeverity(int)

setSeverity

public void setSeverity(int severity)
Modifier method to set the Severity of the Event object. The Severity field stands as an indicator for the criticality of an Event. This field could hold any one of the severities defined in Web NMS system (refer the SeverityInfo.conf file under the WebNMS/conf directory to know about the severities defined in the Web NMS system).

By default SpecialPurposeSeverity defined in the SeverityInfo.conf file will be set as the value of this field. The user could set the severity of the Event at the level of Trap Parser, Trap Filter, Event Parser and Event Filter. If an invalid severity value is passed to the method, then the severity will be set to Info.

Specified by:
setSeverity in interface com.adventnet.nms.eventdb.corba.Event_CIOperations
Parameters:
severity - The integer value corresponding to the Severity to be set for the Event. If the severity value passed is invalid, then Info severity will be set to the Event.
See Also:
getSeverity()

getTime

public long getTime()
Accessor method to get the time stamp at which the Event object is generated. The method returns the time in the form of milliseconds for the Event object. The user could set the time value using the corresponding modifier method present in this class.

Specified by:
getTime in interface com.adventnet.nms.eventdb.corba.Event_CIOperations
Returns:
The method returns the time, in milliseconds of this Event occurrence (or creation).
See Also:
setTime(long)

setTime

public void setTime(long time)
Modifier method to set the time stamp at which the Event object is generated. The field is set as milliseconds for the Event object. The time field holds the time value at which this event has been created.

Specified by:
setTime in interface com.adventnet.nms.eventdb.corba.Event_CIOperations
Parameters:
time - The time value in milliseconds, to be set for the Event Object.
See Also:
getTime()

getSource

public java.lang.String getSource()
Accessor method to get the Source of the event. This field could hold the name field of the ManagedObject to which this event corresponds to. If this event is not related to any ManagedObject, this field could be empty or 'null'. This field is used to update the status of the corresponding ManagedObject with the severity of the event through Alert.

Users could use the corresponding modifier method present in this class to set the source of the Event. Events will be correlated into Alerts based on the 'entity' field and Alerts will update the corresponding Managed Object based on the 'source' field. The 'entity' field is more specific towards identifying the problem domain and 'source' field will be used to correlate the problem with the Managed object. The 'node' field could correspond to the node object. For example: The Agent in the printer could be configured to send notification to the server on the following cases: when the Printer Toner level goes below 10%, when the paper count goes below 50 and when Interface for the printer has problems. When Events are generated based on the notification for toner level the entity, source, node fields could be set with entity - printer_toner source - printer node - printer When Events are generated based on the notification for Interface going down, the fields could be set with entity - IF-printer_down source - IF-printer node - printer Here entity specifies the problem domain, source identifies the Managed object and node corresponds to the network object.

Specified by:
getSource in interface com.adventnet.nms.eventdb.corba.Event_CIOperations
Returns:
The source, if any, of the event.
See Also:
setSource(String)

setSource

public void setSource(java.lang.String source)
Modifier method to get the Source of the event. This field could hold the name of the ManagedObject to which this event corresponds to. If the event is not related to any ManagedObject, then this field could be empty or 'null'. This field is used to update the status of the corresponding ManagedObject with the severity of the event through Alert.

Events will be correlated into Alerts based on the 'entity' field and Alerts will update the corresponding Managed Object based on the 'source' field. The 'entity' field is more specific towards identifying the problem domain and 'source' field will be used to correlate the problem with the Managed object.

Specified by:
setSource in interface com.adventnet.nms.eventdb.corba.Event_CIOperations
Parameters:
source - The source of the event.
See Also:
getSource()

getHelpURL

public java.lang.String getHelpURL()
Accessor method to get the Help URL set for this Event Object. This field could hold the URL (or File path) of the html file that holds the help information about this event. The URL (or File path) should be related to the WebNMS/help directory. Using this field, the user could configure context sensitive help to be launched from the client, for each of the Event Generated.

In Java client on viewing the Event details, when the user clicks the Help button, this is the file that will be displayed as help to the Event object. The users could modify or set the help URL using the corresponding modifier method present in this class. This method will return 'null' when the 'helpURL' field is not set.

Specified by:
getHelpURL in interface com.adventnet.nms.eventdb.corba.Event_CIOperations
Returns:
Returns the Help URL (or file path) associated with this event object.
See Also:
setHelpURL(String)

setHelpURL

public void setHelpURL(java.lang.String helpURL)
Modifier method to set the Help URL for this Event Object. This field could hold the URL (or File path) of the html file that contains the help information about this event. The URL (or File path) should be related to WebNMS/help directory. Using this field, the user could configure context sensitive help to be launched from the client, for each of the Event Generated.

In Java client on viewing the Event details, when the users click the Help button, this is the file that will be displayed as help to the Event object. The 'helpURL' field once set and added to the server cannot be modified.

Specified by:
setHelpURL in interface com.adventnet.nms.eventdb.corba.Event_CIOperations
Parameters:
helpURL - The help file path relative to the WebNMS/help directory should be passed.
See Also:
getHelpURL()

getWebNMS

public java.lang.String getWebNMS()
Accessor method to Get the WebNMS server that owns this Event Object.

Specified by:
getWebNMS in interface com.adventnet.nms.eventdb.corba.Event_CIOperations
Returns:
The the name of the Web NMS server that owns this Event object.
See Also:
setWebNMS(String)

setWebNMS

public void setWebNMS(java.lang.String webNMS)
Modifier method to set the Web NMS server that owns this Event Object.

Specified by:
setWebNMS in interface com.adventnet.nms.eventdb.corba.Event_CIOperations
Parameters:
webNMS - The Web NMS server name that owns this Event Object.
See Also:
getWebNMS()

getGroupName

public java.lang.String getGroupName()
Accessor method to get the Group Name to which this event belongs. This field could hold the information that is helpful in grouping of Alerts. The Group Name set to an event will be copied on to the Alert created by this event and used in the grouping of Alerts.

Alerts with same 'groupName' field will be grouped while displaying Alerts in the client. The Group Name could be set using the corresponding modifier method present in this class. This method will return 'null' if the 'groupName' field is not set.

Specified by:
getGroupName in interface com.adventnet.nms.eventdb.corba.Event_CIOperations
Returns:
The group name to which this event belongs.
See Also:
setGroupName(String)

setGroupName

public void setGroupName(java.lang.String group)
Modifier method to set the Group Name to which this event belongs. This field could hold the information that is helpful in grouping of Alerts. The Group Name set to an event will be copied on to the Alert created by this event and used in the grouping of Alerts. Alerts with same 'groupName' field will be grouped while displaying Alerts in the client. The 'groupName' field once set and added to the server cannot be modified.

Specified by:
setGroupName in interface com.adventnet.nms.eventdb.corba.Event_CIOperations
Parameters:
group - The group name to be set for this Event object.
See Also:
getGroupName()

getOwnerName

public java.lang.String getOwnerName()
Accessor method to get the name of the owner to which the corresponding Event object belongs. The ownerName property could be used at a higher level to uniquely identify the Event, when the id field can no longer be used as the unique identification key for the Event. In such case, ownerName can be used in conjunction with the id to do so.

By Default the value of the OwnerName will be 'null'. This field is reserved for furture use. Currently users are requested not to set this field for holding any information as it may result in some undesirable effect..

Returns:
The owner name to which this Event belongs.

setOwnerName

public void setOwnerName(java.lang.String owner)
Modifier method to set the owner to which the corresponding Event object belongs. The ownerName property could be used at a higher level to uniquely identify the Event, when the id field can no longer be used as the unique identification key for the Event. By Default the value of the OwnerName will be 'null'. This field is reserved for furture use. Currently users are requested not to set this field for holding any information as it may result in some undesirable effect..

Parameters:
owner - The owner name to which this Event belongs.

toString

public java.lang.String toString()
This method overrides the corresponding method in the java.lang.Object class. The method returns the value in text field of this Event Object.

Overrides:
toString in class java.lang.Object
Returns:
Returns the value of the text field of this Event object.

toLogString

public java.lang.String toLogString()
This method returns a concatenated string, seperated by colon (:) containing the values of all the properties of this Event Object. This method is used by Web NMS internally for logging the properties of an Event Object when needed. The format of the String returned by this method is as follows

        :+id+:+severity+:+time+:+source+:+helpURL+:+category+:+domain+:+network+:+node+:+entity
        +:+text+:+groupName+[:+userproperty+:+userproperty....]+NEW_LINE_CHARACTER
 

Specified by:
toLogString in interface com.adventnet.nms.eventdb.corba.Event_CIOperations
Returns:
A concatenated string seperated by colon(:) containing the values of all the properties of this Event object.

getProperties

public java.util.Properties getProperties()
This method returns the values of all the fields in this event object as a key,value pair in a java.util.Properties object. The properties returned also includes the user properties of the Event Object. The keys of the Properties object returned will be the same as that of the names of the property fields in the Event Object.

Derived classes should override this method and invoke the super.getProperties() in the beginning of the method inorder to correctly return super classes' properties.

 For example : Let us suppose a class called MyEvent extends Event
 and has a property String myfield = "";
 The getProperties method code should be,
 
 public Properties getProperties() 
 {
    Properties p = super.getProperties();
    p.put("myfield", myfield);
    return p;
 }
 
 
The Properties object returned from this method will have the following keys, to get the values of the corresponding Event properties.

id, severity, time, text, category, domain, network, node, entity, source, helpURL, groupName, webNMS, stringseverity, ownerName and all user properties. Note : All values returned will be of type String. Users have to cast the String value into appropriate type.

Specified by:
getProperties in interface DBInterface
Returns:
The values of all the fields in this event object as a key,value pair in a java.lang.Properties object.
See Also:
setProperties(Properties)

clone

public java.lang.Object clone()
Creates and returns a copy of this object. This method overrides the clone() method of java.lang.Object. The method clones the current Event object and returns the cloned object (which is again an instance of Event).

Specified by:
clone in interface DBInterface
Overrides:
clone in class java.lang.Object
Returns:
The cloned object of this Event Object.

setProperties

public void setProperties(java.util.Properties p)
This method sets the properties of the Event Object. This method can be used to set the values of more than one property in one go, instead of using the get/set methods for each property. The java.lang.Properties object passed as an argument should contain the properties of the Event to be set as a key,value pair, where key should exactly match the name of the property field in the Event object. All the keys that do not match the names of any of the standard property field defined in the Event object, will be set as User property with the name in the Event Object.

The user should note that the values passed for the properties severity and time should be numerically convertible. If not, this method will not provide expected result. The user should also take care that the value set for the severity field is a valid severity defined in the Web NMS system, if not then Info severity will be set to the Event object. When 'null' is passed as argument the method returns without any function being performed.

Derived classes should override this method and invoke super.setProperties() at the end of this method. It is required that after the Derived classes have set their properties they remove it from the properties object they pass when calling super.setProperties(); This is to ensure the properties are not duplicated in the userProperties too. This will ensure that the user properties reflect correctly and do not contain redundant information.

 For example : Let us suppose a class called MyEvent extends 
 Event and has a field String myfield = "";
 In the setProperties() method (of class MyEvent) the proper code could likely be
 
 public void setProperties(Properties p) {
    if (p == null) return;
    if ((s = p.getProperty("myfield")) != null)  {
         myfield= s;
         p.remove("myfield");
    }
    super.setProperties(p);
  }
 
 

It should be noted that for the properties of the event that are not passed within the Properties object arguement, the previous values or default values will be retained.

Specified by:
setProperties in interface DBInterface
Parameters:
p - The java.lang.Properties object that contains the properties to be set for the Event Object. The key value should either exactly match the name of any standard property field in the Event Object or it will be considered as a User property to be set for the Event Object.

The following are the keys to be used in the argument Properties object, for the corresponding property of the Event.

 
            id, severity, time, text, category, domain, network, node, 
            entity, source, helpURL, groupName, webNMS, stringseverity, ownerName
            and all user properties.
 
 Note : All values must be specified as strings. The setProperties() method
 implementation should take care of casting the values to the appropriate type.
 
See Also:
getProperties()

setUserProperty

public void setUserProperty(java.lang.String nam,
                            java.lang.String val)
This method sets a user property to the Event Object. User properties are additional properties that the user intends to add above the existing set of standard properties present in the Event Object.

The user should note that there could be only one user property with the same name. When the user tries to set the same user property repeatedly, then only the existing user property with the same name will be overridden. Users are strongly recommended not to set a user property with the same name as any of the standard property name of the Event object, as it would cause some unpredictable effect while Web NMS handles this Event Object.

Specified by:
setUserProperty in interface DBExtendedInterface
Parameters:
nam - The name of the User property to be added. It should not be matching the name of any of the standard property of the Event Object. The user should take care that it is not null, else the user property will not be added.
val - The corresponding value(as an Object) of the User property. The user should take care that this value is not null, else the user property will be not be added.
See Also:
getUserProperty(String), removeUserProperty(String)

getUserProperty

public java.lang.String getUserProperty(java.lang.String nam)
The method returns the value of user property present matching the name passed as argument. The method returns null, if no user property exists with that name.

Specified by:
getUserProperty in interface DBExtendedInterface
Parameters:
nam - The name of the user property in the event object for which the value has to be returned by this method.
Returns:
Returns the value(as on Object)of the user property, if any, matching the name passed as an argument.
See Also:
#setUserProperty(String,Object), removeUserProperty(String)

getDynamicUserProperty

public java.lang.Object getDynamicUserProperty(java.lang.String nam)

setDynamicUserProperty

public void setDynamicUserProperty(java.lang.String key,
                                   java.lang.Object value)

removeUserProperty

public java.lang.String removeUserProperty(java.lang.String nam)
The method removes any user property present in the Event object matching the name passed as an argument and returns the value of the property if it exists, else null is returned.

Specified by:
removeUserProperty in interface DBExtendedInterface
Parameters:
nam - The name of the user property that has to be removed from the Event object.
Returns:
The value of the matching user property that is removed from the Event object. It will return null, if no user property exists matching the property name passed within the Event Object.
See Also:
getUserProperty(String), #setUserProperty(String,Object)

getUserProperties

public java.util.Properties getUserProperties()
The method returns all the user properties set in this event object as a key,value pair in a java.lang.Properties object. The keys of properties object will correspond to the name of the user properties and value corresponds to the value of the user property. The method will return null if no user property has been set in the Event Object.

Specified by:
getUserProperties in interface DBExtendedInterface
Returns:
Returns a java.lang.Properties object containing all the user properties defined within the Event object as a key,value pair.

encodeObj

public byte[] encodeObj()
This method converts all the properties of the Event Object along with their corresponding values into a byte stream and returns the stream as a byte[]. This method in combination with the decodeObj(byte[]) method present in this class is mainly used by Web NMS to achieve an effectvie serialization - deserialization mechanism of Event object for data transfer between client and server. It is also used for other similar functionalities within Web NMS.

Users could use this method in combination with the decodeObj(byte[]) method present in this class to achieve an effective serialization - deserialization mechanism of the Event object.

Returns:
The method returns a byte array containing the properties and their corresponding values of the Event Object.
See Also:
decodeObj(byte[])

decodeObj

public void decodeObj(byte[] bytes)
               throws java.io.IOException
This method sets the properties of the Event object from the byte[] passed as an argument. This method in combination with the encodeObj() method present in this class is used by Web NMS to effectively achieve serialization - deserialization of Event object for data transfer between client and server. It is also used for other similar functionalities within Web NMS.

Users could use this method in combination with the encodeObj() method present in this class to achieve an effective serialization - deserialization mechanism of the Event object.

Parameters:
bytes - The byte[] containing the properties along with their values to be set to the Event Object. The byte[] should be in the same format as returned by the encodeObj() method present in this class.
Throws:
java.io.IOException
See Also:
encodeObj()

getKey

public java.lang.String getKey()
Accessor method to get the key value of this Event. The key field could be id field or a combination of id field along with ownerName field. A particular Event object can be uniquely identified with the help of the return value from this method.

Since the key field could be either id when ownerName field is 'null' and combination of id and ownerName when ownerName field is not 'null', users are suggested to use this method to get the key value for an Event.

Specified by:
getKey in interface com.adventnet.nms.eventdb.corba.Event_CIOperations
Specified by:
getKey in interface DBInterface
Returns:
Returns the value of the key field of this event object.

getKeyName

public java.lang.String getKeyName()
Returns the field names used as the unique key of this Event object. This method is used to form the primary key of the event table, when the event object is stored in RDBMS table.

The fields names returned will be id when the ownerName field is 'null' or combination of id and ownerName when the ownerName field is not 'null'. This method is used internally by Web NMS.

Specified by:
getKeyName in interface com.adventnet.nms.eventdb.corba.Event_CIOperations
Specified by:
getKeyName in interface DBInterface
Returns:
The combination of field names used as the unique (primary) key of the event object.

getProperties_CT

public com.adventnet.nms.common.corba.Property_CT[] getProperties_CT()
corba : corba implementation of getProperties()

Specified by:
getProperties_CT in interface com.adventnet.nms.eventdb.corba.Event_CIOperations
Returns:
com.adventnet.nms.common.corba.Property_CT[]

setProperties_CT

public void setProperties_CT(com.adventnet.nms.common.corba.Property_CT[] properties)
corba : corba implementation of setProperties()

Specified by:
setProperties_CT in interface com.adventnet.nms.eventdb.corba.Event_CIOperations
Parameters:
properties - which is to be set to Event Object.

getUserProperties_CT

public com.adventnet.nms.common.corba.Property_CT[] getUserProperties_CT()
corba: Event_CIOperations interface method

Specified by:
getUserProperties_CT in interface com.adventnet.nms.eventdb.corba.Event_CIOperations
Returns:
com.adventnet.nms.common.corba.Property_CT[]

getSnmpPDU

public com.adventnet.snmp.snmp2.SnmpPDU getSnmpPDU()
This method will return the Snmp Trap PDU reference associated with this event. For this Event object to hold the reference of the SnmpPDU object, the Event should get created using Snmp Trap and the parameter TRANSIENT_TRAP_PDU_IN_EVENT against EventMgr process in NmsProcessesBE.conf file has to be set with true.

The returned reference will be 'null' when the event has not been generated through a Trap or when the TRANSIENT_TRAP_PDU_IN_EVENT parameter against EventMgr process, in the configuration file NmsProcessesBE.conf is set to false.

Returns:
Returns the com.adventnet.snmp.snmp2.SnmpPDU reference associated with this Event, if the event has been generated by a trap and the parameter TRANSIENT_TRAP_PDU_IN_EVENT is set to true. It returns 'null', if either the event has not been generated by a trap or if the TRANSIENT_TRAP_PDU_IN_EVENT parameter under the EventMgr module, in the server configuration file NmsProcessesBE.conf is set to false.

The user should be informed that the trap pdu reference set to this event object will not be stored in persistent storage of Web NMS, and is transient. Hence, when this event is retrieved back from the Data Store or using the Event API calls, the trap pdu reference within the event object will be 'null'. The transient reference could be used at the level of Event parsers and Event filters to access the properties of the Snmp Pdu with which this Event has been generated.

See Also:
setSnmpPDU(SnmpPDU)

setSnmpPDU

public void setSnmpPDU(com.adventnet.snmp.snmp2.SnmpPDU pdu)
This method will set the Snmp Trap PDU reference that is to be associated with this event. The reference will be set only in the case where this Event has been generated by a Trap and the parameter TRANSIENT_TRAP_PDU_IN_EVENT against EventMgr process in configuration file NmsProcessesBE.conf is set to true.

This method will be internally used by Web NMS to have the trap pdu associated with the event object created by it (the trap). This trap reference could be used at the level of Event Parsers and Event Filters to access the properties of the corresponding trap with which this event has been generated.

The user should be informed that the trap pdu set to this event object will not be stored in persistent storage of Web NMS, and is transient. Hence, when the same event is retrieved back from the Data Store using the Event API calls, the trap pdu reference within the event object will be 'null'.

Parameters:
pdu - The com.adventnet.snmp.snmp2.SnmpPDU to be associated with this event object.
See Also:
getSnmpPDU()

getMappedProperties

public java.util.Map getMappedProperties()

setMappedProperties

public void setMappedProperties(java.util.Map mappedProps)

"WEBNMS_5 API Docs"

Copyright © 2011 ZOHO Corp., All Rights Reserved.