Skip to content

PSICQUIC/psicquic-clustering

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

psicquic-clustering

To install run:

git clone https://github.com/PSICQUIC/psicquic-clustering.git
cd psicquic-clustering
mvn clean install

Spring Setup

Last updated: 2010-10-04

If you intend to use this library, you will have to setup Spring on your end. The section below explain how you shoul dbe creating a DataSource to hold springbatch data and you will do so by correctly configuring Spring. Now let's assume you have stored the following file in your project to host such config:

 src/main/resources/META-INF/myconfig-spring.xml

Now you could initilize spring using the following method call:

 ApplicationContext ac = new ClassPathXmlApplicationContext( "/META-INF/psicquic-clustering.spring.xml",
                                                             "/META-INF/myconfig.spring.xml" );

This will initialize spring with the base clustering config and your added one.

Spring Batch Setup

Should you want to use this library, you will have to configure the Spring Batch DataSource so that all job definition and instances get persisted into an RDBMS. Thereafter, we assume you are installing it in H2. To do so, you will have to add the following bean definition in the Spring configuration file of your own project:

<!-- Batch storage -->
<bean id="clusteringDataSource" class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName" value="${batch.jdbc.driver}"/>
    <property name="url" value="${batch.jdbc.url}"/>
    <property name="username" value="${batch.jdbc.user}"/>
    <property name="password" value="${batch.jdbc.password}"/>
</bean>

One easy way to configure that DataSource could be to add the following section in yout POM file:

<properties>
    <batch.jdbc.driver>org.h2.Driver</batch.jdbc.driver>
    <batch.jdbc.url>jdbc:h2:file:psicquic-batch</batch.jdbc.url>
    <batch.jdbc.user>psicquic-batch</batch.jdbc.user>
    <batch.jdbc.password>batch</batch.jdbc.password>
</properties>

Add the dependency of your favorite RDBMS as well as DBCP (connection pool) in your Maven dependencies:

    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <version>1.2.143</version>
    </dependency>
    <dependency>
        <groupId>commons-dbcp</groupId>
        <artifactId>commons-dbcp</artifactId>
        <version>1.4</version>
    </dependency>

Should you wish to Initialise the Spring Batch database schema automatically at startup, you can also add the following definition:

<!-- Auto initialization of the Spring Batch schema in H2 -->
<!-- http://static.springsource.org/spring/docs/3.0.4.RELEASE/spring-framework-reference/htmlsingle/spring-framework-reference.html#d0e24245 -->
<jdbc:initialize-database data-source="clusteringDataSource" ignore-failures="ALL">
    <jdbc:script location="classpath*:/org/springframework/batch/core/schema-h2.sql"/>
</jdbc:initialize-database>

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages