01: /*
02: * @(#)ElementCallAction.java 1.2 04/12/06
03: *
04: * Copyright (c) 2003,2004 Sun Microsystems, Inc. All Rights Reserved.
05: *
06: * See the file "LICENSE.txt" for information on usage and redistribution
07: * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
08: */
09: package pnuts.xml.action;
10:
11: import java.util.*;
12: import pnuts.xml.*;
13:
14: /**
15: * This action calls an abstract method passing the keyword assigned to the path,
16: * the element's attributes, and the text element. A subclass defines a concrete
17: * implementation.
18: */
19: public abstract class ElementCallAction extends DigestAction {
20:
21: Stack stack = new Stack();
22:
23: public void start(String path, String key, Map attributeMap,
24: Object top) throws Exception {
25: stack.push(new HashMap(attributeMap));
26: }
27:
28: public void end(String path, String key, String text, Object top)
29: throws Exception {
30: Map attributeMap = (Map) stack.pop();
31: call(key, attributeMap, text);
32:
33: }
34:
35: protected abstract void call(String key, Map attributeMap,
36: String text);
37: }
|