From b80896388ac379743612828c068a86991101a3ec Mon Sep 17 00:00:00 2001
From: jdemendi <jdemendi@localhost>
Date: Tue, 02 Dec 2008 14:57:07 +0000
Subject: [PATCH] add notification system for the saturation index of the workflow element
---
opends/src/server/org/opends/server/workflowelement/WorkflowElement.java | 72 +++++++++++++++++++++++++++++++++++-
1 files changed, 70 insertions(+), 2 deletions(-)
diff --git a/opends/src/server/org/opends/server/workflowelement/WorkflowElement.java b/opends/src/server/org/opends/server/workflowelement/WorkflowElement.java
index d639f9a..70d9a3b 100644
--- a/opends/src/server/org/opends/server/workflowelement/WorkflowElement.java
+++ b/opends/src/server/org/opends/server/workflowelement/WorkflowElement.java
@@ -80,6 +80,13 @@
new ConcurrentHashMap<String, List<Observer>>();
+ // The observable status of the workflow element.
+ // The status contains the health indicator (aka saturation index)
+ // of the workflow element.
+ private ObservableWorkflowElementStatus observableStatus =
+ new ObservableWorkflowElementStatus(this);
+
+
/**
* Provides the observable state of the workflow element.
* This method is intended to be called by the WorkflowElementConfigManager
@@ -95,6 +102,17 @@
/**
+ * Provides the observable status of the workflow element.
+ *
+ * @return the observable status of the workflow element.
+ */
+ protected ObservableWorkflowElementStatus getObservableStatus()
+ {
+ return observableStatus;
+ }
+
+
+ /**
* Registers with a specific workflow element to be notified when the
* workflow element state has changed. This notification system is
* mainly used to be warned when a workflow element is enabled or
@@ -187,7 +205,8 @@
ObservableWorkflowElementState westate = we.getObservableState();
westate.deleteObserver(observer);
}
- else
+
+ if (weid != null)
{
List<Observer> observers = newWorkflowElementNotificationList.get(weid);
if (observers != null)
@@ -362,5 +381,54 @@
{
return workflowElementID;
}
-}
+
+ /**
+ * Modifies the saturation index of the workflow element.
+ *
+ * @param newValue
+ * The new value of the saturation index of the workflow element.
+ */
+ public void setSaturationIndex(int newValue)
+ {
+ observableStatus.setSaturationIndex(newValue);
+ }
+
+
+ /**
+ * Gets the saturation index of the workflow element.
+ *
+ * @return the value of the saturation index of the workflow element.
+ */
+ public int getSaturationIndex()
+ {
+ return observableStatus.getSaturationIndex();
+ }
+
+
+ /**
+ * Registers an observer with the saturation index of the workflow
+ * element. The observer will be notified when the saturation index
+ * is updated.
+ *
+ * @param observer
+ * The observer to notify when the saturation index is modified.
+ */
+ public void registerForSaturationIndexUpdate(Observer observer)
+ {
+ observableStatus.addObserver(observer);
+ }
+
+
+ /**
+ * Deregisters an observer with the saturation index of the workflow
+ * element.
+ *
+ * @param observer
+ * The observer to deregister.
+ */
+ public void deregisterForSaturationIndexUpdate(Observer observer)
+ {
+ observableStatus.deleteObserver(observer);
+ }
+}
--
Gitblit v1.10.0