Package com.ibm.di.connector
Class SNMPServerConnector
- java.lang.Object
-
- com.ibm.di.connector.Connector
-
- 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
Nested Classes Modifier and Type Class Description 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
Constructors Constructor Description SNMPServerConnector()
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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)
CreatesCounter
object.com.tivoli.snmp.data.Counter64
createCounter64(long aValue)
CreatesCounter64
object.com.tivoli.snmp.data.FixedLengthOctetString
createFixedLengthOctetString(java.lang.String aValue)
CreatesFixedLengthOctetString
object.com.tivoli.snmp.data.FullCounter64
createFullCounter64(java.math.BigInteger aValue)
CreatesFullCounter64
object.com.tivoli.snmp.data.Gauge
createGauge(long aValue)
CreatesGauge
object.com.tivoli.snmp.data.IPAddress
createIPAddress(java.lang.String aValue)
CreatesIPAddress
object.com.tivoli.snmp.data.NoChange
createNoChange()
CreatesNoChange
object.com.tivoli.snmp.data.NoSuchInstance
createNoSuchInstance()
CreatesNoSuchInstance
object.com.tivoli.snmp.data.NoSuchObject
createNoSuchObject()
CreatesNoSuchObject
object.com.tivoli.snmp.data.NotSupported
createNotSupported()
CreatesNotSupported
object.com.tivoli.snmp.data.Null
createNull()
CreatesNull
object.com.tivoli.snmp.data.OctetString
createOctetString(java.lang.String aValue)
CreatesOctetString
object.com.tivoli.snmp.data.OID
createOID(java.lang.String aValue)
CreatesOID
object.com.tivoli.snmp.data.Opaque
createOpaque(byte[] aValue)
CreatesOpaque
object.com.tivoli.snmp.data.TimeTicks
createTimeTicks(long aValue)
CreatesTimeTicks
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.java.lang.String
getVersion()
Version information.void
initialize(java.lang.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(java.lang.String aCommunity)
Sets community parametervoid
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, extractExceptionInformation, 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
-
-
-
-
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(java.lang.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(java.lang.Object aObj) throws java.lang.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 interfaceConnectorInterface
- Overrides:
initialize
in classConnector
- Parameters:
aObj
- Null, DatagramPacket or ConnectorMode class- Throws:
java.lang.Exception
- If invalid Connector parameter values are supplied.
-
getNextClient
public ConnectorInterface getNextClient() throws java.lang.Exception
Server mode - returns a new instance of the Connector for each client connection.- Specified by:
getNextClient
in interfaceConnectorInterface
- Overrides:
getNextClient
in classConnector
- Returns:
- ConnectorInterface child SNMPServerConnector object that process client request
- Throws:
java.lang.Exception
- if an error occurs.
-
getNextEntry
public Entry getNextEntry() throws java.lang.Exception
Returns the next Entry from the SNMP client(Manager).- Specified by:
getNextEntry
in interfaceConnectorInterface
- Overrides:
getNextEntry
in classConnector
- Returns:
- - the next Entry, or null if the connection has been closed.
- Throws:
java.lang.Exception
- If retrieving the next Entry fails.- See Also:
ConnectorInterface.selectEntries()
-
replyEntry
public void replyEntry(Entry aEntry) throws java.lang.Exception
Send response to the SNMP client (Manager).- Specified by:
replyEntry
in interfaceConnectorInterface
- Overrides:
replyEntry
in classConnector
- Parameters:
aEntry
- The entry.- Throws:
java.lang.Exception
- If sending response fails.
-
putEntry
public void putEntry(Entry aEntry) throws java.lang.Exception
Send response to the SNMP client (Manager).- Specified by:
putEntry
in interfaceConnectorInterface
- Overrides:
putEntry
in classConnector
- Parameters:
aEntry
- The entry.- Throws:
java.lang.Exception
- If sending response fails.
-
terminateServer
public void terminateServer() throws java.lang.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 interfaceConnectorInterface
- Overrides:
terminateServer
in classConnector
- Throws:
java.lang.Exception
- if an error occurs
-
terminate
public void terminate() throws java.lang.Exception
Terminate the connector.- Specified by:
terminate
in interfaceConnectorInterface
- Overrides:
terminate
in classConnector
- Throws:
java.lang.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)
CreatesCounter
object.- Parameters:
aValue
- The long value to set.- Returns:
- the
Counter
instance.
-
createCounter64
public com.tivoli.snmp.data.Counter64 createCounter64(long aValue)
CreatesCounter64
object.- Parameters:
aValue
- The long value to set.- Returns:
- the
Counter64
instance.
-
createFixedLengthOctetString
public com.tivoli.snmp.data.FixedLengthOctetString createFixedLengthOctetString(java.lang.String aValue)
CreatesFixedLengthOctetString
object.- Parameters:
aValue
- The String value to set.- Returns:
- the
FixedLengthOctetString
instance.
-
createFullCounter64
public com.tivoli.snmp.data.FullCounter64 createFullCounter64(java.math.BigInteger aValue)
CreatesFullCounter64
object.- Parameters:
aValue
- The java.math.BigInteger value to set.- Returns:
- the
FullCounter64
instance.
-
createGauge
public com.tivoli.snmp.data.Gauge createGauge(long aValue)
CreatesGauge
object.- Parameters:
aValue
- The long value to set.- Returns:
- the
Gauge
instance.
-
createIPAddress
public com.tivoli.snmp.data.IPAddress createIPAddress(java.lang.String aValue)
CreatesIPAddress
object.- Parameters:
aValue
- The String value to set.- Returns:
- the
IPAddress
instance.
-
createNoChange
public com.tivoli.snmp.data.NoChange createNoChange()
CreatesNoChange
object.- Returns:
- the
NoChange
instance.
-
createNoSuchInstance
public com.tivoli.snmp.data.NoSuchInstance createNoSuchInstance()
CreatesNoSuchInstance
object.- Returns:
- the
NoSuchInstance
instance.
-
createNoSuchObject
public com.tivoli.snmp.data.NoSuchObject createNoSuchObject()
CreatesNoSuchObject
object.- Returns:
- the
NoSuchObject
instance.
-
createNotSupported
public com.tivoli.snmp.data.NotSupported createNotSupported()
CreatesNotSupported
object.- Returns:
- the
NotSupported
instance.
-
createNull
public com.tivoli.snmp.data.Null createNull()
CreatesNull
object.- Returns:
- the
Null
instance.
-
createOctetString
public com.tivoli.snmp.data.OctetString createOctetString(java.lang.String aValue)
CreatesOctetString
object.- Parameters:
aValue
- The String value to set.- Returns:
- the
OctetString
instance.
-
createOID
public com.tivoli.snmp.data.OID createOID(java.lang.String aValue)
CreatesOID
object.- Parameters:
aValue
- The String value to set.- Returns:
- the
OID
instance.
-
createOpaque
public com.tivoli.snmp.data.Opaque createOpaque(byte[] aValue)
CreatesOpaque
object.- Parameters:
aValue
- The byte[] value to set.- Returns:
- the
Opaque
instance.
-
createTimeTicks
public com.tivoli.snmp.data.TimeTicks createTimeTicks(long aValue)
CreatesTimeTicks
object.- Parameters:
aValue
- The long value to set.- Returns:
- the
TimeTicks
instance.
-
getVersion
public java.lang.String getVersion()
Version information.- Returns:
- version information
-
-