AdventNet Web NMS 4 API Specification

This class is for internal purpose only and is subjected to change. Developers are recommended not to use this API


com.adventnet.nms.fe.alert
Class AlertAPIProxyImpl

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--com.adventnet.nms.fe.alert.AlertAPIProxyImpl
All Implemented Interfaces:
AlertAPI, AlertListener, AlertObserver, BEFailOverListener, CommonAPI, CommonModuleAPI, java.rmi.Remote, java.io.Serializable, ShutDownObserver

public class AlertAPIProxyImpl
extends java.rmi.server.UnicastRemoteObject
implements AlertAPI, AlertObserver, AlertListener, BEFailOverListener, ShutDownObserver

This API is a proxy implementation of AlertAPI published by the Back End Server. This API is accessible either through RMI or directly from the same JVM. When RMI is enabled, i.e. by runninng RMI registry before the NMS FE server is started, the AlertAPI can be accessed remotely via RMI. It is published with RMI handle /AlertAPI on the FE server.

 Code Snippet:
 The following code exhibits the method to get the AlertAPI handle via RMI if executed in seperate JVM or 
 from the static method com.adventnet.nms.fe.alert.AlertFE.getAlertAPI() 
 if executed from the same JVM, and use it to get the no of crtical Alerts pending in NMS.
 
 
 import com.adventnet.nms.alertdb.AlertAPI; 
 import java.rmi.Naming;
 .
 .
 .
 try
 {
      AlerAPI alertAPI
      String apiString = "//hostName/AlertAPI";  // hostName specifies name of the host name
                                            // in which Web NMS Front End (FE) Server is running. The host name
                                            // in which Web NMS Back End (BE) server is running can also 
                                            // given in this place.   
      if(!com.adventnet.nms.util.PureServerUtils.smallNet)
      {
          //com.adventnet.nms.util.PureServerUtils.smallNet will be set false for different JVM
          
          alertAPI = (AlertAPI) Naming.lookup(apiString); //RMI lookup 
                                                          //This fetches the AlertAPI handle 
      }
      else
      {
          //com.adventnet.nms.util.PureServerUtils.smallNet will be set true for same JVM    
          
          alertAPI = com.adventnet.nms.fe.alert.AlertFE.getAlertAPI(); //Same JVM as of the NMS Front End server
      }
      if(alertAPI != null)
      {
          System.out.println("No of Critical alerts pending: " + alertAPI.getCriticalAlertsCount());
      }
 }
 catch(Exception e)
 {}
 
 

As specified above, code within the same JVM as that of the Web NMS FE server can simply use the AlertAPI handle provided by the static method com.adventnet.nms.fe.alert.AlertFE.getAlertAPI() to access the Alert API methods.

See Also:
AlertAPIImpl, Serialized Form

Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
AlertAPIProxyImpl()
           
 
Method Summary
 boolean addAlertListener(AlertListener obs)
          To receive notification when bulk delete of Alert occurs, the user has to implement the AlertListener interface and register to the AlertAPI by addAlertListener method.
 void addAnnotation(AlertAnnotation altan)
          To add AlertAnnotation object to the permanent storage.
 Alert checkOut(java.lang.String entity, int timeOut)
          This method checks out the Alert with the given name from the database for writing, with a write lock.
 Alert checkOutIfAvailable(java.lang.String entity)
          This method checks out the Alert with the given name from the database for writing, with a write lock.
 boolean checkWritePermission(Alert obj)
          Check whether this instance of the AlertObject can be written to the database.
 void clearAlert(Alert alert)
          Deprecated. as of WebNMS2.2
 void clearAlert(Alert alert, boolean dealWithLock)
          Clears the alert i.e, Changes the severity of the alert to clear To clear the Alert by locking.The user has to get the locked alert object by checkOutIfAvailable(String entity) method and then set the value of dealWithLock as true.
 void clearAlert(java.lang.String entity)
          Clears the alert i.e, Changes the severity of the alert to clear.
 void clearLockForObject(java.lang.String entity, int lockType)
          Release the specified lock type unconditionally for the AlertObject with the given name.
 void deleteAlert(Alert alert)
          Deprecated. as of WebNMS2.2
 void deleteAlert(Alert alert, boolean dealWithLock)
          Deletes the alert from the system To delete the Alert after locking the Alert object.The user has to get the locked alert object by checkOutIfAvailable(String entity) method and then set the value of dealWithLock as true.
 void deleteAlert(java.lang.String entity)
          Deletes the alert from the system
 void deleteAlertAnnotation(java.lang.String entity)
          To delete Alert Annotation for an Alert Object whose 'entity' matches with the input parameter.
 void deleteAlertHistory(java.lang.String entity)
          To delete Alert History for an Alert Object whose 'entity' matches with the input parameter.
 boolean deregisterForAlerts(AlertObserver obs)
          To deregister the AlertObserver that has been already registered.
 Alert getAlert(java.lang.String entity)
          This method gets the Alert Object whose entity field matches the parameter entity.
 int getAlertCount(java.lang.String[] category, int severity)
          Returns the number of alerts for the specified array of categories and severity
 int getAlertCount(java.lang.String category, int severity)
          Returns the number of alerts with given category and severity
 java.util.Properties getAlertModuleParams()
          Gets the Alert Module parameters and their values in java.util.Properties object.
 int getAlertQueueSize()
          The events processed by the event module are sent to the alert module for processing into alerts.
 java.util.Vector getAlerts(Alert alert)
          Get all alerts matching the criteria specified in the parameter alert Values can also be set to the user properties of the Alert for which matching should be done in the parameter alert.
 java.util.Vector getAlerts(Alert alert1, Alert alert2)
          This will get all alerts matching the properties in the first parameter alert1 Alert object and between the time specified in the first and second parameter alert2 Alert object.
 java.util.Vector getAlertsBasedOnGroupViewMode()
          For internal use only.
 int getAlertsCount(int severity)
          Returns the number of alerts with given severity in the WebNMS System.
 java.util.Vector getAnnotation(java.lang.String entity)
          Get the Complete set of AlertAnnotation Objects in a Vector for a particular Alert.
 java.lang.String getAnnotationNotes(java.lang.String entity)
          Deprecated. as of WebNMS2.2. Use getAnnotation() and getHistory() which will return Vector of AlertAnnotation and AlertHistory respectively.
 int getClearAlertsCount()
          Returns the number of alerts with Clear severity in the WebNMS System.
 java.util.Vector getCompleteList()
          This method returns a vector of all Persistent Object keys in the database.
 int getCriticalAlertsCount()
          Returns the number of alerts with Critical severity in the WebNMS System.
 int getCurrentLockType(Alert obj)
          Get the lock type currently held by the specified instance of the AlertObject.
 java.lang.String getGroupViewMode()
          Alert objects can be grouped based on the "groupName" property of the Alert.
 java.util.Vector getHistory(java.lang.String entity)
          Get the Complete set of AlertHistory Objects in a Vector for a particular Alert.
 int getMajorAlertsCount()
          Returns the number of alerts with Major severity in the WebNMS System.
 int getMaxSeverityofAlerts()
          The method returns the associated integer value of the maximum severity alert that is pending(or present) in the Web NMS system.
 int getMinorAlertsCount()
          Returns the number of alerts with Minor severity in the WebNMS System.
 java.util.Vector getNextAlertBasedOnGroupViewMode(java.lang.String groupName)
          For internal use only.
 Alert getNextAlertBasedOnModtime(java.lang.String entity)
          This method returns the Alert generated or modified next to the Alert whose 'entity' field is passed as parameter.
 java.util.Vector getObjectNamesWithProps(java.util.Properties p)
          Returns a Vector of all the Persistent Object IDs matching the properties given in the argument.
 java.util.Vector getObjects(java.lang.String classname, java.util.Properties match)
          Returns a vector of alert objects that belong to the specified classname.
 Alert getOldestModifiedAlert()
          To return the Oldest Modified Alert.
 java.util.Properties getPropertiesOfObject(java.lang.String objectname)
          Returns the Properties of the Persistent Object identified by the argument.
 int getTotalAlertCount()
          Returns Total number of Alerts in the WebNMS system.
 int getTotalAlertCount(java.lang.String category)
          Returns the total number of alerts for the specified category
 int getTotalAlertCount(java.lang.String[] category)
          Returns the total number of alerts for the specified array of categories
 int getWarningAlertsCount()
          Returns the number of alerts with Warning severity in the WebNMS System.
 boolean isDatabaseMode()
          Returns true, if Alert module is run in Database mode.
 void listenAlert(AlertActionInformer action)
          This method will be invoked by WebNMS, whenever an Alert related operation is performed.
 Alert lock(Alert obj, int lock_type, int timeout)
          This method will lock the specified Alert, by applying the given type of lock, which will actually define access levels for the object.
 void pauseFilterAction(java.lang.String[] runnableClassName)
          This method can be used to pause the filter action thread at runtime which is running.
 void pickUpAlert(Alert alert, java.lang.String who)
          Deprecated. as of WebNMS2.2 instead use the method pickUpAlert(String entity,String who)
 void pickUpAlert(Alert alert, java.lang.String who, boolean dealWithLock)
          Picks up an alert.
 void pickUpAlert(java.lang.String entity, java.lang.String who)
          Picks up an alert.
 void postBEFailOverNotification(BEFailOverEvent beEvent)
          Indicates that the FE server has successfully switched over its connection to the current primary BE server.
 void preBEFailOverNotification(BEFailOverEvent event)
          Indicates that the BE server, to which the FE server is connected, has failed and the FE server is going to try to connect to the standby BE server.
 void purgeAlertDB()
          Deletes all the alerts in the WebNMS.
 boolean registerForAlerts(AlertObserver obs)
          This method registers the given AlertObserver for notifications of various Alert related operations.
 boolean removeAlertListener(AlertListener obs)
          To deregister the AlertListener that has been already added by addAlertListener method
 void resumeFilterAction(java.lang.String[] runnableClassName)
          This method can be used to resume the filter action thread at runtime which has been paused.
 void saveAlertState()
          Saves the state of the FaultMgr.
 void setAlertModuleParams(java.util.Properties prop)
          Sets the Alert Module Parameters.
 boolean setAutoCommit(boolean b)
          This method sets the data base connection's auto-commit mode to true or false.
 void shutDown()
          Gets called whenever Web NMS Server shuts down.
 void unlock(Alert obj)
          Unlock the specified AlertObject.
 void unPickAlert(Alert alert, java.lang.String who, boolean dealWithLock)
          This method unpicks the alert, if it is already picked up by an user.
 void unPickAlert(java.lang.String entity, java.lang.String who)
          This method unpicks the alert, whose entity field matches entity, if it is already picked up by an user.
 void update(Alert al)
          For all Alert Observers which are registered to WebNMS, this method is invoked whenever there is an addition,updation or deletion of an Alert Object.
 void update(java.util.Vector v)
          This method is similar to the previous method except the argument which is a Vector of Alert Objects.
 void update(XMLNode node)
          This method will be invoked by WebNMS whenever bulk delete or purging of Alerts occur.
 boolean updateAlert(Alert alert)
          Updates the Alert, matching the entity as that of the alert passed as a parameter to the method.
 boolean updateAlert(Alert alert, boolean dealWithLock)
          Update the Alert in the NMS.All the properties of the existing alert will be replaced with the properties of the alert passed as parameter.To update the Alert by locking.The user has to get the locked alert object by checkOutIfAvailable(String entity) method and then set the value of dealWithLock as true.After the required action is performed the user has to unlock the Alert Object by unlock(Alert obj)
 void updateNotes(Alert alert, java.lang.String notes)
          Deprecated. as of WebNMS2.1
 void updateNotes(Alert alert, java.lang.String userName, java.lang.String notes)
          Deprecated. as of WebNMS2.1
 void updateNotes(Alert alert, java.lang.String userName, java.lang.String notes, boolean dealWithLock)
          To add annotation notes to the Alert.
 void updateNotes(java.lang.String entity, java.lang.String notes)
          To add annotation notes to the Alert
 void updateNotes(java.lang.String entity, java.lang.String username, java.lang.String notes)
          To add annotation notes to the Alert as annotated by user of name userName.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AlertAPIProxyImpl

public AlertAPIProxyImpl()
                  throws java.rmi.RemoteException
Method Detail

pickUpAlert

public void pickUpAlert(Alert alert,
                        java.lang.String who)
                 throws java.rmi.RemoteException
Deprecated. as of WebNMS2.2 instead use the method pickUpAlert(String entity,String who)

Picks up an alert. The owner of the alert object is changed to the name specified in the second argument.
Specified by:
pickUpAlert in interface AlertAPI
Parameters:
alert - The Alert Object to be picked up.
who - The user name to be assigned to the Alert.who field

pickUpAlert

public void pickUpAlert(java.lang.String entity,
                        java.lang.String who)
                 throws java.rmi.RemoteException
Picks up an alert. The owner of the alert object is changed to the name specified in the second argument.
Specified by:
pickUpAlert in interface AlertAPI
Parameters:
entity - The entity of the Alert object to be picked up.
who - The user name to be assigned to the Alert.who field

pickUpAlert

public void pickUpAlert(Alert alert,
                        java.lang.String who,
                        boolean dealWithLock)
                 throws java.rmi.RemoteException,
                        AccessDeniedException,
                        UserTransactionException,
                        FaultException
Picks up an alert. The owner of the alert object is changed to the name specified in the second argument.To pick up Alert by locking the Alert object. The user has to get the locked alert object by checkOutIfAvailable(String entity) method and then set the value of dealWithLock as true.After the required action is performed the user has to unlock the Alert Object by unlock(Alert obj)

Specified by:
pickUpAlert in interface AlertAPI
Parameters:
alert - The Alert Object to be picked up.
who - The user name to be assigned to the Alert.who field
dealWithLock - provides concurrency control for the Alert Object passed as an argument.
Throws:
AccessDeniedException - if the object is locked by some other thread and is not available for writing.
java.rmi.RemoteException - if request fails in remote machine
UserTransactionException - if the current transaction is timed out.

unPickAlert

public void unPickAlert(java.lang.String entity,
                        java.lang.String who)
                 throws java.rmi.RemoteException
This method unpicks the alert, whose entity field matches entity, if it is already picked up by an user. An AlertAnnotation entry will be entered for user who unpicked the alert.
Specified by:
unPickAlert in interface AlertAPI
Parameters:
entity - The entity of the Alert object to be picked up.
who - The user name who unpicking the alert

unPickAlert

public void unPickAlert(Alert alert,
                        java.lang.String who,
                        boolean dealWithLock)
                 throws java.rmi.RemoteException,
                        AccessDeniedException,
                        UserTransactionException,
                        FaultException
This method unpicks the alert, if it is already picked up by an user. An AlertAnnotation entry will be entered for user who unpicked the alert. To unpick up Alert by locking the Alert object. The user has to get the locked alert object by checkOutIfAvailable(String entity) method and then set the value of dealWithLock as true.After the required action is performed the user has to unlock the Alert Object by unlock(Alert obj)

Specified by:
unPickAlert in interface AlertAPI
Parameters:
Alert - The Alert object to be picked up.
who - The user name who unpicking the alert
dealWithLock - provides concurrency control for the Alert Object passed as an argument.
Throws:
AccessDeniedException - if the object is locked by some other thread and is not available for writing.
java.rmi.RemoteException - if request fails in remote machine
UserTransactionException - if the current transaction is timed out.

getAlert

public Alert getAlert(java.lang.String entity)
               throws java.rmi.RemoteException
This method gets the Alert Object whose entity field matches the parameter entity.
Specified by:
getAlert in interface AlertAPI
Parameters:
entity - Entity field of the Alert Object to be obtained
Returns:
Alert Object whose entity field matches the parameter entity. 'null' will be returned if no Alert object with entity field matching the parameter entity is available.

getAlerts

public java.util.Vector getAlerts(Alert alert)
                           throws java.rmi.RemoteException
Description copied from interface: AlertAPI
Get all alerts matching the criteria specified in the parameter alert Values can also be set to the user properties of the Alert for which matching should be done in the parameter alert.

The values set for the String based properties in parameter alert can take wildCard character * which stands for its well known purpose. The String based properties can also accept values that starts with character ! which stands for negation operation while matching. They can also accept ,(comma) seperated values which can match any one of the values seperated by comma.

      Example criteria for String based properties:
               
                  1. WebNMS*  - matches values startswith WebNMS
                  2. *WebNMS  - matches values endswith WebNMS
                  3. !WebNMS  - matches values that does not start with WebNMS
                  4. Node,Interface,Snmp  - matches any value that startwith 
                       any of the mentioned string                 
 

The values set for Numeric properties can only match the exact value given for the property in Alert object passed namely alert. For the properties modTime and createTime, this method will return all the Alerts whose modTime or createTime is greater than that of the given Alert's modTime or createTime respectively.

Specified by:
getAlerts in interface AlertAPI
Following copied from interface: com.adventnet.nms.alertdb.AlertAPI
Parameters:
alert - The alert object whose properties are used for filtering alerts.
Returns:
A Vector of Alerts matching the given critieria, returns all alerts if input alert is null and returns null if no alerts are matching for the properties of the given Alert.
Throws:
java.rmi.RemoteException - in request fails in remtoe machine
See Also:
AlertAPI.getAlerts(Alert alert1,Alert alert2), CommonAPI.getObjectNamesWithProps(Properties), CommonAPI.getPropertiesOfObject(String), CommonAPI.getCompleteList()

getAlerts

public java.util.Vector getAlerts(Alert alert1,
                                  Alert alert2)
                           throws java.rmi.RemoteException,
                                  FaultException
Description copied from interface: AlertAPI
This will get all alerts matching the properties in the first parameter alert1 Alert object and between the time specified in the first and second parameter alert2 Alert object. Values can also be set to the user properties of the Alert for which, matching should be done in the parameter alert1.

The values set for the String based properties in first Alert can take wildCard character * which stands for its well known purpose. The String based properties can a also accept values that starts with character ! which stands for negation operation while matching. They can also accept ,(comma) seperated values which can match any one of the values seperated by comma.

      Example criteria for String based properties:
               
                  1. WebNMS*  - matches values startswith WebNMS
                  2. *WebNMS  - matches values endswith WebNMS
                  3. !WebNMS  - matches values that does not start with WebNMS
                  4. Node,Interface,Snmp  - matches any value that startwith any of 
                      the mentioned string                 
 

The values set for Numeric properties can only match the exact value given for the property in alert object passed, namely alert1.

For the properties modTime and createTime the matching would take place as follows.

     1. modTime specified both in alert1 and alert2. 
         Matches the Alert whose modTime greater than that specified in alert1
          and less than specifed in alert2
     2. modTime specified only in alert1 and not in alert2:
          Matches the Alert whose modTime greater than specifed in alert1
     3.  modTime specified only in alert2 and not in alert1:
           Matches the Alert whose modTime less than specified in alert2
     4.  modTime not specified in both alert2 and alert1:
           modTime will not be taken as a filtering criteria
 
     The same matching mechanism will be followed for the property createTime 
 
Specified by:
getAlerts in interface AlertAPI
Following copied from interface: com.adventnet.nms.alertdb.AlertAPI
Parameters:
alert1 - The Alert object whose properties are used for filtering events. The time field indicates filtering all Alerts whose time is after the time indicated in this Alert.
alert2 - The time field indicates filtering all alerts whose time is before the time indicated in this Alert.
Returns:
A Vector of Alerts matching the given critieria. Returns all the alerts if alert1 is null and returns 'null' while no Alerts are there in WebNMS with the specified properties.
Throws:
java.rmi.RemoteException - if request fails in remote machine
FaultException - if there is any exception while fetching the alerts matching the properties
See Also:
CommonAPI.getObjectNamesWithProps(Properties), CommonAPI.getPropertiesOfObject(String), CommonAPI.getCompleteList()

purgeAlertDB

public void purgeAlertDB()
                  throws java.rmi.RemoteException,
                         NmsStorageException,
                         UserTransactionException
Description copied from interface: AlertAPI
Deletes all the alerts in the WebNMS. All the Alerts will be deleted from database including extended Alert's tables. Corresponding Annotation and History objects are deleted based on the value of ON_DELETING_ALERT_DELETE. parameter against EventMgr process in NmsProcessesBE.conf file. This parameter can have any of the following values.
 
 none
 history
 annotation
 both
 
 

If ON_DELETING_ALERT_DELETE is set to none, both history and annotation won't be deleted while deleting Alert. If it is set to annotation, only annotation will be deleted while deleting Alert. It it is set to history, only history will be deleted. Both history and annotation will be deleted it the parameter is is set to both. Before deleting Alerts, Alert Listeners will be notified about this operation.

Note: If Alerts are deleted through this method, ManagedObjects will not be updated.

Specified by:
purgeAlertDB in interface AlertAPI
Following copied from interface: com.adventnet.nms.alertdb.AlertAPI
Throws:
java.rmi.RemoteException - if request fails in remote machine
NmsStorageException - if any error occurs while updating the storage.
UserTransactionException - if there is any exception while making the transaction
See Also:
AlertAPI.deleteAlert(Alert alert,boolean dealWithLock)

getAnnotationNotes

public java.lang.String getAnnotationNotes(java.lang.String entity)
                                    throws java.rmi.RemoteException
Deprecated. as of WebNMS2.2. Use getAnnotation() and getHistory() which will return Vector of AlertAnnotation and AlertHistory respectively.

Get the Complete set of Annotation Notes for a particular Alert.
Specified by:
getAnnotationNotes in interface AlertAPI
Parameters:
entity - The unique entity name of the Alert.
Returns:
A formatted concatenation of all notes annotated either programmatically or by the end-user himself.

getAnnotation

public java.util.Vector getAnnotation(java.lang.String entity)
                               throws java.rmi.RemoteException,
                                      FaultException
Get the Complete set of AlertAnnotation Objects in a Vector for a particular Alert. The Vector will be arranged according to Annotation Object's modTime in ascending order. If there is no AlertAnnotation Object for that entity, this method will return null.
Specified by:
getAnnotation in interface AlertAPI
Parameters:
entity - The unique entity name of the Alert.
Returns:
The Vector of AlertAnnotation object. If the Annotation Object does not exist, returns null.
Throws:
java.rmi.RemoteException - if request fails in remote machine
FaultException - if any other exception occurs while processing the method.
See Also:
AlertAnnotation

getHistory

public java.util.Vector getHistory(java.lang.String entity)
                            throws java.rmi.RemoteException,
                                   FaultException
Get the Complete set of AlertHistory Objects in a Vector for a particular Alert. The Vector will be arranged according to History Object's modTime in ascending order. If there is no AlertHistory Object for that entity, this method will return null.
Specified by:
getHistory in interface AlertAPI
Parameters:
entity - The unique entity name of the Alert.
Returns:
The Vector of AlertHistory object. If the History Object does not exist, returns null.
Throws:
java.rmi.RemoteException - if request fails in remote machine
FaultException - if any other exception occurs while processing the method.
See Also:
AlertHistory

addAnnotation

public void addAnnotation(AlertAnnotation altan)
                   throws java.rmi.RemoteException,
                          UserTransactionException,
                          FaultException
To add AlertAnnotation object to the permanent storage. The permanent storage is a serialized file for serialized mode and table in database mode. If the modTime Annotation object is set using setModTime(), NMS will reset the modTime to current time in milliseconds. Hence using setModTime() should be avoided. There is no corresponding method like addHistory(AlertHistory altHistory) available in NMS, since History object is allowed to be added only by NMS and not by users.
Specified by:
addAnnotation in interface AlertAPI
Parameters:
AlertAnnotation - object to be added.
Throws:
java.rmi.RemoteException - if request fails in remote machine
UserTransactionException - if the current transaction is timed out.
FaultException - if any other exception occurs while processing the method.

deleteAlert

public void deleteAlert(Alert alert,
                        boolean dealWithLock)
                 throws java.rmi.RemoteException,
                        AccessDeniedException,
                        UserTransactionException,
                        FaultException
Deletes the alert from the system To delete the Alert after locking the Alert object.The user has to get the locked alert object by checkOutIfAvailable(String entity) method and then set the value of dealWithLock as true.

After the required action is performed the user has to unlock the Alert Object by unlock(Alert obj)

Specified by:
deleteAlert in interface AlertAPI
Parameters:
alert - The Alert object to be deleted
dealWithLock - provides concurrency control for the Alert Object passed as an argument.
Throws:
AccessDeniedException - if the object is locked by some other thread and is not available for writing.
java.rmi.RemoteException - if request fails in remote machine
UserTransactionException - if the current transaction is timed out.

deleteAlert

public void deleteAlert(Alert alert)
                 throws java.rmi.RemoteException
Deprecated. as of WebNMS2.2

Deletes the alert from the system
Specified by:
deleteAlert in interface AlertAPI
Parameters:
alert - The Alert object to be deleted

deleteAlert

public void deleteAlert(java.lang.String entity)
                 throws java.rmi.RemoteException
Deletes the alert from the system
Specified by:
deleteAlert in interface AlertAPI
Parameters:
entity - The entity of the alert object to be deleted

clearAlert

public void clearAlert(Alert alert)
                throws java.rmi.RemoteException
Deprecated. as of WebNMS2.2

Clears the alert i.e, Changes the severity of the alert to clear.
Specified by:
clearAlert in interface AlertAPI
Parameters:
alert - The Alert Object whose status is to be cleared.

clearAlert

public void clearAlert(Alert alert,
                       boolean dealWithLock)
                throws java.rmi.RemoteException,
                       AccessDeniedException,
                       UserTransactionException,
                       FaultException
Clears the alert i.e, Changes the severity of the alert to clear To clear the Alert by locking.The user has to get the locked alert object by checkOutIfAvailable(String entity) method and then set the value of dealWithLock as true.

After the required action is performed the user has to unlock the Alert Object by unlock(Alert obj)

Specified by:
clearAlert in interface AlertAPI
Parameters:
alert - The Alert Object whose status is to be cleared.
dealWithLock - provides concurrency control for the Alert Object passed as an argument.
Throws:
AccessDeniedException - if the object is locked by some other thread and is not available for writing.
java.rmi.RemoteException - if request fails in remote machine
UserTransactionException - if the current transaction is timed out.

clearAlert

public void clearAlert(java.lang.String entity)
                throws java.rmi.RemoteException
Clears the alert i.e, Changes the severity of the alert to clear.
Specified by:
clearAlert in interface AlertAPI
Parameters:
entity - The entity of thr Alert Object whose status is to be cleared.

updateAlert

public boolean updateAlert(Alert alert)
                    throws java.rmi.RemoteException,
                           UserTransactionException,
                           FaultException
Description copied from interface: AlertAPI
Updates the Alert, matching the entity as that of the alert passed as a parameter to the method. All the properties of the existing alert will be replaced with the properties of the alert passed as a parameter.

The user should note that the severity value of the alert object passed should not be equal to that of any NO-CRITICAL severities defined in the Web NMS system, as well as that of the Special Purpose severity defined. Similarly, the entity and the source field cannot be null, in which case the method call will fail.

The user can modify all the properties except that of PreviousSeverity(alert previous severity) and modTime(alert Modified time). The previous severity will be set from the severity of the existing alert and the modified time will be determined by the Web NMS server, which will update it with the exact time of modification.

If the Alert is updated, corresponding Managed Object will be updated based on ALERT_TO_MANAGEDOBJECT_PROPOGATION parameter against EventMgr process in NmsProcessesBE.conf file, this parameter can have any one of the following values

 
 max
 latest
 none
 
 
If ALERT_TO_MANAGEDOBJECT_PROPOGATION is set to none, Managed Object will not be updated by Alerts. If it is set to max, Managed Object will reflect the maximum severity of Alerts belongs to that Manged Object. If the Alert belongs to that Managed Object is updated, Managed Object will be updated by the maximum severity of the remaining Alerts. If there is no more Alerts for that Managed Object, then it will reflect status of the updated Alert. If ALERT_TO_MANAGEDOBJECT_PROPOGATION is set to latest, Managed Object will reflect the status of latest Alert belongs to that Managed Object.

The method will return a value true, if the updation is successfull or else false will be returned.

Note : FaultException will not be thrown when there is some problem while adding Alert history entry into ANNOTATION table.

Specified by:
updateAlert in interface AlertAPI
Following copied from interface: com.adventnet.nms.alertdb.AlertAPI
Parameters:
alert - The alert object by which the existing alert which has same matching entity will be updated with.
Returns:
true, if the updation had been successfully done, false if no entity or source fields of the Alert object is null or no Alert is there in WebNMS with the corresponding entity
Throws:
java.rmi.RemoteException - if request fails in remote machine
UserTransactionException - if there is any exception while making the transaction for update the alert
FaultException - wrapper for all other module level exceptions
See Also:
AlertAPI.updateAlert(Alert alert,boolean dealWithLock)

updateAlert

public boolean updateAlert(Alert alert,
                           boolean dealWithLock)
                    throws java.rmi.RemoteException,
                           AccessDeniedException,
                           UserTransactionException,
                           FaultException
Update the Alert in the NMS.All the properties of the existing alert will be replaced with the properties of the alert passed as parameter.To update the Alert by locking.The user has to get the locked alert object by checkOutIfAvailable(String entity) method and then set the value of dealWithLock as true.After the required action is performed the user has to unlock the Alert Object by unlock(Alert obj)

The user should note that the severity value of the alert object passed should not be equal to that of any NO-CRITICAL severities defined in the Web NMS system as well as that of the Special Purpose severity defined. Similarly the entity and the source field cannot be null, in which case the method call will fail.

The user can modify all the properties except that of PreviousSeverity(alert previous severity) and modTime(alert Modified time). The previous severity will be set from the severity of the existing alert and the modified time will be determined by the Web NMS server, which will update it with the exact time of modification.

The method will return a value true if the updation was successfull or else false will be returned.

Specified by:
updateAlert in interface AlertAPI
Parameters:
alert - The alert object with which the existing alert with the same matching entity will be updated with.
dealWithLock - provides concurrency control for the Alert Object passed as an argument.
Returns:
Returns true if the updation had been successfully done or else false will be returned.
Throws:
AccessDeniedException - if the object is locked by some other thread and is not available for writing.
java.rmi.RemoteException - if request fails in remote machine
UserTransactionException - if the current transaction is timed out.

updateNotes

public void updateNotes(Alert alert,
                        java.lang.String userName,
                        java.lang.String notes,
                        boolean dealWithLock)
                 throws java.rmi.RemoteException,
                        AccessDeniedException,
                        UserTransactionException,
                        FaultException
To add annotation notes to the Alert. If the userName is not given, it will be added with user name as "Default User". To add annotation notes by locking the Alert object. The user has to get the locked alert object by checkOutIfAvailable(String entity) method and then set the value of dealWithLock as true.After the required action is performed the user has to unlock the Alert Object by unlock(Alert obj)

Specified by:
updateNotes in interface AlertAPI
Parameters:
alert - The Alert object to which annotation has to be done.
notes - The text which is to be used for annotation.
userName - The name of the user who is adding the annotation
dealWithLock - provides concurrency control for the Alert Object passed as an argument.
Throws:
AccessDeniedException - if the object is locked by some other thread and is not available for writing.
java.rmi.RemoteException - if request fails in remote machine
UserTransactionException - if the current transaction is timed out.

updateNotes

public void updateNotes(Alert alert,
                        java.lang.String notes)
                 throws java.rmi.RemoteException
Deprecated. as of WebNMS2.1

To add annotation notes to the Alert.
Specified by:
updateNotes in interface AlertAPI
Parameters:
alert - The Alert object to which annotation has to be done.
notes - The text which is to be used for annotation.

updateNotes

public void updateNotes(java.lang.String entity,
                        java.lang.String notes)
                 throws java.rmi.RemoteException
To add annotation notes to the Alert
Specified by:
updateNotes in interface AlertAPI
Parameters:
entity - The entity of the Alert to which annotation has to be done.
notes - The text which is to be used for annotation.

updateNotes

public void updateNotes(java.lang.String entity,
                        java.lang.String username,
                        java.lang.String notes)
                 throws java.rmi.RemoteException
To add annotation notes to the Alert as annotated by user of name userName. This call would be useful for servlets in HTML UI.
Specified by:
updateNotes in interface AlertAPI
Parameters:
entity - The entity of the Alert to which annotation has to be done.
userName - The name of the user who is adding the annotation
notes - The text which is to be used for annotation.

updateNotes

public void updateNotes(Alert alert,
                        java.lang.String userName,
                        java.lang.String notes)
                 throws java.rmi.RemoteException
Deprecated. as of WebNMS2.1

To add annotation notes to the Alert as annotated by user of name userName. This call would be useful for servlets in HTML UI.
Specified by:
updateNotes in interface AlertAPI
Parameters:
alert - The Alert object to which annotation has to be done.
userName - The name of the user who is adding the annotation
notes - The text which is to be used for annotation.

getMaxSeverityofAlerts

public int getMaxSeverityofAlerts()
                           throws java.rmi.RemoteException
The method returns the associated integer value of the maximum severity alert that is pending(or present) in the Web NMS system.
Specified by:
getMaxSeverityofAlerts in interface AlertAPI
Throws:
java.rmi.RemoteException - When the api call fails via RMI.

getAlertsCount

public int getAlertsCount(int severity)
                   throws java.rmi.RemoteException
Description copied from interface: AlertAPI
Returns the number of alerts with given severity in the WebNMS System.
Specified by:
getAlertsCount in interface AlertAPI
Following copied from interface: com.adventnet.nms.alertdb.AlertAPI
Parameters:
severity - The severity value of the alert as specified in the SeverityInfo.conf file in the WebNMS/conf directory..
Returns:
Number of Alerts with the given severity
Throws:
java.rmi.RemoteException - when this API call fails via RMI
See Also:
AlertAPI.getTotalAlertCount(), AlertAPI.getAlertCount(String category,int severity), AlertAPI.getAlertCount(String category[],int severity)

getCriticalAlertsCount

public int getCriticalAlertsCount()
                           throws java.rmi.RemoteException
Description copied from interface: AlertAPI
Returns the number of alerts with Critical severity in the WebNMS System. The method has been deprecated to support configurable number of severities. The existing implementation will return the count of the alerts with the highest severity as defined in the file SeverityInfo.conf present in the WebNMS/conf directory.
Specified by:
getCriticalAlertsCount in interface AlertAPI
Following copied from interface: com.adventnet.nms.alertdb.AlertAPI
Returns:
Number of Critical Alerts
Throws:
java.rmi.RemoteException - if API call fails via RMI
See Also:
AlertAPI.getAlertsCount(int severity), AlertAPI.getAlertCount(String category,int severity), AlertAPI.getAlertCount(String category[],int severity)

getMajorAlertsCount

public int getMajorAlertsCount()
                        throws java.rmi.RemoteException
Description copied from interface: AlertAPI
Returns the number of alerts with Major severity in the WebNMS System. The method has been deprecated to support configurable number of severities. The existing implementation will return the count of the alerts with the second highest severity as defined in the file SeverityInfo.conf present in the WebNMS/conf directory.
Specified by:
getMajorAlertsCount in interface AlertAPI
Following copied from interface: com.adventnet.nms.alertdb.AlertAPI
Returns:
Number of Major Alerts
Throws:
java.rmi.RemoteException - if API call fails via RMI
See Also:
AlertAPI.getAlertsCount(int), AlertAPI.getAlertCount(String category,int severity), AlertAPI.getAlertCount(String category[],int severity)

getMinorAlertsCount

public int getMinorAlertsCount()
                        throws java.rmi.RemoteException
Description copied from interface: AlertAPI
Returns the number of alerts with Minor severity in the WebNMS System. The method has been deprecated to support configurable number of severities. The existing implementation will return the count of the alerts with the third highest severity as defined in the file SeverityInfo.conf present in the WebNMS/conf directory.
Specified by:
getMinorAlertsCount in interface AlertAPI
Following copied from interface: com.adventnet.nms.alertdb.AlertAPI
Returns:
Number of Minor Alerts
Throws:
java.rmi.RemoteException - if API call fails via RMI
See Also:
AlertAPI.getAlertsCount(int), AlertAPI.getAlertCount(String category,int severity), AlertAPI.getAlertCount(String category[],int severity)

getWarningAlertsCount

public int getWarningAlertsCount()
                          throws java.rmi.RemoteException
Description copied from interface: AlertAPI
Returns the number of alerts with Warning severity in the WebNMS System. The method has been deprecated to support configurable number of severities. The existing implementation will return the count of the alerts with the fourth highest severity as defined in the file SeverityInfo.conf present in the WebNMS/conf directory.
Specified by:
getWarningAlertsCount in interface AlertAPI
Following copied from interface: com.adventnet.nms.alertdb.AlertAPI
Returns:
Number of Warning Alerts
Throws:
java.rmi.RemoteException - if API call fails via RMI
See Also:
AlertAPI.getAlertsCount(int), AlertAPI.getAlertCount(String category,int severity), AlertAPI.getAlertCount(String category[],int severity)

getClearAlertsCount

public int getClearAlertsCount()
                        throws java.rmi.RemoteException
Description copied from interface: AlertAPI
Returns the number of alerts with Clear severity in the WebNMS System.
Specified by:
getClearAlertsCount in interface AlertAPI
Following copied from interface: com.adventnet.nms.alertdb.AlertAPI
Returns:
Number of cleared Alerts
Throws:
java.rmi.RemoteException - if API call fails via RMI
See Also:
AlertAPI.getAlertsCount(int), AlertAPI.getAlertCount(String category,int severity), AlertAPI.getAlertCount(String category[],int severity)

saveAlertState

public void saveAlertState()
                    throws java.rmi.RemoteException
Description copied from interface: AlertAPI
Saves the state of the FaultMgr. Since WebNMS2.3, NMS supports state less server, invocation of this method does nothing.
Specified by:
saveAlertState in interface AlertAPI
Following copied from interface: com.adventnet.nms.alertdb.AlertAPI
Throws:
java.rmi.RemoteException - if API call fails via RMI

getObjects

public java.util.Vector getObjects(java.lang.String classname,
                                   java.util.Properties match)
                            throws java.rmi.RemoteException,
                                   FaultException
Description copied from interface: AlertAPI
Returns a vector of alert objects that belong to the specified classname. Note that if you specify properties matching extended alerts, then you should specify the extended alert classname as the first argument. The complete Alert object (along with the extended properties) will be returned. If you specify base classname (Alert) for properties matching extended alerts, getObjects will return NULL.
Specified by:
getObjects in interface AlertAPI
Following copied from interface: com.adventnet.nms.alertdb.AlertAPI
Parameters:
classname - Name of the class to which the object belongs
match - The matching criteria in the form of Properties
Returns:
Vector of objects matching the given properties
Throws:
java.rmi.RemoteException - if API call fails via RMI
FaultException - if there is any exception while fetching the objects with given criteria
See Also:
CommonAPI.getObjectNamesWithProps(Properties), CommonAPI.getPropertiesOfObject(String)

registerForAlerts

public boolean registerForAlerts(AlertObserver obs)
                          throws java.rmi.RemoteException
Description copied from interface: AlertAPI
This method registers the given AlertObserver for notifications of various Alert related operations. The observer for alerts should implement AlertObserver interface and register that object with NMS by this method.
Specified by:
registerForAlerts in interface AlertAPI
Following copied from interface: com.adventnet.nms.alertdb.AlertAPI
Parameters:
obs - The AlertObserver interface implementor class which will be notified about various alert related operations.
Returns:
true, if the given object is registered as Alert Observer successfully, false otherwise. Returns 'false' if the argument is 'null'
Throws:
java.rmi.RemoteException - if request fails in remote machine
See Also:
AlertAPI.deregisterForAlerts(AlertObserver), AlertAPI.addAlertListener(AlertListener), AlertAPI.removeAlertListener(AlertListener), AlertListener, AlertActionInformer

deregisterForAlerts

public boolean deregisterForAlerts(AlertObserver obs)
                            throws java.rmi.RemoteException
To deregister the AlertObserver that has been already registered.
Specified by:
deregisterForAlerts in interface AlertAPI
Parameters:
obs - The AlertObserver that has to be deregistered.

setAutoCommit

public boolean setAutoCommit(boolean b)
                      throws java.rmi.RemoteException,
                             java.sql.SQLException
Description copied from interface: AlertAPI
This method sets the data base connection's auto-commit mode to true or false. By default, auto-commit mode is true.
Specified by:
setAutoCommit in interface AlertAPI
Following copied from interface: com.adventnet.nms.alertdb.AlertAPI
Parameters:
b - Decides the auto-commit mode
Returns:
true on Transaction is successful
Throws:
java.rmi.RemoteException - if request fails in remote machine
SQLException - When problem occurs dealing with DB

getPropertiesOfObject

public java.util.Properties getPropertiesOfObject(java.lang.String objectname)
                                           throws java.rmi.RemoteException,
                                                  NmsStorageException,
                                                  UserTransactionException
Description copied from interface: CommonAPI
Returns the Properties of the Persistent Object identified by the argument. The given argument is the uniqueKey of that API.
Specified by:
getPropertiesOfObject in interface CommonAPI

getObjectNamesWithProps

public java.util.Vector getObjectNamesWithProps(java.util.Properties p)
                                         throws java.rmi.RemoteException
Description copied from interface: CommonAPI
Returns a Vector of all the Persistent Object IDs matching the properties given in the argument. For example, in TopoAPI this method will return a Vector of all ManagedObject names matching the properties given in the argument. Here name is the uniqueKey for ManagedObject.
Specified by:
getObjectNamesWithProps in interface CommonAPI

getCompleteList

public java.util.Vector getCompleteList()
                                 throws java.rmi.RemoteException,
                                        NmsStorageException,
                                        UserTransactionException
Description copied from interface: CommonAPI
This method returns a vector of all Persistent Object keys in the database.
Specified by:
getCompleteList in interface CommonAPI

isDatabaseMode

public boolean isDatabaseMode()
                       throws java.rmi.RemoteException
Description copied from interface: AlertAPI
Returns true, if Alert module is run in Database mode. As of WebNMS2.3, NMS supports only data base mode, there is no need of using this method.
Specified by:
isDatabaseMode in interface AlertAPI
Following copied from interface: com.adventnet.nms.alertdb.AlertAPI
Returns:
true, if Alert module is run in DB mode
Throws:
java.rmi.RemoteException - if request fails in remote machine

getGroupViewMode

public java.lang.String getGroupViewMode()
                                  throws java.rmi.RemoteException
Alert objects can be grouped based on the "groupName" property of the Alert. Alerts with the same group name will form a group under this mechanism. When there is more than one alert in a group, one among them will represent that group. This is based on the setting of the parameter "GROUP_ALERTS_MODE" of com.adventnet.nms.eventdb.EventMgr module in the configuration file named processSmall_begin.conf_SERIALIZE_BE (Serialized mode) or processSmall_begin.conf_RDBMS_BE (RDBMS mode) present in WebNMS/conf directory of the Web NMS BackEnd server. This can be either "max","latest" or "none".

If the group mode is "none", then the alerts are not grouped and all the alerts are shown separately.

If the group mode is "max", then the alert of maximum severity, out of all the alerts belonging to that group, represents that group.

If the group mode is "latest", then the latest alert from an alert group represents that group.

This method will return the group view mode set in the configuration file processSmall_begin.conf_SERIALIZE_BE (Serialized mode) or processSmall_begin.conf_RDBMS_BE (RDBMS mode) as mentioned above.

Specified by:
getGroupViewMode in interface AlertAPI
Returns:
One of the three values : "max", "latest" or "none".

getAlertsBasedOnGroupViewMode

public java.util.Vector getAlertsBasedOnGroupViewMode()
                                               throws java.rmi.RemoteException,
                                                      FaultException
Description copied from interface: AlertAPI
For internal use only. Users are suggested not to use this method. Used by the AlertCustomView in FE
Specified by:
getAlertsBasedOnGroupViewMode in interface AlertAPI
Following copied from interface: com.adventnet.nms.alertdb.AlertAPI
Returns:
Vector which contains internal informations
Throws:
java.rmi.RemoteException - if request fails in remote machine
FaultException - if there are any exceptions while fetching alerts based on group view mode

getNextAlertBasedOnGroupViewMode

public java.util.Vector getNextAlertBasedOnGroupViewMode(java.lang.String groupName)
                                                  throws java.rmi.RemoteException,
                                                         FaultException
Description copied from interface: AlertAPI
For internal use only. Users are suggested not to use this method. Used by the AlertCustomView in FE.
Specified by:
getNextAlertBasedOnGroupViewMode in interface AlertAPI
Following copied from interface: com.adventnet.nms.alertdb.AlertAPI
Parameters:
groupName - The groupName field of Alert object
Returns:
Vector which contains internal informations
Throws:
java.rmi.RemoteException - if request fails in remote machine
FaultException - if there are any exceptions while fetching next alert based on group view mode

getAlertQueueSize

public int getAlertQueueSize()
                      throws java.rmi.RemoteException
The events processed by the event module are sent to the alert module for processing into alerts. This returns the number of events in the queue in alert module which are waiting to get processed.
Specified by:
getAlertQueueSize in interface AlertAPI
Returns:
The number of events waiting in the alert module to get processed.

getTotalAlertCount

public int getTotalAlertCount()
                       throws java.rmi.RemoteException,
                              FaultException
Description copied from interface: AlertAPI
Returns Total number of Alerts in the WebNMS system.
Specified by:
getTotalAlertCount in interface AlertAPI
Following copied from interface: com.adventnet.nms.alertdb.AlertAPI
Returns:
The total number of Alerts in WebNMS
Throws:
java.rmi.RemoteException - if request fails in remote machine
FaultException - if there are any exceptions while fetching total alerts count
See Also:
AlertAPI.getAlertCount(String category,int severity), AlertAPI.getAlertCount(String category[],int severity)

getNextAlertBasedOnModtime

public Alert getNextAlertBasedOnModtime(java.lang.String entity)
                                 throws java.rmi.RemoteException,
                                        FaultException
This method returns the Alert generated or modified next to the Alert whose 'entity' field is passed as parameter. Returns 'null' if no Alert object exists after the Alert whose 'entity' field is passed. Returns 'null' if the Alert whose 'entity' field is passed does not exist in the Server.
Specified by:
getNextAlertBasedOnModtime in interface AlertAPI
Following copied from interface: com.adventnet.nms.alertdb.AlertAPI
Parameters:
entity - The entity field of Alert Object
Returns:
Alert object which is next to the Alert specified by its entity based on modTime or currentTime whichever is applicable
Throws:
java.rmi.RemoteException - if request fails in remote machine
FaultException - if there are any exceptions while fetching next alert based on modified time
See Also:
AlertAPI.getOldestModifiedAlert()

deleteAlertAnnotation

public void deleteAlertAnnotation(java.lang.String entity)
                           throws java.rmi.RemoteException,
                                  FaultException,
                                  UserTransactionException
To delete Alert Annotation for an Alert Object whose 'entity' matches with the input parameter.
Specified by:
deleteAlertAnnotation in interface AlertAPI
Parameters:
entity - - 'entity' field of the Alert whose Annotation is to be deleted.
Throws:
java.rmi.RemoteException - if request fails in remote machine
FaultException - if any other exception occurs while processing the method.

deleteAlertHistory

public void deleteAlertHistory(java.lang.String entity)
                        throws java.rmi.RemoteException,
                               FaultException,
                               UserTransactionException
To delete Alert History for an Alert Object whose 'entity' matches with the input parameter.
Specified by:
deleteAlertHistory in interface AlertAPI
Parameters:
entity - - 'entity' field of the Alert whose History is to be deleted.
Throws:
java.rmi.RemoteException - if request fails in remote machine
FaultException - if any other exception occurs while processing the method.

getOldestModifiedAlert

public Alert getOldestModifiedAlert()
                             throws java.rmi.RemoteException,
                                    NmsStorageException
To return the Oldest Modified Alert.
Specified by:
getOldestModifiedAlert in interface AlertAPI
Returns:
Alert - The Alert object that has been modified least recently. Will return 'null' if there are no Alerts in NMS.

addAlertListener

public boolean addAlertListener(AlertListener obs)
                         throws java.rmi.RemoteException
To receive notification when bulk delete of Alert occurs, the user has to implement the AlertListener interface and register to the AlertAPI by addAlertListener method.
Specified by:
addAlertListener in interface AlertAPI
Parameters:
AlertListener - The user written class that implements AlertListener
Returns:
boolean returns true on successfull adding the AlertListener

removeAlertListener

public boolean removeAlertListener(AlertListener obs)
                            throws java.rmi.RemoteException
To deregister the AlertListener that has been already added by addAlertListener method
Specified by:
removeAlertListener in interface AlertAPI
Parameters:
AlertListener - The user written class that implements AlertListener
Returns:
boolean returns true on successfully removing the AlertListener

getAlertCount

public int getAlertCount(java.lang.String category,
                         int severity)
                  throws java.rmi.RemoteException,
                         FaultException
Returns the number of alerts with given category and severity
Specified by:
getAlertCount in interface AlertAPI
Parameters:
category - category of the Alert
severity - The severity value of the alert as specified in the SeverityInfo.conf file in the WebNMS/conf directory..

getTotalAlertCount

public int getTotalAlertCount(java.lang.String category)
                       throws java.rmi.RemoteException,
                              FaultException
Returns the total number of alerts for the specified category
Specified by:
getTotalAlertCount in interface AlertAPI
Parameters:
category - category of the Alert

getTotalAlertCount

public int getTotalAlertCount(java.lang.String[] category)
                       throws java.rmi.RemoteException,
                              FaultException
Returns the total number of alerts for the specified array of categories
Specified by:
getTotalAlertCount in interface AlertAPI
Parameters:
category - category of the Alerts

getAlertCount

public int getAlertCount(java.lang.String[] category,
                         int severity)
                  throws java.rmi.RemoteException,
                         FaultException
Returns the number of alerts for the specified array of categories and severity
Specified by:
getAlertCount in interface AlertAPI
Parameters:
category - category of the Alerts
severity - The severity value of the alert as specified in the SeverityInfo.conf file in the WebNMS/conf directory..

checkOutIfAvailable

public Alert checkOutIfAvailable(java.lang.String entity)
                          throws java.rmi.RemoteException,
                                 TimeoutException,
                                 FaultException
This method checks out the Alert with the given name from the database for writing, with a write lock. This method throws an Exception if the Alert object is locked by another thread and doesn't wait.
Specified by:
checkOutIfAvailable in interface AlertAPI
Parameters:
name - The unique name of the Alert to be checked out
Returns:
Alert, if it is present in the database null, if not present in the database
Throws:
RemoteException, - if a problem occurs when accessing through RMI.
TimeoutException, - if the object is locked by some other thread
FaultException - if any other exception occurs while processing the method.

checkOut

public Alert checkOut(java.lang.String entity,
                      int timeOut)
               throws java.rmi.RemoteException,
                      TimeoutException,
                      FaultException
This method checks out the Alert with the given name from the database for writing, with a write lock. If the Alert object to be checked out is currently locked by some other thread, this method keeps trying to check out the object for the specified time. If the Alert object becomes available for writing before the specified time, the object is fetched from the database, locked and returned back. Returns null if the Alert is not present in the database.
Specified by:
checkOut in interface AlertAPI
Parameters:
name - The unique name of the Alert to be checked out
timeOut - Time in seconds to wait, if the object is locked by some other thread.
Returns:
Alert Object, if it is present in the database null, if not present in the database
Throws:
TimeoutException, - if the object is not available for writing for the specified amount of time.
java.rmi.RemoteException - if request fails in remote machine
FaultException - if any other exception occurs while processing the method.

unlock

public void unlock(Alert obj)
            throws java.rmi.RemoteException,
                   FaultException
Unlock the specified AlertObject. This method will unlock the given AlertObject, releiving it of all the previously applied locks.
Specified by:
unlock in interface AlertAPI
Parameters:
obj - The Alert Object that is to be unlocked.
Throws:
java.rmi.RemoteException - if request fails in remote machine
FaultException - if any other exception occurs while processing the method.
See Also:
LockableObject

checkWritePermission

public boolean checkWritePermission(Alert obj)
                             throws java.rmi.RemoteException,
                                    FaultException
Check whether this instance of the AlertObject can be written to the database. This method checks whether the specified instance of the AlertObject currently holds a valid write lock, so that it can be written to the database.
Specified by:
checkWritePermission in interface AlertAPI
Parameters:
obj - The AlertObject instance that is to be checked whether it has a write lock.
Returns:
true if the object holds a write lock, false otherwise.
Throws:
java.rmi.RemoteException - if request fails in remote machine
FaultException - if any other exception occurs while processing the method.
See Also:
LockableObject

getCurrentLockType

public int getCurrentLockType(Alert obj)
                       throws java.rmi.RemoteException,
                              FaultException
Get the lock type currently held by the specified instance of the AlertObject. This method is useful in finding out what type of lock this instance of the AlertObject holds, when multiple instances hold different types of locks.
Specified by:
getCurrentLockType in interface AlertAPI
Parameters:
obj - AlertObject instance for which the lock type is to be obtained.
Returns:
The lock type value, as defined in the LockableObject interfae, currently held by the specified instance of the AlertObject. If the object instance is not locked previously, this method returns UNKNOWN_LOCK.
Throws:
java.rmi.RemoteException - if request fails in remote machine
FaultException - if any other exception occurs while processing the method.

clearLockForObject

public void clearLockForObject(java.lang.String entity,
                               int lockType)
                        throws java.rmi.RemoteException,
                               FaultException
Release the specified lock type unconditionally for the AlertObject with the given name. If under some exceptional condition, a AlertObject instance that was holding a lock, is lost before it has unlocked, then it will result in all subsequent requests for locks over that AlertObject to fail. In such a case, this method can be used to unconditionally release the specified lock type by giving just the name of the AlertObject. But the effect of this method depends entirely on the implementation of the LockableObject interface.
Specified by:
clearLockForObject in interface AlertAPI
Parameters:
name - Name of the AlertObject to be unlocked.
lockType - Type of the lock to be unlocked.
Throws:
java.rmi.RemoteException - if request fails in remote machine
FaultException - if any other exception occurs while processing the method.

lock

public Alert lock(Alert obj,
                  int lock_type,
                  int timeout)
           throws java.rmi.RemoteException,
                  TimeoutException
Description copied from interface: AlertAPI
This method will lock the specified Alert, by applying the given type of lock, which will actually define access levels for the object.
Specified by:
lock in interface AlertAPI
Following copied from interface: com.adventnet.nms.alertdb.AlertAPI
Parameters:
lock_type - Type of the lock to be locked. One of the constants present in LockableObject interface.
obj - AlertObject instance which is to be locked
timeout - Time in seconds to wait.
Returns:
The Alert with the lock set in it's lockId property.
Throws:
java.rmi.RemoteException - if request fails in remote machine
TimeoutException - if the Alert object is already locked and not available with in the spcified time interval,
See Also:
AlertAPI.unlock(Alert alt)

update

public void update(Alert al)
            throws java.rmi.RemoteException
Description copied from interface: AlertObserver
For all Alert Observers which are registered to WebNMS, this method is invoked whenever there is an addition,updation or deletion of an Alert Object. The corresponding Alert object is passed as the argument to this method. The other method AlertObserver.update(Vector) will be invoked when there are a group of alerts getting added or updated or deleted in the Web NMS system. In such case the Vector object will contain all the Alert Objects under operation.

As mentioned earlier, Alert Observer will be notified for all operations on Alerts viz. Additions ,Deletions and Updations. To ascertain whether the notification for the concerned Alert is due to addition or updation or deletion the user could use severity and previousSeverity properties of the Alert Object. The severity and previousSeverity of Alert object can be obtained using Alert.getSeverity() and Alert.getPreviousSeverity() methods respectively.

The information tabulated below could stand as a guideline for the users in this regard.

Operation type Severity Previous Severity
Addition int value based on the entry given in SeverityInfo.conf Special purpose Severity can be obtained from SeverityInfo.getSpecialPurposeSeverity()
Deletion Special purpose severity which can be obtained from SeverityInfo.getSpecialPurposeSeverity() int value based on the entry given in SeverityInfo.conf
Updation int value based on the entry given in SeverityInfo.conf int value based on the entry given in SeverityInfo.conf

Note: Alert processing thread waits until invocation of this method gets completed. Hence users are suggested not to overload this method. This method is invoked after Alert object is added in database

Specified by:
update in interface AlertObserver
Following copied from interface: com.adventnet.nms.alertdb.AlertObserver
Parameters:
alert - The Alert Object that has been either added or updated or deleted, in WebNMS system.
Throws:
java.rmi.RemoteException - if any exception in remote machine
See Also:
Alert, AlertObserver.update(Vector)

update

public void update(java.util.Vector v)
            throws java.rmi.RemoteException
Description copied from interface: AlertObserver
This method is similar to the previous method except the argument which is a Vector of Alert Objects. This method will be invoked when WebNMS processes high volume of Alert at a time. To improve the performance in the above circumstances, this particular call has been provided so that the observer could be intimated about the Alert Operation in one shot. Apart from this, there is no difference in the functionality of these two methods.

Note: Alert processing thread waits until invocation of this method gets completed. Hence users are suggested not to overload this method. This method is invoked after Alert objects are added in database

Specified by:
update in interface AlertObserver
Following copied from interface: com.adventnet.nms.alertdb.AlertObserver
Parameters:
vect - Vector of Alert Objects that has been added or updated or deleted by the Web NMS system
Throws:
java.rmi.RemoteException - if any exception occurs in remote machine
See Also:
Alert, AlertObserver.update(Alert)

update

public void update(XMLNode node)
            throws java.rmi.RemoteException
Description copied from interface: AlertListener
This method will be invoked by WebNMS whenever bulk delete or purging of Alerts occur. Bulk delete of Alerts occur when TopoAPI.deleteObjectAndSubElements(String objkey) method is invoked or for cascade delete when TopoAPI.deleteObjectAndSubElements(String objkey,int level) is invoked or when bulk delete is performed through client or when Alerts are purged using AlertAPI.purgeAlertDB().

The bulk delete or cascade delete occurs for deletion of a Network or a container parent, or a group relationship. When ever such a bulk delete of ManagedObjects occurs, the corresponding Alerts have to be deleted and intimated to the users who have registered themselves as AlertListener. The XMLNode which is passed as an argument to this method contains the query which could fetch Alert keys, corresponding to the deleted ManagedObject and its sub elements or the Alerts to be purged. The remote user can execute the query to get the entities of the deleted Alert. An example structure of XMLNode for bulk delete is shown below as an reference
  <BULK_DELETE_INFO>
  
	    <DATA
         sqlQuery=" select entity from Alert where "+RelationalUtil.getAlias("source")+" 
                in ( "+moKeys+" ) and "+ RelationalUtil.getAlias("ownerName")+" like "
                +"'"+ownerName+"'"

	       parentObjKey="192.168.4.0" 

         ownerName = "adventnet" />

      <PROPS
	       parentKey="192.168.4.0"  />
	
   </BULK_DELETE_INFO>
 
If the database access is not available to the remote user then the user has to get the names of the ManagedObjects deleted by TopoAPI.getObjectNamesWithProps(Properties p) method. The entity of the Alerts deleted for each ManagedObject can be obtained one by one by CommonAPI.getObjectNamesWithProps(Properties p) method.

An example structure of XMLNode for purge Alert is shown below as an reference

  <PURGE_ALERT>
	    <DATA
         sqlQuery="select ENTITY,OWNERNAME from Alert"/>
   </PURGE_ALERT>
 
Specified by:
update in interface AlertListener
Following copied from interface: com.adventnet.nms.alertdb.AlertListener
Parameters:
node - XMLNode which contains the entities of Alert
Throws:
RemoteException - if exception occurs in remote machine.

listenAlert

public void listenAlert(AlertActionInformer action)
                 throws java.rmi.RemoteException
Description copied from interface: AlertListener
This method will be invoked by WebNMS, whenever an Alert related operation is performed. When doing the following operations related to Alert object,intimation will be sent to the registered listeners. Operations are defined as integers in AlertConstants interface.

The various operations are

 AlertConstants.ALS_CLEAR_ALERT
 AlertConstants.ALS_DELETE_ALERT
 AlertConstants.ALS_PICKUP_ALERT
 AlertConstants.ALS_UNPICK_ALERT
 AlertConstants.ALS_UPDATE_ALERT
 AlertConstants.ALS_UPDATE_NOTES
 AlertConstants.ALS_NMS_ACTION
 
The operations can be identified by using AlertActionInformer.getOperation() method. This method returns AlertConstants.ALS_NMS_ACTION if NMS itself does any operation, like deletion of Alerts based on ALERT_WINDOW_SIZE and ALERT_DELETE_INTERVAL parameters or updation of Alerts through Events.

The user who is performing the corresponding operation, can be identified by using AlertActionInformer.getUserName() method. This method returns the corresponding user's name, if the operation is performed through UI. It returns RMIUser if the operation is performed through RMI. This method returns null if WebNMS itself does any operation.

AlertActionInformer.isBatchUpdate() method can be used to the identify, whether the corresponding operation is a batch one or not. If this method returns true, the corresponding alerts are stored in a Vector and can be accessed using AlertActionInformer.getAlertList() method. In this case AlertActionInformer.getAlert() method will return null. If AlertActionInformer.isBatchUpdate() method returns false, the corresponding alert object can be accesed by using AlertActionInformer.getAlert() method. In this case AlertActionInformer.getAlertList() returns null.

AlertActionInformer.getNotes() returns the corresponding notes added by the user, only when user updating the notes using AlertAPI.updateNotes(Alert alert,String userName,String notes, boolean lock) method or from UI. For all other operations this method will return null.

Specified by:
listenAlert in interface AlertListener
Following copied from interface: com.adventnet.nms.alertdb.AlertListener
Parameters:
action - AlertActionInformer object which encapsulates the details of the operation
Throws:
RemoteException - if any errors in remote machine.

preBEFailOverNotification

public void preBEFailOverNotification(BEFailOverEvent event)
Description copied from interface: BEFailOverListener
Indicates that the BE server, to which the FE server is connected, has failed and the FE server is going to try to connect to the standby BE server.

The FE server, on detecting the BE server failure, intimates all the BEFailOverListeners through this method and makes an attempt to switch over to the standby BE server. The attempt to switch over may fail, and this notification does not imply anything about the outcome of the switch over operation.

Specified by:
preBEFailOverNotification in interface BEFailOverListener
Following copied from interface: com.adventnet.nms.fe.common.BEFailOverListener
Parameters:
beFailOverEvent - An event object indicating BE fail over, containing details about the failed BE server and the current primary BE server
See Also:
BEFailOverListener.postBEFailOverNotification(BEFailOverEvent), MainSocketClientFE.registerBEFailOverListener(BEFailOverListener), MainSocketClientFE.deRegisterBEFailOverListener(BEFailOverListener)

postBEFailOverNotification

public void postBEFailOverNotification(BEFailOverEvent beEvent)
Description copied from interface: BEFailOverListener
Indicates that the FE server has successfully switched over its connection to the current primary BE server.

The FE server, on successfully switching over to the current primary BE server, notifies all the BEFailOverListeners through this method. This notification is the confirmation that the switch over operation has been successful.

Specified by:
postBEFailOverNotification in interface BEFailOverListener
Following copied from interface: com.adventnet.nms.fe.common.BEFailOverListener
Parameters:
beFailOverEvent - An event object indicating BE fail over, containing details about the failed BE server and the current primary BE server
See Also:
BEFailOverListener.preBEFailOverNotification(BEFailOverEvent), MainSocketClientFE.registerBEFailOverListener(BEFailOverListener), MainSocketClientFE.deRegisterBEFailOverListener(BEFailOverListener)

shutDown

public void shutDown()
Gets called whenever Web NMS Server shuts down.
Specified by:
shutDown in interface ShutDownObserver

getAlertModuleParams

public java.util.Properties getAlertModuleParams()
                                          throws java.rmi.RemoteException
Gets the Alert Module parameters and their values in java.util.Properties object. int, boolean values are also converted as String objects and stored in java.util.Properties object.

The following parameters and their values will be put in the java.util.Properties object and returned.

Alert Module Parameters Possible Values
ALERT_DELETE_INTERVAL int > 0 (numhours)
ALERT_TO_MANAGEDOBJECT_PROPOGATION max,latest,none
ALERTS_USER_PROPERTY latest,append,none
CREATE_ALERT_HISTORY true,false
ON_DELETING_ALERT_DELETE none,both,history,annotation
ACTION_ON_DELETING_MO clear,delete,none
ANNOTATION_TABLE_SIZE int >= 0
ALERT_LOCK true,false
ALERT_WINDOW_SIZE int > 0
GROUP_ALERTS_MODE max,latest,none
MAX_ALERTS_PER_BATCH int >= 0

Specified by:
getAlertModuleParams in interface AlertAPI
Returns:
Alert Module Parameters stored in java.util.Properties object
Throws:
java.rmi.RemoteException - if request fails in remote machine

setAlertModuleParams

public void setAlertModuleParams(java.util.Properties prop)
                          throws java.rmi.RemoteException,
                                 com.adventnet.nms.admin.InvalidParameterException
Sets the Alert Module Parameters. Fault Module parameters and their allowable values are tabulated as below. If the given value for any of the parameter is invalid, WebNMS takes the remaning all valid values and throws exception for that particular invalid value.

Alert Module Parameters Values Allowed
ALERT_DELETE_INTERVAL int > 0 (numhours)
ALERT_TO_MANAGEDOBJECT_PROPOGATION max,latest,none
ALERTS_USER_PROPERTY latest,append,none
CREATE_ALERT_HISTORY true,false
ON_DELETING_ALERT_DELETE none,both,history,annotation
ACTION_ON_DELETING_MO clear,delete,none
ANNOTATION_TABLE_SIZE int >= 0
ALERT_LOCK true,false
MAX_ALERTS_PER_BATCH int >= 0

Specified by:
setAlertModuleParams in interface AlertAPI
Parameters:
prop - java.util.Properties object in which Alert Module Parameters and their values are stored
Throws:
java.rmi.RemoteException - if request fails in remote machine
com.adventnet.nms.admin.InvalidParameterException - if invalid value is given for any of the Alert Module Parameter.

resumeFilterAction

public void resumeFilterAction(java.lang.String[] runnableClassName)
                        throws java.rmi.RemoteException
Description copied from interface: AlertAPI
This method can be used to resume the filter action thread at runtime which has been paused. This is applicable when the Alert Filter Action has been configured to run in separate thread on server startup. The functionality of running the event filter action in a separate thread cannot be configured and started using this method. Only already configured and running alert filter action thread which has been paused can be resumed. The default runnable(implementation) class is available to execute the SendEmail,SendTrap, and FilterCommand Action in separate thread.
Specified by:
resumeFilterAction in interface AlertAPI
Following copied from interface: com.adventnet.nms.alertdb.AlertAPI
Parameters:
runnableClassName - The classname with the package structure of the runnable class to be resumed.
Throws:
java.rmi.RemoteException - if a problem occurs when accessing through RMI. For eg, runnableClassName[0]="com.adventnet.nms.alertdb.SendEmailAlertAction" runnableClassName[1]="com.adventnet.nms.alertdb.SendTrapAlertAction" Note: The "FILTERACTION_FOR_ALERT_IN_THREAD" argument in EventMgr process must be set to true in NmsProcessBE.conf file to use this method.

pauseFilterAction

public void pauseFilterAction(java.lang.String[] runnableClassName)
                       throws java.rmi.RemoteException
Description copied from interface: AlertAPI
This method can be used to pause the filter action thread at runtime which is running. This is applicable when the Alert Filter Action has been configured to run in separate thread on server startup. The functionality of running the alert filter action in a separate thread cannot be configured and started using this method. The default runnable(implementation) class is available to execute the SendEmail,SendTrap, and FilterCommand Action in separate thread.
Specified by:
pauseFilterAction in interface AlertAPI
Following copied from interface: com.adventnet.nms.alertdb.AlertAPI
Parameters:
runnableClassName - The classname with the package structure of the runnable class to be resumed.
Throws:
java.rmi.RemoteException - if a problem occurs when accessing through RMI. For eg, runnableClassName[0]="com.adventnet.nms.alertdb.SendEmailAlertAction" runnableClassName[1]="com.adventnet.nms.alertdb.SendTrapAlertAction" Note: The "FILTERACTION_FOR_ALERT_IN_THREAD" argument in EventMgr process must be set to true in NmsProcessBE.conf file to use this method.

AdventNet Web NMS 4 API Specification