net.sf.tomp.xtcl.command
Class FilterCommand

java.lang.Object
  extended by net.sf.tomp.xtcl.command.AbstractCommand
      extended by net.sf.tomp.xtcl.command.VarCommand
          extended by net.sf.tomp.xtcl.command.AbstractParametrizedVarCommand
              extended by net.sf.tomp.xtcl.command.FilterCommand
All Implemented Interfaces:
Parametrized, Command, ParametrizedCommand
Direct Known Subclasses:
StyleFilterCommand

public class FilterCommand
extends AbstractParametrizedVarCommand

Command for loading and initializing a XMLFilter (XTFilter)

Author:
tomp

Field Summary
protected  java.lang.String className
          XTCL's XTFilter or SAX's XMLFilter class name
protected  java.util.Map params
          formal params
protected  java.util.Map realParams
          real params
 
Fields inherited from class net.sf.tomp.xtcl.command.VarCommand
var
 
Constructor Summary
FilterCommand()
           
 
Method Summary
 int execute(Context context)
          Loads and initializes (parametrizes) the filter.
protected  int initFilter(XTFilter f, Context context)
          Initializes the filter: Evaluates the parameters, gets the real params and fetches them to the XTFilter.
 void setClassName(java.lang.String r)
          sets the filter class name
 void setParameter(java.lang.String k, java.lang.Object v)
          sets a parameter
 java.lang.String toString()
           
 
Methods inherited from class net.sf.tomp.xtcl.command.AbstractParametrizedVarCommand
addParameterPropertiesReference, propertiesToParameters
 
Methods inherited from class net.sf.tomp.xtcl.command.VarCommand
setVar
 
Methods inherited from class net.sf.tomp.xtcl.command.AbstractCommand
done, initParameters, listArray, listList, listMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

className

protected java.lang.String className
XTCL's XTFilter or SAX's XMLFilter class name


params

protected java.util.Map params
formal params


realParams

protected java.util.Map realParams
real params

Constructor Detail

FilterCommand

public FilterCommand()
Method Detail

setParameter

public void setParameter(java.lang.String k,
                         java.lang.Object v)
sets a parameter

Specified by:
setParameter in interface Parametrized
Specified by:
setParameter in class AbstractParametrizedVarCommand
Parameters:
k - param name
v - param value
See Also:
Parametrized.setParameter(java.lang.String, java.lang.Object)

setClassName

public void setClassName(java.lang.String r)
sets the filter class name

Parameters:
r - filter class name

execute

public int execute(Context context)
            throws java.lang.Exception
Loads and initializes (parametrizes) the filter. Only the filter implementing the XTFilter is parametrized.

Specified by:
execute in interface Command
Overrides:
execute in class AbstractCommand
Parameters:
context -
Returns:
0 if OK, otherwise 1
Throws:
java.lang.Exception

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
"FILTER " + var + "=" + className + " (" + listMap(params) + ")";

initFilter

protected int initFilter(XTFilter f,
                         Context context)
Initializes the filter: Evaluates the parameters, gets the real params and fetches them to the XTFilter.

Parameters:
f - the filter to be initialized
context - Context to evaluate the params
Returns:
1 if strict parameter passing fails, otherwise 0


Copyright © 2004-2005 Masaryk University in Brno, Faculty of Informatics, Czech Republic. All Rights Reserved.