From dd45e938564249a5e6897bd92dd29808d8990868 Mon Sep 17 00:00:00 2001 From: rudolf Date: Fri, 24 Oct 2003 08:34:56 +0000 Subject: MOA-ID version 1.1 (initial) git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@19 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../iaik/servertools/observer/ObservableImpl.java | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 id.server/src/at/gv/egovernment/moa/id/iaik/servertools/observer/ObservableImpl.java (limited to 'id.server/src/at/gv/egovernment/moa/id/iaik/servertools') diff --git a/id.server/src/at/gv/egovernment/moa/id/iaik/servertools/observer/ObservableImpl.java b/id.server/src/at/gv/egovernment/moa/id/iaik/servertools/observer/ObservableImpl.java new file mode 100644 index 000000000..6f6949ad6 --- /dev/null +++ b/id.server/src/at/gv/egovernment/moa/id/iaik/servertools/observer/ObservableImpl.java @@ -0,0 +1,46 @@ +package at.gv.egovernment.moa.id.iaik.servertools.observer; + +import iaik.servertools.observer.NotificationData; +import iaik.servertools.observer.Observable; +import iaik.servertools.observer.Observer; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + + +/** + * Implementation of interface TrustManager + * @author Paul Ivancsics + * @version $Id$ + */ +public class ObservableImpl implements Observable { + /** a List for all observers */ + private List observers = new ArrayList(); + + /** + * @see iaik.servertools.observer.Observable#addObserver(iaik.servertools.observer.Observable) + */ + public void addObserver(Observer observer) { + observers.add(observer); + } + + /** + * @see iaik.servertools.observer.Observable#removeObserver(iaik.servertools.observer.Observable) + */ + public boolean removeObserver(Observer observer) { + return observers.remove(observer); + } + + /** + * @see iaik.servertools.observer.Observable#notify(iaik.servertools.observer.NotificationData) + */ + public void notify(NotificationData data) { + Iterator iter = observers.iterator(); + for (iter = observers.iterator(); iter.hasNext();) { + Observer observer = (Observer) iter.next(); + observer.notify(data); + } + } + +} -- cgit v1.2.3