// ============================================================================
//
// 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_describeall_loop_0_1;
import routines.Mathematical;
import routines.DataOperation;
import routines.Relational;
import routines.TalendDate;
import routines.TalendDataGenerator;
import routines.Numeric;
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 tJavaRow_1
//import java.util.List;
@SuppressWarnings("unused")
/**
* Job: Bio2RDF_DescribeAll_loop Purpose: <br>
* Description: <br>
* @author test@talend.com
* @version 5.5.0.r117820
* @status
*/
public class Bio2RDF_DescribeAll_loop 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 (ns != null) {
this.setProperty("ns", ns.toString());
}
if (id != null) {
this.setProperty("id", id.toString());
}
if (ntriples != null) {
this.setProperty("ntriples", ntriples.toString());
}
if (format != null) {
this.setProperty("format", format.toString());
}
if (database_endpoint != null) {
this.setProperty("database_endpoint",
database_endpoint.toString());
}
}
public String ns;
public String getNs() {
return this.ns;
}
public String id;
public String getId() {
return this.id;
}
public String ntriples;
public String getNtriples() {
return this.ntriples;
}
public String format;
public String getFormat() {
return this.format;
}
public String database_endpoint;
public String getDatabase_endpoint() {
return this.database_endpoint;
}
}
private ContextProperties context = new ContextProperties();
public ContextProperties getContext() {
return this.context;
}
private final String jobVersion = "0.1";
private final String jobName = "Bio2RDF_DescribeAll_loop";
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_DescribeAll_loop.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_DescribeAll_loop.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 tPostjob_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";
tPostjob_1_onSubJobError(exception, errorComponent, globalMap);
}
public void tSesameRdfOutput_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";
tSesameRdfOutput_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";
tSesameRdfOutput_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";
tSesameRdfOutput_1_onSubJobError(exception, errorComponent, globalMap);
}
public void tSesameModelCreate_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";
tSesameModelCreate_1_onSubJobError(exception, errorComponent, globalMap);
}
public void tFixedFlowInput_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";
tFixedFlowInput_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";
tFixedFlowInput_1_onSubJobError(exception, errorComponent, globalMap);
}
public void tFlowToIterate_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";
tFixedFlowInput_1_onSubJobError(exception, errorComponent, globalMap);
}
public void tSparqlSelectRequest_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";
tFixedFlowInput_1_onSubJobError(exception, errorComponent, globalMap);
}
public void tJavaRow_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";
tFixedFlowInput_1_onSubJobError(exception, errorComponent, globalMap);
}
public void tSesameModelAddStatement_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";
tFixedFlowInput_1_onSubJobError(exception, errorComponent, globalMap);
}
public void tPostjob_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 void tSesameRdfOutput_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 void tSesameModelCreate_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 void tFixedFlowInput_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 void tPostjob_1Process(final java.util.Map<String, Object> globalMap)
throws TalendException {
globalMap.put("tPostjob_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;
/**
* [tPostjob_1 begin ] start
*/
ok_Hash.put("tPostjob_1", false);
start_Hash.put("tPostjob_1", System.currentTimeMillis());
currentComponent = "tPostjob_1";
int tos_count_tPostjob_1 = 0;
/**
* [tPostjob_1 begin ] stop
*/
/**
* [tPostjob_1 main ] start
*/
currentComponent = "tPostjob_1";
tos_count_tPostjob_1++;
/**
* [tPostjob_1 main ] stop
*/
/**
* [tPostjob_1 end ] start
*/
currentComponent = "tPostjob_1";
ok_Hash.put("tPostjob_1", true);
end_Hash.put("tPostjob_1", System.currentTimeMillis());
tSesameRdfOutput_1Process(globalMap);
/**
* [tPostjob_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 {
/**
* [tPostjob_1 finally ] start
*/
currentComponent = "tPostjob_1";
/**
* [tPostjob_1 finally ] stop
*/
} catch (java.lang.Exception e) {
// ignore
} catch (java.lang.Error error) {
// ignore
}
resourceMap = null;
}
globalMap.put("tPostjob_1_SUBPROCESS_STATE", 1);
}
public static class row6Struct implements
routines.system.IPersistableRow<row6Struct> {
final static byte[] commonByteArrayLock_BIO2RDF_Bio2RDF_DescribeAll_loop = new byte[0];
static byte[] commonByteArray_BIO2RDF_Bio2RDF_DescribeAll_loop = 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_Bio2RDF_DescribeAll_loop.length) {
if (length < 1024
&& commonByteArray_BIO2RDF_Bio2RDF_DescribeAll_loop.length == 0) {
commonByteArray_BIO2RDF_Bio2RDF_DescribeAll_loop = new byte[1024];
} else {
commonByteArray_BIO2RDF_Bio2RDF_DescribeAll_loop = new byte[2 * length];
}
}
dis.readFully(commonByteArray_BIO2RDF_Bio2RDF_DescribeAll_loop,
0, length);
strReturn = new String(
commonByteArray_BIO2RDF_Bio2RDF_DescribeAll_loop, 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_DescribeAll_loop) {
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(row6Struct 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 row5Struct implements
routines.system.IPersistableRow<row5Struct> {
final static byte[] commonByteArrayLock_BIO2RDF_Bio2RDF_DescribeAll_loop = new byte[0];
static byte[] commonByteArray_BIO2RDF_Bio2RDF_DescribeAll_loop = 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_Bio2RDF_DescribeAll_loop.length) {
if (length < 1024
&& commonByteArray_BIO2RDF_Bio2RDF_DescribeAll_loop.length == 0) {
commonByteArray_BIO2RDF_Bio2RDF_DescribeAll_loop = new byte[1024];
} else {
commonByteArray_BIO2RDF_Bio2RDF_DescribeAll_loop = new byte[2 * length];
}
}
dis.readFully(commonByteArray_BIO2RDF_Bio2RDF_DescribeAll_loop,
0, length);
strReturn = new String(
commonByteArray_BIO2RDF_Bio2RDF_DescribeAll_loop, 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_DescribeAll_loop) {
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(row5Struct 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 tSesameRdfOutput_1Process(
final java.util.Map<String, Object> globalMap)
throws TalendException {
globalMap.put("tSesameRdfOutput_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;
row5Struct row5 = new row5Struct();
row5Struct row6 = row5;
/**
* [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;
/**
* [tLogRow_2 begin ] stop
*/
/**
* [tSesameRdfOutput_1 begin ] start
*/
ok_Hash.put("tSesameRdfOutput_1", false);
start_Hash
.put("tSesameRdfOutput_1", System.currentTimeMillis());
currentComponent = "tSesameRdfOutput_1";
int tos_count_tSesameRdfOutput_1 = 0;
int nb_line_tSesameRdfOutput_1 = 0;
/**
* [tSesameRdfOutput_1 begin ] stop
*/
/**
* [tSesameRdfOutput_1 main ] start
*/
currentComponent = "tSesameRdfOutput_1";
org.openrdf.model.Model model_tSesameRdfOutput_1 = (org.openrdf.model.Model) globalMap
.get("model_tSesameModelCreate_1");
java.io.Writer rdfWriter_tSesameRdfOutput_1 = new java.io.StringWriter();
try {
if (context.format.toLowerCase().equals("rdf")
|| context.format.toLowerCase().equals("rdf/xml")
|| context.format.toLowerCase().equals("xml")
|| context.format.toLowerCase().equals(
"application/rdf+xml")
|| context.format.toLowerCase().equals("rdfxml")) {
org.openrdf.rio.Rio.write(model_tSesameRdfOutput_1,
rdfWriter_tSesameRdfOutput_1,
org.openrdf.rio.RDFFormat.RDFXML);
} else if (context.format.toLowerCase().equals("turtle")
|| context.format.toLowerCase().equals("ttl")
|| context.format.toLowerCase().equals(
"text/turtle")) {
org.openrdf.rio.Rio.write(model_tSesameRdfOutput_1,
rdfWriter_tSesameRdfOutput_1,
org.openrdf.rio.RDFFormat.TURTLE);
} else if (context.format.toLowerCase().equals("nt")
|| context.format.toLowerCase().equals("n-triple")
|| context.format.toLowerCase()
.equals("text/plain")
|| context.format.toLowerCase().equals("ntriple")
|| context.format.toLowerCase().equals("ntriples")
|| context.format.toLowerCase().equals("n-triples")) {
org.openrdf.rio.Rio.write(model_tSesameRdfOutput_1,
rdfWriter_tSesameRdfOutput_1,
org.openrdf.rio.RDFFormat.NTRIPLES);
} else if (context.format.toLowerCase().equals("jsonld")
|| context.format.toLowerCase().equals("json-ld")
|| context.format.toLowerCase().equals("json/ld")) {
org.openrdf.rio.Rio.write(model_tSesameRdfOutput_1,
rdfWriter_tSesameRdfOutput_1,
org.openrdf.rio.RDFFormat.JSONLD);
} else if (context.format.toLowerCase().equals("n3")
|| context.format.toLowerCase().equals(
"text/rdf+n3")) {
org.openrdf.rio.Rio.write(model_tSesameRdfOutput_1,
rdfWriter_tSesameRdfOutput_1,
org.openrdf.rio.RDFFormat.N3);
} else if (context.format.toLowerCase().equals("rdf/json")
|| context.format.toLowerCase().equals("json")
|| context.format.toLowerCase().equals(
"application/rdf+json")
|| context.format.toLowerCase().equals("rdfjson")) {
org.openrdf.rio.Rio.write(model_tSesameRdfOutput_1,
rdfWriter_tSesameRdfOutput_1,
org.openrdf.rio.RDFFormat.RDFJSON);
} else if (context.format.toLowerCase().equals("trig")
|| context.format.toLowerCase().equals(
"application/trig")) {
org.openrdf.rio.Rio.write(model_tSesameRdfOutput_1,
rdfWriter_tSesameRdfOutput_1,
org.openrdf.rio.RDFFormat.TRIG);
} else if (context.format.toLowerCase().equals("nquads")
|| context.format.toLowerCase().equals("n-quads")
|| context.format.toLowerCase().equals("nquad")
|| context.format.toLowerCase().equals("n-quad")) {
org.openrdf.rio.Rio.write(model_tSesameRdfOutput_1,
rdfWriter_tSesameRdfOutput_1,
org.openrdf.rio.RDFFormat.NQUADS);
} else {
System.err.println("RDF Format not supported");
}
} catch (Exception e) {
System.out.println("FAILED");
}
row5.rdf = rdfWriter_tSesameRdfOutput_1.toString();
nb_line_tSesameRdfOutput_1++;
tos_count_tSesameRdfOutput_1++;
/**
* [tSesameRdfOutput_1 main ] stop
*/
/**
* [tLogRow_2 main ] start
*/
currentComponent = "tLogRow_2";
row6 = row5;
tos_count_tLogRow_2++;
/**
* [tLogRow_2 main ] stop
*/
/**
* [tBufferOutput_1 main ] start
*/
currentComponent = "tBufferOutput_1";
String[] row_tBufferOutput_1 = new String[] { "", };
if (row6.rdf != null) {
row_tBufferOutput_1[0] = row6.rdf;
} else {
row_tBufferOutput_1[0] = null;
}
globalBuffer.add(row_tBufferOutput_1);
tos_count_tBufferOutput_1++;
/**
* [tBufferOutput_1 main ] stop
*/
/**
* [tSesameRdfOutput_1 end ] start
*/
currentComponent = "tSesameRdfOutput_1";
globalMap.put("tSesameRdfOutput_1_NB_LINE",
nb_line_tSesameRdfOutput_1);
ok_Hash.put("tSesameRdfOutput_1", true);
end_Hash.put("tSesameRdfOutput_1", System.currentTimeMillis());
/**
* [tSesameRdfOutput_1 end ] stop
*/
/**
* [tLogRow_2 end ] start
*/
currentComponent = "tLogRow_2";
ok_Hash.put("tLogRow_2", true);
end_Hash.put("tLogRow_2", System.currentTimeMillis());
/**
* [tLogRow_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
*/
}// 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 {
/**
* [tSesameRdfOutput_1 finally ] start
*/
currentComponent = "tSesameRdfOutput_1";
/**
* [tSesameRdfOutput_1 finally ] stop
*/
/**
* [tLogRow_2 finally ] start
*/
currentComponent = "tLogRow_2";
/**
* [tLogRow_2 finally ] stop
*/
/**
* [tBufferOutput_1 finally ] start
*/
currentComponent = "tBufferOutput_1";
/**
* [tBufferOutput_1 finally ] stop
*/
} catch (java.lang.Exception e) {
// ignore
} catch (java.lang.Error error) {
// ignore
}
resourceMap = null;
}
globalMap.put("tSesameRdfOutput_1_SUBPROCESS_STATE", 1);
}
public void tSesameModelCreate_1Process(
final java.util.Map<String, Object> globalMap)
throws TalendException {
globalMap.put("tSesameModelCreate_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;
/**
* [tSesameModelCreate_1 begin ] start
*/
ok_Hash.put("tSesameModelCreate_1", false);
start_Hash.put("tSesameModelCreate_1",
System.currentTimeMillis());
currentComponent = "tSesameModelCreate_1";
int tos_count_tSesameModelCreate_1 = 0;
org.openrdf.model.Model model_tSesameModelCreate_1 = new org.openrdf.model.impl.LinkedHashModel();
globalMap.put("model_tSesameModelCreate_1",
model_tSesameModelCreate_1);
/**
* [tSesameModelCreate_1 begin ] stop
*/
/**
* [tSesameModelCreate_1 main ] start
*/
currentComponent = "tSesameModelCreate_1";
tos_count_tSesameModelCreate_1++;
/**
* [tSesameModelCreate_1 main ] stop
*/
/**
* [tSesameModelCreate_1 end ] start
*/
currentComponent = "tSesameModelCreate_1";
ok_Hash.put("tSesameModelCreate_1", true);
end_Hash.put("tSesameModelCreate_1", System.currentTimeMillis());
/**
* [tSesameModelCreate_1 end ] stop
*/
}// end the resume
if (resumeEntryMethodName == null || globalResumeTicket) {
resumeUtil.addLog("CHECKPOINT",
"CONNECTION:SUBJOB_OK:tSesameModelCreate_1:OnSubjobOk",
"", Thread.currentThread().getId() + "", "", "", "",
"", "");
}
tFixedFlowInput_1Process(globalMap);
} catch (java.lang.Exception e) {
TalendException te = new TalendException(e, currentComponent,
globalMap);
throw te;
} catch (java.lang.Error error) {
throw error;
} finally {
try {
/**
* [tSesameModelCreate_1 finally ] start
*/
currentComponent = "tSesameModelCreate_1";
/**
* [tSesameModelCreate_1 finally ] stop
*/
} catch (java.lang.Exception e) {
// ignore
} catch (java.lang.Error error) {
// ignore
}
resourceMap = null;
}
globalMap.put("tSesameModelCreate_1_SUBPROCESS_STATE", 1);
}
public static class row4Struct implements
routines.system.IPersistableRow<row4Struct> {
final static byte[] commonByteArrayLock_BIO2RDF_Bio2RDF_DescribeAll_loop = new byte[0];
static byte[] commonByteArray_BIO2RDF_Bio2RDF_DescribeAll_loop = new byte[0];
public String subject;
public String getSubject() {
return this.subject;
}
public String predicate;
public String getPredicate() {
return this.predicate;
}
public String object;
public String getObject() {
return this.object;
}
public String graph;
public String getGraph() {
return this.graph;
}
public String type;
public String getType() {
return this.type;
}
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_DescribeAll_loop.length) {
if (length < 1024
&& commonByteArray_BIO2RDF_Bio2RDF_DescribeAll_loop.length == 0) {
commonByteArray_BIO2RDF_Bio2RDF_DescribeAll_loop = new byte[1024];
} else {
commonByteArray_BIO2RDF_Bio2RDF_DescribeAll_loop = new byte[2 * length];
}
}
dis.readFully(commonByteArray_BIO2RDF_Bio2RDF_DescribeAll_loop,
0, length);
strReturn = new String(
commonByteArray_BIO2RDF_Bio2RDF_DescribeAll_loop, 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_DescribeAll_loop) {
try {
int length = 0;
this.subject = readString(dis);
this.predicate = readString(dis);
this.object = readString(dis);
this.graph = readString(dis);
this.type = readString(dis);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
public void writeData(ObjectOutputStream dos) {
try {
// String
writeString(this.subject, dos);
// String
writeString(this.predicate, dos);
// String
writeString(this.object, dos);
// String
writeString(this.graph, dos);
// String
writeString(this.type, dos);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(super.toString());
sb.append("[");
sb.append("subject=" + subject);
sb.append(",predicate=" + predicate);
sb.append(",object=" + object);
sb.append(",graph=" + graph);
sb.append(",type=" + type);
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 row3Struct implements
routines.system.IPersistableRow<row3Struct> {
final static byte[] commonByteArrayLock_BIO2RDF_Bio2RDF_DescribeAll_loop = new byte[0];
static byte[] commonByteArray_BIO2RDF_Bio2RDF_DescribeAll_loop = new byte[0];
public String subject;
public String getSubject() {
return this.subject;
}
public String predicate;
public String getPredicate() {
return this.predicate;
}
public String object;
public String getObject() {
return this.object;
}
public String graph;
public String getGraph() {
return this.graph;
}
public String type;
public String getType() {
return this.type;
}
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_DescribeAll_loop.length) {
if (length < 1024
&& commonByteArray_BIO2RDF_Bio2RDF_DescribeAll_loop.length == 0) {
commonByteArray_BIO2RDF_Bio2RDF_DescribeAll_loop = new byte[1024];
} else {
commonByteArray_BIO2RDF_Bio2RDF_DescribeAll_loop = new byte[2 * length];
}
}
dis.readFully(commonByteArray_BIO2RDF_Bio2RDF_DescribeAll_loop,
0, length);
strReturn = new String(
commonByteArray_BIO2RDF_Bio2RDF_DescribeAll_loop, 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_DescribeAll_loop) {
try {
int length = 0;
this.subject = readString(dis);
this.predicate = readString(dis);
this.object = readString(dis);
this.graph = readString(dis);
this.type = readString(dis);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
public void writeData(ObjectOutputStream dos) {
try {
// String
writeString(this.subject, dos);
// String
writeString(this.predicate, dos);
// String
writeString(this.object, dos);
// String
writeString(this.graph, dos);
// String
writeString(this.type, dos);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(super.toString());
sb.append("[");
sb.append("subject=" + subject);
sb.append(",predicate=" + predicate);
sb.append(",object=" + object);
sb.append(",graph=" + graph);
sb.append(",type=" + type);
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 row2Struct implements
routines.system.IPersistableRow<row2Struct> {
final static byte[] commonByteArrayLock_BIO2RDF_Bio2RDF_DescribeAll_loop = new byte[0];
static byte[] commonByteArray_BIO2RDF_Bio2RDF_DescribeAll_loop = new byte[0];
public String endpoint;
public String getEndpoint() {
return this.endpoint;
}
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_DescribeAll_loop.length) {
if (length < 1024
&& commonByteArray_BIO2RDF_Bio2RDF_DescribeAll_loop.length == 0) {
commonByteArray_BIO2RDF_Bio2RDF_DescribeAll_loop = new byte[1024];
} else {
commonByteArray_BIO2RDF_Bio2RDF_DescribeAll_loop = new byte[2 * length];
}
}
dis.readFully(commonByteArray_BIO2RDF_Bio2RDF_DescribeAll_loop,
0, length);
strReturn = new String(
commonByteArray_BIO2RDF_Bio2RDF_DescribeAll_loop, 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_DescribeAll_loop) {
try {
int length = 0;
this.endpoint = readString(dis);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
public void writeData(ObjectOutputStream dos) {
try {
// String
writeString(this.endpoint, dos);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(super.toString());
sb.append("[");
sb.append("endpoint=" + endpoint);
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_Bio2RDF_DescribeAll_loop = new byte[0];
static byte[] commonByteArray_BIO2RDF_Bio2RDF_DescribeAll_loop = new byte[0];
public String endpoint;
public String getEndpoint() {
return this.endpoint;
}
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_DescribeAll_loop.length) {
if (length < 1024
&& commonByteArray_BIO2RDF_Bio2RDF_DescribeAll_loop.length == 0) {
commonByteArray_BIO2RDF_Bio2RDF_DescribeAll_loop = new byte[1024];
} else {
commonByteArray_BIO2RDF_Bio2RDF_DescribeAll_loop = new byte[2 * length];
}
}
dis.readFully(commonByteArray_BIO2RDF_Bio2RDF_DescribeAll_loop,
0, length);
strReturn = new String(
commonByteArray_BIO2RDF_Bio2RDF_DescribeAll_loop, 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_DescribeAll_loop) {
try {
int length = 0;
this.endpoint = readString(dis);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
public void writeData(ObjectOutputStream dos) {
try {
// String
writeString(this.endpoint, dos);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(super.toString());
sb.append("[");
sb.append("endpoint=" + endpoint);
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 tFixedFlowInput_1Process(
final java.util.Map<String, Object> globalMap)
throws TalendException {
globalMap.put("tFixedFlowInput_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;
row1Struct row1 = new row1Struct();
row1Struct row2 = row1;
row3Struct row3 = new row3Struct();
row4Struct row4 = new row4Struct();
/**
* [tFlowToIterate_1 begin ] start
*/
int NB_ITERATE_tSparqlSelectRequest_2 = 0; // for statistics
ok_Hash.put("tFlowToIterate_1", false);
start_Hash.put("tFlowToIterate_1", System.currentTimeMillis());
currentComponent = "tFlowToIterate_1";
int tos_count_tFlowToIterate_1 = 0;
int nb_line_tFlowToIterate_1 = 0;
int counter_tFlowToIterate_1 = 0;
/**
* [tFlowToIterate_1 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
*/
/**
* [tFixedFlowInput_1 begin ] start
*/
ok_Hash.put("tFixedFlowInput_1", false);
start_Hash.put("tFixedFlowInput_1", System.currentTimeMillis());
currentComponent = "tFixedFlowInput_1";
int tos_count_tFixedFlowInput_1 = 0;
StringBuilder result_tFixedFlowInput_1 = new StringBuilder();
result_tFixedFlowInput_1
.append("aHR0cDovL2FmZnltZXRyaXguYmlvMnJkZi5vcmcvc3BhcnFsCmh0dHA6Ly9iaW9tb2RlbHMuYmlv");
result_tFixedFlowInput_1
.append("MnJkZi5vcmcvc3BhcnFsCmh0dHA6Ly9iaW9wb3J0YWwuYmlvMnJkZi5vcmcvc3BhcnFsCmh0dHA6");
result_tFixedFlowInput_1
.append("Ly9jaGVtYmwuYmlvMnJkZi5vcmcvc3BhcnFsCmh0dHA6Ly9jbGluaWNhbHRyaWFscy5iaW8ycmRm");
result_tFixedFlowInput_1
.append("Lm9yZy9zcGFycWwKaHR0cDovL2N0ZC5iaW8ycmRmLm9yZy9zcGFycWwKaHR0cDovL2Ric25wLmJp");
result_tFixedFlowInput_1
.append("bzJyZGYub3JnL3NwYXJxbApodHRwOi8vZHJ1Z2JhbmsuYmlvMnJkZi5vcmcvc3BhcnFsCmh0dHA6");
result_tFixedFlowInput_1
.append("Ly9nZW5hZ2UuYmlvMnJkZi5vcmcvc3BhcnFsCmh0dHA6Ly9nZW5kci5iaW8ycmRmLm9yZy9zcGFy");
result_tFixedFlowInput_1
.append("cWwKaHR0cDovL2dvYS5iaW8ycmRmLm9yZy9zcGFycWwKaHR0cDovL2hnbmMuYmlvMnJkZi5vcmcv");
result_tFixedFlowInput_1
.append("c3BhcnFsCmh0dHA6Ly9ob21vbG9nZW5lLmJpbzJyZGYub3JnL3NwYXJxbApodHRwOi8vaW50ZXJw");
result_tFixedFlowInput_1
.append("cm8uYmlvMnJkZi5vcmcvc3BhcnFsCmh0dHA6Ly9pcHJvY2xhc3MuYmlvMnJkZi5vcmcvc3BhcnFs");
result_tFixedFlowInput_1
.append("Cmh0dHA6Ly9pcmVmaW5kZXguYmlvMnJkZi5vcmcvc3BhcnFsCmh0dHA6Ly9saW5rZWRzcGwuYmlv");
result_tFixedFlowInput_1
.append("MnJkZi5vcmcvc3BhcnFsCmh0dHA6Ly9sc3IuYmlvMnJkZi5vcmcvc3BhcnFsCmh0dHA6Ly9tZXNo");
result_tFixedFlowInput_1
.append("LmJpbzJyZGYub3JnL3NwYXJxbApodHRwOi8vbWdpLmJpbzJyZGYub3JnL3NwYXJxbApodHRwOi8v");
result_tFixedFlowInput_1
.append("bmNiaWdlbmUuYmlvMnJkZi5vcmcvc3BhcnFsCmh0dHA6Ly9uZGMuYmlvMnJkZi5vcmcvc3BhcnFs");
result_tFixedFlowInput_1
.append("Cmh0dHA6Ly9vbWltLmJpbzJyZGYub3JnL3NwYXJxbApodHRwOi8vb3JwaGFuZXQuYmlvMnJkZi5v");
result_tFixedFlowInput_1
.append("cmcvc3BhcnFsCmh0dHA6Ly9wYXRod2F5Y29tbW9ucy5iaW8ycmRmLm9yZy9zcGFycWwKaHR0cDov");
result_tFixedFlowInput_1
.append("L3BoYXJtZ2tiLmJpbzJyZGYub3JnL3NwYXJxbApodHRwOi8vcHVibWVkLmJpbzJyZGYub3JnL3Nw");
result_tFixedFlowInput_1
.append("YXJxbApodHRwOi8vcmVhY3RvbWUuYmlvMnJkZi5vcmcvc3BhcnFsCmh0dHA6Ly9zYWJpb3JrLmJp");
result_tFixedFlowInput_1
.append("bzJyZGYub3JnL3NwYXJxbApodHRwOi8vc2dkLmJpbzJyZGYub3JnL3NwYXJxbApodHRwOi8vc2lk");
result_tFixedFlowInput_1
.append("ZXIuYmlvMnJkZi5vcmcvc3BhcnFsCmh0dHA6Ly90YXhvbm9teS5iaW8ycmRmLm9yZy9zcGFycWwK");
result_tFixedFlowInput_1
.append("aHR0cDovL3dpa2lwYXRod2F5cy5iaW8ycmRmLm9yZy9zcGFycWwKaHR0cDovL3dvcm1iYXNlLmJp");
result_tFixedFlowInput_1
.append("bzJyZGYub3JnL3NwYXJxbApodHRwOi8vbmV4dHByb3QuYmlvMnJkZi5vcmcvc3BhcnFs");
String originalFileContent_tFixedFlowInput_1 = "";
try {
originalFileContent_tFixedFlowInput_1 = new String(
(new sun.misc.BASE64Decoder()).decodeBuffer(result_tFixedFlowInput_1
.toString()), utf8Charset);
} catch (java.lang.Exception e) {
e.printStackTrace();
}
int nb_line_tFixedFlowInput_1 = 0;
for (int i_tFixedFlowInput_1 = 0; i_tFixedFlowInput_1 < 1; i_tFixedFlowInput_1++) {
java.io.InputStream ins_tFixedFlowInput_1 = new java.io.ByteArrayInputStream(
originalFileContent_tFixedFlowInput_1
.getBytes(utf8Charset));
org.talend.fileprocess.FileInputDelimited fid_tFixedFlowInput_1 = new org.talend.fileprocess.FileInputDelimited(
ins_tFixedFlowInput_1, utf8Charset, ";", "\n",
true, 0, 0, -1, -1, false);
while (fid_tFixedFlowInput_1.nextRecord()) {
nb_line_tFixedFlowInput_1++;
row1 = new row1Struct();
if (0 < fid_tFixedFlowInput_1
.getColumnsCountOfCurrentRow()) {
String colContent = fid_tFixedFlowInput_1.get(0);
row1.endpoint = (colContent == null || colContent
.length() == 0) ? null : colContent;
} else {
row1.endpoint = null;
}
/**
* [tFixedFlowInput_1 begin ] stop
*/
/**
* [tFixedFlowInput_1 main ] start
*/
currentComponent = "tFixedFlowInput_1";
tos_count_tFixedFlowInput_1++;
/**
* [tFixedFlowInput_1 main ] stop
*/
/**
* [tLogRow_1 main ] start
*/
currentComponent = "tLogRow_1";
// /////////////////////
strBuffer_tLogRow_1 = new StringBuilder();
if (row1.endpoint != null) { //
strBuffer_tLogRow_1.append(String
.valueOf(row1.endpoint));
} //
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++;
// ////
// ////
// /////////////////////
row2 = row1;
tos_count_tLogRow_1++;
/**
* [tLogRow_1 main ] stop
*/
/**
* [tFlowToIterate_1 main ] start
*/
currentComponent = "tFlowToIterate_1";
globalMap.put("endpoint", row2.endpoint);
nb_line_tFlowToIterate_1++;
counter_tFlowToIterate_1++;
globalMap.put("tFlowToIterate_1_CURRENT_ITERATION",
counter_tFlowToIterate_1);
tos_count_tFlowToIterate_1++;
/**
* [tFlowToIterate_1 main ] stop
*/
NB_ITERATE_tSparqlSelectRequest_2++;
iterateLoop++;
/**
* [tSesameModelAddStatement_1 begin ] start
*/
ok_Hash.put("tSesameModelAddStatement_1", false);
start_Hash.put("tSesameModelAddStatement_1",
System.currentTimeMillis());
currentComponent = "tSesameModelAddStatement_1";
int tos_count_tSesameModelAddStatement_1 = 0;
org.openrdf.model.ValueFactory factory_tSesameModelAddStatement_1 = org.openrdf.model.impl.ValueFactoryImpl
.getInstance();
int nb_line_tSesameModelAddStatement_1 = 0;
/**
* [tSesameModelAddStatement_1 begin ] stop
*/
/**
* [tJavaRow_1 begin ] start
*/
ok_Hash.put("tJavaRow_1", false);
start_Hash
.put("tJavaRow_1", System.currentTimeMillis());
currentComponent = "tJavaRow_1";
int tos_count_tJavaRow_1 = 0;
int nb_line_tJavaRow_1 = 0;
/**
* [tJavaRow_1 begin ] stop
*/
/**
* [tSparqlSelectRequest_2 begin ] start
*/
ok_Hash.put("tSparqlSelectRequest_2", false);
start_Hash.put("tSparqlSelectRequest_2",
System.currentTimeMillis());
currentComponent = "tSparqlSelectRequest_2";
int tos_count_tSparqlSelectRequest_2 = 0;
String URL_string_tSparqlSelectRequest_2;
URL_string_tSparqlSelectRequest_2 = ((String) globalMap
.get("endpoint"))
+ "?default-graph-uri=&query="
+ java.net.URLEncoder
.encode("select ?s ?p ?o ?g isLiteral(?o) where { GRAPH ?g {?s ?p ?o . FILTER (?s = <http://bio2rdf.org/"
+ context.ns
+ ":"
+ context.id
+ ">) .}}", "UTF-8")
+ "&format=application%2Fsparql-results%2Bjson&timeout=0&debug=on";
org.json.JSONArray jsonArray_tSparqlSelectRequest_2 = new org.json.JSONArray();
org.json.JSONArray jsonKeysArray_tSparqlSelectRequest_2;
java.util.ArrayList<String> queryKeys_tSparqlSelectRequest_2 = new java.util.ArrayList<String>();
// ArrayList that will contain the key value of the
// query sorted correctly
org.json.JSONObject jsonObj_tSparqlSelectRequest_2;
java.util.Iterator<String> queryKeysIterator_tSparqlSelectRequest_2;
java.net.URL url_tSparqlSelectRequest_2 = new java.net.URL(
URL_string_tSparqlSelectRequest_2);
java.net.HttpURLConnection urlConn_tSparqlSelectRequest_2 = (java.net.HttpURLConnection) url_tSparqlSelectRequest_2
.openConnection();
urlConn_tSparqlSelectRequest_2.setRequestMethod("GET");
urlConn_tSparqlSelectRequest_2.setDoOutput(true);
urlConn_tSparqlSelectRequest_2.setDoInput(true);
urlConn_tSparqlSelectRequest_2.setUseCaches(false);
try {
urlConn_tSparqlSelectRequest_2.connect();
byte[] buffer_tSparqlSelectRequest_2 = new byte[1024];
int bos_buffer_tSparqlSelectRequest_2 = 0;
StringBuilder sb_tSparqlSelectRequest_2 = new StringBuilder();
if (java.net.HttpURLConnection.HTTP_OK == (urlConn_tSparqlSelectRequest_2
.getResponseCode())) {
java.io.InputStream bis_tSparqlSelectRequest_2 = new java.io.BufferedInputStream(
urlConn_tSparqlSelectRequest_2
.getInputStream());
while ((bos_buffer_tSparqlSelectRequest_2 = bis_tSparqlSelectRequest_2
.read(buffer_tSparqlSelectRequest_2)) != -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_2
.append(new String(
buffer_tSparqlSelectRequest_2,
0,
bos_buffer_tSparqlSelectRequest_2));
}
bis_tSparqlSelectRequest_2.close();
} else {
System.err
.println(urlConn_tSparqlSelectRequest_2
.getResponseCode()
+ " "
+ urlConn_tSparqlSelectRequest_2
.getResponseMessage());
}
urlConn_tSparqlSelectRequest_2.disconnect();
jsonObj_tSparqlSelectRequest_2 = new org.json.JSONObject(
sb_tSparqlSelectRequest_2.toString());
jsonKeysArray_tSparqlSelectRequest_2 = jsonObj_tSparqlSelectRequest_2
.getJSONObject("head").getJSONArray("vars");
for (int k_tSparqlSelectRequest_2 = 0; k_tSparqlSelectRequest_2 < jsonKeysArray_tSparqlSelectRequest_2
.length(); k_tSparqlSelectRequest_2++) {
queryKeys_tSparqlSelectRequest_2
.add(jsonKeysArray_tSparqlSelectRequest_2
.getString(k_tSparqlSelectRequest_2));
}
jsonArray_tSparqlSelectRequest_2 = jsonObj_tSparqlSelectRequest_2
.getJSONObject("results").getJSONArray(
"bindings");
} catch (Exception e) {
System.err.println("UnknownHostException");
}
if (jsonArray_tSparqlSelectRequest_2.length() == 0) {
globalMap.put("tSparqlSelectRequest_2_HAS_RESULTS",
false);
} else {
globalMap.put("tSparqlSelectRequest_2_HAS_RESULTS",
true);
}
int i_tSparqlSelectRequest_2;
int nb_line_tSparqlSelectRequest_2 = 0;
for (i_tSparqlSelectRequest_2 = 0; i_tSparqlSelectRequest_2 < jsonArray_tSparqlSelectRequest_2
.length(); i_tSparqlSelectRequest_2++) {
/**
* [tSparqlSelectRequest_2 begin ] stop
*/
/**
* [tSparqlSelectRequest_2 main ] start
*/
currentComponent = "tSparqlSelectRequest_2";
queryKeysIterator_tSparqlSelectRequest_2 = queryKeys_tSparqlSelectRequest_2
.iterator();
if (queryKeysIterator_tSparqlSelectRequest_2
.hasNext()) {
try {
row3.subject = jsonArray_tSparqlSelectRequest_2
.getJSONObject(
i_tSparqlSelectRequest_2)
.getJSONObject(
queryKeysIterator_tSparqlSelectRequest_2
.next())
.getString("value");
} catch (org.json.JSONException e_tSparqlSelectRequest_2) {
row3.subject = "";
}
}
if (queryKeysIterator_tSparqlSelectRequest_2
.hasNext()) {
try {
row3.predicate = jsonArray_tSparqlSelectRequest_2
.getJSONObject(
i_tSparqlSelectRequest_2)
.getJSONObject(
queryKeysIterator_tSparqlSelectRequest_2
.next())
.getString("value");
} catch (org.json.JSONException e_tSparqlSelectRequest_2) {
row3.predicate = "";
}
}
if (queryKeysIterator_tSparqlSelectRequest_2
.hasNext()) {
try {
row3.object = jsonArray_tSparqlSelectRequest_2
.getJSONObject(
i_tSparqlSelectRequest_2)
.getJSONObject(
queryKeysIterator_tSparqlSelectRequest_2
.next())
.getString("value");
} catch (org.json.JSONException e_tSparqlSelectRequest_2) {
row3.object = "";
}
}
if (queryKeysIterator_tSparqlSelectRequest_2
.hasNext()) {
try {
row3.graph = jsonArray_tSparqlSelectRequest_2
.getJSONObject(
i_tSparqlSelectRequest_2)
.getJSONObject(
queryKeysIterator_tSparqlSelectRequest_2
.next())
.getString("value");
} catch (org.json.JSONException e_tSparqlSelectRequest_2) {
row3.graph = "";
}
}
if (queryKeysIterator_tSparqlSelectRequest_2
.hasNext()) {
try {
row3.type = jsonArray_tSparqlSelectRequest_2
.getJSONObject(
i_tSparqlSelectRequest_2)
.getJSONObject(
queryKeysIterator_tSparqlSelectRequest_2
.next())
.getString("value");
} catch (org.json.JSONException e_tSparqlSelectRequest_2) {
row3.type = "";
}
}
tos_count_tSparqlSelectRequest_2++;
/**
* [tSparqlSelectRequest_2 main ] stop
*/
/**
* [tJavaRow_1 main ] start
*/
currentComponent = "tJavaRow_1";
// Code généré selon le schémas d'entrée et de
// sortie
row4.subject = row3.subject;
row4.predicate = row3.predicate;
row4.object = row3.object;
row4.graph = row3.graph;
if (row3.type.equals(0)) {
row4.type = "uri";
} else {
row4.type = "string";
}
nb_line_tJavaRow_1++;
tos_count_tJavaRow_1++;
/**
* [tJavaRow_1 main ] stop
*/
/**
* [tSesameModelAddStatement_1 main ] start
*/
currentComponent = "tSesameModelAddStatement_1";
String subject_tSesameModelAddStatement_1 = row4.subject;
String predicate_tSesameModelAddStatement_1 = row4.predicate;
String object_tSesameModelAddStatement_1 = row4.object;
String graph_tSesameModelAddStatement_1 = row4.graph;
org.openrdf.model.Model model_tSesameModelAddStatement_1 = (org.openrdf.model.Model) globalMap
.get("model_tSesameModelCreate_1");
try {
if (row4.type.toLowerCase().equals("uri")) {
model_tSesameModelAddStatement_1
.add(factory_tSesameModelAddStatement_1
.createURI(subject_tSesameModelAddStatement_1),
factory_tSesameModelAddStatement_1
.createURI(predicate_tSesameModelAddStatement_1),
factory_tSesameModelAddStatement_1
.createURI(object_tSesameModelAddStatement_1),
factory_tSesameModelAddStatement_1
.createURI(graph_tSesameModelAddStatement_1));
}
else {
model_tSesameModelAddStatement_1
.add(factory_tSesameModelAddStatement_1
.createURI(subject_tSesameModelAddStatement_1),
factory_tSesameModelAddStatement_1
.createURI(predicate_tSesameModelAddStatement_1),
factory_tSesameModelAddStatement_1
.createLiteral(object_tSesameModelAddStatement_1),
factory_tSesameModelAddStatement_1
.createURI(graph_tSesameModelAddStatement_1));
}
globalMap.put("model_tSesameModelCreate_1",
model_tSesameModelAddStatement_1);
} catch (Exception e) {
// System.out.println("Fail");
}
nb_line_tSesameModelAddStatement_1++;
tos_count_tSesameModelAddStatement_1++;
/**
* [tSesameModelAddStatement_1 main ] stop
*/
/**
* [tSparqlSelectRequest_2 end ] start
*/
currentComponent = "tSparqlSelectRequest_2";
nb_line_tSparqlSelectRequest_2++;
}
globalMap.put("tSparqlSelectRequest_2_NB_LINE",
nb_line_tSparqlSelectRequest_2);
ok_Hash.put("tSparqlSelectRequest_2", true);
end_Hash.put("tSparqlSelectRequest_2",
System.currentTimeMillis());
/**
* [tSparqlSelectRequest_2 end ] stop
*/
/**
* [tJavaRow_1 end ] start
*/
currentComponent = "tJavaRow_1";
globalMap.put("tJavaRow_1_NB_LINE", nb_line_tJavaRow_1);
ok_Hash.put("tJavaRow_1", true);
end_Hash.put("tJavaRow_1", System.currentTimeMillis());
/**
* [tJavaRow_1 end ] stop
*/
/**
* [tSesameModelAddStatement_1 end ] start
*/
currentComponent = "tSesameModelAddStatement_1";
globalMap.put("tSesameModelAddStatement_1_NB_LINE",
nb_line_tSesameModelAddStatement_1);
ok_Hash.put("tSesameModelAddStatement_1", true);
end_Hash.put("tSesameModelAddStatement_1",
System.currentTimeMillis());
/**
* [tSesameModelAddStatement_1 end ] stop
*/
/**
* [tFixedFlowInput_1 end ] start
*/
currentComponent = "tFixedFlowInput_1";
}
fid_tFixedFlowInput_1.close();
}
globalMap.put("tFixedFlowInput_1_NB_LINE",
nb_line_tFixedFlowInput_1);
ok_Hash.put("tFixedFlowInput_1", true);
end_Hash.put("tFixedFlowInput_1", System.currentTimeMillis());
/**
* [tFixedFlowInput_1 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
*/
/**
* [tFlowToIterate_1 end ] start
*/
currentComponent = "tFlowToIterate_1";
globalMap.put("tFlowToIterate_1_NB_LINE",
nb_line_tFlowToIterate_1);
ok_Hash.put("tFlowToIterate_1", true);
end_Hash.put("tFlowToIterate_1", System.currentTimeMillis());
/**
* [tFlowToIterate_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 {
/**
* [tFixedFlowInput_1 finally ] start
*/
currentComponent = "tFixedFlowInput_1";
/**
* [tFixedFlowInput_1 finally ] stop
*/
/**
* [tLogRow_1 finally ] start
*/
currentComponent = "tLogRow_1";
/**
* [tLogRow_1 finally ] stop
*/
/**
* [tFlowToIterate_1 finally ] start
*/
currentComponent = "tFlowToIterate_1";
/**
* [tFlowToIterate_1 finally ] stop
*/
/**
* [tSparqlSelectRequest_2 finally ] start
*/
currentComponent = "tSparqlSelectRequest_2";
/**
* [tSparqlSelectRequest_2 finally ] stop
*/
/**
* [tJavaRow_1 finally ] start
*/
currentComponent = "tJavaRow_1";
/**
* [tJavaRow_1 finally ] stop
*/
/**
* [tSesameModelAddStatement_1 finally ] start
*/
currentComponent = "tSesameModelAddStatement_1";
/**
* [tSesameModelAddStatement_1 finally ] stop
*/
} catch (java.lang.Exception e) {
// ignore
} catch (java.lang.Error error) {
// ignore
}
resourceMap = null;
}
globalMap.put("tFixedFlowInput_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_DescribeAll_loop Bio2RDF_DescribeAll_loopClass = new Bio2RDF_DescribeAll_loop();
int exitCode = Bio2RDF_DescribeAll_loopClass.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_DescribeAll_loop.class
.getClassLoader().getResourceAsStream(
"bio2rdf/bio2rdf_describeall_loop_0_1/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.ns = (String) context.getProperty("ns");
context.id = (String) context.getProperty("id");
context.ntriples = (String) context.getProperty("ntriples");
context.format = (String) context.getProperty("format");
context.database_endpoint = (String) context
.getProperty("database_endpoint");
} 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("ns")) {
context.ns = (String) parentContextMap.get("ns");
}
if (parentContextMap.containsKey("id")) {
context.id = (String) parentContextMap.get("id");
}
if (parentContextMap.containsKey("ntriples")) {
context.ntriples = (String) parentContextMap.get("ntriples");
}
if (parentContextMap.containsKey("format")) {
context.format = (String) parentContextMap.get("format");
}
if (parentContextMap.containsKey("database_endpoint")) {
context.database_endpoint = (String) parentContextMap
.get("database_endpoint");
}
}
// 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;
tSesameModelCreate_1Process(globalMap);
if (!"failure".equals(status)) {
status = "end";
}
} catch (TalendException e_tSesameModelCreate_1) {
globalMap.put("tSesameModelCreate_1_SUBPROCESS_STATE", -1);
e_tSesameModelCreate_1.printStackTrace();
}
this.globalResumeTicket = true;// to run tPostJob
try {
errorCode = null;
tPostjob_1Process(globalMap);
if (!"failure".equals(status)) {
status = "end";
}
} catch (TalendException e_tPostjob_1) {
globalMap.put("tPostjob_1_SUBPROCESS_STATE", -1);
e_tPostjob_1.printStackTrace();
}
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_DescribeAll_loop");
}
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;
}
/************************************************************************************************
* 77361 characters generated by Talend Open Studio for ESB on the 29 août 2014
* 16:28:18 EDT
************************************************************************************************/