Solaris Bandwidth Manager 1.6 Developer Guide

Using Client Mode

Clients exist as separate processes, which act on the policy agent. For example, the configuration tool batool was implemented as a client.

When operating in client mode, applications connecting to the policy agent must specify a password at connect time in order to have write access.

First, you must import the necessary classes:

import com.sun.jaw.impl.adaptor.security.AuthInfo;

Then, when connecting to the policy agent, specify the password:

.
.
.
AdaptorMO adaptor = new AdaptorClient();
AuthInfo auth = new AuthInfo ("login", "password");
adaptor.connect (auth, host, portnumber, servicename.APT)
.
.
.

The login and password are the ones set when the Solaris Bandwidth Manager packages were installed. They are defined in the /etc/opt/SUNWconn/ba/agent.properties file.

You must also provide the name and class names of the c-beans to be retrieved:

.
.
.
ObjectName on = new ObjectName(domain, BeanName);
Vector v =adaptor.getObject (on, null);
if (v == null || v.size() ==0)
   {
   System.err.println("Unable to retrieve the Bandwidth Manager m-bean.");
   System.err.println("Try stopping and restarting the policy agent";
   System,exit(1);
   }
className userDefinedVariable = (className) v.elementAt(0);
.
.
.