use of javax.management.MBeanException in project karaf by apache.
the class WebMBeanImpl method start.
public void start(Long bundleId) throws MBeanException {
try {
List<Long> list = new ArrayList<>();
list.add(bundleId);
webContainerService.start(list);
} catch (Exception e) {
throw new MBeanException(null, e.toString());
}
}
use of javax.management.MBeanException in project karaf by apache.
the class WebMBeanImpl method stop.
public void stop(Long bundleId) throws MBeanException {
try {
List<Long> list = new ArrayList<>();
list.add(bundleId);
webContainerService.stop(list);
} catch (Exception e) {
throw new MBeanException(null, e.toString());
}
}
use of javax.management.MBeanException in project jdk8u_jdk by JetBrains.
the class SnmpGenericObjectServer method get.
/**
* Get the value of an SNMP variable.
*
* <p><b><i>
* You should never need to use this method directly.
* </i></b></p>
*
* @param meta The impacted metadata object
* @param name The ObjectName of the impacted MBean
* @param id The OID arc identifying the variable we're trying to set.
* @param data User contextual data allocated through the
* {@link com.sun.jmx.snmp.agent.SnmpUserDataFactory}
*
* @return The value of the variable.
*
* @exception SnmpStatusException whenever an SNMP exception must be
* raised. Raising an exception will abort the request. <br>
* Exceptions should never be raised directly, but only by means of
* <code>
* req.registerGetException(<i>VariableId</i>,<i>SnmpStatusException</i>)
* </code>
**/
public SnmpValue get(SnmpGenericMetaServer meta, ObjectName name, long id, Object data) throws SnmpStatusException {
final String attname = meta.getAttributeName(id);
Object result = null;
try {
result = server.getAttribute(name, attname);
} catch (MBeanException m) {
Exception t = m.getTargetException();
if (t instanceof SnmpStatusException)
throw (SnmpStatusException) t;
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
} catch (Exception e) {
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
}
return meta.buildSnmpValue(id, result);
}
use of javax.management.MBeanException in project jdk8u_jdk by JetBrains.
the class SnmpMibAgent method setSnmpAdaptorName.
/**
* Sets the reference to the SNMP protocol adaptor through which the MIB
* will be SNMP accessible and add this new MIB in the SNMP MIB handler
* associated to the specified <CODE>name</CODE>.
*
* @param name The name of the SNMP protocol adaptor.
* @param contextName The MIB context name. If null is passed, will be registered in the default context.
* @exception InstanceNotFoundException The SNMP protocol adaptor does
* not exist in the MBean server.
*
* @exception ServiceNotFoundException This SNMP MIB is not registered
* in the MBean server or the requested service is not supported.
*
* @since 1.5
*/
@Override
public void setSnmpAdaptorName(ObjectName name, String contextName) throws InstanceNotFoundException, ServiceNotFoundException {
if (server == null) {
throw new ServiceNotFoundException(mibName + " is not registered in the MBean server");
}
//
if (adaptor != null) {
adaptor.removeMib(this, contextName);
}
// Then update the reference to the new adaptor server.
//
Object[] params = { this, contextName };
String[] signature = { "com.sun.jmx.snmp.agent.SnmpMibAgent", "java.lang.String" };
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;
}
use of javax.management.MBeanException in project jdk8u_jdk by JetBrains.
the class SnmpMibAgent method setSnmpAdaptorName.
/**
* Sets the reference to the SNMP protocol adaptor through which the MIB
* will be SNMP accessible and add this new MIB in the SNMP MIB handler
* associated to the specified <CODE>name</CODE>.
* This method is to be called to set a specific agent to a specific OID. This can be useful when dealing with MIB overlapping.
* Some OID can be implemented in more than one MIB. In this case, the OID nearer agent will be used on SNMP operations.
* @param name The name of the SNMP protocol adaptor.
* @param oids The set of OIDs this agent implements.
* @exception InstanceNotFoundException The SNMP protocol adaptor does
* not exist in the MBean server.
*
* @exception ServiceNotFoundException This SNMP MIB is not registered
* in the MBean server or the requested service is not supported.
*
* @since 1.5
*/
@Override
public void setSnmpAdaptorName(ObjectName name, SnmpOid[] oids) throws InstanceNotFoundException, ServiceNotFoundException {
if (server == null) {
throw new ServiceNotFoundException(mibName + " is not registered in the MBean server");
}
//
if (adaptor != null) {
adaptor.removeMib(this);
}
// Then update the reference to the new adaptor server.
//
Object[] params = { this, oids };
String[] signature = { "com.sun.jmx.snmp.agent.SnmpMibAgent", 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;
}
Aggregations