public void setSnmpAdaptorName(ObjectName name,
String contextName, SnmpOid[] oids)
throws InstanceNotFoundException, ServiceNotFoundException {
if (server == null) {
throw new ServiceNotFoundException(mibName + " is not registered in the MBean server");
}
// First remove the reference on the old adaptor server.
//
if (adaptor != null) {
adaptor.removeMib(this, contextName);
}
// Then update the reference to the new adaptor server.
//
Object[] params = {this, contextName, oids};
String[] signature = {"com.sun.jmx.snmp.agent.SnmpMibAgent", "java.lang.String", oids.getClass().getName()};
try {
adaptor = (SnmpMibHandler)(server.invoke(name, "addMib", params,
signature));
} catch (InstanceNotFoundException e) {
throw new InstanceNotFoundException(name.toString());
} catch (ReflectionException e) {
throw new ServiceNotFoundException(name.toString());
} catch (MBeanException e) {
// Should never occur...
}
adaptorName = name;