AdventNet Web NMS 4 API Specification

com.adventnet.nms.eventdb
Interface EventParserAPI

All Superinterfaces:
CommonModuleAPI, java.rmi.Remote

public interface EventParserAPI
extends java.rmi.Remote, CommonModuleAPI

This API defines the methods for configuring Event Parsers. This has necessary methods to add EventParsers like setEventParser(Properties p) and setEventParsers(Properties[] array,boolean deleteOldParsers).

Existing EventParsers can be deleted using methods like deleteEventParser(String name) and deleteAllEventParsers().

This API has necessary method to enable and disable EventParsers. enableParsers(String[] parserNames,boolean flag) can be used for this purpose.

This API is accessible either through RMI or directly from the same JVM. When RMI is enabled, i.e. by running RMI registry before starting NMS server, EventParserAPI can be accessed remotely via RMI.

The following code snippet can be used to get EventParserAPI handle in secured and authenticated mode through RMI. In this mode, NMS needs userName and password to provide EventParserAPI handle.

 
 try
 {
    RMIAccessAPI rmiapi = (RMIAccessAPI)Naming.lookup("//hostName/RMIAccessAPI");
    EventParserAPI api = (EventParserAPI)rmiapi.getAPI("userName","password","EventParserAPI");
 }
 catch(Exception ee)
 {
     System.out.println("Error while getting EventParserAPI handle");
     ee.printStackTrace();
 }
 
 

The following code snippet can be used to get EventParserAPI handle through RMI, when RMI security mechanism of NMS is disabled.

 
 try
 {
     EventParserAPI api = (EventParserAPI)Naming.lookup("//hostName/EventParserAPI");
 }
 catch(Exception ee)
 {
    System.out.println("Error in getting EventParserAPI handle");
    ee.printStackTrace();
 }
 
 

For the same JVM as that of WebNMS server, com.adventnet.nms.util.NmsUtil#getAPI(EventParserAPI) can be used to get EventParserAPI handle.


Method Summary
 void deleteAllEventParsers()
          To delete all the event parsers in the server.
 boolean deleteEventParser(java.lang.String name)
          To delete an event parser in the server with the given name.
 void enableParsers(java.lang.String[] parserNames, boolean bool)
          To enable or disable Event Parsers specified by the parameter 'parserNames'.
 java.util.Properties[] getEventParsersFromFile(java.lang.String file)
          To get all the event parsers from the file.
 boolean saveEventParsersToFile(java.util.Properties[] props, java.lang.String file)
          To save a set of event parsers to a file.
 boolean setEventParser(java.util.Properties prop)
          To set an Event Parser to the server.
 boolean setEventParsers(java.util.Properties[] props, boolean deleteOldParsers)
          To set more than one event parser at a time on the server.
 

Method Detail

setEventParser

public boolean setEventParser(java.util.Properties prop)
                       throws java.rmi.RemoteException,
                              NmsStorageException,
                              FaultException
To set an Event Parser to the server. If an event Parser with the same name exists, then it is overwritten by the new one.
Parameters:
prop - the properties to be set to the event parser.
Returns:
success of the request.
Throws:
java.rmi.RemoteException - if request fails in remote machine
NmsStorageException - if any error occurs while storing the EventParser
FaultException - wrapper for all other module level errors
See Also:
EventParser

setEventParsers

public boolean setEventParsers(java.util.Properties[] props,
                               boolean deleteOldParsers)
                        throws java.rmi.RemoteException,
                               NmsStorageException,
                               FaultException
To set more than one event parser at a time on the server.
Parameters:
props - The array of Properties objects. Each Properties object corressponds to one event parser.
deleteOldParsers - Whether to delete the existing event parsers or retain them.
Returns:
Success of the request.
Throws:
java.rmi.RemoteException - if request fails in remote machine
NmsStorageException - if any error occurs while storing the EventParsers
FaultException - wrapper for all other module level errors
See Also:
EventParser

deleteEventParser

public boolean deleteEventParser(java.lang.String name)
                          throws java.rmi.RemoteException,
                                 NmsStorageException,
                                 FaultException
To delete an event parser in the server with the given name.
Parameters:
name - the name of the event parser.
Returns:
true if an event parser with that name exists. Otherwise false.
Throws:
java.rmi.RemoteException - if request fails in remote machine
NmsStorageException - if any error occurs while storing the changes
FaultException - wrapper for all other module level errors

deleteAllEventParsers

public void deleteAllEventParsers()
                           throws java.rmi.RemoteException
To delete all the event parsers in the server.
Throws:
java.rmi.RemoteException -  

getEventParsersFromFile

public java.util.Properties[] getEventParsersFromFile(java.lang.String file)
                                               throws java.rmi.RemoteException,
                                                      FaultException
To get all the event parsers from the file.
Parameters:
file - the name of the file.
Returns:
an array of Properties objects.
Throws:
java.rmi.RemoteException - if request fails in remote machine
FaultException - wrapper for all other module level errors
See Also:
saveEventParsersToFile(Properties[],String)

saveEventParsersToFile

public boolean saveEventParsersToFile(java.util.Properties[] props,
                                      java.lang.String file)
                               throws java.rmi.RemoteException,
                                      NmsStorageException,
                                      FaultException
To save a set of event parsers to a file.
Parameters:
props - the Properties objects representing the event parsers
file - the name of the file
Returns:
success of the request.
Throws:
java.rmi.RemoteException - if request fails in remote machine
NmsStorageException - if any error occurs while storing the EventParsers
FaultException - wrapper for all other module level errors
See Also:
EventParser

enableParsers

public void enableParsers(java.lang.String[] parserNames,
                          boolean bool)
                   throws java.rmi.RemoteException,
                          NmsStorageException,
                          FaultException
To enable or disable Event Parsers specified by the parameter 'parserNames'.
Parameters:
parserNames - - String [] containing Event Parser names.
bool - - boolean 'true' sets the Event Parsers enabled and 'false' sets disabled.
Throws:
java.rmi.RemoteException - if request fails in remote machine
NmsStorageException - if error occurs while storing the changes
FaultException - wrapper for all other module level errors

AdventNet Web NMS 4 API Specification