package com.mgreau.tennistour.batch;

import java.util.logging.Level;
import java.util.logging.Logger;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import javax.batch.operations.JobOperator;
import javax.batch.runtime.BatchRuntime;
import javax.ejb.Schedule;
import javax.ejb.Singleton;
import javax.ejb.Startup;
import javax.ejb.TimerService;

@Startup
@Singleton
public class StarterServiceJobs {
    /* Use the container's timer service */
    @Resource TimerService tservice;
    
    JobOperator jo;
    
    private static final Logger logger = Logger.getLogger("StarterServiceJobs");
    
    @PostConstruct
    public void init() {
        logger.log(Level.INFO, "Initializing Batch APP.");
        jo = BatchRuntime.getJobOperator();
    }
    
    @Schedule(second="*/30", minute="*",hour="*", persistent=false)
    public void loadHistoryDatas() {
    	 //long jid = jo.start("loadHistoryJob", new Properties());
    	 
    	 //JobExecution je = jo.getJobExecution(jid);
    	 //logger.log(Level.INFO, "Job created on: " + je.getCreateTime() + "<br>");
    	 //logger.log(Level.INFO, "Job started on: " + je.getStartTime() + "<br>");
    }
    
}

@@ -31,16 +31,45 @@
 batch;%0A%0A
+import java.util.Properties;%0A
 import j
@@ -283,16 +283,57 @@
 untime;%0A
+import javax.batch.runtime.JobExecution;%0A
 import j
@@ -934,23 +934,16 @@
 oid load
-History
 Datas() 
@@ -943,25 +943,155 @@
 atas() %7B
+%0A        final Properties props = new Properties();%0A        props.put(%22csvDatasFileName%22,%0A                  %22ausopen_ATP_2013.csv%22);
 %0A    %09 
-//
 long jid
@@ -1120,32 +1120,21 @@
 ryJob%22, 
-new Properties()
+props
 );%0A    %09
@@ -1141,18 +1141,16 @@
  %0A    %09 
-//
 JobExecu
@@ -1182,34 +1182,32 @@
 ion(jid);%0A    %09 
-//
 logger.log(Level
@@ -1274,10 +1274,8 @@
   %09 
-//
 logg

Load datas at startup