org.eclipse.birt.report.engine.api
Interface IEngineTask

All Known Subinterfaces:
IDataExtractionTask, IGetParameterDefinitionTask, IRenderTask, IRunAndRenderTask, IRunTask

public interface IEngineTask

defines common features for an engine task. A task captures a set of operations that engine performs to get a unit of work done.


Field Summary
static int CANCEL_ON_ERROR
          cancel the task execution if there is an error.
static int CONTINUE_ON_ERROR
          continue the task execution if there is an error.
static int STATUS_CANCELLED
          the task is finished by cancled
static int STATUS_FAILED
          the task is finished with errors
static int STATUS_NOT_STARTED
          the task is not running yet
static int STATUS_RUNNING
          the task is running
static int STATUS_SUCCEEDED
          the task is finished with sucessful
static int TASK_DATAEXTRACTION
           
static int TASK_GETPARAMETERDEFINITION
           
static int TASK_RENDER
           
static int TASK_RUN
           
static int TASK_RUNANDRENDER
           
static int TASK_UNKNOWN
           
 
Method Summary
 void addScriptableJavaObject(java.lang.String jsName, java.lang.Object obj)
          Deprecated. user should add it to appContext.
 void cancel()
          set the cancel flag if the task is running.
 void cancel(java.lang.Object signal)
          Deprecated. user should use cancel() instead.
 void close()
          close the task, relese any resources.
 java.util.Map getAppContext()
          returns the context objects for the task.
 boolean getCancelFlag()
          return a flag if the user called cancel.
 IReportEngine getEngine()
          returns the report engine object
 java.util.List getErrors()
          Gets all errors.
 int getID()
          returns an identifier for the task.
 java.util.Locale getLocale()
          returns the locale for running the task
 java.util.logging.Logger getLogger()
          return the logger used by the task.
 java.lang.String getParameterDisplayText(java.lang.String name)
          Gets parameter display text by parameter name.
 java.lang.Object getParameterValue(java.lang.String name)
          returns the value of a parameter.
 java.util.HashMap getParameterValues()
          returns the parameter name/value collection
 IReportRunnable getReportRunnable()
          returns the runnable report design object
 int getStatus()
          get the status of task
 int getTaskType()
          Gets the type of the engine.
 com.ibm.icu.util.ULocale getULocale()
          returns the locale for running the task
 void setAppContext(java.util.Map context)
          sets the task context.
 void setDataSource(IDocArchiveReader dataSource)
          set the data source used by the engine task.
 void setErrorHandlingOption(int option)
          set the error handling mode for the first error.
 void setLocale(java.util.Locale locale)
          sets the task locale
 void setLocale(com.ibm.icu.util.ULocale locale)
          sets the task locale
 void setLogger(java.util.logging.Logger logger)
          set the logger used by the task.
 void setParameter(java.lang.String name, java.lang.Object value, java.lang.String displayText)
          Sets parameter value and display text.
 void setParameterDisplayText(java.lang.String name, java.lang.String displayText)
          Sets display text of a parameter with specified name.
 void setParameterValue(java.lang.String name, java.lang.Object value)
          sets one parameter value
 void setParameterValues(java.util.Map params)
          set all parameter valuess
 boolean validateParameters()
           
 

Field Detail

TASK_UNKNOWN

public static final int TASK_UNKNOWN
See Also:
Constant Field Values

TASK_GETPARAMETERDEFINITION

public static final int TASK_GETPARAMETERDEFINITION
See Also:
Constant Field Values

TASK_RUN

public static final int TASK_RUN
See Also:
Constant Field Values

TASK_RENDER

public static final int TASK_RENDER
See Also:
Constant Field Values

TASK_RUNANDRENDER

public static final int TASK_RUNANDRENDER
See Also:
Constant Field Values

TASK_DATAEXTRACTION

public static final int TASK_DATAEXTRACTION
See Also:
Constant Field Values

STATUS_NOT_STARTED

public static final int STATUS_NOT_STARTED
the task is not running yet

See Also:
Constant Field Values

STATUS_RUNNING

public static final int STATUS_RUNNING
the task is running

See Also:
Constant Field Values

STATUS_SUCCEEDED

public static final int STATUS_SUCCEEDED
the task is finished with sucessful

See Also:
Constant Field Values

STATUS_FAILED

public static final int STATUS_FAILED
the task is finished with errors

See Also:
Constant Field Values

STATUS_CANCELLED

public static final int STATUS_CANCELLED
the task is finished by cancled

See Also:
Constant Field Values

CONTINUE_ON_ERROR

public static final int CONTINUE_ON_ERROR
continue the task execution if there is an error.

See Also:
Constant Field Values

CANCEL_ON_ERROR

public static final int CANCEL_ON_ERROR
cancel the task execution if there is an error.

See Also:
Constant Field Values
Method Detail

setLocale

public void setLocale(java.util.Locale locale)
sets the task locale

Parameters:
locale - the task locale

setLocale

public void setLocale(com.ibm.icu.util.ULocale locale)
sets the task locale

Parameters:
locale - the task locale

setAppContext

public void setAppContext(java.util.Map context)
sets the task context. this method must be called before the run/render/execute etc.

Parameters:
context - - task contexts in a map. The map contains name-value pairs

getLocale

public java.util.Locale getLocale()
returns the locale for running the task

Returns:
the locale for running the task

getULocale

public com.ibm.icu.util.ULocale getULocale()
returns the locale for running the task

Returns:
the locale for running the task

getAppContext

public java.util.Map getAppContext()
returns the context objects for the task. The return appContext is read only, the user should never try to modify the value.

Returns:
the task contexts

getEngine

public IReportEngine getEngine()
returns the report engine object

Returns:
the engine object

addScriptableJavaObject

public void addScriptableJavaObject(java.lang.String jsName,
                                    java.lang.Object obj)
Deprecated. user should add it to appContext.

defines an additional Java object that is exposed to BIRT scripting at a per-task level

Parameters:
jsName - the name that the object is referenced in JavaScript
obj - the Java object that is wrapped and scripted

getID

public int getID()
returns an identifier for the task. The identifier can be used to identify the task, especially when writing logs in a multi-threaded environment.

Returns:
an identifier for the task.

getReportRunnable

public IReportRunnable getReportRunnable()
returns the runnable report design object

Returns:
the runnable report design object

setParameterValues

public void setParameterValues(java.util.Map params)
set all parameter valuess

Parameters:
params - a hash map with all parameters

setParameterValue

public void setParameterValue(java.lang.String name,
                              java.lang.Object value)
sets one parameter value

Parameters:
name - parameter name
value - parameter value

getParameterValues

public java.util.HashMap getParameterValues()
returns the parameter name/value collection

Returns:
the parameter names/values in a hash map

getParameterValue

public java.lang.Object getParameterValue(java.lang.String name)
returns the value of a parameter.

Returns:
the parameter value.

validateParameters

public boolean validateParameters()
Returns:
whether the parameter validation succeeds

setParameter

public void setParameter(java.lang.String name,
                         java.lang.Object value,
                         java.lang.String displayText)
Sets parameter value and display text.

Parameters:
name - parameter name.
value - value.
displayText - display text.

getParameterDisplayText

public java.lang.String getParameterDisplayText(java.lang.String name)
Gets parameter display text by parameter name.

Parameters:
name - parameter name.
Returns:
display text.

setParameterDisplayText

public void setParameterDisplayText(java.lang.String name,
                                    java.lang.String displayText)
Sets display text of a parameter with specified name.

Parameters:
name - name of the parameter.
displayText - display text to set.

cancel

public void cancel()
set the cancel flag if the task is running. the task can re-run if it is cancedl.


cancel

public void cancel(java.lang.Object signal)
Deprecated. user should use cancel() instead.

cancels the task with a signal. you can't call this method in the same thread with runTask The signal will be notified when the task finishes the cancel.


getCancelFlag

public boolean getCancelFlag()
return a flag if the user called cancel.

Returns:
true the user has called cancel, false the user doesn't call cancel.

getStatus

public int getStatus()
get the status of task

Returns:
the status

setErrorHandlingOption

public void setErrorHandlingOption(int option)
set the error handling mode for the first error. If the options is set to cancel_on_error, the task is cancelled just like the user calls cancel(). If the option is set the continue_on_erro, the task will continue and saves the error into the error list.

Parameters:
option - the error handling mode.
Returns:

close

public void close()
close the task, relese any resources.


setDataSource

public void setDataSource(IDocArchiveReader dataSource)
set the data source used by the engine task. The dataSource is opend and closed by this task.

Parameters:
dataSource - data source archive.

getErrors

public java.util.List getErrors()
Gets all errors.

Returns:
the errors list.

getTaskType

public int getTaskType()
Gets the type of the engine.

Returns:
task type including:
  • 0 for GetParameterDefinition Task
  • 1 for Run Task
  • 2 for Render Task
  • 3 for Run and Render Task
  • 4 for DataExtraction Task
  • -1 default value for unknown task

  • getLogger

    public java.util.logging.Logger getLogger()
    return the logger used by the task.

    Returns:
    logger used by the task.

    setLogger

    public void setLogger(java.util.logging.Logger logger)
    set the logger used by the task.

    Parameters:
    logger - the logger used to output messages.


    Copyright © 2005 Actuate Corp. All rights reserved.