/* * de.superx.etl - a package for controlling ETL routines * Copyright (C) 2021 Daniel Quathamer * * This package is licensed under the CampusSource License; * http://www.campussource.de/org/license/ */ package de.superx.elt.bin; import java.sql.Connection; import de.superx.elt.EtlActionJob; import de.superx.elt.EtlUtils; import de.superx.elt.util.GetOpts; public class EtlJobExecutor { public EtlJobExecutor() { // TODO Auto-generated constructor stub } public static void main(String[] args) { String usage="usage: java de.superx.elt.bin.EtlJobExecutor -dbproperties:$DB_PROPERTIES -job:abc -params:TID=16000 (optional) -outfile:Ausgabedatei (optional)" ; GetOpts.setOpts(args); String isdrin = GetOpts.isAllRequiredOptionsPresent("-dbproperties,-job"); if (isdrin != null) { System.err.println(usage); System.exit(1); } int returnCode=0; String dbpropfile = GetOpts.getValue("-dbproperties"); String job = GetOpts.getValue("-job"); String params =null; if (GetOpts.isPresent("-params")) params=GetOpts.getValue("-params"); if(!(params==null)) params=de.memtext.util.StringUtils.replace(params, ",", EtlUtils.NEWLINE); String outfile=null; if (GetOpts.isPresent("-outfile")) outfile=GetOpts.getValue("-outfile"); //System.out.println("param:"+params); EtlActionJob myJob=new EtlActionJob(job,"",dbpropfile); //TODO:Mandantid try { myJob.initJob(job,params); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); System.err.println(myJob.getLogoutput()); System.exit(1); } System.out.println("Job "+ job+" initialized"); try { returnCode= myJob.execute(outfile); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); System.err.println(myJob.getLogoutput()); System.exit(1); } System.out.println("Job "+ job+" executed in " +myJob.getDuration()+" Sec."); System.exit(returnCode); } }