Package scriptella.driver.spring
package scriptella.driver.spring
Spring Framework Integration Driver for Scriptella.
This driver allows working in The Spring Framework environment and provides an ability to locate Spring-managed data sources.
This driver acts as a proxy and relies on JDBC Bridge.
Important:
The driver requires EtlExecutorBean to operate, see examples below.General information
| Driver class: | scriptella.driver.spring.Driver |
| URL: | Name of the DataSource bean specified in the bean factory/application context |
| Runtime dependencies: |
Spring Framework 5.3.x:
spring-aop, spring-beans,
spring-context, spring-core,
spring-expression, spring-jcl,
spring-jdbc, and spring-tx
|
Driver Specific Properties
| Name | Description | Required |
|---|
ETL Executor Configuration
EtlExecutorBean is intended to be configured from Spring XML configuration files. See EtlExecutorBean Javadoc for details on how to configure the executor in Spring.Example
This example creates a table Spring_Table using a connection from Spring Datasource.Spring Application Context
Spring application context declares a datasource and an executor. Additional properties and dependencies like progress indicator may also be injected.
<beans>
<bean id="datasource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName"><value>org.h2.Driver</value></property>
<property name="url"><value>jdbc:h2:mem:spring;MODE=LEGACY;NON_KEYWORDS=VALUE</value></property>
<property name="username"><value>sa</value></property>
<property name="password"><value></value></property>
</bean>
<bean id="progress" class="scriptella.interactive.ConsoleProgressIndicator"/>
<bean id="executor" class="scriptella.driver.spring.EtlExecutorBean">
<property name="configLocation"><value>etl.xml</value></property>
<property name="progressIndicator"><ref local="progress"/></property>
<property name="properties"><map>
<entry key="tableName"><value>Spring_Table</value></entry>
</map>
</property>
</bean>
</beans>
ETL file etl.xml
<etl>
<connection driver="spring" url="datasource"/>
<script>
CREATE TABLE ${tableName} (
ID INT
)
</script>
</etl>
The usage of executor is straightforward:
EtlExecutor exec = (EtlExecutor) beanFactory.getBean("executor");
exec.execute();
Additionally you can use java.util.concurrent.Callable or java.lang.Runnable
invocation interface to avoid unnecessary dependency on Scriptella in application code:
Callable exec = (Callable) beanFactory.getBean("executor");
exec.call();
Batched execution of ETL files
BatchEtlExecutorBean provides an API
to execute ETL files in a batch.-
ClassDescriptionBatched implementation to run
ETL executorsfor Spring IoC container.Scriptella driver for The Spring Framework Bean Factory(or Application Context) registered datasources.Implementation ofEtlExecutorfor Spring IoC container.Thrown to indicate Spring provider failure.