|
The RMI APIs support using RMI from remote clients to perform SNMP operations. The advantage of using the RMI APIs is to allow a server to perform the SNMP functions, while the clients only make the RMI calls to the server. In other words, the server can run on the web server, while applets make RMI calls to the server to perform SNMP functions. For example, the server can load MIB's and a client can avail the information in the MIBs without loading them each time it is started.

The RMI server can be started as a standalone server, or as part of another Java application, say a web server. The main interface or origin for all RMI operations is the com.adventnet.snmp.rmi.SnmpFactory interface. This interface is implemented by the com.adventnet.snmp.rmi.SnmpFactorImpl class, which can be started from the command line or from another Java application. When started from the command line, this class is published as AdventnetSnmpFactory and registered with the RMI registry. When started from another Java application, the user has to publish the factory interface to allow remote access.
The SnmpFactory interface has methods for creating instances of classes for SNMP services on the server. These methods return RMI interfaces for getting access to the services provided by the SNMP service classes. These service interfaces very closely follow the SNMP beans classes in the com.adventnet.snmp.beans package. For example, this following code shows how the com.adventnet.snmp.rmi.SnmpTarget interface is obtained on a remote RMI client.
|
String hostname = "myserver"; SnmpFactory factory = (com.adventnet.snmp.rmi.SnmpFactory) Naming.lookup( "rmi://" + hostname + "/AdventnetSnmpFactory" ); // Get an SnmpTarget object SnmpTarget target = factory.createTarget(); |
Once the com.adventnet.snmp.rmi.SnmpTarget interface is obtained, the RMI client can use its methods similar to a local instance of SnmpTarget. The method signatures between the corresponding beans and RMI interfaces are mostly identical.
The following SNMP service interfaces are provided in the com.adventnet.snmp.rmi package.
SnmpTarget
SnmpRequestServer
SnmpTrapReceiver
SnmpPoller
SnmpTable
MibOperations
Examples of using these services are provided in the rmiclient directory.
|