01: /*
02: * @(#)SimpleRuleSet.java 1.2 04/12/06
03: *
04: * Copyright (c) 2003 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;
10:
11: import java.util.*;
12:
13: class SimpleRuleSet implements RuleSet {
14: HashMap rules = new HashMap();
15:
16: public void add(String pattern, DigestAction action, String keyword) {
17: rules.put(pattern, new RuleTarget(action, keyword));
18: }
19:
20: public void scan(String path, List paths, TargetHandler handler)
21: throws Exception {
22: RuleTarget target = (RuleTarget) rules.get(path);
23: if (target != null) {
24: handler.handle(target.action, target.keyword);
25: }
26: }
27: }
|