SlideShare a Scribd company logo
1 of 9
Collection<ClassActionReportBean> data = new
ArrayList<ClassActionReportBean>();
Iterator<HashMap<String, Object>> iter = records.iterator();
while(iter.hasNext()) {
HashMap<String, Object> record = iter.next();
ClassActionReportBean bean = new ClassActionReportBean();
………………………………………………………………………………………………………………………………………………………………..
………………………………………………………………………….
data.add(bean);

<bean id="loggingAdvice"
class="ca.cgi.mvest.springframework.logging.LoggingAdvisor">
</bean>
<bean id="theLogger"
class="org.springframework.aop.support.RegexpMethodPointcutAdvisor" >
<property name="advice">
<ref local="loggingAdvice"></ref>
</property>
<property name="patterns">
<list>
<value>.*execute</value>
<value>.*beforeStep</value>
<value>.*afterStep</value>
<value>.*create</value>
<value>.*update</value>
<value>.*read</value>
<value>.*process</value>
<value>.*write</value>
</list>
</property>
</bean>
</beans>
 <bean id="environmentBean"
class="ca.cgi.mvest.springframework.main.EnvironmentBean">
 <property name="client" value="${client}" />
 <property name="ahsPageFlag" value="${AHS_PAGE}" />
 <property name="criticalDir" value="${CRITICAL}" />
 <property name="environment" value="${env}" />
 <property name="dbSchema" value="${hibernate.default_schema}" />
 <property name="dbUser" value="${hibernate.connection.username}"
/>
 <property name="dbPassword"
value="${hibernate.connection.password}" />
 <property name="dbConnection" value="${hibernate.connection.url}"
/>
 <property name="minPoolSize" value="${hibernate.c3p0.min_size}"
/>
 <property name="maxPoolSize" value="${hibernate.c3p0.max_size}"
/>
 <property name="connectionTimeOut"
value="${hibernate.c3p0.timeout}" />
 <property name="schedulerUrl" value="${quartz.scheduler.url}" />
 <property name="comDir" value="${COM}" />
 <property name="iffilesDir" value="${IFFILES}" />
 <property name="fundataDir" value="${FUNDATA}" />
 <property name="mprootDir" value="${MP_ROOT}" />
 <property name="mptmpDir" value="${mptmp.dir}" />
 <property name="pricingDir" value="${PRICING}" />
 <property name="prodEnvFlag" value="${PRODENV}" />
 <property name="xferDir" value="${XFER}" />
 <property name="path" value="${PATH}" />
 <property name="oracleHome" value="${ORACLE_HOME}" />
 <property name="oracleTwoTask" value="${TWO_TASK}" />
 <property name="sftpKeyPath" value="${sftp.key.filepath}" />
</bean>
<aop:config>
<aop:pointcut id="jobLauncherTxOperation"
expression="execution(*
ca.cgi.mvest.springframework.main.IJobLauncher.*(..))"></aop:pointcut>
<aop:pointcut id="defaultTxOperation"
expression="execution(*
ca.cgi.mvest.springframework.wms.*.*(..))"></aop:pointcut>
<aop:pointcut id="webTxOperation"
expression="execution(*
ca.cgi.mvest.web.admin.*.*(..))"></aop:pointcut>
 In order to run Spring Batch, we need to configure SpringBatch
infrastructure.This includes creation of JobRepository, JobLauncher and
TransactionManager.
 For each job, we need a separate xml context definition file. However, there
is a number of common objects that we will need recurrently.
 JOB REPOSITORY:
 JOB LAUNCHER:
 MvestJobLauncher(class):

 IJobLauncher(interface):It will contain the methods in
the MVestJobLauncher.java file
 The jobLauncher as defined in the “app-config.xml” in
the batch of MVest clearly has a bean definition as:
<bean id="jobLauncher"
class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
<property name="jobRepository" ref="jobRepository" />
</bean>
<bean id="jobRegistry"
class="org.springframework.batch.core.configu
ration.support.MapJobRegistry" />//

<bean id="jobOperator"
class="org.springframework.batch.core.launch.
support.SimpleJobOperator">
<property name="jobExplorer">
<bean
class="org.springframework.batch.core.explore.support.JobExplorerFactoryBean">
<property name="dataSource" ref="dataSource" />
</bean>
</property>
<property name="jobRepository" ref="jobRepository"></property>
<property name="jobRegistry" ref="jobRegistry"></property>
<property name="jobLauncher" ref="jobLauncher"></property>
</bean>
<bean id="mvestJobLauncher"
class="ca.cgi.mvest.springframework.main.MVestJobLauncher"
scope="prototype">
<property name="jobLauncher" ref="jobLauncher"></property>
<property name="reportingBean" ref="reportingBean"></property>
<property name="sf" ref="sessionFactory"></property>
<property name="dataSource" ref="dataSource"></property>
</bean>
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource" >
<property name="driverClassName"
value="${hibernate.connection.driver_class}" />
<property name="url" value="${hibernate.connection.url}" />
<property name="username" value="${hibernate.connection.username}" />
<property name="password" value="${hibernate.connection.password}" />
</bean>
 TRANSACTION MANAGER:
<tx:advice id="jobLauncherTxAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="preJob" propagation="REQUIRES_NEW" />
<tx:method name="runJob" read-only="false"
propagation="SUPPORTS"
rollback-for="Exception, RuntimeException" />
<tx:method name="postJob" propagation="REQUIRES_NEW" />
<tx:method name="handlePrinter" propagation="MANDATORY" />
<tx:method name="update*" propagation="MANDATORY" />
<tx:method name="handleRollback*"
propagation="REQUIRES_NEW" />
<tx:method name="setJobNumber" propagation="NEVER" />
<tx:method name="setJobRequest" propagation="NEVER" />
<tx:method name="cleanup" propagation="NEVER" />
<tx:method name="sendMail" propagation="NEVER" />
<tx:method name="*" propagation="MANDATORY" />
</tx:attributes>
</tx:advice>

More Related Content

What's hot

Everything You (N)ever Wanted to Know about Testing View Controllers
Everything You (N)ever Wanted to Know about Testing View ControllersEverything You (N)ever Wanted to Know about Testing View Controllers
Everything You (N)ever Wanted to Know about Testing View ControllersBrian Gesiak
 
05 JavaScript #burningkeyboards
05 JavaScript #burningkeyboards05 JavaScript #burningkeyboards
05 JavaScript #burningkeyboardsDenis Ristic
 
What's new in jQuery 1.5
What's new in jQuery 1.5What's new in jQuery 1.5
What's new in jQuery 1.5Martin Kleppe
 
Building Go Web Apps
Building Go Web AppsBuilding Go Web Apps
Building Go Web AppsMark
 
Practical Protocols with Associated Types
Practical Protocols with Associated TypesPractical Protocols with Associated Types
Practical Protocols with Associated TypesNatasha Murashev
 
Teste de Integração com DbUnit e jIntegrity
Teste de Integração com DbUnit e jIntegrityTeste de Integração com DbUnit e jIntegrity
Teste de Integração com DbUnit e jIntegrityWashington Botelho
 
React + Redux. Best practices
React + Redux.  Best practicesReact + Redux.  Best practices
React + Redux. Best practicesClickky
 
Quick: Better Tests via Incremental Setup
Quick: Better Tests via Incremental SetupQuick: Better Tests via Incremental Setup
Quick: Better Tests via Incremental SetupBrian Gesiak
 
Testing view controllers with Quick and Nimble
Testing view controllers with Quick and NimbleTesting view controllers with Quick and Nimble
Testing view controllers with Quick and NimbleMarcio Klepacz
 
Testowanie JavaScript
Testowanie JavaScriptTestowanie JavaScript
Testowanie JavaScriptTomasz Bak
 
PostgreSQL's Secret NoSQL Superpowers
PostgreSQL's Secret NoSQL SuperpowersPostgreSQL's Secret NoSQL Superpowers
PostgreSQL's Secret NoSQL SuperpowersAmanda Gilmore
 
React.js or why DOM finally makes sense
React.js or why DOM finally makes senseReact.js or why DOM finally makes sense
React.js or why DOM finally makes senseEldar Djafarov
 
[Srijan Wednesday Webinar] Rails 5: What's in It for Me?
[Srijan Wednesday Webinar] Rails 5: What's in It for Me?[Srijan Wednesday Webinar] Rails 5: What's in It for Me?
[Srijan Wednesday Webinar] Rails 5: What's in It for Me?Srijan Technologies
 
Upgrade your javascript to drupal 8
Upgrade your javascript to drupal 8Upgrade your javascript to drupal 8
Upgrade your javascript to drupal 8Théodore Biadala
 
AngularJS Services
AngularJS ServicesAngularJS Services
AngularJS ServicesEyal Vardi
 
Javascript Frameworks for Joomla
Javascript Frameworks for JoomlaJavascript Frameworks for Joomla
Javascript Frameworks for JoomlaLuke Summerfield
 

What's hot (20)

Everything You (N)ever Wanted to Know about Testing View Controllers
Everything You (N)ever Wanted to Know about Testing View ControllersEverything You (N)ever Wanted to Know about Testing View Controllers
Everything You (N)ever Wanted to Know about Testing View Controllers
 
Spring 3.0
Spring 3.0Spring 3.0
Spring 3.0
 
05 JavaScript #burningkeyboards
05 JavaScript #burningkeyboards05 JavaScript #burningkeyboards
05 JavaScript #burningkeyboards
 
What's new in jQuery 1.5
What's new in jQuery 1.5What's new in jQuery 1.5
What's new in jQuery 1.5
 
Building Go Web Apps
Building Go Web AppsBuilding Go Web Apps
Building Go Web Apps
 
Practical Protocols with Associated Types
Practical Protocols with Associated TypesPractical Protocols with Associated Types
Practical Protocols with Associated Types
 
React with Redux
React with ReduxReact with Redux
React with Redux
 
Teste de Integração com DbUnit e jIntegrity
Teste de Integração com DbUnit e jIntegrityTeste de Integração com DbUnit e jIntegrity
Teste de Integração com DbUnit e jIntegrity
 
React + Redux. Best practices
React + Redux.  Best practicesReact + Redux.  Best practices
React + Redux. Best practices
 
React & Redux
React & ReduxReact & Redux
React & Redux
 
Quick: Better Tests via Incremental Setup
Quick: Better Tests via Incremental SetupQuick: Better Tests via Incremental Setup
Quick: Better Tests via Incremental Setup
 
Testing view controllers with Quick and Nimble
Testing view controllers with Quick and NimbleTesting view controllers with Quick and Nimble
Testing view controllers with Quick and Nimble
 
Testowanie JavaScript
Testowanie JavaScriptTestowanie JavaScript
Testowanie JavaScript
 
PostgreSQL's Secret NoSQL Superpowers
PostgreSQL's Secret NoSQL SuperpowersPostgreSQL's Secret NoSQL Superpowers
PostgreSQL's Secret NoSQL Superpowers
 
React.js or why DOM finally makes sense
React.js or why DOM finally makes senseReact.js or why DOM finally makes sense
React.js or why DOM finally makes sense
 
[Srijan Wednesday Webinar] Rails 5: What's in It for Me?
[Srijan Wednesday Webinar] Rails 5: What's in It for Me?[Srijan Wednesday Webinar] Rails 5: What's in It for Me?
[Srijan Wednesday Webinar] Rails 5: What's in It for Me?
 
Upgrade your javascript to drupal 8
Upgrade your javascript to drupal 8Upgrade your javascript to drupal 8
Upgrade your javascript to drupal 8
 
Javascript - Beyond-jQuery
Javascript - Beyond-jQueryJavascript - Beyond-jQuery
Javascript - Beyond-jQuery
 
AngularJS Services
AngularJS ServicesAngularJS Services
AngularJS Services
 
Javascript Frameworks for Joomla
Javascript Frameworks for JoomlaJavascript Frameworks for Joomla
Javascript Frameworks for Joomla
 

Similar to Configure Spring Batch Infrastructure

How to Bring Common UI Patterns to ADF
How to Bring Common UI Patterns to ADF How to Bring Common UI Patterns to ADF
How to Bring Common UI Patterns to ADF Luc Bors
 
Spring Framework Petclinic sample application
Spring Framework Petclinic sample applicationSpring Framework Petclinic sample application
Spring Framework Petclinic sample applicationAntoine Rey
 
Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsAdding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsJeff Durta
 
JavaScript Fundamentals with Angular and Lodash
JavaScript Fundamentals with Angular and LodashJavaScript Fundamentals with Angular and Lodash
JavaScript Fundamentals with Angular and LodashBret Little
 
Local data storage for mobile apps
Local data storage for mobile appsLocal data storage for mobile apps
Local data storage for mobile appsIvano Malavolta
 
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)Red Hat Developers
 
In The Brain of Cagatay Civici: Exploring JavaServer Faces 2.0 and PrimeFaces
In The Brain of Cagatay Civici: Exploring JavaServer Faces 2.0 and PrimeFaces In The Brain of Cagatay Civici: Exploring JavaServer Faces 2.0 and PrimeFaces
In The Brain of Cagatay Civici: Exploring JavaServer Faces 2.0 and PrimeFaces Skills Matter
 
Spring data iii
Spring data iiiSpring data iii
Spring data iii명철 강
 
Building Lithium Apps
Building Lithium AppsBuilding Lithium Apps
Building Lithium AppsNate Abele
 
Integration Of Springs Framework In Hibernates
Integration Of Springs Framework In HibernatesIntegration Of Springs Framework In Hibernates
Integration Of Springs Framework In HibernatesSunkara Prakash
 
Integration Of Springs Framework In Hibernates
Integration Of Springs Framework In HibernatesIntegration Of Springs Framework In Hibernates
Integration Of Springs Framework In HibernatesSunkara Prakash
 
Understanding backbonejs
Understanding backbonejsUnderstanding backbonejs
Understanding backbonejsNick Lee
 
jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginnersDivakar Gu
 
jrubykaigi2010-lt-rubeus
jrubykaigi2010-lt-rubeusjrubykaigi2010-lt-rubeus
jrubykaigi2010-lt-rubeusTakeshi AKIMA
 
How to execute an oracle stored procedure with nested table as a parameter fr...
How to execute an oracle stored procedure with nested table as a parameter fr...How to execute an oracle stored procedure with nested table as a parameter fr...
How to execute an oracle stored procedure with nested table as a parameter fr...Priyobroto Ghosh (Mule ESB Certified)
 
Java7 New Features and Code Examples
Java7 New Features and Code ExamplesJava7 New Features and Code Examples
Java7 New Features and Code ExamplesNaresh Chintalcheru
 

Similar to Configure Spring Batch Infrastructure (20)

How to Bring Common UI Patterns to ADF
How to Bring Common UI Patterns to ADF How to Bring Common UI Patterns to ADF
How to Bring Common UI Patterns to ADF
 
How te bring common UI patterns to ADF
How te bring common UI patterns to ADFHow te bring common UI patterns to ADF
How te bring common UI patterns to ADF
 
Spring Framework Petclinic sample application
Spring Framework Petclinic sample applicationSpring Framework Petclinic sample application
Spring Framework Petclinic sample application
 
Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsAdding a modern twist to legacy web applications
Adding a modern twist to legacy web applications
 
JavaScript Fundamentals with Angular and Lodash
JavaScript Fundamentals with Angular and LodashJavaScript Fundamentals with Angular and Lodash
JavaScript Fundamentals with Angular and Lodash
 
Local data storage for mobile apps
Local data storage for mobile appsLocal data storage for mobile apps
Local data storage for mobile apps
 
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
 
In The Brain of Cagatay Civici: Exploring JavaServer Faces 2.0 and PrimeFaces
In The Brain of Cagatay Civici: Exploring JavaServer Faces 2.0 and PrimeFaces In The Brain of Cagatay Civici: Exploring JavaServer Faces 2.0 and PrimeFaces
In The Brain of Cagatay Civici: Exploring JavaServer Faces 2.0 and PrimeFaces
 
Rails is not just Ruby
Rails is not just RubyRails is not just Ruby
Rails is not just Ruby
 
Spring data iii
Spring data iiiSpring data iii
Spring data iii
 
Building Lithium Apps
Building Lithium AppsBuilding Lithium Apps
Building Lithium Apps
 
Refreshing mule cache using oracle database change notification
Refreshing mule cache using oracle database change notificationRefreshing mule cache using oracle database change notification
Refreshing mule cache using oracle database change notification
 
Integration Of Springs Framework In Hibernates
Integration Of Springs Framework In HibernatesIntegration Of Springs Framework In Hibernates
Integration Of Springs Framework In Hibernates
 
Integration Of Springs Framework In Hibernates
Integration Of Springs Framework In HibernatesIntegration Of Springs Framework In Hibernates
Integration Of Springs Framework In Hibernates
 
Understanding backbonejs
Understanding backbonejsUnderstanding backbonejs
Understanding backbonejs
 
Hibernate
HibernateHibernate
Hibernate
 
jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginners
 
jrubykaigi2010-lt-rubeus
jrubykaigi2010-lt-rubeusjrubykaigi2010-lt-rubeus
jrubykaigi2010-lt-rubeus
 
How to execute an oracle stored procedure with nested table as a parameter fr...
How to execute an oracle stored procedure with nested table as a parameter fr...How to execute an oracle stored procedure with nested table as a parameter fr...
How to execute an oracle stored procedure with nested table as a parameter fr...
 
Java7 New Features and Code Examples
Java7 New Features and Code ExamplesJava7 New Features and Code Examples
Java7 New Features and Code Examples
 

Configure Spring Batch Infrastructure

  • 1. Collection<ClassActionReportBean> data = new ArrayList<ClassActionReportBean>(); Iterator<HashMap<String, Object>> iter = records.iterator(); while(iter.hasNext()) { HashMap<String, Object> record = iter.next(); ClassActionReportBean bean = new ClassActionReportBean(); ……………………………………………………………………………………………………………………………………………………………….. …………………………………………………………………………. data.add(bean);
  • 2.
  • 3.
  • 4.  <bean id="loggingAdvice" class="ca.cgi.mvest.springframework.logging.LoggingAdvisor"> </bean> <bean id="theLogger" class="org.springframework.aop.support.RegexpMethodPointcutAdvisor" > <property name="advice"> <ref local="loggingAdvice"></ref> </property> <property name="patterns"> <list> <value>.*execute</value> <value>.*beforeStep</value> <value>.*afterStep</value> <value>.*create</value> <value>.*update</value> <value>.*read</value> <value>.*process</value> <value>.*write</value> </list> </property> </bean> </beans>
  • 5.  <bean id="environmentBean" class="ca.cgi.mvest.springframework.main.EnvironmentBean">  <property name="client" value="${client}" />  <property name="ahsPageFlag" value="${AHS_PAGE}" />  <property name="criticalDir" value="${CRITICAL}" />  <property name="environment" value="${env}" />  <property name="dbSchema" value="${hibernate.default_schema}" />  <property name="dbUser" value="${hibernate.connection.username}" />  <property name="dbPassword" value="${hibernate.connection.password}" />
  • 6.  <property name="dbConnection" value="${hibernate.connection.url}" />  <property name="minPoolSize" value="${hibernate.c3p0.min_size}" />  <property name="maxPoolSize" value="${hibernate.c3p0.max_size}" />  <property name="connectionTimeOut" value="${hibernate.c3p0.timeout}" />  <property name="schedulerUrl" value="${quartz.scheduler.url}" />  <property name="comDir" value="${COM}" />  <property name="iffilesDir" value="${IFFILES}" />  <property name="fundataDir" value="${FUNDATA}" />  <property name="mprootDir" value="${MP_ROOT}" />  <property name="mptmpDir" value="${mptmp.dir}" />  <property name="pricingDir" value="${PRICING}" />  <property name="prodEnvFlag" value="${PRODENV}" />  <property name="xferDir" value="${XFER}" />  <property name="path" value="${PATH}" />  <property name="oracleHome" value="${ORACLE_HOME}" />  <property name="oracleTwoTask" value="${TWO_TASK}" />  <property name="sftpKeyPath" value="${sftp.key.filepath}" /> </bean> <aop:config> <aop:pointcut id="jobLauncherTxOperation" expression="execution(* ca.cgi.mvest.springframework.main.IJobLauncher.*(..))"></aop:pointcut> <aop:pointcut id="defaultTxOperation" expression="execution(* ca.cgi.mvest.springframework.wms.*.*(..))"></aop:pointcut> <aop:pointcut id="webTxOperation" expression="execution(* ca.cgi.mvest.web.admin.*.*(..))"></aop:pointcut>  In order to run Spring Batch, we need to configure SpringBatch infrastructure.This includes creation of JobRepository, JobLauncher and TransactionManager.  For each job, we need a separate xml context definition file. However, there is a number of common objects that we will need recurrently.
  • 7.  JOB REPOSITORY:  JOB LAUNCHER:  MvestJobLauncher(class):   IJobLauncher(interface):It will contain the methods in the MVestJobLauncher.java file  The jobLauncher as defined in the “app-config.xml” in the batch of MVest clearly has a bean definition as: <bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher"> <property name="jobRepository" ref="jobRepository" /> </bean> <bean id="jobRegistry" class="org.springframework.batch.core.configu ration.support.MapJobRegistry" />// 
  • 8. <bean id="jobOperator" class="org.springframework.batch.core.launch. support.SimpleJobOperator"> <property name="jobExplorer"> <bean class="org.springframework.batch.core.explore.support.JobExplorerFactoryBean"> <property name="dataSource" ref="dataSource" /> </bean> </property> <property name="jobRepository" ref="jobRepository"></property> <property name="jobRegistry" ref="jobRegistry"></property> <property name="jobLauncher" ref="jobLauncher"></property> </bean> <bean id="mvestJobLauncher" class="ca.cgi.mvest.springframework.main.MVestJobLauncher" scope="prototype"> <property name="jobLauncher" ref="jobLauncher"></property> <property name="reportingBean" ref="reportingBean"></property> <property name="sf" ref="sessionFactory"></property> <property name="dataSource" ref="dataSource"></property> </bean> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" > <property name="driverClassName" value="${hibernate.connection.driver_class}" /> <property name="url" value="${hibernate.connection.url}" /> <property name="username" value="${hibernate.connection.username}" /> <property name="password" value="${hibernate.connection.password}" /> </bean>  TRANSACTION MANAGER: <tx:advice id="jobLauncherTxAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="preJob" propagation="REQUIRES_NEW" /> <tx:method name="runJob" read-only="false" propagation="SUPPORTS" rollback-for="Exception, RuntimeException" /> <tx:method name="postJob" propagation="REQUIRES_NEW" />
  • 9. <tx:method name="handlePrinter" propagation="MANDATORY" /> <tx:method name="update*" propagation="MANDATORY" /> <tx:method name="handleRollback*" propagation="REQUIRES_NEW" /> <tx:method name="setJobNumber" propagation="NEVER" /> <tx:method name="setJobRequest" propagation="NEVER" /> <tx:method name="cleanup" propagation="NEVER" /> <tx:method name="sendMail" propagation="NEVER" /> <tx:method name="*" propagation="MANDATORY" /> </tx:attributes> </tx:advice>