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 classSNMPServerConnector.EmptyValueAn 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.BadValuecreateBadValue()Convenient methods to create SNMP object types.com.tivoli.snmp.data.BooleancreateBoolean(boolean aValue)Creates boolean object.com.tivoli.snmp.data.CountercreateCounter(long aValue)CreatesCounterobject.com.tivoli.snmp.data.Counter64createCounter64(long aValue)CreatesCounter64object.com.tivoli.snmp.data.FixedLengthOctetStringcreateFixedLengthOctetString(java.lang.String aValue)CreatesFixedLengthOctetStringobject.com.tivoli.snmp.data.FullCounter64createFullCounter64(java.math.BigInteger aValue)CreatesFullCounter64object.com.tivoli.snmp.data.GaugecreateGauge(long aValue)CreatesGaugeobject.com.tivoli.snmp.data.IPAddresscreateIPAddress(java.lang.String aValue)CreatesIPAddressobject.com.tivoli.snmp.data.NoChangecreateNoChange()CreatesNoChangeobject.com.tivoli.snmp.data.NoSuchInstancecreateNoSuchInstance()CreatesNoSuchInstanceobject.com.tivoli.snmp.data.NoSuchObjectcreateNoSuchObject()CreatesNoSuchObjectobject.com.tivoli.snmp.data.NotSupportedcreateNotSupported()CreatesNotSupportedobject.com.tivoli.snmp.data.NullcreateNull()CreatesNullobject.com.tivoli.snmp.data.OctetStringcreateOctetString(java.lang.String aValue)CreatesOctetStringobject.com.tivoli.snmp.data.OIDcreateOID(java.lang.String aValue)CreatesOIDobject.com.tivoli.snmp.data.OpaquecreateOpaque(byte[] aValue)CreatesOpaqueobject.com.tivoli.snmp.data.TimeTickscreateTimeTicks(long aValue)CreatesTimeTicksobject.ConnectorInterfacegetNextClient()Server mode - returns a new instance of the Connector for each client connection.EntrygetNextEntry()Returns the next Entry from the SNMP client(Manager).SNMPServerConnectorgetServerConnector()Returns the server Connector if this Connector is handling a client session.java.lang.StringgetVersion()Version information.voidinitialize(java.lang.Object aObj)Initialize the Connector.booleanisAccepting()Checks if this Connector is currently waiting for a client connection.booleanisTerminating()Checks if termination is requested.voidputEntry(Entry aEntry)Send response to the SNMP client (Manager).voidreplyEntry(Entry aEntry)Send response to the SNMP client (Manager).voidsetCommunity(java.lang.String aCommunity)Sets community parametervoidsetServerConnector(SNMPServerConnector aServerConnector)Sets the server Connector for this Connector.voidterminate()Terminate the connector.voidterminateServer()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.ExceptionInitialize 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:
initializein interfaceConnectorInterface- Overrides:
initializein 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:
getNextClientin interfaceConnectorInterface- Overrides:
getNextClientin 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:
getNextEntryin interfaceConnectorInterface- Overrides:
getNextEntryin 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:
replyEntryin interfaceConnectorInterface- Overrides:
replyEntryin 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:
putEntryin interfaceConnectorInterface- Overrides:
putEntryin classConnector- Parameters:
aEntry- The entry.- Throws:
java.lang.Exception- If sending response fails.
-
terminateServer
public void terminateServer() throws java.lang.ExceptionThis 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:
terminateServerin interfaceConnectorInterface- Overrides:
terminateServerin classConnector- Throws:
java.lang.Exception- if an error occurs
-
terminate
public void terminate() throws java.lang.ExceptionTerminate the connector.- Specified by:
terminatein interfaceConnectorInterface- Overrides:
terminatein 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
BadValueinstance.
-
createBoolean
public com.tivoli.snmp.data.Boolean createBoolean(boolean aValue)
Creates boolean object.- Parameters:
aValue- The boolean value to set.- Returns:
- the
Booleaninstance.
-
createCounter
public com.tivoli.snmp.data.Counter createCounter(long aValue)
CreatesCounterobject.- Parameters:
aValue- The long value to set.- Returns:
- the
Counterinstance.
-
createCounter64
public com.tivoli.snmp.data.Counter64 createCounter64(long aValue)
CreatesCounter64object.- Parameters:
aValue- The long value to set.- Returns:
- the
Counter64instance.
-
createFixedLengthOctetString
public com.tivoli.snmp.data.FixedLengthOctetString createFixedLengthOctetString(java.lang.String aValue)
CreatesFixedLengthOctetStringobject.- Parameters:
aValue- The String value to set.- Returns:
- the
FixedLengthOctetStringinstance.
-
createFullCounter64
public com.tivoli.snmp.data.FullCounter64 createFullCounter64(java.math.BigInteger aValue)
CreatesFullCounter64object.- Parameters:
aValue- The java.math.BigInteger value to set.- Returns:
- the
FullCounter64instance.
-
createGauge
public com.tivoli.snmp.data.Gauge createGauge(long aValue)
CreatesGaugeobject.- Parameters:
aValue- The long value to set.- Returns:
- the
Gaugeinstance.
-
createIPAddress
public com.tivoli.snmp.data.IPAddress createIPAddress(java.lang.String aValue)
CreatesIPAddressobject.- Parameters:
aValue- The String value to set.- Returns:
- the
IPAddressinstance.
-
createNoChange
public com.tivoli.snmp.data.NoChange createNoChange()
CreatesNoChangeobject.- Returns:
- the
NoChangeinstance.
-
createNoSuchInstance
public com.tivoli.snmp.data.NoSuchInstance createNoSuchInstance()
CreatesNoSuchInstanceobject.- Returns:
- the
NoSuchInstanceinstance.
-
createNoSuchObject
public com.tivoli.snmp.data.NoSuchObject createNoSuchObject()
CreatesNoSuchObjectobject.- Returns:
- the
NoSuchObjectinstance.
-
createNotSupported
public com.tivoli.snmp.data.NotSupported createNotSupported()
CreatesNotSupportedobject.- Returns:
- the
NotSupportedinstance.
-
createNull
public com.tivoli.snmp.data.Null createNull()
CreatesNullobject.- Returns:
- the
Nullinstance.
-
createOctetString
public com.tivoli.snmp.data.OctetString createOctetString(java.lang.String aValue)
CreatesOctetStringobject.- Parameters:
aValue- The String value to set.- Returns:
- the
OctetStringinstance.
-
createOID
public com.tivoli.snmp.data.OID createOID(java.lang.String aValue)
CreatesOIDobject.- Parameters:
aValue- The String value to set.- Returns:
- the
OIDinstance.
-
createOpaque
public com.tivoli.snmp.data.Opaque createOpaque(byte[] aValue)
CreatesOpaqueobject.- Parameters:
aValue- The byte[] value to set.- Returns:
- the
Opaqueinstance.
-
createTimeTicks
public com.tivoli.snmp.data.TimeTicks createTimeTicks(long aValue)
CreatesTimeTicksobject.- Parameters:
aValue- The long value to set.- Returns:
- the
TimeTicksinstance.
-
getVersion
public java.lang.String getVersion()
Version information.- Returns:
- version information
-
-