Methods Summary |
---|
synchronized javax.management.monitor.MonitorNotification | buildAlarmNotification(javax.management.ObjectName object, java.lang.String attribute, java.lang.Comparable value)
String type = null;
String msg = null;
Object trigger = null;
final StringMonitorObservedObject o =
(StringMonitorObservedObject) getObservedObject(object);
if (o == null)
return null;
// Send matching notification if notifyMatch is true.
// Send differing notification if notifyDiffer is true.
//
if (o.getStatus() == MATCHING_OR_DIFFERING) {
if (o.getDerivedGauge().equals(stringToCompare)) {
if (notifyMatch) {
type = STRING_TO_COMPARE_VALUE_MATCHED;
msg = "";
trigger = stringToCompare;
}
o.setStatus(DIFFERING);
} else {
if (notifyDiffer) {
type = STRING_TO_COMPARE_VALUE_DIFFERED;
msg = "";
trigger = stringToCompare;
}
o.setStatus(MATCHING);
}
} else {
if (o.getStatus() == MATCHING) {
if (o.getDerivedGauge().equals(stringToCompare)) {
if (notifyMatch) {
type = STRING_TO_COMPARE_VALUE_MATCHED;
msg = "";
trigger = stringToCompare;
}
o.setStatus(DIFFERING);
}
} else if (o.getStatus() == DIFFERING) {
if (!o.getDerivedGauge().equals(stringToCompare)) {
if (notifyDiffer) {
type = STRING_TO_COMPARE_VALUE_DIFFERED;
msg = "";
trigger = stringToCompare;
}
o.setStatus(MATCHING);
}
}
}
return new MonitorNotification(type,
this,
0,
0,
msg,
null,
null,
null,
trigger);
|
ObservedObject | createObservedObject(javax.management.ObjectName object)Factory method for ObservedObject creation.
final StringMonitorObservedObject smo =
new StringMonitorObservedObject(object);
smo.setStatus(MATCHING_OR_DIFFERING);
return smo;
|
public synchronized java.lang.String | getDerivedGauge(javax.management.ObjectName object)Gets the derived gauge of the specified object, if this object is
contained in the set of observed MBeans, or null otherwise.
return (String) super.getDerivedGauge(object);
|
public synchronized java.lang.String | getDerivedGauge()Returns the derived gauge of the first object in the set of
observed MBeans.
if (observedObjects.isEmpty()) {
return null;
} else {
return (String) observedObjects.get(0).getDerivedGauge();
}
|
public synchronized long | getDerivedGaugeTimeStamp(javax.management.ObjectName object)Gets the derived gauge timestamp of the specified object, if
this object is contained in the set of observed MBeans, or
0 otherwise.
return super.getDerivedGaugeTimeStamp(object);
|
public synchronized long | getDerivedGaugeTimeStamp()Gets the derived gauge timestamp of the first object in the set
of observed MBeans.
if (observedObjects.isEmpty()) {
return 0;
} else {
return observedObjects.get(0).getDerivedGaugeTimeStamp();
}
|
public javax.management.MBeanNotificationInfo[] | getNotificationInfo()Returns a NotificationInfo object containing the name of
the Java class of the notification and the notification types sent by
the string monitor.
return notifsInfo;
|
public synchronized boolean | getNotifyDiffer()Gets the differing notification's on/off switch value common to
all observed MBeans.
return notifyDiffer;
|
public synchronized boolean | getNotifyMatch()Gets the matching notification's on/off switch value common to
all observed MBeans.
return notifyMatch;
|
public synchronized java.lang.String | getStringToCompare()Gets the string to compare with the observed attribute common
to all observed MBeans.
return stringToCompare;
|
synchronized boolean | isComparableTypeValid(javax.management.ObjectName object, java.lang.String attribute, java.lang.Comparable value)Check that the type of the supplied observed attribute
value is one of the value types supported by this monitor.
// Check that the observed attribute is of type "String".
//
if (value instanceof String) {
return true;
}
return false;
|
java.lang.String | makeDebugTag()
return "StringMonitor";
|
synchronized void | onErrorNotification(javax.management.monitor.MonitorNotification notification)
final StringMonitorObservedObject o = (StringMonitorObservedObject)
getObservedObject(notification.getObservedObject());
if (o == null)
return;
// Reset values.
//
o.setStatus(MATCHING_OR_DIFFERING);
|
public synchronized void | setNotifyDiffer(boolean value)Sets the differing notification's on/off switch value common to
all observed MBeans.
if (notifyDiffer == value)
return;
notifyDiffer = value;
|
public synchronized void | setNotifyMatch(boolean value)Sets the matching notification's on/off switch value common to
all observed MBeans.
if (notifyMatch == value)
return;
notifyMatch = value;
|
public synchronized void | setStringToCompare(java.lang.String value)Sets the string to compare with the observed attribute common
to all observed MBeans.
if (value == null) {
throw new IllegalArgumentException("Null string to compare");
}
if (stringToCompare.equals(value))
return;
stringToCompare = value;
// Reset values.
//
for (ObservedObject o : observedObjects) {
final StringMonitorObservedObject smo =
(StringMonitorObservedObject) o;
smo.setStatus(MATCHING_OR_DIFFERING);
}
|
public synchronized void | start()Starts the string monitor.
if (isActive()) {
if (isTraceOn()) {
trace("start", "the monitor is already active");
}
return;
}
// Reset values.
//
for (ObservedObject o : observedObjects) {
final StringMonitorObservedObject smo =
(StringMonitorObservedObject) o;
smo.setStatus(MATCHING_OR_DIFFERING);
}
doStart();
|
public synchronized void | stop()Stops the string monitor.
doStop();
|