org.norther.tammi.spray.engine.tool
Class JavaTool

java.lang.Object
  extended by org.norther.tammi.core.pool.RecyclableSupport
      extended by org.norther.tammi.core.pool.PoolableSupport
          extended by org.norther.tammi.spray.engine.tool.GlobalTool
              extended by org.norther.tammi.spray.engine.tool.ContextTool
                  extended by org.norther.tammi.spray.engine.tool.JavaTool
All Implemented Interfaces:
Serializable, Cloneable, EventListener, Poolable, Recyclable, ContextBindingListener

public class JavaTool
extends ContextTool

A request context tool for interpreting Java statements in templates.

Author:
Ilkka Priha
See Also:
Serialized Form

Constructor Summary
JavaTool()
          Constructs a new tool.
 
Method Summary
 void dispose()
          Disposes the object by setting its disposed flag.
 Object evaluate(String path)
          Evaluates a script file.
 Object evaluate(String key, String path)
          Evaluates a script file in the specified key folder.
 Object evaluate(String key, String path, String encoding)
          Evaluates a script file in the specified key folder by applying the specified encoding.
 void execute(String path)
          Executes a script file.
 void execute(String key, String path)
          Executes a script file in the specified key folder.
 void execute(String key, String path, String encoding)
          Executes a script file in the specified key folder by applying the specified encoding.
protected  Interpreter getInterpreter()
          Gets an interpreter.
 Object getVariable(String name)
          Gets the value of a variable.
 Object interpret(String expr)
          Interprets an expression.
 void setVariable(String name, Object value)
          Sets the value of a variable.
 
Methods inherited from class org.norther.tammi.spray.engine.tool.ContextTool
getFilter, getFilterChain, getFilterKey, getPrincipal, getRequest, getResponse, isFilterChanged
 
Methods inherited from class org.norther.tammi.spray.engine.tool.GlobalTool
clone, getContext, getContextToolFilter, getMBeanServer, getName, isBound, nop, toString, valueBound, valueUnbound
 
Methods inherited from class org.norther.tammi.core.pool.PoolableSupport
disposed, recycled
 
Methods inherited from class org.norther.tammi.core.pool.RecyclableSupport
isDisposed, recycle
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.norther.tammi.core.pool.Recyclable
isDisposed, recycle
 

Constructor Detail

JavaTool

public JavaTool()
Constructs a new tool.

Method Detail

dispose

public void dispose()
Description copied from class: RecyclableSupport
Disposes the object by setting its disposed flag.

Specified by:
dispose in interface Recyclable
Overrides:
dispose in class ContextTool

getVariable

public Object getVariable(String name)
Gets the value of a variable.

Parameters:
name - the variable name.
Returns:
the variable value.

setVariable

public void setVariable(String name,
                        Object value)
Sets the value of a variable.

Parameters:
name - the variable name.
value - the value of the variable.

interpret

public Object interpret(String expr)
Interprets an expression.

Parameters:
expr - the expression.
Returns:
the result or an exception.

evaluate

public Object evaluate(String path)
Evaluates a script file.

Parameters:
path - the pathname of the file.
Returns:
the result or an exception.

evaluate

public Object evaluate(String key,
                       String path)
Evaluates a script file in the specified key folder.

Parameters:
key - a path finder key.
path - the pathname of the file.
Returns:
the result.

evaluate

public Object evaluate(String key,
                       String path,
                       String encoding)
Evaluates a script file in the specified key folder by applying the specified encoding.

Parameters:
key - a path finder key.
path - the pathname of the file.
encoding - the character encoding.
Returns:
the result.

execute

public void execute(String path)
Executes a script file.

Parameters:
path - the pathname of the file.

execute

public void execute(String key,
                    String path)
Executes a script file in the specified key folder.

Parameters:
key - a path finder key.
path - the pathname of the file.

execute

public void execute(String key,
                    String path,
                    String encoding)
Executes a script file in the specified key folder by applying the specified encoding.

Parameters:
key - a path finder key.
path - the pathname of the file.
encoding - the character encoding.

getInterpreter

protected Interpreter getInterpreter()
                              throws Exception
Gets an interpreter.

Returns:
an interpreter.
Throws:
Exception - on errors.


Copyright © 2004 The Norther Organization. All rights reserved.