use of javax.management.JMRuntimeException in project felix by apache.
the class MX4JMBeanServer method getMBeanInfo.
public MBeanInfo getMBeanInfo(ObjectName objectName) throws InstanceNotFoundException, IntrospectionException, ReflectionException {
objectName = secureObjectName(objectName);
MBeanMetaData metadata = findMBeanMetaData(objectName);
MBeanInfo info = getHeadInterceptor().getMBeanInfo(metadata);
if (info == null)
throw new JMRuntimeException("MBeanInfo returned for MBean " + objectName + " is null");
return info;
}
use of javax.management.JMRuntimeException in project felix by apache.
the class InvokerMBeanServerInterceptor method getAttributes.
public AttributeList getAttributes(MBeanMetaData metadata, String[] attributes) {
if (metadata.dynamic) {
try {
return ((DynamicMBean) metadata.mbean).getAttributes(attributes);
} catch (JMRuntimeException x) {
throw x;
} catch (RuntimeException x) {
throw new RuntimeMBeanException(x);
} catch (Error x) {
throw new RuntimeErrorException(x);
}
} else {
AttributeList list = new AttributeList();
for (int i = 0; i < attributes.length; ++i) {
String name = attributes[i];
try {
Object value = getAttribute(metadata, name);
Attribute attr = new Attribute(name, value);
list.add(attr);
} catch (Exception ignored) {
Logger logger = getLogger();
if (logger.isEnabledFor(Logger.DEBUG))
logger.debug("Exception caught from getAttributes(), ignoring attribute " + name);
}
}
return list;
}
}
use of javax.management.JMRuntimeException in project felix by apache.
the class InvokerMBeanServerInterceptor method setAttributes.
public AttributeList setAttributes(MBeanMetaData metadata, AttributeList attributes) {
if (metadata.dynamic) {
try {
return ((DynamicMBean) metadata.mbean).setAttributes(attributes);
} catch (JMRuntimeException x) {
throw x;
} catch (RuntimeException x) {
throw new RuntimeMBeanException(x);
} catch (Error x) {
throw new RuntimeErrorException(x);
}
} else {
AttributeList list = new AttributeList();
for (int i = 0; i < attributes.size(); ++i) {
Attribute attr = (Attribute) attributes.get(i);
try {
setAttribute(metadata, attr);
list.add(attr);
} catch (Exception ignored) {
Logger logger = getLogger();
if (logger.isEnabledFor(Logger.DEBUG))
logger.debug("Exception caught from setAttributes(), ignoring attribute " + attr, ignored);
}
}
return list;
}
}
use of javax.management.JMRuntimeException in project spf4j by zolyfarkas.
the class ExportedValuesMBean method setAttributes.
/**
* {@inheritDoc}
*/
@Override
public AttributeList setAttributes(final AttributeList list) {
AttributeList result = new AttributeList(list.size());
for (Attribute attr : list.asList()) {
ExportedValue<Object> eval = (ExportedValue<Object>) exportedValues.get(attr.getName());
if (eval != null) {
try {
eval.set(attr.getValue());
result.add(attr);
} catch (InvalidAttributeValueException | InvalidObjectException | RuntimeException ex) {
LOG.warn("Exception while setting attr {}", attr, ex);
throw new JMRuntimeException("Exception while setting attributes " + list + ", detail:\n" + Throwables.toString(ex));
}
}
}
return result;
}
use of javax.management.JMRuntimeException in project spf4j by zolyfarkas.
the class ExportedValuesMBean method getAttributes.
/**
* {@inheritDoc}
*/
@Override
public AttributeList getAttributes(final String[] names) {
AttributeList list = new AttributeList(names.length);
for (String name : names) {
try {
ExportedValue<?> attr = exportedValues.get(name);
if (attr == null) {
throw new IllegalArgumentException("No attribute with name " + name);
}
list.add(new Attribute(name, attr.get()));
} catch (OpenDataException | RuntimeException ex) {
LOG.error("Exception getting attribute {}", name, ex);
throw new JMRuntimeException("Exception while getting attributes " + Arrays.toString(names) + ", detail:\n" + Throwables.toString(ex));
}
}
return list;
}
Aggregations