01: /*
02: * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05: package com.sun.portal.rewriter.services.idsame;
06:
07: import com.sun.identity.sm.ServiceListener;
08: import com.sun.portal.rewriter.util.Debug;
09:
10: import java.util.Observable;
11:
12: /**
13: * This is both Event Listener of IDSAME events and event propagator
14: * it is listens to IDSAME events using the IDSAME API interface and
15: * propagates the same using java standard observer/observable classes/interface
16: *
17: * @version 1.0 12/15/2001
18: * @author Raja Nagendra Kumar, Nagendra.Raja@sun.com
19: */
20: public class IDSAMEEventListenerImpl extends Observable implements
21: ServiceListener {
22: public IDSAMEEventListenerImpl() {
23: super ();
24: }//constructor
25:
26: public void schemaChanged(final String serviceName,
27: final String version) {
28: if (Debug.isMessageEnabled()) {
29: Debug.message("Received Notification: Schema changed: "
30: + serviceName + "(" + version + ")");
31: }
32: }//schemaChanged()
33:
34: public void globalConfigChanged(final String s, final String v,
35: final String aGroup, final String aComponent,
36: final int aEventType) {
37: if (Debug.isMessageEnabled()) {
38: Debug
39: .message("Received Notification: Global Config Changed: "
40: + s
41: + "("
42: + v
43: + ")"
44: + " Group: "
45: + aGroup
46: + " RewriterModule: "
47: + aComponent
48: + " Event: " + aEventType);
49: }
50:
51: dispatch(aComponent);
52: }//globalConfigChanged()
53:
54: public void organizationConfigChanged(final String s,
55: final String v, final String o, final String g,
56: final String c, final int e) {
57: if (Debug.isMessageEnabled()) {
58: Debug.message("Org Config Changed: " + s + "(" + v + ")"
59: + " Org: " + o + " Group: " + g
60: + " RewriterModule: " + c + " Event: ");
61: }
62: }//organizationConfigChanged()
63:
64: private void dispatch(final String aComponent) {
65: setChanged();
66: final String configName = aComponent.substring(aComponent
67: .lastIndexOf("/") + 1);
68: Debug.message("configName:" + configName + " ObserverCount: "
69: + countObservers());
70: notifyObservers(configName);
71: }//dispatch()
72:
73: }//class IDSAMEEventLisnerImpl
|