// ============================================================================ // // Copyright (c) 2006-2013, Talend Inc. // // This source code has been automatically generated by_Talend Open Studio for ESB // / Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package bio2rdf.bio2rdf_rest_subjob_1_7; import routines.Mathematical; import routines.DataOperation; import routines.Relational; import routines.TalendDate; import routines.TalendDataGenerator; import routines.Numeric; import routines.MD5; import routines.TalendString; import routines.StringHandling; import routines.system.*; import routines.system.api.*; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import java.math.BigDecimal; import java.io.ByteArrayOutputStream; import java.io.ByteArrayInputStream; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.ObjectOutputStream; import java.io.ObjectInputStream; import java.io.IOException; import java.util.Comparator; @SuppressWarnings("unused") /** * Job: bio2rdf_rest_subjob Purpose: <br> * Description: <br> * @author test@talend.com * @version 5.5.0.r117820 * @status */ public class bio2rdf_rest_subjob implements TalendJob { public final Object obj = new Object(); // for transmiting parameters purpose private Object valueObject = null; public Object getValueObject() { return this.valueObject; } public void setValueObject(Object valueObject) { this.valueObject = valueObject; } private final static String defaultCharset = java.nio.charset.Charset .defaultCharset().name(); private final static String utf8Charset = "UTF-8"; // create and load default properties private java.util.Properties defaultProps = new java.util.Properties(); // create application properties with default public class ContextProperties extends java.util.Properties { private static final long serialVersionUID = 1L; public ContextProperties(java.util.Properties properties) { super(properties); } public ContextProperties() { super(); } public void synchronizeContext() { if (namespace != null) { this.setProperty("namespace", namespace.toString()); } if (ns != null) { this.setProperty("ns", ns.toString()); } if (id != null) { this.setProperty("id", id.toString()); } if (format != null) { this.setProperty("format", format.toString()); } if (query != null) { this.setProperty("query", query.toString()); } if (request != null) { this.setProperty("request", request.toString()); } if (debug != null) { this.setProperty("debug", debug.toString()); } if (database_endpoint != null) { this.setProperty("database_endpoint", database_endpoint.toString()); } if (uri != null) { this.setProperty("uri", uri.toString()); } if (parm1 != null) { this.setProperty("parm1", parm1.toString()); } if (parm2 != null) { this.setProperty("parm2", parm2.toString()); } if (parm3 != null) { this.setProperty("parm3", parm3.toString()); } } public String namespace; public String getNamespace() { return this.namespace; } public String ns; public String getNs() { return this.ns; } public String id; public String getId() { return this.id; } public String format; public String getFormat() { return this.format; } public String query; public String getQuery() { return this.query; } public String request; public String getRequest() { return this.request; } public Boolean debug; public Boolean getDebug() { return this.debug; } public String database_endpoint; public String getDatabase_endpoint() { return this.database_endpoint; } public String uri; public String getUri() { return this.uri; } public String parm1; public String getParm1() { return this.parm1; } public String parm2; public String getParm2() { return this.parm2; } public String parm3; public String getParm3() { return this.parm3; } } private ContextProperties context = new ContextProperties(); public ContextProperties getContext() { return this.context; } private final String jobVersion = "1.7"; private final String jobName = "bio2rdf_rest_subjob"; private final String projectName = "BIO2RDF"; public Integer errorCode = null; private String currentComponent = ""; private final java.util.Map<String, Object> globalMap = new java.util.HashMap<String, Object>(); private final java.util.Map<String, Long> start_Hash = new java.util.HashMap<String, Long>(); private final java.util.Map<String, Long> end_Hash = new java.util.HashMap<String, Long>(); private final java.util.Map<String, Boolean> ok_Hash = new java.util.HashMap<String, Boolean>(); public final java.util.List<String[]> globalBuffer = new java.util.ArrayList<String[]>(); public boolean isExportedAsOSGI = false; // OSGi DataSource private final static String KEY_DB_DATASOURCES = "KEY_DB_DATASOURCES"; public void setDataSources( java.util.Map<String, javax.sql.DataSource> dataSources) { java.util.Map<String, routines.system.TalendDataSource> talendDataSources = new java.util.HashMap<String, routines.system.TalendDataSource>(); for (java.util.Map.Entry<String, javax.sql.DataSource> dataSourceEntry : dataSources .entrySet()) { talendDataSources.put( dataSourceEntry.getKey(), new routines.system.TalendDataSource(dataSourceEntry .getValue())); } globalMap.put(KEY_DB_DATASOURCES, talendDataSources); } private final java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream(); private final java.io.PrintStream errorMessagePS = new java.io.PrintStream( new java.io.BufferedOutputStream(baos)); public String getExceptionStackTrace() { if ("failure".equals(this.getStatus())) { errorMessagePS.flush(); return baos.toString(); } return null; } private java.lang.Exception exception = null; public java.lang.Exception getException() { if ("failure".equals(this.getStatus())) { return this.exception; } return null; } private class TalendException extends java.lang.Exception { private static final long serialVersionUID = 1L; private java.util.Map<String, Object> globalMap = null; private java.lang.Exception e = null; private String currentComponent = null; private String virtualComponentName = null; public void setVirtualComponentName(String virtualComponentName) { this.virtualComponentName = virtualComponentName; } private TalendException(java.lang.Exception e, String errorComponent, final java.util.Map<String, Object> globalMap) { this.currentComponent = errorComponent; this.globalMap = globalMap; this.e = e; } public java.lang.Exception getException() { return this.e; } public String getCurrentComponent() { return this.currentComponent; } public String getExceptionCauseMessage(java.lang.Exception e) { Throwable cause = e; String message = null; int i = 10; while (null != cause && 0 < i--) { message = cause.getMessage(); if (null == message) { cause = cause.getCause(); } else { break; } } if (null == message) { message = e.getClass().getName(); } return message; } @Override public void printStackTrace() { if (!(e instanceof TalendException || e instanceof TDieException)) { if (virtualComponentName != null && currentComponent.indexOf(virtualComponentName + "_") == 0) { globalMap.put(virtualComponentName + "_ERROR_MESSAGE", getExceptionCauseMessage(e)); } globalMap.put(currentComponent + "_ERROR_MESSAGE", getExceptionCauseMessage(e)); System.err .println("Exception in component " + currentComponent); } if (!(e instanceof TDieException)) { if (e instanceof TalendException) { e.printStackTrace(); } else { e.printStackTrace(); e.printStackTrace(errorMessagePS); bio2rdf_rest_subjob.this.exception = e; } } if (!(e instanceof TalendException)) { try { for (java.lang.reflect.Method m : this.getClass() .getEnclosingClass().getMethods()) { if (m.getName().compareTo(currentComponent + "_error") == 0) { m.invoke(bio2rdf_rest_subjob.this, new Object[] { e, currentComponent, globalMap }); break; } } if (!(e instanceof TDieException)) { } } catch (java.lang.SecurityException e) { this.e.printStackTrace(); } catch (java.lang.IllegalArgumentException e) { this.e.printStackTrace(); } catch (java.lang.IllegalAccessException e) { this.e.printStackTrace(); } catch (java.lang.reflect.InvocationTargetException e) { this.e.printStackTrace(); } } } } public void tSparqlSelectRequest_1_error(java.lang.Exception exception, String errorComponent, final java.util.Map<String, Object> globalMap) throws TalendException { end_Hash.put(errorComponent, System.currentTimeMillis()); status = "failure"; tSparqlSelectRequest_1_onSubJobError(exception, errorComponent, globalMap); } public void tReplace_1_error(java.lang.Exception exception, String errorComponent, final java.util.Map<String, Object> globalMap) throws TalendException { end_Hash.put(errorComponent, System.currentTimeMillis()); status = "failure"; tSparqlSelectRequest_1_onSubJobError(exception, errorComponent, globalMap); } public void tLogRow_3_error(java.lang.Exception exception, String errorComponent, final java.util.Map<String, Object> globalMap) throws TalendException { end_Hash.put(errorComponent, System.currentTimeMillis()); status = "failure"; tSparqlSelectRequest_1_onSubJobError(exception, errorComponent, globalMap); } public void tMap_1_error(java.lang.Exception exception, String errorComponent, final java.util.Map<String, Object> globalMap) throws TalendException { end_Hash.put(errorComponent, System.currentTimeMillis()); status = "failure"; tSparqlSelectRequest_1_onSubJobError(exception, errorComponent, globalMap); } public void tFlowToIterate_2_error(java.lang.Exception exception, String errorComponent, final java.util.Map<String, Object> globalMap) throws TalendException { end_Hash.put(errorComponent, System.currentTimeMillis()); status = "failure"; tSparqlSelectRequest_1_onSubJobError(exception, errorComponent, globalMap); } public void tRunJob_1_error(java.lang.Exception exception, String errorComponent, final java.util.Map<String, Object> globalMap) throws TalendException { end_Hash.put(errorComponent, System.currentTimeMillis()); status = "failure"; tSparqlSelectRequest_1_onSubJobError(exception, errorComponent, globalMap); } public void tMap_2_error(java.lang.Exception exception, String errorComponent, final java.util.Map<String, Object> globalMap) throws TalendException { end_Hash.put(errorComponent, System.currentTimeMillis()); status = "failure"; tSparqlSelectRequest_1_onSubJobError(exception, errorComponent, globalMap); } public void tBufferOutput_1_error(java.lang.Exception exception, String errorComponent, final java.util.Map<String, Object> globalMap) throws TalendException { end_Hash.put(errorComponent, System.currentTimeMillis()); status = "failure"; tSparqlSelectRequest_1_onSubJobError(exception, errorComponent, globalMap); } public void tLogRow_2_error(java.lang.Exception exception, String errorComponent, final java.util.Map<String, Object> globalMap) throws TalendException { end_Hash.put(errorComponent, System.currentTimeMillis()); status = "failure"; tSparqlSelectRequest_1_onSubJobError(exception, errorComponent, globalMap); } public void tLogRow_1_error(java.lang.Exception exception, String errorComponent, final java.util.Map<String, Object> globalMap) throws TalendException { end_Hash.put(errorComponent, System.currentTimeMillis()); status = "failure"; tSparqlSelectRequest_1_onSubJobError(exception, errorComponent, globalMap); } public void tSparqlSelectRequest_1_onSubJobError( java.lang.Exception exception, String errorComponent, final java.util.Map<String, Object> globalMap) throws TalendException { resumeUtil.addLog("SYSTEM_LOG", "NODE:" + errorComponent, "", Thread .currentThread().getId() + "", "FATAL", "", exception.getMessage(), ResumeUtil.getExceptionStackTrace(exception), ""); } public static class out3Struct implements routines.system.IPersistableRow<out3Struct> { final static byte[] commonByteArrayLock_BIO2RDF_bio2rdf_rest_subjob = new byte[0]; static byte[] commonByteArray_BIO2RDF_bio2rdf_rest_subjob = new byte[0]; public String string; public String getString() { return this.string; } public routines.system.Document body; public routines.system.Document getBody() { return this.body; } private String readString(ObjectInputStream dis) throws IOException { String strReturn = null; int length = 0; length = dis.readInt(); if (length == -1) { strReturn = null; } else { if (length > commonByteArray_BIO2RDF_bio2rdf_rest_subjob.length) { if (length < 1024 && commonByteArray_BIO2RDF_bio2rdf_rest_subjob.length == 0) { commonByteArray_BIO2RDF_bio2rdf_rest_subjob = new byte[1024]; } else { commonByteArray_BIO2RDF_bio2rdf_rest_subjob = new byte[2 * length]; } } dis.readFully(commonByteArray_BIO2RDF_bio2rdf_rest_subjob, 0, length); strReturn = new String( commonByteArray_BIO2RDF_bio2rdf_rest_subjob, 0, length, utf8Charset); } return strReturn; } private void writeString(String str, ObjectOutputStream dos) throws IOException { if (str == null) { dos.writeInt(-1); } else { byte[] byteArray = str.getBytes(utf8Charset); dos.writeInt(byteArray.length); dos.write(byteArray); } } public void readData(ObjectInputStream dis) { synchronized (commonByteArrayLock_BIO2RDF_bio2rdf_rest_subjob) { try { int length = 0; this.string = readString(dis); this.body = (routines.system.Document) dis.readObject(); } catch (IOException e) { throw new RuntimeException(e); } catch (ClassNotFoundException eCNFE) { throw new RuntimeException(eCNFE); } } } public void writeData(ObjectOutputStream dos) { try { // String writeString(this.string, dos); // Document dos.writeObject(this.body); } catch (IOException e) { throw new RuntimeException(e); } } public String toString() { StringBuilder sb = new StringBuilder(); sb.append(super.toString()); sb.append("["); sb.append("string=" + string); sb.append(",body=" + String.valueOf(body)); sb.append("]"); return sb.toString(); } /** * Compare keys */ public int compareTo(out3Struct other) { int returnValue = -1; return returnValue; } private int checkNullsAndCompare(Object object1, Object object2) { int returnValue = 0; if (object1 instanceof Comparable && object2 instanceof Comparable) { returnValue = ((Comparable) object1).compareTo(object2); } else if (object1 != null && object2 != null) { returnValue = compareStrings(object1.toString(), object2.toString()); } else if (object1 == null && object2 != null) { returnValue = 1; } else if (object1 != null && object2 == null) { returnValue = -1; } else { returnValue = 0; } return returnValue; } private int compareStrings(String string1, String string2) { return string1.compareTo(string2); } } public static class debug2Struct implements routines.system.IPersistableRow<debug2Struct> { final static byte[] commonByteArrayLock_BIO2RDF_bio2rdf_rest_subjob = new byte[0]; static byte[] commonByteArray_BIO2RDF_bio2rdf_rest_subjob = new byte[0]; public String string; public String getString() { return this.string; } public routines.system.Document body; public routines.system.Document getBody() { return this.body; } private String readString(ObjectInputStream dis) throws IOException { String strReturn = null; int length = 0; length = dis.readInt(); if (length == -1) { strReturn = null; } else { if (length > commonByteArray_BIO2RDF_bio2rdf_rest_subjob.length) { if (length < 1024 && commonByteArray_BIO2RDF_bio2rdf_rest_subjob.length == 0) { commonByteArray_BIO2RDF_bio2rdf_rest_subjob = new byte[1024]; } else { commonByteArray_BIO2RDF_bio2rdf_rest_subjob = new byte[2 * length]; } } dis.readFully(commonByteArray_BIO2RDF_bio2rdf_rest_subjob, 0, length); strReturn = new String( commonByteArray_BIO2RDF_bio2rdf_rest_subjob, 0, length, utf8Charset); } return strReturn; } private void writeString(String str, ObjectOutputStream dos) throws IOException { if (str == null) { dos.writeInt(-1); } else { byte[] byteArray = str.getBytes(utf8Charset); dos.writeInt(byteArray.length); dos.write(byteArray); } } public void readData(ObjectInputStream dis) { synchronized (commonByteArrayLock_BIO2RDF_bio2rdf_rest_subjob) { try { int length = 0; this.string = readString(dis); this.body = (routines.system.Document) dis.readObject(); } catch (IOException e) { throw new RuntimeException(e); } catch (ClassNotFoundException eCNFE) { throw new RuntimeException(eCNFE); } } } public void writeData(ObjectOutputStream dos) { try { // String writeString(this.string, dos); // Document dos.writeObject(this.body); } catch (IOException e) { throw new RuntimeException(e); } } public String toString() { StringBuilder sb = new StringBuilder(); sb.append(super.toString()); sb.append("["); sb.append("string=" + string); sb.append(",body=" + String.valueOf(body)); sb.append("]"); return sb.toString(); } /** * Compare keys */ public int compareTo(debug2Struct other) { int returnValue = -1; return returnValue; } private int checkNullsAndCompare(Object object1, Object object2) { int returnValue = 0; if (object1 instanceof Comparable && object2 instanceof Comparable) { returnValue = ((Comparable) object1).compareTo(object2); } else if (object1 != null && object2 != null) { returnValue = compareStrings(object1.toString(), object2.toString()); } else if (object1 == null && object2 != null) { returnValue = 1; } else if (object1 != null && object2 == null) { returnValue = -1; } else { returnValue = 0; } return returnValue; } private int compareStrings(String string1, String string2) { return string1.compareTo(string2); } } public static class row2Struct implements routines.system.IPersistableRow<row2Struct> { final static byte[] commonByteArrayLock_BIO2RDF_bio2rdf_rest_subjob = new byte[0]; static byte[] commonByteArray_BIO2RDF_bio2rdf_rest_subjob = new byte[0]; public String string; public String getString() { return this.string; } public routines.system.Document body; public routines.system.Document getBody() { return this.body; } private String readString(ObjectInputStream dis) throws IOException { String strReturn = null; int length = 0; length = dis.readInt(); if (length == -1) { strReturn = null; } else { if (length > commonByteArray_BIO2RDF_bio2rdf_rest_subjob.length) { if (length < 1024 && commonByteArray_BIO2RDF_bio2rdf_rest_subjob.length == 0) { commonByteArray_BIO2RDF_bio2rdf_rest_subjob = new byte[1024]; } else { commonByteArray_BIO2RDF_bio2rdf_rest_subjob = new byte[2 * length]; } } dis.readFully(commonByteArray_BIO2RDF_bio2rdf_rest_subjob, 0, length); strReturn = new String( commonByteArray_BIO2RDF_bio2rdf_rest_subjob, 0, length, utf8Charset); } return strReturn; } private void writeString(String str, ObjectOutputStream dos) throws IOException { if (str == null) { dos.writeInt(-1); } else { byte[] byteArray = str.getBytes(utf8Charset); dos.writeInt(byteArray.length); dos.write(byteArray); } } public void readData(ObjectInputStream dis) { synchronized (commonByteArrayLock_BIO2RDF_bio2rdf_rest_subjob) { try { int length = 0; this.string = readString(dis); this.body = (routines.system.Document) dis.readObject(); } catch (IOException e) { throw new RuntimeException(e); } catch (ClassNotFoundException eCNFE) { throw new RuntimeException(eCNFE); } } } public void writeData(ObjectOutputStream dos) { try { // String writeString(this.string, dos); // Document dos.writeObject(this.body); } catch (IOException e) { throw new RuntimeException(e); } } public String toString() { StringBuilder sb = new StringBuilder(); sb.append(super.toString()); sb.append("["); sb.append("string=" + string); sb.append(",body=" + String.valueOf(body)); sb.append("]"); return sb.toString(); } /** * Compare keys */ public int compareTo(row2Struct other) { int returnValue = -1; return returnValue; } private int checkNullsAndCompare(Object object1, Object object2) { int returnValue = 0; if (object1 instanceof Comparable && object2 instanceof Comparable) { returnValue = ((Comparable) object1).compareTo(object2); } else if (object1 != null && object2 != null) { returnValue = compareStrings(object1.toString(), object2.toString()); } else if (object1 == null && object2 != null) { returnValue = 1; } else if (object1 != null && object2 == null) { returnValue = -1; } else { returnValue = 0; } return returnValue; } private int compareStrings(String string1, String string2) { return string1.compareTo(string2); } } public static class out1Struct implements routines.system.IPersistableRow<out1Struct> { final static byte[] commonByteArrayLock_BIO2RDF_bio2rdf_rest_subjob = new byte[0]; static byte[] commonByteArray_BIO2RDF_bio2rdf_rest_subjob = new byte[0]; public String sparql; public String getSparql() { return this.sparql; } private String readString(ObjectInputStream dis) throws IOException { String strReturn = null; int length = 0; length = dis.readInt(); if (length == -1) { strReturn = null; } else { if (length > commonByteArray_BIO2RDF_bio2rdf_rest_subjob.length) { if (length < 1024 && commonByteArray_BIO2RDF_bio2rdf_rest_subjob.length == 0) { commonByteArray_BIO2RDF_bio2rdf_rest_subjob = new byte[1024]; } else { commonByteArray_BIO2RDF_bio2rdf_rest_subjob = new byte[2 * length]; } } dis.readFully(commonByteArray_BIO2RDF_bio2rdf_rest_subjob, 0, length); strReturn = new String( commonByteArray_BIO2RDF_bio2rdf_rest_subjob, 0, length, utf8Charset); } return strReturn; } private void writeString(String str, ObjectOutputStream dos) throws IOException { if (str == null) { dos.writeInt(-1); } else { byte[] byteArray = str.getBytes(utf8Charset); dos.writeInt(byteArray.length); dos.write(byteArray); } } public void readData(ObjectInputStream dis) { synchronized (commonByteArrayLock_BIO2RDF_bio2rdf_rest_subjob) { try { int length = 0; this.sparql = readString(dis); } catch (IOException e) { throw new RuntimeException(e); } } } public void writeData(ObjectOutputStream dos) { try { // String writeString(this.sparql, dos); } catch (IOException e) { throw new RuntimeException(e); } } public String toString() { StringBuilder sb = new StringBuilder(); sb.append(super.toString()); sb.append("["); sb.append("sparql=" + sparql); sb.append("]"); return sb.toString(); } /** * Compare keys */ public int compareTo(out1Struct other) { int returnValue = -1; return returnValue; } private int checkNullsAndCompare(Object object1, Object object2) { int returnValue = 0; if (object1 instanceof Comparable && object2 instanceof Comparable) { returnValue = ((Comparable) object1).compareTo(object2); } else if (object1 != null && object2 != null) { returnValue = compareStrings(object1.toString(), object2.toString()); } else if (object1 == null && object2 != null) { returnValue = 1; } else if (object1 != null && object2 == null) { returnValue = -1; } else { returnValue = 0; } return returnValue; } private int compareStrings(String string1, String string2) { return string1.compareTo(string2); } } public static class debug1Struct implements routines.system.IPersistableRow<debug1Struct> { final static byte[] commonByteArrayLock_BIO2RDF_bio2rdf_rest_subjob = new byte[0]; static byte[] commonByteArray_BIO2RDF_bio2rdf_rest_subjob = new byte[0]; public String sparql; public String getSparql() { return this.sparql; } private String readString(ObjectInputStream dis) throws IOException { String strReturn = null; int length = 0; length = dis.readInt(); if (length == -1) { strReturn = null; } else { if (length > commonByteArray_BIO2RDF_bio2rdf_rest_subjob.length) { if (length < 1024 && commonByteArray_BIO2RDF_bio2rdf_rest_subjob.length == 0) { commonByteArray_BIO2RDF_bio2rdf_rest_subjob = new byte[1024]; } else { commonByteArray_BIO2RDF_bio2rdf_rest_subjob = new byte[2 * length]; } } dis.readFully(commonByteArray_BIO2RDF_bio2rdf_rest_subjob, 0, length); strReturn = new String( commonByteArray_BIO2RDF_bio2rdf_rest_subjob, 0, length, utf8Charset); } return strReturn; } private void writeString(String str, ObjectOutputStream dos) throws IOException { if (str == null) { dos.writeInt(-1); } else { byte[] byteArray = str.getBytes(utf8Charset); dos.writeInt(byteArray.length); dos.write(byteArray); } } public void readData(ObjectInputStream dis) { synchronized (commonByteArrayLock_BIO2RDF_bio2rdf_rest_subjob) { try { int length = 0; this.sparql = readString(dis); } catch (IOException e) { throw new RuntimeException(e); } } } public void writeData(ObjectOutputStream dos) { try { // String writeString(this.sparql, dos); } catch (IOException e) { throw new RuntimeException(e); } } public String toString() { StringBuilder sb = new StringBuilder(); sb.append(super.toString()); sb.append("["); sb.append("sparql=" + sparql); sb.append("]"); return sb.toString(); } /** * Compare keys */ public int compareTo(debug1Struct other) { int returnValue = -1; return returnValue; } private int checkNullsAndCompare(Object object1, Object object2) { int returnValue = 0; if (object1 instanceof Comparable && object2 instanceof Comparable) { returnValue = ((Comparable) object1).compareTo(object2); } else if (object1 != null && object2 != null) { returnValue = compareStrings(object1.toString(), object2.toString()); } else if (object1 == null && object2 != null) { returnValue = 1; } else if (object1 != null && object2 == null) { returnValue = -1; } else { returnValue = 0; } return returnValue; } private int compareStrings(String string1, String string2) { return string1.compareTo(string2); } } public static class row4Struct implements routines.system.IPersistableRow<row4Struct> { final static byte[] commonByteArrayLock_BIO2RDF_bio2rdf_rest_subjob = new byte[0]; static byte[] commonByteArray_BIO2RDF_bio2rdf_rest_subjob = new byte[0]; public String sparql; public String getSparql() { return this.sparql; } private String readString(ObjectInputStream dis) throws IOException { String strReturn = null; int length = 0; length = dis.readInt(); if (length == -1) { strReturn = null; } else { if (length > commonByteArray_BIO2RDF_bio2rdf_rest_subjob.length) { if (length < 1024 && commonByteArray_BIO2RDF_bio2rdf_rest_subjob.length == 0) { commonByteArray_BIO2RDF_bio2rdf_rest_subjob = new byte[1024]; } else { commonByteArray_BIO2RDF_bio2rdf_rest_subjob = new byte[2 * length]; } } dis.readFully(commonByteArray_BIO2RDF_bio2rdf_rest_subjob, 0, length); strReturn = new String( commonByteArray_BIO2RDF_bio2rdf_rest_subjob, 0, length, utf8Charset); } return strReturn; } private void writeString(String str, ObjectOutputStream dos) throws IOException { if (str == null) { dos.writeInt(-1); } else { byte[] byteArray = str.getBytes(utf8Charset); dos.writeInt(byteArray.length); dos.write(byteArray); } } public void readData(ObjectInputStream dis) { synchronized (commonByteArrayLock_BIO2RDF_bio2rdf_rest_subjob) { try { int length = 0; this.sparql = readString(dis); } catch (IOException e) { throw new RuntimeException(e); } } } public void writeData(ObjectOutputStream dos) { try { // String writeString(this.sparql, dos); } catch (IOException e) { throw new RuntimeException(e); } } public String toString() { StringBuilder sb = new StringBuilder(); sb.append(super.toString()); sb.append("["); sb.append("sparql=" + sparql); sb.append("]"); return sb.toString(); } /** * Compare keys */ public int compareTo(row4Struct other) { int returnValue = -1; return returnValue; } private int checkNullsAndCompare(Object object1, Object object2) { int returnValue = 0; if (object1 instanceof Comparable && object2 instanceof Comparable) { returnValue = ((Comparable) object1).compareTo(object2); } else if (object1 != null && object2 != null) { returnValue = compareStrings(object1.toString(), object2.toString()); } else if (object1 == null && object2 != null) { returnValue = 1; } else if (object1 != null && object2 == null) { returnValue = -1; } else { returnValue = 0; } return returnValue; } private int compareStrings(String string1, String string2) { return string1.compareTo(string2); } } public static class row1Struct implements routines.system.IPersistableRow<row1Struct> { final static byte[] commonByteArrayLock_BIO2RDF_bio2rdf_rest_subjob = new byte[0]; static byte[] commonByteArray_BIO2RDF_bio2rdf_rest_subjob = new byte[0]; public String sparql; public String getSparql() { return this.sparql; } private String readString(ObjectInputStream dis) throws IOException { String strReturn = null; int length = 0; length = dis.readInt(); if (length == -1) { strReturn = null; } else { if (length > commonByteArray_BIO2RDF_bio2rdf_rest_subjob.length) { if (length < 1024 && commonByteArray_BIO2RDF_bio2rdf_rest_subjob.length == 0) { commonByteArray_BIO2RDF_bio2rdf_rest_subjob = new byte[1024]; } else { commonByteArray_BIO2RDF_bio2rdf_rest_subjob = new byte[2 * length]; } } dis.readFully(commonByteArray_BIO2RDF_bio2rdf_rest_subjob, 0, length); strReturn = new String( commonByteArray_BIO2RDF_bio2rdf_rest_subjob, 0, length, utf8Charset); } return strReturn; } private void writeString(String str, ObjectOutputStream dos) throws IOException { if (str == null) { dos.writeInt(-1); } else { byte[] byteArray = str.getBytes(utf8Charset); dos.writeInt(byteArray.length); dos.write(byteArray); } } public void readData(ObjectInputStream dis) { synchronized (commonByteArrayLock_BIO2RDF_bio2rdf_rest_subjob) { try { int length = 0; this.sparql = readString(dis); } catch (IOException e) { throw new RuntimeException(e); } } } public void writeData(ObjectOutputStream dos) { try { // String writeString(this.sparql, dos); } catch (IOException e) { throw new RuntimeException(e); } } public String toString() { StringBuilder sb = new StringBuilder(); sb.append(super.toString()); sb.append("["); sb.append("sparql=" + sparql); sb.append("]"); return sb.toString(); } /** * Compare keys */ public int compareTo(row1Struct other) { int returnValue = -1; return returnValue; } private int checkNullsAndCompare(Object object1, Object object2) { int returnValue = 0; if (object1 instanceof Comparable && object2 instanceof Comparable) { returnValue = ((Comparable) object1).compareTo(object2); } else if (object1 != null && object2 != null) { returnValue = compareStrings(object1.toString(), object2.toString()); } else if (object1 == null && object2 != null) { returnValue = 1; } else if (object1 != null && object2 == null) { returnValue = -1; } else { returnValue = 0; } return returnValue; } private int compareStrings(String string1, String string2) { return string1.compareTo(string2); } } public static class row3Struct implements routines.system.IPersistableRow<row3Struct> { final static byte[] commonByteArrayLock_BIO2RDF_bio2rdf_rest_subjob = new byte[0]; static byte[] commonByteArray_BIO2RDF_bio2rdf_rest_subjob = new byte[0]; public String sparql; public String getSparql() { return this.sparql; } private String readString(ObjectInputStream dis) throws IOException { String strReturn = null; int length = 0; length = dis.readInt(); if (length == -1) { strReturn = null; } else { if (length > commonByteArray_BIO2RDF_bio2rdf_rest_subjob.length) { if (length < 1024 && commonByteArray_BIO2RDF_bio2rdf_rest_subjob.length == 0) { commonByteArray_BIO2RDF_bio2rdf_rest_subjob = new byte[1024]; } else { commonByteArray_BIO2RDF_bio2rdf_rest_subjob = new byte[2 * length]; } } dis.readFully(commonByteArray_BIO2RDF_bio2rdf_rest_subjob, 0, length); strReturn = new String( commonByteArray_BIO2RDF_bio2rdf_rest_subjob, 0, length, utf8Charset); } return strReturn; } private void writeString(String str, ObjectOutputStream dos) throws IOException { if (str == null) { dos.writeInt(-1); } else { byte[] byteArray = str.getBytes(utf8Charset); dos.writeInt(byteArray.length); dos.write(byteArray); } } public void readData(ObjectInputStream dis) { synchronized (commonByteArrayLock_BIO2RDF_bio2rdf_rest_subjob) { try { int length = 0; this.sparql = readString(dis); } catch (IOException e) { throw new RuntimeException(e); } } } public void writeData(ObjectOutputStream dos) { try { // String writeString(this.sparql, dos); } catch (IOException e) { throw new RuntimeException(e); } } public String toString() { StringBuilder sb = new StringBuilder(); sb.append(super.toString()); sb.append("["); sb.append("sparql=" + sparql); sb.append("]"); return sb.toString(); } /** * Compare keys */ public int compareTo(row3Struct other) { int returnValue = -1; return returnValue; } private int checkNullsAndCompare(Object object1, Object object2) { int returnValue = 0; if (object1 instanceof Comparable && object2 instanceof Comparable) { returnValue = ((Comparable) object1).compareTo(object2); } else if (object1 != null && object2 != null) { returnValue = compareStrings(object1.toString(), object2.toString()); } else if (object1 == null && object2 != null) { returnValue = 1; } else if (object1 != null && object2 == null) { returnValue = -1; } else { returnValue = 0; } return returnValue; } private int compareStrings(String string1, String string2) { return string1.compareTo(string2); } } public void tSparqlSelectRequest_1Process( final java.util.Map<String, Object> globalMap) throws TalendException { globalMap.put("tSparqlSelectRequest_1_SUBPROCESS_STATE", 0); final boolean execStat = this.execStat; String iterateId = ""; int iterateLoop = 0; String currentComponent = ""; java.util.Map<String, Object> resourceMap = new java.util.HashMap<String, Object>(); try { String currentMethodName = new java.lang.Exception() .getStackTrace()[0].getMethodName(); boolean resumeIt = currentMethodName.equals(resumeEntryMethodName); if (resumeEntryMethodName == null || resumeIt || globalResumeTicket) {// start // the // resume globalResumeTicket = true; row3Struct row3 = new row3Struct(); row1Struct row1 = new row1Struct(); row1Struct row4 = row1; out1Struct out1 = new out1Struct(); row2Struct row2 = new row2Struct(); out3Struct out3 = new out3Struct(); debug2Struct debug2 = new debug2Struct(); debug1Struct debug1 = new debug1Struct(); /** * [tFlowToIterate_2 begin ] start */ int NB_ITERATE_tRunJob_1 = 0; // for statistics ok_Hash.put("tFlowToIterate_2", false); start_Hash.put("tFlowToIterate_2", System.currentTimeMillis()); currentComponent = "tFlowToIterate_2"; int tos_count_tFlowToIterate_2 = 0; int nb_line_tFlowToIterate_2 = 0; int counter_tFlowToIterate_2 = 0; /** * [tFlowToIterate_2 begin ] stop */ /** * [tLogRow_1 begin ] start */ ok_Hash.put("tLogRow_1", false); start_Hash.put("tLogRow_1", System.currentTimeMillis()); currentComponent = "tLogRow_1"; int tos_count_tLogRow_1 = 0; // ///////////////////// final String OUTPUT_FIELD_SEPARATOR_tLogRow_1 = "|"; java.io.PrintStream consoleOut_tLogRow_1 = null; StringBuilder strBuffer_tLogRow_1 = null; int nb_line_tLogRow_1 = 0; // ///////////////////// /** * [tLogRow_1 begin ] stop */ /** * [tMap_1 begin ] start */ ok_Hash.put("tMap_1", false); start_Hash.put("tMap_1", System.currentTimeMillis()); currentComponent = "tMap_1"; int tos_count_tMap_1 = 0; // ############################### // # Lookup's keys initialization // ############################### // ############################### // # Vars initialization class Var__tMap_1__Struct { } Var__tMap_1__Struct Var__tMap_1 = new Var__tMap_1__Struct(); // ############################### // ############################### // # Outputs initialization out1Struct out1_tmp = new out1Struct(); debug1Struct debug1_tmp = new debug1Struct(); // ############################### /** * [tMap_1 begin ] stop */ /** * [tLogRow_3 begin ] start */ ok_Hash.put("tLogRow_3", false); start_Hash.put("tLogRow_3", System.currentTimeMillis()); currentComponent = "tLogRow_3"; int tos_count_tLogRow_3 = 0; // ///////////////////// final String OUTPUT_FIELD_SEPARATOR_tLogRow_3 = "|"; java.io.PrintStream consoleOut_tLogRow_3 = null; StringBuilder strBuffer_tLogRow_3 = null; int nb_line_tLogRow_3 = 0; // ///////////////////// /** * [tLogRow_3 begin ] stop */ /** * [tReplace_1 begin ] start */ ok_Hash.put("tReplace_1", false); start_Hash.put("tReplace_1", System.currentTimeMillis()); currentComponent = "tReplace_1"; int tos_count_tReplace_1 = 0; int nb_line_tReplace_1 = 0; /** * [tReplace_1 begin ] stop */ /** * [tSparqlSelectRequest_1 begin ] start */ ok_Hash.put("tSparqlSelectRequest_1", false); start_Hash.put("tSparqlSelectRequest_1", System.currentTimeMillis()); currentComponent = "tSparqlSelectRequest_1"; int tos_count_tSparqlSelectRequest_1 = 0; String URL_string_tSparqlSelectRequest_1; URL_string_tSparqlSelectRequest_1 = context.database_endpoint + "?default-graph-uri=&query=" + java.net.URLEncoder .encode("select ?sparql where { <http://bio2rdf.org/namespace:" + context.namespace + "> <http://bio2rdf.org/bio2rdf_vocabulary:sparql_" + context.request + "> ?sparql . }", "UTF-8") + "&format=application%2Fsparql-results%2Bjson&timeout=0&debug=on"; org.json.JSONArray jsonArray_tSparqlSelectRequest_1 = new org.json.JSONArray(); org.json.JSONArray jsonKeysArray_tSparqlSelectRequest_1; java.util.ArrayList<String> queryKeys_tSparqlSelectRequest_1 = new java.util.ArrayList<String>(); // ArrayList that will contain the key value of the query sorted // correctly org.json.JSONObject jsonObj_tSparqlSelectRequest_1; java.util.Iterator<String> queryKeysIterator_tSparqlSelectRequest_1; java.net.URL url_tSparqlSelectRequest_1 = new java.net.URL( URL_string_tSparqlSelectRequest_1); java.net.HttpURLConnection urlConn_tSparqlSelectRequest_1 = (java.net.HttpURLConnection) url_tSparqlSelectRequest_1 .openConnection(); urlConn_tSparqlSelectRequest_1.setRequestMethod("GET"); urlConn_tSparqlSelectRequest_1.setDoOutput(true); urlConn_tSparqlSelectRequest_1.setDoInput(true); urlConn_tSparqlSelectRequest_1.setUseCaches(false); try { urlConn_tSparqlSelectRequest_1.connect(); byte[] buffer_tSparqlSelectRequest_1 = new byte[1024]; int bos_buffer_tSparqlSelectRequest_1 = 0; StringBuilder sb_tSparqlSelectRequest_1 = new StringBuilder(); if (java.net.HttpURLConnection.HTTP_OK == (urlConn_tSparqlSelectRequest_1 .getResponseCode())) { java.io.InputStream bis_tSparqlSelectRequest_1 = new java.io.BufferedInputStream( urlConn_tSparqlSelectRequest_1.getInputStream()); while ((bos_buffer_tSparqlSelectRequest_1 = bis_tSparqlSelectRequest_1 .read(buffer_tSparqlSelectRequest_1)) != -1) { // Then the table of bytes and its size are used to // generate a string // which is added to a string builder that will // contain the whole response sb_tSparqlSelectRequest_1.append(new String( buffer_tSparqlSelectRequest_1, 0, bos_buffer_tSparqlSelectRequest_1)); } bis_tSparqlSelectRequest_1.close(); } else { System.err.println(urlConn_tSparqlSelectRequest_1 .getResponseCode() + " " + urlConn_tSparqlSelectRequest_1 .getResponseMessage()); } urlConn_tSparqlSelectRequest_1.disconnect(); jsonObj_tSparqlSelectRequest_1 = new org.json.JSONObject( sb_tSparqlSelectRequest_1.toString()); jsonKeysArray_tSparqlSelectRequest_1 = jsonObj_tSparqlSelectRequest_1 .getJSONObject("head").getJSONArray("vars"); for (int k_tSparqlSelectRequest_1 = 0; k_tSparqlSelectRequest_1 < jsonKeysArray_tSparqlSelectRequest_1 .length(); k_tSparqlSelectRequest_1++) { queryKeys_tSparqlSelectRequest_1 .add(jsonKeysArray_tSparqlSelectRequest_1 .getString(k_tSparqlSelectRequest_1)); } jsonArray_tSparqlSelectRequest_1 = jsonObj_tSparqlSelectRequest_1 .getJSONObject("results").getJSONArray("bindings"); } catch (Exception e) { System.err.println("UnknownHostException"); } if (jsonArray_tSparqlSelectRequest_1.length() == 0) { globalMap.put("tSparqlSelectRequest_1_HAS_RESULTS", false); } else { globalMap.put("tSparqlSelectRequest_1_HAS_RESULTS", true); } int i_tSparqlSelectRequest_1; int nb_line_tSparqlSelectRequest_1 = 0; for (i_tSparqlSelectRequest_1 = 0; i_tSparqlSelectRequest_1 < jsonArray_tSparqlSelectRequest_1 .length(); i_tSparqlSelectRequest_1++) { /** * [tSparqlSelectRequest_1 begin ] stop */ /** * [tSparqlSelectRequest_1 main ] start */ currentComponent = "tSparqlSelectRequest_1"; queryKeysIterator_tSparqlSelectRequest_1 = queryKeys_tSparqlSelectRequest_1 .iterator(); if (queryKeysIterator_tSparqlSelectRequest_1.hasNext()) { try { row3.sparql = jsonArray_tSparqlSelectRequest_1 .getJSONObject(i_tSparqlSelectRequest_1) .getJSONObject( queryKeysIterator_tSparqlSelectRequest_1 .next()).getString("value"); } catch (org.json.JSONException e_tSparqlSelectRequest_1) { row3.sparql = ""; } } tos_count_tSparqlSelectRequest_1++; /** * [tSparqlSelectRequest_1 main ] stop */ /** * [tReplace_1 main ] start */ currentComponent = "tReplace_1"; String searchStr_tReplace_1_1 = "$NSID$" + ""; row3.sparql = StringUtils.replaceAllStrictly(row3.sparql, searchStr_tReplace_1_1, context.ns + ":" + context.id + "", false, false); String searchStr_tReplace_1_2 = "$ID$" + ""; row3.sparql = StringUtils.replaceAllStrictly(row3.sparql, searchStr_tReplace_1_2, context.id + "", false, false); String searchStr_tReplace_1_3 = "$NS$" + ""; row3.sparql = StringUtils.replaceAllStrictly(row3.sparql, searchStr_tReplace_1_3, context.ns + "", false, false); String searchStr_tReplace_1_4 = "$QUERY$" + ""; row3.sparql = StringUtils.replaceAllStrictly(row3.sparql, searchStr_tReplace_1_4, context.query + "", false, false); String searchStr_tReplace_1_5 = "$URI$" + ""; row3.sparql = StringUtils.replaceAllStrictly(row3.sparql, searchStr_tReplace_1_5, context.uri + "", false, false); String searchStr_tReplace_1_6 = "$PARM1$" + ""; row3.sparql = StringUtils.replaceAllStrictly(row3.sparql, searchStr_tReplace_1_6, context.parm1 + "", false, false); String searchStr_tReplace_1_7 = "$PARM2$" + ""; row3.sparql = StringUtils.replaceAllStrictly(row3.sparql, searchStr_tReplace_1_7, context.parm2 + "", false, false); String searchStr_tReplace_1_8 = "$PARM3$" + ""; row3.sparql = StringUtils.replaceAllStrictly(row3.sparql, searchStr_tReplace_1_8, context.parm3 + "", false, false); String searchStr_tReplace_1_9 = "#" + ""; row3.sparql = StringUtils.replaceAllStrictly(row3.sparql, searchStr_tReplace_1_9, "%23" + "", false, false); row1.sparql = row3.sparql; nb_line_tReplace_1++; tos_count_tReplace_1++; /** * [tReplace_1 main ] stop */ /** * [tLogRow_3 main ] start */ currentComponent = "tLogRow_3"; // ///////////////////// strBuffer_tLogRow_3 = new StringBuilder(); if (row1.sparql != null) { // strBuffer_tLogRow_3.append(String.valueOf(row1.sparql)); } // if (globalMap.get("tLogRow_CONSOLE") != null) { consoleOut_tLogRow_3 = (java.io.PrintStream) globalMap .get("tLogRow_CONSOLE"); } else { consoleOut_tLogRow_3 = new java.io.PrintStream( new java.io.BufferedOutputStream(System.out)); globalMap.put("tLogRow_CONSOLE", consoleOut_tLogRow_3); } consoleOut_tLogRow_3 .println(strBuffer_tLogRow_3.toString()); consoleOut_tLogRow_3.flush(); nb_line_tLogRow_3++; // //// // //// // ///////////////////// row4 = row1; tos_count_tLogRow_3++; /** * [tLogRow_3 main ] stop */ /** * [tMap_1 main ] start */ currentComponent = "tMap_1"; boolean hasCasePrimitiveKeyWithNull_tMap_1 = false; // ############################### // # Input tables (lookups) boolean rejectedInnerJoin_tMap_1 = false; boolean mainRowRejected_tMap_1 = false; // ############################### { // start of Var scope // ############################### // # Vars tables Var__tMap_1__Struct Var = Var__tMap_1;// ############################### // ############################### // # Output tables out1 = null; debug1 = null; // # Output table : 'out1' out1_tmp.sparql = row4.sparql; out1 = out1_tmp; // # Output table : 'debug1' // # Filter conditions if ( context.debug ) { debug1_tmp.sparql = row4.sparql; debug1 = debug1_tmp; } // closing filter/reject // ############################### } // end of Var scope rejectedInnerJoin_tMap_1 = false; tos_count_tMap_1++; /** * [tMap_1 main ] stop */ // Start of branch "out1" if (out1 != null) { /** * [tFlowToIterate_2 main ] start */ currentComponent = "tFlowToIterate_2"; globalMap.put("out1.sparql", out1.sparql); nb_line_tFlowToIterate_2++; counter_tFlowToIterate_2++; globalMap.put("tFlowToIterate_2_CURRENT_ITERATION", counter_tFlowToIterate_2); tos_count_tFlowToIterate_2++; /** * [tFlowToIterate_2 main ] stop */ NB_ITERATE_tRunJob_1++; iterateLoop++; /** * [tBufferOutput_1 begin ] start */ ok_Hash.put("tBufferOutput_1", false); start_Hash.put("tBufferOutput_1", System.currentTimeMillis()); currentComponent = "tBufferOutput_1"; int tos_count_tBufferOutput_1 = 0; /** * [tBufferOutput_1 begin ] stop */ /** * [tLogRow_2 begin ] start */ ok_Hash.put("tLogRow_2", false); start_Hash.put("tLogRow_2", System.currentTimeMillis()); currentComponent = "tLogRow_2"; int tos_count_tLogRow_2 = 0; // ///////////////////// final String OUTPUT_FIELD_SEPARATOR_tLogRow_2 = "|"; java.io.PrintStream consoleOut_tLogRow_2 = null; StringBuilder strBuffer_tLogRow_2 = null; int nb_line_tLogRow_2 = 0; // ///////////////////// /** * [tLogRow_2 begin ] stop */ /** * [tMap_2 begin ] start */ ok_Hash.put("tMap_2", false); start_Hash.put("tMap_2", System.currentTimeMillis()); currentComponent = "tMap_2"; int tos_count_tMap_2 = 0; // ############################### // # Lookup's keys initialization // ############################### // ############################### // # Vars initialization class Var__tMap_2__Struct { } Var__tMap_2__Struct Var__tMap_2 = new Var__tMap_2__Struct(); // ############################### // ############################### // # Outputs initialization out3Struct out3_tmp = new out3Struct(); debug2Struct debug2_tmp = new debug2Struct(); // ############################### /** * [tMap_2 begin ] stop */ /** * [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; /** * [tRunJob_1 begin ] stop */ /** * [tRunJob_1 main ] start */ currentComponent = "tRunJob_1"; java.util.List<String> paraList_tRunJob_1 = new java.util.ArrayList<String>(); 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"); // for feature:10589 paraList_tRunJob_1.add("--stat_port=" + portStats); 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>(); Object obj_tRunJob_1 = null; obj_tRunJob_1 = row1.sparql; paraList_tRunJob_1.add("--context_param rdf_url=" + RuntimeUtils .tRunJobConvertContext(obj_tRunJob_1)); parentContextMap_tRunJob_1 .put("rdf_url", obj_tRunJob_1); obj_tRunJob_1 = context.format; paraList_tRunJob_1.add("--context_param formatOut=" + RuntimeUtils .tRunJobConvertContext(obj_tRunJob_1)); parentContextMap_tRunJob_1.put("formatOut", obj_tRunJob_1); bio2rdf.rdfxml_reader_converter_1_7.rdfxml_reader_converter childJob_tRunJob_1 = new bio2rdf.rdfxml_reader_converter_1_7.rdfxml_reader_converter(); // pass DataSources java.util.Map<String, routines.system.TalendDataSource> talendDataSources_tRunJob_1 = (java.util.Map<String, routines.system.TalendDataSource>) globalMap .get(KEY_DB_DATASOURCES); if (null != talendDataSources_tRunJob_1) { java.util.Map<String, javax.sql.DataSource> dataSources_tRunJob_1 = new java.util.HashMap<String, javax.sql.DataSource>(); for (java.util.Map.Entry<String, routines.system.TalendDataSource> talendDataSourceEntry_tRunJob_1 : talendDataSources_tRunJob_1 .entrySet()) { dataSources_tRunJob_1.put( talendDataSourceEntry_tRunJob_1 .getKey(), talendDataSourceEntry_tRunJob_1 .getValue().getRawDataSource()); } childJob_tRunJob_1 .setDataSources(dataSources_tRunJob_1); } childJob_tRunJob_1.parentContextMap = parentContextMap_tRunJob_1; String[][] childReturn_tRunJob_1 = childJob_tRunJob_1 .runJob((String[]) paraList_tRunJob_1 .toArray(new String[paraList_tRunJob_1 .size()])); errorCode = childJob_tRunJob_1.getErrorCode(); if (childJob_tRunJob_1.getErrorCode() == null) { globalMap.put( "tRunJob_1_CHILD_RETURN_CODE", childJob_tRunJob_1.getStatus() != null && ("failure") .equals(childJob_tRunJob_1 .getStatus()) ? 1 : 0); } else { globalMap.put("tRunJob_1_CHILD_RETURN_CODE", childJob_tRunJob_1.getErrorCode()); } if (childJob_tRunJob_1.getExceptionStackTrace() != null) { globalMap .put("tRunJob_1_CHILD_EXCEPTION_STACKTRACE", childJob_tRunJob_1 .getExceptionStackTrace()); } for (String[] item_tRunJob_1 : childReturn_tRunJob_1) { if (childJob_tRunJob_1.hastBufferOutputComponent() || true) { if (0 < item_tRunJob_1.length) { row2.string = item_tRunJob_1[0]; } else { row2.string = null; } if (1 < item_tRunJob_1.length) { row2.body = ParserUtils .parseTo_Document(item_tRunJob_1[1]); } else { row2.body = null; } } tos_count_tRunJob_1++; /** * [tRunJob_1 main ] stop */ /** * [tMap_2 main ] start */ currentComponent = "tMap_2"; boolean hasCasePrimitiveKeyWithNull_tMap_2 = false; // ############################### // # Input tables (lookups) boolean rejectedInnerJoin_tMap_2 = false; boolean mainRowRejected_tMap_2 = false; // ############################### { // start of Var scope // ############################### // # Vars tables Var__tMap_2__Struct Var = Var__tMap_2;// ############################### // ############################### // # Output tables out3 = null; debug2 = null; // # Output table : 'out3' out3_tmp.string = row2.string; out3_tmp.body = row2.body; out3 = out3_tmp; // # Output table : 'debug2' // # Filter conditions if ( context.debug ) { debug2_tmp.string = row2.string; debug2_tmp.body = row2.body; debug2 = debug2_tmp; } // closing filter/reject // ############################### } // end of Var scope rejectedInnerJoin_tMap_2 = false; tos_count_tMap_2++; /** * [tMap_2 main ] stop */ // Start of branch "out3" if (out3 != null) { /** * [tBufferOutput_1 main ] start */ currentComponent = "tBufferOutput_1"; String[] row_tBufferOutput_1 = new String[] { "", "", }; if (out3.string != null) { row_tBufferOutput_1[0] = out3.string; } else { row_tBufferOutput_1[0] = null; } if (out3.body != null) { row_tBufferOutput_1[1] = String .valueOf(out3.body); } else { row_tBufferOutput_1[1] = null; } globalBuffer.add(row_tBufferOutput_1); tos_count_tBufferOutput_1++; /** * [tBufferOutput_1 main ] stop */ } // End of branch "out3" // Start of branch "debug2" if (debug2 != null) { /** * [tLogRow_2 main ] start */ currentComponent = "tLogRow_2"; // ///////////////////// strBuffer_tLogRow_2 = new StringBuilder(); if (debug2.string != null) { // strBuffer_tLogRow_2.append(String .valueOf(debug2.string)); } // strBuffer_tLogRow_2.append("|"); if (debug2.body != null) { // strBuffer_tLogRow_2.append(String .valueOf(debug2.body)); } // if (globalMap.get("tLogRow_CONSOLE") != null) { consoleOut_tLogRow_2 = (java.io.PrintStream) globalMap .get("tLogRow_CONSOLE"); } else { consoleOut_tLogRow_2 = new java.io.PrintStream( new java.io.BufferedOutputStream( System.out)); globalMap.put("tLogRow_CONSOLE", consoleOut_tLogRow_2); } consoleOut_tLogRow_2 .println(strBuffer_tLogRow_2.toString()); consoleOut_tLogRow_2.flush(); nb_line_tLogRow_2++; // //// // //// // ///////////////////// tos_count_tLogRow_2++; /** * [tLogRow_2 main ] stop */ } // End of branch "debug2" } // C_01 /** * [tRunJob_1 end ] start */ currentComponent = "tRunJob_1"; ok_Hash.put("tRunJob_1", true); end_Hash.put("tRunJob_1", System.currentTimeMillis()); /** * [tRunJob_1 end ] stop */ /** * [tMap_2 end ] start */ currentComponent = "tMap_2"; // ############################### // # Lookup hashes releasing // ############################### ok_Hash.put("tMap_2", true); end_Hash.put("tMap_2", System.currentTimeMillis()); /** * [tMap_2 end ] stop */ /** * [tBufferOutput_1 end ] start */ currentComponent = "tBufferOutput_1"; ok_Hash.put("tBufferOutput_1", true); end_Hash.put("tBufferOutput_1", System.currentTimeMillis()); /** * [tBufferOutput_1 end ] stop */ /** * [tLogRow_2 end ] start */ currentComponent = "tLogRow_2"; // //// // //// globalMap.put("tLogRow_2_NB_LINE", nb_line_tLogRow_2); // ///////////////////// ok_Hash.put("tLogRow_2", true); end_Hash.put("tLogRow_2", System.currentTimeMillis()); /** * [tLogRow_2 end ] stop */ } // End of branch "out1" // Start of branch "debug1" if (debug1 != null) { /** * [tLogRow_1 main ] start */ currentComponent = "tLogRow_1"; // ///////////////////// strBuffer_tLogRow_1 = new StringBuilder(); if (debug1.sparql != null) { // strBuffer_tLogRow_1.append(String .valueOf(debug1.sparql)); } // if (globalMap.get("tLogRow_CONSOLE") != null) { consoleOut_tLogRow_1 = (java.io.PrintStream) globalMap .get("tLogRow_CONSOLE"); } else { consoleOut_tLogRow_1 = new java.io.PrintStream( new java.io.BufferedOutputStream(System.out)); globalMap.put("tLogRow_CONSOLE", consoleOut_tLogRow_1); } consoleOut_tLogRow_1.println(strBuffer_tLogRow_1 .toString()); consoleOut_tLogRow_1.flush(); nb_line_tLogRow_1++; // //// // //// // ///////////////////// tos_count_tLogRow_1++; /** * [tLogRow_1 main ] stop */ } // End of branch "debug1" /** * [tSparqlSelectRequest_1 end ] start */ currentComponent = "tSparqlSelectRequest_1"; nb_line_tSparqlSelectRequest_1++; } globalMap.put("tSparqlSelectRequest_1_NB_LINE", nb_line_tSparqlSelectRequest_1); ok_Hash.put("tSparqlSelectRequest_1", true); end_Hash.put("tSparqlSelectRequest_1", System.currentTimeMillis()); /** * [tSparqlSelectRequest_1 end ] stop */ /** * [tReplace_1 end ] start */ currentComponent = "tReplace_1"; globalMap.put("tReplace_1_NB_LINE", nb_line_tReplace_1); ok_Hash.put("tReplace_1", true); end_Hash.put("tReplace_1", System.currentTimeMillis()); /** * [tReplace_1 end ] stop */ /** * [tLogRow_3 end ] start */ currentComponent = "tLogRow_3"; // //// // //// globalMap.put("tLogRow_3_NB_LINE", nb_line_tLogRow_3); // ///////////////////// ok_Hash.put("tLogRow_3", true); end_Hash.put("tLogRow_3", System.currentTimeMillis()); /** * [tLogRow_3 end ] stop */ /** * [tMap_1 end ] start */ currentComponent = "tMap_1"; // ############################### // # Lookup hashes releasing // ############################### ok_Hash.put("tMap_1", true); end_Hash.put("tMap_1", System.currentTimeMillis()); /** * [tMap_1 end ] stop */ /** * [tFlowToIterate_2 end ] start */ currentComponent = "tFlowToIterate_2"; globalMap.put("tFlowToIterate_2_NB_LINE", nb_line_tFlowToIterate_2); ok_Hash.put("tFlowToIterate_2", true); end_Hash.put("tFlowToIterate_2", System.currentTimeMillis()); /** * [tFlowToIterate_2 end ] stop */ /** * [tLogRow_1 end ] start */ currentComponent = "tLogRow_1"; // //// // //// globalMap.put("tLogRow_1_NB_LINE", nb_line_tLogRow_1); // ///////////////////// ok_Hash.put("tLogRow_1", true); end_Hash.put("tLogRow_1", System.currentTimeMillis()); /** * [tLogRow_1 end ] stop */ }// end the resume } catch (java.lang.Exception e) { TalendException te = new TalendException(e, currentComponent, globalMap); throw te; } catch (java.lang.Error error) { throw error; } finally { try { /** * [tSparqlSelectRequest_1 finally ] start */ currentComponent = "tSparqlSelectRequest_1"; /** * [tSparqlSelectRequest_1 finally ] stop */ /** * [tReplace_1 finally ] start */ currentComponent = "tReplace_1"; /** * [tReplace_1 finally ] stop */ /** * [tLogRow_3 finally ] start */ currentComponent = "tLogRow_3"; /** * [tLogRow_3 finally ] stop */ /** * [tMap_1 finally ] start */ currentComponent = "tMap_1"; /** * [tMap_1 finally ] stop */ /** * [tFlowToIterate_2 finally ] start */ currentComponent = "tFlowToIterate_2"; /** * [tFlowToIterate_2 finally ] stop */ /** * [tRunJob_1 finally ] start */ currentComponent = "tRunJob_1"; /** * [tRunJob_1 finally ] stop */ /** * [tMap_2 finally ] start */ currentComponent = "tMap_2"; /** * [tMap_2 finally ] stop */ /** * [tBufferOutput_1 finally ] start */ currentComponent = "tBufferOutput_1"; /** * [tBufferOutput_1 finally ] stop */ /** * [tLogRow_2 finally ] start */ currentComponent = "tLogRow_2"; /** * [tLogRow_2 finally ] stop */ /** * [tLogRow_1 finally ] start */ currentComponent = "tLogRow_1"; /** * [tLogRow_1 finally ] stop */ } catch (java.lang.Exception e) { // ignore } catch (java.lang.Error error) { // ignore } resourceMap = null; } globalMap.put("tSparqlSelectRequest_1_SUBPROCESS_STATE", 1); } public String resuming_logs_dir_path = null; public String resuming_checkpoint_path = null; public String parent_part_launcher = null; private String resumeEntryMethodName = null; private boolean globalResumeTicket = false; public boolean watch = false; // portStats is null, it means don't execute the statistics public Integer portStats = null; public int portTraces = 4334; public String clientHost; public String defaultClientHost = "localhost"; public String contextStr = "Default"; public boolean isDefaultContext = true; public String pid = "0"; public String rootPid = null; public String fatherPid = null; public String fatherNode = null; public long startTime = 0; public boolean isChildJob = false; public String log4jLevel = ""; private boolean execStat = true; private ThreadLocal<java.util.Map<String, String>> threadLocal = new ThreadLocal<java.util.Map<String, String>>() { protected java.util.Map<String, String> initialValue() { java.util.Map<String, String> threadRunResultMap = new java.util.HashMap<String, String>(); threadRunResultMap.put("errorCode", null); threadRunResultMap.put("status", ""); return threadRunResultMap; }; }; private java.util.Properties context_param = new java.util.Properties(); public java.util.Map<String, Object> parentContextMap = new java.util.HashMap<String, Object>(); public String status = ""; public static void main(String[] args) { final bio2rdf_rest_subjob bio2rdf_rest_subjobClass = new bio2rdf_rest_subjob(); int exitCode = bio2rdf_rest_subjobClass.runJobInTOS(args); System.exit(exitCode); } public String[][] runJob(String[] args) { int exitCode = runJobInTOS(args); String[][] bufferValue = (String[][]) globalBuffer .toArray(new String[globalBuffer.size()][]); return bufferValue; } public boolean hastBufferOutputComponent() { boolean hastBufferOutput = false; hastBufferOutput = true; return hastBufferOutput; } public int runJobInTOS(String[] args) { // reset status status = ""; String lastStr = ""; for (String arg : args) { if (arg.equalsIgnoreCase("--context_param")) { lastStr = arg; } else if (lastStr.equals("")) { evalParam(arg); } else { evalParam(lastStr + " " + arg); lastStr = ""; } } if (clientHost == null) { clientHost = defaultClientHost; } if (pid == null || "0".equals(pid)) { pid = TalendString.getAsciiRandomString(6); } if (rootPid == null) { rootPid = pid; } if (fatherPid == null) { fatherPid = pid; } else { isChildJob = true; } try { // call job/subjob with an existing context, like: // --context=production. if without this parameter, there will use // the default context instead. java.io.InputStream inContext = bio2rdf_rest_subjob.class .getClassLoader().getResourceAsStream( "bio2rdf/bio2rdf_rest_subjob_1_7/contexts/" + contextStr + ".properties"); if (isDefaultContext && inContext == null) { } else { if (inContext != null) { // defaultProps is in order to keep the original context // value defaultProps.load(inContext); inContext.close(); context = new ContextProperties(defaultProps); } else { // print info and job continue to run, for case: // context_param is not empty. System.err.println("Could not find the context " + contextStr); } } if (!context_param.isEmpty()) { context.putAll(context_param); } context.namespace = (String) context.getProperty("namespace"); context.ns = (String) context.getProperty("ns"); context.id = (String) context.getProperty("id"); context.format = (String) context.getProperty("format"); context.query = (String) context.getProperty("query"); context.request = (String) context.getProperty("request"); try { context.debug = routines.system.ParserUtils .parseTo_Boolean(context.getProperty("debug")); } catch (NumberFormatException e) { context.debug = null; } context.database_endpoint = (String) context .getProperty("database_endpoint"); context.uri = (String) context.getProperty("uri"); context.parm1 = (String) context.getProperty("parm1"); context.parm2 = (String) context.getProperty("parm2"); context.parm3 = (String) context.getProperty("parm3"); } catch (java.io.IOException ie) { System.err.println("Could not load context " + contextStr); ie.printStackTrace(); } // get context value from parent directly if (parentContextMap != null && !parentContextMap.isEmpty()) { if (parentContextMap.containsKey("namespace")) { context.namespace = (String) parentContextMap.get("namespace"); } if (parentContextMap.containsKey("ns")) { context.ns = (String) parentContextMap.get("ns"); } if (parentContextMap.containsKey("id")) { context.id = (String) parentContextMap.get("id"); } if (parentContextMap.containsKey("format")) { context.format = (String) parentContextMap.get("format"); } if (parentContextMap.containsKey("query")) { context.query = (String) parentContextMap.get("query"); } if (parentContextMap.containsKey("request")) { context.request = (String) parentContextMap.get("request"); } if (parentContextMap.containsKey("debug")) { context.debug = (Boolean) parentContextMap.get("debug"); } if (parentContextMap.containsKey("database_endpoint")) { context.database_endpoint = (String) parentContextMap .get("database_endpoint"); } if (parentContextMap.containsKey("uri")) { context.uri = (String) parentContextMap.get("uri"); } if (parentContextMap.containsKey("parm1")) { context.parm1 = (String) parentContextMap.get("parm1"); } if (parentContextMap.containsKey("parm2")) { context.parm2 = (String) parentContextMap.get("parm2"); } if (parentContextMap.containsKey("parm3")) { context.parm3 = (String) parentContextMap.get("parm3"); } } // Resume: init the resumeUtil resumeEntryMethodName = ResumeUtil .getResumeEntryMethodName(resuming_checkpoint_path); resumeUtil = new ResumeUtil(resuming_logs_dir_path, isChildJob, rootPid); resumeUtil.initCommonInfo(pid, rootPid, fatherPid, projectName, jobName, contextStr, jobVersion); // Resume: jobStart resumeUtil.addLog("JOB_STARTED", "JOB:" + jobName, parent_part_launcher, Thread.currentThread().getId() + "", "", "", "", "", resumeUtil.convertToJsonText(context)); java.util.concurrent.ConcurrentHashMap<Object, Object> concurrentHashMap = new java.util.concurrent.ConcurrentHashMap<Object, Object>(); globalMap.put("concurrentHashMap", concurrentHashMap); long startUsedMemory = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); long endUsedMemory = 0; long end = 0; startTime = System.currentTimeMillis(); this.globalResumeTicket = true;// to run tPreJob this.globalResumeTicket = false;// to run others jobs try { errorCode = null; tSparqlSelectRequest_1Process(globalMap); if (!"failure".equals(status)) { status = "end"; } } catch (TalendException e_tSparqlSelectRequest_1) { globalMap.put("tSparqlSelectRequest_1_SUBPROCESS_STATE", -1); e_tSparqlSelectRequest_1.printStackTrace(); } this.globalResumeTicket = true;// to run tPostJob end = System.currentTimeMillis(); if (watch) { System.out.println((end - startTime) + " milliseconds"); } endUsedMemory = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); if (false) { System.out .println((endUsedMemory - startUsedMemory) + " bytes memory increase when running : bio2rdf_rest_subjob"); } int returnCode = 0; if (errorCode == null) { returnCode = status != null && status.equals("failure") ? 1 : 0; } else { returnCode = errorCode.intValue(); } resumeUtil.addLog("JOB_ENDED", "JOB:" + jobName, parent_part_launcher, Thread.currentThread().getId() + "", "", "" + returnCode, "", "", ""); return returnCode; } public void destroy() { } private java.util.Map<String, Object> getSharedConnections4REST() { java.util.Map<String, Object> connections = new java.util.HashMap<String, Object>(); return connections; } private void evalParam(String arg) { if (arg.startsWith("--resuming_logs_dir_path")) { resuming_logs_dir_path = arg.substring(25); } else if (arg.startsWith("--resuming_checkpoint_path")) { resuming_checkpoint_path = arg.substring(27); } else if (arg.startsWith("--parent_part_launcher")) { parent_part_launcher = arg.substring(23); } else if (arg.startsWith("--watch")) { watch = true; } else if (arg.startsWith("--stat_port=")) { String portStatsStr = arg.substring(12); if (portStatsStr != null && !portStatsStr.equals("null")) { portStats = Integer.parseInt(portStatsStr); } } else if (arg.startsWith("--trace_port=")) { portTraces = Integer.parseInt(arg.substring(13)); } else if (arg.startsWith("--client_host=")) { clientHost = arg.substring(14); } else if (arg.startsWith("--context=")) { contextStr = arg.substring(10); isDefaultContext = false; } else if (arg.startsWith("--father_pid=")) { fatherPid = arg.substring(13); } else if (arg.startsWith("--root_pid=")) { rootPid = arg.substring(11); } else if (arg.startsWith("--father_node=")) { fatherNode = arg.substring(14); } else if (arg.startsWith("--pid=")) { pid = arg.substring(6); } else if (arg.startsWith("--context_param")) { String keyValue = arg.substring(16); int index = -1; if (keyValue != null && (index = keyValue.indexOf('=')) > -1) { if (fatherPid == null) { context_param.put(keyValue.substring(0, index), replaceEscapeChars(keyValue.substring(index + 1))); } else { // the subjob won't escape the especial chars context_param.put(keyValue.substring(0, index), keyValue.substring(index + 1)); } } } else if (arg.startsWith("--log4jLevel=")) { log4jLevel = arg.substring(13); } } private final String[][] escapeChars = { { "\\\\", "\\" }, { "\\n", "\n" }, { "\\'", "\'" }, { "\\r", "\r" }, { "\\f", "\f" }, { "\\b", "\b" }, { "\\t", "\t" } }; private String replaceEscapeChars(String keyValue) { if (keyValue == null || ("").equals(keyValue.trim())) { return keyValue; } StringBuilder result = new StringBuilder(); int currIndex = 0; while (currIndex < keyValue.length()) { int index = -1; // judege if the left string includes escape chars for (String[] strArray : escapeChars) { index = keyValue.indexOf(strArray[0], currIndex); if (index >= 0) { result.append(keyValue.substring(currIndex, index + strArray[0].length()).replace(strArray[0], strArray[1])); currIndex = index + strArray[0].length(); break; } } // if the left string doesn't include escape chars, append the left // into the result if (index < 0) { result.append(keyValue.substring(currIndex)); currIndex = currIndex + keyValue.length(); } } return result.toString(); } public Integer getErrorCode() { return errorCode; } public String getStatus() { return status; } ResumeUtil resumeUtil = null; } /************************************************************************************************ * 80327 characters generated by Talend Open Studio for ESB on the 29 août 2014 * 16:28:19 EDT ************************************************************************************************/