use of mx4j.log.Logger in project geode by apache.
the class MX4JModelMBean method sendAttributeChangeNotification.
public void sendAttributeChangeNotification(AttributeChangeNotification notification) throws MBeanException, RuntimeOperationsException {
if (notification == null)
throw new RuntimeOperationsException(new IllegalArgumentException(LocalizedStrings.MX4JModelMBean_NOTIFICATION_CANNOT_BE_NULL.toLocalizedString()));
getAttributeChangeBroadcaster().sendNotification(notification);
Logger modelMBeanLogger = getModelMBeanLogger(notification.getType());
if (modelMBeanLogger != null)
if (modelMBeanLogger.isEnabledFor(Logger.DEBUG))
modelMBeanLogger.debug("ModelMBean log: " + new Date() + " - " + notification);
Logger logger = getLogger();
if (logger.isEnabledFor(Logger.DEBUG))
logger.debug("Attribute change notification " + notification + " sent");
}
use of mx4j.log.Logger in project geode by apache.
the class MX4JModelMBean method setManagedResource.
public void setManagedResource(Object resource, String resourceType) throws MBeanException, RuntimeOperationsException, InstanceNotFoundException, InvalidTargetObjectTypeException {
if (resource == null)
throw new RuntimeOperationsException(new IllegalArgumentException(LocalizedStrings.MX4JModelMBean_MANAGED_RESOURCE_CANNOT_BE_NULL.toLocalizedString()));
if (!isResourceTypeSupported(resourceType))
throw new InvalidTargetObjectTypeException(resourceType);
Logger logger = getLogger();
if (logger.isEnabledFor(Logger.DEBUG))
logger.debug("Setting managed resource to be: " + resource);
m_managedResource = resource;
}
use of mx4j.log.Logger in project geode by apache.
the class MX4JModelMBean method getPersistPolicy.
private int getPersistPolicy(Descriptor descriptor, Descriptor mbean) {
Logger logger = getLogger();
String persist = (String) descriptor.getFieldValue("persistPolicy");
if (persist == null && mbean != null)
persist = (String) mbean.getFieldValue("persistPolicy");
if (persist == null) {
if (logger.isEnabledFor(Logger.TRACE))
logger.trace("No persist policy defined, assuming Never");
return PERSIST_NEVER;
} else {
if (persist.equals("Never")) {
if (logger.isEnabledFor(Logger.TRACE))
logger.trace("Persist never");
return PERSIST_NEVER;
} else if (persist.equals("OnUpdate")) {
if (logger.isEnabledFor(Logger.TRACE))
logger.trace("Persist on update");
return PERSIST_ON_UPDATE;
} else if (persist.equals("OnTimer")) {
if (logger.isEnabledFor(Logger.TRACE))
logger.trace("Persist on update");
return PERSIST_ON_TIMER;
} else if (persist.equals("NoMoreOftenThan")) {
if (logger.isEnabledFor(Logger.TRACE)) {
Long period = getFieldTimeValue(descriptor, mbean, "persistPeriod");
logger.trace("Persist no more often than " + period);
}
return PERSIST_NO_MORE_OFTEN_THAN;
} else {
// Garbage, assuming Never
if (logger.isEnabledFor(Logger.TRACE))
logger.trace("Invalid persist policy, assuming persist never");
return PERSIST_NEVER;
}
}
}
use of mx4j.log.Logger in project geode by apache.
the class MX4JModelMBean method resolveTargetObject.
private Object resolveTargetObject(Descriptor descriptor) throws MBeanException {
Logger logger = getLogger();
Object target = descriptor.getFieldValue("targetObject");
if (logger.isEnabledFor(Logger.TRACE))
logger.trace("targetObject is: " + target);
if (target == null) {
target = getManagedResource();
} else {
String targetObjectType = (String) descriptor.getFieldValue("targetObjectType");
if (logger.isEnabledFor(Logger.TRACE))
logger.trace("targetObjectType is: " + targetObjectType);
if (targetObjectType == null) {
// Not defined, assume object reference
targetObjectType = OBJECT_RESOURCE_TYPE;
}
if (!isResourceTypeSupported(targetObjectType))
throw new MBeanException(new InvalidTargetObjectTypeException(targetObjectType));
}
return target;
}
use of mx4j.log.Logger in project geode by apache.
the class MX4JModelMBean method getAttributes.
public AttributeList getAttributes(String[] attributes) {
if (attributes == null)
throw new RuntimeOperationsException(new IllegalArgumentException(LocalizedStrings.MX4JModelMBean_ATTRIBUTE_NAMES_CANNOT_BE_NULL.toLocalizedString()));
Logger logger = getLogger();
AttributeList list = new AttributeList();
for (int i = 0; i < attributes.length; ++i) {
String attrName = attributes[i];
Attribute attribute = null;
try {
Object value = getAttribute(attrName);
attribute = new Attribute(attrName, value);
list.add(attribute);
} catch (Exception x) {
if (logger.isEnabledFor(Logger.TRACE))
logger.trace("getAttribute for attribute " + attrName + " failed", x);
// And go on with the next attribute
}
}
return list;
}
Aggregations