 |
Description
|
SNMPProtocol
Bean
This bean provides SNMP Manager
services. All the frequently used SNMP commands are implemented by this
bean and provided in the form of an API.
The SNMPProtocol Bean listens for
commands from other beans which implement the user interface. Commands can
be passed to the bean either wrapped as a MessageEvent
class or by calling the handleRequest
methods, both of which process the desired request. It listens for MessageEvents
from the SNMPUI Bean by implementing MessageListener.
The MessageEventcarries
the command name to be executed. Alternatively, SNMP commands may also be
issued by invoking the handleRequestwith
the proper parameters.
This bean throws three events
containing relevant data which a system providing a user interface for
this bean would need to interpret. These events contain information about
the response to the request made, status of the last issued request, and
any traps that may be received from an agent. The SNMPUI Bean needs to
listen to these events, retrieve the data and display it to the user.
Significant events
The bean throws the following
events, which a user interface component would need to capture :
- ResponseEvent
carries the response from agents for the last issued command. This is
thrown if the agent returns a valid response.
- StatusEvent
is thrown if a problem is noticed in receiving a response for the
request sent to the agents
- TrapEvent
is thrown whenever a trap message is received
from any of the managed agents. Typically agents would send trap
messages to the manager when a significant event occurs at an agent,
like when an agent is about to shut down.
Significant methods
The SNMPProtocol Bean implements
the following significant methods, the exact syntax for each is provided
in the API Reference.
- Adding/removing listeners for
events (described above) thrown by this class:
addResponseListener
/
removeResponseListener
addStatusListener
/
removeStatusListener
addTrapListener
/
removeTrapListener
- Methods that accept external
events (these are all polymorphic forms and provide same functionality)
processMessageEvent
- listens for message events and makes requests to the agents
handleRequest
- accepts a message object and makes requests
to the agents
handleRequest
- accepts the request variables as individual
parameters rather than an object
- Methods that implement SNMP
commands (only a representative sample are documented here)
snmpGetRequest
- issues a get request to specified agent snmp
snmpGetNextRequest
- issues a get-next request to the agent snmp
snmpSetRequest
- issues a set request to the agent
setTrapEnabled
- sets on/off the logic for receiving trap messages from agents
getResponseObject
- method for retrieving a response object if the event cannot be decoded
getStatus
- method for retrieving a status object if the event cannot be decoded
getTrapObject
- method for retrieving a trap object if the trap-event cannot be
decoded
- Methods used to configure the
system
getPort
- get the port number for sending/receiving messages
setPort
- set the port number for sending/receiving messages
Customization
The following attributes of the
SNMPProtocol Bean can be customized :
- trapEnabled
- the protocol bean can be configured to receive/not receive trap
messages
- port -
the port at which the protocol bean operates to receive and send
messages
The SNMPUI Bean implements a user
interface for the SNMPProtocol Bean. It provides a mechanism for
interacting with the SNMPProtocol Bean for making connections to SNMP
Agents and requesting data and setting the variables at the Agent.
The SNMPUI Bean issues commands to
the SNMPProtocol Bean by throwing a MessageEventwhich
wraps the command issued and the operands and sends it to the SNMPProtocol
bean which is the listener. The SNMPProtocol Bean receives theMessageEvent,
recovers its contents and executes a corresponding request to the named
agent.
The SNMPUI Bean receives feedback
about the status of the issued command from the SNMPProtocol Bean through
the StatusEvent,
requested system variable data is returned to the user interface bean
through a ResponseEventand
trap information received from an agent is returned through a TrapEvent.
The data returned by the StatusEventand
ResponseEventare
shown in the SNMPUI Bean's response area, while a new window is popped up
when a trap is received, as the user may want to view this data
immediately.
Significant Events
MessageEvent-
this event is thrown to the protocol bean whenever the user issues an SNMP
command. The event contains the command and any associated parameters like
the agent and object identifiers.
Significant Methods
- Methods that listen to events
from the protocol bean
- handleResponse
- accepts a object / response parameters and
displays the response received
- processResponseEvent-
accepts a ResponseEvent
and displays the response received
- handleTrap
- accepts a trap object / trap parameters and
displays the trap information
- processTrapEvent
- accepts a TrapEvent
and displays the information received
- handleStatus
- receives status information and displays it
- processStatusEvent
-accepts a StatusEvent and displays the
status information received
- Methods that may be used by the
application container to add/remove Agents and Objects
- Methods that may be used to
change the visual aspects of the UI
- Methods for adding and removing
event listeners
Customization
The following attributes of the
SNMPUI Bean can be customized :
- UserInterfaceBackground-
background color of the SNMPUI Bean
- UserInterfaceForeground-
foreground color of the SNMPUI Bean
- UserInterfaceFont-
font attribute for the SNMPUI Bean
- TextFieldBackground-
background color for all text fields
- TextFieldForeground -
sets the foreground for all text fields
- TextFieldFont-
font for the text in all text fields
- ChoicesBackground-
background color for the Choices in the user interface
- ChoicesForeground -
foreground color for the Choices in the user interface
- ChoicesFont -
font of the choices in the user interface
- listsBackground-
background color of all lists.
- listsForeground-
foreground color of all lists.
- listsFont-
font of the text displayed in all lists.
- ButtonsBackground-
background color of the Buttons in the user interface
- ButtonsForeground-
foreground color of the Buttons in the user interface
- ButtonsFont-
font of the Button labels
- AgentsFile -
file selector for choosing file with agent information
- ObjectsFile
- file selector for choosing file with object information
Refer to the section Usage
Scenarios for information on how to use the SNMP Bean in
different ways.