public class EtlExecutor extends java.lang.Object implements java.lang.Runnable, java.util.concurrent.Callable<ExecutionStatistics>
Use ConfigurationFactory
to parse script files and to configure
the executor.
The usage scenario of this class may be described using the following steps:
EtlExecutor(scriptella.configuration.ConfigurationEl)
Create an instance of this class
and pass a script file configuration
.
Execute
the script
Additionally simplified helper methods are declared in this class:
Thread.interrupt()
mechanism.
To interrupt the ETL execution invoke Thread.interrupt()
on a thread
which started
ETL operation. As a part of interruption process
the engine tries to roll back all changes made during the ETL operation.
ExecutorService
and Future
can also be used to control ETL execution.
Runnable
and Callable
.
This feature simplifies integration of Scriptella executors with Executors
or other systems like Spring/Quartz etc. It also minimizes application code dependency on Scriptella.Constructor and Description |
---|
EtlExecutor()
Creates ETL executor.
|
EtlExecutor(ConfigurationEl configuration)
Creates an ETL executor for specified configuration file.
|
Modifier and Type | Method and Description |
---|---|
ExecutionStatistics |
call()
A synonym for
execute() . |
ExecutionStatistics |
execute()
Executes ETL based on a specified configuration.
|
ExecutionStatistics |
execute(ProgressIndicator indicator)
Executes ETL based on a specified configuration.
|
ConfigurationEl |
getConfiguration()
Returns ETL configuration for this executor.
|
boolean |
isJmxEnabled()
Returns true if monitoring/management via JMX is enabled.
|
boolean |
isSuppressStatistics()
Getter for
suppressStatistics property. |
static EtlExecutor |
newExecutor(java.io.File scriptFile)
Converts file to URL and invokes
newExecutor(java.net.URL) . |
static EtlExecutor |
newExecutor(java.net.URL scriptFileUrl)
Helper method to create a new ScriptExecutor for specified script URL.
|
static EtlExecutor |
newExecutor(java.net.URL scriptFileUrl,
java.util.Map<java.lang.String,?> externalProperties)
Helper method to create a new ScriptExecutor for specified script URL.
|
protected EtlContext |
prepare(ProgressIndicator indicator)
Prepares the scripts context.
|
void |
run()
A runnable adapter for
execute() method. |
void |
setConfiguration(ConfigurationEl configuration)
Sets ETL configuration.
|
void |
setJmxEnabled(boolean jmxEnabled)
Enables or disables ETL monitoring/management via JMX.
|
void |
setSuppressStatistics(boolean suppressStatistics)
Enables or disables collecting of statistics.
|
public EtlExecutor()
public EtlExecutor(ConfigurationEl configuration)
configuration
- ETL configuration.public ConfigurationEl getConfiguration()
public void setConfiguration(ConfigurationEl configuration)
configuration
- ETL configuration.public boolean isJmxEnabled()
If jmxEnabled=true the executor registers MBeans for executed ETL files.
The object names of the mbeans have the following form:
scriptella: type=etl,url="ETL_FILE_URL"
public void setJmxEnabled(boolean jmxEnabled)
If jmxEnabled=true the executor registers MBeans for executed ETL files.
The object names of the mbeans have the following form:
scriptella: type=etl,url="ETL_FILE_URL"
jmxEnabled
- true if monitoring/management via JMX is enabled.JmxEtlManagerMBean
public boolean isSuppressStatistics()
suppressStatistics
property.public void setSuppressStatistics(boolean suppressStatistics)
Setting this option to true
may improve performance in some cases.
suppressStatistics
- true if statistics collection should be disabled.public ExecutionStatistics execute() throws EtlExecutorException
EtlExecutorException
- if ETL fails.execute(scriptella.interactive.ProgressIndicator)
public ExecutionStatistics execute(ProgressIndicator indicator) throws EtlExecutorException
indicator
- progress indicator to use.EtlExecutorException
- if ETL fails.protected EtlContext prepare(ProgressIndicator indicator)
indicator
- progress indicator to use.public static EtlExecutor newExecutor(java.io.File scriptFile)
newExecutor(java.net.URL)
.scriptFile
- ETL file.newExecutor(java.net.URL)
public static EtlExecutor newExecutor(java.net.URL scriptFileUrl)
Calls newExecutor(java.net.URL, java.util.Map)
and passes System properties
as external properties.
scriptFileUrl
- URL of script file.public static EtlExecutor newExecutor(java.net.URL scriptFileUrl, java.util.Map<java.lang.String,?> externalProperties)
scriptFileUrl
- URL of script file.externalProperties
- see ConfigurationFactory.setExternalParameters(java.util.Map)
ConfigurationFactory
public void run() throws SystemException
execute()
method.
Please note that due to a checked
exceptions limitation a SystemException
is thrown instead of
the EtlExecutorException
.
run
in interface java.lang.Runnable
SystemException
- a wrapped EtlExecutorException
.execute()
public ExecutionStatistics call() throws EtlExecutorException
execute()
.call
in interface java.util.concurrent.Callable<ExecutionStatistics>
EtlExecutorException
Copyright © Copyright 2006-2019 The Scriptella Project Team.