List of usage examples for java.lang Runtime exec
public Process exec(String cmdarray[]) throws IOException
From source file:talonetl.getproperties_0_4.getProperties.java
public void tRunJob_2Process(final java.util.Map<String, Object> globalMap) throws TalendException { globalMap.put("tRunJob_2_SUBPROCESS_STATE", 0); final boolean execStat = this.execStat; String iterateId = ""; int iterateLoop = 0; String currentComponent = ""; try {/*w w w. ja v a2 s.com*/ String currentMethodName = new Exception().getStackTrace()[0].getMethodName(); boolean resumeIt = currentMethodName.equals(resumeEntryMethodName); if (resumeEntryMethodName == null || resumeIt || globalResumeTicket) {// start // the // resume globalResumeTicket = true; /** * [tRunJob_2 begin ] start */ ok_Hash.put("tRunJob_2", false); start_Hash.put("tRunJob_2", System.currentTimeMillis()); currentComponent = "tRunJob_2"; int tos_count_tRunJob_2 = 0; class DealChildJobLibrary_tRunJob_2 { public String replaceJarPathsFromCrcMap(String originalClassPathLine) throws Exception { String classPathLine = ""; String crcMapPath = new java.io.File("../crcMap").getCanonicalPath(); if (isNeedAddLibsPath(crcMapPath)) { java.util.Map<String, String> crcMap = null; java.io.ObjectInputStream ois = new ObjectInputStream( new java.io.FileInputStream(crcMapPath)); crcMap = (java.util.Map<String, String>) ois.readObject(); ois.close(); classPathLine = addLibsPath(originalClassPathLine, crcMap); } else { classPathLine = originalClassPathLine; } return classPathLine; } private boolean isNeedAddLibsPath(String crcMapPath) { if (!(new java.io.File(crcMapPath).exists())) {// when // not // use // cache return false; } return true; } private String addLibsPath(String line, java.util.Map<String, String> crcMap) { for (java.util.Map.Entry<String, String> entry : crcMap.entrySet()) { line = adaptLibPaths(line, entry); } return line; } private String adaptLibPaths(String line, java.util.Map.Entry<String, String> entry) { String jarName = entry.getValue(); String crc = entry.getKey(); String libStringFinder = "../lib/" + jarName; if (line.contains(libStringFinder)) { line = line.replace(libStringFinder, "../../../cache/lib/" + crc + "/" + jarName); } else if (line.contains(":$ROOT_PATH/" + jarName + ":")) { line = line.replace(":$ROOT_PATH/" + jarName + ":", ":$ROOT_PATH/../../../cache/lib/" + crc + "/" + jarName + ":"); } else if (line.contains(";" + jarName + ";")) { line = line.replace(";" + jarName + ";", ";../../../cache/lib/" + crc + "/" + jarName + ";"); } return line; } } DealChildJobLibrary_tRunJob_2 dealChildJobLibrary_tRunJob_2 = new DealChildJobLibrary_tRunJob_2(); /** * [tRunJob_2 begin ] stop */ /** * [tRunJob_2 main ] start */ currentComponent = "tRunJob_2"; java.util.List<String> paraList_tRunJob_2 = new java.util.ArrayList<String>(); String osName_tRunJob_2 = System.getProperty("os.name"); if (osName_tRunJob_2 != null && osName_tRunJob_2.toLowerCase().startsWith("win")) { paraList_tRunJob_2.add("java"); paraList_tRunJob_2.add("-Xms256M"); paraList_tRunJob_2.add("-Xmx1024M"); paraList_tRunJob_2.add("-cp"); paraList_tRunJob_2.add(dealChildJobLibrary_tRunJob_2.replaceJarPathsFromCrcMap( "../lib/advancedPersistentLookupLib-1.0.jar;../lib/commons-codec-1.3.jar;../lib/commons-collections-3.2.jar;../lib/commons-httpclient-3.0.1.jar;../lib/commons-logging-1.1.jar;../lib/dom4j-1.6.1.jar;../lib/jboss-serialization.jar;../lib/jcifs-1.3.0.jar;../lib/log4j-1.2.15.jar;../lib/mysql-connector-java-5.1.22-bin.jar;../lib/TalendSAX.jar;../lib/trove.jar;../lib/systemRoutines.jar;../lib/userRoutines.jar;.;loadpropertyimages_0_2.jar;getpropfinacials_0_2.jar;loadfinacialdata_0_1.jar;loadpropertyimages_0_2.jar;")); paraList_tRunJob_2.add("talonetl.loadpropertyimages_0_2.loadPropertyImages"); paraList_tRunJob_2.add("--father_pid=" + pid); paraList_tRunJob_2.add("--root_pid=" + rootPid); paraList_tRunJob_2.add("--father_node=tRunJob_2"); paraList_tRunJob_2.add("--context=Default"); paraList_tRunJob_2.add("%*"); } else { paraList_tRunJob_2.add("java"); paraList_tRunJob_2.add("-Xms256M"); paraList_tRunJob_2.add("-Xmx1024M"); paraList_tRunJob_2.add("-cp"); paraList_tRunJob_2.add(dealChildJobLibrary_tRunJob_2.replaceJarPathsFromCrcMap( "$ROOT_PATH/../lib/advancedPersistentLookupLib-1.0.jar:$ROOT_PATH/../lib/commons-codec-1.3.jar:$ROOT_PATH/../lib/commons-collections-3.2.jar:$ROOT_PATH/../lib/commons-httpclient-3.0.1.jar:$ROOT_PATH/../lib/commons-logging-1.1.jar:$ROOT_PATH/../lib/dom4j-1.6.1.jar:$ROOT_PATH/../lib/jboss-serialization.jar:$ROOT_PATH/../lib/jcifs-1.3.0.jar:$ROOT_PATH/../lib/log4j-1.2.15.jar:$ROOT_PATH/../lib/mysql-connector-java-5.1.22-bin.jar:$ROOT_PATH/../lib/TalendSAX.jar:$ROOT_PATH/../lib/trove.jar:$ROOT_PATH:$ROOT_PATH/../lib/systemRoutines.jar:$ROOT_PATH/../lib/userRoutines.jar::.:$ROOT_PATH/loadpropertyimages_0_2.jar:$ROOT_PATH/getpropfinacials_0_2.jar:$ROOT_PATH/loadfinacialdata_0_1.jar:$ROOT_PATH/loadpropertyimages_0_2.jar:") .replace("$ROOT_PATH", System.getProperty("user.dir"))); paraList_tRunJob_2.add("talonetl.loadpropertyimages_0_2.loadPropertyImages"); paraList_tRunJob_2.add("--father_pid=" + pid); paraList_tRunJob_2.add("--root_pid=" + rootPid); paraList_tRunJob_2.add("--father_node=tRunJob_2"); paraList_tRunJob_2.add("--context=Default"); paraList_tRunJob_2.add("$@"); } // for feature:10589 paraList_tRunJob_2.add("--stat_port=" + null); if (resuming_logs_dir_path != null) { paraList_tRunJob_2.add("--resuming_logs_dir_path=" + resuming_logs_dir_path); } String childResumePath_tRunJob_2 = ResumeUtil.getChildJobCheckPointPath(resuming_checkpoint_path); String tRunJobName_tRunJob_2 = ResumeUtil.getRighttRunJob(resuming_checkpoint_path); if ("tRunJob_2".equals(tRunJobName_tRunJob_2) && childResumePath_tRunJob_2 != null) { paraList_tRunJob_2.add("--resuming_checkpoint_path=" + ResumeUtil.getChildJobCheckPointPath(resuming_checkpoint_path)); } paraList_tRunJob_2.add("--parent_part_launcher=JOB:" + jobName + "/NODE:tRunJob_2"); java.util.Map<String, Object> parentContextMap_tRunJob_2 = new java.util.HashMap<String, Object>(); context.synchronizeContext(); java.util.Enumeration<?> propertyNames_tRunJob_2 = context.propertyNames(); while (propertyNames_tRunJob_2.hasMoreElements()) { String key_tRunJob_2 = (String) propertyNames_tRunJob_2.nextElement(); Object value_tRunJob_2 = (Object) context.get(key_tRunJob_2); paraList_tRunJob_2.add("--context_param " + key_tRunJob_2 + "=" + value_tRunJob_2); } parentContextMap_tRunJob_2.put("propertySourceUri", context.propertySourceUri); parentContextMap_tRunJob_2.put("cusomterName", context.cusomterName); Object obj_tRunJob_2 = null; obj_tRunJob_2 = context.propertySourceUri; paraList_tRunJob_2.add( "--context_param propertySourceUri=" + RuntimeUtils.tRunJobConvertContext(obj_tRunJob_2)); parentContextMap_tRunJob_2.put("propertySourceUri", obj_tRunJob_2); Runtime runtime_tRunJob_2 = Runtime.getRuntime(); final Process ps_tRunJob_2; ps_tRunJob_2 = runtime_tRunJob_2 .exec((String[]) paraList_tRunJob_2.toArray(new String[paraList_tRunJob_2.size()])); Thread normal_tRunJob_2 = new Thread() { public void run() { try { java.io.BufferedReader reader = new java.io.BufferedReader( new java.io.InputStreamReader(ps_tRunJob_2.getInputStream())); String line = ""; try { while ((line = reader.readLine()) != null) { System.out.println(line); } } finally { reader.close(); } } catch (java.io.IOException ioe) { ioe.printStackTrace(); } } }; normal_tRunJob_2.start(); final StringBuffer errorMsg_tRunJob_2 = new StringBuffer(); Thread error_tRunJob_2 = new Thread() { public void run() { try { java.io.BufferedReader reader = new java.io.BufferedReader( new java.io.InputStreamReader(ps_tRunJob_2.getErrorStream())); String line = ""; try { while ((line = reader.readLine()) != null) { errorMsg_tRunJob_2.append(line).append("\n"); } } finally { reader.close(); } } catch (java.io.IOException ioe) { ioe.printStackTrace(); } } }; error_tRunJob_2.start(); // 0 indicates normal termination int result_tRunJob_2 = ps_tRunJob_2.waitFor(); normal_tRunJob_2.join(10000); error_tRunJob_2.join(10000); globalMap.put("tRunJob_2_CHILD_RETURN_CODE", result_tRunJob_2); if (result_tRunJob_2 != 0) { globalMap.put("tRunJob_2_CHILD_EXCEPTION_STACKTRACE", errorMsg_tRunJob_2.toString()); throw new RuntimeException("Child job return " + result_tRunJob_2 + ". It doesn't terminate normally.\n" + errorMsg_tRunJob_2.toString()); } tos_count_tRunJob_2++; /** * [tRunJob_2 main ] stop */ /** * [tRunJob_2 end ] start */ currentComponent = "tRunJob_2"; ok_Hash.put("tRunJob_2", true); end_Hash.put("tRunJob_2", System.currentTimeMillis()); /** * [tRunJob_2 end ] stop */ } // end the resume } catch (Exception e) { throw new TalendException(e, currentComponent, globalMap); } catch (java.lang.Error error) { throw new java.lang.Error(error); } globalMap.put("tRunJob_2_SUBPROCESS_STATE", 1); }
From source file:talonetl.getproperties_0_3.getProperties.java
public void tRunJob_1Process(final java.util.Map<String, Object> globalMap) throws TalendException { globalMap.put("tRunJob_1_SUBPROCESS_STATE", 0); final boolean execStat = this.execStat; String iterateId = ""; int iterateLoop = 0; String currentComponent = ""; try {//from w ww . j a va2s . c om String currentMethodName = new Exception().getStackTrace()[0].getMethodName(); boolean resumeIt = currentMethodName.equals(resumeEntryMethodName); if (resumeEntryMethodName == null || resumeIt || globalResumeTicket) {// start // the // resume globalResumeTicket = true; /** * [tRunJob_1 begin ] start */ ok_Hash.put("tRunJob_1", false); start_Hash.put("tRunJob_1", System.currentTimeMillis()); currentComponent = "tRunJob_1"; int tos_count_tRunJob_1 = 0; class DealChildJobLibrary_tRunJob_1 { public String replaceJarPathsFromCrcMap(String originalClassPathLine) throws Exception { String classPathLine = ""; String crcMapPath = new java.io.File("../crcMap").getCanonicalPath(); if (isNeedAddLibsPath(crcMapPath)) { java.util.Map<String, String> crcMap = null; java.io.ObjectInputStream ois = new ObjectInputStream( new java.io.FileInputStream(crcMapPath)); crcMap = (java.util.Map<String, String>) ois.readObject(); ois.close(); classPathLine = addLibsPath(originalClassPathLine, crcMap); } else { classPathLine = originalClassPathLine; } return classPathLine; } private boolean isNeedAddLibsPath(String crcMapPath) { if (!(new java.io.File(crcMapPath).exists())) {// when // not // use // cache return false; } return true; } private String addLibsPath(String line, java.util.Map<String, String> crcMap) { for (java.util.Map.Entry<String, String> entry : crcMap.entrySet()) { line = adaptLibPaths(line, entry); } return line; } private String adaptLibPaths(String line, java.util.Map.Entry<String, String> entry) { String jarName = entry.getValue(); String crc = entry.getKey(); String libStringFinder = "../lib/" + jarName; if (line.contains(libStringFinder)) { line = line.replace(libStringFinder, "../../../cache/lib/" + crc + "/" + jarName); } else if (line.contains(":$ROOT_PATH/" + jarName + ":")) { line = line.replace(":$ROOT_PATH/" + jarName + ":", ":$ROOT_PATH/../../../cache/lib/" + crc + "/" + jarName + ":"); } else if (line.contains(";" + jarName + ";")) { line = line.replace(";" + jarName + ";", ";../../../cache/lib/" + crc + "/" + jarName + ";"); } return line; } } DealChildJobLibrary_tRunJob_1 dealChildJobLibrary_tRunJob_1 = new DealChildJobLibrary_tRunJob_1(); /** * [tRunJob_1 begin ] stop */ /** * [tRunJob_1 main ] start */ currentComponent = "tRunJob_1"; java.util.List<String> paraList_tRunJob_1 = new java.util.ArrayList<String>(); String osName_tRunJob_1 = System.getProperty("os.name"); if (osName_tRunJob_1 != null && osName_tRunJob_1.toLowerCase().startsWith("win")) { paraList_tRunJob_1.add("java"); paraList_tRunJob_1.add("-Xms256M"); paraList_tRunJob_1.add("-Xmx1024M"); paraList_tRunJob_1.add("-cp"); paraList_tRunJob_1.add(dealChildJobLibrary_tRunJob_1.replaceJarPathsFromCrcMap( "../lib/advancedPersistentLookupLib-1.0.jar;../lib/commons-codec-1.3.jar;../lib/commons-collections-3.2.jar;../lib/commons-httpclient-3.0.1.jar;../lib/commons-logging-1.1.jar;../lib/dom4j-1.6.1.jar;../lib/jboss-serialization.jar;../lib/jcifs-1.3.0.jar;../lib/log4j-1.2.15.jar;../lib/mysql-connector-java-5.1.22-bin.jar;../lib/TalendSAX.jar;../lib/trove.jar;../lib/systemRoutines.jar;../lib/userRoutines.jar;.;getpropfinacials_0_1.jar;getpropfinacials_0_1.jar;loadfinacialdata_0_1.jar;loadpropertyimages_0_1.jar;")); paraList_tRunJob_1.add("talonetl.getpropfinacials_0_1.getPropFinacials"); paraList_tRunJob_1.add("--father_pid=" + pid); paraList_tRunJob_1.add("--root_pid=" + rootPid); paraList_tRunJob_1.add("--father_node=tRunJob_1"); paraList_tRunJob_1.add("--context=Default"); paraList_tRunJob_1.add("%*"); } else { paraList_tRunJob_1.add("java"); paraList_tRunJob_1.add("-Xms256M"); paraList_tRunJob_1.add("-Xmx1024M"); paraList_tRunJob_1.add("-cp"); paraList_tRunJob_1.add(dealChildJobLibrary_tRunJob_1.replaceJarPathsFromCrcMap( "$ROOT_PATH/../lib/advancedPersistentLookupLib-1.0.jar:$ROOT_PATH/../lib/commons-codec-1.3.jar:$ROOT_PATH/../lib/commons-collections-3.2.jar:$ROOT_PATH/../lib/commons-httpclient-3.0.1.jar:$ROOT_PATH/../lib/commons-logging-1.1.jar:$ROOT_PATH/../lib/dom4j-1.6.1.jar:$ROOT_PATH/../lib/jboss-serialization.jar:$ROOT_PATH/../lib/jcifs-1.3.0.jar:$ROOT_PATH/../lib/log4j-1.2.15.jar:$ROOT_PATH/../lib/mysql-connector-java-5.1.22-bin.jar:$ROOT_PATH/../lib/TalendSAX.jar:$ROOT_PATH/../lib/trove.jar:$ROOT_PATH:$ROOT_PATH/../lib/systemRoutines.jar:$ROOT_PATH/../lib/userRoutines.jar::.:$ROOT_PATH/getpropfinacials_0_1.jar:$ROOT_PATH/getpropfinacials_0_1.jar:$ROOT_PATH/loadfinacialdata_0_1.jar:$ROOT_PATH/loadpropertyimages_0_1.jar:") .replace("$ROOT_PATH", System.getProperty("user.dir"))); paraList_tRunJob_1.add("talonetl.getpropfinacials_0_1.getPropFinacials"); paraList_tRunJob_1.add("--father_pid=" + pid); paraList_tRunJob_1.add("--root_pid=" + rootPid); paraList_tRunJob_1.add("--father_node=tRunJob_1"); paraList_tRunJob_1.add("--context=Default"); paraList_tRunJob_1.add("$@"); } // for feature:10589 paraList_tRunJob_1.add("--stat_port=" + null); if (resuming_logs_dir_path != null) { paraList_tRunJob_1.add("--resuming_logs_dir_path=" + resuming_logs_dir_path); } String childResumePath_tRunJob_1 = ResumeUtil.getChildJobCheckPointPath(resuming_checkpoint_path); String tRunJobName_tRunJob_1 = ResumeUtil.getRighttRunJob(resuming_checkpoint_path); if ("tRunJob_1".equals(tRunJobName_tRunJob_1) && childResumePath_tRunJob_1 != null) { paraList_tRunJob_1.add("--resuming_checkpoint_path=" + ResumeUtil.getChildJobCheckPointPath(resuming_checkpoint_path)); } paraList_tRunJob_1.add("--parent_part_launcher=JOB:" + jobName + "/NODE:tRunJob_1"); java.util.Map<String, Object> parentContextMap_tRunJob_1 = new java.util.HashMap<String, Object>(); context.synchronizeContext(); java.util.Enumeration<?> propertyNames_tRunJob_1 = context.propertyNames(); while (propertyNames_tRunJob_1.hasMoreElements()) { String key_tRunJob_1 = (String) propertyNames_tRunJob_1.nextElement(); Object value_tRunJob_1 = (Object) context.get(key_tRunJob_1); paraList_tRunJob_1.add("--context_param " + key_tRunJob_1 + "=" + value_tRunJob_1); } parentContextMap_tRunJob_1.put("propertySourceUri", context.propertySourceUri); parentContextMap_tRunJob_1.put("cusomterName", context.cusomterName); Object obj_tRunJob_1 = null; obj_tRunJob_1 = context.propertySourceUri; paraList_tRunJob_1.add( "--context_param propertySourceUri=" + RuntimeUtils.tRunJobConvertContext(obj_tRunJob_1)); parentContextMap_tRunJob_1.put("propertySourceUri", obj_tRunJob_1); Runtime runtime_tRunJob_1 = Runtime.getRuntime(); final Process ps_tRunJob_1; ps_tRunJob_1 = runtime_tRunJob_1 .exec((String[]) paraList_tRunJob_1.toArray(new String[paraList_tRunJob_1.size()])); Thread normal_tRunJob_1 = new Thread() { public void run() { try { java.io.BufferedReader reader = new java.io.BufferedReader( new java.io.InputStreamReader(ps_tRunJob_1.getInputStream())); String line = ""; try { while ((line = reader.readLine()) != null) { System.out.println(line); } } finally { reader.close(); } } catch (java.io.IOException ioe) { ioe.printStackTrace(); } } }; normal_tRunJob_1.start(); final StringBuffer errorMsg_tRunJob_1 = new StringBuffer(); Thread error_tRunJob_1 = new Thread() { public void run() { try { java.io.BufferedReader reader = new java.io.BufferedReader( new java.io.InputStreamReader(ps_tRunJob_1.getErrorStream())); String line = ""; try { while ((line = reader.readLine()) != null) { errorMsg_tRunJob_1.append(line).append("\n"); } } finally { reader.close(); } } catch (java.io.IOException ioe) { ioe.printStackTrace(); } } }; error_tRunJob_1.start(); // 0 indicates normal termination int result_tRunJob_1 = ps_tRunJob_1.waitFor(); normal_tRunJob_1.join(10000); error_tRunJob_1.join(10000); globalMap.put("tRunJob_1_CHILD_RETURN_CODE", result_tRunJob_1); if (result_tRunJob_1 != 0) { globalMap.put("tRunJob_1_CHILD_EXCEPTION_STACKTRACE", errorMsg_tRunJob_1.toString()); throw new RuntimeException("Child job return " + result_tRunJob_1 + ". It doesn't terminate normally.\n" + errorMsg_tRunJob_1.toString()); } tos_count_tRunJob_1++; /** * [tRunJob_1 main ] stop */ /** * [tRunJob_1 end ] start */ currentComponent = "tRunJob_1"; ok_Hash.put("tRunJob_1", true); end_Hash.put("tRunJob_1", System.currentTimeMillis()); /** * [tRunJob_1 end ] stop */ } // end the resume if (resumeEntryMethodName == null || globalResumeTicket) { resumeUtil.addLog("CHECKPOINT", "CONNECTION:SUBJOB_OK:tRunJob_1:OnSubjobOk", "", Thread.currentThread().getId() + "", "", "", "", "", ""); } tRunJob_2Process(globalMap); } catch (Exception e) { throw new TalendException(e, currentComponent, globalMap); } catch (java.lang.Error error) { throw new java.lang.Error(error); } globalMap.put("tRunJob_1_SUBPROCESS_STATE", 1); }
From source file:talonetl.getproperties_0_4.getProperties.java
public void tRunJob_1Process(final java.util.Map<String, Object> globalMap) throws TalendException { globalMap.put("tRunJob_1_SUBPROCESS_STATE", 0); final boolean execStat = this.execStat; String iterateId = ""; int iterateLoop = 0; String currentComponent = ""; try {/*w w w . j a va 2s . c o m*/ String currentMethodName = new Exception().getStackTrace()[0].getMethodName(); boolean resumeIt = currentMethodName.equals(resumeEntryMethodName); if (resumeEntryMethodName == null || resumeIt || globalResumeTicket) {// start // the // resume globalResumeTicket = true; /** * [tRunJob_1 begin ] start */ ok_Hash.put("tRunJob_1", false); start_Hash.put("tRunJob_1", System.currentTimeMillis()); currentComponent = "tRunJob_1"; int tos_count_tRunJob_1 = 0; class DealChildJobLibrary_tRunJob_1 { public String replaceJarPathsFromCrcMap(String originalClassPathLine) throws Exception { String classPathLine = ""; String crcMapPath = new java.io.File("../crcMap").getCanonicalPath(); if (isNeedAddLibsPath(crcMapPath)) { java.util.Map<String, String> crcMap = null; java.io.ObjectInputStream ois = new ObjectInputStream( new java.io.FileInputStream(crcMapPath)); crcMap = (java.util.Map<String, String>) ois.readObject(); ois.close(); classPathLine = addLibsPath(originalClassPathLine, crcMap); } else { classPathLine = originalClassPathLine; } return classPathLine; } private boolean isNeedAddLibsPath(String crcMapPath) { if (!(new java.io.File(crcMapPath).exists())) {// when // not // use // cache return false; } return true; } private String addLibsPath(String line, java.util.Map<String, String> crcMap) { for (java.util.Map.Entry<String, String> entry : crcMap.entrySet()) { line = adaptLibPaths(line, entry); } return line; } private String adaptLibPaths(String line, java.util.Map.Entry<String, String> entry) { String jarName = entry.getValue(); String crc = entry.getKey(); String libStringFinder = "../lib/" + jarName; if (line.contains(libStringFinder)) { line = line.replace(libStringFinder, "../../../cache/lib/" + crc + "/" + jarName); } else if (line.contains(":$ROOT_PATH/" + jarName + ":")) { line = line.replace(":$ROOT_PATH/" + jarName + ":", ":$ROOT_PATH/../../../cache/lib/" + crc + "/" + jarName + ":"); } else if (line.contains(";" + jarName + ";")) { line = line.replace(";" + jarName + ";", ";../../../cache/lib/" + crc + "/" + jarName + ";"); } return line; } } DealChildJobLibrary_tRunJob_1 dealChildJobLibrary_tRunJob_1 = new DealChildJobLibrary_tRunJob_1(); /** * [tRunJob_1 begin ] stop */ /** * [tRunJob_1 main ] start */ currentComponent = "tRunJob_1"; java.util.List<String> paraList_tRunJob_1 = new java.util.ArrayList<String>(); String osName_tRunJob_1 = System.getProperty("os.name"); if (osName_tRunJob_1 != null && osName_tRunJob_1.toLowerCase().startsWith("win")) { paraList_tRunJob_1.add("java"); paraList_tRunJob_1.add("-Xms256M"); paraList_tRunJob_1.add("-Xmx1024M"); paraList_tRunJob_1.add("-cp"); paraList_tRunJob_1.add(dealChildJobLibrary_tRunJob_1.replaceJarPathsFromCrcMap( "../lib/advancedPersistentLookupLib-1.0.jar;../lib/commons-codec-1.3.jar;../lib/commons-collections-3.2.jar;../lib/commons-httpclient-3.0.1.jar;../lib/commons-logging-1.1.jar;../lib/dom4j-1.6.1.jar;../lib/jboss-serialization.jar;../lib/jcifs-1.3.0.jar;../lib/log4j-1.2.15.jar;../lib/mysql-connector-java-5.1.22-bin.jar;../lib/TalendSAX.jar;../lib/trove.jar;../lib/systemRoutines.jar;../lib/userRoutines.jar;.;getpropfinacials_0_2.jar;getpropfinacials_0_2.jar;loadfinacialdata_0_1.jar;loadpropertyimages_0_2.jar;")); paraList_tRunJob_1.add("talonetl.getpropfinacials_0_2.getPropFinacials"); paraList_tRunJob_1.add("--father_pid=" + pid); paraList_tRunJob_1.add("--root_pid=" + rootPid); paraList_tRunJob_1.add("--father_node=tRunJob_1"); paraList_tRunJob_1.add("--context=Default"); paraList_tRunJob_1.add("%*"); } else { paraList_tRunJob_1.add("java"); paraList_tRunJob_1.add("-Xms256M"); paraList_tRunJob_1.add("-Xmx1024M"); paraList_tRunJob_1.add("-cp"); paraList_tRunJob_1.add(dealChildJobLibrary_tRunJob_1.replaceJarPathsFromCrcMap( "$ROOT_PATH/../lib/advancedPersistentLookupLib-1.0.jar:$ROOT_PATH/../lib/commons-codec-1.3.jar:$ROOT_PATH/../lib/commons-collections-3.2.jar:$ROOT_PATH/../lib/commons-httpclient-3.0.1.jar:$ROOT_PATH/../lib/commons-logging-1.1.jar:$ROOT_PATH/../lib/dom4j-1.6.1.jar:$ROOT_PATH/../lib/jboss-serialization.jar:$ROOT_PATH/../lib/jcifs-1.3.0.jar:$ROOT_PATH/../lib/log4j-1.2.15.jar:$ROOT_PATH/../lib/mysql-connector-java-5.1.22-bin.jar:$ROOT_PATH/../lib/TalendSAX.jar:$ROOT_PATH/../lib/trove.jar:$ROOT_PATH:$ROOT_PATH/../lib/systemRoutines.jar:$ROOT_PATH/../lib/userRoutines.jar::.:$ROOT_PATH/getpropfinacials_0_2.jar:$ROOT_PATH/getpropfinacials_0_2.jar:$ROOT_PATH/loadfinacialdata_0_1.jar:$ROOT_PATH/loadpropertyimages_0_2.jar:") .replace("$ROOT_PATH", System.getProperty("user.dir"))); paraList_tRunJob_1.add("talonetl.getpropfinacials_0_2.getPropFinacials"); paraList_tRunJob_1.add("--father_pid=" + pid); paraList_tRunJob_1.add("--root_pid=" + rootPid); paraList_tRunJob_1.add("--father_node=tRunJob_1"); paraList_tRunJob_1.add("--context=Default"); paraList_tRunJob_1.add("$@"); } // for feature:10589 paraList_tRunJob_1.add("--stat_port=" + null); if (resuming_logs_dir_path != null) { paraList_tRunJob_1.add("--resuming_logs_dir_path=" + resuming_logs_dir_path); } String childResumePath_tRunJob_1 = ResumeUtil.getChildJobCheckPointPath(resuming_checkpoint_path); String tRunJobName_tRunJob_1 = ResumeUtil.getRighttRunJob(resuming_checkpoint_path); if ("tRunJob_1".equals(tRunJobName_tRunJob_1) && childResumePath_tRunJob_1 != null) { paraList_tRunJob_1.add("--resuming_checkpoint_path=" + ResumeUtil.getChildJobCheckPointPath(resuming_checkpoint_path)); } paraList_tRunJob_1.add("--parent_part_launcher=JOB:" + jobName + "/NODE:tRunJob_1"); java.util.Map<String, Object> parentContextMap_tRunJob_1 = new java.util.HashMap<String, Object>(); context.synchronizeContext(); java.util.Enumeration<?> propertyNames_tRunJob_1 = context.propertyNames(); while (propertyNames_tRunJob_1.hasMoreElements()) { String key_tRunJob_1 = (String) propertyNames_tRunJob_1.nextElement(); Object value_tRunJob_1 = (Object) context.get(key_tRunJob_1); paraList_tRunJob_1.add("--context_param " + key_tRunJob_1 + "=" + value_tRunJob_1); } parentContextMap_tRunJob_1.put("propertySourceUri", context.propertySourceUri); parentContextMap_tRunJob_1.put("cusomterName", context.cusomterName); Object obj_tRunJob_1 = null; obj_tRunJob_1 = context.propertySourceUri; paraList_tRunJob_1.add( "--context_param propertySourceUri=" + RuntimeUtils.tRunJobConvertContext(obj_tRunJob_1)); parentContextMap_tRunJob_1.put("propertySourceUri", obj_tRunJob_1); Runtime runtime_tRunJob_1 = Runtime.getRuntime(); final Process ps_tRunJob_1; ps_tRunJob_1 = runtime_tRunJob_1 .exec((String[]) paraList_tRunJob_1.toArray(new String[paraList_tRunJob_1.size()])); Thread normal_tRunJob_1 = new Thread() { public void run() { try { java.io.BufferedReader reader = new java.io.BufferedReader( new java.io.InputStreamReader(ps_tRunJob_1.getInputStream())); String line = ""; try { while ((line = reader.readLine()) != null) { System.out.println(line); } } finally { reader.close(); } } catch (java.io.IOException ioe) { ioe.printStackTrace(); } } }; normal_tRunJob_1.start(); final StringBuffer errorMsg_tRunJob_1 = new StringBuffer(); Thread error_tRunJob_1 = new Thread() { public void run() { try { java.io.BufferedReader reader = new java.io.BufferedReader( new java.io.InputStreamReader(ps_tRunJob_1.getErrorStream())); String line = ""; try { while ((line = reader.readLine()) != null) { errorMsg_tRunJob_1.append(line).append("\n"); } } finally { reader.close(); } } catch (java.io.IOException ioe) { ioe.printStackTrace(); } } }; error_tRunJob_1.start(); // 0 indicates normal termination int result_tRunJob_1 = ps_tRunJob_1.waitFor(); normal_tRunJob_1.join(10000); error_tRunJob_1.join(10000); globalMap.put("tRunJob_1_CHILD_RETURN_CODE", result_tRunJob_1); if (result_tRunJob_1 != 0) { globalMap.put("tRunJob_1_CHILD_EXCEPTION_STACKTRACE", errorMsg_tRunJob_1.toString()); throw new RuntimeException("Child job return " + result_tRunJob_1 + ". It doesn't terminate normally.\n" + errorMsg_tRunJob_1.toString()); } tos_count_tRunJob_1++; /** * [tRunJob_1 main ] stop */ /** * [tRunJob_1 end ] start */ currentComponent = "tRunJob_1"; ok_Hash.put("tRunJob_1", true); end_Hash.put("tRunJob_1", System.currentTimeMillis()); /** * [tRunJob_1 end ] stop */ } // end the resume if (resumeEntryMethodName == null || globalResumeTicket) { resumeUtil.addLog("CHECKPOINT", "CONNECTION:SUBJOB_OK:tRunJob_1:OnSubjobOk", "", Thread.currentThread().getId() + "", "", "", "", "", ""); } tRunJob_2Process(globalMap); } catch (Exception e) { throw new TalendException(e, currentComponent, globalMap); } catch (java.lang.Error error) { throw new java.lang.Error(error); } globalMap.put("tRunJob_1_SUBPROCESS_STATE", 1); }
From source file:talonetl.getproperties_1_2.getProperties.java
public void tRunJob_2Process(final java.util.Map<String, Object> globalMap) throws TalendException { globalMap.put("tRunJob_2_SUBPROCESS_STATE", 0); final boolean execStat = this.execStat; String iterateId = ""; int iterateLoop = 0; String currentComponent = ""; try {/*from w w w . j a v a2 s. c o m*/ String currentMethodName = new Exception().getStackTrace()[0].getMethodName(); boolean resumeIt = currentMethodName.equals(resumeEntryMethodName); if (resumeEntryMethodName == null || resumeIt || globalResumeTicket) {// start // the // resume globalResumeTicket = true; /** * [tRunJob_2 begin ] start */ ok_Hash.put("tRunJob_2", false); start_Hash.put("tRunJob_2", System.currentTimeMillis()); currentComponent = "tRunJob_2"; int tos_count_tRunJob_2 = 0; class DealChildJobLibrary_tRunJob_2 { public String replaceJarPathsFromCrcMap(String originalClassPathLine) throws Exception { String classPathLine = ""; String crcMapPath = new java.io.File("../crcMap").getCanonicalPath(); if (isNeedAddLibsPath(crcMapPath)) { java.util.Map<String, String> crcMap = null; java.io.ObjectInputStream ois = new ObjectInputStream( new java.io.FileInputStream(crcMapPath)); crcMap = (java.util.Map<String, String>) ois.readObject(); ois.close(); classPathLine = addLibsPath(originalClassPathLine, crcMap); } else { classPathLine = originalClassPathLine; } return classPathLine; } private boolean isNeedAddLibsPath(String crcMapPath) { if (!(new java.io.File(crcMapPath).exists())) {// when // not // use // cache return false; } return true; } private String addLibsPath(String line, java.util.Map<String, String> crcMap) { for (java.util.Map.Entry<String, String> entry : crcMap.entrySet()) { line = adaptLibPaths(line, entry); } return line; } private String adaptLibPaths(String line, java.util.Map.Entry<String, String> entry) { String jarName = entry.getValue(); String crc = entry.getKey(); String libStringFinder = "../lib/" + jarName; if (line.contains(libStringFinder)) { line = line.replace(libStringFinder, "../../../cache/lib/" + crc + "/" + jarName); } else if (line.contains(":$ROOT_PATH/" + jarName + ":")) { line = line.replace(":$ROOT_PATH/" + jarName + ":", ":$ROOT_PATH/../../../cache/lib/" + crc + "/" + jarName + ":"); } else if (line.contains(";" + jarName + ";")) { line = line.replace(";" + jarName + ";", ";../../../cache/lib/" + crc + "/" + jarName + ";"); } return line; } } DealChildJobLibrary_tRunJob_2 dealChildJobLibrary_tRunJob_2 = new DealChildJobLibrary_tRunJob_2(); /** * [tRunJob_2 begin ] stop */ /** * [tRunJob_2 main ] start */ currentComponent = "tRunJob_2"; java.util.List<String> paraList_tRunJob_2 = new java.util.ArrayList<String>(); String osName_tRunJob_2 = System.getProperty("os.name"); if (osName_tRunJob_2 != null && osName_tRunJob_2.toLowerCase().startsWith("win")) { paraList_tRunJob_2.add("java"); paraList_tRunJob_2.add("-Xms256M"); paraList_tRunJob_2.add("-Xmx1024M"); paraList_tRunJob_2.add("-cp"); paraList_tRunJob_2.add(dealChildJobLibrary_tRunJob_2.replaceJarPathsFromCrcMap( "../lib/advancedPersistentLookupLib-1.0.jar;../lib/commons-codec-1.3.jar;../lib/commons-collections-3.2.jar;../lib/commons-httpclient-3.0.1.jar;../lib/commons-logging-1.1.jar;../lib/dom4j-1.6.1.jar;../lib/jboss-serialization.jar;../lib/jcifs-1.3.0.jar;../lib/log4j-1.2.15.jar;../lib/mysql-connector-java-5.1.22-bin.jar;../lib/TalendSAX.jar;../lib/trove.jar;../lib/systemRoutines.jar;../lib/userRoutines.jar;.;loadpropertyimages_0_2.jar;getpropfinacials_0_2.jar;loadfinacialdata_0_1.jar;loadpropertyimages_0_2.jar;")); paraList_tRunJob_2.add("talonetl.loadpropertyimages_0_2.loadPropertyImages"); paraList_tRunJob_2.add("--father_pid=" + pid); paraList_tRunJob_2.add("--root_pid=" + rootPid); paraList_tRunJob_2.add("--father_node=tRunJob_2"); paraList_tRunJob_2.add("--context=Default"); paraList_tRunJob_2.add("%*"); } else { paraList_tRunJob_2.add("java"); paraList_tRunJob_2.add("-Xms256M"); paraList_tRunJob_2.add("-Xmx1024M"); paraList_tRunJob_2.add("-cp"); paraList_tRunJob_2.add(dealChildJobLibrary_tRunJob_2.replaceJarPathsFromCrcMap( "$ROOT_PATH/../lib/advancedPersistentLookupLib-1.0.jar:$ROOT_PATH/../lib/commons-codec-1.3.jar:$ROOT_PATH/../lib/commons-collections-3.2.jar:$ROOT_PATH/../lib/commons-httpclient-3.0.1.jar:$ROOT_PATH/../lib/commons-logging-1.1.jar:$ROOT_PATH/../lib/dom4j-1.6.1.jar:$ROOT_PATH/../lib/jboss-serialization.jar:$ROOT_PATH/../lib/jcifs-1.3.0.jar:$ROOT_PATH/../lib/log4j-1.2.15.jar:$ROOT_PATH/../lib/mysql-connector-java-5.1.22-bin.jar:$ROOT_PATH/../lib/TalendSAX.jar:$ROOT_PATH/../lib/trove.jar:$ROOT_PATH:$ROOT_PATH/../lib/systemRoutines.jar:$ROOT_PATH/../lib/userRoutines.jar::.:$ROOT_PATH/loadpropertyimages_0_2.jar:$ROOT_PATH/getpropfinacials_0_2.jar:$ROOT_PATH/loadfinacialdata_0_1.jar:$ROOT_PATH/loadpropertyimages_0_2.jar:") .replace("$ROOT_PATH", System.getProperty("user.dir"))); paraList_tRunJob_2.add("talonetl.loadpropertyimages_0_2.loadPropertyImages"); paraList_tRunJob_2.add("--father_pid=" + pid); paraList_tRunJob_2.add("--root_pid=" + rootPid); paraList_tRunJob_2.add("--father_node=tRunJob_2"); paraList_tRunJob_2.add("--context=Default"); paraList_tRunJob_2.add("$@"); } // for feature:10589 paraList_tRunJob_2.add("--stat_port=" + null); if (resuming_logs_dir_path != null) { paraList_tRunJob_2.add("--resuming_logs_dir_path=" + resuming_logs_dir_path); } String childResumePath_tRunJob_2 = ResumeUtil.getChildJobCheckPointPath(resuming_checkpoint_path); String tRunJobName_tRunJob_2 = ResumeUtil.getRighttRunJob(resuming_checkpoint_path); if ("tRunJob_2".equals(tRunJobName_tRunJob_2) && childResumePath_tRunJob_2 != null) { paraList_tRunJob_2.add("--resuming_checkpoint_path=" + ResumeUtil.getChildJobCheckPointPath(resuming_checkpoint_path)); } paraList_tRunJob_2.add("--parent_part_launcher=JOB:" + jobName + "/NODE:tRunJob_2"); java.util.Map<String, Object> parentContextMap_tRunJob_2 = new java.util.HashMap<String, Object>(); context.synchronizeContext(); java.util.Enumeration<?> propertyNames_tRunJob_2 = context.propertyNames(); while (propertyNames_tRunJob_2.hasMoreElements()) { String key_tRunJob_2 = (String) propertyNames_tRunJob_2.nextElement(); Object value_tRunJob_2 = (Object) context.get(key_tRunJob_2); paraList_tRunJob_2.add("--context_param " + key_tRunJob_2 + "=" + value_tRunJob_2); } parentContextMap_tRunJob_2.put("propertySourceUri", context.propertySourceUri); parentContextMap_tRunJob_2.put("cusomterName", context.cusomterName); parentContextMap_tRunJob_2.put("talon_Password", context.talon_Password); parentContextMap_tRunJob_2.put("talon_AdditionalParams", context.talon_AdditionalParams); parentContextMap_tRunJob_2.put("talon_Port", context.talon_Port); parentContextMap_tRunJob_2.put("talon_Database", context.talon_Database); parentContextMap_tRunJob_2.put("talon_Server", context.talon_Server); parentContextMap_tRunJob_2.put("talon_Login", context.talon_Login); parentContextMap_tRunJob_2.put("cityStatsInfoApiUri", context.cityStatsInfoApiUri); parentContextMap_tRunJob_2.put("authId", context.authId); parentContextMap_tRunJob_2.put("authToken", context.authToken); Object obj_tRunJob_2 = null; obj_tRunJob_2 = context.propertySourceUri; paraList_tRunJob_2.add( "--context_param propertySourceUri=" + RuntimeUtils.tRunJobConvertContext(obj_tRunJob_2)); parentContextMap_tRunJob_2.put("propertySourceUri", obj_tRunJob_2); Runtime runtime_tRunJob_2 = Runtime.getRuntime(); final Process ps_tRunJob_2; ps_tRunJob_2 = runtime_tRunJob_2 .exec((String[]) paraList_tRunJob_2.toArray(new String[paraList_tRunJob_2.size()])); Thread normal_tRunJob_2 = new Thread() { public void run() { try { java.io.BufferedReader reader = new java.io.BufferedReader( new java.io.InputStreamReader(ps_tRunJob_2.getInputStream())); String line = ""; try { while ((line = reader.readLine()) != null) { System.out.println(line); } } finally { reader.close(); } } catch (java.io.IOException ioe) { ioe.printStackTrace(); } } }; normal_tRunJob_2.start(); final StringBuffer errorMsg_tRunJob_2 = new StringBuffer(); Thread error_tRunJob_2 = new Thread() { public void run() { try { java.io.BufferedReader reader = new java.io.BufferedReader( new java.io.InputStreamReader(ps_tRunJob_2.getErrorStream())); String line = ""; try { while ((line = reader.readLine()) != null) { errorMsg_tRunJob_2.append(line).append("\n"); } } finally { reader.close(); } } catch (java.io.IOException ioe) { ioe.printStackTrace(); } } }; error_tRunJob_2.start(); // 0 indicates normal termination int result_tRunJob_2 = ps_tRunJob_2.waitFor(); normal_tRunJob_2.join(10000); error_tRunJob_2.join(10000); globalMap.put("tRunJob_2_CHILD_RETURN_CODE", result_tRunJob_2); if (result_tRunJob_2 != 0) { globalMap.put("tRunJob_2_CHILD_EXCEPTION_STACKTRACE", errorMsg_tRunJob_2.toString()); throw new RuntimeException("Child job return " + result_tRunJob_2 + ". It doesn't terminate normally.\n" + errorMsg_tRunJob_2.toString()); } tos_count_tRunJob_2++; /** * [tRunJob_2 main ] stop */ /** * [tRunJob_2 end ] start */ currentComponent = "tRunJob_2"; ok_Hash.put("tRunJob_2", true); end_Hash.put("tRunJob_2", System.currentTimeMillis()); /** * [tRunJob_2 end ] stop */ } // end the resume } catch (Exception e) { throw new TalendException(e, currentComponent, globalMap); } catch (java.lang.Error error) { throw new java.lang.Error(error); } globalMap.put("tRunJob_2_SUBPROCESS_STATE", 1); }
From source file:talonetl.getproperties_1_2.getProperties.java
public void tRunJob_1Process(final java.util.Map<String, Object> globalMap) throws TalendException { globalMap.put("tRunJob_1_SUBPROCESS_STATE", 0); final boolean execStat = this.execStat; String iterateId = ""; int iterateLoop = 0; String currentComponent = ""; try {/*from www . j ava 2 s . c om*/ String currentMethodName = new Exception().getStackTrace()[0].getMethodName(); boolean resumeIt = currentMethodName.equals(resumeEntryMethodName); if (resumeEntryMethodName == null || resumeIt || globalResumeTicket) {// start // the // resume globalResumeTicket = true; /** * [tRunJob_1 begin ] start */ ok_Hash.put("tRunJob_1", false); start_Hash.put("tRunJob_1", System.currentTimeMillis()); currentComponent = "tRunJob_1"; int tos_count_tRunJob_1 = 0; class DealChildJobLibrary_tRunJob_1 { public String replaceJarPathsFromCrcMap(String originalClassPathLine) throws Exception { String classPathLine = ""; String crcMapPath = new java.io.File("../crcMap").getCanonicalPath(); if (isNeedAddLibsPath(crcMapPath)) { java.util.Map<String, String> crcMap = null; java.io.ObjectInputStream ois = new ObjectInputStream( new java.io.FileInputStream(crcMapPath)); crcMap = (java.util.Map<String, String>) ois.readObject(); ois.close(); classPathLine = addLibsPath(originalClassPathLine, crcMap); } else { classPathLine = originalClassPathLine; } return classPathLine; } private boolean isNeedAddLibsPath(String crcMapPath) { if (!(new java.io.File(crcMapPath).exists())) {// when // not // use // cache return false; } return true; } private String addLibsPath(String line, java.util.Map<String, String> crcMap) { for (java.util.Map.Entry<String, String> entry : crcMap.entrySet()) { line = adaptLibPaths(line, entry); } return line; } private String adaptLibPaths(String line, java.util.Map.Entry<String, String> entry) { String jarName = entry.getValue(); String crc = entry.getKey(); String libStringFinder = "../lib/" + jarName; if (line.contains(libStringFinder)) { line = line.replace(libStringFinder, "../../../cache/lib/" + crc + "/" + jarName); } else if (line.contains(":$ROOT_PATH/" + jarName + ":")) { line = line.replace(":$ROOT_PATH/" + jarName + ":", ":$ROOT_PATH/../../../cache/lib/" + crc + "/" + jarName + ":"); } else if (line.contains(";" + jarName + ";")) { line = line.replace(";" + jarName + ";", ";../../../cache/lib/" + crc + "/" + jarName + ";"); } return line; } } DealChildJobLibrary_tRunJob_1 dealChildJobLibrary_tRunJob_1 = new DealChildJobLibrary_tRunJob_1(); /** * [tRunJob_1 begin ] stop */ /** * [tRunJob_1 main ] start */ currentComponent = "tRunJob_1"; java.util.List<String> paraList_tRunJob_1 = new java.util.ArrayList<String>(); String osName_tRunJob_1 = System.getProperty("os.name"); if (osName_tRunJob_1 != null && osName_tRunJob_1.toLowerCase().startsWith("win")) { paraList_tRunJob_1.add("java"); paraList_tRunJob_1.add("-Xms256M"); paraList_tRunJob_1.add("-Xmx1024M"); paraList_tRunJob_1.add("-cp"); paraList_tRunJob_1.add(dealChildJobLibrary_tRunJob_1.replaceJarPathsFromCrcMap( "../lib/advancedPersistentLookupLib-1.0.jar;../lib/commons-codec-1.3.jar;../lib/commons-collections-3.2.jar;../lib/commons-httpclient-3.0.1.jar;../lib/commons-logging-1.1.jar;../lib/dom4j-1.6.1.jar;../lib/jboss-serialization.jar;../lib/jcifs-1.3.0.jar;../lib/log4j-1.2.15.jar;../lib/mysql-connector-java-5.1.22-bin.jar;../lib/TalendSAX.jar;../lib/trove.jar;../lib/systemRoutines.jar;../lib/userRoutines.jar;.;getpropfinacials_0_2.jar;getpropfinacials_0_2.jar;loadfinacialdata_0_1.jar;loadpropertyimages_0_2.jar;")); paraList_tRunJob_1.add("talonetl.getpropfinacials_0_2.getPropFinacials"); paraList_tRunJob_1.add("--father_pid=" + pid); paraList_tRunJob_1.add("--root_pid=" + rootPid); paraList_tRunJob_1.add("--father_node=tRunJob_1"); paraList_tRunJob_1.add("--context=Default"); paraList_tRunJob_1.add("%*"); } else { paraList_tRunJob_1.add("java"); paraList_tRunJob_1.add("-Xms256M"); paraList_tRunJob_1.add("-Xmx1024M"); paraList_tRunJob_1.add("-cp"); paraList_tRunJob_1.add(dealChildJobLibrary_tRunJob_1.replaceJarPathsFromCrcMap( "$ROOT_PATH/../lib/advancedPersistentLookupLib-1.0.jar:$ROOT_PATH/../lib/commons-codec-1.3.jar:$ROOT_PATH/../lib/commons-collections-3.2.jar:$ROOT_PATH/../lib/commons-httpclient-3.0.1.jar:$ROOT_PATH/../lib/commons-logging-1.1.jar:$ROOT_PATH/../lib/dom4j-1.6.1.jar:$ROOT_PATH/../lib/jboss-serialization.jar:$ROOT_PATH/../lib/jcifs-1.3.0.jar:$ROOT_PATH/../lib/log4j-1.2.15.jar:$ROOT_PATH/../lib/mysql-connector-java-5.1.22-bin.jar:$ROOT_PATH/../lib/TalendSAX.jar:$ROOT_PATH/../lib/trove.jar:$ROOT_PATH:$ROOT_PATH/../lib/systemRoutines.jar:$ROOT_PATH/../lib/userRoutines.jar::.:$ROOT_PATH/getpropfinacials_0_2.jar:$ROOT_PATH/getpropfinacials_0_2.jar:$ROOT_PATH/loadfinacialdata_0_1.jar:$ROOT_PATH/loadpropertyimages_0_2.jar:") .replace("$ROOT_PATH", System.getProperty("user.dir"))); paraList_tRunJob_1.add("talonetl.getpropfinacials_0_2.getPropFinacials"); paraList_tRunJob_1.add("--father_pid=" + pid); paraList_tRunJob_1.add("--root_pid=" + rootPid); paraList_tRunJob_1.add("--father_node=tRunJob_1"); paraList_tRunJob_1.add("--context=Default"); paraList_tRunJob_1.add("$@"); } // for feature:10589 paraList_tRunJob_1.add("--stat_port=" + null); if (resuming_logs_dir_path != null) { paraList_tRunJob_1.add("--resuming_logs_dir_path=" + resuming_logs_dir_path); } String childResumePath_tRunJob_1 = ResumeUtil.getChildJobCheckPointPath(resuming_checkpoint_path); String tRunJobName_tRunJob_1 = ResumeUtil.getRighttRunJob(resuming_checkpoint_path); if ("tRunJob_1".equals(tRunJobName_tRunJob_1) && childResumePath_tRunJob_1 != null) { paraList_tRunJob_1.add("--resuming_checkpoint_path=" + ResumeUtil.getChildJobCheckPointPath(resuming_checkpoint_path)); } paraList_tRunJob_1.add("--parent_part_launcher=JOB:" + jobName + "/NODE:tRunJob_1"); java.util.Map<String, Object> parentContextMap_tRunJob_1 = new java.util.HashMap<String, Object>(); context.synchronizeContext(); java.util.Enumeration<?> propertyNames_tRunJob_1 = context.propertyNames(); while (propertyNames_tRunJob_1.hasMoreElements()) { String key_tRunJob_1 = (String) propertyNames_tRunJob_1.nextElement(); Object value_tRunJob_1 = (Object) context.get(key_tRunJob_1); paraList_tRunJob_1.add("--context_param " + key_tRunJob_1 + "=" + value_tRunJob_1); } parentContextMap_tRunJob_1.put("propertySourceUri", context.propertySourceUri); parentContextMap_tRunJob_1.put("cusomterName", context.cusomterName); parentContextMap_tRunJob_1.put("talon_Password", context.talon_Password); parentContextMap_tRunJob_1.put("talon_AdditionalParams", context.talon_AdditionalParams); parentContextMap_tRunJob_1.put("talon_Port", context.talon_Port); parentContextMap_tRunJob_1.put("talon_Database", context.talon_Database); parentContextMap_tRunJob_1.put("talon_Server", context.talon_Server); parentContextMap_tRunJob_1.put("talon_Login", context.talon_Login); parentContextMap_tRunJob_1.put("cityStatsInfoApiUri", context.cityStatsInfoApiUri); parentContextMap_tRunJob_1.put("authId", context.authId); parentContextMap_tRunJob_1.put("authToken", context.authToken); Object obj_tRunJob_1 = null; obj_tRunJob_1 = context.propertySourceUri; paraList_tRunJob_1.add( "--context_param propertySourceUri=" + RuntimeUtils.tRunJobConvertContext(obj_tRunJob_1)); parentContextMap_tRunJob_1.put("propertySourceUri", obj_tRunJob_1); Runtime runtime_tRunJob_1 = Runtime.getRuntime(); final Process ps_tRunJob_1; ps_tRunJob_1 = runtime_tRunJob_1 .exec((String[]) paraList_tRunJob_1.toArray(new String[paraList_tRunJob_1.size()])); Thread normal_tRunJob_1 = new Thread() { public void run() { try { java.io.BufferedReader reader = new java.io.BufferedReader( new java.io.InputStreamReader(ps_tRunJob_1.getInputStream())); String line = ""; try { while ((line = reader.readLine()) != null) { System.out.println(line); } } finally { reader.close(); } } catch (java.io.IOException ioe) { ioe.printStackTrace(); } } }; normal_tRunJob_1.start(); final StringBuffer errorMsg_tRunJob_1 = new StringBuffer(); Thread error_tRunJob_1 = new Thread() { public void run() { try { java.io.BufferedReader reader = new java.io.BufferedReader( new java.io.InputStreamReader(ps_tRunJob_1.getErrorStream())); String line = ""; try { while ((line = reader.readLine()) != null) { errorMsg_tRunJob_1.append(line).append("\n"); } } finally { reader.close(); } } catch (java.io.IOException ioe) { ioe.printStackTrace(); } } }; error_tRunJob_1.start(); // 0 indicates normal termination int result_tRunJob_1 = ps_tRunJob_1.waitFor(); normal_tRunJob_1.join(10000); error_tRunJob_1.join(10000); globalMap.put("tRunJob_1_CHILD_RETURN_CODE", result_tRunJob_1); if (result_tRunJob_1 != 0) { globalMap.put("tRunJob_1_CHILD_EXCEPTION_STACKTRACE", errorMsg_tRunJob_1.toString()); throw new RuntimeException("Child job return " + result_tRunJob_1 + ". It doesn't terminate normally.\n" + errorMsg_tRunJob_1.toString()); } tos_count_tRunJob_1++; /** * [tRunJob_1 main ] stop */ /** * [tRunJob_1 end ] start */ currentComponent = "tRunJob_1"; ok_Hash.put("tRunJob_1", true); end_Hash.put("tRunJob_1", System.currentTimeMillis()); /** * [tRunJob_1 end ] stop */ } // end the resume if (resumeEntryMethodName == null || globalResumeTicket) { resumeUtil.addLog("CHECKPOINT", "CONNECTION:SUBJOB_OK:tRunJob_1:OnSubjobOk", "", Thread.currentThread().getId() + "", "", "", "", "", ""); } tRunJob_2Process(globalMap); } catch (Exception e) { throw new TalendException(e, currentComponent, globalMap); } catch (java.lang.Error error) { throw new java.lang.Error(error); } globalMap.put("tRunJob_1_SUBPROCESS_STATE", 1); }
From source file:talonetl.getproperties_1_3.getProperties.java
public void tRunJob_2Process(final java.util.Map<String, Object> globalMap) throws TalendException { globalMap.put("tRunJob_2_SUBPROCESS_STATE", 0); final boolean execStat = this.execStat; String iterateId = ""; int iterateLoop = 0; String currentComponent = ""; try {//from w w w. jav a2s. c o m String currentMethodName = new Exception().getStackTrace()[0].getMethodName(); boolean resumeIt = currentMethodName.equals(resumeEntryMethodName); if (resumeEntryMethodName == null || resumeIt || globalResumeTicket) {// start // the // resume globalResumeTicket = true; /** * [tRunJob_2 begin ] start */ ok_Hash.put("tRunJob_2", false); start_Hash.put("tRunJob_2", System.currentTimeMillis()); currentComponent = "tRunJob_2"; int tos_count_tRunJob_2 = 0; class DealChildJobLibrary_tRunJob_2 { public String replaceJarPathsFromCrcMap(String originalClassPathLine) throws Exception { String classPathLine = ""; String crcMapPath = new java.io.File("../crcMap").getCanonicalPath(); if (isNeedAddLibsPath(crcMapPath)) { java.util.Map<String, String> crcMap = null; java.io.ObjectInputStream ois = new ObjectInputStream( new java.io.FileInputStream(crcMapPath)); crcMap = (java.util.Map<String, String>) ois.readObject(); ois.close(); classPathLine = addLibsPath(originalClassPathLine, crcMap); } else { classPathLine = originalClassPathLine; } return classPathLine; } private boolean isNeedAddLibsPath(String crcMapPath) { if (!(new java.io.File(crcMapPath).exists())) {// when // not // use // cache return false; } return true; } private String addLibsPath(String line, java.util.Map<String, String> crcMap) { for (java.util.Map.Entry<String, String> entry : crcMap.entrySet()) { line = adaptLibPaths(line, entry); } return line; } private String adaptLibPaths(String line, java.util.Map.Entry<String, String> entry) { String jarName = entry.getValue(); String crc = entry.getKey(); String libStringFinder = "../lib/" + jarName; if (line.contains(libStringFinder)) { line = line.replace(libStringFinder, "../../../cache/lib/" + crc + "/" + jarName); } else if (line.contains(":$ROOT_PATH/" + jarName + ":")) { line = line.replace(":$ROOT_PATH/" + jarName + ":", ":$ROOT_PATH/../../../cache/lib/" + crc + "/" + jarName + ":"); } else if (line.contains(";" + jarName + ";")) { line = line.replace(";" + jarName + ";", ";../../../cache/lib/" + crc + "/" + jarName + ";"); } return line; } } DealChildJobLibrary_tRunJob_2 dealChildJobLibrary_tRunJob_2 = new DealChildJobLibrary_tRunJob_2(); /** * [tRunJob_2 begin ] stop */ /** * [tRunJob_2 main ] start */ currentComponent = "tRunJob_2"; java.util.List<String> paraList_tRunJob_2 = new java.util.ArrayList<String>(); String osName_tRunJob_2 = System.getProperty("os.name"); if (osName_tRunJob_2 != null && osName_tRunJob_2.toLowerCase().startsWith("win")) { paraList_tRunJob_2.add("java"); paraList_tRunJob_2.add("-Xms256M"); paraList_tRunJob_2.add("-Xmx1024M"); paraList_tRunJob_2.add("-cp"); paraList_tRunJob_2.add(dealChildJobLibrary_tRunJob_2.replaceJarPathsFromCrcMap( "../lib/advancedPersistentLookupLib-1.0.jar;../lib/commons-codec-1.3.jar;../lib/commons-collections-3.2.jar;../lib/commons-httpclient-3.0.1.jar;../lib/commons-logging-1.1.jar;../lib/dom4j-1.6.1.jar;../lib/jboss-serialization.jar;../lib/jcifs-1.3.0.jar;../lib/log4j-1.2.15.jar;../lib/mysql-connector-java-5.1.22-bin.jar;../lib/TalendSAX.jar;../lib/trove.jar;../lib/systemRoutines.jar;../lib/userRoutines.jar;.;loadpropertyimages_0_2.jar;getpropfinacials_0_3.jar;loadfinacialdata_0_2.jar;loadpropertyimages_0_2.jar;")); paraList_tRunJob_2.add("talonetl.loadpropertyimages_0_2.loadPropertyImages"); paraList_tRunJob_2.add("--father_pid=" + pid); paraList_tRunJob_2.add("--root_pid=" + rootPid); paraList_tRunJob_2.add("--father_node=tRunJob_2"); paraList_tRunJob_2.add("--context=Default"); paraList_tRunJob_2.add("%*"); } else { paraList_tRunJob_2.add("java"); paraList_tRunJob_2.add("-Xms256M"); paraList_tRunJob_2.add("-Xmx1024M"); paraList_tRunJob_2.add("-cp"); paraList_tRunJob_2.add(dealChildJobLibrary_tRunJob_2.replaceJarPathsFromCrcMap( "$ROOT_PATH/../lib/advancedPersistentLookupLib-1.0.jar:$ROOT_PATH/../lib/commons-codec-1.3.jar:$ROOT_PATH/../lib/commons-collections-3.2.jar:$ROOT_PATH/../lib/commons-httpclient-3.0.1.jar:$ROOT_PATH/../lib/commons-logging-1.1.jar:$ROOT_PATH/../lib/dom4j-1.6.1.jar:$ROOT_PATH/../lib/jboss-serialization.jar:$ROOT_PATH/../lib/jcifs-1.3.0.jar:$ROOT_PATH/../lib/log4j-1.2.15.jar:$ROOT_PATH/../lib/mysql-connector-java-5.1.22-bin.jar:$ROOT_PATH/../lib/TalendSAX.jar:$ROOT_PATH/../lib/trove.jar:$ROOT_PATH:$ROOT_PATH/../lib/systemRoutines.jar:$ROOT_PATH/../lib/userRoutines.jar::.:$ROOT_PATH/loadpropertyimages_0_2.jar:$ROOT_PATH/getpropfinacials_0_3.jar:$ROOT_PATH/loadfinacialdata_0_2.jar:$ROOT_PATH/loadpropertyimages_0_2.jar:") .replace("$ROOT_PATH", System.getProperty("user.dir"))); paraList_tRunJob_2.add("talonetl.loadpropertyimages_0_2.loadPropertyImages"); paraList_tRunJob_2.add("--father_pid=" + pid); paraList_tRunJob_2.add("--root_pid=" + rootPid); paraList_tRunJob_2.add("--father_node=tRunJob_2"); paraList_tRunJob_2.add("--context=Default"); paraList_tRunJob_2.add("$@"); } // for feature:10589 paraList_tRunJob_2.add("--stat_port=" + null); if (resuming_logs_dir_path != null) { paraList_tRunJob_2.add("--resuming_logs_dir_path=" + resuming_logs_dir_path); } String childResumePath_tRunJob_2 = ResumeUtil.getChildJobCheckPointPath(resuming_checkpoint_path); String tRunJobName_tRunJob_2 = ResumeUtil.getRighttRunJob(resuming_checkpoint_path); if ("tRunJob_2".equals(tRunJobName_tRunJob_2) && childResumePath_tRunJob_2 != null) { paraList_tRunJob_2.add("--resuming_checkpoint_path=" + ResumeUtil.getChildJobCheckPointPath(resuming_checkpoint_path)); } paraList_tRunJob_2.add("--parent_part_launcher=JOB:" + jobName + "/NODE:tRunJob_2"); java.util.Map<String, Object> parentContextMap_tRunJob_2 = new java.util.HashMap<String, Object>(); context.synchronizeContext(); java.util.Enumeration<?> propertyNames_tRunJob_2 = context.propertyNames(); while (propertyNames_tRunJob_2.hasMoreElements()) { String key_tRunJob_2 = (String) propertyNames_tRunJob_2.nextElement(); Object value_tRunJob_2 = (Object) context.get(key_tRunJob_2); paraList_tRunJob_2.add("--context_param " + key_tRunJob_2 + "=" + value_tRunJob_2); } parentContextMap_tRunJob_2.put("propertySourceUri", context.propertySourceUri); parentContextMap_tRunJob_2.put("cusomterName", context.cusomterName); parentContextMap_tRunJob_2.put("talon_Password", context.talon_Password); parentContextMap_tRunJob_2.put("talon_AdditionalParams", context.talon_AdditionalParams); parentContextMap_tRunJob_2.put("talon_Port", context.talon_Port); parentContextMap_tRunJob_2.put("talon_Database", context.talon_Database); parentContextMap_tRunJob_2.put("talon_Server", context.talon_Server); parentContextMap_tRunJob_2.put("talon_Login", context.talon_Login); parentContextMap_tRunJob_2.put("cityStatsInfoApiUri", context.cityStatsInfoApiUri); parentContextMap_tRunJob_2.put("authId", context.authId); parentContextMap_tRunJob_2.put("authToken", context.authToken); parentContextMap_tRunJob_2.put("customerUUid", context.customerUUid); parentContextMap_tRunJob_2.put("tmpDataStore", context.tmpDataStore); parentContextMap_tRunJob_2.put("propBaseXml", context.propBaseXml); Object obj_tRunJob_2 = null; obj_tRunJob_2 = context.propertySourceUri; paraList_tRunJob_2.add( "--context_param propertySourceUri=" + RuntimeUtils.tRunJobConvertContext(obj_tRunJob_2)); parentContextMap_tRunJob_2.put("propertySourceUri", obj_tRunJob_2); Runtime runtime_tRunJob_2 = Runtime.getRuntime(); final Process ps_tRunJob_2; ps_tRunJob_2 = runtime_tRunJob_2 .exec((String[]) paraList_tRunJob_2.toArray(new String[paraList_tRunJob_2.size()])); Thread normal_tRunJob_2 = new Thread() { public void run() { try { java.io.BufferedReader reader = new java.io.BufferedReader( new java.io.InputStreamReader(ps_tRunJob_2.getInputStream())); String line = ""; try { while ((line = reader.readLine()) != null) { System.out.println(line); } } finally { reader.close(); } } catch (java.io.IOException ioe) { ioe.printStackTrace(); } } }; normal_tRunJob_2.start(); final StringBuffer errorMsg_tRunJob_2 = new StringBuffer(); Thread error_tRunJob_2 = new Thread() { public void run() { try { java.io.BufferedReader reader = new java.io.BufferedReader( new java.io.InputStreamReader(ps_tRunJob_2.getErrorStream())); String line = ""; try { while ((line = reader.readLine()) != null) { errorMsg_tRunJob_2.append(line).append("\n"); } } finally { reader.close(); } } catch (java.io.IOException ioe) { ioe.printStackTrace(); } } }; error_tRunJob_2.start(); // 0 indicates normal termination int result_tRunJob_2 = ps_tRunJob_2.waitFor(); normal_tRunJob_2.join(10000); error_tRunJob_2.join(10000); globalMap.put("tRunJob_2_CHILD_RETURN_CODE", result_tRunJob_2); if (result_tRunJob_2 != 0) { globalMap.put("tRunJob_2_CHILD_EXCEPTION_STACKTRACE", errorMsg_tRunJob_2.toString()); throw new RuntimeException("Child job return " + result_tRunJob_2 + ". It doesn't terminate normally.\n" + errorMsg_tRunJob_2.toString()); } tos_count_tRunJob_2++; /** * [tRunJob_2 main ] stop */ /** * [tRunJob_2 end ] start */ currentComponent = "tRunJob_2"; ok_Hash.put("tRunJob_2", true); end_Hash.put("tRunJob_2", System.currentTimeMillis()); /** * [tRunJob_2 end ] stop */ } // end the resume } catch (Exception e) { throw new TalendException(e, currentComponent, globalMap); } catch (java.lang.Error error) { throw new java.lang.Error(error); } globalMap.put("tRunJob_2_SUBPROCESS_STATE", 1); }
From source file:talonetl.getproperties_1_3.getProperties.java
public void tRunJob_1Process(final java.util.Map<String, Object> globalMap) throws TalendException { globalMap.put("tRunJob_1_SUBPROCESS_STATE", 0); final boolean execStat = this.execStat; String iterateId = ""; int iterateLoop = 0; String currentComponent = ""; try {//from ww w.ja v a 2 s .c o m String currentMethodName = new Exception().getStackTrace()[0].getMethodName(); boolean resumeIt = currentMethodName.equals(resumeEntryMethodName); if (resumeEntryMethodName == null || resumeIt || globalResumeTicket) {// start // the // resume globalResumeTicket = true; /** * [tRunJob_1 begin ] start */ ok_Hash.put("tRunJob_1", false); start_Hash.put("tRunJob_1", System.currentTimeMillis()); currentComponent = "tRunJob_1"; int tos_count_tRunJob_1 = 0; class DealChildJobLibrary_tRunJob_1 { public String replaceJarPathsFromCrcMap(String originalClassPathLine) throws Exception { String classPathLine = ""; String crcMapPath = new java.io.File("../crcMap").getCanonicalPath(); if (isNeedAddLibsPath(crcMapPath)) { java.util.Map<String, String> crcMap = null; java.io.ObjectInputStream ois = new ObjectInputStream( new java.io.FileInputStream(crcMapPath)); crcMap = (java.util.Map<String, String>) ois.readObject(); ois.close(); classPathLine = addLibsPath(originalClassPathLine, crcMap); } else { classPathLine = originalClassPathLine; } return classPathLine; } private boolean isNeedAddLibsPath(String crcMapPath) { if (!(new java.io.File(crcMapPath).exists())) {// when // not // use // cache return false; } return true; } private String addLibsPath(String line, java.util.Map<String, String> crcMap) { for (java.util.Map.Entry<String, String> entry : crcMap.entrySet()) { line = adaptLibPaths(line, entry); } return line; } private String adaptLibPaths(String line, java.util.Map.Entry<String, String> entry) { String jarName = entry.getValue(); String crc = entry.getKey(); String libStringFinder = "../lib/" + jarName; if (line.contains(libStringFinder)) { line = line.replace(libStringFinder, "../../../cache/lib/" + crc + "/" + jarName); } else if (line.contains(":$ROOT_PATH/" + jarName + ":")) { line = line.replace(":$ROOT_PATH/" + jarName + ":", ":$ROOT_PATH/../../../cache/lib/" + crc + "/" + jarName + ":"); } else if (line.contains(";" + jarName + ";")) { line = line.replace(";" + jarName + ";", ";../../../cache/lib/" + crc + "/" + jarName + ";"); } return line; } } DealChildJobLibrary_tRunJob_1 dealChildJobLibrary_tRunJob_1 = new DealChildJobLibrary_tRunJob_1(); /** * [tRunJob_1 begin ] stop */ /** * [tRunJob_1 main ] start */ currentComponent = "tRunJob_1"; java.util.List<String> paraList_tRunJob_1 = new java.util.ArrayList<String>(); String osName_tRunJob_1 = System.getProperty("os.name"); if (osName_tRunJob_1 != null && osName_tRunJob_1.toLowerCase().startsWith("win")) { paraList_tRunJob_1.add("java"); paraList_tRunJob_1.add("-Xms256M"); paraList_tRunJob_1.add("-Xmx1024M"); paraList_tRunJob_1.add("-cp"); paraList_tRunJob_1.add(dealChildJobLibrary_tRunJob_1.replaceJarPathsFromCrcMap( "../lib/advancedPersistentLookupLib-1.0.jar;../lib/commons-codec-1.3.jar;../lib/commons-collections-3.2.jar;../lib/commons-httpclient-3.0.1.jar;../lib/commons-logging-1.1.jar;../lib/dom4j-1.6.1.jar;../lib/jboss-serialization.jar;../lib/jcifs-1.3.0.jar;../lib/log4j-1.2.15.jar;../lib/mysql-connector-java-5.1.22-bin.jar;../lib/TalendSAX.jar;../lib/trove.jar;../lib/systemRoutines.jar;../lib/userRoutines.jar;.;getpropfinacials_0_3.jar;getpropfinacials_0_3.jar;loadfinacialdata_0_2.jar;loadpropertyimages_0_2.jar;")); paraList_tRunJob_1.add("talonetl.getpropfinacials_0_3.getPropFinacials"); paraList_tRunJob_1.add("--father_pid=" + pid); paraList_tRunJob_1.add("--root_pid=" + rootPid); paraList_tRunJob_1.add("--father_node=tRunJob_1"); paraList_tRunJob_1.add("--context=Default"); paraList_tRunJob_1.add("%*"); } else { paraList_tRunJob_1.add("java"); paraList_tRunJob_1.add("-Xms256M"); paraList_tRunJob_1.add("-Xmx1024M"); paraList_tRunJob_1.add("-cp"); paraList_tRunJob_1.add(dealChildJobLibrary_tRunJob_1.replaceJarPathsFromCrcMap( "$ROOT_PATH/../lib/advancedPersistentLookupLib-1.0.jar:$ROOT_PATH/../lib/commons-codec-1.3.jar:$ROOT_PATH/../lib/commons-collections-3.2.jar:$ROOT_PATH/../lib/commons-httpclient-3.0.1.jar:$ROOT_PATH/../lib/commons-logging-1.1.jar:$ROOT_PATH/../lib/dom4j-1.6.1.jar:$ROOT_PATH/../lib/jboss-serialization.jar:$ROOT_PATH/../lib/jcifs-1.3.0.jar:$ROOT_PATH/../lib/log4j-1.2.15.jar:$ROOT_PATH/../lib/mysql-connector-java-5.1.22-bin.jar:$ROOT_PATH/../lib/TalendSAX.jar:$ROOT_PATH/../lib/trove.jar:$ROOT_PATH:$ROOT_PATH/../lib/systemRoutines.jar:$ROOT_PATH/../lib/userRoutines.jar::.:$ROOT_PATH/getpropfinacials_0_3.jar:$ROOT_PATH/getpropfinacials_0_3.jar:$ROOT_PATH/loadfinacialdata_0_2.jar:$ROOT_PATH/loadpropertyimages_0_2.jar:") .replace("$ROOT_PATH", System.getProperty("user.dir"))); paraList_tRunJob_1.add("talonetl.getpropfinacials_0_3.getPropFinacials"); paraList_tRunJob_1.add("--father_pid=" + pid); paraList_tRunJob_1.add("--root_pid=" + rootPid); paraList_tRunJob_1.add("--father_node=tRunJob_1"); paraList_tRunJob_1.add("--context=Default"); paraList_tRunJob_1.add("$@"); } // for feature:10589 paraList_tRunJob_1.add("--stat_port=" + null); if (resuming_logs_dir_path != null) { paraList_tRunJob_1.add("--resuming_logs_dir_path=" + resuming_logs_dir_path); } String childResumePath_tRunJob_1 = ResumeUtil.getChildJobCheckPointPath(resuming_checkpoint_path); String tRunJobName_tRunJob_1 = ResumeUtil.getRighttRunJob(resuming_checkpoint_path); if ("tRunJob_1".equals(tRunJobName_tRunJob_1) && childResumePath_tRunJob_1 != null) { paraList_tRunJob_1.add("--resuming_checkpoint_path=" + ResumeUtil.getChildJobCheckPointPath(resuming_checkpoint_path)); } paraList_tRunJob_1.add("--parent_part_launcher=JOB:" + jobName + "/NODE:tRunJob_1"); java.util.Map<String, Object> parentContextMap_tRunJob_1 = new java.util.HashMap<String, Object>(); context.synchronizeContext(); java.util.Enumeration<?> propertyNames_tRunJob_1 = context.propertyNames(); while (propertyNames_tRunJob_1.hasMoreElements()) { String key_tRunJob_1 = (String) propertyNames_tRunJob_1.nextElement(); Object value_tRunJob_1 = (Object) context.get(key_tRunJob_1); paraList_tRunJob_1.add("--context_param " + key_tRunJob_1 + "=" + value_tRunJob_1); } parentContextMap_tRunJob_1.put("propertySourceUri", context.propertySourceUri); parentContextMap_tRunJob_1.put("cusomterName", context.cusomterName); parentContextMap_tRunJob_1.put("talon_Password", context.talon_Password); parentContextMap_tRunJob_1.put("talon_AdditionalParams", context.talon_AdditionalParams); parentContextMap_tRunJob_1.put("talon_Port", context.talon_Port); parentContextMap_tRunJob_1.put("talon_Database", context.talon_Database); parentContextMap_tRunJob_1.put("talon_Server", context.talon_Server); parentContextMap_tRunJob_1.put("talon_Login", context.talon_Login); parentContextMap_tRunJob_1.put("cityStatsInfoApiUri", context.cityStatsInfoApiUri); parentContextMap_tRunJob_1.put("authId", context.authId); parentContextMap_tRunJob_1.put("authToken", context.authToken); parentContextMap_tRunJob_1.put("customerUUid", context.customerUUid); parentContextMap_tRunJob_1.put("tmpDataStore", context.tmpDataStore); parentContextMap_tRunJob_1.put("propBaseXml", context.propBaseXml); Object obj_tRunJob_1 = null; obj_tRunJob_1 = context.propertySourceUri; paraList_tRunJob_1.add( "--context_param propertySourceUri=" + RuntimeUtils.tRunJobConvertContext(obj_tRunJob_1)); parentContextMap_tRunJob_1.put("propertySourceUri", obj_tRunJob_1); Runtime runtime_tRunJob_1 = Runtime.getRuntime(); final Process ps_tRunJob_1; ps_tRunJob_1 = runtime_tRunJob_1 .exec((String[]) paraList_tRunJob_1.toArray(new String[paraList_tRunJob_1.size()])); Thread normal_tRunJob_1 = new Thread() { public void run() { try { java.io.BufferedReader reader = new java.io.BufferedReader( new java.io.InputStreamReader(ps_tRunJob_1.getInputStream())); String line = ""; try { while ((line = reader.readLine()) != null) { System.out.println(line); } } finally { reader.close(); } } catch (java.io.IOException ioe) { ioe.printStackTrace(); } } }; normal_tRunJob_1.start(); final StringBuffer errorMsg_tRunJob_1 = new StringBuffer(); Thread error_tRunJob_1 = new Thread() { public void run() { try { java.io.BufferedReader reader = new java.io.BufferedReader( new java.io.InputStreamReader(ps_tRunJob_1.getErrorStream())); String line = ""; try { while ((line = reader.readLine()) != null) { errorMsg_tRunJob_1.append(line).append("\n"); } } finally { reader.close(); } } catch (java.io.IOException ioe) { ioe.printStackTrace(); } } }; error_tRunJob_1.start(); // 0 indicates normal termination int result_tRunJob_1 = ps_tRunJob_1.waitFor(); normal_tRunJob_1.join(10000); error_tRunJob_1.join(10000); globalMap.put("tRunJob_1_CHILD_RETURN_CODE", result_tRunJob_1); if (result_tRunJob_1 != 0) { globalMap.put("tRunJob_1_CHILD_EXCEPTION_STACKTRACE", errorMsg_tRunJob_1.toString()); throw new RuntimeException("Child job return " + result_tRunJob_1 + ". It doesn't terminate normally.\n" + errorMsg_tRunJob_1.toString()); } tos_count_tRunJob_1++; /** * [tRunJob_1 main ] stop */ /** * [tRunJob_1 end ] start */ currentComponent = "tRunJob_1"; ok_Hash.put("tRunJob_1", true); end_Hash.put("tRunJob_1", System.currentTimeMillis()); /** * [tRunJob_1 end ] stop */ } // end the resume if (resumeEntryMethodName == null || globalResumeTicket) { resumeUtil.addLog("CHECKPOINT", "CONNECTION:SUBJOB_OK:tRunJob_1:OnSubjobOk", "", Thread.currentThread().getId() + "", "", "", "", "", ""); } tRunJob_2Process(globalMap); } catch (Exception e) { throw new TalendException(e, currentComponent, globalMap); } catch (java.lang.Error error) { throw new java.lang.Error(error); } globalMap.put("tRunJob_1_SUBPROCESS_STATE", 1); }