Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

How to execute Scriptella ETL files (See related posts)

Scriptella ETL provides several ways to execute ETL files:

Invocation from Ant
<taskdef resource="antscriptella.properties" classpath="/path/to/scriptella.jar[;additional_drivers.jar]"/>
<etl file="path/to/etl/file/> <!-- Execute ETL file from specified location -->

Command-Line Execution
Just type scriptella to run the file named etl.xml in the current directory. Alternatively you can use Java launcher:
java -jar scriptella.jar [arguments]

Executing ETL Files from Java
It is extremely easy to run Scriptella ETL files from java code. Just make sure scriptella.jar is on classpath and use any of the following methods to execute an ETL file:
EtlExecutor.newExecutor(new File("etl.xml")).execute(); //Execute etl.xml file
EtlExecutor.newExecutor(getClass().getResource("etl.xml")).execute(); //Execute etl.xml file loaded from classpath
EtlExecutor.newExecutor(
    servletContext.getResource("/WEB-INF/etl.xml")).execute(); //Execute etl.xml file from web application WEB-INF dir

Integration with Spring Framework
<beans>
    <!-- Spring beans declarations -->

    <!-- Spring managed bean which executes etl.xml file -->
    <bean id="executor" class="scriptella.driver.spring.EtlExecutorBean">
        <property name="configLocation" value="etl.xml"/>
    </bean>
</beans>

The usage of executor is straightforward:
EtlExecutor exec = (EtlExecutor) beanFactory.getBean("executor");
exec.execute();

See Spring Driver JavaDoc for additional details.

You need to create an account or log in to post comments to this site.


Click here to browse all 4857 code snippets

Related Posts