com.virtualweaver.xotics.dialect.xape.task
Class XapAbstractTask

java.lang.Object
  extended bycom.virtualweaver.xotics.dialect.xape.task.XapAbstractTask
All Implemented Interfaces:
XapProcessable, XapTask

public abstract class XapAbstractTask
extends java.lang.Object
implements XapTask

This this an abstract implementation of XapTask, which contains base code common to any XAP Task implementations and a useful method to retrieve arguments.

Version:
2.1

Field Summary
protected  java.lang.String taskLocation
          this String is included in the message of a XapException to identify the task.
 
Constructor Summary
XapAbstractTask()
           
 
Method Summary
 java.lang.String getArgument(XapRuntimeEnvironment env, java.lang.String argKey, boolean mandatory)
          returns argument value.
 java.lang.String getId()
          Getter for property ID
 void init(XapRuntimeEnvironment env)
          does nothing
abstract  void process(XapRuntimeEnvironment env)
          This method performs any specific processing, with help of the application instance runtime environment.
 void setArguments(java.util.Map map)
          stores arguments map
 void setId(java.lang.String id)
          setter for property ID.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

taskLocation

protected java.lang.String taskLocation
this String is included in the message of a XapException to identify the task.

Constructor Detail

XapAbstractTask

public XapAbstractTask()
Method Detail

setId

public void setId(java.lang.String id)
setter for property ID.

Parameters:
id - Id value

getId

public java.lang.String getId()
Getter for property ID

Specified by:
getId in interface XapProcessable
Returns:
ID value
See Also:
XapProcessable.getId()

init

public void init(XapRuntimeEnvironment env)
          throws XapException
does nothing

Specified by:
init in interface XapTask
Parameters:
env - XAPE runtime env
Throws:
XapException
See Also:
XapTask.init(com.virtualweaver.xotics.dialect.xape.engine.XapRuntimeEnvironment)

process

public abstract void process(XapRuntimeEnvironment env)
                      throws XapException
Description copied from interface: XapProcessable
This method performs any specific processing, with help of the application instance runtime environment. If a class implementing this interface is an XO container, this container is responsible for calling process() method of its XapProcessable children.

Specified by:
process in interface XapProcessable
Parameters:
env - the application instance runtime environment
Throws:
XapException - for any processing error occurrence

setArguments

public void setArguments(java.util.Map map)
                  throws XapException
stores arguments map

Specified by:
setArguments in interface XapTask
Parameters:
map - a map containing couples of name/value as strings
Throws:
XapException
See Also:
XapTask.setArguments(java.util.Map)

getArgument

public java.lang.String getArgument(XapRuntimeEnvironment env,
                                    java.lang.String argKey,
                                    boolean mandatory)
                             throws XapException
returns argument value. Before returning the value, this method performs resolving (i.e calls env.resolveValue()). If param mandatory is true, throws an exception if argument is not found.

Parameters:
env - XAPE runtime env
argKey - argument key
mandatory - if true, throws XapException when argument is not found. Has no effect if false
Returns:
a resolved argument value
Throws:
XapException - if param mandatory is true when argument is not found