com.ibm.di.connector
Class SNMPServerConnector

java.lang.Object
  extended by com.ibm.di.connector.Connector
      extended by com.ibm.di.connector.SNMPServerConnector
All Implemented Interfaces:
ConnectorInterface, VersionInfoInterface

public class SNMPServerConnector
extends Connector

The SNMP Server Connector is used by a monitoring console (an SNMP Manager). The SNMP Server Connector receives SNMP packets on a specified port, and returns appropriate SNMP response packets.


Nested Class Summary
static class SNMPServerConnector.EmptyValue
          An Empty Value used in internal code.
 
Field Summary
 
Fields inherited from class com.ibm.di.connector.Connector
ALL_MODES, myLog, PROPERTY_MESSAGE, PROPERTY_READER, PROPERTY_WRITER
 
Constructor Summary
SNMPServerConnector()
          Default constructor.
 
Method Summary
 com.tivoli.snmp.data.BadValue createBadValue()
          Convenient methods to create SNMP object types.
 com.tivoli.snmp.data.Boolean createBoolean(boolean aValue)
          Creates boolean object.
 com.tivoli.snmp.data.Counter createCounter(long aValue)
          Creates Counter object.
 com.tivoli.snmp.data.Counter64 createCounter64(long aValue)
          Creates Counter64 object.
 com.tivoli.snmp.data.FixedLengthOctetString createFixedLengthOctetString(String aValue)
          Creates FixedLengthOctetString object.
 com.tivoli.snmp.data.FullCounter64 createFullCounter64(BigInteger aValue)
          Creates FullCounter64 object.
 com.tivoli.snmp.data.Gauge createGauge(long aValue)
          Creates Gauge object.
 com.tivoli.snmp.data.IPAddress createIPAddress(String aValue)
          Creates IPAddress object.
 com.tivoli.snmp.data.NoChange createNoChange()
          Creates NoChange object.
 com.tivoli.snmp.data.NoSuchInstance createNoSuchInstance()
          Creates NoSuchInstance object.
 com.tivoli.snmp.data.NoSuchObject createNoSuchObject()
          Creates NoSuchObject object.
 com.tivoli.snmp.data.NotSupported createNotSupported()
          Creates NotSupported object.
 com.tivoli.snmp.data.Null createNull()
          Creates Null object.
 com.tivoli.snmp.data.OctetString createOctetString(String aValue)
          Creates OctetString object.
 com.tivoli.snmp.data.OID createOID(String aValue)
          Creates OID object.
 com.tivoli.snmp.data.Opaque createOpaque(byte[] aValue)
          Creates Opaque object.
 com.tivoli.snmp.data.TimeTicks createTimeTicks(long aValue)
          Creates TimeTicks object.
 ConnectorInterface getNextClient()
          Server mode - returns a new instance of the Connector for each client connection.
 Entry getNextEntry()
          Returns the next Entry from the SNMP client(Manager).
 SNMPServerConnector getServerConnector()
          Returns the server Connector if this Connector is handling a client session.
 String getVersion()
          Version information.
 void initialize(Object aObj)
          Initialize the Connector.
 boolean isAccepting()
          Checks if this Connector is currently waiting for a client connection.
 boolean isTerminating()
          Checks if termination is requested.
 void putEntry(Entry aEntry)
          Send response to the SNMP client (Manager).
 void replyEntry(Entry aEntry)
          Send response to the SNMP client (Manager).
 void setCommunity(String aCommunity)
          Sets community parameter
 void setServerConnector(SNMPServerConnector aServerConnector)
          Sets the server Connector for this Connector.
 void terminate()
          Terminate the connector.
 void terminateServer()
          This method tries to terminate the server by setting the termination flag for the Connector returned by getServerConnector and immediatly connecting to its port.
 
Methods inherited from class com.ibm.di.connector.Connector
addFindEntry, allModes, clearFindEntries, debug, debugMode, deleteEntry, findEntry, findEntry, getBoolean, getClassInstance, getConfiguration, getContext, getFindEntryCount, getFirstFindEntry, getLog, getMaxDuplicateEntries, getModes, getModes, getName, getNextFindEntry, getParam, getParser, getProperty, getPushbackEntry, getRawConnectorConfiguration, getRSInterface, getUI, hasConfigValue, hasParser, initParser, isDeltaSupported, isExceptionFatal, isIOException, logError, logmsg, modEntry, modEntry, pushback, queryOperations, queryReply, querySchema, queryTables, reconnect, reconnect, registerScriptBeans, selectEntries, setConfiguration, setContext, setCurrent, setDebugMode, setLog, setMaxDuplicateEntries, setModes, setModes, setName, setParam, setParser, setProperty, setRSInterface
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SNMPServerConnector

public SNMPServerConnector()
Default constructor.

Method Detail

getServerConnector

public SNMPServerConnector getServerConnector()
Returns the server Connector if this Connector is handling a client session.

Returns:
SNMPServerConnector The parent SNMPServerConnector

setCommunity

public void setCommunity(String aCommunity)
Sets community parameter

Parameters:
aCommunity - The community

setServerConnector

public void setServerConnector(SNMPServerConnector aServerConnector)
Sets the server Connector for this Connector.

Parameters:
aServerConnector - The serverConnector.

isAccepting

public boolean isAccepting()
Checks if this Connector is currently waiting for a client connection.

Returns:
true if this Connector is currently waiting for a client connection.

isTerminating

public boolean isTerminating()
Checks if termination is requested.

Returns:
true if this Connector has the termination flag set.

initialize

public void initialize(Object aObj)
                throws Exception
Initialize the Connector. To initialize this Connector with a DatagramPacket object for the obj parameter. In all other cases, the Connector will initialize an SNMP server(Agent) session.

Specified by:
initialize in interface ConnectorInterface
Overrides:
initialize in class Connector
Parameters:
aObj - Null, DatagramPacket or ConnectorMode class
Throws:
Exception - If invalid Connector parameter values are supplied.

getNextClient

public ConnectorInterface getNextClient()
                                 throws Exception
Server mode - returns a new instance of the Connector for each client connection.

Specified by:
getNextClient in interface ConnectorInterface
Overrides:
getNextClient in class Connector
Returns:
ConnectorInterface child SNMPServerConnector object that process client request
Throws:
Exception - if an error occurs.

getNextEntry

public Entry getNextEntry()
                   throws Exception
Returns the next Entry from the SNMP client(Manager).

Specified by:
getNextEntry in interface ConnectorInterface
Overrides:
getNextEntry in class Connector
Returns:
- the next Entry, or null if the connection has been closed.
Throws:
Exception - If retrieving the next Entry fails.
See Also:
ConnectorInterface.selectEntries()

replyEntry

public void replyEntry(Entry aEntry)
                throws Exception
Send response to the SNMP client (Manager).

Specified by:
replyEntry in interface ConnectorInterface
Overrides:
replyEntry in class Connector
Parameters:
aEntry - The entry.
Throws:
Exception - If sending response fails.

putEntry

public void putEntry(Entry aEntry)
              throws Exception
Send response to the SNMP client (Manager).

Specified by:
putEntry in interface ConnectorInterface
Overrides:
putEntry in class Connector
Parameters:
aEntry - The entry.
Throws:
Exception - If sending response fails.

terminateServer

public void terminateServer()
                     throws Exception
This method tries to terminate the server by setting the termination flag for the Connector returned by getServerConnector and immediatly connecting to its port.

Specified by:
terminateServer in interface ConnectorInterface
Overrides:
terminateServer in class Connector
Throws:
Exception - if an error occurs

terminate

public void terminate()
               throws Exception
Terminate the connector.

Specified by:
terminate in interface ConnectorInterface
Overrides:
terminate in class Connector
Throws:
Exception - if an error occurs.

createBadValue

public com.tivoli.snmp.data.BadValue createBadValue()
Convenient methods to create SNMP object types.

Returns:
the BadValue instance.

createBoolean

public com.tivoli.snmp.data.Boolean createBoolean(boolean aValue)
Creates boolean object.

Parameters:
aValue - The boolean value to set.
Returns:
the Boolean instance.

createCounter

public com.tivoli.snmp.data.Counter createCounter(long aValue)
Creates Counter object.

Parameters:
aValue - The long value to set.
Returns:
the Counter instance.

createCounter64

public com.tivoli.snmp.data.Counter64 createCounter64(long aValue)
Creates Counter64 object.

Parameters:
aValue - The long value to set.
Returns:
the Counter64 instance.

createFixedLengthOctetString

public com.tivoli.snmp.data.FixedLengthOctetString createFixedLengthOctetString(String aValue)
Creates FixedLengthOctetString object.

Parameters:
aValue - The String value to set.
Returns:
the FixedLengthOctetString instance.

createFullCounter64

public com.tivoli.snmp.data.FullCounter64 createFullCounter64(BigInteger aValue)
Creates FullCounter64 object.

Parameters:
aValue - The java.math.BigInteger value to set.
Returns:
the FullCounter64 instance.

createGauge

public com.tivoli.snmp.data.Gauge createGauge(long aValue)
Creates Gauge object.

Parameters:
aValue - The long value to set.
Returns:
the Gauge instance.

createIPAddress

public com.tivoli.snmp.data.IPAddress createIPAddress(String aValue)
Creates IPAddress object.

Parameters:
aValue - The String value to set.
Returns:
the IPAddress instance.

createNoChange

public com.tivoli.snmp.data.NoChange createNoChange()
Creates NoChange object.

Returns:
theNoChange instance.

createNoSuchInstance

public com.tivoli.snmp.data.NoSuchInstance createNoSuchInstance()
Creates NoSuchInstance object.

Returns:
the NoSuchInstance instance.

createNoSuchObject

public com.tivoli.snmp.data.NoSuchObject createNoSuchObject()
Creates NoSuchObject object.

Returns:
the NoSuchObject instance.

createNotSupported

public com.tivoli.snmp.data.NotSupported createNotSupported()
Creates NotSupported object.

Returns:
theNotSupported instance.

createNull

public com.tivoli.snmp.data.Null createNull()
Creates Null object.

Returns:
the Null instance.

createOctetString

public com.tivoli.snmp.data.OctetString createOctetString(String aValue)
Creates OctetString object.

Parameters:
aValue - The String value to set.
Returns:
the OctetString instance.

createOID

public com.tivoli.snmp.data.OID createOID(String aValue)
Creates OID object.

Parameters:
aValue - The String value to set.
Returns:
the OID instance.

createOpaque

public com.tivoli.snmp.data.Opaque createOpaque(byte[] aValue)
Creates Opaque object.

Parameters:
aValue - The byte[] value to set.
Returns:
the Opaque instance.

createTimeTicks

public com.tivoli.snmp.data.TimeTicks createTimeTicks(long aValue)
Creates TimeTicks object.

Parameters:
aValue - The long value to set.
Returns:
the TimeTicks instance.

getVersion

public String getVersion()
Version information.

Returns:
version information