com.ibm.di.connector
Class SNMPConnector

java.lang.Object
  extended by com.ibm.di.connector.Connector
      extended by com.ibm.di.connector.SNMPConnector
All Implemented Interfaces:
ConnectorInterface, VersionInfoInterface, com.tivoli.snmp.TrapFilter, com.tivoli.snmp.TrapListener, Serializable

public class SNMPConnector
extends Connector
implements com.tivoli.snmp.TrapListener, com.tivoli.snmp.TrapFilter, ConnectorInterface

The SNMPConnector implements get/set/walk and trap-receive operations by means of the IBM Tivoli SNMP Stack.

The connector can operate in two modes: Client and Trap Receiver - Client Mode

In client mode you can use it in iterator mode where the connector will send a getnext request to the snmp agent and return one entry for each OID returned by the agent. In Lookup mode the connector will perform a get request returning the oid/value for the requested oid. The link criteria specifies: oid and optionally server, port and version.

- Trap Receiver Mode

In trap receiver mode the connector can only be used in Iterator mode. The connector will listen for incoming snmp traps and return each as an entry to the caller. Both V1, V2c and V3 traps are handled.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.ibm.di.connector.Connector
ALL_MODES, myLog, PROPERTY_MESSAGE, PROPERTY_READER, PROPERTY_WRITER
 
Constructor Summary
SNMPConnector()
          Constructor for the SNMPConnector object
 
Method Summary
 boolean filter(com.tivoli.snmp.SnmpTrap trap)
          Indicates that trap should be sent to this connector.
 Entry findEntry(SearchCriteria search)
          Searches for an entry matching the specified search criteria.
 Entry getNextEntry()
          Gets the nextEntry attribute of the SNMPConnector object
 String getVersion()
          Version information.
 void handle(com.tivoli.snmp.SnmpTrap trap)
          Trap listener
 void initialize(Object o)
          This methods initializes the SNMP API library, reads the Connector configurations parameters, subscribes for SNMP Traps and opens an SNMP session.
 void putEntry(Entry entry)
          Send SNMP data.
 void reconnect()
          Reconnect to the underlying data source.
 Entry returnEntry(Object obj)
          Checks the type of the given object.
 void selectEntries()
          This method initializes the SNMP PDU (protocol data unit) to be sent on all subsequent getNextEntry calls as part of the get next request.
 void terminate()
          This method unsubscribes from SNMP Trap events, terminates the SNMP API library, i.e.
 
Methods inherited from class com.ibm.di.connector.Connector
addFindEntry, allModes, clearFindEntries, debug, debugMode, deleteEntry, findEntry, getBoolean, getClassInstance, getConfiguration, getContext, getFindEntryCount, getFirstFindEntry, getLog, getMaxDuplicateEntries, getModes, getModes, getName, getNextClient, getNextFindEntry, getParam, getParser, getProperty, getPushbackEntry, getRawConnectorConfiguration, getRSInterface, getUI, hasConfigValue, hasParser, initParser, isDeltaSupported, isExceptionFatal, isIOException, logError, logmsg, modEntry, modEntry, pushback, queryOperations, queryReply, querySchema, queryTables, reconnect, registerScriptBeans, replyEntry, setConfiguration, setContext, setCurrent, setDebugMode, setLog, setMaxDuplicateEntries, setModes, setModes, setName, setParam, setParser, setProperty, setRSInterface, terminateServer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.di.connector.ConnectorInterface
deleteEntry, getConfiguration, getContext, getFindEntryCount, getFirstFindEntry, getMaxDuplicateEntries, getName, getNextClient, getNextFindEntry, getParam, getPushbackEntry, getRawConnectorConfiguration, isDeltaSupported, isExceptionFatal, isIOException, modEntry, modEntry, pushback, queryOperations, queryReply, querySchema, reconnect, registerScriptBeans, replyEntry, setConfiguration, setContext, setCurrent, setLog, setMaxDuplicateEntries, setName, setParam, setRSInterface, terminateServer
 

Constructor Detail

SNMPConnector

public SNMPConnector()
Constructor for the SNMPConnector object

Method Detail

getVersion

public String getVersion()
Version information.

Specified by:
getVersion in interface VersionInfoInterface
Returns:
version information

getNextEntry

public Entry getNextEntry()
                   throws Exception
Gets the nextEntry attribute of the SNMPConnector object

Specified by:
getNextEntry in interface ConnectorInterface
Overrides:
getNextEntry in class Connector
Returns:
The nextEntry value
Throws:
Exception - An exception is thrown if this method fails.
See Also:
ConnectorInterface.selectEntries()

returnEntry

public Entry returnEntry(Object obj)
                  throws Exception
Checks the type of the given object. If it is an Entry, it casts it to an Entry and returns it.

Parameters:
obj - String, Entry or Exception.
Returns:
returns null if a String is passed. Otherwise if an Entry is passed returns the Object cast to Entry.
Throws:
Exception - If the object is an Exception or is not an instance of the above classes, an Exception is thrown.

initialize

public void initialize(Object o)
                throws Exception
This methods initializes the SNMP API library, reads the Connector configurations parameters, subscribes for SNMP Traps and opens an SNMP session.

Specified by:
initialize in interface ConnectorInterface
Overrides:
initialize in class Connector
Parameters:
o - An object the AssemblyLine passes to the Connector on init
Throws:
Exception - An exception is thrown if this method fails.

terminate

public void terminate()
This method unsubscribes from SNMP Trap events, terminates the SNMP API library, i.e. this method cleans up.

Specified by:
terminate in interface ConnectorInterface
Overrides:
terminate in class Connector

selectEntries

public void selectEntries()
                   throws Exception
This method initializes the SNMP PDU (protocol data unit) to be sent on all subsequent getNextEntry calls as part of the get next request.

Specified by:
selectEntries in interface ConnectorInterface
Overrides:
selectEntries in class Connector
Throws:
Exception - An exception is thrown if this method fails.

findEntry

public Entry findEntry(SearchCriteria search)
                throws Exception
Searches for an entry matching the specified search criteria.

Specified by:
findEntry in interface ConnectorInterface
Overrides:
findEntry in class Connector
Parameters:
search - the search criteria
Returns:
the entry found
Throws:
Exception - An exception is thrown if this method fails.

putEntry

public void putEntry(Entry entry)
              throws Exception
Send SNMP data.

Specified by:
putEntry in interface ConnectorInterface
Overrides:
putEntry in class Connector
Parameters:
entry - an entry containing the SNMP data to send
Throws:
Exception - An exception is thrown if this method fails.

filter

public boolean filter(com.tivoli.snmp.SnmpTrap trap)
Indicates that trap should be sent to this connector.

Specified by:
filter in interface com.tivoli.snmp.TrapFilter
Parameters:
trap - the SnmpTrap object.
Returns:
true

handle

public void handle(com.tivoli.snmp.SnmpTrap trap)
Trap listener

Specified by:
handle in interface com.tivoli.snmp.TrapListener
Parameters:
trap - The SNMP trap to be handled

reconnect

public void reconnect()
               throws Exception
Reconnect to the underlying data source.

Overrides:
reconnect in class Connector
Throws:
Exception - if an error occurs.
See Also:
Connector.initialize(Object)