1 package net.sf.tomp.xml.include.xtcl;
2
3 import net.sf.tomp.xml.include.AdaptiveXIncludeFilter;
4 import net.sf.tomp.xml.type.TypeDatabase;
5 import net.sf.tomp.xtcl.Context;
6
7 import java.io.PrintStream;
8
9 /***
10 * DOCUMENT ME!
11 *
12 * @author tomp
13 */
14 public class AdaptiveXIncluderCommand extends AdaptiveFilterCommand {
15 /***
16 * DOCUMENT ME!
17 *
18 * @param context DOCUMENT ME!
19 * @return DOCUMENT ME!
20 * @throws Exception DOCUMENT ME!
21 */
22 public int execute(Context context) throws Exception {
23 PrintStream out = context.getOut();
24
25 if (out == null) {
26 return 0;
27 }
28
29 AdaptiveXIncludeFilter aif = new AdaptiveXIncludeFilter();
30 TypeDatabase tdb = (TypeDatabase) context.get(tdVar);
31
32 if (tdb == null) {
33 return done(context, 1);
34 } else {
35
36 aif.setTypeDatabase(tdb);
37
38
39 initFilter(aif, context);
40
41
42 context.put(var, aif);
43
44 return done(context, 0);
45 }
46 }
47
48 /***
49 * DOCUMENT ME!
50 *
51 * @return DOCUMENT ME!
52 */
53 public String toString() {
54 return "ADAPTIVEXINCLUDER " + var + " type-database=" + tdVar + " ("
55 + listMap(params) + ")";
56 }
57 }
58
59
60
61
62
63
64
65
66
67
68