com.jrockit.mc.rjmx.notification
Class NotificationRule

java.lang.Object
  extended by com.jrockit.mc.rjmx.notification.NotificationRule
All Implemented Interfaces:
IAttributeValueListener, java.lang.Comparable, java.util.EventListener

public final class NotificationRule
extends java.lang.Object
implements java.lang.Comparable, IAttributeValueListener

A notification rule is the 3-tuple (NotificationTrigger, NotificationConstraint and NotificationAction) with a name. A rule is an IAttributeValueListener that will trigger whenever a value that fulfills the conditions of the rule is intercepted. Note that this API will change in 4.0.


Constructor Summary
NotificationRule()
          Constructor.
NotificationRule(java.lang.String name, com.jrockit.mc.rjmx.notification.internal.NotificationTrigger trigger, com.jrockit.mc.rjmx.notification.internal.NotificationConstraintHolder constraintHolder, INotificationAction action)
          Constructor.
 
Method Summary
 void addConstraint(INotificationConstraint constraint)
          Convenience method to add a constraint to this rule.
 int compareTo(java.lang.Object o)
          To be able to sort it in lists...
 void exportToXml(org.w3c.dom.Element parentNode)
          Creates and inserts an XML node for this object that becomes a subnode to the specified parent node.
 INotificationAction getAction()
          Gets the action.
 com.jrockit.mc.rjmx.notification.internal.NotificationConstraintHolder getConstraintHolder()
          Gets the constraintHolder.
 java.lang.String getDescription()
          Returns the description of the rule
 java.lang.String getName()
          Gets the name.
 java.lang.String getRulePath()
          A path to the rule.
 INotificationTrigger getTrigger()
          Gets the trigger.
protected  java.lang.String getVerboseInformation()
          Only for internal debugging purposes.
 boolean hasAction()
           
 boolean hasConstraints()
           
 boolean hasTrigger()
           
 void initializeFromXml(org.w3c.dom.Element node, INotificationFactory factory)
          Initializes the instance according to the specified node representing the object.
 boolean isComplete()
          This method returns true if the rule has a name, a complete trigger and an action.
 void setAction(INotificationAction action)
          Sets the action.
 void setDescription(java.lang.String description)
          Sets the description of the rule
 void setName(java.lang.String name)
          Sets the name.
 void setRulePath(java.lang.String rulePath)
          Sets the path to the rule.
 void setTrigger(com.jrockit.mc.rjmx.notification.internal.NotificationTrigger trigger)
          Sets the trigger.
 java.lang.String toString()
           
 void valueChanged(AttributeValueEvent event)
          This method will be called whenever the subscribed attribute's value has changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NotificationRule

public NotificationRule()
Constructor. Creates an empty rule.


NotificationRule

public NotificationRule(java.lang.String name,
                        com.jrockit.mc.rjmx.notification.internal.NotificationTrigger trigger,
                        com.jrockit.mc.rjmx.notification.internal.NotificationConstraintHolder constraintHolder,
                        INotificationAction action)
Constructor.

Parameters:
name - the name of the rule.
trigger - the rule trigger.
constraintHolder - the constraints.
action - the action to perform.
Method Detail

getAction

public INotificationAction getAction()
Gets the action.

Returns:
Returns a NotificationAction

getRulePath

public java.lang.String getRulePath()
A path to the rule. A grouping.

Returns:
the path to the rule.

setRulePath

public void setRulePath(java.lang.String rulePath)
Sets the path to the rule.

Parameters:
rulePath - the path to the rule.

setAction

public void setAction(INotificationAction action)
Sets the action.

Parameters:
action - The action to set

addConstraint

public void addConstraint(INotificationConstraint constraint)
Convenience method to add a constraint to this rule.

Parameters:
constraint - The constraint to set

getName

public java.lang.String getName()
Gets the name.

Returns:
Returns a String

setName

public void setName(java.lang.String name)
Sets the name.

Parameters:
name - The name to set

getTrigger

public INotificationTrigger getTrigger()
Gets the trigger.

Returns:
Returns a NotificationTrigger

setTrigger

public void setTrigger(com.jrockit.mc.rjmx.notification.internal.NotificationTrigger trigger)
Sets the trigger.

Parameters:
trigger - the trigger to set

getConstraintHolder

public com.jrockit.mc.rjmx.notification.internal.NotificationConstraintHolder getConstraintHolder()
Gets the constraintHolder.

Returns:
Returns a NotificationConstraintHolder

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

getVerboseInformation

protected java.lang.String getVerboseInformation()
Only for internal debugging purposes.

Returns:
String verbose information about this rule.

hasConstraints

public boolean hasConstraints()
Returns:
boolean true if this rule has constraints.

hasTrigger

public boolean hasTrigger()
Returns:
true if this rule contains a complete trigger.

hasAction

public boolean hasAction()
Returns:
boolean true if this rule has an action.

compareTo

public int compareTo(java.lang.Object o)
To be able to sort it in lists...

Specified by:
compareTo in interface java.lang.Comparable
See Also:
Comparable.compareTo(Object)

initializeFromXml

public void initializeFromXml(org.w3c.dom.Element node,
                              INotificationFactory factory)
Initializes the instance according to the specified node representing the object.

Parameters:
node - the XML node representing the object

exportToXml

public void exportToXml(org.w3c.dom.Element parentNode)
Creates and inserts an XML node for this object that becomes a subnode to the specified parent node.

Parameters:
parentNode - the XML node to become a subnode to

valueChanged

public void valueChanged(AttributeValueEvent event)
Description copied from interface: IAttributeValueListener
This method will be called whenever the subscribed attribute's value has changed.

Specified by:
valueChanged in interface IAttributeValueListener
Parameters:
event - the event containing change information.
See Also:
IAttributeValueListener.valueChanged(AttributeValueEvent)

isComplete

public boolean isComplete()
This method returns true if the rule has a name, a complete trigger and an action.

Returns:
boolean

setDescription

public void setDescription(java.lang.String description)
Sets the description of the rule

Parameters:
description - the description, or null if not available

getDescription

public java.lang.String getDescription()
Returns the description of the rule

Returns:
the description, or null if not available


Copyright © 1999, 2011, Oracle and/or its affiliates. All rights reserved.