View Javadoc

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              // set type database
36              aif.setTypeDatabase(tdb);
37  
38              // set params
39              initFilter(aif, context);
40  
41              // put the filter to context
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   * The contents of this file are subject to the Mozilla Public License Version
61   * 1.1 (the "License"); you may not use this file except in compliance with the
62   * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
63   * Software distributed under the License is distributed on an "AS IS" basis,
64   * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
65   * the specific language governing rights and limitations under the License. The
66   * Original Code is: all this file. The Initial Developer of the Original Code
67   * is: Tomas Pitner, Masaryk University in Brno, Czech Republic. Contributor(s):
68   */