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.file;
06:
07: import com.sun.portal.rewriter.Rewriter;
08: import com.sun.portal.rewriter.util.Debug;
09: import com.sun.portal.rewriter.util.collections.TypedHashCache;
10:
11: import java.util.Observable;
12:
13: /**
14: * This is both Event Listener of IDSAME events and event propagator
15: * it is listens to IDSAME events using the IDSAME API interface and
16: * propagates the same using java standard observer/observable classes/interface
17: *
18: * @version 1.0 12/15/2001
19: * @author Raja Nagendra Kumar, Nagendra.Raja@sun.com
20: */
21: class FileEventListenerImpl extends Observable {
22: FileEventListenerImpl() {
23: super ();
24: }//constructor
25:
26: public void dispatch(final String aComponent) {
27: setChanged();
28: final String configName = aComponent.substring(aComponent
29: .lastIndexOf("/") + 1);
30: Debug.message("File configName:" + configName
31: + " File ObserverCount: " + countObservers());
32: notifyObservers(configName);
33: clearChanged();
34: }//dispatch()
35:
36: public static void main(String[] args) {
37: FileEventListenerImpl obj = new FileEventListenerImpl();
38: obj.addObserver(new TypedHashCache(Rewriter.class));
39: obj.addObserver(new TypedHashCache(Rewriter.class));
40: obj.dispatch("");
41: }//main()
42:
43: }//class FileEventListenerImpl
|