Solaris Bandwidth Manager 1.6 の開発

クライアントモードの使用

クライアントは、ポリシーエージェントに作用する個別のプロセスとして存在します。たとえば、構成ツール batool はクライアントとして実装されています。

ポリシーエージェントに接続されたアプリケーションは、クライアントモードで動作する場合、書き込み権を得るために接続時にパスワードを指定する必要があります。

まず、必要なクラスをインポートします。


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

次に、ポリシーエージェントに接続する時にパスワードを指定します。


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

ログインとパスワードは、Solaris Bandwidth Manager パッケージがインストールされた時に設定されたものを使用します。これらは、/etc/opt/SUNWconn/ba/agent.properties ファイルに定義されています。

また、検出する c-bean 名とクラス名も指定する必要があります。


.
.
.
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);
.
.
.