List of usage examples for org.springframework.batch.core JobParameters JobParameters
public JobParameters()
From source file:org.devware.batch.main.Launcher.java
public static void main(String arg[]) { String[] springConfig = { "org/devware/config/context/readerConfig.xml", "org/devware/config/context/writerConfig.xml", "org/devware/config/context/processorConfig.xml", "org/devware/config/datasource/datasource.xml" }; ApplicationContext context = new ClassPathXmlApplicationContext(springConfig); JobLauncher jobLauncher = (JobLauncher) context.getBean("jobLauncher"); Job job = (Job) context.getBean("ExcelReaderJob"); try {//from ww w. ja v a2s . com JobExecution execution = jobLauncher.run(job, new JobParameters()); System.out.println("Exit Status : " + execution.getStatus()); } catch (Exception e) { // e.printStackTrace(); } System.out.println("Done"); }
From source file:com.mkyong.AppJobAllExport.java
/** * @param args the command line arguments *///www . j ava 2 s. c om public static void main(String[] args) { fLogger.log(Level.INFO, "Export all csv to mysql"); String[] springConfig = { "spring/batch/config/database.xml", "spring/batch/config/context.xml", "spring/batch/jobs/csvexport/job-all-export.xml" }; ApplicationContext context = new ClassPathXmlApplicationContext(springConfig); JobLauncher jobLauncher = (JobLauncher) context.getBean("jobLauncher"); Job job = (Job) context.getBean("exportJob"); try { JobExecution execution = jobLauncher.run(job, new JobParameters()); fLogger.log(Level.INFO, "Exit Status : {0}", execution.getStatus()); } catch (JobParametersInvalidException e) { e.getMessage(); } catch (JobExecutionAlreadyRunningException e) { e.getMessage(); } catch (JobInstanceAlreadyCompleteException e) { e.getMessage(); } catch (JobRestartException e) { e.getMessage(); } fLogger.log(Level.INFO, "Done"); }
From source file:com.mkyong.AppJobAllImport.java
/** * @param args the command line arguments *//*from w w w . j a v a 2s. c om*/ public static void main(String[] args) { fLogger.log(Level.INFO, "Import all csv to mysql"); String[] springConfig = { "spring/batch/config/database.xml", "spring/batch/config/context.xml", "spring/batch/jobs/csvimport/job-all-import.xml" }; ApplicationContext context = new ClassPathXmlApplicationContext(springConfig); JobLauncher jobLauncher = (JobLauncher) context.getBean("jobLauncher"); Job job = (Job) context.getBean("importJob"); try { JobExecution execution = jobLauncher.run(job, new JobParameters()); fLogger.log(Level.INFO, "Exit Status : {0}", execution.getStatus()); } catch (JobParametersInvalidException e) { e.getMessage(); } catch (JobExecutionAlreadyRunningException e) { e.getMessage(); } catch (JobInstanceAlreadyCompleteException e) { e.getMessage(); } catch (JobRestartException e) { e.getMessage(); } fLogger.log(Level.INFO, "Done"); }
From source file:pl.mariuszczarny.springbatchforslask.main.AppJobAllImport.java
/** * @param args the command line arguments *///w w w .j ava 2 s .c o m public static void main(String[] args) { fLogger.log(Level.INFO, "Import all csv to mysql"); String[] springConfig = { "spring/batch/config/database.xml", "spring/batch/config/context.xml", "spring/batch/jobs/job-all-import.xml" }; ApplicationContext context = new ClassPathXmlApplicationContext(springConfig); JobLauncher jobLauncher = (JobLauncher) context.getBean("jobLauncher"); Job job = (Job) context.getBean("importJob"); try { JobExecution execution = jobLauncher.run(job, new JobParameters()); fLogger.log(Level.INFO, "Exit Status : {0}", execution.getStatus()); } catch (JobParametersInvalidException e) { e.getMessage(); } catch (JobExecutionAlreadyRunningException e) { e.getMessage(); } catch (JobInstanceAlreadyCompleteException e) { e.getMessage(); } catch (JobRestartException e) { e.getMessage(); } fLogger.log(Level.INFO, "Done"); }
From source file:com.mkyong.AppJobCityImport.java
/** * @param args the command line arguments *//* w w w .j a v a 2 s. co m*/ public static void main(String[] args) { fLogger.log(Level.INFO, "Import city csv from mysql"); String[] springConfig = { "spring/batch/config/database.xml", "spring/batch/config/context.xml", "spring/batch/jobs/csvimport/job-city-import.xml" }; ApplicationContext context = new ClassPathXmlApplicationContext(springConfig); JobLauncher jobCityLauncher = (JobLauncher) context.getBean("jobLauncher"); Job cityJob = (Job) context.getBean("cityImportJob"); try { JobExecution execution = jobCityLauncher.run(cityJob, new JobParameters()); fLogger.log(Level.INFO, "Exit Status : {0}", execution.getStatus()); } catch (JobParametersInvalidException e) { e.getMessage(); } catch (JobExecutionAlreadyRunningException e) { e.getMessage(); } catch (JobInstanceAlreadyCompleteException e) { e.getMessage(); } catch (JobRestartException e) { e.getMessage(); } fLogger.log(Level.INFO, "Done"); }
From source file:com.mkyong.AppJobReportImport.java
/** * @param args the command line arguments *//* w w w .j a v a 2 s . c o m*/ public static void main(String[] args) { fLogger.log(Level.INFO, "Import report csv from mysql"); String[] springConfig = { "spring/batch/config/database.xml", "spring/batch/config/context.xml", "spring/batch/jobs/csvimport/job-report-import.xml" }; ApplicationContext context = new ClassPathXmlApplicationContext(springConfig); JobLauncher jobCityLauncher = (JobLauncher) context.getBean("jobLauncher"); Job reportJob = (Job) context.getBean("reportImportJob"); try { JobExecution execution = jobCityLauncher.run(reportJob, new JobParameters()); fLogger.log(Level.INFO, "Exit Status : {0}", execution.getStatus()); } catch (JobParametersInvalidException e) { e.getMessage(); } catch (JobExecutionAlreadyRunningException e) { e.getMessage(); } catch (JobInstanceAlreadyCompleteException e) { e.getMessage(); } catch (JobRestartException e) { e.getMessage(); } fLogger.log(Level.INFO, "Done"); }
From source file:pl.mariuszczarny.springbatchforslask.main.fromdb.ClubImport.java
/** * @param args the command line arguments *//*w ww . j av a2s.c o m*/ public static void main(String[] args) { fLogger.log(Level.INFO, "Import club csv from mysql"); String[] springConfig = { "spring/batch/config/database.xml", "spring/batch/config/context.xml", "spring/batch/jobs/fromdb/club.xml" }; ApplicationContext context = new ClassPathXmlApplicationContext(springConfig); JobLauncher jobCityLauncher = (JobLauncher) context.getBean("jobLauncher"); Job clubJob = (Job) context.getBean("clubImportJob"); try { JobExecution execution = jobCityLauncher.run(clubJob, new JobParameters()); fLogger.log(Level.INFO, "Exit Status : {0}", execution.getStatus()); } catch (JobParametersInvalidException e) { e.getMessage(); } catch (JobExecutionAlreadyRunningException e) { e.getMessage(); } catch (JobInstanceAlreadyCompleteException e) { e.getMessage(); } catch (JobRestartException e) { e.getMessage(); } fLogger.log(Level.INFO, "Done"); }
From source file:pl.mariuszczarny.springbatchforslask.main.fromcsv.ArrangeExport.java
/** * @param args the command line arguments *///from www . ja va 2 s. co m public static void main(String[] args) { fLogger.log(Level.INFO, "Import city csv from mysql"); String[] springConfig = { "spring/batch/config/database.xml", "spring/batch/config/context.xml", "spring/batch/jobs/fromdb/city.xml" }; ApplicationContext context = new ClassPathXmlApplicationContext(springConfig); JobLauncher jobCityLauncher = (JobLauncher) context.getBean("jobLauncher"); Job cityJob = (Job) context.getBean("cityImportJob"); try { JobExecution execution = jobCityLauncher.run(cityJob, new JobParameters()); fLogger.log(Level.INFO, "Exit Status : {0}", execution.getStatus()); } catch (JobParametersInvalidException e) { e.getMessage(); } catch (JobExecutionAlreadyRunningException e) { e.getMessage(); } catch (JobInstanceAlreadyCompleteException e) { e.getMessage(); } catch (JobRestartException e) { e.getMessage(); } fLogger.log(Level.INFO, "Done"); }
From source file:pl.mariuszczarny.springbatchforslask.main.fromdb.CoachImport.java
/** * @param args the command line arguments *//*from w ww . j a v a 2 s .c om*/ public static void main(String[] args) { fLogger.log(Level.INFO, "Import coach csv from mysql"); String[] springConfig = { "spring/batch/config/database.xml", "spring/batch/config/context.xml", "spring/batch/jobs/fromdb/coach.xml" }; ApplicationContext context = new ClassPathXmlApplicationContext(springConfig); JobLauncher jobCoachLauncher = (JobLauncher) context.getBean("jobLauncher"); Job coachJob = (Job) context.getBean("coachImportJob"); try { JobExecution execution = jobCoachLauncher.run(coachJob, new JobParameters()); fLogger.log(Level.INFO, "Exit Status : {0}", execution.getStatus()); } catch (JobParametersInvalidException e) { e.getMessage(); } catch (JobExecutionAlreadyRunningException e) { e.getMessage(); } catch (JobInstanceAlreadyCompleteException e) { e.getMessage(); } catch (JobRestartException e) { e.getMessage(); } fLogger.log(Level.INFO, "Done"); }
From source file:pl.mariuszczarny.springbatchforslask.main.fromdb.StaffImport.java
/** * @param args the command line arguments *//*from w w w. j a va 2 s .c o m*/ public static void main(String[] args) { fLogger.log(Level.INFO, "Import staff csv from mysql"); String[] springConfig = { "spring/batch/config/database.xml", "spring/batch/config/context.xml", "spring/batch/jobs/fromdb/staff.xml" }; ApplicationContext context = new ClassPathXmlApplicationContext(springConfig); JobLauncher jobStaffLauncher = (JobLauncher) context.getBean("jobLauncher"); Job staffJob = (Job) context.getBean("staffImportJob"); try { JobExecution execution = jobStaffLauncher.run(staffJob, new JobParameters()); fLogger.log(Level.INFO, "Exit Status : {0}", execution.getStatus()); } catch (JobParametersInvalidException e) { e.getMessage(); } catch (JobExecutionAlreadyRunningException e) { e.getMessage(); } catch (JobInstanceAlreadyCompleteException e) { e.getMessage(); } catch (JobRestartException e) { e.getMessage(); } fLogger.log(Level.INFO, "Done"); }