Interface IEngineTask
- All Known Subinterfaces:
IDataExtractionTask
,IDatasetPreviewTask
,IExtractionTask
,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
FieldsModifier and TypeFieldDescriptionstatic final int
cancel the task execution if there is an error.static final int
continue the task execution if there is an error.static final int
the task is finished by cancledstatic final int
the task is finished with errorsstatic final int
the task is not running yetstatic final int
the task is runningstatic final int
the task is finished with sucessfulstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addScriptableJavaObject
(String jsName, Object obj) Deprecated.user should add it to appContext.void
cancel()
set the cancel flag if the task is running.void
cancels the task by the given reason.void
close()
close the task, relese any resources.returns the context objects for the task.boolean
return a flag if the user called cancel.returns the report engine objectGets all exceptions that are thrown out during executing this task.int
getID()
returns an identifier for the task.returns the locale for running the taskreturn the logger used by the task.Gets parameter display text by parameter name.getParameterValue
(String name) returns the value of a parameter.returns the parameter name/value collectionreturns the runnable report design objectint
get the status of taskint
Gets the type of the engine.com.ibm.icu.util.ULocale
returns the locale for running the taskvoid
setAppContext
(Map context) sets the task context.void
setDataSource
(org.eclipse.birt.core.archive.IDocArchiveReader dataSource) set the data source used by the engine task.void
setDataSource
(org.eclipse.birt.core.archive.IDocArchiveReader dataSource, String reportlet) set the data source used by the engine task.void
setErrorHandlingOption
(int option) set the error handling mode for the first error.void
setLocale
(com.ibm.icu.util.ULocale locale) sets the task localevoid
sets the task localevoid
set the logger used by the task.void
setParameter
(String name, Object[] values, String[] displayText) Sets parameter value and display text.void
setParameter
(String name, Object value, String displayText) Sets parameter value and display text.void
setParameterDisplayText
(String name, String displayText) Sets display text of a parameter with specified name.void
setParameterDisplayText
(String name, String[] text) Sets display text of a parameter with specified name.void
setParameterValue
(String name, Object value) sets one parameter valuevoid
setParameterValue
(String name, Object[] values) sets one parameter valuesvoid
setParameterValues
(Map params) set all parameter valuessvoid
setProgressMonitor
(IProgressMonitor monitor) the a progress monitor to keep track of the report progressvoid
setStatusHandler
(IStatusHandler handler) set a task-level status handler, this handler will override the engine-level onevoid
setTimeZone
(com.ibm.icu.util.TimeZone timeZone) Set the time zone information for the task.void
setUserACL
(String[] acl) set user's ACL.boolean
-
Field Details
-
TASK_UNKNOWN
static final int TASK_UNKNOWN- See Also:
-
TASK_GETPARAMETERDEFINITION
static final int TASK_GETPARAMETERDEFINITION- See Also:
-
TASK_RUN
static final int TASK_RUN- See Also:
-
TASK_RENDER
static final int TASK_RENDER- See Also:
-
TASK_RUNANDRENDER
static final int TASK_RUNANDRENDER- See Also:
-
TASK_DATAEXTRACTION
static final int TASK_DATAEXTRACTION- See Also:
-
TASK_DATASETPREVIEW
static final int TASK_DATASETPREVIEW- See Also:
-
STATUS_NOT_STARTED
static final int STATUS_NOT_STARTEDthe task is not running yet- See Also:
-
STATUS_RUNNING
static final int STATUS_RUNNINGthe task is running- See Also:
-
STATUS_SUCCEEDED
static final int STATUS_SUCCEEDEDthe task is finished with sucessful- See Also:
-
STATUS_FAILED
static final int STATUS_FAILEDthe task is finished with errors- See Also:
-
STATUS_CANCELLED
static final int STATUS_CANCELLEDthe task is finished by cancled- See Also:
-
CONTINUE_ON_ERROR
static final int CONTINUE_ON_ERRORcontinue the task execution if there is an error.- See Also:
-
CANCEL_ON_ERROR
static final int CANCEL_ON_ERRORcancel the task execution if there is an error.- See Also:
-
-
Method Details
-
setLocale
sets the task locale- Parameters:
locale
- the task locale
-
setLocale
void setLocale(com.ibm.icu.util.ULocale locale) sets the task locale- Parameters:
locale
- the task locale
-
setTimeZone
void setTimeZone(com.ibm.icu.util.TimeZone timeZone) Set the time zone information for the task.Only following tasks have the meaningful implementations:
- RunAndRenderTask
- RenderTask
- GetParameterDefinitionTask
- Parameters:
timeZone
- the time zone information for the task
-
setAppContext
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
Locale getLocale()returns the locale for running the task- Returns:
- the locale for running the task
-
getULocale
com.ibm.icu.util.ULocale getULocale()returns the locale for running the task- Returns:
- the locale for running the task
-
getAppContext
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
IReportEngine getEngine()returns the report engine object- Returns:
- the engine object
-
addScriptableJavaObject
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 JavaScriptobj
- the Java object that is wrapped and scripted
-
getID
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
IReportRunnable getReportRunnable()returns the runnable report design object- Returns:
- the runnable report design object
-
setParameterValues
set all parameter valuess- Parameters:
params
- a hash map with all parameters
-
setParameterValue
sets one parameter value- Parameters:
name
- parameter namevalue
- parameter value
-
setParameterValue
sets one parameter values- Parameters:
name
- parameter namevalues
- parameter values
-
getParameterValues
HashMap getParameterValues()returns the parameter name/value collection- Returns:
- the parameter names/values in a hash map
-
getParameterValue
returns the value of a parameter.- Returns:
- the parameter value.
-
validateParameters
boolean validateParameters()- Returns:
- whether the parameter validation succeeds
-
setParameter
Sets parameter value and display text.- Parameters:
name
- parameter name.value
- value.displayText
- display text.
-
setParameter
Sets parameter value and display text.- Parameters:
name
- parameter name.values
- values.displayText
- display text.
-
getParameterDisplayText
Gets parameter display text by parameter name.- Parameters:
name
- parameter name.- Returns:
- display text.
-
setParameterDisplayText
Sets display text of a parameter with specified name.- Parameters:
name
- name of the parameter.displayText
- display text to set.
-
setParameterDisplayText
Sets display text of a parameter with specified name.- Parameters:
name
- name of the parameter.displayText
- display text to set.
-
cancel
void cancel()set the cancel flag if the task is running. the task can re-run if it was cancelled. -
cancel
cancels the task by the given reason. -
getCancelFlag
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
int getStatus()get the status of task- Returns:
- the status
-
setErrorHandlingOption
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.
-
close
void close()close the task, relese any resources. -
setDataSource
void setDataSource(org.eclipse.birt.core.archive.IDocArchiveReader dataSource) set the data source used by the engine task. The dataSource is closed by this task.- Parameters:
dataSource
- data source archive.
-
setDataSource
set the data source used by the engine task.- Parameters:
dataSource
- data source archive.reportlet
- the bookmark of the reportlet.
-
getErrors
List getErrors()Gets all exceptions that are thrown out during executing this task. Each exception is supposed to be an instance of EngineException.- Returns:
- the all the exceptions in a list.
-
getTaskType
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
Logger getLogger()return the logger used by the task.- Returns:
- logger used by the task.
-
setLogger
set the logger used by the task.- Parameters:
logger
- the logger used to output messages.
-
setUserACL
set user's ACL.- Parameters:
acl
- a string array, each element is a single SID.
-
setProgressMonitor
the a progress monitor to keep track of the report progress- Parameters:
monitor
- a user defined progress monitor
-
setStatusHandler
set a task-level status handler, this handler will override the engine-level one- Parameters:
handler
- a user defined status handler
-