// ============================================================================ // // 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.rdfxml_reader_converter_1_7; import routines.Mathematical; import routines.DataOperation; import routines.BioUtil; 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; //the import part of tRDF2RDF_2 import org.apache.jena.riot.Lang; import org.apache.jena.riot.RDFDataMgr; import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.ModelFactory; import java.io.*; @SuppressWarnings("unused") /** * Job: rdfxml_reader_converter Purpose: <br> * Description: <br> * @author test@talend.com * @version 5.5.0.r117820 * @status */ public class rdfxml_reader_converter 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 (rdf_url != null) { this.setProperty("rdf_url", rdf_url.toString()); } if (formatOut != null) { this.setProperty("formatOut", formatOut.toString()); } if (debug != null) { this.setProperty("debug", debug.toString()); } if (ntriples != null) { this.setProperty("ntriples", ntriples.toString()); } if (format1 != null) { this.setProperty("format1", format1.toString()); } if (rdf_url1 != null) { this.setProperty("rdf_url1", rdf_url1.toString()); } if (format2 != null) { this.setProperty("format2", format2.toString()); } if (format3 != null) { this.setProperty("format3", format3.toString()); } if (format4 != null) { this.setProperty("format4", format4.toString()); } if (format5 != null) { this.setProperty("format5", format5.toString()); } if (rdf_url2 != null) { this.setProperty("rdf_url2", rdf_url2.toString()); } if (rdf_url3 != null) { this.setProperty("rdf_url3", rdf_url3.toString()); } if (rdf_url4 != null) { this.setProperty("rdf_url4", rdf_url4.toString()); } if (rdf_url5 != null) { this.setProperty("rdf_url5", rdf_url5.toString()); } if (rdf_url6 != null) { this.setProperty("rdf_url6", rdf_url6.toString()); } if (rdf_url7 != null) { this.setProperty("rdf_url7", rdf_url7.toString()); } } public String rdf_url; public String getRdf_url() { return this.rdf_url; } public String formatOut; public String getFormatOut() { return this.formatOut; } public Boolean debug; public Boolean getDebug() { return this.debug; } public String ntriples; public String getNtriples() { return this.ntriples; } public String format1; public String getFormat1() { return this.format1; } public String rdf_url1; public String getRdf_url1() { return this.rdf_url1; } public String format2; public String getFormat2() { return this.format2; } public String format3; public String getFormat3() { return this.format3; } public String format4; public String getFormat4() { return this.format4; } public String format5; public String getFormat5() { return this.format5; } public String rdf_url2; public String getRdf_url2() { return this.rdf_url2; } public String rdf_url3; public String getRdf_url3() { return this.rdf_url3; } public String rdf_url4; public String getRdf_url4() { return this.rdf_url4; } public String rdf_url5; public String getRdf_url5() { return this.rdf_url5; } public String rdf_url6; public String getRdf_url6() { return this.rdf_url6; } public String rdf_url7; public String getRdf_url7() { return this.rdf_url7; } } private ContextProperties context = new ContextProperties(); public ContextProperties getContext() { return this.context; } private final String jobVersion = "1.7"; private final String jobName = "rdfxml_reader_converter"; 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); rdfxml_reader_converter.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(rdfxml_reader_converter.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 tHttpRequest_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"; tHttpRequest_2_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"; tHttpRequest_2_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"; tHttpRequest_2_onSubJobError(exception, errorComponent, globalMap); } public void tMap_6_error(java.lang.Exception exception, String errorComponent, final java.util.Map<String, Object> globalMap) throws TalendException { end_Hash.put(errorComponent, System.currentTimeMillis()); status = "failure"; tHttpRequest_2_onSubJobError(exception, errorComponent, globalMap); } public void tRDF2RDF_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"; tHttpRequest_2_onSubJobError(exception, errorComponent, globalMap); } public void tMap_5_error(java.lang.Exception exception, String errorComponent, final java.util.Map<String, Object> globalMap) throws TalendException { end_Hash.put(errorComponent, System.currentTimeMillis()); status = "failure"; tHttpRequest_2_onSubJobError(exception, errorComponent, globalMap); } public void tBufferOutput_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"; tHttpRequest_2_onSubJobError(exception, errorComponent, globalMap); } public void tLogRow_7_error(java.lang.Exception exception, String errorComponent, final java.util.Map<String, Object> globalMap) throws TalendException { end_Hash.put(errorComponent, System.currentTimeMillis()); status = "failure"; tHttpRequest_2_onSubJobError(exception, errorComponent, globalMap); } public void tLogRow_6_error(java.lang.Exception exception, String errorComponent, final java.util.Map<String, Object> globalMap) throws TalendException { end_Hash.put(errorComponent, System.currentTimeMillis()); status = "failure"; tHttpRequest_2_onSubJobError(exception, errorComponent, globalMap); } public void tHttpRequest_2_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 out2Struct implements routines.system.IPersistableRow<out2Struct> { final static byte[] commonByteArrayLock_BIO2RDF_rdfxml_reader_converter = new byte[0]; static byte[] commonByteArray_BIO2RDF_rdfxml_reader_converter = 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_rdfxml_reader_converter.length) { if (length < 1024 && commonByteArray_BIO2RDF_rdfxml_reader_converter.length == 0) { commonByteArray_BIO2RDF_rdfxml_reader_converter = new byte[1024]; } else { commonByteArray_BIO2RDF_rdfxml_reader_converter = new byte[2 * length]; } } dis.readFully(commonByteArray_BIO2RDF_rdfxml_reader_converter, 0, length); strReturn = new String( commonByteArray_BIO2RDF_rdfxml_reader_converter, 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_rdfxml_reader_converter) { 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(out2Struct 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 debug3Struct implements routines.system.IPersistableRow<debug3Struct> { final static byte[] commonByteArrayLock_BIO2RDF_rdfxml_reader_converter = new byte[0]; static byte[] commonByteArray_BIO2RDF_rdfxml_reader_converter = new byte[0]; public String ntriples; public String getNtriples() { return this.ntriples; } 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_rdfxml_reader_converter.length) { if (length < 1024 && commonByteArray_BIO2RDF_rdfxml_reader_converter.length == 0) { commonByteArray_BIO2RDF_rdfxml_reader_converter = new byte[1024]; } else { commonByteArray_BIO2RDF_rdfxml_reader_converter = new byte[2 * length]; } } dis.readFully(commonByteArray_BIO2RDF_rdfxml_reader_converter, 0, length); strReturn = new String( commonByteArray_BIO2RDF_rdfxml_reader_converter, 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_rdfxml_reader_converter) { try { int length = 0; this.ntriples = readString(dis); } catch (IOException e) { throw new RuntimeException(e); } } } public void writeData(ObjectOutputStream dos) { try { // String writeString(this.ntriples, dos); } catch (IOException e) { throw new RuntimeException(e); } } public String toString() { StringBuilder sb = new StringBuilder(); sb.append(super.toString()); sb.append("["); sb.append("ntriples=" + ntriples); sb.append("]"); return sb.toString(); } /** * Compare keys */ public int compareTo(debug3Struct 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_rdfxml_reader_converter = new byte[0]; static byte[] commonByteArray_BIO2RDF_rdfxml_reader_converter = new byte[0]; public String rdf; public String getRdf() { return this.rdf; } 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_rdfxml_reader_converter.length) { if (length < 1024 && commonByteArray_BIO2RDF_rdfxml_reader_converter.length == 0) { commonByteArray_BIO2RDF_rdfxml_reader_converter = new byte[1024]; } else { commonByteArray_BIO2RDF_rdfxml_reader_converter = new byte[2 * length]; } } dis.readFully(commonByteArray_BIO2RDF_rdfxml_reader_converter, 0, length); strReturn = new String( commonByteArray_BIO2RDF_rdfxml_reader_converter, 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_rdfxml_reader_converter) { try { int length = 0; this.rdf = readString(dis); } catch (IOException e) { throw new RuntimeException(e); } } } public void writeData(ObjectOutputStream dos) { try { // String writeString(this.rdf, dos); } catch (IOException e) { throw new RuntimeException(e); } } public String toString() { StringBuilder sb = new StringBuilder(); sb.append(super.toString()); sb.append("["); sb.append("rdf=" + rdf); 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 static class outStruct implements routines.system.IPersistableRow<outStruct> { final static byte[] commonByteArrayLock_BIO2RDF_rdfxml_reader_converter = new byte[0]; static byte[] commonByteArray_BIO2RDF_rdfxml_reader_converter = new byte[0]; public String rdf; public String getRdf() { return this.rdf; } 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_rdfxml_reader_converter.length) { if (length < 1024 && commonByteArray_BIO2RDF_rdfxml_reader_converter.length == 0) { commonByteArray_BIO2RDF_rdfxml_reader_converter = new byte[1024]; } else { commonByteArray_BIO2RDF_rdfxml_reader_converter = new byte[2 * length]; } } dis.readFully(commonByteArray_BIO2RDF_rdfxml_reader_converter, 0, length); strReturn = new String( commonByteArray_BIO2RDF_rdfxml_reader_converter, 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_rdfxml_reader_converter) { try { int length = 0; this.rdf = readString(dis); } catch (IOException e) { throw new RuntimeException(e); } } } public void writeData(ObjectOutputStream dos) { try { // String writeString(this.rdf, dos); } catch (IOException e) { throw new RuntimeException(e); } } public String toString() { StringBuilder sb = new StringBuilder(); sb.append(super.toString()); sb.append("["); sb.append("rdf=" + rdf); sb.append("]"); return sb.toString(); } /** * Compare keys */ public int compareTo(outStruct 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 ntriplesStruct implements routines.system.IPersistableRow<ntriplesStruct> { final static byte[] commonByteArrayLock_BIO2RDF_rdfxml_reader_converter = new byte[0]; static byte[] commonByteArray_BIO2RDF_rdfxml_reader_converter = new byte[0]; public String ntriples; public String getNtriples() { return this.ntriples; } 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_rdfxml_reader_converter.length) { if (length < 1024 && commonByteArray_BIO2RDF_rdfxml_reader_converter.length == 0) { commonByteArray_BIO2RDF_rdfxml_reader_converter = new byte[1024]; } else { commonByteArray_BIO2RDF_rdfxml_reader_converter = new byte[2 * length]; } } dis.readFully(commonByteArray_BIO2RDF_rdfxml_reader_converter, 0, length); strReturn = new String( commonByteArray_BIO2RDF_rdfxml_reader_converter, 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_rdfxml_reader_converter) { try { int length = 0; this.ntriples = readString(dis); } catch (IOException e) { throw new RuntimeException(e); } } } public void writeData(ObjectOutputStream dos) { try { // String writeString(this.ntriples, dos); } catch (IOException e) { throw new RuntimeException(e); } } public String toString() { StringBuilder sb = new StringBuilder(); sb.append(super.toString()); sb.append("["); sb.append("ntriples=" + ntriples); sb.append("]"); return sb.toString(); } /** * Compare keys */ public int compareTo(ntriplesStruct 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_rdfxml_reader_converter = new byte[0]; static byte[] commonByteArray_BIO2RDF_rdfxml_reader_converter = new byte[0]; public String ResponseContent; public String getResponseContent() { return this.ResponseContent; } 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_rdfxml_reader_converter.length) { if (length < 1024 && commonByteArray_BIO2RDF_rdfxml_reader_converter.length == 0) { commonByteArray_BIO2RDF_rdfxml_reader_converter = new byte[1024]; } else { commonByteArray_BIO2RDF_rdfxml_reader_converter = new byte[2 * length]; } } dis.readFully(commonByteArray_BIO2RDF_rdfxml_reader_converter, 0, length); strReturn = new String( commonByteArray_BIO2RDF_rdfxml_reader_converter, 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_rdfxml_reader_converter) { try { int length = 0; this.ResponseContent = readString(dis); } catch (IOException e) { throw new RuntimeException(e); } } } public void writeData(ObjectOutputStream dos) { try { // String writeString(this.ResponseContent, dos); } catch (IOException e) { throw new RuntimeException(e); } } public String toString() { StringBuilder sb = new StringBuilder(); sb.append(super.toString()); sb.append("["); sb.append("ResponseContent=" + ResponseContent); 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 row2Struct implements routines.system.IPersistableRow<row2Struct> { final static byte[] commonByteArrayLock_BIO2RDF_rdfxml_reader_converter = new byte[0]; static byte[] commonByteArray_BIO2RDF_rdfxml_reader_converter = new byte[0]; public String ResponseContent; public String getResponseContent() { return this.ResponseContent; } 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_rdfxml_reader_converter.length) { if (length < 1024 && commonByteArray_BIO2RDF_rdfxml_reader_converter.length == 0) { commonByteArray_BIO2RDF_rdfxml_reader_converter = new byte[1024]; } else { commonByteArray_BIO2RDF_rdfxml_reader_converter = new byte[2 * length]; } } dis.readFully(commonByteArray_BIO2RDF_rdfxml_reader_converter, 0, length); strReturn = new String( commonByteArray_BIO2RDF_rdfxml_reader_converter, 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_rdfxml_reader_converter) { try { int length = 0; this.ResponseContent = readString(dis); } catch (IOException e) { throw new RuntimeException(e); } } } public void writeData(ObjectOutputStream dos) { try { // String writeString(this.ResponseContent, dos); } catch (IOException e) { throw new RuntimeException(e); } } public String toString() { StringBuilder sb = new StringBuilder(); sb.append(super.toString()); sb.append("["); sb.append("ResponseContent=" + ResponseContent); 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 row1Struct implements routines.system.IPersistableRow<row1Struct> { final static byte[] commonByteArrayLock_BIO2RDF_rdfxml_reader_converter = new byte[0]; static byte[] commonByteArray_BIO2RDF_rdfxml_reader_converter = new byte[0]; public String ResponseContent; public String getResponseContent() { return this.ResponseContent; } 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_rdfxml_reader_converter.length) { if (length < 1024 && commonByteArray_BIO2RDF_rdfxml_reader_converter.length == 0) { commonByteArray_BIO2RDF_rdfxml_reader_converter = new byte[1024]; } else { commonByteArray_BIO2RDF_rdfxml_reader_converter = new byte[2 * length]; } } dis.readFully(commonByteArray_BIO2RDF_rdfxml_reader_converter, 0, length); strReturn = new String( commonByteArray_BIO2RDF_rdfxml_reader_converter, 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_rdfxml_reader_converter) { try { int length = 0; this.ResponseContent = readString(dis); } catch (IOException e) { throw new RuntimeException(e); } } } public void writeData(ObjectOutputStream dos) { try { // String writeString(this.ResponseContent, dos); } catch (IOException e) { throw new RuntimeException(e); } } public String toString() { StringBuilder sb = new StringBuilder(); sb.append(super.toString()); sb.append("["); sb.append("ResponseContent=" + ResponseContent); 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 void tHttpRequest_2Process( final java.util.Map<String, Object> globalMap) throws TalendException { globalMap.put("tHttpRequest_2_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; row1Struct row1 = new row1Struct(); row1Struct row2 = row1; ntriplesStruct ntriples = new ntriplesStruct(); outStruct out = new outStruct(); row3Struct row3 = new row3Struct(); out2Struct out2 = new out2Struct(); debug3Struct debug3 = new debug3Struct(); debug1Struct debug1 = new debug1Struct(); /** * [tBufferOutput_2 begin ] start */ ok_Hash.put("tBufferOutput_2", false); start_Hash.put("tBufferOutput_2", System.currentTimeMillis()); currentComponent = "tBufferOutput_2"; int tos_count_tBufferOutput_2 = 0; /** * [tBufferOutput_2 begin ] stop */ /** * [tLogRow_7 begin ] start */ ok_Hash.put("tLogRow_7", false); start_Hash.put("tLogRow_7", System.currentTimeMillis()); currentComponent = "tLogRow_7"; int tos_count_tLogRow_7 = 0; // ///////////////////// final String OUTPUT_FIELD_SEPARATOR_tLogRow_7 = "|"; java.io.PrintStream consoleOut_tLogRow_7 = null; StringBuilder strBuffer_tLogRow_7 = null; int nb_line_tLogRow_7 = 0; // ///////////////////// /** * [tLogRow_7 begin ] stop */ /** * [tMap_5 begin ] start */ ok_Hash.put("tMap_5", false); start_Hash.put("tMap_5", System.currentTimeMillis()); currentComponent = "tMap_5"; int tos_count_tMap_5 = 0; // ############################### // # Lookup's keys initialization // ############################### // ############################### // # Vars initialization class Var__tMap_5__Struct { } Var__tMap_5__Struct Var__tMap_5 = new Var__tMap_5__Struct(); // ############################### // ############################### // # Outputs initialization out2Struct out2_tmp = new out2Struct(); debug3Struct debug3_tmp = new debug3Struct(); // ############################### /** * [tMap_5 begin ] stop */ /** * [tRDF2RDF_2 begin ] start */ ok_Hash.put("tRDF2RDF_2", false); start_Hash.put("tRDF2RDF_2", System.currentTimeMillis()); currentComponent = "tRDF2RDF_2"; int tos_count_tRDF2RDF_2 = 0; // Reader reader_tRDF2RDF_2; Writer writer_tRDF2RDF_2; Model model_tRDF2RDF_2 = ModelFactory.createDefaultModel(); String inputFormat_tRDF2RDF_2; int nb_line_tRDF2RDF_2 = 0; /** * [tRDF2RDF_2 begin ] stop */ /** * [tMap_6 begin ] start */ ok_Hash.put("tMap_6", false); start_Hash.put("tMap_6", System.currentTimeMillis()); currentComponent = "tMap_6"; int tos_count_tMap_6 = 0; // ############################### // # Lookup's keys initialization // ############################### // ############################### // # Vars initialization class Var__tMap_6__Struct { } Var__tMap_6__Struct Var__tMap_6 = new Var__tMap_6__Struct(); // ############################### // ############################### // # Outputs initialization outStruct out_tmp = new outStruct(); // ############################### /** * [tMap_6 begin ] stop */ /** * [tLogRow_6 begin ] start */ ok_Hash.put("tLogRow_6", false); start_Hash.put("tLogRow_6", System.currentTimeMillis()); currentComponent = "tLogRow_6"; int tos_count_tLogRow_6 = 0; // ///////////////////// final String OUTPUT_FIELD_SEPARATOR_tLogRow_6 = "|"; java.io.PrintStream consoleOut_tLogRow_6 = null; StringBuilder strBuffer_tLogRow_6 = null; int nb_line_tLogRow_6 = 0; // ///////////////////// /** * [tLogRow_6 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 ntriplesStruct ntriples_tmp = new ntriplesStruct(); debug1Struct debug1_tmp = new debug1Struct(); // ############################### /** * [tMap_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; /** * [tLogRow_1 begin ] stop */ /** * [tHttpRequest_2 begin ] start */ ok_Hash.put("tHttpRequest_2", false); start_Hash.put("tHttpRequest_2", System.currentTimeMillis()); currentComponent = "tHttpRequest_2"; int tos_count_tHttpRequest_2 = 0; /** * [tHttpRequest_2 begin ] stop */ /** * [tHttpRequest_2 main ] start */ currentComponent = "tHttpRequest_2"; java.net.URL url_tHttpRequest_2 = new java.net.URL( context.rdf_url); java.net.HttpURLConnection urlConn_tHttpRequest_2 = (java.net.HttpURLConnection) url_tHttpRequest_2 .openConnection(); urlConn_tHttpRequest_2.setRequestMethod("GET"); urlConn_tHttpRequest_2.setDoOutput(true); urlConn_tHttpRequest_2.setDoInput(true); urlConn_tHttpRequest_2.setUseCaches(false); urlConn_tHttpRequest_2.setRequestProperty("Accept", "application/rdf+xml"); urlConn_tHttpRequest_2.connect(); byte[] buffer_tHttpRequest_2 = new byte[1024]; int bos_buffer_tHttpRequest_2 = 0; StringBuilder sb_tHttpRequest_2 = new StringBuilder(); if (java.net.HttpURLConnection.HTTP_OK == (urlConn_tHttpRequest_2 .getResponseCode())) { java.io.InputStream bis_tHttpRequest_2 = new java.io.BufferedInputStream( urlConn_tHttpRequest_2.getInputStream()); while ((bos_buffer_tHttpRequest_2 = bis_tHttpRequest_2 .read(buffer_tHttpRequest_2)) != -1) { sb_tHttpRequest_2.append(new String( buffer_tHttpRequest_2, 0, bos_buffer_tHttpRequest_2)); } bis_tHttpRequest_2.close(); } else { System.err .println(urlConn_tHttpRequest_2.getResponseCode() + " " + urlConn_tHttpRequest_2 .getResponseMessage()); } row1.ResponseContent = sb_tHttpRequest_2.toString(); urlConn_tHttpRequest_2.disconnect(); tos_count_tHttpRequest_2++; /** * [tHttpRequest_2 main ] stop */ /** * [tLogRow_1 main ] start */ currentComponent = "tLogRow_1"; row2 = row1; tos_count_tLogRow_1++; /** * [tLogRow_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 ntriples = null; debug1 = null; // # Output table : 'ntriples' ntriples_tmp.ntriples = row2.ResponseContent; ntriples = ntriples_tmp; // # Output table : 'debug1' // # Filter conditions if ( context.debug ) { debug1_tmp.ResponseContent = row2.ResponseContent; debug1 = debug1_tmp; } // closing filter/reject // ############################### } // end of Var scope rejectedInnerJoin_tMap_2 = false; tos_count_tMap_2++; /** * [tMap_2 main ] stop */ // Start of branch "ntriples" if (ntriples != null) { /** * [tMap_6 main ] start */ currentComponent = "tMap_6"; boolean hasCasePrimitiveKeyWithNull_tMap_6 = false; // ############################### // # Input tables (lookups) boolean rejectedInnerJoin_tMap_6 = false; boolean mainRowRejected_tMap_6 = false; // ############################### { // start of Var scope // ############################### // # Vars tables Var__tMap_6__Struct Var = Var__tMap_6;// ############################### // ############################### // # Output tables out = null; // # Output table : 'out' out_tmp.rdf = ntriples.ntriples; out = out_tmp; // ############################### } // end of Var scope rejectedInnerJoin_tMap_6 = false; tos_count_tMap_6++; /** * [tMap_6 main ] stop */ // Start of branch "out" if (out != null) { /** * [tRDF2RDF_2 main ] start */ currentComponent = "tRDF2RDF_2"; String rdfInput_tRDF2RDF_2 = ""; String baseUri_tRDF2RDF_2 = "http://identifiers.org/"; rdfInput_tRDF2RDF_2 = out.rdf; RDFDataMgr.read( model_tRDF2RDF_2, new ByteArrayInputStream(rdfInput_tRDF2RDF_2 .getBytes()), baseUri_tRDF2RDF_2, Lang.RDFXML); writer_tRDF2RDF_2 = new StringWriter(); if (context.formatOut.toLowerCase().equals("rdf") || context.formatOut.toLowerCase().equals( "rdf/xml") || context.formatOut.toLowerCase() .equals("xml") || context.formatOut.toLowerCase().equals( "application/rdf+xml") || context.formatOut.toLowerCase().equals( "rdfxml")) { RDFDataMgr.write(writer_tRDF2RDF_2, model_tRDF2RDF_2, Lang.RDFXML); } else if (context.formatOut.toLowerCase().equals( "turtle") || context.formatOut.toLowerCase() .equals("ttl") || context.formatOut.toLowerCase().equals( "text/turtle")) { RDFDataMgr.write(writer_tRDF2RDF_2, model_tRDF2RDF_2, Lang.TURTLE); } else if (context.formatOut.toLowerCase().equals("nt") || context.formatOut.toLowerCase().equals( "n-triple") || context.formatOut.toLowerCase().equals( "text/plain") || context.formatOut.toLowerCase().equals( "ntriple") || context.formatOut.toLowerCase().equals( "ntriples") || context.formatOut.toLowerCase().equals( "n-triples")) { RDFDataMgr.write(writer_tRDF2RDF_2, model_tRDF2RDF_2, Lang.NTRIPLES); } else if (context.formatOut.toLowerCase().equals( "jsonld") || context.formatOut.toLowerCase().equals( "json-ld") || context.formatOut.toLowerCase().equals( "json/ld")) { RDFDataMgr.write(writer_tRDF2RDF_2, model_tRDF2RDF_2, Lang.JSONLD); } else if (context.formatOut.toLowerCase().equals("n3") || context.formatOut.toLowerCase().equals( "text/rdf+n3")) { RDFDataMgr.write(writer_tRDF2RDF_2, model_tRDF2RDF_2, Lang.N3); } else if (context.formatOut.toLowerCase().equals( "rdf/json") || context.formatOut.toLowerCase().equals( "json") || context.formatOut.toLowerCase().equals( "application/rdf+json") || context.formatOut.toLowerCase().equals( "rdfjson")) { RDFDataMgr.write(writer_tRDF2RDF_2, model_tRDF2RDF_2, Lang.RDFJSON); } else if (context.formatOut.toLowerCase().equals( "trig") || context.formatOut.toLowerCase().equals( "application/trig")) { RDFDataMgr.write(writer_tRDF2RDF_2, model_tRDF2RDF_2, Lang.TRIG); } else if (context.formatOut.toLowerCase().equals( "nquads") || context.formatOut.toLowerCase().equals( "n-quads")) { RDFDataMgr.write(writer_tRDF2RDF_2, model_tRDF2RDF_2, Lang.NQUADS); } else { System.err.println("RDF Lang not supported"); } row3.rdf = writer_tRDF2RDF_2.toString(); nb_line_tRDF2RDF_2++; tos_count_tRDF2RDF_2++; /** * [tRDF2RDF_2 main ] stop */ /** * [tMap_5 main ] start */ currentComponent = "tMap_5"; boolean hasCasePrimitiveKeyWithNull_tMap_5 = false; // ############################### // # Input tables (lookups) boolean rejectedInnerJoin_tMap_5 = false; boolean mainRowRejected_tMap_5 = false; // ############################### { // start of Var scope // ############################### // # Vars tables Var__tMap_5__Struct Var = Var__tMap_5;// ############################### // ############################### // # Output tables out2 = null; debug3 = null; // # Output table : 'out2' out2_tmp.string = row3.rdf; out2_tmp.body = null; out2 = out2_tmp; // # Output table : 'debug3' // # Filter conditions if ( context.debug ) { debug3_tmp.ntriples = row3.rdf; debug3 = debug3_tmp; } // closing filter/reject // ############################### } // end of Var scope rejectedInnerJoin_tMap_5 = false; tos_count_tMap_5++; /** * [tMap_5 main ] stop */ // Start of branch "out2" if (out2 != null) { /** * [tBufferOutput_2 main ] start */ currentComponent = "tBufferOutput_2"; String[] row_tBufferOutput_2 = new String[] { "", "", }; if (out2.string != null) { row_tBufferOutput_2[0] = out2.string; } else { row_tBufferOutput_2[0] = null; } if (out2.body != null) { row_tBufferOutput_2[1] = String .valueOf(out2.body); } else { row_tBufferOutput_2[1] = null; } globalBuffer.add(row_tBufferOutput_2); tos_count_tBufferOutput_2++; /** * [tBufferOutput_2 main ] stop */ } // End of branch "out2" // Start of branch "debug3" if (debug3 != null) { /** * [tLogRow_7 main ] start */ currentComponent = "tLogRow_7"; // ///////////////////// strBuffer_tLogRow_7 = new StringBuilder(); if (debug3.ntriples != null) { // strBuffer_tLogRow_7.append(String .valueOf(debug3.ntriples)); } // if (globalMap.get("tLogRow_CONSOLE") != null) { consoleOut_tLogRow_7 = (java.io.PrintStream) globalMap .get("tLogRow_CONSOLE"); } else { consoleOut_tLogRow_7 = new java.io.PrintStream( new java.io.BufferedOutputStream( System.out)); globalMap.put("tLogRow_CONSOLE", consoleOut_tLogRow_7); } consoleOut_tLogRow_7.println(strBuffer_tLogRow_7 .toString()); consoleOut_tLogRow_7.flush(); nb_line_tLogRow_7++; // //// // //// // ///////////////////// tos_count_tLogRow_7++; /** * [tLogRow_7 main ] stop */ } // End of branch "debug3" } // End of branch "out" } // End of branch "ntriples" // Start of branch "debug1" if (debug1 != null) { /** * [tLogRow_6 main ] start */ currentComponent = "tLogRow_6"; // ///////////////////// strBuffer_tLogRow_6 = new StringBuilder(); if (debug1.ResponseContent != null) { // strBuffer_tLogRow_6.append(String .valueOf(debug1.ResponseContent)); } // if (globalMap.get("tLogRow_CONSOLE") != null) { consoleOut_tLogRow_6 = (java.io.PrintStream) globalMap .get("tLogRow_CONSOLE"); } else { consoleOut_tLogRow_6 = new java.io.PrintStream( new java.io.BufferedOutputStream(System.out)); globalMap.put("tLogRow_CONSOLE", consoleOut_tLogRow_6); } consoleOut_tLogRow_6 .println(strBuffer_tLogRow_6.toString()); consoleOut_tLogRow_6.flush(); nb_line_tLogRow_6++; // //// // //// // ///////////////////// tos_count_tLogRow_6++; /** * [tLogRow_6 main ] stop */ } // End of branch "debug1" /** * [tHttpRequest_2 end ] start */ currentComponent = "tHttpRequest_2"; ok_Hash.put("tHttpRequest_2", true); end_Hash.put("tHttpRequest_2", System.currentTimeMillis()); /** * [tHttpRequest_2 end ] stop */ /** * [tLogRow_1 end ] start */ currentComponent = "tLogRow_1"; ok_Hash.put("tLogRow_1", true); end_Hash.put("tLogRow_1", System.currentTimeMillis()); /** * [tLogRow_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 */ /** * [tMap_6 end ] start */ currentComponent = "tMap_6"; // ############################### // # Lookup hashes releasing // ############################### ok_Hash.put("tMap_6", true); end_Hash.put("tMap_6", System.currentTimeMillis()); /** * [tMap_6 end ] stop */ /** * [tRDF2RDF_2 end ] start */ currentComponent = "tRDF2RDF_2"; globalMap.put("tRDF2RDF_2_NB_LINE", nb_line_tRDF2RDF_2); ok_Hash.put("tRDF2RDF_2", true); end_Hash.put("tRDF2RDF_2", System.currentTimeMillis()); /** * [tRDF2RDF_2 end ] stop */ /** * [tMap_5 end ] start */ currentComponent = "tMap_5"; // ############################### // # Lookup hashes releasing // ############################### ok_Hash.put("tMap_5", true); end_Hash.put("tMap_5", System.currentTimeMillis()); /** * [tMap_5 end ] stop */ /** * [tBufferOutput_2 end ] start */ currentComponent = "tBufferOutput_2"; ok_Hash.put("tBufferOutput_2", true); end_Hash.put("tBufferOutput_2", System.currentTimeMillis()); /** * [tBufferOutput_2 end ] stop */ /** * [tLogRow_7 end ] start */ currentComponent = "tLogRow_7"; // //// // //// globalMap.put("tLogRow_7_NB_LINE", nb_line_tLogRow_7); // ///////////////////// ok_Hash.put("tLogRow_7", true); end_Hash.put("tLogRow_7", System.currentTimeMillis()); /** * [tLogRow_7 end ] stop */ /** * [tLogRow_6 end ] start */ currentComponent = "tLogRow_6"; // //// // //// globalMap.put("tLogRow_6_NB_LINE", nb_line_tLogRow_6); // ///////////////////// ok_Hash.put("tLogRow_6", true); end_Hash.put("tLogRow_6", System.currentTimeMillis()); /** * [tLogRow_6 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 { /** * [tHttpRequest_2 finally ] start */ currentComponent = "tHttpRequest_2"; /** * [tHttpRequest_2 finally ] stop */ /** * [tLogRow_1 finally ] start */ currentComponent = "tLogRow_1"; /** * [tLogRow_1 finally ] stop */ /** * [tMap_2 finally ] start */ currentComponent = "tMap_2"; /** * [tMap_2 finally ] stop */ /** * [tMap_6 finally ] start */ currentComponent = "tMap_6"; /** * [tMap_6 finally ] stop */ /** * [tRDF2RDF_2 finally ] start */ currentComponent = "tRDF2RDF_2"; /** * [tRDF2RDF_2 finally ] stop */ /** * [tMap_5 finally ] start */ currentComponent = "tMap_5"; /** * [tMap_5 finally ] stop */ /** * [tBufferOutput_2 finally ] start */ currentComponent = "tBufferOutput_2"; /** * [tBufferOutput_2 finally ] stop */ /** * [tLogRow_7 finally ] start */ currentComponent = "tLogRow_7"; /** * [tLogRow_7 finally ] stop */ /** * [tLogRow_6 finally ] start */ currentComponent = "tLogRow_6"; /** * [tLogRow_6 finally ] stop */ } catch (java.lang.Exception e) { // ignore } catch (java.lang.Error error) { // ignore } resourceMap = null; } globalMap.put("tHttpRequest_2_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 rdfxml_reader_converter rdfxml_reader_converterClass = new rdfxml_reader_converter(); int exitCode = rdfxml_reader_converterClass.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 = rdfxml_reader_converter.class .getClassLoader().getResourceAsStream( "bio2rdf/rdfxml_reader_converter_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.rdf_url = (String) context.getProperty("rdf_url"); context.formatOut = (String) context.getProperty("formatOut"); try { context.debug = routines.system.ParserUtils .parseTo_Boolean(context.getProperty("debug")); } catch (NumberFormatException e) { context.debug = null; } context.ntriples = (String) context.getProperty("ntriples"); context.format1 = (String) context.getProperty("format1"); context.rdf_url1 = (String) context.getProperty("rdf_url1"); context.format2 = (String) context.getProperty("format2"); context.format3 = (String) context.getProperty("format3"); context.format4 = (String) context.getProperty("format4"); context.format5 = (String) context.getProperty("format5"); context.rdf_url2 = (String) context.getProperty("rdf_url2"); context.rdf_url3 = (String) context.getProperty("rdf_url3"); context.rdf_url4 = (String) context.getProperty("rdf_url4"); context.rdf_url5 = (String) context.getProperty("rdf_url5"); context.rdf_url6 = (String) context.getProperty("rdf_url6"); context.rdf_url7 = (String) context.getProperty("rdf_url7"); } 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("rdf_url")) { context.rdf_url = (String) parentContextMap.get("rdf_url"); } if (parentContextMap.containsKey("formatOut")) { context.formatOut = (String) parentContextMap.get("formatOut"); } if (parentContextMap.containsKey("debug")) { context.debug = (Boolean) parentContextMap.get("debug"); } if (parentContextMap.containsKey("ntriples")) { context.ntriples = (String) parentContextMap.get("ntriples"); } if (parentContextMap.containsKey("format1")) { context.format1 = (String) parentContextMap.get("format1"); } if (parentContextMap.containsKey("rdf_url1")) { context.rdf_url1 = (String) parentContextMap.get("rdf_url1"); } if (parentContextMap.containsKey("format2")) { context.format2 = (String) parentContextMap.get("format2"); } if (parentContextMap.containsKey("format3")) { context.format3 = (String) parentContextMap.get("format3"); } if (parentContextMap.containsKey("format4")) { context.format4 = (String) parentContextMap.get("format4"); } if (parentContextMap.containsKey("format5")) { context.format5 = (String) parentContextMap.get("format5"); } if (parentContextMap.containsKey("rdf_url2")) { context.rdf_url2 = (String) parentContextMap.get("rdf_url2"); } if (parentContextMap.containsKey("rdf_url3")) { context.rdf_url3 = (String) parentContextMap.get("rdf_url3"); } if (parentContextMap.containsKey("rdf_url4")) { context.rdf_url4 = (String) parentContextMap.get("rdf_url4"); } if (parentContextMap.containsKey("rdf_url5")) { context.rdf_url5 = (String) parentContextMap.get("rdf_url5"); } if (parentContextMap.containsKey("rdf_url6")) { context.rdf_url6 = (String) parentContextMap.get("rdf_url6"); } if (parentContextMap.containsKey("rdf_url7")) { context.rdf_url7 = (String) parentContextMap.get("rdf_url7"); } } // 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; tHttpRequest_2Process(globalMap); if (!"failure".equals(status)) { status = "end"; } } catch (TalendException e_tHttpRequest_2) { globalMap.put("tHttpRequest_2_SUBPROCESS_STATE", -1); e_tHttpRequest_2.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 : rdfxml_reader_converter"); } 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; } /************************************************************************************************ * 74109 characters generated by Talend Open Studio for ESB on the 29 août 2014 * 16:28:19 EDT ************************************************************************************************/