Compare commits
61 Commits
patch/TPS-
...
bugfix/6.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65521fe787 | ||
|
|
1b352a0717 | ||
|
|
8c7001ddb8 | ||
|
|
40ff8318d5 | ||
|
|
6adb459d72 | ||
|
|
0c4d3f6496 | ||
|
|
198c42c1c4 | ||
|
|
15f4f30072 | ||
|
|
3678ba9d15 | ||
|
|
78c0b847ed | ||
|
|
613fe89353 | ||
|
|
9454a83171 | ||
|
|
7905bdc654 | ||
|
|
92c1df3f29 | ||
|
|
00ea4cd731 | ||
|
|
bc90f108d7 | ||
|
|
ab6149b248 | ||
|
|
bb91988bb1 | ||
|
|
ae9073f471 | ||
|
|
ca57dfacf8 | ||
|
|
05af5bf600 | ||
|
|
0807265663 | ||
|
|
54e715e7c8 | ||
|
|
bfd5f82ac5 | ||
|
|
8094b7bfb4 | ||
|
|
0567af9bc8 | ||
|
|
b6ff8d3ff6 | ||
|
|
463ef16ab5 | ||
|
|
d13a061428 | ||
|
|
d805167f5e | ||
|
|
0b7d6f8ca5 | ||
|
|
a5abed33d9 | ||
|
|
b547e844cb | ||
|
|
7630ffa121 | ||
|
|
191ef84e29 | ||
|
|
a8059247b3 | ||
|
|
d70506ae4d | ||
|
|
79888cca13 | ||
|
|
325a248645 | ||
|
|
c1143106a3 | ||
|
|
8c04bf77b2 | ||
|
|
6056dcaca6 | ||
|
|
cc8f7140b6 | ||
|
|
e292cd6e80 | ||
|
|
12dadf118b | ||
|
|
34b52c3216 | ||
|
|
f502cfa5f7 | ||
|
|
191600b6c7 | ||
|
|
c04ebb3a26 | ||
|
|
da1037cc73 | ||
|
|
2c3dc0a013 | ||
|
|
60561fd06e | ||
|
|
ea00977f55 | ||
|
|
dcf012746c | ||
|
|
4794001d6e | ||
|
|
cabbd8669d | ||
|
|
866f0e75a3 | ||
|
|
9273ae0e70 | ||
|
|
e139770ffb | ||
|
|
2c4ec03831 | ||
|
|
4dec127b3e |
@@ -136,7 +136,7 @@ public class FileCopy {
|
||||
if (index > 0) {
|
||||
int end = index;
|
||||
int start = index;
|
||||
while (sb.charAt(start) != '"') { //$NON-NLS-1$
|
||||
while (sb.charAt(start) != '"') {
|
||||
start--;
|
||||
}
|
||||
sb.replace(start + 1, end, "../../.."); //$NON-NLS-1$
|
||||
@@ -156,8 +156,11 @@ public class FileCopy {
|
||||
input.close();
|
||||
}
|
||||
if (temp.isDirectory()) { // copy subfolder
|
||||
copyComponentFolder(sourceComponentFolder + File.separator + file[i], targetComponentFolder + File.separator
|
||||
+ file[i], modifySkeletonValue);
|
||||
// TDI-31436:Avoid case of copy infinite subfolder if target folder is under source folder
|
||||
if (!temp.getAbsolutePath().equals(targetComponentFolder)) {
|
||||
copyComponentFolder(sourceComponentFolder + File.separator + file[i], targetComponentFolder
|
||||
+ File.separator + file[i], modifySkeletonValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -342,6 +342,9 @@ end_Hash.put("<%=node.getUniqueName() %>", System.currentTimeMillis());
|
||||
if(errorThread_<%=iterateTargetNodeName %>.exception!=null){
|
||||
throw errorThread_<%=iterateTargetNodeName %>.exception;
|
||||
}
|
||||
if(errorThread_<%=iterateTargetNodeName %>.error!=null){
|
||||
throw errorThread_<%=iterateTargetNodeName %>.error;
|
||||
}
|
||||
}else{
|
||||
Integer threadErrorCode = mtp_<%=iterateTargetNodeName %>.getTalendThreadResult().getErrorCode();
|
||||
String threadStatus = mtp_<%=iterateTargetNodeName %>.getTalendThreadResult().getStatus();
|
||||
|
||||
@@ -83,6 +83,17 @@
|
||||
talendThreadPool.setErrorThread(this);
|
||||
talendThreadPool.stopAllWorkers();
|
||||
|
||||
} catch (java.lang.Error error){
|
||||
this.status = "failure";
|
||||
Integer localErrorCode = (Integer) (((java.util.Map) threadLocal.get()).get("errorCode"));
|
||||
if (localErrorCode != null) {
|
||||
if (this.errorCode == null || localErrorCode.compareTo(this.errorCode) > 0) {
|
||||
this.errorCode = localErrorCode;
|
||||
}
|
||||
}
|
||||
this.error = error;
|
||||
talendThreadPool.setErrorThread(this);
|
||||
talendThreadPool.stopAllWorkers();
|
||||
} finally {
|
||||
try{
|
||||
<%=finallyPart%>
|
||||
@@ -134,4 +145,4 @@
|
||||
}//3
|
||||
}//2
|
||||
}//1
|
||||
%>
|
||||
%>
|
||||
|
||||
@@ -56,6 +56,7 @@ ComponentsPreferencePage.rowLimit=Row limit
|
||||
ComponentsPreferencePage.WarningMsg=Need to restart Talend Open Studio to load extral components !
|
||||
ComponentsPreferencePage.WarningTitle=Warning
|
||||
ComponentsPreferencePage.directoryFieldLabel=User component folder\:
|
||||
ComponentsPreferencePage.notValidDirectory=Your selection will result in folder nesting, which is not recommended. Do you want to continue anyway?
|
||||
ComponentsProviderManager.unableLoad=unable to load component provider
|
||||
ComponenttRunJobPreferencePage.label=Don't show corresponding job after double click on a tRunJob Component.
|
||||
ComponentJobletPreferencePage.label=Don't show corresponding job after double click on a Joblet Component.
|
||||
|
||||
@@ -15,9 +15,9 @@ package org.talend.designer.codegen.components.ui;
|
||||
import java.io.File;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
|
||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||
@@ -43,7 +43,6 @@ import org.talend.commons.ui.utils.workbench.preferences.ComboFieldEditor;
|
||||
import org.talend.core.CorePlugin;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.PluginChecker;
|
||||
import org.talend.core.model.components.ComponentPaletteUtilities;
|
||||
import org.talend.designer.codegen.CodeGeneratorActivator;
|
||||
import org.talend.designer.codegen.ICodeGeneratorService;
|
||||
import org.talend.designer.codegen.i18n.Messages;
|
||||
@@ -81,6 +80,8 @@ public class ComponentsPreferencePage extends FieldEditorPreferencePage implemen
|
||||
|
||||
private static String oldPath = null;
|
||||
|
||||
private final String component_suffix = "_java.xml";
|
||||
|
||||
/**
|
||||
* This class exists to provide visibility to the <code>refreshValidState</code> method and to perform more
|
||||
* intelligent clearing of the error message.
|
||||
@@ -290,6 +291,15 @@ public class ComponentsPreferencePage extends FieldEditorPreferencePage implemen
|
||||
filePathTemp.showErrorMessage();
|
||||
setValid(false);
|
||||
} else {
|
||||
if (oldPath.equals(newPath)) {
|
||||
setValid(true);
|
||||
return;
|
||||
}
|
||||
if (!StringUtils.isEmpty(newPath)) {
|
||||
if (!checkUserComponentsFolder(file)) {
|
||||
filePathTemp.getTextControl(parent).setText(oldPath);
|
||||
}
|
||||
}
|
||||
setValid(true);
|
||||
}
|
||||
}
|
||||
@@ -308,6 +318,18 @@ public class ComponentsPreferencePage extends FieldEditorPreferencePage implemen
|
||||
parent.pack();
|
||||
}
|
||||
|
||||
private boolean checkUserComponentsFolder(File componentsfolder) {
|
||||
for (File subFile : componentsfolder.listFiles()) {
|
||||
String name = subFile.getName();
|
||||
if (name.equals(componentsfolder.getName() + component_suffix)) {
|
||||
boolean isContinue = MessageDialog.openConfirm(Display.getDefault().getActiveShell(), "Confirm",
|
||||
Messages.getString("ComponentsPreferencePage.notValidDirectory")); //$NON-NLS-1$
|
||||
return isContinue;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void propertyChangeForComponents(PropertyChangeEvent event) {
|
||||
MessageDialog warningMessageDialog = new MessageDialog(getFieldEditorParent().getShell(),
|
||||
Messages.getString("ComponentsPreferencePage.WarningTitle"), null, //$NON-NLS-1$
|
||||
|
||||
@@ -9,13 +9,14 @@
|
||||
<property name="jar.name" value="cobolX.jar" />
|
||||
<property name="component.name" value="tFileInputEBCDIC" />
|
||||
<property name="author.name" value="jjzhou" />
|
||||
|
||||
|
||||
<!-- modification 2: compile classpath -->
|
||||
<path id="compile.classpath">
|
||||
<pathelement location="../../libs/commons-lang-2.6.jar"/>
|
||||
</path>
|
||||
|
||||
<!-- #################################################### -->
|
||||
|
||||
<!-- #################################################### -->
|
||||
|
||||
|
||||
<!-- sourcecode and final jar path -->
|
||||
<property name="source.home" value="." />
|
||||
@@ -33,7 +34,7 @@
|
||||
<target name="process" description="prepare a temp dir">
|
||||
<antcall target="prepare" />
|
||||
<antcall target="compile" />
|
||||
<antcall target="clean" />
|
||||
<antcall target="clean" />
|
||||
</target>
|
||||
|
||||
<target name="prepare" description="prepare a temp dir">
|
||||
@@ -48,7 +49,7 @@
|
||||
<javac srcdir="${source.home}" destdir="${build.dir}/classes" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}">
|
||||
<classpath refid="compile.classpath" />
|
||||
</javac>
|
||||
|
||||
|
||||
<!-- include source code -->
|
||||
<copy todir="${build.dir}/classes">
|
||||
<fileset dir="${source.home}">
|
||||
@@ -66,7 +67,7 @@
|
||||
<!-- who -->
|
||||
<attribute name="Built-By" value="${author.name}" />
|
||||
<!-- when -->
|
||||
<attribute name="Built-Date" value="${date}"/>
|
||||
<attribute name="Built-Date" value="${date}"/>
|
||||
<!-- JDK version -->
|
||||
<attribute name="Created-By" value="${java.version} (${java.vendor})" />
|
||||
<!-- Information about the program itself -->
|
||||
@@ -85,4 +86,4 @@
|
||||
<delete dir="${build.dir}" />
|
||||
<mkdir dir="${build.dir}" />
|
||||
</target>
|
||||
</project>
|
||||
</project>
|
||||
|
||||
@@ -4,9 +4,34 @@ import java.math.BigDecimal;
|
||||
import org.apache.commons.lang.mutable.MutableInt;
|
||||
|
||||
public class EBCDICType3 {
|
||||
|
||||
public static BigDecimal readType3Value(byte[] byteValue, int decimal,
|
||||
boolean isImpliedDecimal) throws Exception {
|
||||
boolean isImpliedDecimal){
|
||||
BigDecimal retVal = new BigDecimal(convertByteArr2Hex(byteValue,decimal,isImpliedDecimal));
|
||||
int lgth = byteValue.length;
|
||||
int tmp = byteValue[lgth-1] & 0x0F;
|
||||
|
||||
if ((tmp == 0x0F) || (tmp == 0x0C)) {
|
||||
return retVal;
|
||||
} else if (tmp == 0x0D) {
|
||||
return retVal.negate();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isValidPackedDecimal(byte[] byteArr){
|
||||
boolean isValid = false;
|
||||
int lgth = byteArr.length;
|
||||
if(lgth > 0){
|
||||
int tmp = byteArr[lgth-1] & 0x0F;
|
||||
if(tmp == 0x0F || tmp == 0x0C || tmp == 0x0D){
|
||||
isValid = true;
|
||||
}
|
||||
}
|
||||
return isValid;
|
||||
}
|
||||
|
||||
public static String convertByteArr2Hex(byte[] byteValue, int decimal, boolean isImpliedDecimal){
|
||||
int len = byteValue.length;
|
||||
StringBuffer strbuf = new StringBuffer();
|
||||
int tmp;
|
||||
@@ -29,24 +54,27 @@ public class EBCDICType3 {
|
||||
strbuf.insert(strbuf.length() - decimal, '.');
|
||||
}
|
||||
|
||||
BigDecimal retVal;
|
||||
return strbuf.toString();
|
||||
}
|
||||
|
||||
try {
|
||||
retVal = new BigDecimal(strbuf.toString());
|
||||
} catch (NumberFormatException ex) {
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
tmp = byteValue[len - 1];
|
||||
tmp1 = tmp & 0x0F;
|
||||
|
||||
if ((tmp1 == 0x0F) || (tmp1 == 0x0C)) {
|
||||
return retVal;
|
||||
} else if (tmp1 == 0x0D) {
|
||||
return retVal.negate();
|
||||
} else {
|
||||
return retVal;
|
||||
}
|
||||
public static BigDecimal readType3(byte[] byteValue, int decimal,
|
||||
boolean isImpliedDecimal,String defaultStrValue){
|
||||
if(defaultStrValue == null || "".equals(defaultStrValue)){
|
||||
return readType3Value(byteValue,decimal,isImpliedDecimal);
|
||||
}else{
|
||||
boolean isValid = isValidPackedDecimal(byteValue);
|
||||
BigDecimal convertedBigDecimal = new BigDecimal(convertByteArr2Hex(byteValue,decimal,isImpliedDecimal));// implicit else part
|
||||
if(isValid){
|
||||
int lgth = byteValue.length;
|
||||
int tmp = byteValue[lgth-1] & 0x0F;
|
||||
if(tmp == 0x0D){// implicit else part for 0x0F or 0x0C
|
||||
convertedBigDecimal = convertedBigDecimal.negate();
|
||||
}
|
||||
}else{
|
||||
convertedBigDecimal = new BigDecimal(defaultStrValue);
|
||||
}
|
||||
return convertedBigDecimal;
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] writeType3Value(int length, int decimal,
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="org.talend.designer.components.libs" default="process" basedir=".">
|
||||
|
||||
<property name="component.plugin.home" value="../../../org.talend.designer.components.localprovider/components" />
|
||||
<property name="poi.jar.home" value="../../../org.talend.libraries.excel/lib" />
|
||||
<property name="axis2.jar.home" value="../../../org.talend.libraries.apache.axis2/lib" />
|
||||
<property name="dom4j.jar.home" value="../../../org.talend.libraries.dom4j-jaxen/lib" />
|
||||
<property name="apache.jar.home" value="../../../org.talend.libraries.apache/lib" />
|
||||
|
||||
<!-- #################################################### -->
|
||||
|
||||
@@ -12,14 +15,14 @@
|
||||
|
||||
<!-- modification 2: compile classpath -->
|
||||
<path id="compile.classpath">
|
||||
<pathelement location="${component.plugin.home}/tFileInputXML/dom4j-1.6.1.jar" />
|
||||
<pathelement location="${component.plugin.home}/tMicrosoftCrmInput/geronimo-stax-api_1.0_spec-1.0.jar" />
|
||||
<pathelement location="${component.plugin.home}/tFileInputExcel/log4j-1.2.15.jar" />
|
||||
<pathelement location="${component.plugin.home}/tFileInputExcel/poi-3.8-20120913_modified_talend.jar" />
|
||||
<pathelement location="${component.plugin.home}/tFileInputExcel/poi-ooxml-3.8-20121127_modified_talend.jar" />
|
||||
<pathelement location="${component.plugin.home}/tFileInputExcel/poi-ooxml-schemas-3.8-20120326.jar" />
|
||||
<pathelement location="${component.plugin.home}/tFileInputExcel/poi-scratchpad-3.8-20120326.jar" />
|
||||
<pathelement location="${component.plugin.home}/tMicrosoftCrmInput/xmlbeans-2.3.0.jar" />
|
||||
<pathelement location="${dom4j.jar.home}/dom4j-1.6.1.jar" />
|
||||
<pathelement location="${axis2.jar.home}/geronimo-stax-api_1.0_spec-1.0.jar" />
|
||||
<pathelement location="${apache.jar.home}/log4j-1.2.17.jar" />
|
||||
<pathelement location="${poi.jar.home}/poi-3.11-20141221_modified_talend.jar" />
|
||||
<pathelement location="${poi.jar.home}/poi-ooxml-3.11-20141221_modified_talend.jar" />
|
||||
<pathelement location="${poi.jar.home}/poi-ooxml-schemas-3.11-20141221.jar" />
|
||||
<pathelement location="${poi.jar.home}/poi-scratchpad-3.11-20141221.jar" />
|
||||
<pathelement location="${apache.jar.home}/xmlbeans-2.3.0.jar" />
|
||||
</path>
|
||||
|
||||
<!-- #################################################### -->
|
||||
@@ -27,7 +30,7 @@
|
||||
|
||||
<!-- sourcecode and final jar path -->
|
||||
<property name="source.home" value="." />
|
||||
<property name="jar.home" value="${component.plugin.home}/${component.name}/${jar.name}" />
|
||||
<property name="jar.home" value="${poi.jar.home}/${jar.name}" />
|
||||
|
||||
<!-- temp dir for clasee files -->
|
||||
<property name="build.dir" value="../../build" />
|
||||
|
||||
@@ -15,6 +15,8 @@ package com.talend.excel.xssf.event;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.poi.xssf.usermodel.XSSFComment;
|
||||
|
||||
/**
|
||||
* created by wwang on 2012-9-27 Detailled comment
|
||||
*
|
||||
@@ -41,7 +43,7 @@ public class DefaultTalendSheetContentsHandler implements TalendXSSFSheetXMLHand
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endRow() {
|
||||
public void endRow(int rowNum) {
|
||||
cache.writeData(row);
|
||||
row = null;
|
||||
// when each row end ,reset lastColumnIndex
|
||||
@@ -52,7 +54,7 @@ public class DefaultTalendSheetContentsHandler implements TalendXSSFSheetXMLHand
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cell(String cellReference, String formattedValue) {
|
||||
public void cell(String cellReference, String formattedValue,XSSFComment comment) {
|
||||
checkHasNullValue(cellReference);
|
||||
row.add(formattedValue);
|
||||
}
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
<pathelement location="${dom4j.jar.home}/dom4j-1.6.1.jar" />
|
||||
<pathelement location="${axis2.jar.home}/geronimo-stax-api_1.0_spec-1.0.jar" />
|
||||
<pathelement location="${apache.jar.home}/log4j-1.2.17.jar" />
|
||||
<pathelement location="${poi.jar.home}/poi-3.10-FINAL-20140219_modified_talend.jar" />
|
||||
<pathelement location="${poi.jar.home}/poi-ooxml-3.10-FINAL-20140219_modified_talend.jar" />
|
||||
<pathelement location="${poi.jar.home}/poi-ooxml-schemas-3.10-FINAL-20140208.jar" />
|
||||
<pathelement location="${poi.jar.home}/poi-scratchpad-3.10-FINAL-20140208.jar" />
|
||||
<pathelement location="${poi.jar.home}/poi-3.11-20141221_modified_talend.jar" />
|
||||
<pathelement location="${poi.jar.home}/poi-ooxml-3.11-20141221_modified_talend.jar" />
|
||||
<pathelement location="${poi.jar.home}/poi-ooxml-schemas-3.11-20141221.jar" />
|
||||
<pathelement location="${poi.jar.home}/poi-scratchpad-3.11-20141221.jar" />
|
||||
<pathelement location="${apache.jar.home}/xmlbeans-2.3.0.jar" />
|
||||
</path>
|
||||
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.talend</groupId>
|
||||
<artifactId>talendMQConnectionUtil</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>talendMQConnectionUtil</name>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.activemq</groupId>
|
||||
<artifactId>activemq-all</artifactId>
|
||||
<version>5.10.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ibm</groupId>
|
||||
<artifactId>com.ibm.mq</artifactId>
|
||||
<version>x</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ibm</groupId>
|
||||
<artifactId>com.ibm.mqjms</artifactId>
|
||||
<version>x</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.resource</groupId>
|
||||
<artifactId>connector-api</artifactId>
|
||||
<version>1.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.talend</groupId>
|
||||
<artifactId>talendMQRFH2</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,7 @@
|
||||
Note:
|
||||
About the jar we can't find in http://mvnrepository.com/ .
|
||||
we need add it to the local repository manually.
|
||||
For example:
|
||||
mvn install:install-file -Dfile=D:\workspace\talend_540\.Java\lib\talendMQRFH2.jar -DgroupId=org.talend -DartifactId=talendMQRFH2 -Dversion=1.0.0 -Dpackaging=jar
|
||||
mvn install:install-file -Dfile=D:\workspace\talend_540\.Java\lib\com.ibm.mq.jar -DgroupId=com.ibm -DartifactId=com.ibm.mq -Dversion=x -Dpackaging=jar
|
||||
mvn install:install-file -Dfile=D:\workspace\talend_540\.Java\lib\com.ibm.mqjms.jar -DgroupId=com.ibm -DartifactId=com.ibm.mqjms -Dversion=x -Dpackaging=jar
|
||||
@@ -0,0 +1,128 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.mq;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.jms.JMSException;
|
||||
|
||||
import org.apache.activemq.ConnectionClosedException;
|
||||
|
||||
/**
|
||||
* A buffer to keep all the MQ connections, make it reusable between the
|
||||
* different jobs.
|
||||
*/
|
||||
public class SharedActiveMQConnection {
|
||||
|
||||
private static boolean DEBUG = false;
|
||||
|
||||
private static SharedActiveMQConnection instance = null;
|
||||
|
||||
private Map<String, javax.jms.Connection> sharedConnections = new HashMap<String, javax.jms.Connection>();
|
||||
|
||||
private SharedActiveMQConnection() {
|
||||
|
||||
}
|
||||
|
||||
private static synchronized SharedActiveMQConnection getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new SharedActiveMQConnection();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
private synchronized javax.jms.Connection getConnection(String url,
|
||||
String userName, String password, String mqConnectionName)
|
||||
throws JMSException {
|
||||
if (DEBUG) {
|
||||
Set<String> keySet = sharedConnections.keySet();
|
||||
System.out
|
||||
.print("SharedMQConnection, current shared connections list is:"); //$NON-NLS-1$
|
||||
for (String key : keySet) {
|
||||
System.out.print(" " + key); //$NON-NLS-1$
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
javax.jms.Connection connection = sharedConnections
|
||||
.get(mqConnectionName);
|
||||
if (connection == null) {
|
||||
if (DEBUG) {
|
||||
System.out
|
||||
.println("SharedMQConnection, can't find the key:" + mqConnectionName + " " //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ "so create a new one and share it."); //$NON-NLS-1$
|
||||
}
|
||||
org.apache.activemq.ActiveMQConnectionFactory factory = new org.apache.activemq.ActiveMQConnectionFactory(
|
||||
url);
|
||||
if (userName == null || ("").equals(userName)) {
|
||||
connection = factory.createConnection();
|
||||
} else {
|
||||
connection = factory.createConnection(userName, password);
|
||||
}
|
||||
connection.start();
|
||||
sharedConnections.put(mqConnectionName, connection);
|
||||
} else {
|
||||
try{
|
||||
connection.start();
|
||||
if (DEBUG) {
|
||||
System.out
|
||||
.println("SharedMQConnection, find the key: " + mqConnectionName + " " + "it is OK."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
}
|
||||
}catch(ConnectionClosedException e){
|
||||
if (DEBUG) {
|
||||
System.out.println("SharedMQConnection, find the key: " + mqConnectionName + " " //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ "But it is closed. So create a new one and share it."); //$NON-NLS-1$
|
||||
}
|
||||
org.apache.activemq.ActiveMQConnectionFactory factory = new org.apache.activemq.ActiveMQConnectionFactory(
|
||||
url);
|
||||
if (userName == null || ("").equals(userName)) {
|
||||
connection = factory.createConnection();
|
||||
} else {
|
||||
connection = factory.createConnection(userName, password);
|
||||
}
|
||||
connection.start();
|
||||
sharedConnections.put(mqConnectionName, connection);
|
||||
}
|
||||
}
|
||||
return connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* If there don't exist the connection or it is closed, create and store it.
|
||||
*
|
||||
* @param url
|
||||
* @param mqConnectionName
|
||||
* @return
|
||||
* @throws JMSException
|
||||
*/
|
||||
public static javax.jms.Connection getMQConnection(String url,
|
||||
String userName, String password, String mqConnectionName)
|
||||
throws JMSException {
|
||||
SharedActiveMQConnection instanceLocal = getInstance();
|
||||
javax.jms.Connection connection = instanceLocal.getConnection(url,
|
||||
userName, password, mqConnectionName);
|
||||
return connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the buffer as null, make it recyclable.
|
||||
*/
|
||||
public static void clear() {
|
||||
instance = null;
|
||||
}
|
||||
|
||||
public static void setDebugMode(boolean debug) {
|
||||
DEBUG = debug;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.mq;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.ibm.mq.MQException;
|
||||
|
||||
/**
|
||||
* A buffer to keep all the MQ connections, make it reusable between the
|
||||
* different jobs.
|
||||
*/
|
||||
public class SharedWebSphereMQConnection {
|
||||
|
||||
private static boolean DEBUG = false;
|
||||
|
||||
private static SharedWebSphereMQConnection instance = null;
|
||||
|
||||
private Map<String, com.ibm.mq.MQQueueManager> sharedConnections = new HashMap<String, com.ibm.mq.MQQueueManager>();
|
||||
|
||||
private SharedWebSphereMQConnection() {
|
||||
|
||||
}
|
||||
|
||||
private static synchronized SharedWebSphereMQConnection getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new SharedWebSphereMQConnection();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
private synchronized com.ibm.mq.MQQueueManager getConnection(
|
||||
String queueManager,
|
||||
java.util.Hashtable<String, Object> properties,
|
||||
String mqConnectionName) throws MQException {
|
||||
if (DEBUG) {
|
||||
Set<String> keySet = sharedConnections.keySet();
|
||||
System.out
|
||||
.print("SharedMQConnection, current shared connections list is:"); //$NON-NLS-1$
|
||||
for (String key : keySet) {
|
||||
System.out.print(" " + key); //$NON-NLS-1$
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
com.ibm.mq.MQQueueManager connection = sharedConnections
|
||||
.get(mqConnectionName);
|
||||
if (connection == null) {
|
||||
if (DEBUG) {
|
||||
System.out
|
||||
.println("SharedMQConnection, can't find the key:" + mqConnectionName + " " //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ "so create a new one and share it."); //$NON-NLS-1$
|
||||
}
|
||||
connection = new com.ibm.mq.MQQueueManager(queueManager, properties);
|
||||
sharedConnections.put(mqConnectionName, connection);
|
||||
} else if (!connection.isConnected()) {
|
||||
if (DEBUG) {
|
||||
System.out
|
||||
.println("SharedMQConnection, find the key: " + mqConnectionName + " " //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ "But it is closed. So create a new one and share it."); //$NON-NLS-1$
|
||||
}
|
||||
connection = new com.ibm.mq.MQQueueManager(queueManager, properties);
|
||||
sharedConnections.put(mqConnectionName, connection);
|
||||
} else {
|
||||
if (DEBUG) {
|
||||
System.out
|
||||
.println("SharedMQConnection, find the key: " + mqConnectionName + " " + "it is OK."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
}
|
||||
}
|
||||
return connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* If there don't exist the connection or it is closed, create and store it.
|
||||
*
|
||||
* @param queueManager
|
||||
* @param properties
|
||||
* @param mqConnectionName
|
||||
* @return
|
||||
* @throws MQException
|
||||
*/
|
||||
public static com.ibm.mq.MQQueueManager getMQConnection(
|
||||
String queueManager,
|
||||
java.util.Hashtable<String, Object> properties,
|
||||
String mqConnectionName) throws MQException {
|
||||
SharedWebSphereMQConnection instanceLocal = getInstance();
|
||||
com.ibm.mq.MQQueueManager connection = instanceLocal.getConnection(
|
||||
queueManager, properties, mqConnectionName);
|
||||
return connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the buffer as null, make it recyclable.
|
||||
*/
|
||||
public static void clear() {
|
||||
instance = null;
|
||||
}
|
||||
|
||||
public static void setDebugMode(boolean debug) {
|
||||
DEBUG = debug;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.talend.mq;
|
||||
|
||||
import javax.jms.JMSException;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class TestSharedActiveMQConn extends TestCase {
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testSameConnNAme() throws JMSException {
|
||||
assertTrue(SharedActiveMQConnection.getMQConnection("tcp://localhost:61616", "", "", "conn")==SharedActiveMQConnection.getMQConnection("tcp://localhost:61616", "", "", "conn"));
|
||||
}
|
||||
@Test
|
||||
public void testDiffConnNAme() throws JMSException {
|
||||
assertFalse(SharedActiveMQConnection.getMQConnection("tcp://localhost:61616", "", "", "conn1")==SharedActiveMQConnection.getMQConnection("tcp://localhost:61616", "", "", "conn2"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package org.talend.mq;
|
||||
|
||||
import java.util.Hashtable;
|
||||
|
||||
import javax.jms.JMSException;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.ibm.mq.MQException;
|
||||
|
||||
public class TestSharedWebShpereMQConn extends TestCase {
|
||||
private static Hashtable<String,Object> properties = new java.util.Hashtable<String,Object>();
|
||||
static{
|
||||
properties.put("hostname", "localhost");
|
||||
properties.put("port", Integer.valueOf("1414"));
|
||||
properties.put("channel", "TALEND.CH");
|
||||
properties.put("CCSID", new Integer(1208));
|
||||
properties.put("transport", "MQSeries");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testSameConnNAme() throws JMSException, MQException {
|
||||
assertTrue(SharedWebSphereMQConnection.getMQConnection("TALEND", properties, "conn")==SharedWebSphereMQConnection.getMQConnection("TALEND", properties, "conn"));
|
||||
}
|
||||
@Test
|
||||
public void testDiffConnNAme() throws JMSException, MQException {
|
||||
assertTrue(SharedWebSphereMQConnection.getMQConnection("TALEND", properties, "conn1")!=SharedWebSphereMQConnection.getMQConnection("TALEND", properties, "conn2"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -62,12 +62,12 @@ tHash_Lookup_<%=connectionName%>.endPut();
|
||||
<%
|
||||
if (includeParallelComps && memoryStorage && !isOneOfReloadLookupMode) {
|
||||
%>
|
||||
java.util.List<java.util.concurrent.ConcurrentHashMap<String,Object>> mapsList_<%=cid%> =
|
||||
(java.util.List<java.util.concurrent.ConcurrentHashMap<String,Object>>)globalMap.get("THREAD_MAPS_<%=partitionNode.getUniqueName()%>_"+jobName);
|
||||
java.util.List<java.util.Map<String,Object>> mapsList_<%=cid%> =
|
||||
(java.util.List<java.util.Map<String,Object>>)globalMap.get("THREAD_MAPS_<%=partitionNode.getUniqueName()%>_"+jobName);
|
||||
if (mapsList_<%=cid%> != null) {
|
||||
|
||||
|
||||
for (java.util.concurrent.ConcurrentHashMap<String,Object> map : mapsList_<%=cid%>) {
|
||||
for (java.util.Map<String,Object> map : mapsList_<%=cid%>) {
|
||||
org.talend.designer.components.lookup.memory.ConcurrentAdvancedMemoryLookup
|
||||
<<%=connectionName%>Struct> tmp = (org.talend.designer.components.lookup.memory.ConcurrentAdvancedMemoryLookup
|
||||
<<%=connectionName%>Struct>)tHash_Lookup_<%=connectionName%>;
|
||||
|
||||
@@ -39,7 +39,6 @@ imports="
|
||||
boolean removeSource = "true".equals(ElementParameterParser.getValue(node, "__REMOVE_SOURCE_FILE__"));
|
||||
|
||||
final boolean isLog4jEnabled = ("true").equals(ElementParameterParser.getValue(node.getProcess(), "__LOG4J_ACTIVATE__"));
|
||||
log4jFileUtil.componentStartInfo(node);
|
||||
|
||||
List< ? extends IConnection> outputConnections = node.getOutgoingSortedConnections();
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ imports="
|
||||
boolean dieOnError = "true".equals(ElementParameterParser.getValue(node, "__DIE_ON_ERROR__"));
|
||||
|
||||
final boolean isLog4jEnabled = ("true").equals(ElementParameterParser.getValue(node.getProcess(), "__LOG4J_ACTIVATE__"));
|
||||
log4jFileUtil.componentStartInfo(node);
|
||||
String dataInputConnection = null;
|
||||
|
||||
List< ? extends IConnection> inputConnections = node.getIncomingConnections();
|
||||
@@ -54,7 +53,28 @@ imports="
|
||||
String <%=cid%>_remoteFilePath = normalizePath(<%=cid%>_filePath);
|
||||
String <%=cid%>_remoteFileName = getFolderFromPath(<%=cid%>_remoteFilePath);
|
||||
com.box.boxjavalibv2.dao.BoxItem <%=cid%>_boxItem = null;
|
||||
<%=cid%>_boxItem = searchItem(<%=cid%>_client, <%=cid%>_remoteFileName);
|
||||
com.box.boxjavalibv2.dao.BoxFolder <%=cid%>_boxFolder = null;
|
||||
|
||||
String parentPath = normalizePath(<%=cid%>_remoteFilePath.replace(<%=cid%>_remoteFileName, ""));
|
||||
|
||||
<%=cid%>_boxFolder = <%=cid%>_client.getFoldersManager().getFolder("0", null);
|
||||
|
||||
List<String> <%=cid%>_paths = new java.util.ArrayList<String>(java.util.Arrays.asList(parentPath.split("/")));
|
||||
|
||||
<%=cid%>_boxFolder = getBoxFolderRecursively(<%=cid%>_paths, <%=cid%>_boxFolder, <%=cid%>_client);
|
||||
|
||||
com.box.boxjavalibv2.dao.BoxCollection <%=cid%>_searchResults = <%=cid%>_boxFolder.getItemCollection();
|
||||
for (com.box.boxjavalibv2.dao.BoxTypedObject <%=cid%>_entry : <%=cid%>_searchResults.getEntries())
|
||||
{
|
||||
if(<%=cid%>_entry.getValue("name").equals(<%=cid%>_remoteFileName)){
|
||||
if("folder".equals(<%=cid%>_entry.getType())){
|
||||
<%=cid%>_boxItem = (com.box.boxjavalibv2.dao.BoxItem)<%=cid%>_client.getFoldersManager().getFolder(<%=cid%>_entry.getId(),null);
|
||||
}else{
|
||||
<%=cid%>_boxItem = (com.box.boxjavalibv2.dao.BoxItem)<%=cid%>_client.getFilesManager().getFile(<%=cid%>_entry.getId(),null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (<%=cid%>_boxItem == null)
|
||||
{
|
||||
throw new Exception("Nothing found under path " + <%=cid%>_filePath);
|
||||
@@ -68,6 +88,6 @@ imports="
|
||||
com.box.boxjavalibv2.requests.requestobjects.BoxFolderDeleteRequestObject <%=cid%>_delObject = com.box.boxjavalibv2.requests.requestobjects.BoxFolderDeleteRequestObject.deleteFolderRequestObject(true);
|
||||
<%=cid%>_client.getFoldersManager().deleteFolder(<%=cid%>_boxItem.getId(), <%=cid%>_delObject);
|
||||
}
|
||||
globalMap.put("<%=cid %>_REMOVED_PATH", getBoxItemPath(<%=cid%>_boxItem));
|
||||
globalMap.put("<%=cid %>_REMOVED_PATH",getBoxItemPath(<%=cid%>_boxItem));
|
||||
|
||||
|
||||
|
||||
|
||||
54
main/plugins/org.talend.designer.components.localprovider/components/tBoxGet/tBoxGet_begin.javajet
Normal file → Executable file
54
main/plugins/org.talend.designer.components.localprovider/components/tBoxGet/tBoxGet_begin.javajet
Normal file → Executable file
@@ -118,43 +118,29 @@ if(!"true".equals(useExistingConn)){
|
||||
String <%=cid%>_name = getFolderFromPath(<%=cid%>_path);
|
||||
|
||||
com.box.boxjavalibv2.dao.BoxFile <%=cid%>_boxFile = null;
|
||||
com.box.boxjavalibv2.dao.BoxFolder <%=cid%>_boxFolder = null;
|
||||
com.box.restclientv2.requestsbase.BoxDefaultRequestObject <%=cid%>_requestObject = new com.box.restclientv2.requestsbase.BoxDefaultRequestObject();
|
||||
com.box.boxjavalibv2.dao.BoxCollection <%=cid%>_searchResults = <%=cid%>_client.getSearchManager().search(<%=cid%>_name, <%=cid%>_requestObject);
|
||||
|
||||
String parentPath = normalizePath(<%=cid%>_path.replace(<%=cid%>_name, ""));
|
||||
|
||||
<%=cid%>_boxFolder = <%=cid%>_client.getFoldersManager().getFolder("0", <%=cid%>_requestObject);
|
||||
|
||||
List<String> <%=cid%>_paths = new java.util.ArrayList<String>(java.util.Arrays.asList(parentPath.split("/")));
|
||||
|
||||
<%=cid%>_boxFolder = getBoxFolderRecursively(<%=cid%>_paths, <%=cid%>_boxFolder, <%=cid%>_client);
|
||||
|
||||
com.box.boxjavalibv2.dao.BoxCollection <%=cid%>_searchResults = <%=cid%>_boxFolder.getItemCollection();
|
||||
for (com.box.boxjavalibv2.dao.BoxTypedObject <%=cid%>_entry : <%=cid%>_searchResults.getEntries())
|
||||
{
|
||||
if (<%=cid%>_entry instanceof com.box.boxjavalibv2.dao.BoxFile && ((com.box.boxjavalibv2.dao.BoxFile) <%=cid%>_entry).getName().equals(<%=cid%>_name))
|
||||
{
|
||||
if (<%=cid%>_path == null || <%=cid%>_path.isEmpty())
|
||||
{
|
||||
<%=cid%>_boxFile = ((com.box.boxjavalibv2.dao.BoxFile) <%=cid%>_entry);
|
||||
break;
|
||||
}
|
||||
java.lang.StringBuilder <%=cid%>_sBuilder = new java.lang.StringBuilder();
|
||||
for (com.box.boxjavalibv2.dao.BoxTypedObject <%=cid%>_obj : ((com.box.boxjavalibv2.dao.BoxFile) <%=cid%>_entry).getPathCollection().getEntries())
|
||||
{
|
||||
<%=cid%>_sBuilder.append(<%=cid%>_obj.getValue("name") + "/");
|
||||
}
|
||||
<%=cid%>_sBuilder.append(((com.box.boxjavalibv2.dao.BoxFile) <%=cid%>_entry).getName());
|
||||
if (<%=cid%>_sBuilder.toString().equals(<%=cid%>_path))
|
||||
{
|
||||
<%=cid%>_boxFile = (com.box.boxjavalibv2.dao.BoxFile) <%=cid%>_entry;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (<%=cid%>_entry instanceof com.box.boxjavalibv2.dao.BoxFolder && ((com.box.boxjavalibv2.dao.BoxFolder) <%=cid%>_entry).getName().equals(<%=cid%>_name))
|
||||
{
|
||||
java.lang.StringBuilder <%=cid%>_sBuilder = new java.lang.StringBuilder();
|
||||
for (com.box.boxjavalibv2.dao.BoxTypedObject <%=cid%>_obj : ((com.box.boxjavalibv2.dao.BoxFolder) <%=cid%>_entry).getPathCollection().getEntries())
|
||||
{
|
||||
<%=cid%>_sBuilder.append(<%=cid%>_obj.getValue("name") + "/");
|
||||
}
|
||||
<%=cid%>_sBuilder.append(((com.box.boxjavalibv2.dao.BoxFolder) <%=cid%>_entry).getName());
|
||||
if (<%=cid%>_sBuilder.toString().equals(<%=cid%>_path))
|
||||
{
|
||||
<%=cid%>_hasError = true;
|
||||
throw new Exception(<%=boxPath%> + " exists but is a directory");
|
||||
}
|
||||
}
|
||||
|
||||
if(<%=cid%>_entry.getValue("name").equals(<%=cid%>_name)){
|
||||
if("folder".equals(<%=cid%>_entry.getType())){
|
||||
<%=cid%>_hasError = true;
|
||||
throw new Exception(<%=boxPath%> + " exists but is a directory");
|
||||
}else{
|
||||
<%=cid%>_boxFile = <%=cid%>_client.getFilesManager().getFile(<%=cid%>_entry.getId(),null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (<%=cid%>_boxFile == null && !<%=cid%>_hasError) {
|
||||
|
||||
59
main/plugins/org.talend.designer.components.localprovider/components/tBoxList/tBoxList_begin.javajet
Normal file → Executable file
59
main/plugins/org.talend.designer.components.localprovider/components/tBoxList/tBoxList_begin.javajet
Normal file → Executable file
@@ -129,43 +129,28 @@ if(!"true".equals(useExistingConn)){
|
||||
}
|
||||
else
|
||||
{
|
||||
com.box.boxjavalibv2.dao.BoxCollection <%=cid%>_searchResults = <%=cid%>_client.getSearchManager().search(<%=cid%>_name, <%=cid%>_requestObject);
|
||||
for (com.box.boxjavalibv2.dao.BoxTypedObject <%=cid%>_entry : <%=cid%>_searchResults.getEntries())
|
||||
{
|
||||
if (<%=cid%>_entry instanceof com.box.boxjavalibv2.dao.BoxFile && ((com.box.boxjavalibv2.dao.BoxFile) <%=cid%>_entry).getName().equals(<%=cid%>_name))
|
||||
{
|
||||
if (<%=cid%>_path == null || <%=cid%>_path.isEmpty())
|
||||
{
|
||||
<%=cid%>_boxFile = ((com.box.boxjavalibv2.dao.BoxFile) <%=cid%>_entry);
|
||||
break;
|
||||
}
|
||||
java.lang.StringBuilder <%=cid%>_sBuilder = new java.lang.StringBuilder();
|
||||
for (com.box.boxjavalibv2.dao.BoxTypedObject <%=cid%>_obj : ((com.box.boxjavalibv2.dao.BoxFile) <%=cid%>_entry).getPathCollection().getEntries())
|
||||
{
|
||||
<%=cid%>_sBuilder.append(<%=cid%>_obj.getValue("name") + "/");
|
||||
}
|
||||
<%=cid%>_sBuilder.append(((com.box.boxjavalibv2.dao.BoxFile) <%=cid%>_entry).getName());
|
||||
if (<%=cid%>_sBuilder.toString().equals(<%=cid%>_path))
|
||||
{
|
||||
<%=cid%>_boxFile = (com.box.boxjavalibv2.dao.BoxFile) <%=cid%>_entry;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (<%=cid%>_entry instanceof com.box.boxjavalibv2.dao.BoxFolder && ((com.box.boxjavalibv2.dao.BoxFolder) <%=cid%>_entry).getName().equals(<%=cid%>_name))
|
||||
{
|
||||
java.lang.StringBuilder <%=cid%>_sBuilder = new java.lang.StringBuilder();
|
||||
for (com.box.boxjavalibv2.dao.BoxTypedObject <%=cid%>_obj : ((com.box.boxjavalibv2.dao.BoxFolder) <%=cid%>_entry).getPathCollection().getEntries())
|
||||
{
|
||||
<%=cid%>_sBuilder.append(<%=cid%>_obj.getValue("name") + "/");
|
||||
}
|
||||
<%=cid%>_sBuilder.append(((com.box.boxjavalibv2.dao.BoxFolder) <%=cid%>_entry).getName());
|
||||
if (<%=cid%>_sBuilder.toString().equals(<%=cid%>_path))
|
||||
{
|
||||
<%=cid%>_boxFolder = (com.box.boxjavalibv2.dao.BoxFolder) <%=cid%>_entry;
|
||||
<%=cid%>_boxFolder = <%=cid%>_client.getFoldersManager().getFolder(<%=cid%>_boxFolder.getId(), null);
|
||||
}
|
||||
}
|
||||
}
|
||||
String parentPath = normalizePath(<%=cid%>_path.replace(<%=cid%>_name, ""));
|
||||
|
||||
<%=cid%>_boxFolder = <%=cid%>_client.getFoldersManager().getFolder("0", <%=cid%>_requestObject);
|
||||
|
||||
if ("All Files".equals(parentPath)) {
|
||||
|
||||
for (com.box.boxjavalibv2.dao.BoxTypedObject <%=cid%>_boxTypedObject : <%=cid%>_boxFolder.getItemCollection().getEntries()) {
|
||||
if (<%=cid%>_boxTypedObject.getValue("name").equals(<%=cid%>_name)) {
|
||||
if ("folder".equals(<%=cid%>_boxTypedObject.getType())) {
|
||||
<%=cid%>_boxFolder = <%=cid%>_client.getFoldersManager().getFolder(<%=cid%>_boxTypedObject.getId(), <%=cid%>_requestObject);
|
||||
} else {
|
||||
<%=cid%>_boxFile = <%=cid%>_client.getFilesManager().getFile(<%=cid%>_boxTypedObject.getId(),<%=cid%>_requestObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
List<String> <%=cid%>_paths = new java.util.ArrayList<String>(java.util.Arrays.asList(parentPath.split("/")));
|
||||
|
||||
<%=cid%>_boxFolder = getBoxFolderRecursively(<%=cid%>_paths, <%=cid%>_boxFolder, <%=cid%>_client);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ imports="
|
||||
String overwrite = ElementParameterParser.getValue(node, "__REPLACE_IF_EXIST__");
|
||||
|
||||
final boolean isLog4jEnabled = ("true").equals(ElementParameterParser.getValue(node.getProcess(), "__LOG4J_ACTIVATE__"));
|
||||
log4jFileUtil.componentStartInfo(node);
|
||||
%>
|
||||
<%if("true".equals(exposeOutput)){%>
|
||||
if(<%=cid%>_remoteName == null || <%=cid%>_remoteName.isEmpty())
|
||||
|
||||
@@ -37,7 +37,6 @@ imports="
|
||||
String overwrite = ElementParameterParser.getValue(node, "__REPLACE_IF_EXIST__");
|
||||
|
||||
final boolean isLog4jEnabled = ("true").equals(ElementParameterParser.getValue(node.getProcess(), "__LOG4J_ACTIVATE__"));
|
||||
log4jFileUtil.componentStartInfo(node);
|
||||
|
||||
String dataInputConnection = null;
|
||||
String dataOutputConnection = null;
|
||||
|
||||
@@ -6,7 +6,10 @@ imports="
|
||||
org.talend.core.model.metadata.IMetadataTable
|
||||
org.talend.core.model.metadata.MappingTypeRetriever
|
||||
org.talend.core.model.metadata.MetadataTalendType
|
||||
org.talend.core.model.metadata.types.JavaTypesManager
|
||||
org.talend.core.model.process.IConnectionCategory
|
||||
org.talend.core.model.process.IConnection
|
||||
org.talend.core.model.utils.NodeUtil
|
||||
java.util.List
|
||||
java.util.ArrayList
|
||||
java.util.Map
|
||||
@@ -44,6 +47,15 @@ String batchSize=ElementParameterParser.getValue(node,"__BATCH_SIZE__");
|
||||
<%
|
||||
getManager(dbmsId, cid, node);
|
||||
|
||||
IConnection inputConn = null;
|
||||
String incomingConnName = null;
|
||||
|
||||
List< ? extends IConnection> conns = node.getIncomingConnections();
|
||||
if(conns!=null && conns.size()>0){
|
||||
inputConn = conns.get(0);
|
||||
incomingConnName = inputConn.getName();
|
||||
}
|
||||
|
||||
boolean isDynamic = false;
|
||||
List<IMetadataTable> metadatas = node.getMetadataList();
|
||||
if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
@@ -69,6 +81,13 @@ if(columnList != null && columnList.size() > 0) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<Column> colStruct = new ArrayList();
|
||||
for(Column colStmt:stmtStructure) {
|
||||
if(!colStmt.isReplaced()&&!colStmt.isAddCol()&&!colStmt.isDynamic()) {
|
||||
colStruct.add(colStmt);
|
||||
}
|
||||
}
|
||||
%>
|
||||
|
||||
<%
|
||||
@@ -192,7 +211,7 @@ if(!isDynamic) {
|
||||
%>
|
||||
int count_<%=cid%>=0;
|
||||
<%
|
||||
if(columnList != null && columnList.size() > 0) {
|
||||
if(columnList != null && columnList.size() > 0) {
|
||||
Manager manager = null;
|
||||
%>
|
||||
<%@ include file="../templates/_tableActionForOutput.javajet"%>
|
||||
@@ -242,7 +261,8 @@ if(columnList != null && columnList.size() > 0) {
|
||||
<%
|
||||
}
|
||||
}
|
||||
}// end isDynamic
|
||||
}// end !isDynamic
|
||||
|
||||
if(isDynamic) {
|
||||
%>
|
||||
java.sql.PreparedStatement pstmt_<%=cid %> =null;
|
||||
@@ -254,7 +274,207 @@ if(isDynamic) {
|
||||
<%
|
||||
}
|
||||
}
|
||||
|
||||
if(incomingConnName==null || columnList == null || columnList.isEmpty()) {
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
int schemaOptNum = 100;
|
||||
String schemaOptNumStr=ElementParameterParser.getValue(node, "__SCHEMA_OPT_NUM__");
|
||||
if(schemaOptNumStr!=null && !"".equals(schemaOptNumStr) && !"\"\"".equals(schemaOptNumStr)){
|
||||
schemaOptNum = Integer.parseInt(schemaOptNumStr);
|
||||
}
|
||||
|
||||
if(columnList.size() <= schemaOptNum) {//optimize for 65535 method size issue in java
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
%>
|
||||
class SetPrepareStatementUtil_<%=cid%> {
|
||||
<%
|
||||
List<String> types = new ArrayList<String>();
|
||||
if(dataAction!=null && dataAction.contains("INSERT")) {
|
||||
types.add("Insert");
|
||||
}
|
||||
if(dataAction!=null && dataAction.contains("UPDATE")) {
|
||||
types.add("Update");
|
||||
}
|
||||
for(String type : types) {
|
||||
int counter = 1;
|
||||
for(Column column : colStruct) {
|
||||
if("Insert".equals(type) && !column.isInsertable()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if("Update".equals(type) && !column.isUpdatable()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getColumn().getTalendType(), column.getColumn().isNullable());
|
||||
|
||||
int actionType = NORMAL_TYPE;
|
||||
String splits = "insertSQLSplits_";
|
||||
|
||||
if("INSERT_OR_UPDATE".equals(dataAction) || "UPDATE_OR_INSERT".equals(dataAction)) {
|
||||
if("Insert".equals(type)) {
|
||||
actionType = INSERT_TYPE;
|
||||
} else if("Update".equals(type)) {
|
||||
actionType = UPDATE_TYPE;
|
||||
splits = "updateSQLSplits_";
|
||||
}
|
||||
} else if("UPDATE".equals(dataAction)) {
|
||||
splits = "updateSQLSplits_";
|
||||
}
|
||||
|
||||
if((counter-1)%schemaOptNum==0){//begin method
|
||||
%>
|
||||
void set<%=type%>_<%=(counter-1)/schemaOptNum%>(
|
||||
final <%=NodeUtil.getPrivateConnClassName(inputConn) %>Struct <%=inputConn.getName() %>,
|
||||
final java.sql.PreparedStatement
|
||||
<%
|
||||
if(actionType == NORMAL_TYPE) {
|
||||
%>
|
||||
pstmt_<%=cid%>
|
||||
<%
|
||||
} else if(actionType == INSERT_TYPE) {
|
||||
%>
|
||||
pstmtInsert_<%=cid%>
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
pstmtUpdate_<%=cid%>
|
||||
<%
|
||||
}
|
||||
|
||||
if(isEnableDebug) {
|
||||
%>
|
||||
,
|
||||
final StringBuffer query_<%=cid%>
|
||||
,
|
||||
final String[] <%=splits%><%=cid%>
|
||||
<%
|
||||
}
|
||||
%>
|
||||
) throws java.sql.SQLException {
|
||||
//}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
<%=getManager(dbmsId, cid).generateSetStmt(typeToGenerate, column, counter, incomingConnName, cid, actionType)%>
|
||||
<%
|
||||
if(isEnableDebug) {
|
||||
%>
|
||||
<%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counter, splits)%>;
|
||||
<%
|
||||
}
|
||||
|
||||
if(counter%schemaOptNum==0) {//close method
|
||||
%>
|
||||
//{
|
||||
}
|
||||
<%
|
||||
}
|
||||
|
||||
counter++;
|
||||
}
|
||||
|
||||
if((counter-1) >0&&((counter-1)%schemaOptNum)>0){//close method
|
||||
%>
|
||||
//{
|
||||
}
|
||||
<%
|
||||
}
|
||||
}
|
||||
%>
|
||||
}
|
||||
|
||||
SetPrepareStatementUtil_<%=cid%> setPrepareStatementUtil_<%=cid%> = new SetPrepareStatementUtil_<%=cid%>();
|
||||
|
||||
<%
|
||||
IConnection rejectConn = null;
|
||||
List<? extends IConnection> rejectConns = node.getOutgoingConnections("REJECT");
|
||||
if(rejectConns != null && rejectConns.size() > 0) {
|
||||
rejectConn = rejectConns.get(0);
|
||||
}
|
||||
|
||||
List<? extends IConnection> outgoingConns = node.getOutgoingSortedConnections();
|
||||
|
||||
IConnection outputConn = null;
|
||||
|
||||
for(IConnection outgoingConn : outgoingConns) {
|
||||
if(rejectConn == null || (rejectConn != null && !outgoingConn.getName().equals(rejectConn.getName()))) {
|
||||
if(outgoingConn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
||||
outputConn = outgoingConn;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<IConnection> outputConns = new ArrayList<IConnection>();
|
||||
|
||||
if(outputConn!=null) {
|
||||
outputConns.add(outputConn);
|
||||
}
|
||||
|
||||
String dieOnError = ElementParameterParser.getValue(node, "__DIE_ON_ERROR__");
|
||||
List<IMetadataColumn> rejectColumnList = null;
|
||||
IMetadataTable metadataTable = node.getMetadataFromConnector("REJECT");
|
||||
if(metadataTable != null) {
|
||||
rejectColumnList = metadataTable.getListColumns();
|
||||
}
|
||||
|
||||
if(!"true".equals(dieOnError) && rejectConn != null && rejectColumnList != null && rejectColumnList.size() > 0) {
|
||||
outputConns.add(rejectConn);
|
||||
}
|
||||
|
||||
if(outputConns.isEmpty()) {
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
%>
|
||||
|
||||
class DataPropagateUtil_<%=cid%> {
|
||||
<%
|
||||
for(IConnection outputConnection : outputConns) {
|
||||
String sourceObjectName = incomingConnName;
|
||||
String sourceObjectType = NodeUtil.getPrivateConnClassName(inputConn);
|
||||
|
||||
String targetObjectName = outputConnection.getName();
|
||||
String targetObjectType = NodeUtil.getPrivateConnClassName(outputConnection);
|
||||
|
||||
int index = 0;
|
||||
for(IMetadataColumn column : columnList) {
|
||||
if(index%schemaOptNum==0){//begin method
|
||||
%>
|
||||
void assign_<%=targetObjectName%>_<%=index/schemaOptNum%>(final <%=sourceObjectType%>Struct <%=sourceObjectName%>,final <%=targetObjectType%>Struct <%=targetObjectName%>) {
|
||||
//}
|
||||
<%
|
||||
}
|
||||
|
||||
//do assign
|
||||
%>
|
||||
<%=targetObjectName%>.<%=column.getLabel()%> = <%=sourceObjectName%>.<%=column.getLabel()%>;
|
||||
<%
|
||||
|
||||
if((index+1)%schemaOptNum==0) {//close method
|
||||
%>
|
||||
//{
|
||||
}
|
||||
<%
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
if(index>0&&(index%schemaOptNum)>0){//close method
|
||||
%>
|
||||
//{
|
||||
}
|
||||
<%
|
||||
}
|
||||
}
|
||||
%>
|
||||
}
|
||||
|
||||
DataPropagateUtil_<%=cid%> dataPropagateUtil_<%=cid%> = new DataPropagateUtil_<%=cid%>();
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -348,6 +348,10 @@
|
||||
>
|
||||
<DEFAULT>10000</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="SCHEMA_OPT_NUM" FIELD="TEXT" NUM_ROW="40" SHOW="false">
|
||||
<DEFAULT>100</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
</ADVANCED_PARAMETERS>
|
||||
|
||||
|
||||
@@ -262,24 +262,44 @@ skeleton="../templates/db_output_bulk.skeleton"
|
||||
} // end bug0014422
|
||||
|
||||
if(incomingConnName != null && columnList != null){
|
||||
int schemaOptNum = 100;
|
||||
String schemaOptNumStr=ElementParameterParser.getValue(node, "__SCHEMA_OPT_NUM__");
|
||||
if(schemaOptNumStr!=null && !"".equals(schemaOptNumStr) && !"\"\"".equals(schemaOptNumStr)){
|
||||
schemaOptNum = Integer.parseInt(schemaOptNumStr);
|
||||
}
|
||||
|
||||
boolean optimize65535 = columnList.size() > schemaOptNum;//optimize for 65535 method size issue in java
|
||||
%>
|
||||
whetherReject_<%=cid%> = false;
|
||||
<%
|
||||
if(("INSERT").equals(dataAction)) {
|
||||
int counter = 1;
|
||||
for(Column column : colStruct) {
|
||||
if(column.isInsertable()) {
|
||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getColumn().getTalendType(), column.getColumn().isNullable());
|
||||
if(!column.isInsertable()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(optimize65535) {
|
||||
if((counter-1)%schemaOptNum==0){
|
||||
%>
|
||||
setPrepareStatementUtil_<%=cid%>.setInsert_<%=(counter-1)/schemaOptNum%>(<%=incomingConnName%>,pstmt_<%=cid%>
|
||||
<%if(isEnableDebug) {%>,query_<%=cid%>,insertSQLSplits_<%=cid%><%}%>
|
||||
);
|
||||
<%
|
||||
}
|
||||
} else {
|
||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getColumn().getTalendType(), column.getColumn().isNullable());
|
||||
%>
|
||||
<%=getManager(dbmsId, cid).generateSetStmt(typeToGenerate, column, counter, incomingConnName, cid, NORMAL_TYPE)%>
|
||||
<%
|
||||
if(isEnableDebug) {
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counter, "insertSQLSplits_")%>;
|
||||
<%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counter, "insertSQLSplits_")%>;
|
||||
<%
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
|
||||
counter++;
|
||||
}
|
||||
if(isDynamic) {
|
||||
Column dynamicColumn = getColumn(getDynamicColumn());
|
||||
@@ -333,11 +353,21 @@ skeleton="../templates/db_output_bulk.skeleton"
|
||||
%>
|
||||
<%=rejectConnName %> = new <%=rejectConnName %>Struct();
|
||||
<%
|
||||
int index = 0;
|
||||
for(IMetadataColumn column : columnList) {
|
||||
%>
|
||||
<%=rejectConnName%>.<%=column.getLabel()%> = <%=incomingConnName%>.<%=column.getLabel()%>;
|
||||
<%
|
||||
}
|
||||
if(optimize65535) {
|
||||
if(index%schemaOptNum==0) {
|
||||
%>
|
||||
dataPropagateUtil_<%=cid%>.assign_<%=rejectConnName%>_<%=index/schemaOptNum%>(<%=incomingConnName%>,<%=rejectConnName%>);
|
||||
<%
|
||||
}
|
||||
index++;
|
||||
} else {
|
||||
%>
|
||||
<%=rejectConnName%>.<%=column.getLabel()%> = <%=incomingConnName%>.<%=column.getLabel()%>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
%>
|
||||
rejectedCount_<%=cid%> = rejectedCount_<%=cid%> + 1;
|
||||
<%=rejectConnName%>.errorCode = ((java.sql.SQLException)e).getSQLState();
|
||||
@@ -359,18 +389,31 @@ skeleton="../templates/db_output_bulk.skeleton"
|
||||
} else if(("UPDATE").equals(dataAction)) {
|
||||
int counterCol = 1;
|
||||
for(Column column : colStruct) {
|
||||
if(column.isUpdatable()) {
|
||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getColumn().getTalendType(), column.getColumn().isNullable());
|
||||
%>
|
||||
<%=getManager(dbmsId, cid).generateSetStmt(typeToGenerate, column, counterCol, incomingConnName, cid, NORMAL_TYPE)%>
|
||||
<%
|
||||
if(isEnableDebug) {
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_")%>;
|
||||
<%
|
||||
}
|
||||
counterCol++;
|
||||
if(!column.isUpdatable()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(optimize65535) {
|
||||
if((counterCol-1)%schemaOptNum==0){
|
||||
%>
|
||||
setPrepareStatementUtil_<%=cid%>.setUpdate_<%=(counterCol-1)/schemaOptNum%>(<%=incomingConnName%>,pstmt_<%=cid%>
|
||||
<%if(isEnableDebug) {%>,query_<%=cid%>,updateSQLSplits_<%=cid%><%}%>
|
||||
);
|
||||
<%
|
||||
}
|
||||
} else {
|
||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getColumn().getTalendType(), column.getColumn().isNullable());
|
||||
%>
|
||||
<%=getManager(dbmsId, cid).generateSetStmt(typeToGenerate, column, counterCol, incomingConnName, cid, NORMAL_TYPE)%>
|
||||
<%
|
||||
if(isEnableDebug) {
|
||||
%>
|
||||
<%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_")%>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
|
||||
counterCol++;
|
||||
}
|
||||
if(isDynamic) {
|
||||
Column dynamicColumn = getColumn(talendDynCol);
|
||||
@@ -404,11 +447,11 @@ skeleton="../templates/db_output_bulk.skeleton"
|
||||
if(isEnableDebug) {
|
||||
if(isDynamic){
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid, node).retrieveSQL(talendDynCol.getLabel(),typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_", "(("+incomingConnName+"."+column.getName()+"==null)?1:0)")%>;
|
||||
<%=getManager(dbmsId, cid, node).retrieveSQL(talendDynCol.getLabel(),typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_", "(("+incomingConnName+"."+column.getName()+"==null)?1:0)")%>;
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid, node).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_", "(("+incomingConnName+"."+column.getName()+"==null)?1:0)")%>;
|
||||
<%=getManager(dbmsId, cid, node).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_", "(("+incomingConnName+"."+column.getName()+"==null)?1:0)")%>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
@@ -422,11 +465,11 @@ skeleton="../templates/db_output_bulk.skeleton"
|
||||
|
||||
if(isDynamic){
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid, node).retrieveSQL(talendDynCol.getLabel(),typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_")%>;
|
||||
<%=getManager(dbmsId, cid, node).retrieveSQL(talendDynCol.getLabel(),typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_")%>;
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid, node).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_")%>;
|
||||
<%=getManager(dbmsId, cid, node).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_")%>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
@@ -471,11 +514,21 @@ skeleton="../templates/db_output_bulk.skeleton"
|
||||
%>
|
||||
<%=rejectConnName %> = new <%=rejectConnName %>Struct();
|
||||
<%
|
||||
int index = 0;
|
||||
for(IMetadataColumn column : columnList) {
|
||||
%>
|
||||
<%=rejectConnName%>.<%=column.getLabel()%> = <%=incomingConnName%>.<%=column.getLabel()%>;
|
||||
<%
|
||||
}
|
||||
if(optimize65535) {
|
||||
if(index%schemaOptNum==0) {
|
||||
%>
|
||||
dataPropagateUtil_<%=cid%>.assign_<%=rejectConnName%>_<%=index/schemaOptNum%>(<%=incomingConnName%>,<%=rejectConnName%>);
|
||||
<%
|
||||
}
|
||||
index++;
|
||||
} else {
|
||||
%>
|
||||
<%=rejectConnName%>.<%=column.getLabel()%> = <%=incomingConnName%>.<%=column.getLabel()%>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
%>
|
||||
rejectedCount_<%=cid%> = rejectedCount_<%=cid%> + 1;
|
||||
<%=rejectConnName%>.errorCode = ((java.sql.SQLException)e).getSQLState();
|
||||
@@ -526,18 +579,31 @@ skeleton="../templates/db_output_bulk.skeleton"
|
||||
<%
|
||||
int counterCol = 1;
|
||||
for(Column column : colStruct) {
|
||||
if(column.isUpdatable()) {
|
||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getColumn().getTalendType(), column.getColumn().isNullable());
|
||||
if(!column.isUpdatable()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(optimize65535) {
|
||||
if((counterCol-1)%schemaOptNum==0){
|
||||
%>
|
||||
setPrepareStatementUtil_<%=cid%>.setUpdate_<%=(counterCol-1)/schemaOptNum%>(<%=incomingConnName%>,pstmtUpdate_<%=cid%>
|
||||
<%if(isEnableDebug) {%>,query_<%=cid%>,updateSQLSplits_<%=cid%><%}%>
|
||||
);
|
||||
<%
|
||||
}
|
||||
} else {
|
||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getColumn().getTalendType(), column.getColumn().isNullable());
|
||||
%>
|
||||
<%=getManager(dbmsId, cid).generateSetStmt(typeToGenerate, column, counterCol, incomingConnName, cid, UPDATE_TYPE)%>
|
||||
<%
|
||||
if(isEnableDebug) {
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_")%>;
|
||||
<%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_")%>;
|
||||
<%
|
||||
}
|
||||
counterCol++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
counterCol++;
|
||||
}
|
||||
if(isDynamic) {
|
||||
Column dynamicColumn = getColumn(getDynamicColumn());
|
||||
@@ -571,11 +637,11 @@ skeleton="../templates/db_output_bulk.skeleton"
|
||||
if(isEnableDebug) {
|
||||
if(isDynamic){
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid, node).retrieveSQL(talendDynCol.getLabel(),typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_", "(("+incomingConnName+"."+column.getName()+"==null)?1:0)")%>;
|
||||
<%=getManager(dbmsId, cid, node).retrieveSQL(talendDynCol.getLabel(),typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_", "(("+incomingConnName+"."+column.getName()+"==null)?1:0)")%>;
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid, node).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_", "(("+incomingConnName+"."+column.getName()+"==null)?1:0)")%>;
|
||||
<%=getManager(dbmsId, cid, node).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_", "(("+incomingConnName+"."+column.getName()+"==null)?1:0)")%>;
|
||||
<%
|
||||
}
|
||||
|
||||
@@ -589,11 +655,11 @@ skeleton="../templates/db_output_bulk.skeleton"
|
||||
if(isEnableDebug) {
|
||||
if(isDynamic){
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid, node).retrieveSQL(talendDynCol.getLabel(),typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_")%>;
|
||||
<%=getManager(dbmsId, cid, node).retrieveSQL(talendDynCol.getLabel(),typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_")%>;
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid, node).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_")%>;
|
||||
<%=getManager(dbmsId, cid, node).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_")%>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
@@ -625,11 +691,21 @@ skeleton="../templates/db_output_bulk.skeleton"
|
||||
%>
|
||||
<%=rejectConnName %> = new <%=rejectConnName %>Struct();
|
||||
<%
|
||||
int index = 0;
|
||||
for(IMetadataColumn column : columnList) {
|
||||
%>
|
||||
<%=rejectConnName%>.<%=column.getLabel()%> = <%=incomingConnName%>.<%=column.getLabel()%>;
|
||||
<%
|
||||
}
|
||||
if(optimize65535) {
|
||||
if(index%schemaOptNum==0) {
|
||||
%>
|
||||
dataPropagateUtil_<%=cid%>.assign_<%=rejectConnName%>_<%=index/schemaOptNum%>(<%=incomingConnName%>,<%=rejectConnName%>);
|
||||
<%
|
||||
}
|
||||
index++;
|
||||
} else {
|
||||
%>
|
||||
<%=rejectConnName%>.<%=column.getLabel()%> = <%=incomingConnName%>.<%=column.getLabel()%>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
%>
|
||||
rejectedCount_<%=cid%> = rejectedCount_<%=cid%> + 1;
|
||||
<%=rejectConnName%>.errorCode = ((java.sql.SQLException)e).getSQLState();
|
||||
@@ -648,19 +724,32 @@ skeleton="../templates/db_output_bulk.skeleton"
|
||||
<%
|
||||
int counterInsert = 1;
|
||||
for(Column columnInsert : colStruct) {
|
||||
if(columnInsert.isInsertable()) {
|
||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(columnInsert.getColumn().getTalendType(), columnInsert.getColumn().isNullable());
|
||||
if(!columnInsert.isInsertable()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(optimize65535) {
|
||||
if((counterInsert-1)%schemaOptNum==0){
|
||||
%>
|
||||
setPrepareStatementUtil_<%=cid%>.setInsert_<%=(counterInsert-1)/schemaOptNum%>(<%=incomingConnName%>,pstmtInsert_<%=cid%>
|
||||
<%if(isEnableDebug) {%>,query_<%=cid%>,insertSQLSplits_<%=cid%><%}%>
|
||||
);
|
||||
<%
|
||||
}
|
||||
} else {
|
||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(columnInsert.getColumn().getTalendType(), columnInsert.getColumn().isNullable());
|
||||
%>
|
||||
<%=getManager(dbmsId, cid).generateSetStmt(typeToGenerate, columnInsert, counterInsert, incomingConnName, cid, INSERT_TYPE)%>
|
||||
<%
|
||||
if(isEnableDebug) {
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, columnInsert, incomingConnName, cid, "query_" , counterInsert, "insertSQLSplits_")%>;
|
||||
<%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, columnInsert, incomingConnName, cid, "query_" , counterInsert, "insertSQLSplits_")%>;
|
||||
<%
|
||||
}
|
||||
counterInsert++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
counterInsert++;
|
||||
}
|
||||
if(isDynamic) {
|
||||
Column dynamicColumn = getColumn(getDynamicColumn());
|
||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(dynamicColumn.getColumn().getTalendType(), dynamicColumn.getColumn().isNullable());
|
||||
@@ -700,11 +789,21 @@ skeleton="../templates/db_output_bulk.skeleton"
|
||||
%>
|
||||
<%=rejectConnName %> = new <%=rejectConnName %>Struct();
|
||||
<%
|
||||
int index = 0;
|
||||
for(IMetadataColumn column : columnList) {
|
||||
%>
|
||||
<%=rejectConnName%>.<%=column.getLabel()%> = <%=incomingConnName%>.<%=column.getLabel()%>;
|
||||
<%
|
||||
}
|
||||
if(optimize65535) {
|
||||
if(index%schemaOptNum==0) {
|
||||
%>
|
||||
dataPropagateUtil_<%=cid%>.assign_<%=rejectConnName%>_<%=index/schemaOptNum%>(<%=incomingConnName%>,<%=rejectConnName%>);
|
||||
<%
|
||||
}
|
||||
index++;
|
||||
} else {
|
||||
%>
|
||||
<%=rejectConnName%>.<%=column.getLabel()%> = <%=incomingConnName%>.<%=column.getLabel()%>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
%>
|
||||
rejectedCount_<%=cid%> = rejectedCount_<%=cid%> + 1;
|
||||
<%=rejectConnName%>.errorCode = ((java.sql.SQLException)e).getSQLState();
|
||||
@@ -727,18 +826,31 @@ skeleton="../templates/db_output_bulk.skeleton"
|
||||
<%
|
||||
int counterColUpdate = 1;
|
||||
for(Column columnUpdate : colStruct) {
|
||||
if(columnUpdate.isUpdatable()) {
|
||||
if(!columnUpdate.isUpdatable()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(optimize65535) {
|
||||
if((counterColUpdate-1)%schemaOptNum==0){
|
||||
%>
|
||||
setPrepareStatementUtil_<%=cid%>.setUpdate_<%=(counterColUpdate-1)/schemaOptNum%>(<%=incomingConnName%>,pstmtUpdate_<%=cid%>
|
||||
<%if(isEnableDebug) {%>,query_<%=cid%>,updateSQLSplits_<%=cid%><%}%>
|
||||
);
|
||||
<%
|
||||
}
|
||||
} else {
|
||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(columnUpdate.getColumn().getTalendType(), columnUpdate.getColumn().isNullable());
|
||||
%>
|
||||
<%=getManager(dbmsId, cid).generateSetStmt(typeToGenerate, columnUpdate, counterColUpdate, incomingConnName, cid, UPDATE_TYPE)%>
|
||||
<%
|
||||
if(isEnableDebug) {
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, columnUpdate, incomingConnName, cid, "query_" , counterColUpdate, "updateSQLSplits_")%>;
|
||||
<%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, columnUpdate, incomingConnName, cid, "query_" , counterColUpdate, "updateSQLSplits_")%>;
|
||||
<%
|
||||
}
|
||||
counterColUpdate++;
|
||||
}
|
||||
}
|
||||
|
||||
counterColUpdate++;
|
||||
}
|
||||
if(isDynamic) {
|
||||
Column dynamicColumn = getColumn(getDynamicColumn());
|
||||
@@ -773,11 +885,11 @@ skeleton="../templates/db_output_bulk.skeleton"
|
||||
if(isEnableDebug) {
|
||||
if(isDynamic){
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid, node).retrieveSQL(talendDynCol.getLabel(),typeToGenerate, columnUpdate, incomingConnName, cid, "query_" , counterColUpdate, "updateSQLSplits_", "(("+incomingConnName+"."+columnUpdate.getName()+"==null)?1:0)")%>;
|
||||
<%=getManager(dbmsId, cid, node).retrieveSQL(talendDynCol.getLabel(),typeToGenerate, columnUpdate, incomingConnName, cid, "query_" , counterColUpdate, "updateSQLSplits_", "(("+incomingConnName+"."+columnUpdate.getName()+"==null)?1:0)")%>;
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid, node).retrieveSQL(typeToGenerate, columnUpdate, incomingConnName, cid, "query_" , counterColUpdate, "updateSQLSplits_", "(("+incomingConnName+"."+columnUpdate.getName()+"==null)?1:0)")%>;
|
||||
<%=getManager(dbmsId, cid, node).retrieveSQL(typeToGenerate, columnUpdate, incomingConnName, cid, "query_" , counterColUpdate, "updateSQLSplits_", "(("+incomingConnName+"."+columnUpdate.getName()+"==null)?1:0)")%>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
@@ -791,11 +903,11 @@ skeleton="../templates/db_output_bulk.skeleton"
|
||||
if(isEnableDebug) {
|
||||
if(isDynamic){
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid, node).retrieveSQL(talendDynCol.getLabel(),typeToGenerate, columnUpdate, incomingConnName, cid, "query_" , counterColUpdate, "updateSQLSplits_")%>;
|
||||
<%=getManager(dbmsId, cid, node).retrieveSQL(talendDynCol.getLabel(),typeToGenerate, columnUpdate, incomingConnName, cid, "query_" , counterColUpdate, "updateSQLSplits_")%>;
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid, node).retrieveSQL(typeToGenerate, columnUpdate, incomingConnName, cid, "query_" , counterColUpdate, "updateSQLSplits_")%>;
|
||||
<%=getManager(dbmsId, cid, node).retrieveSQL(typeToGenerate, columnUpdate, incomingConnName, cid, "query_" , counterColUpdate, "updateSQLSplits_")%>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
@@ -821,18 +933,30 @@ skeleton="../templates/db_output_bulk.skeleton"
|
||||
}
|
||||
int counter = 1;
|
||||
for(Column column : colStruct) {
|
||||
if(column.isInsertable()) {
|
||||
if(!column.isInsertable()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(optimize65535) {
|
||||
if((counter-1)%schemaOptNum==0){
|
||||
%>
|
||||
setPrepareStatementUtil_<%=cid%>.setInsert_<%=(counter-1)/schemaOptNum%>(<%=incomingConnName%>,pstmtInsert_<%=cid%>
|
||||
<%if(isEnableDebug) {%>,query_<%=cid%>,insertSQLSplits_<%=cid%><%}%>
|
||||
);
|
||||
<%
|
||||
}
|
||||
} else {
|
||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getColumn().getTalendType(), column.getColumn().isNullable());
|
||||
%>
|
||||
<%=getManager(dbmsId, cid).generateSetStmt(typeToGenerate, column, counter, incomingConnName, cid, INSERT_TYPE)%>
|
||||
<%
|
||||
if(isEnableDebug) {
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counter, "insertSQLSplits_")%>;
|
||||
<%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counter, "insertSQLSplits_")%>;
|
||||
<%
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
if(isDynamic) {
|
||||
Column dynamicColumn = getColumn(talendDynCol);
|
||||
@@ -876,11 +1000,21 @@ skeleton="../templates/db_output_bulk.skeleton"
|
||||
%>
|
||||
<%=rejectConnName %> = new <%=rejectConnName %>Struct();
|
||||
<%
|
||||
int index = 0;
|
||||
for(IMetadataColumn column : columnList) {
|
||||
%>
|
||||
<%=rejectConnName%>.<%=column.getLabel()%> = <%=incomingConnName%>.<%=column.getLabel()%>;
|
||||
<%
|
||||
}
|
||||
if(optimize65535) {
|
||||
if(index%schemaOptNum==0) {
|
||||
%>
|
||||
dataPropagateUtil_<%=cid%>.assign_<%=rejectConnName%>_<%=index/schemaOptNum%>(<%=incomingConnName%>,<%=rejectConnName%>);
|
||||
<%
|
||||
}
|
||||
index++;
|
||||
} else {
|
||||
%>
|
||||
<%=rejectConnName%>.<%=column.getLabel()%> = <%=incomingConnName%>.<%=column.getLabel()%>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
%>
|
||||
rejectedCount_<%=cid%> = rejectedCount_<%=cid%> + 1;
|
||||
<%=rejectConnName%>.errorCode = ((java.sql.SQLException)e).getSQLState();
|
||||
@@ -912,7 +1046,7 @@ skeleton="../templates/db_output_bulk.skeleton"
|
||||
<%
|
||||
if(isEnableDebug) {
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , keyCounter, "deleteSQLSplits_", "(("+incomingConnName+"."+column.getName()+"==null)?1:0)")%>;
|
||||
<%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , keyCounter, "deleteSQLSplits_", "(("+incomingConnName+"."+column.getName()+"==null)?1:0)")%>;
|
||||
<%
|
||||
}
|
||||
keyCounter++;
|
||||
@@ -924,7 +1058,7 @@ skeleton="../templates/db_output_bulk.skeleton"
|
||||
<%
|
||||
if(isEnableDebug) {
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , keyCounter, "deleteSQLSplits_")%>;
|
||||
<%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , keyCounter, "deleteSQLSplits_")%>;
|
||||
<%
|
||||
}
|
||||
keyCounter++;
|
||||
@@ -970,10 +1104,20 @@ skeleton="../templates/db_output_bulk.skeleton"
|
||||
%>
|
||||
<%=rejectConnName %> = new <%=rejectConnName %>Struct();
|
||||
<%
|
||||
int index = 0;
|
||||
for(IMetadataColumn column : columnList) {
|
||||
%>
|
||||
<%=rejectConnName%>.<%=column.getLabel()%> = <%=incomingConnName%>.<%=column.getLabel()%>;
|
||||
<%
|
||||
if(optimize65535) {
|
||||
if(index%schemaOptNum==0) {
|
||||
%>
|
||||
dataPropagateUtil_<%=cid%>.assign_<%=rejectConnName%>_<%=index/schemaOptNum%>(<%=incomingConnName%>,<%=rejectConnName%>);
|
||||
<%
|
||||
}
|
||||
index++;
|
||||
} else {
|
||||
%>
|
||||
<%=rejectConnName%>.<%=column.getLabel()%> = <%=incomingConnName%>.<%=column.getLabel()%>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
%>
|
||||
rejectedCount_<%=cid%> = rejectedCount_<%=cid%> + 1;
|
||||
@@ -1006,10 +1150,20 @@ skeleton="../templates/db_output_bulk.skeleton"
|
||||
%>
|
||||
<%=outgoingConn.getName()%> = new <%=outgoingConn.getName()%>Struct();
|
||||
<%
|
||||
int index = 0;
|
||||
for(IMetadataColumn column : columnList) {
|
||||
%>
|
||||
<%=outgoingConn.getName()%>.<%=column.getLabel()%> = <%=incomingConnName%>.<%=column.getLabel()%>;
|
||||
<%
|
||||
if(optimize65535) {
|
||||
if(index%schemaOptNum==0) {
|
||||
%>
|
||||
dataPropagateUtil_<%=cid%>.assign_<%=outgoingConn.getName()%>_<%=index/schemaOptNum%>(<%=incomingConnName%>,<%=outgoingConn.getName()%>);
|
||||
<%
|
||||
}
|
||||
index++;
|
||||
} else {
|
||||
%>
|
||||
<%=outgoingConn.getName()%>.<%=column.getLabel()%> = <%=incomingConnName%>.<%=column.getLabel()%>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,4 +89,6 @@ SUPPORT_NULL_WHERE.NAME=Support null in "SQL WHERE" statement
|
||||
USE_BATCH_SIZE.NAME=Use Batch Size
|
||||
BATCH_SIZE.NAME= Batch Size
|
||||
PROPERTIES.NAME=Additional JDBC Parameters
|
||||
NB_LINE_REJECTED.NAME=Number Of Rejected Lines
|
||||
NB_LINE_REJECTED.NAME=Number Of Rejected Lines
|
||||
|
||||
SCHEMA_OPT_NUM.NAME=Schema Optimize Number
|
||||
@@ -507,14 +507,13 @@ pstmt_<%=cid %> = conn_<%=cid%>.prepareStatement(deleteQuery);
|
||||
boolean isfirstInsertWhere = true;
|
||||
String keyColumnName=null;
|
||||
for(Map<String, String> keyColumn:insertColumns){
|
||||
if (isfirstInsertWhere) {
|
||||
isfirstInsertWhere = false;
|
||||
}else {
|
||||
mergeInsertName.append(",");
|
||||
mergeInsertValue.append(",");
|
||||
|
||||
}
|
||||
if (keyColumn.get("INSERT").equals("true")) {
|
||||
if (isfirstInsertWhere) {
|
||||
isfirstInsertWhere = false;
|
||||
}else {
|
||||
mergeInsertName.append(",");
|
||||
mergeInsertValue.append(",");
|
||||
}
|
||||
keyColumnName=keyColumn.get("SCHEMA_COLUMN");
|
||||
keyColumnName = new Column(metadata.getColumn(keyColumnName)).getName();
|
||||
mergeInsertName.append(keyColumnName);
|
||||
|
||||
@@ -64,7 +64,7 @@ if(rejectConns != null && rejectConns.size() > 0) {
|
||||
|
||||
String firstConnName = "";
|
||||
IConnection outConn = null;
|
||||
List< ? extends IConnection> outConns = node.getOutgoingConnections();
|
||||
List< ? extends IConnection> outConns = node.getOutgoingSortedConnections();
|
||||
if(outConns!=null){
|
||||
for (IConnection conn : outConns) {
|
||||
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
||||
|
||||
@@ -70,7 +70,7 @@ if(rejectConns != null && rejectConns.size() > 0) {
|
||||
|
||||
String firstConnName = "";
|
||||
IConnection outConn = null;
|
||||
List< ? extends IConnection> outConns = node.getOutgoingConnections();
|
||||
List< ? extends IConnection> outConns = node.getOutgoingSortedConnections();
|
||||
if(outConns!=null){
|
||||
for (IConnection conn : outConns) {
|
||||
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<%@ jet
|
||||
<%@ jet
|
||||
imports="
|
||||
|
||||
org.talend.core.model.metadata.IMetadataColumn
|
||||
@@ -8,10 +8,10 @@ imports="
|
||||
org.talend.core.model.process.ElementParameterParser
|
||||
org.talend.core.model.process.IConnection
|
||||
org.talend.core.model.process.IConnectionCategory
|
||||
org.talend.core.model.process.INode
|
||||
org.talend.core.model.process.INode
|
||||
org.talend.designer.codegen.config.CodeGeneratorArgument
|
||||
org.talend.core.model.utils.NodeUtil
|
||||
|
||||
|
||||
java.util.ArrayList
|
||||
java.util.List
|
||||
java.util.Map
|
||||
@@ -60,7 +60,7 @@ if(rejectConns != null && rejectConns.size() > 0) {
|
||||
|
||||
IConnection outConn = null;
|
||||
String firstConnName = "";
|
||||
List< ? extends IConnection> outConns = node.getOutgoingConnections();
|
||||
List< ? extends IConnection> outConns = node.getOutgoingSortedConnections();
|
||||
if(outConns!=null){
|
||||
for (IConnection conn : outConns) {
|
||||
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
||||
@@ -74,7 +74,7 @@ if(outConns!=null){
|
||||
%>
|
||||
int nb_line_<%=cid%>=0;
|
||||
java.nio.ByteBuffer bbRecord_<%=cid %> = null;
|
||||
|
||||
|
||||
<%
|
||||
//set original columns
|
||||
List<IMetadataColumn> newColumnList = new ArrayList<IMetadataColumn>();
|
||||
@@ -91,7 +91,7 @@ if(outConn!=null && inConn!=null){
|
||||
continue;
|
||||
}
|
||||
boolean isOirginalColumn = false;
|
||||
for(IMetadataColumn inputCol : inputMetadataTable.getListColumns()){
|
||||
for(IMetadataColumn inputCol : inputMetadataTable.getListColumns()){
|
||||
JavaType stringType = JavaTypesManager.getJavaTypeFromId(inputCol.getTalendType());
|
||||
if( outputCol.getLabel().equals( inputCol.getLabel()) ){
|
||||
if(oirginalColumnsSize%schemaOptNum==0){
|
||||
@@ -145,6 +145,7 @@ if(outConn!=null && inConn!=null){
|
||||
Integer orgainLength = column.getOriginalLength();
|
||||
String orgainType = column.getType();
|
||||
Integer precision = column.getPrecision();
|
||||
String defaultStrValue = column.getDefault();
|
||||
if(precision==null) precision = 0;
|
||||
if(valueN%schemaOptNum==0){
|
||||
%>
|
||||
@@ -173,7 +174,7 @@ the original size in the column:<%=column.getLabel()%> in the schema should be b
|
||||
}
|
||||
}
|
||||
}
|
||||
%>
|
||||
%>
|
||||
<%=outConn.getName() %>.<%=column.getLabel()%> = new String(bb_<%=outConn.getName() %>_<%=column.getLabel()%>,<%=encoding%>)<%=(isTrimAll || (!trimSelects.isEmpty() && (trimStr)))?".trim()":"" %>;
|
||||
<%
|
||||
}else if(orgainType.equals("1")) {
|
||||
@@ -189,7 +190,13 @@ the original size in the column:<%=column.getLabel()%> in the schema should be b
|
||||
boolean isImpliedDecimal = (isImpliedDecimalStr!=null&&!("").equals(isImpliedDecimalStr))?("true").equals(isImpliedDecimalStr):true;
|
||||
if(orgainType.equals("3")){
|
||||
%>
|
||||
<%=outConn.getName() %>.<%=column.getLabel()%> = cobolConversion.EBCDICType3.readType3Value(bb_<%=outConn.getName() %>_<%=column.getLabel()%>,<%=precision %>,<%=isImpliedDecimal %>);
|
||||
<%=outConn.getName() %>.<%=column.getLabel()%> = cobolConversion.EBCDICType3.readType3(bb_<%=outConn.getName() %>_<%=column.getLabel()%>,<%=precision %>,<%=isImpliedDecimal %>
|
||||
,<% if(defaultStrValue == null || "".equals(defaultStrValue)){%>
|
||||
null
|
||||
<%}else{%>
|
||||
""+<%= defaultStrValue %>
|
||||
<%} %>
|
||||
);
|
||||
<%
|
||||
}else {
|
||||
%>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<%@ jet
|
||||
<%@ jet
|
||||
imports="
|
||||
org.talend.core.model.process.INode
|
||||
org.talend.core.model.process.INode
|
||||
org.talend.core.model.process.IConnection
|
||||
org.talend.core.model.process.ElementParameterParser
|
||||
org.talend.core.model.process.IConnectionCategory
|
||||
@@ -59,7 +59,7 @@ if(rejectConns != null && rejectConns.size() > 0) {
|
||||
|
||||
IConnection outConn = null;
|
||||
String firstConnName = "";
|
||||
List< ? extends IConnection> outConns = node.getOutgoingConnections();
|
||||
List< ? extends IConnection> outConns = node.getOutgoingSortedConnections();
|
||||
if(outConns!=null){
|
||||
for (IConnection conn : outConns) {
|
||||
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
||||
@@ -113,7 +113,7 @@ try{
|
||||
continue;
|
||||
}
|
||||
boolean isOirginalColumn = false;
|
||||
for(IMetadataColumn inputCol : inputMetadataTable.getListColumns()){
|
||||
for(IMetadataColumn inputCol : inputMetadataTable.getListColumns()){
|
||||
JavaType stringType = JavaTypesManager.getJavaTypeFromId(inputCol.getTalendType());
|
||||
if( outputCol.getLabel().equals( inputCol.getLabel()) ){
|
||||
isOirginalColumn = true;
|
||||
@@ -135,7 +135,7 @@ try{
|
||||
%>
|
||||
<%=outConn.getName()%>.<%=outputCol.getLabel()%> = <%=inConn.getName()%>.<%=inputCol.getLabel()%>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(oirginalColumnsSize%schemaOptNum==0){
|
||||
isOirginalColumn = true;
|
||||
@@ -148,7 +148,7 @@ try{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!isOirginalColumn){
|
||||
if(!("").equals(rejectConnName)&&rejectConnName.equals(firstConnName)
|
||||
&& (outputCol.getLabel().equals("errorMessage") || outputCol.getLabel().equals("errorCode"))){
|
||||
@@ -165,6 +165,7 @@ try{
|
||||
Integer orgainLength = column.getOriginalLength();
|
||||
String orgainType = column.getType();
|
||||
Integer precision = column.getPrecision();
|
||||
String defaultStrValue = column.getDefault();
|
||||
if(precision==null) precision = 0;
|
||||
if(outputMetadataTable.getListColumns().size() <= schemaOptNum){
|
||||
if(orgainLength==null || orgainLength.intValue()==0 || orgainType==null || "".endsWith(orgainType.trim())) {
|
||||
@@ -189,7 +190,7 @@ try{
|
||||
}
|
||||
}
|
||||
}
|
||||
%>
|
||||
%>
|
||||
<%=outConn.getName() %>.<%=column.getLabel()%> = new String(bb_<%=outConn.getName() %>_<%=column.getLabel()%>,<%=encoding%>)<%=(isTrimAll || (!trimSelects.isEmpty() && (trimStr)))?".trim()":"" %>;
|
||||
<%
|
||||
}else if(orgainType.equals("1")) {
|
||||
@@ -205,7 +206,13 @@ try{
|
||||
boolean isImpliedDecimal = (isImpliedDecimalStr!=null&&!("").equals(isImpliedDecimalStr))?("true").equals(isImpliedDecimalStr):true;
|
||||
if(orgainType.equals("3")){
|
||||
%>
|
||||
<%=outConn.getName() %>.<%=column.getLabel()%> = cobolConversion.EBCDICType3.readType3Value(bb_<%=outConn.getName() %>_<%=column.getLabel()%>,<%=precision %>,<%=isImpliedDecimal %>);
|
||||
<%=outConn.getName() %>.<%=column.getLabel()%> = cobolConversion.EBCDICType3.readType3(bb_<%=outConn.getName() %>_<%=column.getLabel()%>,<%=precision %>,<%=isImpliedDecimal %>
|
||||
,<% if(defaultStrValue == null || "".equals(defaultStrValue)){%>
|
||||
null
|
||||
<%}else{%>
|
||||
""+<%= defaultStrValue %>
|
||||
<%} %>
|
||||
);
|
||||
<%
|
||||
}else {
|
||||
%>
|
||||
@@ -276,7 +283,7 @@ try{
|
||||
}
|
||||
}
|
||||
}
|
||||
%>
|
||||
%>
|
||||
<%=rejectConnName%>.errorMessage = ex_<%=cid %>.getMessage() + " - Line: " + tos_count_<%=node.getUniqueName() %>;
|
||||
<%=firstConnName %> = null;
|
||||
<%
|
||||
|
||||
@@ -249,7 +249,7 @@ if(rejectConns != null && rejectConns.size() > 0) {
|
||||
|
||||
IConnection outConn = null;
|
||||
String firstConnName = "";
|
||||
List< ? extends IConnection> outConns = node.getOutgoingConnections();
|
||||
List< ? extends IConnection> outConns = node.getOutgoingSortedConnections();
|
||||
if(outConns!=null){
|
||||
for (IConnection conn : outConns) {
|
||||
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
||||
|
||||
@@ -76,7 +76,7 @@ if(rejectConns != null && rejectConns.size() > 0) {
|
||||
|
||||
IConnection outConn = null;
|
||||
String firstConnName = "";
|
||||
List< ? extends IConnection> outConns = node.getOutgoingConnections();
|
||||
List< ? extends IConnection> outConns = node.getOutgoingSortedConnections();
|
||||
if(outConns!=null){
|
||||
for (IConnection conn : outConns) {
|
||||
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
||||
|
||||
@@ -67,7 +67,7 @@ if(rejectConns != null && rejectConns.size() > 0) {
|
||||
|
||||
IConnection outConn = null;
|
||||
String firstConnName = "";
|
||||
List< ? extends IConnection> outConns = node.getOutgoingConnections();
|
||||
List< ? extends IConnection> outConns = node.getOutgoingSortedConnections();
|
||||
if(outConns!=null){
|
||||
for (IConnection conn : outConns) {
|
||||
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
||||
|
||||
@@ -53,7 +53,7 @@ if(rejectConns != null && rejectConns.size() > 0) {
|
||||
|
||||
IConnection outConn = null;
|
||||
String firstConnName = "";
|
||||
List< ? extends IConnection> outConns = node.getOutgoingConnections();
|
||||
List< ? extends IConnection> outConns = node.getOutgoingSortedConnections();
|
||||
if(outConns!=null){
|
||||
for (IConnection conn : outConns) {
|
||||
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
||||
|
||||
@@ -251,7 +251,7 @@ if(rejectConns != null && rejectConns.size() > 0) {
|
||||
|
||||
IConnection outConn = null;
|
||||
String firstConnName = "";
|
||||
List< ? extends IConnection> outConns = node.getOutgoingConnections();
|
||||
List< ? extends IConnection> outConns = node.getOutgoingSortedConnections();
|
||||
if(outConns!=null){
|
||||
for (IConnection conn : outConns) {
|
||||
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
||||
|
||||
@@ -131,7 +131,7 @@ if(rejectConns != null && rejectConns.size() > 0) {
|
||||
|
||||
IConnection outConn = null;
|
||||
String firstConnName = "";
|
||||
List< ? extends IConnection> outConns = node.getOutgoingConnections();
|
||||
List< ? extends IConnection> outConns = node.getOutgoingSortedConnections();
|
||||
if(outConns!=null){
|
||||
for (IConnection conn : outConns) {
|
||||
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<%@ jet
|
||||
<%@ jet
|
||||
imports="
|
||||
java.util.List
|
||||
java.util.Map
|
||||
|
||||
|
||||
org.talend.core.model.metadata.IMetadataColumn
|
||||
org.talend.core.model.metadata.IMetadataTable
|
||||
org.talend.core.model.metadata.types.JavaType
|
||||
@@ -12,15 +12,15 @@
|
||||
org.talend.core.model.process.IConnectionCategory
|
||||
org.talend.core.model.process.INode
|
||||
org.talend.designer.codegen.config.CodeGeneratorArgument
|
||||
"
|
||||
"
|
||||
%>
|
||||
<%@ include file="../templates/Log4j/Log4jFileUtil.javajet"%>
|
||||
<%
|
||||
<%
|
||||
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
|
||||
INode node = (INode)codeGenArgument.getArgument();
|
||||
boolean isLog4jEnabled = ("true").equals(ElementParameterParser.getValue(node.getProcess(), "__LOG4J_ACTIVATE__"));
|
||||
String cid = node.getUniqueName();
|
||||
|
||||
|
||||
String filename = ElementParameterParser.getValue(node,"__FILENAME__");
|
||||
String copybook = ElementParameterParser.getValue(node,"__COPYBOOK__");
|
||||
String encoding = ElementParameterParser.getValue(node,"__ENCODING__");
|
||||
@@ -47,7 +47,7 @@ if(!customSetOriginalLength){//------11111
|
||||
net.sf.cobol2j.FileFormat fF_<%=cid %> = (net.sf.cobol2j.FileFormat) o_<%=cid %>;
|
||||
net.sf.cobol2j.RecordSet rset_<%=cid %> = new net.sf.cobol2j.RecordSet(new java.io.FileInputStream(<%= filename %>), fF_<%=cid %>);
|
||||
java.util.Map recdefs_<%=cid %> = new net.sf.cobol2j.RecordsMap(fF_<%=cid %>);
|
||||
|
||||
|
||||
// read every record, for each record split into column definition
|
||||
List inrecord_<%=cid %>;
|
||||
<%
|
||||
@@ -77,7 +77,7 @@ if(!customSetOriginalLength){//------11111
|
||||
%>
|
||||
class EBCDICUtil_<%=cid%>{
|
||||
<%
|
||||
|
||||
|
||||
for(Map<String, String> schemaMap : schemas) {//------AAA0
|
||||
String schemaName = schemaMap.get("SCHEMA");
|
||||
IConnection justConn = null; //------->get the right output connection--->to get the columns info
|
||||
@@ -142,9 +142,9 @@ if(!customSetOriginalLength){//------11111
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.debug("<%=cid%> - Retrieving the record " + nb_line_<%= cid %> + ".");
|
||||
<%}%>
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
<%
|
||||
|
||||
if (conns!=null && conns.size()>0) {
|
||||
@@ -152,16 +152,16 @@ if(!customSetOriginalLength){//------11111
|
||||
IConnection connTemp = conns.get(i);
|
||||
if (connTemp.getLineStyle().hasConnectionCategory(IConnectionCategory.MAIN)) {
|
||||
%>
|
||||
<%=connTemp.getName() %> = null;
|
||||
<%=connTemp.getName() %> = null;
|
||||
<%
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for(Map<String, String> schemaMap : schemas) {//------AAA0
|
||||
String schemaName = schemaMap.get("SCHEMA");
|
||||
String code = schemaMap.get("CODE");
|
||||
|
||||
|
||||
IConnection justConn = null; //------->get the right output connection--->to get the columns info
|
||||
if(conns != null && conns.size() > 0){
|
||||
for(IConnection conn : conns){
|
||||
@@ -179,7 +179,7 @@ if(!customSetOriginalLength){//------11111
|
||||
List<IMetadataColumn> justColumnList = justMetadata.getListColumns();
|
||||
%>
|
||||
if(inrecord_<%=cid %>.get(0).equals("<%=code %>") || recdefs_<%=cid %>.size() == 1 ){
|
||||
|
||||
|
||||
<%=justConn.getName() %> = new <%=justConn.getName() %>Struct();
|
||||
<%
|
||||
int sizeListColumns = justColumnList.size();
|
||||
@@ -188,7 +188,7 @@ if(!customSetOriginalLength){//------11111
|
||||
JavaType javaType = JavaTypesManager.getJavaTypeFromId(column.getTalendType());
|
||||
if(!isOptimizeCode){
|
||||
if(javaType == JavaTypesManager.STRING){
|
||||
%>
|
||||
%>
|
||||
<%=justConn.getName() %>.<%=column.getLabel()%> = (String)inrecord_<%=cid %>.get(<%=valueN%>);
|
||||
<%
|
||||
}else {
|
||||
@@ -204,8 +204,8 @@ if(!customSetOriginalLength){//------11111
|
||||
}
|
||||
}
|
||||
}
|
||||
%>
|
||||
}
|
||||
%>
|
||||
}
|
||||
<%
|
||||
}//------BBB0
|
||||
}//------AAA0
|
||||
@@ -255,6 +255,7 @@ the original size in the column:<%=column.getLabel()%> should be bigger than 0
|
||||
Integer orgainLength = column.getOriginalLength();
|
||||
String orgainType = column.getType();
|
||||
Integer precision = column.getPrecision();
|
||||
String defaultStrValue = column.getDefault();
|
||||
if(valueN%schemaOptNum==0){
|
||||
%>
|
||||
public void getValue_<%=valueN/schemaOptNum%>(final <%=conn.getName()%>Struct <%=conn.getName() %>,java.nio.ByteBuffer bbRecord_<%=cid %>) throws java.lang.Exception{
|
||||
@@ -274,7 +275,7 @@ the original size in the column:<%=column.getLabel()%> in the schema should be b
|
||||
bbRecord_<%=cid %>.get(bb_<%=column.getLabel()%>_<%=cid%>);
|
||||
<%
|
||||
if(orgainType.equals("X")){
|
||||
%>
|
||||
%>
|
||||
<%=conn.getName() %>.<%=column.getLabel()%> = new String(bb_<%=column.getLabel()%>_<%=cid%>,<%=encoding%>)<%=(isTrimAll || (!trimSelects.isEmpty() && ("true").equals(trimSelects.get(valueN).get("TRIM"))))?".trim()":"" %>;
|
||||
<%
|
||||
}else if(orgainType.equals("1")) {
|
||||
@@ -290,7 +291,13 @@ the original size in the column:<%=column.getLabel()%> in the schema should be b
|
||||
boolean isImpliedDecimal = (isImpliedDecimalStr!=null&&!("").equals(isImpliedDecimalStr))?("true").equals(isImpliedDecimalStr):true;
|
||||
if(orgainType.equals("3")){
|
||||
%>
|
||||
<%=conn.getName() %>.<%=column.getLabel()%> = cobolConversion.EBCDICType3.readType3Value(bb_<%=column.getLabel()%>_<%=cid%>,<%=precision %>,<%=isImpliedDecimal %>);
|
||||
<%=conn.getName() %>.<%=column.getLabel()%> = cobolConversion.EBCDICType3.readType3(bb_<%=column.getLabel()%>_<%=cid%>,<%=precision %>,<%=isImpliedDecimal %>
|
||||
,<% if(defaultStrValue == null || "".equals(defaultStrValue)){%>
|
||||
null
|
||||
<%}else{%>
|
||||
""+<%= defaultStrValue %>
|
||||
<%} %>
|
||||
);
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
@@ -336,6 +343,12 @@ DB Type of the column:<%=column.getLabel()%> should be X, 1, 2, 3, 9, B, T
|
||||
<%}%>
|
||||
while((iReadOffset_<%=cid %> = fs_<%=cid %>.read(bb_row_<%=cid %>))!= -1){
|
||||
bbRecord_<%=cid %> = java.nio.ByteBuffer.wrap(bb_row_<%=cid %>);
|
||||
nb_line_<%= cid %> ++;
|
||||
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.debug("<%=cid%> - Retrieving the record " + nb_line_<%= cid %> + ".");
|
||||
<%}%>
|
||||
|
||||
<%
|
||||
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.MAIN)) {//------BBB1
|
||||
IMetadataTable justMetadata = conn.getMetadataTable();
|
||||
@@ -346,6 +359,7 @@ DB Type of the column:<%=column.getLabel()%> should be X, 1, 2, 3, 9, B, T
|
||||
Integer orgainLength = column.getOriginalLength();
|
||||
String orgainType = column.getType();
|
||||
Integer precision = column.getPrecision();
|
||||
String defaultStrValue = column.getDefault();
|
||||
if(!isOptimizeCode){
|
||||
if(precision==null) precision = 0;
|
||||
if(orgainLength==null || orgainLength.intValue()==0 || orgainType==null || "".endsWith(orgainType.trim())) {
|
||||
@@ -361,7 +375,7 @@ the original size in the column:<%=column.getLabel()%> in the schema should be b
|
||||
bbRecord_<%=cid %>.get(bb_<%=column.getLabel()%>_<%=cid%>);
|
||||
<%
|
||||
if(orgainType.equals("X")){
|
||||
%>
|
||||
%>
|
||||
<%=conn.getName() %>.<%=column.getLabel()%> = new String(bb_<%=column.getLabel()%>_<%=cid%>,<%=encoding%>)<%=(isTrimAll || (!trimSelects.isEmpty() && ("true").equals(trimSelects.get(valueN).get("TRIM"))))?".trim()":"" %>;
|
||||
<%
|
||||
}else if(orgainType.equals("1")) {
|
||||
@@ -377,7 +391,13 @@ the original size in the column:<%=column.getLabel()%> in the schema should be b
|
||||
boolean isImpliedDecimal = (isImpliedDecimalStr!=null&&!("").equals(isImpliedDecimalStr))?("true").equals(isImpliedDecimalStr):true;
|
||||
if(orgainType.equals("3")){
|
||||
%>
|
||||
<%=conn.getName() %>.<%=column.getLabel()%> = cobolConversion.EBCDICType3.readType3Value(bb_<%=column.getLabel()%>_<%=cid%>,<%=precision %>,<%=isImpliedDecimal %>);
|
||||
<%=conn.getName() %>.<%=column.getLabel()%> = cobolConversion.EBCDICType3.readType3(bb_<%=column.getLabel()%>_<%=cid%>,<%=precision %>,<%=isImpliedDecimal %>
|
||||
,<% if(defaultStrValue == null || "".equals(defaultStrValue)){%>
|
||||
null
|
||||
<%}else{%>
|
||||
""+<%= defaultStrValue %>
|
||||
<%} %>
|
||||
);
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
|
||||
@@ -173,10 +173,10 @@
|
||||
<IMPORT NAME="dom4j" MODULE="dom4j-1.6.1.jar" UrlPath="platform:/plugin/org.talend.libraries.dom4j-jaxen/lib/dom4j-1.6.1.jar" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="geronimo-stax-api" MODULE="geronimo-stax-api_1.0_spec-1.0.1.jar" UrlPath="platform:/plugin/org.talend.libraries.apache.axis2/lib/geronimo-stax-api_1.0_spec-1.0.1.jar" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="log4j" MODULE="log4j-1.2.15.jar" UrlPath="platform:/base/plugins/org.apache.log4j_1.2.15.v201012070815.jar" REQUIRED_IF="(VERSION_2007 == 'true')" BundleID="" />
|
||||
<IMPORT NAME="poi" MODULE="poi-3.10-FINAL-20140219_modified_talend.jar" UrlPath="platform:/plugin/org.talend.libraries.excel/lib/poi-3.10-FINAL-20140219_modified_talend.jar" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="poi-ooxml" MODULE="poi-ooxml-3.10-FINAL-20140219_modified_talend.jar" UrlPath="platform:/plugin/org.talend.libraries.excel/lib/poi-ooxml-3.10-FINAL-20140219_modified_talend.jar" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="poi-ooxml-schemas" MODULE="poi-ooxml-schemas-3.10-FINAL-20140208.jar" UrlPath="platform:/plugin/org.talend.libraries.excel/lib/poi-ooxml-schemas-3.10-FINAL-20140208.jar" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="poi-scratchpad" MODULE="poi-scratchpad-3.10-FINAL-20140208.jar" UrlPath="platform:/plugin/org.talend.libraries.excel/lib/poi-scratchpad-3.10-FINAL-20140208.jar" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="poi" MODULE="poi-3.11-20141221_modified_talend.jar" UrlPath="platform:/plugin/org.talend.libraries.excel/lib/poi-3.11-20141221_modified_talend.jar" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="poi-ooxml" MODULE="poi-ooxml-3.11-20141221_modified_talend.jar" UrlPath="platform:/plugin/org.talend.libraries.excel/lib/poi-ooxml-3.11-20141221_modified_talend.jar" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="poi-ooxml-schemas" MODULE="poi-ooxml-schemas-3.11-20141221.jar" UrlPath="platform:/plugin/org.talend.libraries.excel/lib/poi-ooxml-schemas-3.11-20141221.jar" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="poi-scratchpad" MODULE="poi-scratchpad-3.11-20141221.jar" UrlPath="platform:/plugin/org.talend.libraries.excel/lib/poi-scratchpad-3.11-20141221.jar" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="xmlbeans" MODULE="xmlbeans-2.6.0.jar" UrlPath="platform:/plugin/org.talend.libraries.apache.xml/lib/xmlbeans-2.6.0.jar" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="simpleexcel" MODULE="simpleexcel.jar" UrlPath="platform:/plugin/org.talend.libraries.excel/lib/simpleexcel.jar" REQUIRED_IF="(VERSION_2007 == 'true') AND GENERATION_MODE == 'EVENT_MODE')" />
|
||||
</IMPORTS>
|
||||
|
||||
@@ -0,0 +1,230 @@
|
||||
<%@ jet
|
||||
%>
|
||||
<%
|
||||
List<Map<String, String>> mapping = (List<Map<String,String>>)ElementParameterParser.getObjectValueXML(node, "__MAPPING_JSONPATH__");
|
||||
List< ? extends IConnection> conns = NodeUtil.getOutgoingConnections(node, IConnectionCategory.DATA);
|
||||
String firstConnName = "";
|
||||
List<IMetadataTable> metadatas = node.getMetadataList();
|
||||
|
||||
String loopPath = ElementParameterParser.getValue(node, "__JSON_LOOP_QUERY__");
|
||||
%>
|
||||
class JsonPathCache_<%=cid%> {
|
||||
final java.util.Map<String,com.jayway.jsonpath.JsonPath> jsonPathString2compiledJsonPath = new java.util.HashMap<String,com.jayway.jsonpath.JsonPath>();
|
||||
|
||||
public com.jayway.jsonpath.JsonPath getCompiledJsonPath(String jsonPath) {
|
||||
if(jsonPathString2compiledJsonPath.containsKey(jsonPath)) {
|
||||
return jsonPathString2compiledJsonPath.get(jsonPath);
|
||||
} else {
|
||||
com.jayway.jsonpath.JsonPath compiledLoopPath = com.jayway.jsonpath.JsonPath.compile(jsonPath);
|
||||
jsonPathString2compiledJsonPath.put(jsonPath,compiledLoopPath);
|
||||
return compiledLoopPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int nb_line_<%=cid%> = 0;
|
||||
|
||||
JsonPathCache_<%=cid%> jsonPathCache_<%=cid%> = new JsonPathCache_<%=cid%>();
|
||||
|
||||
String loopPath_<%=cid%> = <%=loopPath%>;
|
||||
java.util.List<Object> resultset_<%=cid%> = new java.util.ArrayList<Object>();
|
||||
|
||||
java.io.InputStream is_<%=cid%> = null;
|
||||
com.jayway.jsonpath.ParseContext parseContext_<%=cid%> = com.jayway.jsonpath.JsonPath.using(com.jayway.jsonpath.Configuration.defaultConfiguration());
|
||||
try {
|
||||
<%if(!isUseUrl){//read from a file%>
|
||||
is_<%=cid%> = new java.io.FileInputStream(<%=filename %>);
|
||||
<%}else{ //read from internet%>
|
||||
java.net.URL url_<%=cid %> = new java.net.URL(<%=urlpath %>);
|
||||
java.net.URLConnection urlConn_<%=cid %> = url_<%=cid %>.openConnection();
|
||||
is_<%=cid%> = urlConn_<%=cid %>.getInputStream();
|
||||
<%}%>
|
||||
com.jayway.jsonpath.ReadContext document_<%=cid%> = parseContext_<%=cid%>.parse(is_<%=cid%>,<%=encoding %>);
|
||||
com.jayway.jsonpath.JsonPath compiledLoopPath_<%=cid%> = jsonPathCache_<%=cid%>.getCompiledJsonPath(loopPath_<%=cid%>);
|
||||
Object result_<%=cid%> = document_<%=cid%>.read(compiledLoopPath_<%=cid%>,net.minidev.json.JSONObject.class);
|
||||
if (result_<%=cid%> instanceof net.minidev.json.JSONArray) {
|
||||
resultset_<%=cid%> = (net.minidev.json.JSONArray) result_<%=cid%>;
|
||||
} else {
|
||||
resultset_<%=cid%>.add(result_<%=cid%>);
|
||||
}
|
||||
} catch (java.lang.Exception e_<%=cid%>) {
|
||||
<%
|
||||
if(dieOnError){
|
||||
%>
|
||||
throw(e_<%=cid %>);
|
||||
<%
|
||||
} else {
|
||||
if(isLog4jEnabled){%>
|
||||
log.error("<%=cid%> - " + e_<%=cid%>.getMessage());
|
||||
<%}%>
|
||||
System.err.println(e_<%=cid%>.getMessage());
|
||||
<%
|
||||
}
|
||||
%>
|
||||
} finally {
|
||||
if(is_<%=cid%> != null) {
|
||||
is_<%=cid%>.close();
|
||||
}
|
||||
}
|
||||
|
||||
String jsonPath_<%=cid%> = null;
|
||||
com.jayway.jsonpath.JsonPath compiledJsonPath_<%=cid%> = null;
|
||||
|
||||
Object value_<%=cid%> = null;
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> - Retrieving records from data.");
|
||||
<%}%>
|
||||
for(Object row_<%=cid%> : resultset_<%=cid%>) {
|
||||
nb_line_<%=cid%>++;
|
||||
<%
|
||||
log4jFileUtil.debugRetriveData(node);
|
||||
|
||||
if ((metadatas==null) || (metadatas.isEmpty())) {
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
IMetadataTable metadata = metadatas.get(0);
|
||||
|
||||
if (metadata==null) {
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
if (conns==null || conns.isEmpty()) {
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
List<IMetadataColumn> columns=metadata.getListColumns();
|
||||
|
||||
String rejectConnName = "";
|
||||
List<? extends IConnection> rejectConns = node.getOutgoingConnections("REJECT");
|
||||
if(rejectConns != null && rejectConns.size() > 0) {
|
||||
IConnection rejectConn = rejectConns.get(0);
|
||||
rejectConnName = rejectConn.getName();
|
||||
}
|
||||
List<IMetadataColumn> rejectColumnList = null;
|
||||
IMetadataTable metadataTable = node.getMetadataFromConnector("REJECT");
|
||||
if(metadataTable != null) {
|
||||
rejectColumnList = metadataTable.getListColumns();
|
||||
}
|
||||
for (int i=0;i<conns.size();i++) {
|
||||
IConnection connTemp = conns.get(i);
|
||||
if (connTemp.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
||||
%>
|
||||
<%=connTemp.getName() %> = null;
|
||||
<%
|
||||
}
|
||||
}
|
||||
|
||||
IConnection conn = conns.get(0);
|
||||
firstConnName = conn.getName();
|
||||
|
||||
if(!conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
%>
|
||||
boolean whetherReject_<%=cid %> = false;
|
||||
<%=firstConnName %> = new <%=conn.getName() %>Struct();
|
||||
|
||||
try{
|
||||
<%
|
||||
for (int i=0;i<mapping.size();i++) {
|
||||
for(IMetadataColumn column:columns) {
|
||||
String schemaColumn = mapping.get(i).get("SCHEMA_COLUMN");
|
||||
if(schemaColumn==null || !column.getLabel().equals(schemaColumn)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String jsonPath = mapping.get(i).get("QUERY");
|
||||
|
||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getTalendType(), column.isNullable());
|
||||
JavaType javaType = JavaTypesManager.getJavaTypeFromId(column.getTalendType());
|
||||
String pattern = column.getPattern() == null || column.getPattern().trim().length() == 0 ? null : column.getPattern();
|
||||
|
||||
String defaultValue = column.getDefault();
|
||||
boolean isNotSetDefault = (defaultValue == null || defaultValue.trim().length()==0);
|
||||
%>
|
||||
jsonPath_<%=cid%> = <%=jsonPath%>;
|
||||
compiledJsonPath_<%=cid%> = jsonPathCache_<%=cid%>.getCompiledJsonPath(jsonPath_<%=cid%>);
|
||||
|
||||
try {
|
||||
value_<%=cid%> = compiledJsonPath_<%=cid%>.read(row_<%=cid%>);
|
||||
<%
|
||||
if(javaType == JavaTypesManager.STRING){
|
||||
%>
|
||||
<%=firstConnName%>.<%=column.getLabel() %> = value_<%=cid%> == null ? <%@ include file="./set_default_value.javajet"%> : value_<%=cid%>.toString();
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
if(value_<%=cid%> != null && !value_<%=cid%>.toString().isEmpty()) {
|
||||
<%
|
||||
if(javaType == JavaTypesManager.OBJECT) {
|
||||
%>
|
||||
<%=firstConnName%>.<%=column.getLabel() %> = value_<%=cid%>.toString();
|
||||
<%
|
||||
} else if(javaType == JavaTypesManager.DATE) {
|
||||
%>
|
||||
<%=firstConnName%>.<%=column.getLabel() %> = ParserUtils.parseTo_Date(value_<%=cid%>.toString(), <%=pattern%>);
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
<%=firstConnName%>.<%=column.getLabel() %> = ParserUtils.parseTo_<%=typeToGenerate %>(value_<%=cid%>.toString());
|
||||
<%
|
||||
}
|
||||
%>
|
||||
} else {
|
||||
<%=firstConnName %>.<%=column.getLabel() %> = <%@ include file="./set_default_value.javajet"%>;
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
} catch (com.jayway.jsonpath.PathNotFoundException e_<%=cid%>) {
|
||||
<%=firstConnName %>.<%=column.getLabel() %> = <%@ include file="./set_default_value.javajet"%>;
|
||||
}
|
||||
<%
|
||||
}
|
||||
}
|
||||
|
||||
if(rejectConnName.equals(firstConnName)) {
|
||||
%>
|
||||
<%=firstConnName %> = null;
|
||||
<%
|
||||
}
|
||||
%>
|
||||
} catch (java.lang.Exception e_<%=cid%>) {
|
||||
whetherReject_<%=cid%> = true;
|
||||
<%
|
||||
if (dieOnError) {
|
||||
%>
|
||||
throw(e_<%=cid%>);
|
||||
<%
|
||||
} else {
|
||||
if(!("").equals(rejectConnName)&&!rejectConnName.equals(firstConnName)&&rejectColumnList != null && rejectColumnList.size() > 0) {
|
||||
%>
|
||||
<%=rejectConnName %> = new <%=rejectConnName %>Struct();
|
||||
<%
|
||||
for(IMetadataColumn column : metadata.getListColumns()) {
|
||||
%>
|
||||
<%=rejectConnName%>.<%=column.getLabel()%> = <%=firstConnName%>.<%=column.getLabel()%>;
|
||||
<%
|
||||
}
|
||||
%>
|
||||
<%=rejectConnName%>.errorMessage = e_<%=cid%>.getMessage() + " - Line: " + tos_count_<%=node.getUniqueName() %>;
|
||||
<%=firstConnName %> = null;
|
||||
<%
|
||||
} else if(("").equals(rejectConnName)){
|
||||
if(isLog4jEnabled){%>
|
||||
log.error("<%=cid%> - " + e_<%=cid%>.getMessage());
|
||||
<%}
|
||||
%>
|
||||
System.err.println(e_<%=cid%>.getMessage());
|
||||
<%=firstConnName %> = null;
|
||||
<%
|
||||
}else if(rejectConnName.equals(firstConnName)){
|
||||
%>
|
||||
<%=rejectConnName%>.errorMessage = e_<%=cid%>.getMessage() + " - Line: " + tos_count_<%=node.getUniqueName() %>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
%>
|
||||
}
|
||||
//}
|
||||
@@ -0,0 +1,303 @@
|
||||
<%@ jet
|
||||
%>
|
||||
<%
|
||||
List<Map<String, String>> mapping = (List<Map<String,String>>)ElementParameterParser.getObjectValueXML(node, "__MAPPING__");
|
||||
List< ? extends IConnection> conns = NodeUtil.getOutgoingConnections(node, IConnectionCategory.DATA);
|
||||
String firstConnName = "";
|
||||
List<IMetadataTable> metadatas = node.getMetadataList();
|
||||
%>
|
||||
class JSONUtil_<%=cid%>{
|
||||
public int getData(String query,javax.script.Invocable invocableEngine,java.util.List<org.json.simple.JSONArray> jsonResultList,int recordMaxSize){
|
||||
try{
|
||||
//only 2 types: String/Boolean
|
||||
String resultObj = invocableEngine.invokeFunction("jsonPath",query).toString();
|
||||
if(!"false".equals(resultObj)){
|
||||
org.json.simple.JSONArray resultArray= (org.json.simple.JSONArray)org.json.simple.JSONValue.parse(resultObj);
|
||||
jsonResultList.add(resultArray);
|
||||
if(recordMaxSize != -1 && recordMaxSize != resultArray.size()){
|
||||
//just give an error, don't stop
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.warn("<%=cid%> - The Json resource datas maybe have some problems, please make sure the data structure with the same fields.");
|
||||
<%}%>
|
||||
System.err.println("The Json resource datas maybe have some problems, please make sure the data structure with the same fields.");
|
||||
}
|
||||
recordMaxSize = Math.max(recordMaxSize, resultArray.size());
|
||||
}else{
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.warn("<%=cid%> - Can't find any data with JSONPath " + query);
|
||||
<%}%>
|
||||
System.err.println("Can't find any data with JSONPath " + query);
|
||||
//add null to take a place in List(buffer)
|
||||
jsonResultList.add(null);
|
||||
}
|
||||
}catch(java.lang.Exception e){
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.error("<%=cid%> - " + e.getMessage());
|
||||
<%}%>
|
||||
e.printStackTrace();
|
||||
}
|
||||
return recordMaxSize;
|
||||
}
|
||||
|
||||
<%
|
||||
if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
IMetadataTable metadata = metadatas.get(0);
|
||||
if (metadata!=null) {
|
||||
List<IMetadataColumn> columns=metadata.getListColumns();
|
||||
if (conns!=null) {
|
||||
if (conns.size()>0) {
|
||||
IConnection conn = conns.get(0);
|
||||
firstConnName = conn.getName();
|
||||
for (int i=0;i<mapping.size();i++) {
|
||||
if(i % 100 == 0){
|
||||
%>
|
||||
void setRowValue_<%=(i/100) %>(<%=firstConnName %>Struct <%=firstConnName %>, java.util.List<org.json.simple.JSONArray> JSONResultList_<%=cid%>, int nbResultArray_<%=cid%>) throws java.io.UnsupportedEncodingException{
|
||||
<%
|
||||
}
|
||||
%>
|
||||
<%
|
||||
for(IMetadataColumn column:columns) {
|
||||
if (mapping.get(i).get("SCHEMA_COLUMN")!=null) {
|
||||
if (column.getLabel().compareTo(mapping.get(i).get("SCHEMA_COLUMN"))==0) {
|
||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getTalendType(), column.isNullable());
|
||||
JavaType javaType = JavaTypesManager.getJavaTypeFromId(column.getTalendType());
|
||||
String patternValue = column.getPattern() == null || column.getPattern().trim().length() == 0 ? null : column.getPattern();
|
||||
%>
|
||||
if(JSONResultList_<%=cid%>.get(<%=i%>) != null && nbResultArray_<%=cid%><JSONResultList_<%=cid%>.get(<%=i%>).size() && JSONResultList_<%=cid%>.get(<%=i%>).get(nbResultArray_<%=cid%>)!=null){
|
||||
<%
|
||||
if (javaType == JavaTypesManager.STRING || javaType == JavaTypesManager.OBJECT) {
|
||||
%>
|
||||
<%=firstConnName %>.<%=column.getLabel() %> = JSONResultList_<%=cid%>.get(<%=i%>).get(nbResultArray_<%=cid%>).toString();
|
||||
<%
|
||||
} else if(javaType == JavaTypesManager.DATE) {
|
||||
%>
|
||||
<%=firstConnName %>.<%=column.getLabel() %> = ParserUtils.parseTo_Date(JSONResultList_<%=cid%>.get(<%=i%>).get(nbResultArray_<%=cid%>).toString(), <%= patternValue %>);
|
||||
<%
|
||||
}else if(advancedSeparator && JavaTypesManager.isNumberType(javaType)) {
|
||||
%>
|
||||
<%=firstConnName %>.<%=column.getLabel() %> = ParserUtils.parseTo_<%= typeToGenerate %>(ParserUtils.parseTo_Number(JSONResultList_<%=cid%>.get(<%=i%>).get(nbResultArray_<%=cid%>).toString(), <%= thousandsSeparator %>, <%= decimalSeparator %>));
|
||||
<%
|
||||
} else if(javaType == JavaTypesManager.BYTE_ARRAY) {
|
||||
%>
|
||||
<%=firstConnName %>.<%=column.getLabel() %> = JSONResultList_<%=cid%>.get(<%=i%>).get(nbResultArray_<%=cid%>).toString().getBytes(<%=encoding %>);
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
<%=firstConnName %>.<%=column.getLabel() %> = ParserUtils.parseTo_<%= typeToGenerate %>(JSONResultList_<%=cid%>.get(<%=i%>).get(nbResultArray_<%=cid%>).toString());
|
||||
<%
|
||||
}
|
||||
%>
|
||||
}else{
|
||||
|
||||
<%
|
||||
String defaultValue = JavaTypesManager.getDefaultValueFromJavaType(typeToGenerate, column.getDefault());
|
||||
if(defaultValue == null) {
|
||||
%>
|
||||
throw new RuntimeException("Value is empty for column : '<%= column.getLabel() %>' in '<%=firstConnName%>' connection, value is invalid or this column should be nullable or have a default value.");
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
<%=firstConnName %>.<%=column.getLabel() %> = <%=defaultValue%>;
|
||||
|
||||
<%
|
||||
}
|
||||
%>
|
||||
}
|
||||
<%
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if((i + 1) % 100 == 0){
|
||||
%>
|
||||
}
|
||||
<%
|
||||
}
|
||||
} // for (int i=0)
|
||||
if(mapping.size() > 0 && mapping.size() % 100 > 0){
|
||||
%>
|
||||
}
|
||||
<%
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
%>
|
||||
}
|
||||
int nb_line_<%=cid%> = 0;
|
||||
java.lang.Object jsonText_<%=cid%> = null;
|
||||
JSONUtil_<%=cid%> jsonUtil_<%=cid%>=new JSONUtil_<%=cid%>();
|
||||
java.util.List<org.json.simple.JSONArray> JSONResultList_<%=cid%> = new java.util.ArrayList<org.json.simple.JSONArray>();
|
||||
int recordMaxSize_<%=cid%> = -1;
|
||||
|
||||
//init js json engine
|
||||
javax.script.ScriptEngineManager scriptEngineMgr_<%=cid%> = new javax.script.ScriptEngineManager();
|
||||
javax.script.ScriptEngine jsEngine_<%=cid%> = scriptEngineMgr_<%=cid%>.getEngineByName("JavaScript");
|
||||
if (jsEngine_<%=cid%> == null) {
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.warn("<%=cid%> - No script engine found for JavaScript");
|
||||
<%}%>
|
||||
System.err.println("No script engine found for JavaScript");
|
||||
} else {
|
||||
java.net.URL jsonjsUrl_<%=cid%> = com.jsonpath.test.ReadJar.class.getResource("json.js");
|
||||
if(jsonjsUrl_<%=cid%>!=null) {
|
||||
jsEngine_<%=cid%>.eval(new java.io.BufferedReader(new java.io.InputStreamReader(jsonjsUrl_<%=cid%>.openStream())));
|
||||
}
|
||||
|
||||
java.net.URL jsonpathjsUrl_<%=cid%> = com.jsonpath.test.ReadJar.class.getResource("jsonpath.js");
|
||||
if(jsonpathjsUrl_<%=cid%>!=null) {
|
||||
jsEngine_<%=cid%>.eval(new java.io.BufferedReader(new java.io.InputStreamReader(jsonpathjsUrl_<%=cid%>.openStream())));
|
||||
}
|
||||
|
||||
<%if(!isUseUrl){//read from a file%>
|
||||
java.io.BufferedReader fr_<%=cid%> = null;
|
||||
<%}else{ //read from internet%>
|
||||
java.io.InputStreamReader fr_<%=cid %> = null;
|
||||
<%}%>
|
||||
try{
|
||||
<%if(!isUseUrl){//read from a file%>
|
||||
fr_<%=cid%> = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(<%=filename %>),<%=encoding %>));
|
||||
<%}else{ //read from internet%>
|
||||
java.net.URL url_<%=cid %> = new java.net.URL(<%=urlpath %>);
|
||||
java.net.URLConnection urlConn_<%=cid %> = url_<%=cid %>.openConnection();
|
||||
fr_<%=cid %> = new java.io.InputStreamReader(urlConn_<%=cid %>.getInputStream(),<%=encoding %>);
|
||||
<%}%>
|
||||
jsonText_<%=cid%> = org.json.simple.JSONValue.parse(fr_<%=cid%>);
|
||||
if(jsonText_<%=cid%> == null) {
|
||||
throw new RuntimeException("fail to parse the json file : " + <%if(!isUseUrl) {%> <%=filename %> <%} else {%> <%=urlpath %> <%}%>);
|
||||
}
|
||||
} catch(java.lang.Exception e_<%=cid%>) {
|
||||
<%if (dieOnError) {%>
|
||||
throw e_<%=cid%>;
|
||||
<%} else {%>
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.error("<%=cid%> - " + e_<%=cid%>.getMessage());
|
||||
<%}%>
|
||||
System.err.println(e_<%=cid%>.getMessage());
|
||||
<%}%>
|
||||
} finally {
|
||||
if(fr_<%=cid%> != null ) {
|
||||
fr_<%=cid%>.close();
|
||||
}
|
||||
}
|
||||
|
||||
if(jsonText_<%=cid%>!=null) {
|
||||
jsEngine_<%=cid%>.eval("var obj="+jsonText_<%=cid%>.toString());
|
||||
|
||||
javax.script.Invocable invocableEngine_<%=cid%> = (javax.script.Invocable)jsEngine_<%=cid%>;
|
||||
|
||||
<%
|
||||
for(Map<String,String> path:mapping){
|
||||
String column = path.get("SCHEMA_COLUMN");
|
||||
String query = path.get("QUERY");
|
||||
%>
|
||||
|
||||
recordMaxSize_<%=cid%>=jsonUtil_<%=cid%>.getData(<%=query%>,invocableEngine_<%=cid%>,JSONResultList_<%=cid%>,recordMaxSize_<%=cid%>);
|
||||
|
||||
<%
|
||||
}
|
||||
%>
|
||||
}
|
||||
}
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> - Retrieving records from data.");
|
||||
<%}%>
|
||||
for(int nbResultArray_<%=cid%> = 0; nbResultArray_<%=cid%> < recordMaxSize_<%=cid%>; nbResultArray_<%=cid%>++){
|
||||
|
||||
nb_line_<%=cid%>++;
|
||||
<%
|
||||
log4jFileUtil.debugRetriveData(node);
|
||||
|
||||
if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
IMetadataTable metadata = metadatas.get(0);
|
||||
if (metadata!=null) {
|
||||
List<IMetadataColumn> columns=metadata.getListColumns();
|
||||
if (conns!=null) {
|
||||
String rejectConnName = "";
|
||||
List<? extends IConnection> rejectConns = node.getOutgoingConnections("REJECT");
|
||||
if(rejectConns != null && rejectConns.size() > 0) {
|
||||
IConnection rejectConn = rejectConns.get(0);
|
||||
rejectConnName = rejectConn.getName();
|
||||
}
|
||||
List<IMetadataColumn> rejectColumnList = null;
|
||||
IMetadataTable metadataTable = node.getMetadataFromConnector("REJECT");
|
||||
if(metadataTable != null) {
|
||||
rejectColumnList = metadataTable.getListColumns();
|
||||
}
|
||||
for (int i=0;i<conns.size();i++) {
|
||||
IConnection connTemp = conns.get(i);
|
||||
if (connTemp.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
||||
%>
|
||||
<%=connTemp.getName() %> = null;
|
||||
<%
|
||||
}
|
||||
}
|
||||
if (conns.size()>0) { // conns.size()>0
|
||||
IConnection conn = conns.get(0);
|
||||
firstConnName = conn.getName();
|
||||
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) { // add for DATA
|
||||
%>
|
||||
boolean whetherReject_<%=cid %> = false;
|
||||
<%=firstConnName %> = new <%=conn.getName() %>Struct();
|
||||
try{
|
||||
<%
|
||||
for (int i=0;i<mapping.size();i++) {
|
||||
if(i % 100 == 0){
|
||||
%>
|
||||
jsonUtil_<%=cid%>.setRowValue_<%= (i/100) %>(<%=firstConnName %>,JSONResultList_<%=cid%>,nbResultArray_<%=cid%>);
|
||||
<%
|
||||
}
|
||||
}// for
|
||||
if(rejectConnName.equals(firstConnName)) {
|
||||
%>
|
||||
<%=firstConnName %> = null;
|
||||
<%
|
||||
}
|
||||
%>
|
||||
} catch (java.lang.Exception e) {
|
||||
whetherReject_<%=cid%> = true;
|
||||
<%
|
||||
if (dieOnError) {
|
||||
%>
|
||||
throw(e);
|
||||
<%
|
||||
} else {
|
||||
if(isLog4jEnabled){%>
|
||||
log.error("<%=cid%> - " + e.getMessage());
|
||||
<%}
|
||||
if(!("").equals(rejectConnName)&&!rejectConnName.equals(firstConnName)&&rejectColumnList != null && rejectColumnList.size() > 0) {
|
||||
%>
|
||||
<%=rejectConnName %> = new <%=rejectConnName %>Struct();
|
||||
<%
|
||||
for(IMetadataColumn column : metadata.getListColumns()) {
|
||||
%>
|
||||
<%=rejectConnName%>.<%=column.getLabel()%> = <%=firstConnName%>.<%=column.getLabel()%>;
|
||||
<%
|
||||
}
|
||||
%>
|
||||
<%=rejectConnName%>.errorMessage = e.getMessage() + " - Line: " + tos_count_<%=node.getUniqueName() %>;
|
||||
<%=firstConnName %> = null;
|
||||
<%
|
||||
} else if(("").equals(rejectConnName)){
|
||||
%>
|
||||
System.err.println(e.getMessage());
|
||||
<%=firstConnName %> = null;
|
||||
<%
|
||||
}else if(rejectConnName.equals(firstConnName)){
|
||||
%>
|
||||
<%=rejectConnName%>.errorMessage = e.getMessage() + " - Line: " + tos_count_<%=node.getUniqueName() %>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
%>
|
||||
}
|
||||
<%
|
||||
}// end for DATA
|
||||
}// conns.size()>0
|
||||
} // if(conns!=null)
|
||||
} // if (metadata!=null)
|
||||
} // if ((metadatas!=null)&&(metadatas.size()>0))
|
||||
%>
|
||||
@@ -0,0 +1,13 @@
|
||||
<%@ jet%>
|
||||
|
||||
<%
|
||||
if(column.isNullable()) {
|
||||
%>
|
||||
<%=isNotSetDefault? null: defaultValue%>
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
<%=isNotSetDefault ? JavaTypesManager.getDefaultValueFromJavaType(typeToGenerate) : defaultValue%>
|
||||
<%
|
||||
}
|
||||
%>
|
||||
@@ -22,7 +22,6 @@ boolean isLog4jEnabled = ("true").equals(ElementParameterParser.getValue(node.ge
|
||||
|
||||
String cid = node.getUniqueName();
|
||||
|
||||
boolean readByXPath = "true".equals(ElementParameterParser.getValue(node, "__READBYXPATH__"));
|
||||
String dieOnErrorStr = ElementParameterParser.getValue(node, "__DIE_ON_ERROR__");
|
||||
boolean dieOnError = (dieOnErrorStr!=null&&!("").equals(dieOnErrorStr))?("true").equals(dieOnErrorStr):false;
|
||||
|
||||
@@ -37,896 +36,19 @@ String useUrl = ElementParameterParser.getValue(node, "__USEURL__");
|
||||
boolean isUseUrl = "true".equals(useUrl);
|
||||
String urlpath = ElementParameterParser.getValue(node, "__URLPATH__");
|
||||
|
||||
if(!readByXPath){
|
||||
//--------------------start Read By JSON Path
|
||||
List<Map<String, String>> mapping = (List<Map<String,String>>)ElementParameterParser.getObjectValueXML(node, "__MAPPING__");
|
||||
List< ? extends IConnection> conns = NodeUtil.getOutgoingConnections(node, IConnectionCategory.DATA);
|
||||
String firstConnName = "";
|
||||
List<IMetadataTable> metadatas = node.getMetadataList();
|
||||
%>
|
||||
class JSONUtil_<%=cid%>{
|
||||
public int getData(String query,javax.script.Invocable invocableEngine,java.util.List<org.json.simple.JSONArray> jsonResultList,int recordMaxSize){
|
||||
try{
|
||||
//only 2 types: String/Boolean
|
||||
String resultObj = invocableEngine.invokeFunction("jsonPath",query).toString();
|
||||
if(!"false".equals(resultObj)){
|
||||
org.json.simple.JSONArray resultArray= (org.json.simple.JSONArray)org.json.simple.JSONValue.parse(resultObj);
|
||||
jsonResultList.add(resultArray);
|
||||
if(recordMaxSize != -1 && recordMaxSize != resultArray.size()){
|
||||
//just give an error, don't stop
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.warn("<%=cid%> - The Json resource datas maybe have some problems, please make sure the data structure with the same fields.");
|
||||
<%}%>
|
||||
System.err.println("The Json resource datas maybe have some problems, please make sure the data structure with the same fields.");
|
||||
}
|
||||
recordMaxSize = Math.max(recordMaxSize, resultArray.size());
|
||||
}else{
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.warn("<%=cid%> - Can't find any data with JSONPath " + query);
|
||||
<%}%>
|
||||
System.err.println("Can't find any data with JSONPath " + query);
|
||||
//add null to take a place in List(buffer)
|
||||
jsonResultList.add(null);
|
||||
}
|
||||
}catch(java.lang.Exception e){
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.error("<%=cid%> - " + e.getMessage());
|
||||
<%}%>
|
||||
e.printStackTrace();
|
||||
}
|
||||
return recordMaxSize;
|
||||
}
|
||||
String readBy = ElementParameterParser.getValue(node, "__READ_BY__");
|
||||
|
||||
<%
|
||||
if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
IMetadataTable metadata = metadatas.get(0);
|
||||
if (metadata!=null) {
|
||||
List<IMetadataColumn> columns=metadata.getListColumns();
|
||||
if (conns!=null) {
|
||||
if (conns.size()>0) {
|
||||
IConnection conn = conns.get(0);
|
||||
firstConnName = conn.getName();
|
||||
for (int i=0;i<mapping.size();i++) {
|
||||
if(i % 100 == 0){
|
||||
if("XPATH".equals(readBy)){
|
||||
%>
|
||||
void setRowValue_<%=(i/100) %>(<%=firstConnName %>Struct <%=firstConnName %>, java.util.List<org.json.simple.JSONArray> JSONResultList_<%=cid%>, int nbResultArray_<%=cid%>) throws java.io.UnsupportedEncodingException{
|
||||
<%@ include file="./xpath.javajet"%>
|
||||
<%
|
||||
}
|
||||
}else if("JSONPATH".equals(readBy)) {
|
||||
%>
|
||||
<%@ include file="./jsonpath.javajet"%>
|
||||
<%
|
||||
for(IMetadataColumn column:columns) {
|
||||
if (mapping.get(i).get("SCHEMA_COLUMN")!=null) {
|
||||
if (column.getLabel().compareTo(mapping.get(i).get("SCHEMA_COLUMN"))==0) {
|
||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getTalendType(), column.isNullable());
|
||||
JavaType javaType = JavaTypesManager.getJavaTypeFromId(column.getTalendType());
|
||||
String patternValue = column.getPattern() == null || column.getPattern().trim().length() == 0 ? null : column.getPattern();
|
||||
%>
|
||||
if(JSONResultList_<%=cid%>.get(<%=i%>) != null && nbResultArray_<%=cid%><JSONResultList_<%=cid%>.get(<%=i%>).size() && JSONResultList_<%=cid%>.get(<%=i%>).get(nbResultArray_<%=cid%>)!=null){
|
||||
<%
|
||||
if (javaType == JavaTypesManager.STRING || javaType == JavaTypesManager.OBJECT) {
|
||||
%>
|
||||
<%=firstConnName %>.<%=column.getLabel() %> = JSONResultList_<%=cid%>.get(<%=i%>).get(nbResultArray_<%=cid%>).toString();
|
||||
<%
|
||||
} else if(javaType == JavaTypesManager.DATE) {
|
||||
%>
|
||||
<%=firstConnName %>.<%=column.getLabel() %> = ParserUtils.parseTo_Date(JSONResultList_<%=cid%>.get(<%=i%>).get(nbResultArray_<%=cid%>).toString(), <%= patternValue %>);
|
||||
<%
|
||||
}else if(advancedSeparator && JavaTypesManager.isNumberType(javaType)) {
|
||||
%>
|
||||
<%=firstConnName %>.<%=column.getLabel() %> = ParserUtils.parseTo_<%= typeToGenerate %>(ParserUtils.parseTo_Number(JSONResultList_<%=cid%>.get(<%=i%>).get(nbResultArray_<%=cid%>).toString(), <%= thousandsSeparator %>, <%= decimalSeparator %>));
|
||||
<%
|
||||
} else if(javaType == JavaTypesManager.BYTE_ARRAY) {
|
||||
%>
|
||||
<%=firstConnName %>.<%=column.getLabel() %> = JSONResultList_<%=cid%>.get(<%=i%>).get(nbResultArray_<%=cid%>).toString().getBytes(<%=encoding %>);
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
<%=firstConnName %>.<%=column.getLabel() %> = ParserUtils.parseTo_<%= typeToGenerate %>(JSONResultList_<%=cid%>.get(<%=i%>).get(nbResultArray_<%=cid%>).toString());
|
||||
<%
|
||||
}
|
||||
%>
|
||||
}else{
|
||||
|
||||
<%
|
||||
String defaultValue = JavaTypesManager.getDefaultValueFromJavaType(typeToGenerate, column.getDefault());
|
||||
if(defaultValue == null) {
|
||||
%>
|
||||
throw new RuntimeException("Value is empty for column : '<%= column.getLabel() %>' in '<%=firstConnName%>' connection, value is invalid or this column should be nullable or have a default value.");
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
<%=firstConnName %>.<%=column.getLabel() %> = <%=defaultValue%>;
|
||||
|
||||
<%
|
||||
}
|
||||
%>
|
||||
}
|
||||
<%
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if((i + 1) % 100 == 0){
|
||||
%>
|
||||
}
|
||||
<%
|
||||
}
|
||||
} // for (int i=0)
|
||||
if(mapping.size() > 0 && mapping.size() % 100 > 0){
|
||||
%>
|
||||
}
|
||||
<%
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
%>
|
||||
}
|
||||
int nb_line_<%=cid%> = 0;
|
||||
java.lang.Object jsonText_<%=cid%> = null;
|
||||
JSONUtil_<%=cid%> jsonUtil_<%=cid%>=new JSONUtil_<%=cid%>();
|
||||
java.util.List<org.json.simple.JSONArray> JSONResultList_<%=cid%> = new java.util.ArrayList<org.json.simple.JSONArray>();
|
||||
int recordMaxSize_<%=cid%> = -1;
|
||||
|
||||
//init js json engine
|
||||
javax.script.ScriptEngineManager scriptEngineMgr_<%=cid%> = new javax.script.ScriptEngineManager();
|
||||
javax.script.ScriptEngine jsEngine_<%=cid%> = scriptEngineMgr_<%=cid%>.getEngineByName("JavaScript");
|
||||
if (jsEngine_<%=cid%> == null) {
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.warn("<%=cid%> - No script engine found for JavaScript");
|
||||
<%}%>
|
||||
System.err.println("No script engine found for JavaScript");
|
||||
} else {
|
||||
java.net.URL jsonjsUrl_<%=cid%> = com.jsonpath.test.ReadJar.class.getResource("json.js");
|
||||
if(jsonjsUrl_<%=cid%>!=null) {
|
||||
jsEngine_<%=cid%>.eval(new java.io.BufferedReader(new java.io.InputStreamReader(jsonjsUrl_<%=cid%>.openStream())));
|
||||
}
|
||||
|
||||
java.net.URL jsonpathjsUrl_<%=cid%> = com.jsonpath.test.ReadJar.class.getResource("jsonpath.js");
|
||||
if(jsonpathjsUrl_<%=cid%>!=null) {
|
||||
jsEngine_<%=cid%>.eval(new java.io.BufferedReader(new java.io.InputStreamReader(jsonpathjsUrl_<%=cid%>.openStream())));
|
||||
}
|
||||
|
||||
<%if(!isUseUrl){//read from a file%>
|
||||
java.io.BufferedReader fr_<%=cid%> = null;
|
||||
<%}else{ //read from internet%>
|
||||
java.io.InputStreamReader fr_<%=cid %> = null;
|
||||
<%}%>
|
||||
try{
|
||||
<%if(!isUseUrl){//read from a file%>
|
||||
fr_<%=cid%> = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(<%=filename %>),<%=encoding %>));
|
||||
<%}else{ //read from internet%>
|
||||
java.net.URL url_<%=cid %> = new java.net.URL(<%=urlpath %>);
|
||||
java.net.URLConnection urlConn_<%=cid %> = url_<%=cid %>.openConnection();
|
||||
fr_<%=cid %> = new java.io.InputStreamReader(urlConn_<%=cid %>.getInputStream(),<%=encoding %>);
|
||||
<%}%>
|
||||
jsonText_<%=cid%> = org.json.simple.JSONValue.parse(fr_<%=cid%>);
|
||||
if(jsonText_<%=cid%> == null) {
|
||||
throw new RuntimeException("fail to parse the json file : " + <%if(!isUseUrl) {%> <%=filename %> <%} else {%> <%=urlpath %> <%}%>);
|
||||
}
|
||||
} catch(java.lang.Exception e_<%=cid%>) {
|
||||
<%if (dieOnError) {%>
|
||||
throw e_<%=cid%>;
|
||||
<%} else {%>
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.error("<%=cid%> - " + e_<%=cid%>.getMessage());
|
||||
<%}%>
|
||||
System.err.println(e_<%=cid%>.getMessage());
|
||||
<%}%>
|
||||
} finally {
|
||||
if(fr_<%=cid%> != null ) {
|
||||
fr_<%=cid%>.close();
|
||||
}
|
||||
}
|
||||
|
||||
if(jsonText_<%=cid%>!=null) {
|
||||
jsEngine_<%=cid%>.eval("var obj="+jsonText_<%=cid%>.toString());
|
||||
|
||||
javax.script.Invocable invocableEngine_<%=cid%> = (javax.script.Invocable)jsEngine_<%=cid%>;
|
||||
|
||||
<%
|
||||
for(Map<String,String> path:mapping){
|
||||
String column = path.get("SCHEMA_COLUMN");
|
||||
String query = path.get("QUERY");
|
||||
%>
|
||||
|
||||
recordMaxSize_<%=cid%>=jsonUtil_<%=cid%>.getData(<%=query%>,invocableEngine_<%=cid%>,JSONResultList_<%=cid%>,recordMaxSize_<%=cid%>);
|
||||
|
||||
<%@ include file="./jsonpath_javascript_api.javajet"%>
|
||||
<%
|
||||
}
|
||||
%>
|
||||
}
|
||||
}
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> - Retrieving records from data.");
|
||||
<%}%>
|
||||
for(int nbResultArray_<%=cid%> = 0; nbResultArray_<%=cid%> < recordMaxSize_<%=cid%>; nbResultArray_<%=cid%>++){
|
||||
|
||||
nb_line_<%=cid%>++;
|
||||
<%
|
||||
if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
IMetadataTable metadata = metadatas.get(0);
|
||||
if (metadata!=null) {
|
||||
List<IMetadataColumn> columns=metadata.getListColumns();
|
||||
if (conns!=null) {
|
||||
String rejectConnName = "";
|
||||
List<? extends IConnection> rejectConns = node.getOutgoingConnections("REJECT");
|
||||
if(rejectConns != null && rejectConns.size() > 0) {
|
||||
IConnection rejectConn = rejectConns.get(0);
|
||||
rejectConnName = rejectConn.getName();
|
||||
}
|
||||
List<IMetadataColumn> rejectColumnList = null;
|
||||
IMetadataTable metadataTable = node.getMetadataFromConnector("REJECT");
|
||||
if(metadataTable != null) {
|
||||
rejectColumnList = metadataTable.getListColumns();
|
||||
}
|
||||
for (int i=0;i<conns.size();i++) {
|
||||
IConnection connTemp = conns.get(i);
|
||||
if (connTemp.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
||||
%>
|
||||
<%=connTemp.getName() %> = null;
|
||||
<%
|
||||
}
|
||||
}
|
||||
if (conns.size()>0) { // conns.size()>0
|
||||
IConnection conn = conns.get(0);
|
||||
firstConnName = conn.getName();
|
||||
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) { // add for DATA
|
||||
%>
|
||||
boolean whetherReject_<%=cid %> = false;
|
||||
<%=firstConnName %> = new <%=conn.getName() %>Struct();
|
||||
try{
|
||||
<%
|
||||
for (int i=0;i<mapping.size();i++) {
|
||||
if(i % 100 == 0){
|
||||
%>
|
||||
jsonUtil_<%=cid%>.setRowValue_<%= (i/100) %>(<%=firstConnName %>,JSONResultList_<%=cid%>,nbResultArray_<%=cid%>);
|
||||
<%
|
||||
}
|
||||
}// for
|
||||
if(rejectConnName.equals(firstConnName)) {
|
||||
%>
|
||||
<%=firstConnName %> = null;
|
||||
<%
|
||||
}
|
||||
%>
|
||||
} catch (java.lang.Exception e) {
|
||||
whetherReject_<%=cid%> = true;
|
||||
<%
|
||||
if (dieOnError) {
|
||||
%>
|
||||
throw(e);
|
||||
<%
|
||||
} else {
|
||||
if(isLog4jEnabled){%>
|
||||
log.error("<%=cid%> - " + e.getMessage());
|
||||
<%}
|
||||
if(!("").equals(rejectConnName)&&!rejectConnName.equals(firstConnName)&&rejectColumnList != null && rejectColumnList.size() > 0) {
|
||||
%>
|
||||
<%=rejectConnName %> = new <%=rejectConnName %>Struct();
|
||||
<%
|
||||
for(IMetadataColumn column : metadata.getListColumns()) {
|
||||
%>
|
||||
<%=rejectConnName%>.<%=column.getLabel()%> = <%=firstConnName%>.<%=column.getLabel()%>;
|
||||
<%
|
||||
}
|
||||
%>
|
||||
<%=rejectConnName%>.errorMessage = e.getMessage() + " - Line: " + tos_count_<%=node.getUniqueName() %>;
|
||||
<%=firstConnName %> = null;
|
||||
<%
|
||||
} else if(("").equals(rejectConnName)){
|
||||
%>
|
||||
System.err.println(e.getMessage());
|
||||
<%=firstConnName %> = null;
|
||||
<%
|
||||
}else if(rejectConnName.equals(firstConnName)){
|
||||
%>
|
||||
<%=rejectConnName%>.errorMessage = e.getMessage() + " - Line: " + tos_count_<%=node.getUniqueName() %>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
%>
|
||||
}
|
||||
<%
|
||||
}// end for DATA
|
||||
}// conns.size()>0
|
||||
} // if(conns!=null)
|
||||
} // if (metadata!=null)
|
||||
} // if ((metadatas!=null)&&(metadatas.size()>0))
|
||||
%>
|
||||
<%
|
||||
//---------------------end Read By JSON Path
|
||||
|
||||
}else{
|
||||
|
||||
//---------------------start Read By XPath
|
||||
List<Map<String, String>> mapping = (List<Map<String,String>>)ElementParameterParser.getObjectValueXML(node, "__MAPPINGXPATH__");
|
||||
String loopQuery = ElementParameterParser.getValue(node, "__LOOP_QUERY__");
|
||||
|
||||
String checkDateStr = ElementParameterParser.getValue(node,"__CHECK_DATE__");
|
||||
boolean checkDate = (checkDateStr!=null&&!("").equals(checkDateStr))?("true").equals(checkDateStr):false;
|
||||
%>
|
||||
|
||||
int nb_line_<%=cid%> = 0;
|
||||
|
||||
class XML_API_<%=cid%>{
|
||||
public boolean isDefNull(org.dom4j.Node node) throws javax.xml.transform.TransformerException {
|
||||
if (node != null && node instanceof org.dom4j.Element) {
|
||||
org.dom4j.Attribute attri = ((org.dom4j.Element)node).attribute("nil");
|
||||
if(attri != null && ("true").equals(attri.getText())){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isMissing(org.dom4j.Node node) throws javax.xml.transform.TransformerException {
|
||||
return node == null ? true : false;
|
||||
}
|
||||
|
||||
public boolean isEmpty(org.dom4j.Node node) throws javax.xml.transform.TransformerException {
|
||||
if (node != null) {
|
||||
return node.getText().length() == 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class ConvertJSONString_<%=cid%>{
|
||||
final static int Brace = 0 ; // {
|
||||
final static int Bracket = 1; // [
|
||||
private int barceType = -1 ;
|
||||
private String originalJsonString = "" ;
|
||||
private String originalLoopString = "" ;
|
||||
private String jsonString4XML = null;
|
||||
private String loopString4XML = null;
|
||||
private String additionRoot = null;
|
||||
|
||||
public void barceType(){
|
||||
|
||||
for (int c = 0; c < originalJsonString.length(); ++c) {
|
||||
if (originalJsonString.charAt(c) == '{') {
|
||||
barceType = Brace;
|
||||
break;
|
||||
} else if (originalJsonString.charAt(c) == '[') {
|
||||
barceType = Bracket;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setJsonString (String originalJsonString) {
|
||||
this.originalJsonString = originalJsonString;
|
||||
}
|
||||
|
||||
public void setLoopString (String originalLoopString) {
|
||||
this.originalLoopString = originalLoopString;
|
||||
}
|
||||
|
||||
public String getJsonString4XML(){
|
||||
return jsonString4XML;
|
||||
}
|
||||
|
||||
public String getLoopString4XML(){
|
||||
if(loopString4XML.length()>1 && loopString4XML.endsWith("/")){
|
||||
loopString4XML = loopString4XML.substring(0, loopString4XML.length()-1);
|
||||
}
|
||||
return loopString4XML;
|
||||
}
|
||||
|
||||
public void setAdditionRoot (String additionRoot) {
|
||||
this.additionRoot = additionRoot;
|
||||
}
|
||||
|
||||
public String getAdditionRoot (){
|
||||
return additionRoot;
|
||||
}
|
||||
|
||||
|
||||
public void generate() {
|
||||
barceType();
|
||||
jsonString4XML = originalJsonString;
|
||||
loopString4XML = originalLoopString;
|
||||
if (Brace == barceType) {
|
||||
if (isNeedAddRoot(originalJsonString)) {
|
||||
jsonString4XML = "{ \"root\": " + originalJsonString + " }";
|
||||
loopString4XML = "root" + originalLoopString;
|
||||
setAdditionRoot("root");
|
||||
}
|
||||
} else if (Bracket == barceType) {
|
||||
jsonString4XML = "{ \"root\" : { \"object\": "
|
||||
+ originalJsonString + " } }";
|
||||
loopString4XML = "root/object" + originalLoopString;
|
||||
setAdditionRoot("object");
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isNeedAddRoot(String originalJsonString) {
|
||||
boolean isNeedAddRoot = false;
|
||||
net.sf.json.JSONObject jso = net.sf.json.JSONObject
|
||||
.fromObject(originalJsonString);
|
||||
String jsonKey = "";
|
||||
Object firstObject = null;
|
||||
if (jso.names().size() == 1) {
|
||||
jsonKey = jso.names().get(0).toString();
|
||||
firstObject = jso.get(jsonKey);
|
||||
}
|
||||
if (jso.size() > 1
|
||||
|| (firstObject != null
|
||||
&& firstObject instanceof net.sf.json.JSONArray && ((net.sf.json.JSONArray) firstObject)
|
||||
.size() > 1)) {
|
||||
isNeedAddRoot = true;
|
||||
}
|
||||
return isNeedAddRoot;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ConvertJSONString_<%=cid%> cjs_<%=cid %> = new ConvertJSONString_<%=cid%>();
|
||||
|
||||
de.odysseus.staxon.json.JsonXMLConfig config_<%=cid %> = new de.odysseus.staxon.json.JsonXMLConfigBuilder().multiplePI(false).build();
|
||||
de.odysseus.staxon.json.JsonXMLInputFactory jsonXMLInputFactory_<%=cid %> = new de.odysseus.staxon.json.JsonXMLInputFactory(config_<%=cid %>);
|
||||
javax.xml.stream.XMLOutputFactory xmlOutputFactory_<%=cid %> = javax.xml.stream.XMLOutputFactory.newInstance();
|
||||
boolean isGetWholeJson_<%=cid %> = false;
|
||||
|
||||
<%
|
||||
String nodeChecked = null;
|
||||
boolean hasNodeCheck = false;
|
||||
for(int i = 0 ;i<mapping.size();i++){
|
||||
nodeChecked = mapping.get(i).get("NODECHECK");
|
||||
if("true".equals(nodeChecked)){
|
||||
hasNodeCheck = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(hasNodeCheck){
|
||||
%>
|
||||
class OriginalJSONString_<%=cid%> {
|
||||
|
||||
String originalJSONString = null;
|
||||
java.io.ByteArrayInputStream bais = null;
|
||||
java.io.ByteArrayOutputStream baos = null;
|
||||
de.odysseus.staxon.json.JsonXMLConfig config = null;
|
||||
de.odysseus.staxon.json.JsonXMLOutputFactory jxof = null;
|
||||
|
||||
public String getOriginalJSONString(String xmlString,String additionRoot,String encoding,boolean isGetWholeJson) throws Exception {
|
||||
|
||||
try {
|
||||
bais = new ByteArrayInputStream(xmlString.getBytes(encoding));
|
||||
baos = new java.io.ByteArrayOutputStream();
|
||||
config = new de.odysseus.staxon.json.JsonXMLConfigBuilder().multiplePI(false).autoArray(true).build();
|
||||
jxof = new de.odysseus.staxon.json.JsonXMLOutputFactory(config);
|
||||
javax.xml.stream.XMLEventReader xmlEventReader = javax.xml.stream.XMLInputFactory.newInstance().createXMLEventReader(bais);
|
||||
javax.xml.stream.XMLEventWriter xmLEventWriter = jxof.createXMLEventWriter(baos,encoding);
|
||||
xmLEventWriter.add(xmlEventReader);
|
||||
xmlEventReader.close();
|
||||
xmLEventWriter.close();
|
||||
net.sf.json.JSONObject json = net.sf.json.JSONObject.fromObject(baos.toString());
|
||||
net.sf.json.JSONObject originalJsonObject = null;
|
||||
if (!json.isNullObject()) {
|
||||
if (additionRoot == null) {
|
||||
originalJSONString = json.toString();
|
||||
} else {
|
||||
if (isGetWholeJson) {
|
||||
originalJsonObject = json.getJSONObject(additionRoot);
|
||||
if (!originalJsonObject.isNullObject()) {
|
||||
originalJSONString = originalJsonObject.toString();
|
||||
}
|
||||
}else {
|
||||
originalJSONString = json.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
baos.close();
|
||||
if(bais!=null){
|
||||
bais.close();
|
||||
}
|
||||
}
|
||||
|
||||
return originalJSONString;
|
||||
}
|
||||
}
|
||||
|
||||
OriginalJSONString_<%=cid%> originalJSONString_<%=cid %> = new OriginalJSONString_<%=cid%>();
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
org.dom4j.io.SAXReader reader_<%=cid%> = new org.dom4j.io.SAXReader();
|
||||
Object filename_<%=cid %> = null;
|
||||
try {
|
||||
filename_<%=cid %> = <%=filename %>;
|
||||
} catch(java.lang.Exception e_<%=cid%>) {
|
||||
<%
|
||||
if (dieOnError) {
|
||||
%>
|
||||
throw(e_<%=cid%>);
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.error("<%=cid%> - " + e_<%=cid%>.getMessage());
|
||||
<%}%>
|
||||
System.err.println(e_<%=cid%>.getMessage());
|
||||
<%
|
||||
}
|
||||
%>
|
||||
}
|
||||
|
||||
boolean isValidFile_<%=cid %> = true;
|
||||
org.dom4j.Document doc_<%=cid%> = null;
|
||||
java.io.BufferedReader br_<%=cid %> = null;
|
||||
java.lang.StringBuilder jsonBuffer_<%=cid%> = new java.lang.StringBuilder("");
|
||||
String jsonStr_<%=cid %> = null;
|
||||
String xmlStr_<%=cid%> = "";
|
||||
String line_<%=cid%> = null;
|
||||
|
||||
String loopQuery_<%=cid %> = <%=loopQuery %> ;
|
||||
java.io.ByteArrayInputStream bais_<%=cid %> = null;
|
||||
java.io.ByteArrayOutputStream baos_<%=cid %> = new java.io.ByteArrayOutputStream();
|
||||
|
||||
try{
|
||||
if(filename_<%=cid %> instanceof java.io.InputStream){
|
||||
br_<%=cid %> = new java.io.BufferedReader(new java.io.InputStreamReader((java.io.InputStream)filename_<%=cid %>,<%=encoding%>));
|
||||
}else{
|
||||
<%
|
||||
if(!isUseUrl){//read from a file
|
||||
%>
|
||||
br_<%=cid%> = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(String.valueOf(filename_<%=cid %>)), <%=encoding %>));
|
||||
<%
|
||||
}else{ //read from internet
|
||||
%>
|
||||
java.net.URL url_<%=cid %> = new java.net.URL(<%=urlpath %>);
|
||||
java.net.URLConnection urlConn_<%=cid %> = url_<%=cid %>.openConnection();
|
||||
br_<%=cid %> = new java.io.BufferedReader( new java.io.InputStreamReader(urlConn_<%=cid %>.getInputStream(),<%=encoding %>));
|
||||
<%
|
||||
}
|
||||
%>
|
||||
}
|
||||
while ((line_<%=cid%> = br_<%=cid %>.readLine()) != null){
|
||||
jsonBuffer_<%=cid%>.append(line_<%=cid%>);
|
||||
}
|
||||
jsonStr_<%=cid %> = jsonBuffer_<%=cid%>.toString();
|
||||
cjs_<%=cid %>.setJsonString(jsonStr_<%=cid %>);
|
||||
cjs_<%=cid %>.setLoopString(loopQuery_<%=cid %>);
|
||||
cjs_<%=cid %>.generate();
|
||||
jsonStr_<%=cid %> = cjs_<%=cid %>.getJsonString4XML();
|
||||
loopQuery_<%=cid %> = cjs_<%=cid %>.getLoopString4XML();
|
||||
bais_<%=cid %> = new ByteArrayInputStream(jsonStr_<%=cid%>.getBytes(<%=encoding%>));
|
||||
javax.xml.stream.XMLEventReader xmlEventReader_<%=cid %> = jsonXMLInputFactory_<%=cid %>.createXMLEventReader(bais_<%=cid %>);
|
||||
javax.xml.stream.XMLEventWriter xmLEventWriter_<%=cid %> = xmlOutputFactory_<%=cid %>.createXMLEventWriter(baos_<%=cid %>,<%=encoding%>);
|
||||
xmLEventWriter_<%=cid %>.add(xmlEventReader_<%=cid %>);
|
||||
//convert json string to xml
|
||||
xmlStr_<%=cid%> = baos_<%=cid %>.toString();
|
||||
xmLEventWriter_<%=cid %>.close();
|
||||
xmlEventReader_<%=cid %>.close();
|
||||
doc_<%=cid%>= reader_<%=cid%>.read(new java.io.StringReader(xmlStr_<%=cid%>));
|
||||
}catch(java.lang.Exception e_<%=cid%>){
|
||||
<%
|
||||
if (dieOnError) {
|
||||
%>
|
||||
throw(e_<%=cid%>);
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.error("<%=cid%> - " + e_<%=cid%>.getMessage());
|
||||
<%}%>
|
||||
System.err.println( e_<%=cid%>.getMessage());
|
||||
isValidFile_<%=cid %> = false;
|
||||
<%
|
||||
}
|
||||
%>
|
||||
} finally {
|
||||
if(br_<%=cid%>!=null) {
|
||||
br_<%=cid %>.close();
|
||||
}
|
||||
baos_<%=cid %>.close();
|
||||
if(bais_<%=cid %>!=null){
|
||||
bais_<%=cid %>.close();
|
||||
}
|
||||
}
|
||||
if(isValidFile_<%=cid %>){
|
||||
|
||||
org.dom4j.XPath x_<%=cid%> = doc_<%=cid%>.createXPath(loopQuery_<%=cid %>);
|
||||
java.util.HashMap<String,String> xmlNameSpaceMap_<%=cid%> = new java.util.HashMap<String, String>();
|
||||
x_<%=cid%> = doc_<%=cid%>.createXPath(loopQuery_<%=cid %>);
|
||||
x_<%=cid%>.setNamespaceURIs(xmlNameSpaceMap_<%=cid%>);
|
||||
java.util.List<org.dom4j.tree.AbstractNode> nodeList_<%=cid%> = (java.util.List<org.dom4j.tree.AbstractNode>)x_<%=cid%>.selectNodes(doc_<%=cid%>);
|
||||
XML_API_<%=cid%> xml_api_<%=cid%> = new XML_API_<%=cid%>();
|
||||
String str_<%=cid %> = "";
|
||||
org.dom4j.Node node_<%=cid%> = null;
|
||||
|
||||
//init all mapping xpaths
|
||||
<%
|
||||
for (int i=0;i<mapping.size();i++) {
|
||||
String query = mapping.get(i).get("QUERY");
|
||||
%>
|
||||
org.dom4j.XPath xTmp<%=i%>_<%=cid%> = org.dom4j.DocumentHelper.createXPath(<%=query%>);
|
||||
xTmp<%=i%>_<%=cid%>.setNamespaceURIs(xmlNameSpaceMap_<%=cid%>);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
for (org.dom4j.tree.AbstractNode temp_<%=cid%>: nodeList_<%=cid%>) {
|
||||
nb_line_<%=cid%>++;
|
||||
<%
|
||||
List< ? extends IConnection> conns = node.getOutgoingSortedConnections();
|
||||
String firstConnName = "";
|
||||
List<IMetadataTable> metadatas = node.getMetadataList();
|
||||
if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
IMetadataTable metadata = metadatas.get(0);
|
||||
if (metadata!=null) {
|
||||
List<IMetadataColumn> columns=metadata.getListColumns();
|
||||
if (conns!=null) {
|
||||
String rejectConnName = "";
|
||||
List<? extends IConnection> rejectConns = node.getOutgoingConnections("REJECT");
|
||||
if(rejectConns != null && rejectConns.size() > 0) {
|
||||
IConnection rejectConn = rejectConns.get(0);
|
||||
rejectConnName = rejectConn.getName();
|
||||
}
|
||||
List<IMetadataColumn> rejectColumnList = null;
|
||||
IMetadataTable metadataTable = node.getMetadataFromConnector("REJECT");
|
||||
if(metadataTable != null) {
|
||||
rejectColumnList = metadataTable.getListColumns();
|
||||
}
|
||||
for (int i=0;i<conns.size();i++) {
|
||||
IConnection connTemp = conns.get(i);
|
||||
if (connTemp.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
||||
%>
|
||||
<%=connTemp.getName() %> = null;
|
||||
<%
|
||||
}
|
||||
}
|
||||
if (conns.size()>0) { // S_if_a_0_0
|
||||
IConnection conn = conns.get(0);
|
||||
firstConnName = conn.getName();
|
||||
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) { // add for reject
|
||||
%>
|
||||
boolean whetherReject_<%=cid %> = false;
|
||||
<%=firstConnName %> = new <%=conn.getName() %>Struct();
|
||||
try{
|
||||
<%
|
||||
for (int i=0;i<mapping.size();i++) { // S_for_a_1_0
|
||||
String query = mapping.get(i).get("QUERY");
|
||||
String nodeCheck = mapping.get(i).get("NODECHECK");
|
||||
if("true".equals(nodeCheck) && query!=null){
|
||||
if((".").equals(query.substring(1,query.length()-1)) && ("/").equals(loopQuery.substring(1,loopQuery.length()-1))){
|
||||
%>
|
||||
isGetWholeJson_<%=cid %> = true;
|
||||
<%
|
||||
}
|
||||
}
|
||||
%>
|
||||
Object obj<%=i%>_<%=cid%> = xTmp<%=i%>_<%=cid%>.evaluate(temp_<%=cid%>);
|
||||
if(obj<%=i%>_<%=cid%> == null) {
|
||||
node_<%=cid%> = null;
|
||||
<%
|
||||
if(("true").equals(nodeCheck)){
|
||||
%>
|
||||
str_<%=cid %> = null;
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
str_<%=cid %> = "";
|
||||
<%
|
||||
}
|
||||
%>
|
||||
} else if(obj<%=i%>_<%=cid%> instanceof org.dom4j.Node) {
|
||||
node_<%=cid%> = (org.dom4j.Node)obj<%=i%>_<%=cid%>;
|
||||
<%
|
||||
if(("true").equals(nodeCheck)){
|
||||
%>
|
||||
str_<%=cid %> = originalJSONString_<%=cid %>.getOriginalJSONString(node_<%=cid %>.asXML(),cjs_<%=cid %>.getAdditionRoot(),<%=encoding%>,isGetWholeJson_<%=cid %>);
|
||||
isGetWholeJson_<%=cid%> = false;
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
str_<%=cid %> = org.jaxen.function.StringFunction.evaluate(node_<%=cid %>,org.jaxen.dom4j.DocumentNavigator.getInstance());
|
||||
<%
|
||||
}
|
||||
%>
|
||||
} else if(obj<%=i%>_<%=cid%> instanceof String || obj<%=i%>_<%=cid%> instanceof Number){
|
||||
node_<%=cid%> = temp_<%=cid%>;
|
||||
str_<%=cid %> = String.valueOf(obj<%=i%>_<%=cid%>);
|
||||
} else if(obj<%=i%>_<%=cid%> instanceof java.util.List){
|
||||
java.util.List<org.dom4j.Node> nodes_<%=cid%> = (java.util.List<org.dom4j.Node>)obj<%=i%>_<%=cid%>;
|
||||
node_<%=cid%> = nodes_<%=cid%>.size()>0 ? nodes_<%=cid%>.get(0) : null;
|
||||
<%
|
||||
if(("true").equals(nodeCheck)){
|
||||
%>
|
||||
if(node_<%=cid %>==null){
|
||||
str_<%=cid %> = null;
|
||||
}else{
|
||||
str_<%=cid %> = originalJSONString_<%=cid %>.getOriginalJSONString(node_<%=cid %>.asXML(),cjs_<%=cid %>.getAdditionRoot(),<%=encoding%>,isGetWholeJson_<%=cid %>);
|
||||
}
|
||||
isGetWholeJson_<%=cid%> = false;
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
str_<%=cid %> = node_<%=cid %>==null?"":org.jaxen.function.StringFunction.evaluate(node_<%=cid %>,org.jaxen.dom4j.DocumentNavigator.getInstance());
|
||||
<%
|
||||
}
|
||||
%>
|
||||
}
|
||||
<%
|
||||
for(IMetadataColumn column:columns) { // S_for_0_1
|
||||
if (mapping.get(i).get("SCHEMA_COLUMN")!=null) { // S_if_0_2
|
||||
if (column.getLabel().compareTo(mapping.get(i).get("SCHEMA_COLUMN"))==0) { // S_if_0_3
|
||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getTalendType(), column.isNullable());
|
||||
JavaType javaType = JavaTypesManager.getJavaTypeFromId(column.getTalendType());
|
||||
String patternValue = column.getPattern() == null || column.getPattern().trim().length() == 0 ? null : column.getPattern();
|
||||
|
||||
boolean isNotSetDefault = false;
|
||||
String defaultValue=column.getDefault();
|
||||
if(defaultValue!=null){
|
||||
isNotSetDefault = defaultValue.length()==0;
|
||||
}else{
|
||||
isNotSetDefault=true;
|
||||
}
|
||||
|
||||
if("true".equals(nodeCheck)){
|
||||
%>
|
||||
<%=conn.getName() %>.<%=column.getLabel() %> = str_<%=cid %>;
|
||||
<%
|
||||
continue;
|
||||
}
|
||||
if(javaType == JavaTypesManager.STRING){
|
||||
if(column.isNullable()){
|
||||
%>
|
||||
if(xml_api_<%=cid%>.isDefNull(node_<%=cid%>)){
|
||||
<%=conn.getName() %>.<%=column.getLabel() %> =null;
|
||||
}else if(xml_api_<%=cid%>.isEmpty(node_<%=cid%>)){
|
||||
<%=conn.getName() %>.<%=column.getLabel() %> ="";
|
||||
}else if(xml_api_<%=cid%>.isMissing(node_<%=cid%> )){
|
||||
<%=conn.getName() %>.<%=column.getLabel() %> =<%=isNotSetDefault?null:column.getDefault()%>;
|
||||
}else{
|
||||
<%
|
||||
}else{ // column.isNullable()
|
||||
%>
|
||||
if(xml_api_<%=cid%>.isEmpty(node_<%=cid%>)){
|
||||
<%=conn.getName() %>.<%=column.getLabel() %> ="";
|
||||
}else if(xml_api_<%=cid%>.isMissing(node_<%=cid%> )){
|
||||
<%=conn.getName() %>.<%=column.getLabel() %> =<%=isNotSetDefault?JavaTypesManager.getDefaultValueFromJavaType(typeToGenerate):column.getDefault()%>;
|
||||
}else{
|
||||
<%
|
||||
}
|
||||
}else{ // other type
|
||||
if(column.isNullable()){
|
||||
%>
|
||||
if(xml_api_<%=cid%>.isDefNull(node_<%=cid%>)){
|
||||
<%=conn.getName() %>.<%=column.getLabel() %> =null;
|
||||
}else if(xml_api_<%=cid%>.isEmpty(node_<%=cid%>) || xml_api_<%=cid%>.isMissing(node_<%=cid%>)){
|
||||
<%=conn.getName() %>.<%=column.getLabel() %>=<%=isNotSetDefault?null:column.getDefault()%>;
|
||||
}else{
|
||||
<%
|
||||
}else{ // column.isNullable()
|
||||
%>
|
||||
if(xml_api_<%=cid%>.isMissing(node_<%=cid%>) || xml_api_<%=cid%>.isEmpty(node_<%=cid%>)){
|
||||
<%=conn.getName() %>.<%=column.getLabel() %> =<%=isNotSetDefault?JavaTypesManager.getDefaultValueFromJavaType(typeToGenerate):column.getDefault()%>;
|
||||
}else{
|
||||
<%
|
||||
}
|
||||
}
|
||||
|
||||
if (javaType == JavaTypesManager.STRING || javaType == JavaTypesManager.OBJECT) {
|
||||
%>
|
||||
<%=conn.getName() %>.<%=column.getLabel() %> = str_<%=cid %>;
|
||||
<%
|
||||
} else if (javaType == JavaTypesManager.DATE) {
|
||||
if(checkDate) {
|
||||
%>
|
||||
<%=conn.getName() %>.<%=column.getLabel() %> = ParserUtils.parseTo_Date(str_<%=cid %>, <%= patternValue %>,false);
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
<%=conn.getName() %>.<%=column.getLabel() %> = ParserUtils.parseTo_Date(str_<%=cid %>, <%= patternValue %>);
|
||||
<%
|
||||
}
|
||||
} else if(javaType == JavaTypesManager.BYTE_ARRAY){
|
||||
%>
|
||||
<%=conn.getName() %>.<%=column.getLabel() %> = str_<%=cid %>.getBytes(<%=encoding %>);
|
||||
<%
|
||||
} else if(advancedSeparator && JavaTypesManager.isNumberType(javaType)) {
|
||||
%>
|
||||
<%=conn.getName() %>.<%=column.getLabel() %> = ParserUtils.parseTo_<%= typeToGenerate %>(ParserUtils.parseTo_Number(str_<%=cid %>, <%= thousandsSeparator %>, <%= decimalSeparator %>));
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
<%=conn.getName() %>.<%=column.getLabel() %> = ParserUtils.parseTo_<%= typeToGenerate %>(str_<%=cid %>);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
}
|
||||
<%
|
||||
} //S_if_1_2
|
||||
} // S_if_1_1
|
||||
} // S_for_1_0
|
||||
} // S_for_a_0_1
|
||||
%>
|
||||
<%
|
||||
if(rejectConnName.equals(firstConnName)) {
|
||||
%>
|
||||
<%=firstConnName %> = null;
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
} catch (java.lang.Exception e_<%=cid%>) {
|
||||
whetherReject_<%=cid%> = true;
|
||||
<%
|
||||
if (dieOnError) {
|
||||
%>
|
||||
throw(e_<%=cid%>);
|
||||
<%
|
||||
} else {
|
||||
if(isLog4jEnabled){%>
|
||||
log.error("<%=cid%> - " + e_<%=cid%>.getMessage());
|
||||
<%}
|
||||
if(!("").equals(rejectConnName)&&!rejectConnName.equals(firstConnName)&&rejectColumnList != null && rejectColumnList.size() > 0) {
|
||||
|
||||
%>
|
||||
<%=rejectConnName %> = new <%=rejectConnName %>Struct();
|
||||
<%
|
||||
for(IMetadataColumn column : metadata.getListColumns()) {
|
||||
%>
|
||||
<%=rejectConnName%>.<%=column.getLabel()%> = <%=firstConnName%>.<%=column.getLabel()%>;
|
||||
<%
|
||||
}
|
||||
%>
|
||||
<%=rejectConnName%>.errorMessage = e_<%=cid%>.getMessage() + " - Line: " + tos_count_<%=node.getUniqueName() %>;
|
||||
<%=firstConnName %> = null;
|
||||
<%
|
||||
} else if(("").equals(rejectConnName)){
|
||||
%>
|
||||
System.err.println(e_<%=cid%>.getMessage());
|
||||
<%=firstConnName %> = null;
|
||||
<%
|
||||
} else if(rejectConnName.equals(firstConnName)){
|
||||
%>
|
||||
<%=rejectConnName%>.errorMessage = e_<%=cid%>.getMessage() + " - Line: " + tos_count_<%=node.getUniqueName() %>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
%>
|
||||
}
|
||||
<%
|
||||
} //if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA))
|
||||
} // S_if_a_1_1
|
||||
|
||||
if (conns.size()>0) {
|
||||
boolean isFirstEnter = true;
|
||||
for (int i=0;i<conns.size();i++) {
|
||||
IConnection tmpconn = conns.get(i);
|
||||
if ((tmpconn.getName().compareTo(firstConnName)!=0)&&(tmpconn.getName().compareTo(rejectConnName)!=0)&&(tmpconn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA))) {
|
||||
%>
|
||||
<%
|
||||
if(isFirstEnter) {%>if(!whetherReject_<%=cid%>) { <% isFirstEnter = false; }
|
||||
%>
|
||||
if(<%=tmpconn.getName() %> == null){
|
||||
<%=tmpconn.getName() %> = new <%=tmpconn.getName() %>Struct();
|
||||
}
|
||||
<%
|
||||
for (IMetadataColumn column: metadata.getListColumns()) {
|
||||
%>
|
||||
<%=tmpconn.getName() %>.<%=column.getLabel() %> = <%=firstConnName %>.<%=column.getLabel() %>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
}
|
||||
%>
|
||||
<% if(!isFirstEnter) {%> } <%
|
||||
}
|
||||
}
|
||||
|
||||
}// if(conn!=null)
|
||||
|
||||
}// if (metadata!=null)
|
||||
}//if ((metadatas!=null)&&(metadatas.size()>0))
|
||||
//--------------------end Read By XPath
|
||||
}
|
||||
%>
|
||||
|
||||
@@ -9,16 +9,10 @@
|
||||
<%
|
||||
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
|
||||
INode node = (INode)codeGenArgument.getArgument();
|
||||
boolean isLog4jEnabled = ("true").equals(ElementParameterParser.getValue(node.getProcess(), "__LOG4J_ACTIVATE__"));
|
||||
boolean readByXPath = "true".equals(ElementParameterParser.getValue(node, "__READBYXPATH__"));
|
||||
String readBy = ElementParameterParser.getValue(node, "__READ_BY__");
|
||||
|
||||
String cid = node.getUniqueName();
|
||||
%>
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.debug("<%=cid%> - Retrieving the record " + nb_line_<%=cid %> + ".");
|
||||
<%}%>
|
||||
<%
|
||||
if(readByXPath){
|
||||
if("XPATH".equals(readBy)){
|
||||
%>
|
||||
}
|
||||
<%
|
||||
|
||||
@@ -35,9 +35,16 @@
|
||||
<DEFAULT />
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="READBYXPATH" FIELD="CHECK" NUM_ROW="25"
|
||||
REQUIRED="true">
|
||||
<DEFAULT>true</DEFAULT>
|
||||
<PARAMETER
|
||||
NAME="READ_BY"
|
||||
FIELD="CLOSED_LIST"
|
||||
NUM_ROW="25"
|
||||
>
|
||||
<ITEMS DEFAULT="XPATH">
|
||||
<ITEM NAME="XPATH" VALUE="XPATH" />
|
||||
<ITEM NAME="JSONPATH" VALUE="JSONPATH" />
|
||||
<ITEM NAME="JSONPATH_WITHOUTPUT_LOOP" VALUE="JSONPATH_WITHOUTPUT_LOOP" />
|
||||
</ITEMS>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="USEURL" FIELD="CHECK" NUM_ROW="30"
|
||||
@@ -56,19 +63,31 @@
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="LOOP_QUERY" FIELD="TEXT" NUM_ROW="45"
|
||||
SHOW_IF="READBYXPATH=='true'" REPOSITORY_VALUE="XPATH_QUERY">
|
||||
SHOW_IF="READ_BY=='XPATH'" REPOSITORY_VALUE="XPATH_QUERY">
|
||||
<DEFAULT>"/bills/bill/line"</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="JSON_LOOP_QUERY" FIELD="TEXT" NUM_ROW="45"
|
||||
SHOW_IF="READ_BY=='JSONPATH'">
|
||||
<DEFAULT>"/bills/bill/line[*]"</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="MAPPING" FIELD="TABLE" REQUIRED="true"
|
||||
SHOW_IF="READBYXPATH=='false'" NUM_ROW="50" NB_LINES="5">
|
||||
SHOW_IF="READ_BY=='JSONPATH_WITHOUTPUT_LOOP'" NUM_ROW="50" NB_LINES="5">
|
||||
<ITEMS BASED_ON_SCHEMA="true">
|
||||
<ITEM NAME="QUERY" REPOSITORY_ITEM="JSON_QUERY" />
|
||||
</ITEMS>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="MAPPING_JSONPATH" FIELD="TABLE" REQUIRED="true"
|
||||
SHOW_IF="READ_BY=='JSONPATH'" NUM_ROW="50" NB_LINES="5">
|
||||
<ITEMS BASED_ON_SCHEMA="true">
|
||||
<ITEM NAME="QUERY" />
|
||||
</ITEMS>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="MAPPINGXPATH" FIELD="TABLE" REQUIRED="true"
|
||||
NUM_ROW="55" NB_LINES="5" SHOW_IF="READBYXPATH=='true'" REPOSITORY_VALUE="JSON_MAPPING">
|
||||
NUM_ROW="55" NB_LINES="5" SHOW_IF="READ_BY=='XPATH'" REPOSITORY_VALUE="JSON_MAPPING">
|
||||
<ITEMS BASED_ON_SCHEMA="true">
|
||||
<ITEM NAME="QUERY" REPOSITORY_ITEM="XML_QUERY" />
|
||||
<ITEM NAME="NODECHECK" FIELD="CHECK" VALUE="false" />
|
||||
@@ -106,7 +125,7 @@
|
||||
<DEFAULT>"."</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="CHECK_DATE" FIELD="CHECK" NUM_ROW="20" SHOW_IF="READBYXPATH=='true'">
|
||||
<PARAMETER NAME="CHECK_DATE" FIELD="CHECK" NUM_ROW="20" SHOW_IF="READ_BY=='XPATH'">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
@@ -118,26 +137,36 @@
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<!-- json path by javascript api -->
|
||||
<IMPORT NAME="json_simple" MODULE="json_simple-1.1.jar" UrlPath="platform:/plugin/org.talend.libraries.jackson/lib/json_simple-1.1.jar"
|
||||
REQUIRED_IF="(READBYXPATH == 'false')" />
|
||||
<IMPORT NAME="jsonpath" MODULE="jsonpath.jar" UrlPath="platform:/plugin/org.talend.libraries.jackson/lib/jsonpath.jar" REQUIRED_IF="(READBYXPATH == 'false')" />
|
||||
REQUIRED_IF="(READ_BY == 'JSONPATH_WITHOUTPUT_LOOP')" />
|
||||
<IMPORT NAME="jsonpath" MODULE="jsonpath.jar" UrlPath="platform:/plugin/org.talend.libraries.jackson/lib/jsonpath.jar" REQUIRED_IF="(READ_BY == 'JSONPATH_WITHOUTPUT_LOOP')" />
|
||||
|
||||
<!-- xpath -->
|
||||
<IMPORT NAME="Java_DOM4J1.6" MODULE="dom4j-1.6.1.jar" UrlPath="platform:/plugin/org.talend.libraries.dom4j-jaxen/lib/dom4j-1.6.1.jar"
|
||||
REQUIRED_IF="(READBYXPATH == 'true')" />
|
||||
REQUIRED_IF="(READ_BY == 'XPATH')" />
|
||||
<IMPORT NAME="Java_JAXEN1.1" MODULE="jaxen-1.1.1.jar" UrlPath="platform:/plugin/org.talend.libraries.dom4j-jaxen/lib/jaxen-1.1.1.jar"
|
||||
REQUIRED_IF="(READBYXPATH == 'true')" />
|
||||
REQUIRED_IF="(READ_BY == 'XPATH')" />
|
||||
<IMPORT NAME="json-lib" MODULE="json-lib-2.4-jdk15.jar" UrlPath="platform:/plugin/org.talend.libraries.jackson/lib/json-lib-2.4-jdk15.jar"
|
||||
REQUIRED_IF="(READBYXPATH == 'true')" />
|
||||
REQUIRED_IF="(READ_BY == 'XPATH')" />
|
||||
<IMPORT NAME="commons_lang" MODULE="commons-lang-2.6.jar" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-lang-2.6.jar"
|
||||
REQUIRED_IF="(READBYXPATH == 'true')" />
|
||||
REQUIRED_IF="(READ_BY == 'XPATH')" />
|
||||
<IMPORT NAME="commons_logging" MODULE="commons-logging-1.1.1.jar" UrlPath="platform:/base/plugins/org.apache.commons.logging_1.1.1.v201101211721.jar"
|
||||
REQUIRED_IF="(READBYXPATH == 'true')" />
|
||||
<IMPORT NAME="ezmorph" MODULE="ezmorph-1.0.6.jar" UrlPath="platform:/plugin/org.talend.libraries.jackson/lib/ezmorph-1.0.6.jar" REQUIRED_IF="(READBYXPATH == 'true')" />
|
||||
<IMPORT NAME="xom" MODULE="xom-1.2.7.jar" REQUIRED_IF="(READBYXPATH == 'true')" />
|
||||
REQUIRED_IF="(READ_BY == 'XPATH')" />
|
||||
<IMPORT NAME="ezmorph" MODULE="ezmorph-1.0.6.jar" UrlPath="platform:/plugin/org.talend.libraries.jackson/lib/ezmorph-1.0.6.jar" REQUIRED_IF="(READ_BY == 'XPATH')" />
|
||||
<IMPORT NAME="xom" MODULE="xom-1.2.7.jar" REQUIRED_IF="(READ_BY == 'XPATH')" />
|
||||
<IMPORT NAME="commons_beanutils" MODULE="commons-beanutils-1.8.3.jar" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-beanutils-1.8.3.jar"
|
||||
REQUIRED_IF="(READBYXPATH == 'true')" />
|
||||
REQUIRED_IF="(READ_BY == 'XPATH')" />
|
||||
<IMPORT NAME="commons_collections" MODULE="commons-collections-3.2.1.jar" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-collections-3.2.1.jar"
|
||||
REQUIRED_IF="(READBYXPATH == 'true')" />
|
||||
<IMPORT NAME="staxon" MODULE="staxon-1.2.jar" REQUIRED_IF="(READBYXPATH == 'true')" />
|
||||
REQUIRED_IF="(READ_BY == 'XPATH')" />
|
||||
<IMPORT NAME="staxon" MODULE="staxon-1.2.jar" REQUIRED_IF="(READ_BY == 'XPATH')" />
|
||||
|
||||
<!-- json path -->
|
||||
<IMPORT NAME="json-path-1.2.0.jar" MODULE="json-path-1.2.0.jar" REQUIRED_IF="(READ_BY == 'JSONPATH')" />
|
||||
<IMPORT NAME="json-smart-2.1.0.jar" MODULE="json-smart-2.1.0.jar" REQUIRED_IF="(READ_BY == 'JSONPATH')" />
|
||||
<IMPORT NAME="asm-1.0.2.jar" MODULE="asm-1.0.2.jar" REQUIRED_IF="(READ_BY == 'JSONPATH')" />
|
||||
<IMPORT NAME="slf4j-api-1.7.5.jar" MODULE="slf4j-api-1.7.5.jar" UrlPath="platform:/plugin/org.talend.libraries.slf4j/lib/slf4j-api-1.7.5.jar" REQUIRED_IF="(READ_BY == 'JSONPATH')" />
|
||||
<IMPORT NAME="slf4j-log4j12-1.7.5.jar" MODULE="slf4j-log4j12-1.7.5.jar" UrlPath="platform:/plugin/org.talend.libraries.slf4j/lib/slf4j-log4j12-1.7.5.jar" REQUIRED_IF="(READ_BY == 'JSONPATH')" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
|
||||
@@ -14,8 +14,6 @@ THOUSANDS_SEPARATOR.NAME=Thousands separator
|
||||
USEURL.NAME=Use Url
|
||||
URLPATH.NAME=URL
|
||||
|
||||
|
||||
|
||||
LOOP_QUERY.NAME=Loop XPath query
|
||||
MAPPINGXPATH.ITEM.QUERY=XPath query
|
||||
MAPPINGXPATH.ITEM.NODECHECK=Get Nodes
|
||||
@@ -23,5 +21,14 @@ MAPPINGXPATH.NAME=Mapping
|
||||
REJECT.LINK=Reject
|
||||
REJECT.MENU=Reject
|
||||
DIE_ON_ERROR.NAME=Die on error
|
||||
READBYXPATH.NAME=Read By XPath
|
||||
CHECK_DATE.NAME=Validate date
|
||||
CHECK_DATE.NAME=Validate date
|
||||
|
||||
READ_BY.NAME=Read By
|
||||
READ_BY.ITEM.XPATH=Xpath
|
||||
READ_BY.ITEM.JSONPATH=JsonPath
|
||||
READ_BY.ITEM.JSONPATH_WITHOUTPUT_LOOP=JsonPath without loop
|
||||
|
||||
JSON_LOOP_QUERY.NAME=Loop Json query
|
||||
|
||||
MAPPING_JSONPATH.NAME=Mapping
|
||||
MAPPING_JSONPATH.ITEM.QUERY=Json query
|
||||
@@ -0,0 +1,590 @@
|
||||
<%@ jet
|
||||
%>
|
||||
<%
|
||||
List<Map<String, String>> mapping = (List<Map<String,String>>)ElementParameterParser.getObjectValueXML(node, "__MAPPINGXPATH__");
|
||||
String loopQuery = ElementParameterParser.getValue(node, "__LOOP_QUERY__");
|
||||
|
||||
String checkDateStr = ElementParameterParser.getValue(node,"__CHECK_DATE__");
|
||||
boolean checkDate = (checkDateStr!=null&&!("").equals(checkDateStr))?("true").equals(checkDateStr):false;
|
||||
%>
|
||||
|
||||
int nb_line_<%=cid%> = 0;
|
||||
|
||||
class XML_API_<%=cid%>{
|
||||
public boolean isDefNull(org.dom4j.Node node) throws javax.xml.transform.TransformerException {
|
||||
if (node != null && node instanceof org.dom4j.Element) {
|
||||
org.dom4j.Attribute attri = ((org.dom4j.Element)node).attribute("nil");
|
||||
if(attri != null && ("true").equals(attri.getText())){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isMissing(org.dom4j.Node node) throws javax.xml.transform.TransformerException {
|
||||
return node == null ? true : false;
|
||||
}
|
||||
|
||||
public boolean isEmpty(org.dom4j.Node node) throws javax.xml.transform.TransformerException {
|
||||
if (node != null) {
|
||||
return node.getText().length() == 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class ConvertJSONString_<%=cid%>{
|
||||
final static int Brace = 0 ; // {
|
||||
final static int Bracket = 1; // [
|
||||
private int barceType = -1 ;
|
||||
private String originalJsonString = "" ;
|
||||
private String originalLoopString = "" ;
|
||||
private String jsonString4XML = null;
|
||||
private String loopString4XML = null;
|
||||
private String additionRoot = null;
|
||||
|
||||
public void barceType(){
|
||||
|
||||
for (int c = 0; c < originalJsonString.length(); ++c) {
|
||||
if (originalJsonString.charAt(c) == '{') {
|
||||
barceType = Brace;
|
||||
break;
|
||||
} else if (originalJsonString.charAt(c) == '[') {
|
||||
barceType = Bracket;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setJsonString (String originalJsonString) {
|
||||
this.originalJsonString = originalJsonString;
|
||||
}
|
||||
|
||||
public void setLoopString (String originalLoopString) {
|
||||
this.originalLoopString = originalLoopString;
|
||||
}
|
||||
|
||||
public String getJsonString4XML(){
|
||||
return jsonString4XML;
|
||||
}
|
||||
|
||||
public String getLoopString4XML(){
|
||||
if(loopString4XML.length()>1 && loopString4XML.endsWith("/")){
|
||||
loopString4XML = loopString4XML.substring(0, loopString4XML.length()-1);
|
||||
}
|
||||
return loopString4XML;
|
||||
}
|
||||
|
||||
public void setAdditionRoot (String additionRoot) {
|
||||
this.additionRoot = additionRoot;
|
||||
}
|
||||
|
||||
public String getAdditionRoot (){
|
||||
return additionRoot;
|
||||
}
|
||||
|
||||
|
||||
public void generate() {
|
||||
barceType();
|
||||
jsonString4XML = originalJsonString;
|
||||
loopString4XML = originalLoopString;
|
||||
if (Brace == barceType) {
|
||||
if (isNeedAddRoot(originalJsonString)) {
|
||||
jsonString4XML = "{ \"root\": " + originalJsonString + " }";
|
||||
loopString4XML = "root" + originalLoopString;
|
||||
setAdditionRoot("root");
|
||||
}
|
||||
} else if (Bracket == barceType) {
|
||||
jsonString4XML = "{ \"root\" : { \"object\": "
|
||||
+ originalJsonString + " } }";
|
||||
loopString4XML = "root/object" + originalLoopString;
|
||||
setAdditionRoot("object");
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isNeedAddRoot(String originalJsonString) {
|
||||
boolean isNeedAddRoot = false;
|
||||
net.sf.json.JSONObject jso = net.sf.json.JSONObject
|
||||
.fromObject(originalJsonString);
|
||||
String jsonKey = "";
|
||||
Object firstObject = null;
|
||||
if (jso.names().size() == 1) {
|
||||
jsonKey = jso.names().get(0).toString();
|
||||
firstObject = jso.get(jsonKey);
|
||||
}
|
||||
if (jso.size() > 1
|
||||
|| (firstObject != null
|
||||
&& firstObject instanceof net.sf.json.JSONArray && ((net.sf.json.JSONArray) firstObject)
|
||||
.size() > 1)) {
|
||||
isNeedAddRoot = true;
|
||||
}
|
||||
return isNeedAddRoot;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ConvertJSONString_<%=cid%> cjs_<%=cid %> = new ConvertJSONString_<%=cid%>();
|
||||
|
||||
de.odysseus.staxon.json.JsonXMLConfig config_<%=cid %> = new de.odysseus.staxon.json.JsonXMLConfigBuilder().multiplePI(false).build();
|
||||
de.odysseus.staxon.json.JsonXMLInputFactory jsonXMLInputFactory_<%=cid %> = new de.odysseus.staxon.json.JsonXMLInputFactory(config_<%=cid %>);
|
||||
javax.xml.stream.XMLOutputFactory xmlOutputFactory_<%=cid %> = javax.xml.stream.XMLOutputFactory.newInstance();
|
||||
boolean isGetWholeJson_<%=cid %> = false;
|
||||
|
||||
<%
|
||||
String nodeChecked = null;
|
||||
boolean hasNodeCheck = false;
|
||||
for(int i = 0 ;i<mapping.size();i++){
|
||||
nodeChecked = mapping.get(i).get("NODECHECK");
|
||||
if("true".equals(nodeChecked)){
|
||||
hasNodeCheck = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(hasNodeCheck){
|
||||
%>
|
||||
class OriginalJSONString_<%=cid%> {
|
||||
|
||||
String originalJSONString = null;
|
||||
java.io.ByteArrayInputStream bais = null;
|
||||
java.io.ByteArrayOutputStream baos = null;
|
||||
de.odysseus.staxon.json.JsonXMLConfig config = null;
|
||||
de.odysseus.staxon.json.JsonXMLOutputFactory jxof = null;
|
||||
|
||||
public String getOriginalJSONString(String xmlString,String additionRoot,String encoding,boolean isGetWholeJson) throws Exception {
|
||||
|
||||
try {
|
||||
bais = new ByteArrayInputStream(xmlString.getBytes(encoding));
|
||||
baos = new java.io.ByteArrayOutputStream();
|
||||
config = new de.odysseus.staxon.json.JsonXMLConfigBuilder().multiplePI(false).autoArray(true).build();
|
||||
jxof = new de.odysseus.staxon.json.JsonXMLOutputFactory(config);
|
||||
javax.xml.stream.XMLEventReader xmlEventReader = javax.xml.stream.XMLInputFactory.newInstance().createXMLEventReader(bais);
|
||||
javax.xml.stream.XMLEventWriter xmLEventWriter = jxof.createXMLEventWriter(baos,encoding);
|
||||
xmLEventWriter.add(xmlEventReader);
|
||||
xmlEventReader.close();
|
||||
xmLEventWriter.close();
|
||||
net.sf.json.JSONObject json = net.sf.json.JSONObject.fromObject(baos.toString());
|
||||
net.sf.json.JSONObject originalJsonObject = null;
|
||||
if (!json.isNullObject()) {
|
||||
if (additionRoot == null) {
|
||||
originalJSONString = json.toString();
|
||||
} else {
|
||||
if (isGetWholeJson) {
|
||||
originalJsonObject = json.getJSONObject(additionRoot);
|
||||
if (!originalJsonObject.isNullObject()) {
|
||||
originalJSONString = originalJsonObject.toString();
|
||||
}
|
||||
}else {
|
||||
originalJSONString = json.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
baos.close();
|
||||
if(bais!=null){
|
||||
bais.close();
|
||||
}
|
||||
}
|
||||
|
||||
return originalJSONString;
|
||||
}
|
||||
}
|
||||
|
||||
OriginalJSONString_<%=cid%> originalJSONString_<%=cid %> = new OriginalJSONString_<%=cid%>();
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
org.dom4j.io.SAXReader reader_<%=cid%> = new org.dom4j.io.SAXReader();
|
||||
Object filename_<%=cid %> = null;
|
||||
try {
|
||||
filename_<%=cid %> = <%=filename %>;
|
||||
} catch(java.lang.Exception e_<%=cid%>) {
|
||||
<%
|
||||
if (dieOnError) {
|
||||
%>
|
||||
throw(e_<%=cid%>);
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.error("<%=cid%> - " + e_<%=cid%>.getMessage());
|
||||
<%}%>
|
||||
System.err.println(e_<%=cid%>.getMessage());
|
||||
<%
|
||||
}
|
||||
%>
|
||||
}
|
||||
|
||||
boolean isValidFile_<%=cid %> = true;
|
||||
org.dom4j.Document doc_<%=cid%> = null;
|
||||
java.io.BufferedReader br_<%=cid %> = null;
|
||||
java.lang.StringBuilder jsonBuffer_<%=cid%> = new java.lang.StringBuilder("");
|
||||
String jsonStr_<%=cid %> = null;
|
||||
String xmlStr_<%=cid%> = "";
|
||||
String line_<%=cid%> = null;
|
||||
|
||||
String loopQuery_<%=cid %> = <%=loopQuery %> ;
|
||||
java.io.ByteArrayInputStream bais_<%=cid %> = null;
|
||||
java.io.ByteArrayOutputStream baos_<%=cid %> = new java.io.ByteArrayOutputStream();
|
||||
|
||||
try{
|
||||
if(filename_<%=cid %> instanceof java.io.InputStream){
|
||||
br_<%=cid %> = new java.io.BufferedReader(new java.io.InputStreamReader((java.io.InputStream)filename_<%=cid %>,<%=encoding%>));
|
||||
}else{
|
||||
<%
|
||||
if(!isUseUrl){//read from a file
|
||||
%>
|
||||
br_<%=cid%> = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(String.valueOf(filename_<%=cid %>)), <%=encoding %>));
|
||||
<%
|
||||
}else{ //read from internet
|
||||
%>
|
||||
java.net.URL url_<%=cid %> = new java.net.URL(<%=urlpath %>);
|
||||
java.net.URLConnection urlConn_<%=cid %> = url_<%=cid %>.openConnection();
|
||||
br_<%=cid %> = new java.io.BufferedReader( new java.io.InputStreamReader(urlConn_<%=cid %>.getInputStream(),<%=encoding %>));
|
||||
<%
|
||||
}
|
||||
%>
|
||||
}
|
||||
while ((line_<%=cid%> = br_<%=cid %>.readLine()) != null){
|
||||
jsonBuffer_<%=cid%>.append(line_<%=cid%>);
|
||||
}
|
||||
jsonStr_<%=cid %> = jsonBuffer_<%=cid%>.toString();
|
||||
cjs_<%=cid %>.setJsonString(jsonStr_<%=cid %>);
|
||||
cjs_<%=cid %>.setLoopString(loopQuery_<%=cid %>);
|
||||
cjs_<%=cid %>.generate();
|
||||
jsonStr_<%=cid %> = cjs_<%=cid %>.getJsonString4XML();
|
||||
loopQuery_<%=cid %> = cjs_<%=cid %>.getLoopString4XML();
|
||||
bais_<%=cid %> = new ByteArrayInputStream(jsonStr_<%=cid%>.getBytes(<%=encoding%>));
|
||||
javax.xml.stream.XMLEventReader xmlEventReader_<%=cid %> = jsonXMLInputFactory_<%=cid %>.createXMLEventReader(bais_<%=cid %>);
|
||||
javax.xml.stream.XMLEventWriter xmLEventWriter_<%=cid %> = xmlOutputFactory_<%=cid %>.createXMLEventWriter(baos_<%=cid %>,<%=encoding%>);
|
||||
xmLEventWriter_<%=cid %>.add(xmlEventReader_<%=cid %>);
|
||||
//convert json string to xml
|
||||
xmlStr_<%=cid%> = baos_<%=cid %>.toString();
|
||||
xmLEventWriter_<%=cid %>.close();
|
||||
xmlEventReader_<%=cid %>.close();
|
||||
doc_<%=cid%>= reader_<%=cid%>.read(new java.io.StringReader(xmlStr_<%=cid%>));
|
||||
}catch(java.lang.Exception e_<%=cid%>){
|
||||
<%
|
||||
if (dieOnError) {
|
||||
%>
|
||||
throw(e_<%=cid%>);
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.error("<%=cid%> - " + e_<%=cid%>.getMessage());
|
||||
<%}%>
|
||||
System.err.println( e_<%=cid%>.getMessage());
|
||||
isValidFile_<%=cid %> = false;
|
||||
<%
|
||||
}
|
||||
%>
|
||||
} finally {
|
||||
if(br_<%=cid%>!=null) {
|
||||
br_<%=cid %>.close();
|
||||
}
|
||||
baos_<%=cid %>.close();
|
||||
if(bais_<%=cid %>!=null){
|
||||
bais_<%=cid %>.close();
|
||||
}
|
||||
}
|
||||
if(isValidFile_<%=cid %>){
|
||||
|
||||
org.dom4j.XPath x_<%=cid%> = doc_<%=cid%>.createXPath(loopQuery_<%=cid %>);
|
||||
java.util.HashMap<String,String> xmlNameSpaceMap_<%=cid%> = new java.util.HashMap<String, String>();
|
||||
x_<%=cid%> = doc_<%=cid%>.createXPath(loopQuery_<%=cid %>);
|
||||
x_<%=cid%>.setNamespaceURIs(xmlNameSpaceMap_<%=cid%>);
|
||||
java.util.List<org.dom4j.tree.AbstractNode> nodeList_<%=cid%> = (java.util.List<org.dom4j.tree.AbstractNode>)x_<%=cid%>.selectNodes(doc_<%=cid%>);
|
||||
XML_API_<%=cid%> xml_api_<%=cid%> = new XML_API_<%=cid%>();
|
||||
String str_<%=cid %> = "";
|
||||
org.dom4j.Node node_<%=cid%> = null;
|
||||
|
||||
//init all mapping xpaths
|
||||
<%
|
||||
for (int i=0;i<mapping.size();i++) {
|
||||
String query = mapping.get(i).get("QUERY");
|
||||
%>
|
||||
org.dom4j.XPath xTmp<%=i%>_<%=cid%> = org.dom4j.DocumentHelper.createXPath(<%=query%>);
|
||||
xTmp<%=i%>_<%=cid%>.setNamespaceURIs(xmlNameSpaceMap_<%=cid%>);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
for (org.dom4j.tree.AbstractNode temp_<%=cid%>: nodeList_<%=cid%>) {
|
||||
nb_line_<%=cid%>++;
|
||||
<%
|
||||
log4jFileUtil.debugRetriveData(node);
|
||||
|
||||
List< ? extends IConnection> conns = node.getOutgoingSortedConnections();
|
||||
String firstConnName = "";
|
||||
List<IMetadataTable> metadatas = node.getMetadataList();
|
||||
if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
IMetadataTable metadata = metadatas.get(0);
|
||||
if (metadata!=null) {
|
||||
List<IMetadataColumn> columns=metadata.getListColumns();
|
||||
if (conns!=null) {
|
||||
String rejectConnName = "";
|
||||
List<? extends IConnection> rejectConns = node.getOutgoingConnections("REJECT");
|
||||
if(rejectConns != null && rejectConns.size() > 0) {
|
||||
IConnection rejectConn = rejectConns.get(0);
|
||||
rejectConnName = rejectConn.getName();
|
||||
}
|
||||
List<IMetadataColumn> rejectColumnList = null;
|
||||
IMetadataTable metadataTable = node.getMetadataFromConnector("REJECT");
|
||||
if(metadataTable != null) {
|
||||
rejectColumnList = metadataTable.getListColumns();
|
||||
}
|
||||
for (int i=0;i<conns.size();i++) {
|
||||
IConnection connTemp = conns.get(i);
|
||||
if (connTemp.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
||||
%>
|
||||
<%=connTemp.getName() %> = null;
|
||||
<%
|
||||
}
|
||||
}
|
||||
if (conns.size()>0) { // S_if_a_0_0
|
||||
IConnection conn = conns.get(0);
|
||||
firstConnName = conn.getName();
|
||||
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) { // add for reject
|
||||
%>
|
||||
boolean whetherReject_<%=cid %> = false;
|
||||
<%=firstConnName %> = new <%=conn.getName() %>Struct();
|
||||
try{
|
||||
<%
|
||||
for (int i=0;i<mapping.size();i++) { // S_for_a_1_0
|
||||
String query = mapping.get(i).get("QUERY");
|
||||
String nodeCheck = mapping.get(i).get("NODECHECK");
|
||||
if("true".equals(nodeCheck) && query!=null){
|
||||
if((".").equals(query.substring(1,query.length()-1)) && ("/").equals(loopQuery.substring(1,loopQuery.length()-1))){
|
||||
%>
|
||||
isGetWholeJson_<%=cid %> = true;
|
||||
<%
|
||||
}
|
||||
}
|
||||
%>
|
||||
Object obj<%=i%>_<%=cid%> = xTmp<%=i%>_<%=cid%>.evaluate(temp_<%=cid%>);
|
||||
if(obj<%=i%>_<%=cid%> == null) {
|
||||
node_<%=cid%> = null;
|
||||
<%
|
||||
if(("true").equals(nodeCheck)){
|
||||
%>
|
||||
str_<%=cid %> = null;
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
str_<%=cid %> = "";
|
||||
<%
|
||||
}
|
||||
%>
|
||||
} else if(obj<%=i%>_<%=cid%> instanceof org.dom4j.Node) {
|
||||
node_<%=cid%> = (org.dom4j.Node)obj<%=i%>_<%=cid%>;
|
||||
<%
|
||||
if(("true").equals(nodeCheck)){
|
||||
%>
|
||||
str_<%=cid %> = originalJSONString_<%=cid %>.getOriginalJSONString(node_<%=cid %>.asXML(),cjs_<%=cid %>.getAdditionRoot(),<%=encoding%>,isGetWholeJson_<%=cid %>);
|
||||
isGetWholeJson_<%=cid%> = false;
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
str_<%=cid %> = org.jaxen.function.StringFunction.evaluate(node_<%=cid %>,org.jaxen.dom4j.DocumentNavigator.getInstance());
|
||||
<%
|
||||
}
|
||||
%>
|
||||
} else if(obj<%=i%>_<%=cid%> instanceof String || obj<%=i%>_<%=cid%> instanceof Number){
|
||||
node_<%=cid%> = temp_<%=cid%>;
|
||||
str_<%=cid %> = String.valueOf(obj<%=i%>_<%=cid%>);
|
||||
} else if(obj<%=i%>_<%=cid%> instanceof java.util.List){
|
||||
java.util.List<org.dom4j.Node> nodes_<%=cid%> = (java.util.List<org.dom4j.Node>)obj<%=i%>_<%=cid%>;
|
||||
node_<%=cid%> = nodes_<%=cid%>.size()>0 ? nodes_<%=cid%>.get(0) : null;
|
||||
<%
|
||||
if(("true").equals(nodeCheck)){
|
||||
%>
|
||||
if(node_<%=cid %>==null){
|
||||
str_<%=cid %> = null;
|
||||
}else{
|
||||
str_<%=cid %> = originalJSONString_<%=cid %>.getOriginalJSONString(node_<%=cid %>.asXML(),cjs_<%=cid %>.getAdditionRoot(),<%=encoding%>,isGetWholeJson_<%=cid %>);
|
||||
}
|
||||
isGetWholeJson_<%=cid%> = false;
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
str_<%=cid %> = node_<%=cid %>==null?"":org.jaxen.function.StringFunction.evaluate(node_<%=cid %>,org.jaxen.dom4j.DocumentNavigator.getInstance());
|
||||
<%
|
||||
}
|
||||
%>
|
||||
}
|
||||
<%
|
||||
for(IMetadataColumn column:columns) { // S_for_0_1
|
||||
if (mapping.get(i).get("SCHEMA_COLUMN")!=null) { // S_if_0_2
|
||||
if (column.getLabel().compareTo(mapping.get(i).get("SCHEMA_COLUMN"))==0) { // S_if_0_3
|
||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getTalendType(), column.isNullable());
|
||||
JavaType javaType = JavaTypesManager.getJavaTypeFromId(column.getTalendType());
|
||||
String patternValue = column.getPattern() == null || column.getPattern().trim().length() == 0 ? null : column.getPattern();
|
||||
|
||||
boolean isNotSetDefault = false;
|
||||
String defaultValue=column.getDefault();
|
||||
if(defaultValue!=null){
|
||||
isNotSetDefault = defaultValue.length()==0;
|
||||
}else{
|
||||
isNotSetDefault=true;
|
||||
}
|
||||
|
||||
if("true".equals(nodeCheck)){
|
||||
%>
|
||||
<%=conn.getName() %>.<%=column.getLabel() %> = str_<%=cid %>;
|
||||
<%
|
||||
continue;
|
||||
}
|
||||
if(javaType == JavaTypesManager.STRING){
|
||||
if(column.isNullable()){
|
||||
%>
|
||||
if(xml_api_<%=cid%>.isDefNull(node_<%=cid%>)){
|
||||
<%=conn.getName() %>.<%=column.getLabel() %> =null;
|
||||
}else if(xml_api_<%=cid%>.isEmpty(node_<%=cid%>)){
|
||||
<%=conn.getName() %>.<%=column.getLabel() %> ="";
|
||||
}else if(xml_api_<%=cid%>.isMissing(node_<%=cid%> )){
|
||||
<%=conn.getName() %>.<%=column.getLabel() %> =<%=isNotSetDefault?null:column.getDefault()%>;
|
||||
}else{
|
||||
<%
|
||||
}else{ // column.isNullable()
|
||||
%>
|
||||
if(xml_api_<%=cid%>.isEmpty(node_<%=cid%>)){
|
||||
<%=conn.getName() %>.<%=column.getLabel() %> ="";
|
||||
}else if(xml_api_<%=cid%>.isMissing(node_<%=cid%> )){
|
||||
<%=conn.getName() %>.<%=column.getLabel() %> =<%=isNotSetDefault?JavaTypesManager.getDefaultValueFromJavaType(typeToGenerate):column.getDefault()%>;
|
||||
}else{
|
||||
<%
|
||||
}
|
||||
}else{ // other type
|
||||
if(column.isNullable()){
|
||||
%>
|
||||
if(xml_api_<%=cid%>.isDefNull(node_<%=cid%>)){
|
||||
<%=conn.getName() %>.<%=column.getLabel() %> =null;
|
||||
}else if(xml_api_<%=cid%>.isEmpty(node_<%=cid%>) || xml_api_<%=cid%>.isMissing(node_<%=cid%>)){
|
||||
<%=conn.getName() %>.<%=column.getLabel() %>=<%=isNotSetDefault?null:column.getDefault()%>;
|
||||
}else{
|
||||
<%
|
||||
}else{ // column.isNullable()
|
||||
%>
|
||||
if(xml_api_<%=cid%>.isMissing(node_<%=cid%>) || xml_api_<%=cid%>.isEmpty(node_<%=cid%>)){
|
||||
<%=conn.getName() %>.<%=column.getLabel() %> =<%=isNotSetDefault?JavaTypesManager.getDefaultValueFromJavaType(typeToGenerate):column.getDefault()%>;
|
||||
}else{
|
||||
<%
|
||||
}
|
||||
}
|
||||
|
||||
if (javaType == JavaTypesManager.STRING || javaType == JavaTypesManager.OBJECT) {
|
||||
%>
|
||||
<%=conn.getName() %>.<%=column.getLabel() %> = str_<%=cid %>;
|
||||
<%
|
||||
} else if (javaType == JavaTypesManager.DATE) {
|
||||
if(checkDate) {
|
||||
%>
|
||||
<%=conn.getName() %>.<%=column.getLabel() %> = ParserUtils.parseTo_Date(str_<%=cid %>, <%= patternValue %>,false);
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
<%=conn.getName() %>.<%=column.getLabel() %> = ParserUtils.parseTo_Date(str_<%=cid %>, <%= patternValue %>);
|
||||
<%
|
||||
}
|
||||
} else if(javaType == JavaTypesManager.BYTE_ARRAY){
|
||||
%>
|
||||
<%=conn.getName() %>.<%=column.getLabel() %> = str_<%=cid %>.getBytes(<%=encoding %>);
|
||||
<%
|
||||
} else if(advancedSeparator && JavaTypesManager.isNumberType(javaType)) {
|
||||
%>
|
||||
<%=conn.getName() %>.<%=column.getLabel() %> = ParserUtils.parseTo_<%= typeToGenerate %>(ParserUtils.parseTo_Number(str_<%=cid %>, <%= thousandsSeparator %>, <%= decimalSeparator %>));
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
<%=conn.getName() %>.<%=column.getLabel() %> = ParserUtils.parseTo_<%= typeToGenerate %>(str_<%=cid %>);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
}
|
||||
<%
|
||||
} //S_if_1_2
|
||||
} // S_if_1_1
|
||||
} // S_for_1_0
|
||||
} // S_for_a_0_1
|
||||
%>
|
||||
<%
|
||||
if(rejectConnName.equals(firstConnName)) {
|
||||
%>
|
||||
<%=firstConnName %> = null;
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
} catch (java.lang.Exception e_<%=cid%>) {
|
||||
whetherReject_<%=cid%> = true;
|
||||
<%
|
||||
if (dieOnError) {
|
||||
%>
|
||||
throw(e_<%=cid%>);
|
||||
<%
|
||||
} else {
|
||||
if(isLog4jEnabled){%>
|
||||
log.error("<%=cid%> - " + e_<%=cid%>.getMessage());
|
||||
<%}
|
||||
if(!("").equals(rejectConnName)&&!rejectConnName.equals(firstConnName)&&rejectColumnList != null && rejectColumnList.size() > 0) {
|
||||
|
||||
%>
|
||||
<%=rejectConnName %> = new <%=rejectConnName %>Struct();
|
||||
<%
|
||||
for(IMetadataColumn column : metadata.getListColumns()) {
|
||||
%>
|
||||
<%=rejectConnName%>.<%=column.getLabel()%> = <%=firstConnName%>.<%=column.getLabel()%>;
|
||||
<%
|
||||
}
|
||||
%>
|
||||
<%=rejectConnName%>.errorMessage = e_<%=cid%>.getMessage() + " - Line: " + tos_count_<%=node.getUniqueName() %>;
|
||||
<%=firstConnName %> = null;
|
||||
<%
|
||||
} else if(("").equals(rejectConnName)){
|
||||
%>
|
||||
System.err.println(e_<%=cid%>.getMessage());
|
||||
<%=firstConnName %> = null;
|
||||
<%
|
||||
} else if(rejectConnName.equals(firstConnName)){
|
||||
%>
|
||||
<%=rejectConnName%>.errorMessage = e_<%=cid%>.getMessage() + " - Line: " + tos_count_<%=node.getUniqueName() %>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
%>
|
||||
}
|
||||
<%
|
||||
} //if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA))
|
||||
} // S_if_a_1_1
|
||||
|
||||
if (conns.size()>0) {
|
||||
boolean isFirstEnter = true;
|
||||
for (int i=0;i<conns.size();i++) {
|
||||
IConnection tmpconn = conns.get(i);
|
||||
if ((tmpconn.getName().compareTo(firstConnName)!=0)&&(tmpconn.getName().compareTo(rejectConnName)!=0)&&(tmpconn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA))) {
|
||||
%>
|
||||
<%
|
||||
if(isFirstEnter) {%>if(!whetherReject_<%=cid%>) { <% isFirstEnter = false; }
|
||||
%>
|
||||
if(<%=tmpconn.getName() %> == null){
|
||||
<%=tmpconn.getName() %> = new <%=tmpconn.getName() %>Struct();
|
||||
}
|
||||
<%
|
||||
for (IMetadataColumn column: metadata.getListColumns()) {
|
||||
%>
|
||||
<%=tmpconn.getName() %>.<%=column.getLabel() %> = <%=firstConnName %>.<%=column.getLabel() %>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
}
|
||||
%>
|
||||
<% if(!isFirstEnter) {%> } <%
|
||||
}
|
||||
}
|
||||
|
||||
}// if(conn!=null)
|
||||
|
||||
}// if (metadata!=null)
|
||||
}//if ((metadatas!=null)&&(metadatas.size()>0))
|
||||
%>
|
||||
@@ -230,6 +230,9 @@
|
||||
path<%=cid%> =<%=directory%>;
|
||||
}
|
||||
path<%=cid%> = path<%=cid%> + attachfileName<%=cid%>;
|
||||
<% if(isLog4jEnabled){ %>
|
||||
log.info("<%= cid %> - Extracted attachment: '"+attachfileName<%=cid%>+"'.");
|
||||
<% } %>
|
||||
java.io.File attachFile = new java.io.File(path<%=cid%>);
|
||||
out<%=cid%> = new java.io.BufferedOutputStream(new java.io.FileOutputStream(attachFile));
|
||||
in<%=cid%> = new java.io.BufferedInputStream(mpart<%=cid%>.getInputStream());
|
||||
@@ -334,4 +337,4 @@
|
||||
fileInput<%=cid%>.close();
|
||||
}
|
||||
////////////////////////////
|
||||
if(hasData_<%=cid%>){
|
||||
if(hasData_<%=cid%>){
|
||||
|
||||
@@ -24,7 +24,7 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
if (metadata!=null) {
|
||||
// component id
|
||||
String cid = node.getUniqueName();
|
||||
boolean isLog4jEnabled = ("true").equals(ElementParameterParser.getValue(node.getProcess(), "__LOG4J_ACTIVATE__"));
|
||||
boolean isLog4jEnabled = ("true").equals(ElementParameterParser.getValue(node.getProcess(), "__LOG4J_ACTIVATE__")) && node.getComponent().isLog4JEnabled();
|
||||
String filename = ElementParameterParser.getValue(node,"__FILENAME__");
|
||||
String directory = ElementParameterParser.getValue(node,"__ATTACHMENT_PATH__");
|
||||
String mailType = ElementParameterParser.getValue(node,"__MAIL_TYPE__");
|
||||
|
||||
@@ -87,8 +87,8 @@
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="JavaMail" MODULE="mail.jar" REQUIRED_IF="(MAIL_TYPE == 'MIME')" />
|
||||
<IMPORT NAME="JAF" MODULE="activation.jar" REQUIRED_IF="(MAIL_TYPE == 'MIME')" />
|
||||
<IMPORT NAME="poi" MODULE="poi-3.10-FINAL-20140219_modified_talend.jar" UrlPath="platform:/plugin/org.talend.libraries.excel/lib/poi-3.10-FINAL-20140219_modified_talend.jar" REQUIRED_IF="(MAIL_TYPE == 'MSG')" />
|
||||
<IMPORT NAME="poi-scratchpad" MODULE="poi-scratchpad-3.10-FINAL-20140208.jar" UrlPath="platform:/plugin/org.talend.libraries.excel/lib/poi-scratchpad-3.10-FINAL-20140208.jar" REQUIRED_IF="(MAIL_TYPE == 'MSG')" />
|
||||
<IMPORT NAME="poi" MODULE="poi-3.11-20141221_modified_talend.jar" UrlPath="platform:/plugin/org.talend.libraries.excel/lib/poi-3.11-20141221_modified_talend.jar" REQUIRED_IF="(MAIL_TYPE == 'MSG')" />
|
||||
<IMPORT NAME="poi-scratchpad" MODULE="poi-scratchpad-3.11-20141221.jar" UrlPath="platform:/plugin/org.talend.libraries.excel/lib/poi-scratchpad-3.11-20141221.jar" REQUIRED_IF="(MAIL_TYPE == 'MSG')" />
|
||||
<IMPORT NAME="talendMsgMailUtil" MODULE="talendMsgMailUtil-1.0.0.jar" REQUIRED_IF="(MAIL_TYPE == 'MSG')" />
|
||||
<IMPORT NAME="log4j-1.2.17.jar" MODULE="log4j-1.2.17.jar" UrlPath="platform:/plugin/org.talend.libraries.apache/lib/log4j-1.2.17.jar" REQUIRED_IF="(MAIL_TYPE == 'MSG')" />
|
||||
</IMPORTS>
|
||||
|
||||
@@ -225,10 +225,10 @@
|
||||
<IMPORT NAME="dom4j" MODULE="dom4j-1.6.1.jar" UrlPath="platform:/plugin/org.talend.libraries.dom4j-jaxen/lib/dom4j-1.6.1.jar" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="geronimo-stax-api" MODULE="geronimo-stax-api_1.0_spec-1.0.1.jar" UrlPath="platform:/plugin/org.talend.libraries.apache.axis2/lib/geronimo-stax-api_1.0_spec-1.0.1.jar" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="log4j" MODULE="log4j-1.2.15.jar" UrlPath="platform:/base/plugins/org.apache.log4j_1.2.15.v201012070815.jar" REQUIRED_IF="(VERSION_2007 == 'true')" BundleID="" />
|
||||
<IMPORT NAME="poi" MODULE="poi-3.10-FINAL-20140219_modified_talend.jar" UrlPath="platform:/plugin/org.talend.libraries.excel/lib/poi-3.10-FINAL-20140219_modified_talend.jar" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="poi-ooxml" MODULE="poi-ooxml-3.10-FINAL-20140219_modified_talend.jar" UrlPath="platform:/plugin/org.talend.libraries.excel/lib/poi-ooxml-3.10-FINAL-20140219_modified_talend.jar" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="poi-ooxml-schemas" MODULE="poi-ooxml-schemas-3.10-FINAL-20140208.jar" UrlPath="platform:/plugin/org.talend.libraries.excel/lib/poi-ooxml-schemas-3.10-FINAL-20140208.jar" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="poi-scratchpad" MODULE="poi-scratchpad-3.10-FINAL-20140208.jar" UrlPath="platform:/plugin/org.talend.libraries.excel/lib/poi-scratchpad-3.10-FINAL-20140208.jar" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="poi" MODULE="poi-3.11-20141221_modified_talend.jar" UrlPath="platform:/plugin/org.talend.libraries.excel/lib/poi-3.11-20141221_modified_talend.jar" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="poi-ooxml" MODULE="poi-ooxml-3.11-20141221_modified_talend.jar" UrlPath="platform:/plugin/org.talend.libraries.excel/lib/poi-ooxml-3.11-20141221_modified_talend.jar" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="poi-ooxml-schemas" MODULE="poi-ooxml-schemas-3.11-20141221.jar" UrlPath="platform:/plugin/org.talend.libraries.excel/lib/poi-ooxml-schemas-3.11-20141221.jar" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="poi-scratchpad" MODULE="poi-scratchpad-3.11-20141221.jar" UrlPath="platform:/plugin/org.talend.libraries.excel/lib/poi-scratchpad-3.11-20141221.jar" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="xmlbeans" MODULE="xmlbeans-2.6.0.jar" UrlPath="platform:/plugin/org.talend.libraries.apache.xml/lib/xmlbeans-2.6.0.jar" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
@@ -107,41 +107,41 @@ com.google.api.client.http.HttpTransport httpTransport = new com.google.api.clie
|
||||
|
||||
com.google.api.services.drive.Drive.Files.List <%=cid%>_listRequest = <%=cid%>_client.files().list();
|
||||
String destFolderName_<%=cid %> = <%=dest_folderName%>;
|
||||
<%
|
||||
if (isFile) {
|
||||
%>
|
||||
<%
|
||||
if (isFile) {
|
||||
%>
|
||||
String fileName_<%=cid %> = <%=fileName%>;
|
||||
if(fileName_<%=cid %> == null || "".equals(fileName_<%=cid %>.trim()) || destFolderName_<%=cid %> == null || "".equals(destFolderName_<%=cid %>.trim()) )
|
||||
{
|
||||
throw new Exception("File/folder name can not be null");
|
||||
}
|
||||
<%=cid%>_listRequest.setQ("title = '" + <%=fileName%> + "' and mimeType != 'application/vnd.google-apps.folder'");
|
||||
<%} else {%>
|
||||
<%} else {%>
|
||||
String sourceFolder_<%=cid %> = <%=folderName%>;
|
||||
if(sourceFolder_<%=cid %> == null || "".equals(sourceFolder_<%=cid %>.trim()) || destFolderName_<%=cid %> == null || "".equals(destFolderName_<%=cid %>.trim()) )
|
||||
{
|
||||
throw new Exception("File/folder name can not be null");
|
||||
}
|
||||
<%=cid%>_listRequest.setQ("title = '" + sourceFolder_<%=cid %> + "' and mimeType = 'application/vnd.google-apps.folder'");
|
||||
<%}%>
|
||||
<%}%>
|
||||
com.google.api.services.drive.model.FileList <%=cid%>_files = <%=cid%>_listRequest.execute();
|
||||
if (<%=cid%>_files.getItems().size() > 1)
|
||||
{
|
||||
<%if (isFile) {
|
||||
%>
|
||||
<%if (isFile) {
|
||||
%>
|
||||
throw new Exception("More then one file found with name \"" + <%=fileName%> + "\" ");
|
||||
<%} else {%>
|
||||
<%} else {%>
|
||||
throw new Exception("More then one folder found with name \"" + <%=folderName%> + "\" ");
|
||||
<%}%>
|
||||
<%}%>
|
||||
}
|
||||
else if (<%=cid%>_files.getItems().isEmpty())
|
||||
{
|
||||
<%if (isFile) {
|
||||
%>
|
||||
<%if (isFile) {
|
||||
%>
|
||||
throw new Exception("No file found with name \"" + <%=fileName%> + "\" ");
|
||||
<%} else {%>
|
||||
<%} else {%>
|
||||
throw new Exception("No folder found with name \"" + <%=folderName%> + "\" ");
|
||||
<%}%>
|
||||
<%}%>
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -151,8 +151,11 @@ com.google.api.client.http.HttpTransport httpTransport = new com.google.api.clie
|
||||
com.google.api.services.drive.model.File resultFile = new com.google.api.services.drive.model.File();
|
||||
|
||||
<%=cid%>_listRequest = <%=cid%>_client.files().list();
|
||||
com.google.api.services.drive.model.FileList <%=cid%>_destFolders = null;
|
||||
String <%=cid%>_destFolderId = "root";
|
||||
<% if(!dest_folderName.equals("\"root\"")) { %>
|
||||
<%=cid%>_listRequest.setQ("title = '" + <%=dest_folderName%> + "' and mimeType = 'application/vnd.google-apps.folder'");
|
||||
com.google.api.services.drive.model.FileList <%=cid%>_destFolders = <%=cid%>_listRequest.execute();
|
||||
<%=cid%>_destFolders = <%=cid%>_listRequest.execute();
|
||||
if (<%=cid%>_destFolders.getItems().size() > 1)
|
||||
{
|
||||
throw new Exception("More then one folder found with name \"" + <%=dest_folderName%> + "\" ");
|
||||
@@ -163,7 +166,8 @@ com.google.api.client.http.HttpTransport httpTransport = new com.google.api.clie
|
||||
}
|
||||
else
|
||||
{
|
||||
String <%=cid%>_destFolderId = <%=cid%>_destFolders.getItems().get(0).getId();
|
||||
<%=cid%>_destFolderId = <%=cid%>_destFolders.getItems().get(0).getId();
|
||||
<% } %>
|
||||
<%
|
||||
if (isFile) {
|
||||
%>
|
||||
@@ -211,6 +215,8 @@ com.google.api.client.http.HttpTransport httpTransport = new com.google.api.clie
|
||||
<%}%>
|
||||
globalMap.put("<%=cid%>_SOURCE_FILEID", <%=cid%>_fileId);
|
||||
globalMap.put("<%=cid%>_DESTINATION_FILEID", resultFile.getId());
|
||||
<% if(!dest_folderName.equals("\"root\"")) { %>
|
||||
}
|
||||
<% } %>
|
||||
}
|
||||
|
||||
@@ -28,15 +28,15 @@ boolean useSSL = helper.getBoolParam("__USE_SSL__");
|
||||
String connection = ElementParameterParser.getValue(node,"__CONNECTION__");
|
||||
String connectionKey = "\"conn_" + connection+"\"";
|
||||
|
||||
List< ? extends IConnection> outputConnections = node.getOutgoingSortedConnections();
|
||||
|
||||
String dataOutputConnection = null;
|
||||
List<? extends IConnection> outputConnections = node.getOutgoingSortedConnections();
|
||||
|
||||
String dataOutputConnection = null;
|
||||
for(IConnection conn : outputConnections) {
|
||||
if(conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
||||
dataOutputConnection = conn.getName();
|
||||
break;
|
||||
} // if(conn) end
|
||||
} // for(conns) end
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
String newFolderName = ElementParameterParser.getValue(node, "__NEW_FOLDER_NAME__");
|
||||
@@ -94,38 +94,57 @@ String proxyPort = helper.getStringParam("__PROXY_PORT__");
|
||||
<%=cid%>_client = (com.google.api.services.drive.Drive)globalMap.get(<%=connectionKey%>);
|
||||
<%}%>
|
||||
String parentFolder_<%=cid %> = <%=folderName%>;
|
||||
if(parentFolder_<%=cid %> == null || "".equals(parentFolder_<%=cid %>.trim()) )
|
||||
if(parentFolder_<%=cid %> == null || "".equals(parentFolder_<%=cid %>.trim()))
|
||||
{
|
||||
throw new Exception("Parent Folder Name can not be null");
|
||||
}
|
||||
|
||||
com.google.api.services.drive.model.File <%=cid%>_createdFolder = new com.google.api.services.drive.model.File();
|
||||
com.google.api.services.drive.model.File <%=cid%>_resultFile = new com.google.api.services.drive.model.File();
|
||||
com.google.api.services.drive.model.File <%=cid%>_resultFile = null;
|
||||
com.google.api.services.drive.Drive.Files.List <%=cid%>_listRequest = <%=cid%>_client.files().list();
|
||||
String parentFolderId_<%= cid %> = "root";
|
||||
<% if (!folderName.equals("\"root\"")) { %>
|
||||
<%=cid%>_listRequest.setQ("title = '" + <%=folderName%> + "' and mimeType = 'application/vnd.google-apps.folder'");
|
||||
com.google.api.services.drive.model.FileList <%=cid%>_files = <%=cid%>_listRequest.execute();
|
||||
|
||||
if (<%=cid%>_files.getItems().size() > 1)
|
||||
{
|
||||
throw new Exception("More then one folder found with name \"" + <%=folderName%> + "\" ");
|
||||
}
|
||||
else if (<%=cid%>_files.getItems().isEmpty())
|
||||
{
|
||||
throw new Exception("No folder found with name \"" + <%=folderName%> + "\" ");
|
||||
System.out.println("No folder found with name \"" + <%=folderName%> + "\",the folder will be created in the default root folder.");
|
||||
<% /* Create the parent folder in the default root folder. */ %>
|
||||
com.google.api.services.drive.model.File newParentFolder_<%= cid %> = new com.google.api.services.drive.model.File();
|
||||
newParentFolder_<%= cid %>.setParents(new java.util.ArrayList<com.google.api.services.drive.model.ParentReference>());
|
||||
newParentFolder_<%= cid %>.setMimeType("application/vnd.google-apps.folder");
|
||||
newParentFolder_<%= cid %>.setTitle(<%= folderName %>);
|
||||
<%=cid%>_resultFile = <%=cid%>_client.files().insert(newParentFolder_<%= cid %>).execute();
|
||||
parentFolderId_<%= cid %> = <%=cid%>_resultFile.getId();
|
||||
}
|
||||
else
|
||||
{
|
||||
<%=cid%>_createdFolder.setParents(java.util.Arrays.asList(new com.google.api.services.drive.model.ParentReference().setId(<%=cid%>_files.getItems().get(0).getId())));
|
||||
|
||||
if(null == parentFolderId_<%= cid %>){
|
||||
parentFolderId_<%= cid %> = <%=cid%>_files.getItems().get(0).getId();
|
||||
}
|
||||
<% }%>
|
||||
|
||||
String subFolderId_<%= cid %> = null;
|
||||
String subFolderName_<%= cid %> = <%= newFolderName %>;
|
||||
if(null != subFolderName_<%= cid %> && !"".equals(subFolderName_<%= cid %>.trim())){
|
||||
<% /* Create a sub folder in the specified parent folder.*/ %>
|
||||
<%=cid%>_createdFolder.setParents(java.util.Arrays.asList(new com.google.api.services.drive.model.ParentReference().setId(parentFolderId_<%= cid %>)));
|
||||
<%=cid%>_createdFolder.setMimeType("application/vnd.google-apps.folder");
|
||||
<%=cid%>_createdFolder.setTitle(<%=newFolderName%>);
|
||||
|
||||
<%=cid%>_createdFolder.setTitle(subFolderName_<%= cid %>);
|
||||
|
||||
<%=cid%>_resultFile = <%=cid%>_client.files().insert(<%=cid%>_createdFolder).execute();
|
||||
<%
|
||||
if(dataOutputConnection != null) {
|
||||
%>
|
||||
<%=dataOutputConnection%>.parentFolderID = <%=cid%>_files.getItems().get(0).getId();
|
||||
<%=dataOutputConnection%>.newFolderID = <%=cid%>_resultFile.getId();
|
||||
<%}%>
|
||||
globalMap.put("<%=cid%>_PARENTFOLDERID", <%=cid%>_files.getItems().get(0).getId());
|
||||
globalMap.put("<%=cid%>_NEWFOLDERID", <%=cid%>_resultFile.getId());
|
||||
subFolderId_<%= cid %> = <%=cid%>_resultFile.getId();
|
||||
}
|
||||
|
||||
<%
|
||||
if(dataOutputConnection != null) {
|
||||
%>
|
||||
<%=dataOutputConnection%>.parentFolderID = parentFolderId_<%= cid %>;
|
||||
<%=dataOutputConnection%>.newFolderID = subFolderId_<%= cid %>;
|
||||
<%}%>
|
||||
globalMap.put("<%=cid%>_PARENTFOLDERID", parentFolderId_<%= cid %>);
|
||||
globalMap.put("<%=cid%>_NEWFOLDERID", subFolderId_<%= cid %>);
|
||||
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
org.talend.core.model.process.IConnection
|
||||
org.talend.designer.codegen.config.CodeGeneratorArgument
|
||||
java.util.List
|
||||
|
||||
org.talend.core.model.process.EConnectionType
|
||||
org.talend.core.model.process.IDataConnection
|
||||
"
|
||||
%>
|
||||
|
||||
@@ -14,35 +17,39 @@
|
||||
|
||||
List<IConnection> connections = (List<IConnection>) node.getIncomingConnections();
|
||||
boolean includeParallelComps = false;
|
||||
List<? extends INode> listPartitions= node.getProcess().getNodesOfType("tPartitioner");
|
||||
if (listPartitions!=null && listPartitions.size() > 0 ) {
|
||||
includeParallelComps = true;
|
||||
}
|
||||
if (connections != null && connections.size() > 0) {
|
||||
for (IConnection connection : connections) {
|
||||
String connectionName = connection.getName();
|
||||
|
||||
INode validTarget = ((IDataConnection) connection).getLinkNodeForHash();
|
||||
INode partitionNode = null;
|
||||
if(validTarget != null) {
|
||||
partitionNode = validTarget.getDesignSubjobStartNode();
|
||||
if ("tCollector".equals(partitionNode.getComponent().getName())) {
|
||||
includeParallelComps = true;
|
||||
partitionNode = partitionNode.getIncomingConnections(EConnectionType.STARTS).get(0).getSource();
|
||||
}
|
||||
}
|
||||
if (includeParallelComps && partitionNode!=null) {
|
||||
%>
|
||||
synchronized (this) {
|
||||
if (globalMap.get("tHash_<%=connectionName%>") == null) {
|
||||
java.util.Map<<%=connectionName%>Struct, <%=connectionName%>Struct> tHash_<%=connectionName%> = null;
|
||||
boolean isMultiThreaded_<%=cid%> = false;
|
||||
if (!(globalMap.get("MULTI_THREADED_JOB_<%=partitionNode.getUniqueName()%>_"+jobName) == null || !((Boolean)globalMap.get("MULTI_THREADED_JOB_<%=partitionNode.getUniqueName()%>_"+jobName)))) {
|
||||
tHash_<%=connectionName%> = new java.util.concurrent.ConcurrentHashMap<<%=connectionName%>Struct,<%=connectionName%>Struct>();
|
||||
isMultiThreaded_<%=cid%> = true;
|
||||
} else {
|
||||
tHash_<%=connectionName%> = new java.util.LinkedHashMap<<%=connectionName%>Struct, <%=connectionName%>Struct>();
|
||||
}
|
||||
globalMap.put("tHash_<%=connectionName%>", tHash_<%=connectionName%>);
|
||||
|
||||
if (includeParallelComps) {
|
||||
%>
|
||||
synchronized (this) {
|
||||
if (globalMap.get("tHash_<%=connectionName%>") == null) {
|
||||
java.util.Map<<%=connectionName%>Struct, <%=connectionName%>Struct> tHash_<%=connectionName%> = null;
|
||||
boolean isMultiThreaded_<%=cid%> = false;
|
||||
if (globalMap.get("MULTI_THREADED_JOB_"+jobName) == null || !((Boolean)globalMap.get("MULTI_THREADED_JOB_"+jobName))) {
|
||||
tHash_<%=connectionName%> = new java.util.concurrent.ConcurrentHashMap<<%=connectionName%>Struct,<%=connectionName%>Struct>();
|
||||
isMultiThreaded_<%=cid%> = true;
|
||||
} else {
|
||||
tHash_<%=connectionName%> = new java.util.LinkedHashMap<<%=connectionName%>Struct, <%=connectionName%>Struct>();
|
||||
}
|
||||
globalMap.put("tHash_<%=connectionName%>", tHash_<%=connectionName%>);
|
||||
|
||||
<% } else {
|
||||
%>
|
||||
java.util.Map<<%=connectionName%>Struct, <%=connectionName%>Struct> tHash_<%=connectionName%> = new java.util.LinkedHashMap<<%=connectionName%>Struct, <%=connectionName%>Struct>();
|
||||
globalMap.put("tHash_<%=connectionName%>", tHash_<%=connectionName%>);
|
||||
<%
|
||||
}
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
java.util.Map<<%=connectionName%>Struct, <%=connectionName%>Struct> tHash_<%=connectionName%> = new java.util.LinkedHashMap<<%=connectionName%>Struct, <%=connectionName%>Struct>();
|
||||
globalMap.put("tHash_<%=connectionName%>", tHash_<%=connectionName%>);
|
||||
<%
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
org.talend.designer.codegen.config.CodeGeneratorArgument
|
||||
java.util.List
|
||||
org.talend.core.model.metadata.IMetadataTable
|
||||
org.talend.core.model.process.EConnectionType
|
||||
org.talend.core.model.process.IDataConnection
|
||||
"
|
||||
%>
|
||||
<%
|
||||
@@ -14,32 +16,35 @@
|
||||
|
||||
List<IConnection> connections = (List<IConnection>) node.getIncomingConnections();
|
||||
boolean includeParallelComps = false;
|
||||
List<? extends INode> listPartitions= node.getProcess().getNodesOfType("tPartitioner");
|
||||
if (listPartitions!=null && listPartitions.size() > 0 ) {
|
||||
includeParallelComps = true;
|
||||
}
|
||||
if (connections != null && connections.size() > 0) {
|
||||
for (IConnection connection : connections) {
|
||||
String connectionName = connection.getName();
|
||||
|
||||
IMetadataTable metadataTable = connection.getMetadataTable();
|
||||
|
||||
if (includeParallelComps) {
|
||||
INode validTarget = ((IDataConnection) connection).getLinkNodeForHash();
|
||||
if(validTarget != null) {
|
||||
INode partitionNode = validTarget.getDesignSubjobStartNode();
|
||||
if ("tCollector".equals(partitionNode.getComponent().getName())) {
|
||||
includeParallelComps = true;
|
||||
partitionNode = partitionNode.getIncomingConnections(EConnectionType.STARTS).get(0).getSource();
|
||||
}
|
||||
if (includeParallelComps) {
|
||||
%>
|
||||
if (isMultiThreaded_<%=cid%>) {
|
||||
java.util.List<java.util.concurrent.ConcurrentHashMap<String,Object>> mapsList_<%=cid%> =
|
||||
(java.util.List<java.util.concurrent.ConcurrentHashMap<String,Object>>)globalMap.get("THREAD_MAPS_"+jobName);
|
||||
if (mapsList_<%=cid%> != null) {
|
||||
for (java.util.concurrent.ConcurrentHashMap<String,Object> map : mapsList_<%=cid%>) {
|
||||
if (globalMap != map) {
|
||||
map.put("tHash_Lookup_<%=connectionName%>",tHash_<%=connectionName%>);
|
||||
} //gm
|
||||
}//for
|
||||
}//null
|
||||
}//is threaded
|
||||
if (isMultiThreaded_<%=cid%>) {
|
||||
java.util.List<java.util.Map<String,Object>> mapsList_<%=cid%> =
|
||||
(java.util.List<java.util.Map<String,Object>>)globalMap.get("THREAD_MAPS_<%=partitionNode.getUniqueName()%>_"+jobName);
|
||||
if (mapsList_<%=cid%> != null) {
|
||||
for (java.util.Map<String,Object> map : mapsList_<%=cid%>) {
|
||||
if (globalMap != map) {
|
||||
map.put("tHash_<%=connectionName%>",tHash_<%=connectionName%>);
|
||||
} //gm
|
||||
}//for
|
||||
}//null
|
||||
}//is threaded
|
||||
}
|
||||
}
|
||||
}
|
||||
<% }
|
||||
<% }
|
||||
}
|
||||
}
|
||||
}
|
||||
%>
|
||||
@@ -440,7 +440,7 @@
|
||||
</ITEMS>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="ADVANCED_PROPERTIES" FIELD="TABLE"
|
||||
<PARAMETER NAME="ADVANCED_PROPERTIES" REPOSITORY_VALUE="ADVANCED_PROPERTIES" FIELD="TABLE"
|
||||
REQUIRED="false" NUM_ROW="50" NB_LINES="3">
|
||||
<ITEMS>
|
||||
<ITEM NAME="PROPERTY" />
|
||||
|
||||
@@ -538,7 +538,7 @@
|
||||
</ITEMS>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="ADVANCED_PROPERTIES" FIELD="TABLE"
|
||||
<PARAMETER NAME="ADVANCED_PROPERTIES" REPOSITORY_VALUE="ADVANCED_PROPERTIES" FIELD="TABLE"
|
||||
REQUIRED="false" NUM_ROW="50" NB_LINES="3"
|
||||
SHOW_IF="USE_EXISTING_CONNECTION == 'false'">
|
||||
<ITEMS>
|
||||
|
||||
@@ -16,6 +16,7 @@ String username = ElementParameterParser.getValue(node, "__USERNAME__");
|
||||
|
||||
String universe = ElementParameterParser.getValue(node, "__UNIVERSE__");
|
||||
boolean useTransaction = "false".equals(ElementParameterParser.getValue(node, "__AUTO_COMMIT__"));
|
||||
boolean useClientTranId = "true".equals(ElementParameterParser.getValue(node, "__GEN_TRANSACTION_ID__"));
|
||||
%>
|
||||
|
||||
org.talend.mdm.webservice.XtentisServiceLocator xtentisService_<%=cid %> = new org.talend.mdm.webservice.XtentisServiceLocator();
|
||||
@@ -40,7 +41,23 @@ stub_<%=cid %>.setPassword(decryptedPassword_<%=cid%>);
|
||||
|
||||
<%if(useTransaction) {%>
|
||||
String turl_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.getMDMTransactionURL(<%=mdmUrl %>);
|
||||
com.talend.mdm.transaction.client.MDMTransaction mdmTransaction_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.newTransaction(turl_<%=cid%>,stub_<%=cid %>.getUsername(),stub_<%=cid %>.getPassword());
|
||||
com.talend.mdm.transaction.client.MDMTransaction mdmTransaction_<%=cid%> = null;
|
||||
<%
|
||||
if(useClientTranId){
|
||||
%>
|
||||
mdmTransaction_<%=cid%> = new com.talend.mdm.transaction.client.MDMTransaction();
|
||||
mdmTransaction_<%=cid%>.setUrl(turl_<%=cid%>);
|
||||
String clientTranId_<%=cid%> = "<%=cid%>"+java.util.UUID.randomUUID()+Thread.currentThread().getId();
|
||||
mdmTransaction_<%=cid%>.setId(clientTranId_<%=cid%>);
|
||||
mdmTransaction_<%=cid%>.setUsername(stub_<%=cid %>.getUsername());
|
||||
mdmTransaction_<%=cid%>.setPassword(stub_<%=cid %>.getPassword());
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
mdmTransaction_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.newTransaction(turl_<%=cid%>,stub_<%=cid %>.getUsername(),stub_<%=cid %>.getPassword());
|
||||
<%
|
||||
}
|
||||
%>
|
||||
stub_<%=cid %>.setHeader(new org.apache.axis.message.SOAPHeaderElement("http://www.talend.com/mdm", "transaction-id", mdmTransaction_<%=cid%>.getId()));
|
||||
globalMap.put("mdmTransaction_<%=cid %>", mdmTransaction_<%=cid%>);
|
||||
<%}%>
|
||||
|
||||
@@ -60,6 +60,15 @@
|
||||
NUM_ROW="40">
|
||||
<DEFAULT>true</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER
|
||||
NAME="GEN_TRANSACTION_ID"
|
||||
FIELD="CHECK"
|
||||
NUM_ROW="40"
|
||||
SHOW_IF="AUTO_COMMIT=='false'"
|
||||
>
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
</PARAMETERS>
|
||||
|
||||
|
||||
@@ -6,4 +6,5 @@ UNIVERSE.NAME=Version
|
||||
HELP=org.talend.help.tMDMConnection
|
||||
LONG_NAME=Creates a connection to a MDM Server
|
||||
|
||||
AUTO_COMMIT.NAME=Auto Commit
|
||||
AUTO_COMMIT.NAME=Auto Commit
|
||||
GEN_TRANSACTION_ID.NAME=Use client side transaction id
|
||||
@@ -7,7 +7,9 @@ imports="
|
||||
org.talend.core.model.metadata.types.JavaTypesManager
|
||||
org.talend.core.model.metadata.MappingTypeRetriever
|
||||
org.talend.core.model.metadata.MetadataTalendType
|
||||
org.talend.core.model.process.IConnectionCategory
|
||||
org.talend.core.model.process.IConnection
|
||||
org.talend.core.model.utils.NodeUtil
|
||||
java.util.List
|
||||
java.util.ArrayList
|
||||
java.util.Map
|
||||
@@ -69,12 +71,6 @@ skeleton="../templates/db_output_bulk.skeleton"
|
||||
boolean usingStatsLogs=cid.equals("talendLogs_DB") || cid.equals("talendStats_DB") || cid.equals("talendMeter_DB");
|
||||
String useBatchSize = ElementParameterParser.getValue(node,"__USE_BATCH_SIZE__");
|
||||
String batchSize=ElementParameterParser.getValue(node,"__BATCH_SIZE__");
|
||||
boolean isUseParallelize ="true".equalsIgnoreCase(ElementParameterParser.getValue(node, "__PARALLELIZE__"));
|
||||
boolean isSpecifyIdentityKey = "true".equals(ElementParameterParser.getValue(node, "__SPECIFY_IDENTITY_FIELD__"));
|
||||
if(isUseParallelize || identityInsert || (!"DROP_CREATE".equals(tableAction) && !"CREATE".equals(tableAction) && !"DROP_IF_EXISTS_AND_CREATE".equals(tableAction))){
|
||||
isSpecifyIdentityKey = false;
|
||||
}
|
||||
String identityKey = ElementParameterParser.getValue(node, "__IDENTITY_FIELD__");
|
||||
%>
|
||||
int nb_line_<%=cid%> = 0;
|
||||
int nb_line_update_<%=cid%> = 0;
|
||||
@@ -119,6 +115,13 @@ if(columnList != null && columnList.size() > 0) {
|
||||
}
|
||||
isDynamic = isDynamic && !getManager(dbmsId, cid).isDynamicColumnReplaced();
|
||||
}
|
||||
boolean isUseParallelize ="true".equalsIgnoreCase(ElementParameterParser.getValue(node, "__PARALLELIZE__"));
|
||||
boolean isSpecifyIdentityKey = "true".equals(ElementParameterParser.getValue(node, "__SPECIFY_IDENTITY_FIELD__"));
|
||||
if(isDynamic || isUseParallelize || identityInsert || (!"DROP_CREATE".equals(tableAction) && !"CREATE".equals(tableAction) && !"DROP_IF_EXISTS_AND_CREATE".equals(tableAction))){
|
||||
isSpecifyIdentityKey = false;
|
||||
}
|
||||
String identityKey = ElementParameterParser.getValue(node, "__IDENTITY_FIELD__");
|
||||
getManager(dbmsId, cid, node).setIsSpecifyIdentityKey(isSpecifyIdentityKey);
|
||||
%>
|
||||
|
||||
<%
|
||||
@@ -272,7 +275,7 @@ if(usingStatsLogs){ %>
|
||||
<%
|
||||
for(Column column : stmtStructure) {
|
||||
if(!column.isReplaced() && !column.isAddCol() && column.isInsertable()) {
|
||||
if(isSpecifyIdentityKey && (column.getName().equals(identityKey))&& !column.isDynamic()) {
|
||||
if(isSpecifyIdentityKey && (column.getName().equals(identityKey))) {
|
||||
continue;
|
||||
}
|
||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getColumn().getTalendType(), column.getColumn().isNullable());
|
||||
@@ -288,7 +291,7 @@ if(usingStatsLogs){ %>
|
||||
int count = 0;
|
||||
for(Column column : stmtStructure) {
|
||||
if(!column.isReplaced() && !column.isAddCol() && column.isInsertable()) {
|
||||
if(isSpecifyIdentityKey && (column.getName().equals(identityKey))&& !column.isDynamic()) {
|
||||
if(isSpecifyIdentityKey && (column.getName().equals(identityKey))) {
|
||||
continue;
|
||||
}
|
||||
if(count != 0) {
|
||||
@@ -308,7 +311,7 @@ if(usingStatsLogs){ %>
|
||||
<%
|
||||
for(Column column : stmtStructure) {
|
||||
if(!column.isReplaced() && !column.isAddCol() && column.isInsertable()) {
|
||||
if(isSpecifyIdentityKey && (column.getName().equals(identityKey))&& !column.isDynamic()) {
|
||||
if(isSpecifyIdentityKey && (column.getName().equals(identityKey))) {
|
||||
continue;
|
||||
}
|
||||
%>
|
||||
@@ -343,7 +346,7 @@ if(usingStatsLogs){ %>
|
||||
<%@ include file="../templates/DB/Output/splitSQLForAllDBInBegin.javajet" %>
|
||||
<%
|
||||
}
|
||||
} //end isDynamic
|
||||
} //end !isDynamic
|
||||
|
||||
if (useExistingConnection) {
|
||||
String connection = ElementParameterParser.getValue(node,"__CONNECTION__");
|
||||
@@ -380,4 +383,234 @@ if(isDynamic) {
|
||||
<%
|
||||
}
|
||||
}
|
||||
|
||||
boolean ignoreDateOutofRange = ("true").equals(ElementParameterParser.getValue(node,"__IGNORE_DATE_OUTOF_RANGE__"));
|
||||
|
||||
IConnection inputConn = null;
|
||||
String incomingConnName = null;
|
||||
|
||||
List< ? extends IConnection> conns = node.getIncomingConnections();
|
||||
if(conns!=null && conns.size()>0){
|
||||
inputConn = conns.get(0);
|
||||
incomingConnName = inputConn.getName();
|
||||
}
|
||||
|
||||
List<Column> colStruct = new ArrayList();
|
||||
for(Column colStmt : stmtStructure) {
|
||||
if (!colStmt.isReplaced()&&!colStmt.isAddCol()&&!colStmt.isDynamic()) {
|
||||
colStruct.add(colStmt);
|
||||
} else if ( colStmt.isReplaced() ) {
|
||||
List <Column> replacements = colStmt.getReplacement() ;
|
||||
for (int i=0; i < replacements.size() ; i++) {
|
||||
Column columnTest = replacements.get(i);
|
||||
String sqlExpression = columnTest.getSqlStmt();
|
||||
if (sqlExpression.contains("?")) {
|
||||
colStruct.add(colStmt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(incomingConnName==null || columnList == null || columnList.isEmpty()) {
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
int schemaOptNum = 100;
|
||||
String schemaOptNumStr=ElementParameterParser.getValue(node, "__SCHEMA_OPT_NUM__");
|
||||
if(schemaOptNumStr!=null && !"".equals(schemaOptNumStr) && !"\"\"".equals(schemaOptNumStr)){
|
||||
schemaOptNum = Integer.parseInt(schemaOptNumStr);
|
||||
}
|
||||
|
||||
if(columnList.size() <= schemaOptNum) {//optimize for 65535 method size issue in java
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
%>
|
||||
class SetPrepareStatementUtil_<%=cid%> {
|
||||
<%
|
||||
List<String> types = new ArrayList<String>();
|
||||
if(dataAction!=null && dataAction.contains("INSERT")) {
|
||||
types.add("Insert");
|
||||
}
|
||||
if(dataAction!=null && dataAction.contains("UPDATE")) {
|
||||
types.add("Update");
|
||||
}
|
||||
|
||||
for(String type : types) {
|
||||
int counter = 1;
|
||||
for(Column column : colStruct) {
|
||||
if("Insert".equals(type) && (!column.isInsertable() || (isSpecifyIdentityKey && (column.getName().equals(identityKey))))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if("Update".equals(type) && !column.isUpdatable()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getColumn().getTalendType(), column.getColumn().isNullable());
|
||||
|
||||
int actionType = NORMAL_TYPE;
|
||||
String splits = "insertSQLSplits_";
|
||||
|
||||
if("INSERT_OR_UPDATE".equals(dataAction) || "UPDATE_OR_INSERT".equals(dataAction)) {
|
||||
if("Insert".equals(type)) {
|
||||
actionType = INSERT_TYPE;
|
||||
} else if("Update".equals(type)) {
|
||||
actionType = UPDATE_TYPE;
|
||||
splits = "updateSQLSplits_";
|
||||
}
|
||||
} else if("UPDATE".equals(dataAction)) {
|
||||
splits = "updateSQLSplits_";
|
||||
}
|
||||
|
||||
if((counter-1)%schemaOptNum==0){//begin method
|
||||
%>
|
||||
void set<%=type%>_<%=(counter-1)/schemaOptNum%>(
|
||||
final <%=NodeUtil.getPrivateConnClassName(inputConn) %>Struct <%=inputConn.getName() %>,
|
||||
final java.sql.PreparedStatement
|
||||
<%
|
||||
if(actionType == NORMAL_TYPE) {
|
||||
%>
|
||||
pstmt_<%=cid%>
|
||||
<%
|
||||
} else if(actionType == INSERT_TYPE) {
|
||||
%>
|
||||
pstmtInsert_<%=cid%>
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
pstmtUpdate_<%=cid%>
|
||||
<%
|
||||
}
|
||||
|
||||
if(isEnableDebug) {
|
||||
%>
|
||||
,
|
||||
final StringBuffer query_<%=cid%>
|
||||
,
|
||||
final String[] <%=splits%><%=cid%>
|
||||
<%
|
||||
}
|
||||
%>
|
||||
) throws java.sql.SQLException {
|
||||
//}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
<%=getManager(dbmsId, cid).generateSetStmt(typeToGenerate, String.valueOf(ignoreDateOutofRange), column, counter, incomingConnName, cid, actionType,null)%>
|
||||
<%
|
||||
if(isEnableDebug) {
|
||||
%>
|
||||
<%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counter, splits)%>;
|
||||
<%
|
||||
}
|
||||
|
||||
if(counter%schemaOptNum==0) {//close method
|
||||
%>
|
||||
//{
|
||||
}
|
||||
<%
|
||||
}
|
||||
|
||||
counter++;
|
||||
}
|
||||
|
||||
if((counter-1) >0&&((counter-1)%schemaOptNum)>0){//close method
|
||||
%>
|
||||
//{
|
||||
}
|
||||
<%
|
||||
}
|
||||
}
|
||||
%>
|
||||
}
|
||||
|
||||
SetPrepareStatementUtil_<%=cid%> setPrepareStatementUtil_<%=cid%> = new SetPrepareStatementUtil_<%=cid%>();
|
||||
|
||||
<%
|
||||
IConnection rejectConn = null;
|
||||
List<? extends IConnection> rejectConns = node.getOutgoingConnections("REJECT");
|
||||
if(rejectConns != null && rejectConns.size() > 0) {
|
||||
rejectConn = rejectConns.get(0);
|
||||
}
|
||||
|
||||
List<? extends IConnection> outgoingConns = node.getOutgoingSortedConnections();
|
||||
|
||||
IConnection outputConn = null;
|
||||
|
||||
for(IConnection outgoingConn : outgoingConns) {
|
||||
if(rejectConn == null || (rejectConn != null && !outgoingConn.getName().equals(rejectConn.getName()))) {
|
||||
if(outgoingConn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
||||
outputConn = outgoingConn;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<IConnection> outputConns = new ArrayList<IConnection>();
|
||||
|
||||
if(outputConn!=null) {
|
||||
outputConns.add(outputConn);
|
||||
}
|
||||
|
||||
String dieOnError = ElementParameterParser.getValue(node, "__DIE_ON_ERROR__");
|
||||
List<IMetadataColumn> rejectColumnList = null;
|
||||
IMetadataTable metadataTable = node.getMetadataFromConnector("REJECT");
|
||||
if(metadataTable != null) {
|
||||
rejectColumnList = metadataTable.getListColumns();
|
||||
}
|
||||
|
||||
if(!"true".equals(dieOnError) && rejectConn != null && rejectColumnList != null && rejectColumnList.size() > 0) {
|
||||
outputConns.add(rejectConn);
|
||||
}
|
||||
|
||||
if(outputConns.isEmpty()) {
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
%>
|
||||
|
||||
class DataPropagateUtil_<%=cid%> {
|
||||
<%
|
||||
for(IConnection outputConnection : outputConns) {
|
||||
String sourceObjectName = incomingConnName;
|
||||
String sourceObjectType = NodeUtil.getPrivateConnClassName(inputConn);
|
||||
|
||||
String targetObjectName = outputConnection.getName();
|
||||
String targetObjectType = NodeUtil.getPrivateConnClassName(outputConnection);
|
||||
|
||||
int index = 0;
|
||||
for(IMetadataColumn column : columnList) {
|
||||
if(index%schemaOptNum==0){//begin method
|
||||
%>
|
||||
void assign_<%=targetObjectName%>_<%=index/schemaOptNum%>(final <%=sourceObjectType%>Struct <%=sourceObjectName%>,final <%=targetObjectType%>Struct <%=targetObjectName%>) {
|
||||
//}
|
||||
<%
|
||||
}
|
||||
|
||||
//do assign
|
||||
%>
|
||||
<%=targetObjectName%>.<%=column.getLabel()%> = <%=sourceObjectName%>.<%=column.getLabel()%>;
|
||||
<%
|
||||
|
||||
if((index+1)%schemaOptNum==0) {//close method
|
||||
%>
|
||||
//{
|
||||
}
|
||||
<%
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
if(index>0&&(index%schemaOptNum)>0){//close method
|
||||
%>
|
||||
//{
|
||||
}
|
||||
<%
|
||||
}
|
||||
}
|
||||
%>
|
||||
}
|
||||
|
||||
DataPropagateUtil_<%=cid%> dataPropagateUtil_<%=cid%> = new DataPropagateUtil_<%=cid%>();
|
||||
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ skeleton="../templates/db_output_bulk.skeleton"
|
||||
String tableAction = ElementParameterParser.getValue(node,"__TABLE_ACTION__");
|
||||
boolean isUseParallelize ="true".equalsIgnoreCase(ElementParameterParser.getValue(node, "__PARALLELIZE__"));
|
||||
boolean isSpecifyIdentityKey = "true".equals(ElementParameterParser.getValue(node, "__SPECIFY_IDENTITY_FIELD__"));
|
||||
if(isUseParallelize || identityInsert || (!"DROP_CREATE".equals(tableAction) && !"CREATE".equals(tableAction) && !"DROP_IF_EXISTS_AND_CREATE".equals(tableAction))){
|
||||
if(isDynamic || isUseParallelize || identityInsert || (!"DROP_CREATE".equals(tableAction) && !"CREATE".equals(tableAction) && !"DROP_IF_EXISTS_AND_CREATE".equals(tableAction))){
|
||||
isSpecifyIdentityKey = false;
|
||||
}
|
||||
String identityKey = ElementParameterParser.getValue(node, "__IDENTITY_FIELD__");
|
||||
|
||||
@@ -284,6 +284,10 @@
|
||||
>
|
||||
<DEFAULT>10000</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="SCHEMA_OPT_NUM" FIELD="TEXT" NUM_ROW="180" SHOW="false">
|
||||
<DEFAULT>100</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
</ADVANCED_PARAMETERS>
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ skeleton="../templates/db_output_bulk.skeleton"
|
||||
} else if ( colStmt.isReplaced() ) {
|
||||
List <Column> replacements = colStmt.getReplacement() ;
|
||||
for (int i=0; i < replacements.size() ; i++) {
|
||||
Column columnTest =columnTest = replacements.get(i);
|
||||
Column columnTest = replacements.get(i);
|
||||
String sqlExpression = columnTest.getSqlStmt();
|
||||
if (sqlExpression.contains("?")) {
|
||||
colStruct.add(colStmt);
|
||||
@@ -115,7 +115,7 @@ skeleton="../templates/db_output_bulk.skeleton"
|
||||
}
|
||||
boolean isUseParallelize ="true".equalsIgnoreCase(ElementParameterParser.getValue(node, "__PARALLELIZE__"));
|
||||
boolean isSpecifyIdentityKey = "true".equals(ElementParameterParser.getValue(node, "__SPECIFY_IDENTITY_FIELD__"));
|
||||
if(isUseParallelize || identityInsert || (!"DROP_CREATE".equals(tableAction) && !"CREATE".equals(tableAction) && !"DROP_IF_EXISTS_AND_CREATE".equals(tableAction))){
|
||||
if(isDynamic || isUseParallelize || identityInsert || (!"DROP_CREATE".equals(tableAction) && !"CREATE".equals(tableAction) && !"DROP_IF_EXISTS_AND_CREATE".equals(tableAction))){
|
||||
isSpecifyIdentityKey = false;
|
||||
}
|
||||
String identityKey = ElementParameterParser.getValue(node, "__IDENTITY_FIELD__");
|
||||
@@ -484,6 +484,14 @@ if((cid.equals("talendLogs_DB") || cid.equals("talendStats_DB") || cid.equals("t
|
||||
}
|
||||
|
||||
if(incomingConnName != null && columnList != null){
|
||||
int schemaOptNum = 100;
|
||||
String schemaOptNumStr=ElementParameterParser.getValue(node, "__SCHEMA_OPT_NUM__");
|
||||
if(schemaOptNumStr!=null && !"".equals(schemaOptNumStr) && !"\"\"".equals(schemaOptNumStr)){
|
||||
schemaOptNum = Integer.parseInt(schemaOptNumStr);
|
||||
}
|
||||
|
||||
boolean optimize65535 = columnList.size() > schemaOptNum;//optimize for 65535 method size issue in java
|
||||
|
||||
if(identityInsert && useExistingConnection ) {
|
||||
%>
|
||||
if ( isShareIdentity_<%=cid%> ) {
|
||||
@@ -495,8 +503,6 @@ if((cid.equals("talendLogs_DB") || cid.equals("talendStats_DB") || cid.equals("t
|
||||
whetherReject_<%=cid%> = false;
|
||||
<%
|
||||
if(("INSERT").equals(dataAction)) {
|
||||
int counter = 1;
|
||||
|
||||
//start issue0010403 date type
|
||||
if (rejectConnName != null) {
|
||||
%>
|
||||
@@ -504,22 +510,33 @@ if((cid.equals("talendLogs_DB") || cid.equals("talendStats_DB") || cid.equals("t
|
||||
<%
|
||||
}//end issue0010403 date type
|
||||
|
||||
int counter = 1;
|
||||
for(Column column : colStruct) {
|
||||
if(column.isInsertable()) {
|
||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getColumn().getTalendType(), column.getColumn().isNullable());
|
||||
if(isSpecifyIdentityKey && (column.getName().equals(identityKey)) && column.isInsertable() && !column.isDynamic()) {
|
||||
continue;
|
||||
}
|
||||
%>
|
||||
<%=getManager(dbmsId, cid).generateSetStmt(typeToGenerate,String.valueOf(ignoreDateOutofRange), column, counter, incomingConnName, cid, NORMAL_TYPE,null)%>
|
||||
<%
|
||||
if(isEnableDebug) {
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counter, "insertSQLSplits_")%>;
|
||||
<%
|
||||
}
|
||||
counter++;
|
||||
if(!column.isInsertable() || (isSpecifyIdentityKey && (column.getName().equals(identityKey)))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(optimize65535) {
|
||||
if((counter-1)%schemaOptNum==0){
|
||||
%>
|
||||
setPrepareStatementUtil_<%=cid%>.setInsert_<%=(counter-1)/schemaOptNum%>(<%=incomingConnName%>,pstmt_<%=cid%>
|
||||
<%if(isEnableDebug) {%>,query_<%=cid%>,insertSQLSplits_<%=cid%><%}%>
|
||||
);
|
||||
<%
|
||||
}
|
||||
} else {
|
||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getColumn().getTalendType(), column.getColumn().isNullable());
|
||||
%>
|
||||
<%=getManager(dbmsId, cid).generateSetStmt(typeToGenerate,String.valueOf(ignoreDateOutofRange), column, counter, incomingConnName, cid, NORMAL_TYPE,null)%>
|
||||
<%
|
||||
if(isEnableDebug) {
|
||||
%>
|
||||
<%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counter, "insertSQLSplits_")%>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
|
||||
counter++;
|
||||
}
|
||||
if(isDynamic) {
|
||||
Column dynamicColumn = getColumn(talendDynCol);
|
||||
@@ -626,7 +643,7 @@ if((cid.equals("talendLogs_DB") || cid.equals("talendStats_DB") || cid.equals("t
|
||||
}
|
||||
for(Column column : colStruct) {
|
||||
if(column.isInsertable()) {
|
||||
if(isSpecifyIdentityKey && (column.getName().equals(identityKey)) && !column.isDynamic()) {
|
||||
if(isSpecifyIdentityKey && (column.getName().equals(identityKey))) {
|
||||
continue;
|
||||
}
|
||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getColumn().getTalendType(), column.getColumn().isNullable());
|
||||
@@ -653,7 +670,7 @@ if((cid.equals("talendLogs_DB") || cid.equals("talendStats_DB") || cid.equals("t
|
||||
int count =0;
|
||||
for(Column column : colStruct) {
|
||||
if(column.isInsertable()) {
|
||||
if(isSpecifyIdentityKey && (column.getName().equals(identityKey)) && !column.isDynamic()) {
|
||||
if(isSpecifyIdentityKey && (column.getName().equals(identityKey))) {
|
||||
continue;
|
||||
}
|
||||
if(count != 0) {
|
||||
@@ -710,18 +727,31 @@ if((cid.equals("talendLogs_DB") || cid.equals("talendStats_DB") || cid.equals("t
|
||||
}//end issue0010403 date type
|
||||
|
||||
for(Column column : colStruct) {
|
||||
if(column.isUpdatable()) {
|
||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getColumn().getTalendType(), column.getColumn().isNullable());
|
||||
%>
|
||||
<%=getManager(dbmsId, cid).generateSetStmt(typeToGenerate,String.valueOf(ignoreDateOutofRange), column, counterCol, incomingConnName, cid, NORMAL_TYPE,null)%>
|
||||
<%
|
||||
if(isEnableDebug) {
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_")%>;
|
||||
<%
|
||||
}
|
||||
counterCol++;
|
||||
if(!column.isUpdatable()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(optimize65535) {
|
||||
if((counterCol-1)%schemaOptNum==0){
|
||||
%>
|
||||
setPrepareStatementUtil_<%=cid%>.setUpdate_<%=(counterCol-1)/schemaOptNum%>(<%=incomingConnName%>,pstmt_<%=cid%>
|
||||
<%if(isEnableDebug) {%>,query_<%=cid%>,updateSQLSplits_<%=cid%><%}%>
|
||||
);
|
||||
<%
|
||||
}
|
||||
} else {
|
||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getColumn().getTalendType(), column.getColumn().isNullable());
|
||||
%>
|
||||
<%=getManager(dbmsId, cid).generateSetStmt(typeToGenerate,String.valueOf(ignoreDateOutofRange), column, counterCol, incomingConnName, cid, NORMAL_TYPE,null)%>
|
||||
<%
|
||||
if(isEnableDebug) {
|
||||
%>
|
||||
<%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_")%>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
|
||||
counterCol++;
|
||||
}
|
||||
if(isDynamic) {
|
||||
Column dynamicColumn = getColumn(talendDynCol);
|
||||
@@ -756,11 +786,11 @@ if((cid.equals("talendLogs_DB") || cid.equals("talendStats_DB") || cid.equals("t
|
||||
if(isEnableDebug) {
|
||||
if(isDynamic){
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid).retrieveSQL(talendDynCol.getLabel(),typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_", "("+incomingConnName+"."+column.getName()+"==null)")%>;
|
||||
<%=getManager(dbmsId, cid).retrieveSQL(talendDynCol.getLabel(),typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_", "("+incomingConnName+"."+column.getName()+"==null)")%>;
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_", "("+incomingConnName+"."+column.getName()+"==null)")%>;
|
||||
<%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_", "("+incomingConnName+"."+column.getName()+"==null)")%>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
@@ -774,11 +804,11 @@ if((cid.equals("talendLogs_DB") || cid.equals("talendStats_DB") || cid.equals("t
|
||||
if(isEnableDebug) {
|
||||
if(isDynamic){
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid).retrieveSQL(talendDynCol.getLabel(),typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_")%>;
|
||||
<%=getManager(dbmsId, cid).retrieveSQL(talendDynCol.getLabel(),typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_")%>;
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_")%>;
|
||||
<%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_")%>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
@@ -891,18 +921,31 @@ if((cid.equals("talendLogs_DB") || cid.equals("talendStats_DB") || cid.equals("t
|
||||
}//end issue0010403 date type
|
||||
|
||||
for(Column column : colStruct) {
|
||||
if(column.isUpdatable()) {
|
||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getColumn().getTalendType(), column.getColumn().isNullable());
|
||||
%>
|
||||
<%=getManager(dbmsId, cid).generateSetStmt(typeToGenerate,String.valueOf(ignoreDateOutofRange), column, counterCol, incomingConnName, cid, UPDATE_TYPE,null)%>
|
||||
<%
|
||||
if(isEnableDebug) {
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_")%>;
|
||||
<%
|
||||
}
|
||||
counterCol++;
|
||||
}
|
||||
if(!column.isUpdatable()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(optimize65535) {
|
||||
if((counterCol-1)%schemaOptNum==0){
|
||||
%>
|
||||
setPrepareStatementUtil_<%=cid%>.setUpdate_<%=(counterCol-1)/schemaOptNum%>(<%=incomingConnName%>,pstmtUpdate_<%=cid%>
|
||||
<%if(isEnableDebug) {%>,query_<%=cid%>,updateSQLSplits_<%=cid%><%}%>
|
||||
);
|
||||
<%
|
||||
}
|
||||
} else {
|
||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getColumn().getTalendType(), column.getColumn().isNullable());
|
||||
%>
|
||||
<%=getManager(dbmsId, cid).generateSetStmt(typeToGenerate,String.valueOf(ignoreDateOutofRange), column, counterCol, incomingConnName, cid, UPDATE_TYPE,null)%>
|
||||
<%
|
||||
if(isEnableDebug) {
|
||||
%>
|
||||
<%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_")%>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
|
||||
counterCol++;
|
||||
}
|
||||
if(isDynamic) {
|
||||
Column dynamicColumn = getColumn(talendDynCol);
|
||||
@@ -941,11 +984,11 @@ if((cid.equals("talendLogs_DB") || cid.equals("talendStats_DB") || cid.equals("t
|
||||
if(isEnableDebug) {
|
||||
if(isDynamic){
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid).retrieveSQL(talendDynCol.getLabel(),typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_", "("+incomingConnName+"."+column.getName()+"==null)")%>;
|
||||
<%=getManager(dbmsId, cid).retrieveSQL(talendDynCol.getLabel(),typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_", "("+incomingConnName+"."+column.getName()+"==null)")%>;
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_", "("+incomingConnName+"."+column.getName()+"==null)")%>;
|
||||
<%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_", "("+incomingConnName+"."+column.getName()+"==null)")%>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
@@ -959,11 +1002,11 @@ if((cid.equals("talendLogs_DB") || cid.equals("talendStats_DB") || cid.equals("t
|
||||
if(isEnableDebug) {
|
||||
if(isDynamic){
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid).retrieveSQL(talendDynCol.getLabel(),typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_")%>;
|
||||
<%=getManager(dbmsId, cid).retrieveSQL(talendDynCol.getLabel(),typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_")%>;
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_")%>;
|
||||
<%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_")%>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
@@ -1031,21 +1074,31 @@ if((cid.equals("talendLogs_DB") || cid.equals("talendStats_DB") || cid.equals("t
|
||||
<%
|
||||
}//end issue0010403 date type
|
||||
for(Column columnInsert : colStruct) {
|
||||
if(columnInsert.isInsertable()) {
|
||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(columnInsert.getColumn().getTalendType(), columnInsert.getColumn().isNullable());
|
||||
if(isSpecifyIdentityKey && (columnInsert.getName().equals(identityKey)) && columnInsert.isInsertable() && !columnInsert.isDynamic()) {
|
||||
continue;
|
||||
}
|
||||
%>
|
||||
<%=getManager(dbmsId, cid).generateSetStmt(typeToGenerate, String.valueOf(ignoreDateOutofRange), columnInsert, counterInsert, incomingConnName, cid, INSERT_TYPE,null)%>
|
||||
<%
|
||||
if(isEnableDebug) {
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, columnInsert, incomingConnName, cid, "query_" , counterInsert, "insertSQLSplits_")%>;
|
||||
<%
|
||||
}
|
||||
counterInsert++;
|
||||
}
|
||||
if(!columnInsert.isInsertable() || (isSpecifyIdentityKey && (columnInsert.getName().equals(identityKey)))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(optimize65535) {
|
||||
if((counterInsert-1)%schemaOptNum==0){
|
||||
%>
|
||||
setPrepareStatementUtil_<%=cid%>.setInsert_<%=(counterInsert-1)/schemaOptNum%>(<%=incomingConnName%>,pstmtInsert_<%=cid%>
|
||||
<%if(isEnableDebug) {%>,query_<%=cid%>,insertSQLSplits_<%=cid%><%}%>
|
||||
);
|
||||
<%
|
||||
}
|
||||
} else {
|
||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(columnInsert.getColumn().getTalendType(), columnInsert.getColumn().isNullable());
|
||||
%>
|
||||
<%=getManager(dbmsId, cid).generateSetStmt(typeToGenerate, String.valueOf(ignoreDateOutofRange), columnInsert, counterInsert, incomingConnName, cid, INSERT_TYPE,null)%>
|
||||
<%
|
||||
if(isEnableDebug) {
|
||||
%>
|
||||
<%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, columnInsert, incomingConnName, cid, "query_" , counterInsert, "insertSQLSplits_")%>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
|
||||
counterInsert++;
|
||||
}
|
||||
if(isDynamic) {
|
||||
Column dynamicColumn = getColumn(talendDynCol);
|
||||
@@ -1128,18 +1181,31 @@ if((cid.equals("talendLogs_DB") || cid.equals("talendStats_DB") || cid.equals("t
|
||||
}//end issue0010403 date type
|
||||
|
||||
for(Column columnUpdate : colStruct) {
|
||||
if(columnUpdate.isUpdatable()) {
|
||||
if(!columnUpdate.isUpdatable()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(optimize65535) {
|
||||
if((counterColUpdate-1)%schemaOptNum==0){
|
||||
%>
|
||||
setPrepareStatementUtil_<%=cid%>.setUpdate_<%=(counterColUpdate-1)/schemaOptNum%>(<%=incomingConnName%>,pstmtUpdate_<%=cid%>
|
||||
<%if(isEnableDebug) {%>,query_<%=cid%>,updateSQLSplits_<%=cid%><%}%>
|
||||
);
|
||||
<%
|
||||
}
|
||||
} else {
|
||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(columnUpdate.getColumn().getTalendType(), columnUpdate.getColumn().isNullable());
|
||||
%>
|
||||
<%=getManager(dbmsId, cid).generateSetStmt(typeToGenerate, String.valueOf(ignoreDateOutofRange), columnUpdate, counterColUpdate, incomingConnName, cid, UPDATE_TYPE,null)%>
|
||||
<%
|
||||
if(isEnableDebug) {
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, columnUpdate, incomingConnName, cid, "query_" , counterColUpdate, "updateSQLSplits_")%>;
|
||||
<%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, columnUpdate, incomingConnName, cid, "query_" , counterColUpdate, "updateSQLSplits_")%>;
|
||||
<%
|
||||
}
|
||||
counterColUpdate++;
|
||||
}
|
||||
}
|
||||
|
||||
counterColUpdate++;
|
||||
}
|
||||
if(isDynamic) {
|
||||
Column dynamicColumn = getColumn(talendDynCol);
|
||||
@@ -1176,11 +1242,11 @@ if((cid.equals("talendLogs_DB") || cid.equals("talendStats_DB") || cid.equals("t
|
||||
if(isEnableDebug) {
|
||||
if(isDynamic){
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid).retrieveSQL(talendDynCol.getLabel(),typeToGenerate, columnUpdate, incomingConnName, cid, "query_" , counterColUpdate, "updateSQLSplits_", "(("+incomingConnName+"."+columnUpdate.getName()+"==null))")%>;
|
||||
<%=getManager(dbmsId, cid).retrieveSQL(talendDynCol.getLabel(),typeToGenerate, columnUpdate, incomingConnName, cid, "query_" , counterColUpdate, "updateSQLSplits_", "(("+incomingConnName+"."+columnUpdate.getName()+"==null))")%>;
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, columnUpdate, incomingConnName, cid, "query_" , counterColUpdate, "updateSQLSplits_", "(("+incomingConnName+"."+columnUpdate.getName()+"==null))")%>;
|
||||
<%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, columnUpdate, incomingConnName, cid, "query_" , counterColUpdate, "updateSQLSplits_", "(("+incomingConnName+"."+columnUpdate.getName()+"==null))")%>;
|
||||
<%
|
||||
}
|
||||
|
||||
@@ -1195,11 +1261,11 @@ if((cid.equals("talendLogs_DB") || cid.equals("talendStats_DB") || cid.equals("t
|
||||
if(isEnableDebug) {
|
||||
if(isDynamic){
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid, node).retrieveSQL(talendDynCol.getLabel(),typeToGenerate, columnUpdate, incomingConnName, cid, "query_" , counterColUpdate, "updateSQLSplits_")%>;
|
||||
<%=getManager(dbmsId, cid, node).retrieveSQL(talendDynCol.getLabel(),typeToGenerate, columnUpdate, incomingConnName, cid, "query_" , counterColUpdate, "updateSQLSplits_")%>;
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, columnUpdate, incomingConnName, cid, "query_" , counterColUpdate, "updateSQLSplits_")%>;
|
||||
<%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, columnUpdate, incomingConnName, cid, "query_" , counterColUpdate, "updateSQLSplits_")%>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
@@ -1231,21 +1297,31 @@ if((cid.equals("talendLogs_DB") || cid.equals("talendStats_DB") || cid.equals("t
|
||||
}
|
||||
int counter = 1;
|
||||
for(Column column : colStruct) {
|
||||
if(column.isInsertable()) {
|
||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getColumn().getTalendType(), column.getColumn().isNullable());
|
||||
if(isSpecifyIdentityKey && (column.getName().equals(identityKey)) && column.isInsertable() && !column.isDynamic()) {
|
||||
continue;
|
||||
}
|
||||
%>
|
||||
<%=getManager(dbmsId, cid).generateSetStmt(typeToGenerate, String.valueOf(ignoreDateOutofRange), column, counter, incomingConnName, cid, INSERT_TYPE,null)%>
|
||||
<%
|
||||
if(isEnableDebug) {
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counter, "insertSQLSplits_")%>;
|
||||
<%
|
||||
}
|
||||
counter++;
|
||||
if(!column.isInsertable() || (isSpecifyIdentityKey && (column.getName().equals(identityKey)))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(optimize65535) {
|
||||
if((counter-1)%schemaOptNum==0){
|
||||
%>
|
||||
setPrepareStatementUtil_<%=cid%>.setInsert_<%=(counter-1)/schemaOptNum%>(<%=incomingConnName%>,pstmtInsert_<%=cid%>
|
||||
<%if(isEnableDebug) {%>,query_<%=cid%>,insertSQLSplits_<%=cid%><%}%>
|
||||
);
|
||||
<%
|
||||
}
|
||||
} else {
|
||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getColumn().getTalendType(), column.getColumn().isNullable());
|
||||
%>
|
||||
<%=getManager(dbmsId, cid).generateSetStmt(typeToGenerate, String.valueOf(ignoreDateOutofRange), column, counter, incomingConnName, cid, INSERT_TYPE,null)%>
|
||||
<%
|
||||
if(isEnableDebug) {
|
||||
%>
|
||||
<%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counter, "insertSQLSplits_")%>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
|
||||
counter++;
|
||||
}
|
||||
if(isDynamic) {
|
||||
Column dynamicColumn = getColumn(talendDynCol);
|
||||
@@ -1331,7 +1407,7 @@ if((cid.equals("talendLogs_DB") || cid.equals("talendStats_DB") || cid.equals("t
|
||||
<%
|
||||
if(isEnableDebug) {
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , keyCounter, "deleteSQLSplits_", "("+incomingConnName+"."+column.getName()+"==null)")%>;
|
||||
<%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , keyCounter, "deleteSQLSplits_", "("+incomingConnName+"."+column.getName()+"==null)")%>;
|
||||
<%
|
||||
}
|
||||
keyCounter++;
|
||||
@@ -1343,7 +1419,7 @@ if((cid.equals("talendLogs_DB") || cid.equals("talendStats_DB") || cid.equals("t
|
||||
<%
|
||||
if(isEnableDebug) {
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , keyCounter, "deleteSQLSplits_")%>;
|
||||
<%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , keyCounter, "deleteSQLSplits_")%>;
|
||||
<%
|
||||
}
|
||||
keyCounter++;
|
||||
@@ -1458,21 +1534,31 @@ if((cid.equals("talendLogs_DB") || cid.equals("talendStats_DB") || cid.equals("t
|
||||
}//end issue0010403 date type
|
||||
|
||||
for(Column columnInsert : colStruct) {
|
||||
if(columnInsert.isInsertable()) {
|
||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(columnInsert.getColumn().getTalendType(), columnInsert.getColumn().isNullable());
|
||||
if(isSpecifyIdentityKey && (columnInsert.getName().equals(identityKey)) && columnInsert.isInsertable() && !columnInsert.isDynamic()) {
|
||||
continue;
|
||||
}
|
||||
%>
|
||||
<%=getManager(dbmsId, cid).generateSetStmt(typeToGenerate, String.valueOf(ignoreDateOutofRange), columnInsert, counterInsert, incomingConnName, cid, INSERT_TYPE,null)%>
|
||||
<%
|
||||
if(isEnableDebug) {
|
||||
%>
|
||||
query_<%=cid%> = <%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, columnInsert, incomingConnName, cid, "query_" , counterInsert, "insertSQLSplits_")%>;
|
||||
<%
|
||||
}
|
||||
counterInsert++;
|
||||
if(!columnInsert.isInsertable() || (isSpecifyIdentityKey && (columnInsert.getName().equals(identityKey)))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(optimize65535) {
|
||||
if((counterInsert-1)%schemaOptNum==0){
|
||||
%>
|
||||
setPrepareStatementUtil_<%=cid%>.setInsert_<%=(counterInsert-1)/schemaOptNum%>(<%=incomingConnName%>,pstmtInsert_<%=cid%>
|
||||
<%if(isEnableDebug) {%>,query_<%=cid%>,insertSQLSplits_<%=cid%><%}%>
|
||||
);
|
||||
<%
|
||||
}
|
||||
} else {
|
||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(columnInsert.getColumn().getTalendType(), columnInsert.getColumn().isNullable());
|
||||
%>
|
||||
<%=getManager(dbmsId, cid).generateSetStmt(typeToGenerate, String.valueOf(ignoreDateOutofRange), columnInsert, counterInsert, incomingConnName, cid, INSERT_TYPE,null)%>
|
||||
<%
|
||||
if(isEnableDebug) {
|
||||
%>
|
||||
<%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, columnInsert, incomingConnName, cid, "query_" , counterInsert, "insertSQLSplits_")%>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
|
||||
counterInsert++;
|
||||
}
|
||||
if(isDynamic) {
|
||||
Column dynamicColumn = getColumn(talendDynCol);
|
||||
|
||||
@@ -91,4 +91,6 @@ TYPE.NAME=Database Driver
|
||||
MAPPING.NAME=Mapping
|
||||
CONNECTION.NAME=Component List
|
||||
IGNORE_DATE_OUTOF_RANGE.NAME=Ignore Date validation
|
||||
NB_LINE_REJECTED.NAME=Number Of Rejected Lines
|
||||
NB_LINE_REJECTED.NAME=Number Of Rejected Lines
|
||||
|
||||
SCHEMA_OPT_NUM.NAME=Schema Optimize Number
|
||||
@@ -37,14 +37,6 @@
|
||||
<PARAMETER NAME="CONNECTION" FIELD="COMPONENT_LIST" NUM_ROW="10"
|
||||
REQUIRED="true" FILTER="REGEXP:^tMomOutput|tMomConnection|tMomInput$" />
|
||||
|
||||
<PARAMETER NAME="SERVER" FIELD="CLOSED_LIST" NUM_ROW="20">
|
||||
<ITEMS DEFAULT="WEBSPHERE">
|
||||
<ITEM NAME="WEBSPHERE" VALUE="WebSphere" />
|
||||
<ITEM NAME="JBOSS" VALUE="JBoss" />
|
||||
<ITEM NAME="ACTIVEMQ" VALUE="ActiveMQ"/>
|
||||
</ITEMS>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="CLOSE" FIELD="CHECK" NUM_ROW="100">
|
||||
<DEFAULT>true</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
@@ -3,6 +3,7 @@ imports="
|
||||
org.talend.core.model.process.INode
|
||||
org.talend.core.model.process.ElementParameterParser
|
||||
org.talend.designer.codegen.config.CodeGeneratorArgument
|
||||
org.talend.core.model.utils.NodeUtil
|
||||
"
|
||||
%>
|
||||
|
||||
@@ -15,10 +16,19 @@ imports="
|
||||
String connectionCid = ElementParameterParser.getValue(node,"__CONNECTION__");
|
||||
|
||||
boolean close = ("true").equals(ElementParameterParser.getValue(node,"__CLOSE__"));
|
||||
|
||||
INode connectionNode = NodeUtil.getNodeByUniqueName(node.getProcess(),connectionCid,true);
|
||||
|
||||
boolean isUseConnection = ("true").equals(ElementParameterParser.getValue(connectionNode, "__USE_CONNECTION__"));
|
||||
|
||||
if(isUseConnection){
|
||||
String realConnNodeName = ElementParameterParser.getValue(connectionNode,"__CONNECTION__");
|
||||
connectionNode = NodeUtil.getNodeByUniqueName(node.getProcess(),realConnNodeName);
|
||||
}
|
||||
String serverType=ElementParameterParser.getValue(connectionNode, "__SERVER__");
|
||||
boolean isTransacted = "true".equals(ElementParameterParser.getValue(connectionNode, "__IS_TRANSACTED__"));
|
||||
|
||||
String serverType=ElementParameterParser.getValue(node, "__SERVER__");
|
||||
final boolean isLog4jEnabled = ("true").equals(ElementParameterParser.getValue(node.getProcess(), "__LOG4J_ACTIVATE__"));
|
||||
|
||||
if (("JBoss").equals(serverType) || ("ActiveMQ").equals(serverType)) {
|
||||
%>
|
||||
javax.jms.Session session_<%=cid%> = (javax.jms.Session)globalMap.get("session_<%=connectionCid%>");
|
||||
@@ -26,18 +36,20 @@ imports="
|
||||
javax.jms.MessageProducer producer_<%=cid%> = (javax.jms.MessageProducer)globalMap.get("producer_<%=connectionCid%>");
|
||||
if(session_<%=cid%> != null && connection_<%=cid %> != null) {
|
||||
<%
|
||||
if (isLog4jEnabled) {
|
||||
%>
|
||||
log.info("<%=cid%> - Committing the session...");
|
||||
<%
|
||||
}
|
||||
%>
|
||||
session_<%=cid%>.commit();
|
||||
<%
|
||||
if (isLog4jEnabled) {
|
||||
%>
|
||||
log.info("<%=cid%> - Commit successfully.");
|
||||
<%
|
||||
if(isTransacted){
|
||||
if (isLog4jEnabled) {
|
||||
%>
|
||||
log.info("<%=cid%> - Committing the session...");
|
||||
<%
|
||||
}
|
||||
%>
|
||||
session_<%=cid%>.commit();
|
||||
<%
|
||||
if (isLog4jEnabled) {
|
||||
%>
|
||||
log.info("<%=cid%> - Commit successfully.");
|
||||
<%
|
||||
}
|
||||
}
|
||||
if(close){
|
||||
%>
|
||||
@@ -80,8 +92,7 @@ imports="
|
||||
} else {
|
||||
%>
|
||||
com.ibm.mq.MQQueueManager qMgr_<%=cid%> = (com.ibm.mq.MQQueueManager)globalMap.get("qMgr_<%=connectionCid%>");
|
||||
com.ibm.mq.MQQueue remoteQ_<%=cid%> = (com.ibm.mq.MQQueue)globalMap.get("remoteQ_<%=connectionCid%>");
|
||||
if(qMgr_<%=cid%> != null && remoteQ_<%=cid%> != null) {
|
||||
if(qMgr_<%=cid%> != null) {
|
||||
<%
|
||||
if (isLog4jEnabled) {
|
||||
%>
|
||||
@@ -103,8 +114,7 @@ imports="
|
||||
<%
|
||||
}
|
||||
%>
|
||||
remoteQ_<%=cid%>.close();
|
||||
qMgr_<%=cid%>.disconnect();;
|
||||
qMgr_<%=cid%>.disconnect();
|
||||
<%
|
||||
if (isLog4jEnabled) {
|
||||
%>
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
imports="
|
||||
org.talend.core.model.process.INode
|
||||
org.talend.core.model.process.ElementParameterParser
|
||||
org.talend.core.model.metadata.IMetadataTable
|
||||
org.talend.designer.codegen.config.CodeGeneratorArgument
|
||||
java.util.List
|
||||
java.util.Map
|
||||
@@ -10,120 +9,161 @@ imports="
|
||||
class="MomConnection"
|
||||
%>
|
||||
|
||||
<%
|
||||
<%
|
||||
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
|
||||
INode node = (INode)codeGenArgument.getArgument();
|
||||
String cid = node.getUniqueName();
|
||||
String host=ElementParameterParser.getValue(node, "__SERVERADDRESS__");
|
||||
String port=ElementParameterParser.getValue(node, "__SERVERPORT__");
|
||||
|
||||
boolean transacted = "true".equals(ElementParameterParser.getValue(node, "__IS_TRANSACTED__"));
|
||||
String acknowledgmentMode = ElementParameterParser.getValue(node, "__ACKNOWLEDGMENT_MODE__");
|
||||
String dbuser= ElementParameterParser.getValue(node, "__USER__");
|
||||
String serverType=ElementParameterParser.getValue(node, "__SERVER__");
|
||||
final boolean isLog4jEnabled = ("true").equals(ElementParameterParser.getValue(node.getProcess(), "__LOG4J_ACTIVATE__"));
|
||||
|
||||
boolean failover = ("true").equals(ElementParameterParser.getValue(node, "__FAILOVER__"));
|
||||
List<Map<String,String>> servers = (List<Map<String,String>>)ElementParameterParser.getObjectValue(node, "__SERVERS__");
|
||||
List<Map<String,String>> additionalOpts = (List<Map<String,String>>)ElementParameterParser.getObjectValue(node, "__ADDITIONAL_OPTIONS__");
|
||||
|
||||
String dbuser= ElementParameterParser.getValue(node, "__USER__");
|
||||
|
||||
|
||||
String strHost = null;
|
||||
String strPort = null;
|
||||
|
||||
%>
|
||||
|
||||
/*---------------------------------------1.initial jms connection factry---------------------------------*/
|
||||
|
||||
String url_<%=cid%> ="";
|
||||
<%if(failover){%>
|
||||
url_<%=cid %> = "failover:(";
|
||||
<%
|
||||
int i=0;
|
||||
for(Map<String, String> serversMap : servers) {
|
||||
strHost = serversMap.get("SERVERS_HOST");
|
||||
strPort = serversMap.get("SERVERS_PORT");
|
||||
boolean isUseSharedConnection = ("true").equals(ElementParameterParser.getValue(node, "__USE_SHARED_CONNECTION__"));
|
||||
String sharedConnectionName = ElementParameterParser.getValue(node, "__SHARED_CONNECTION_NAME__");
|
||||
|
||||
if(i>0) {
|
||||
%>
|
||||
url_<%=cid %> = url_<%=cid %> +",";
|
||||
|
||||
if(("ActiveMQ").equals(serverType)){/***ActiveMQ*****/
|
||||
boolean transacted = "true".equals(ElementParameterParser.getValue(node, "__IS_TRANSACTED__"));
|
||||
String acknowledgmentMode = ElementParameterParser.getValue(node, "__ACKNOWLEDGMENT_MODE__");
|
||||
|
||||
boolean failover = ("true").equals(ElementParameterParser.getValue(node, "__FAILOVER__"));
|
||||
List<Map<String,String>> servers = (List<Map<String,String>>)ElementParameterParser.getObjectValue(node, "__SERVERS__");
|
||||
List<Map<String,String>> additionalOpts = (List<Map<String,String>>)ElementParameterParser.getObjectValue(node, "__ADDITIONAL_OPTIONS__");
|
||||
|
||||
String strHost = null;
|
||||
String strPort = null;
|
||||
%>
|
||||
|
||||
/*---------------------------------------1.initial jms connection factry---------------------------------*/
|
||||
|
||||
String url_<%=cid%> ="";
|
||||
<%if(failover){%>
|
||||
url_<%=cid %> = "failover:(";
|
||||
<%
|
||||
int i=0;
|
||||
for(Map<String, String> serversMap : servers) {
|
||||
strHost = serversMap.get("SERVERS_HOST");
|
||||
strPort = serversMap.get("SERVERS_PORT");
|
||||
|
||||
if(i>0) {
|
||||
%>
|
||||
url_<%=cid %> = url_<%=cid %> +",";
|
||||
<%
|
||||
}
|
||||
%>
|
||||
url_<%=cid %> = url_<%=cid %> +"tcp://";
|
||||
url_<%=cid %> = url_<%=cid %> +<%=strHost%>;
|
||||
url_<%=cid %> = url_<%=cid %> +":";
|
||||
url_<%=cid %> = url_<%=cid %> +<%=strPort%>;
|
||||
<%
|
||||
i++;
|
||||
}
|
||||
%>
|
||||
url_<%=cid %> = url_<%=cid %> +"tcp://";
|
||||
url_<%=cid %> = url_<%=cid %> +<%=strHost%>;
|
||||
url_<%=cid %> = url_<%=cid %> +":";
|
||||
url_<%=cid %> = url_<%=cid %> +<%=strPort%>;
|
||||
url_<%=cid %> = url_<%=cid %> +")?randomize=false";
|
||||
<%
|
||||
i++;
|
||||
}
|
||||
%>
|
||||
url_<%=cid %> = url_<%=cid %> +")?randomize=false";
|
||||
<%
|
||||
for(Map<String, String> optrion : additionalOpts) {
|
||||
%>
|
||||
url_<%=cid %> = url_<%=cid %> +"&"+<%=optrion.get("OPTION_NAME")%>+"="+<%=optrion.get("OPTION_VALUE")%>;
|
||||
<%
|
||||
}
|
||||
}else{%>
|
||||
url_<%=cid %> = "tcp://"+<%=host%>+":"+<%=port%>;
|
||||
<%}%>
|
||||
for(Map<String, String> optrion : additionalOpts) {
|
||||
%>
|
||||
url_<%=cid %> = url_<%=cid %> +"&"+<%=optrion.get("OPTION_NAME")%>+"="+<%=optrion.get("OPTION_VALUE")%>;
|
||||
<%
|
||||
}
|
||||
}else{%>
|
||||
url_<%=cid %> = "tcp://"+<%=host%>+":"+<%=port%>;
|
||||
<%}%>
|
||||
|
||||
|
||||
System.out.println("Connecting to URL: " + url_<%=cid %>);
|
||||
|
||||
<%
|
||||
if(isLog4jEnabled){
|
||||
%>
|
||||
log.info("<%=cid%> - Attempt to create connection from URL: " + url_<%=cid %> + ".");
|
||||
<%
|
||||
}
|
||||
%>
|
||||
org.apache.activemq.ActiveMQConnectionFactory factory_<%=cid %> =
|
||||
new org.apache.activemq.ActiveMQConnectionFactory(url_<%=cid %>);
|
||||
<%
|
||||
|
||||
/*---------------------------------------2.create Queue Or Topic from connection ---------------------------------*/
|
||||
%>
|
||||
|
||||
<%if(dbuser == null || ("\"\"").equals(dbuser) || ("").equals(dbuser)) { %>
|
||||
javax.jms.Connection connection_<%=cid %> = factory_<%=cid %>.createConnection();
|
||||
<%} else { %>
|
||||
|
||||
<%
|
||||
String passwordFieldName = "__PASS__";
|
||||
%>
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
<%
|
||||
if(isUseSharedConnection){
|
||||
%>
|
||||
javax.jms.Connection connection_<%=cid %> = org.talend.mq.SharedActiveMQConnection.getMQConnection(url_<%=cid %>,<%=dbuser%>,decryptedPassword_<%=cid%>,<%=sharedConnectionName%>);
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
System.out.println("Connecting to URL: " + url_<%=cid %>);
|
||||
org.apache.activemq.ActiveMQConnectionFactory factory_<%=cid %> =
|
||||
new org.apache.activemq.ActiveMQConnectionFactory(url_<%=cid %>);
|
||||
<%
|
||||
|
||||
/*---------------------------------------2.create Queue Or Topic from connection ---------------------------------*/
|
||||
%>
|
||||
|
||||
<% if(dbuser == null || ("\"\"").equals(dbuser) || ("").equals(dbuser)) { %>
|
||||
javax.jms.Connection connection_<%=cid %> = factory_<%=cid %>.createConnection();
|
||||
<% } else { %>
|
||||
javax.jms.Connection connection_<%=cid %> = factory_<%=cid %>.createConnection(<%=dbuser%>,decryptedPassword_<%=cid%>);
|
||||
<% } %>
|
||||
<%
|
||||
if(isLog4jEnabled){
|
||||
%>
|
||||
log.info("<%=cid%> - Created connection successfully.");
|
||||
log.info("<%=cid%> - Activating the connection...");
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
connection_<%=cid %>.start();
|
||||
<%
|
||||
if(isLog4jEnabled){
|
||||
%>
|
||||
log.info("<%=cid%> - Activated successfully.");
|
||||
<%
|
||||
}
|
||||
}
|
||||
if(isLog4jEnabled){
|
||||
%>
|
||||
log.info("<%=cid%> - Creating a session...");
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
globalMap.put("connection_<%=cid%>", connection_<%=cid %>);
|
||||
javax.jms.Session session_<%=cid %> = connection_<%=cid %>.createSession(<%=transacted%>, javax.jms.Session.<%=acknowledgmentMode%>);
|
||||
globalMap.put("session_<%=cid %>", session_<%=cid %>);
|
||||
<%
|
||||
if(isLog4jEnabled){
|
||||
%>
|
||||
log.info("<%=cid%> - Created session successfully.");
|
||||
<%
|
||||
}
|
||||
}else{ /***WebSphere MQ*****/
|
||||
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
String channel=ElementParameterParser.getValue(node, "__CHANNEL__");
|
||||
String qm=ElementParameterParser.getValue(node, "__QM__");
|
||||
%>
|
||||
java.util.Hashtable properties<%=cid%>=new java.util.Hashtable();
|
||||
properties<%=cid%>.put("hostname", <%=host%>);
|
||||
properties<%=cid%>.put("port", Integer.valueOf(<%=port%>));
|
||||
properties<%=cid%>.put("channel", <%=channel%>);
|
||||
properties<%=cid%>.put("CCSID", new Integer(1208));
|
||||
properties<%=cid%>.put("transport","MQSeries");
|
||||
<%
|
||||
if(!(dbuser == null) && !("\"\"").equals(dbuser) && !("").equals(dbuser)) {
|
||||
%>
|
||||
properties<%=cid%>.put("userID",<%=dbuser%>);
|
||||
<%
|
||||
String passwordFieldName = "__PASS__";
|
||||
%>
|
||||
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
|
||||
javax.jms.Connection connection_<%=cid %> = factory_<%=cid %>.createConnection(<%=dbuser%>,decryptedPassword_<%=cid%>);
|
||||
<%}%>
|
||||
<%
|
||||
if(isLog4jEnabled){
|
||||
%>
|
||||
log.info("<%=cid%> - Created connection successfully.");
|
||||
log.info("<%=cid%> - Activating the connection...");
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
connection_<%=cid %>.start();
|
||||
<%
|
||||
if(isLog4jEnabled){
|
||||
%>
|
||||
log.info("<%=cid%> - Activated successfully.");
|
||||
log.info("<%=cid%> - Creating a session...");
|
||||
<%
|
||||
}
|
||||
%>
|
||||
globalMap.put("connection_<%=cid%>", connection_<%=cid %>);
|
||||
|
||||
javax.jms.Session session_<%=cid %> = connection_<%=cid %>.createSession(<%=transacted%>, javax.jms.Session.<%=acknowledgmentMode%>);
|
||||
globalMap.put("session_<%=cid %>", session_<%=cid %>);
|
||||
<%
|
||||
if(isLog4jEnabled){
|
||||
%>
|
||||
log.info("<%=cid%> - Created session successfully.");
|
||||
properties<%=cid%>.put("password",decryptedPassword_<%=cid%>);
|
||||
<%
|
||||
}
|
||||
if(isUseSharedConnection){
|
||||
%>
|
||||
com.ibm.mq.MQQueueManager qMgr_<%=cid%> = org.talend.mq.SharedWebSphereMQConnection.getMQConnection(<%=qm%>,properties<%=cid%>,<%=sharedConnectionName%>);
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
com.ibm.mq.MQQueueManager qMgr_<%=cid%> = new com.ibm.mq.MQQueueManager(<%=qm%>,properties<%=cid%>);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
globalMap.put("qMgr_<%=cid%>", qMgr_<%=cid%> );
|
||||
<%
|
||||
}
|
||||
%>
|
||||
@@ -38,27 +38,29 @@
|
||||
<PARAMETER NAME="SERVER" FIELD="CLOSED_LIST" NUM_ROW="20">
|
||||
<ITEMS DEFAULT="ActiveMQ">
|
||||
<ITEM NAME="ACTIVEMQ" VALUE="ActiveMQ" />
|
||||
<ITEM NAME="WEBSPHERE" VALUE="WebSphere" />
|
||||
</ITEMS>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="FAILOVER" FIELD="CHECK" NUM_ROW="15">
|
||||
<PARAMETER NAME="FAILOVER" FIELD="CHECK" NUM_ROW="15" SHOW_IF="(SERVER == 'ACTIVEMQ')">
|
||||
<DEFAULT >false</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="SERVERS" FIELD="TABLE" NB_LINES="5" NUM_ROW="23"
|
||||
SHOW_IF="FAILOVER == 'true'">
|
||||
SHOW_IF="(SERVER == 'ACTIVEMQ') AND (FAILOVER == 'true')">
|
||||
<ITEMS>
|
||||
<ITEM NAME="SERVERS_HOST" FIELD="String" />
|
||||
<ITEM NAME="SERVERS_PORT" FIELD="String" />
|
||||
</ITEMS>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="SERVERADDRESS" FIELD="TEXT" NUM_ROW="20"
|
||||
SHOW_IF="FAILOVER == 'false'">
|
||||
<PARAMETER NAME="SERVERADDRESS" FIELD="TEXT" NUM_ROW="22"
|
||||
SHOW_IF="((SERVER == 'ACTIVEMQ' and FAILOVER == 'false') OR (SERVER == 'WEBSPHERE'))">
|
||||
<DEFAULT>"localhost"</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="SERVERPORT" FIELD="TEXT" NUM_ROW="20"
|
||||
SHOW_IF="FAILOVER == 'false'">
|
||||
<DEFAULT>61616</DEFAULT>
|
||||
<PARAMETER NAME="SERVERPORT" FIELD="TEXT" NUM_ROW="22"
|
||||
SHOW_IF="((SERVER == 'ACTIVEMQ' and FAILOVER == 'false') OR (SERVER == 'WEBSPHERE'))">
|
||||
<DEFAULT IF="(SERVER == 'WEBSPHERE')">"1414"</DEFAULT>
|
||||
<DEFAULT IF="(SERVER == 'ACTIVEMQ')">"61616"</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="USER" FIELD="TEXT" REPOSITORY_VALUE="USERNAME" REQUIRED="false" NUM_ROW="25">
|
||||
@@ -67,11 +69,26 @@
|
||||
<PARAMETER NAME="PASS" FIELD="PASSWORD" REPOSITORY_VALUE="PASSWORD" REQUIRED="false" NUM_ROW="25">
|
||||
<DEFAULT>""</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="CHANNEL" FIELD="TEXT" NUM_ROW="35" SHOW_IF="(SERVER == 'WEBSPHERE')">
|
||||
<DEFAULT>"DC.SVRCONN"</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="QM" FIELD="TEXT" NUM_ROW="40" SHOW_IF="(SERVER == 'WEBSPHERE')">
|
||||
<DEFAULT>""</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="IS_TRANSACTED" FIELD="CHECK" REQUIRED="false" NUM_ROW="45"
|
||||
SHOW_IF="(SERVER == 'ACTIVEMQ')">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="USE_SHARED_CONNECTION" FIELD="CHECK" NUM_ROW="50" REQUIRED="true" >
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="SHARED_CONNECTION_NAME" FIELD="TEXT" NUM_ROW="50" REQUIRED="true" SHOW_IF="(USE_SHARED_CONNECTION == 'true')">
|
||||
<DEFAULT></DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
</PARAMETERS>
|
||||
|
||||
@@ -97,16 +114,19 @@
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="JNP-CLIENT" MODULE="jnp-client.jar" REQUIRED="true" />
|
||||
|
||||
<IMPORT NAME="ACTIVEMQ LIB" MODULE="activemq-all-5.10.0.jar" UrlPath="platform:/plugin/org.talend.libraries.apache/lib/activemq-all-5.10.0.jar" REQUIRED_IF="SERVER == 'ACTIVEMQ'" />
|
||||
<IMPORT NAME="JAVA_SSIST" MODULE="javassist.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="TROVE" MODULE="trove.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="LOG4J" MODULE="log4j-1.2.15.jar" UrlPath="platform:/base/plugins/org.apache.log4j_1.2.15.v201012070815.jar" REQUIRED="false" />
|
||||
|
||||
<IMPORT NAME="WEBSPHERE MQ LIB" MODULE="com.ibm.mq.jar" REQUIRED_IF="(SERVER == 'WEBSPHERE')" />
|
||||
<IMPORT NAME="WEBSPHERE JMS LIB" MODULE="com.ibm.mqjms.jar" REQUIRED_IF="(SERVER == 'WEBSPHERE')" />
|
||||
<IMPORT NAME="WEBSPHERE CONNECTOR" MODULE="websphere-connector-1_5.jar" REQUIRED_IF="(SERVER == 'WEBSPHERE')" />
|
||||
<IMPORT NAME="TALENDMQRFH2" MODULE="talendMQRFH2.jar" REQUIRED_IF="(SERVER == 'WEBSPHERE')" />
|
||||
<IMPORT NAME="Java Message Service" MODULE="jms.jar" UrlPath="platform:/plugin/org.talend.libraries.esb.ext/lib/jms.jar" REQUIRED_IF="(SERVER == 'WEBSPHERE')" />
|
||||
|
||||
<IMPORT NAME="SharedConnectionUtil" MODULE="talendMQConnectionUtil-1.0.0.jar" REQUIRED_IF="(USE_SHARED_CONNECTION == 'true')" />
|
||||
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
<RETURNS>
|
||||
<RETURN NAME="NB_LINE" TYPE="id_Integer" AVAILABILITY="AFTER" />
|
||||
</RETURNS>
|
||||
|
||||
<RETURNS/>
|
||||
</COMPONENT>
|
||||
|
||||
@@ -169,4 +169,7 @@ ADDITIONAL_OPTIONS.ITEM.OPTION_NAME=Option name
|
||||
ADDITIONAL_OPTIONS.ITEM.OPTION_VALUE=Option value
|
||||
SERVERS.NAME=
|
||||
SERVERS.ITEM.SERVERS_HOST=Host
|
||||
SERVERS.ITEM.SERVERS_PORT=Port
|
||||
SERVERS.ITEM.SERVERS_PORT=Port
|
||||
|
||||
USE_SHARED_CONNECTION.NAME=Use or register a shared Connection
|
||||
SHARED_CONNECTION_NAME.NAME=Shared Connection Name
|
||||
Binary file not shown.
@@ -36,19 +36,19 @@
|
||||
<PARAMETERS>
|
||||
|
||||
<PARAMETER NAME="KEEPLISTENING" FIELD="CHECK" SHOW="true" NUM_ROW="10"
|
||||
SHOW_IF="(SERVER == 'JBOSS') OR (SERVER == 'WEBSPHERE') OR (USE_CONNECTION == 'true' or SERVER == 'ACTIVEMQ' AND USEMAX == 'false')">
|
||||
SHOW_IF="(SERVER == 'JBOSS') OR (SERVER == 'WEBSPHERE') OR ((((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'ACTIVEMQ')) OR ((USE_CONNECTION == 'false') and (SERVER == 'ACTIVEMQ'))) AND USEMAX == 'false')">
|
||||
<DEFAULT IF="(SERVER == 'JBOSS')">true</DEFAULT>
|
||||
<DEFAULT IF="(SERVER == 'WEBSPHERE')">false</DEFAULT>
|
||||
<DEFAULT IF="(SERVER == 'ACTIVEMQ')">false</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="STARTSERVER" FIELD="CHECK" NUM_ROW="60"
|
||||
SHOW_IF="(SERVER == 'ACTIVEMQ') or (USE_CONNECTION == 'true')">
|
||||
SHOW_IF="(((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'ACTIVEMQ')) OR ((USE_CONNECTION == 'false') and (SERVER == 'ACTIVEMQ')))">
|
||||
<DEFAULT >false</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="USEMAX" FIELD="CHECK" NUM_ROW="15"
|
||||
SHOW_IF="((USE_CONNECTION == 'true') or (SERVER == 'ACTIVEMQ')) AND (KEEPLISTENING == 'false')">
|
||||
SHOW_IF="(((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'ACTIVEMQ')) OR ((USE_CONNECTION == 'false') and (SERVER == 'ACTIVEMQ'))) AND (KEEPLISTENING == 'false')">
|
||||
<DEFAULT >false</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
@@ -64,12 +64,12 @@
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="TIMEOUT" FIELD="TEXT" NUM_ROW="12"
|
||||
SHOW_IF="(SERVER == 'JBOSS' and KEEPLISTENING == 'TRUE') or (((SERVER == 'ACTIVEMQ') or (USE_CONNECTION == 'true')) and KEEPLISTENING == 'false' and USEMAX == 'false')">
|
||||
SHOW_IF="(SERVER == 'JBOSS' and KEEPLISTENING == 'TRUE') or ((((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'ACTIVEMQ')) OR ((USE_CONNECTION == 'false') and (SERVER == 'ACTIVEMQ'))) and KEEPLISTENING == 'false' and USEMAX == 'false')">
|
||||
<DEFAULT>1</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="MAXMSG" FIELD="TEXT" NUM_ROW="17"
|
||||
SHOW_IF="(((SERVER == 'ACTIVEMQ') or (USE_CONNECTION == 'true')) and KEEPLISTENING == 'false' and USEMAX == 'true')">
|
||||
SHOW_IF="((((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'ACTIVEMQ')) OR ((USE_CONNECTION == 'false') and (SERVER == 'ACTIVEMQ'))) and KEEPLISTENING == 'false' and USEMAX == 'true')">
|
||||
<DEFAULT>1000</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
@@ -111,12 +111,12 @@
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="FROM" FIELD="TEXT" SHOW="true" NUM_ROW="35"
|
||||
SHOW_IF="(SERVER == 'JBOSS') or (SERVER == 'ACTIVEMQ') or (USE_CONNECTION == 'true')">
|
||||
SHOW_IF="(((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER != 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER != 'WEBSPHERE')))">
|
||||
<DEFAULT>""</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="MSGTYPE" FIELD="CLOSED_LIST" NUM_ROW="35"
|
||||
SHOW_IF="(SERVER == 'JBOSS') or (SERVER == 'ACTIVEMQ') or (USE_CONNECTION == 'true')">
|
||||
SHOW_IF="(((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER != 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER != 'WEBSPHERE')))">
|
||||
<ITEMS DEFAULT="TOPIC">
|
||||
<ITEM NAME="TOPIC" VALUE="Topic" />
|
||||
<ITEM NAME="QUEUE" VALUE="Queue" />
|
||||
@@ -137,16 +137,16 @@
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="SCHEMA" FIELD="SCHEMA_TYPE" REQUIRED="true" NUM_ROW="45">
|
||||
<TABLE IF="((USE_CONNECTION == 'true') or (SERVER == 'JBOSS') or (SERVER == 'ACTIVEMQ'))" READONLY="false">
|
||||
<TABLE IF="(((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER != 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER != 'WEBSPHERE')))" READONLY="false">
|
||||
<COLUMN NAME="from" TYPE="id_String" LENGTH="255" READONLY="true" CUSTOM="true" />
|
||||
<COLUMN NAME="message" TYPE="id_String" LENGTH="255" CUSTOM="true" />
|
||||
</TABLE>
|
||||
<TABLE IF="(USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE') and (IS_USE_MESSAGE_ID == 'true')" READONLY="false">
|
||||
<TABLE IF="(((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER == 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE'))) and (IS_USE_MESSAGE_ID == 'true')" READONLY="false">
|
||||
<COLUMN NAME="from" TYPE="id_String" LENGTH="255" READONLY="true" CUSTOM="true" />
|
||||
<COLUMN NAME="messageid" TYPE="id_String" LENGTH="255" READONLY="true" CUSTOM="true" />
|
||||
<COLUMN NAME="message" TYPE="id_String" LENGTH="255" CUSTOM="true" />
|
||||
</TABLE>
|
||||
<TABLE IF="(USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE') and (IS_USE_MESSAGE_ID == 'false')" READONLY="false">
|
||||
<TABLE IF="(((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER == 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE'))) and (IS_USE_MESSAGE_ID == 'false')" READONLY="false">
|
||||
<COLUMN NAME="from" TYPE="id_String" LENGTH="255" READONLY="true" CUSTOM="true" />
|
||||
<COLUMN NAME="message" TYPE="id_String" LENGTH="255" CUSTOM="true" />
|
||||
</TABLE>
|
||||
@@ -165,27 +165,27 @@
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="QUEUE" FIELD="TEXT" NUM_ROW="50"
|
||||
SHOW_IF="(SERVER == 'WEBSPHERE') and (USE_CONNECTION == 'false')">
|
||||
SHOW_IF="(((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')))">
|
||||
<DEFAULT>""</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="IS_USE_MESSAGE_ID" FIELD="CHECK" REQUIRED="true" NUM_ROW="60"
|
||||
SHOW_IF="(USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE') AND (MESSAGE_BODY_TYPE != 'MAP')">
|
||||
SHOW_IF="(((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE'))) AND (MESSAGE_BODY_TYPE != 'MAP')">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="MSG_ID" FIELD="TEXT" NUM_ROW="70"
|
||||
SHOW_IF="(USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE') AND (IS_USE_MESSAGE_ID == 'true') AND (MESSAGE_BODY_TYPE != 'MAP')">
|
||||
SHOW_IF="(((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE'))) AND (IS_USE_MESSAGE_ID == 'true') AND (MESSAGE_BODY_TYPE != 'MAP')">
|
||||
<DEFAULT>""</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="COMMIT" FIELD="CHECK" REQUIRED="true" NUM_ROW="80"
|
||||
SHOW_IF="(USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE') AND (BROWSE == 'false')">
|
||||
SHOW_IF="(((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE'))) AND (BROWSE == 'false')">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="ROLLBACK" FIELD="CHECK" REQUIRED="true" NUM_ROW="90"
|
||||
SHOW_IF="(USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE') AND (KEEPLISTENING == 'false') AND (COMMIT == 'false') AND (BROWSE == 'false')">
|
||||
SHOW_IF="(((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE'))) AND (KEEPLISTENING == 'false') AND (COMMIT == 'false') AND (BROWSE == 'false')">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
@@ -202,7 +202,7 @@
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="BROWSE" FIELD="CHECK" REQUIRED="true" NUM_ROW="10"
|
||||
SHOW_IF="(USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE') AND (ROLLBACK == 'false') AND (COMMIT == 'false')">
|
||||
SHOW_IF="(((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE'))) AND (ROLLBACK == 'false') AND (COMMIT == 'false')">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
@@ -216,11 +216,11 @@
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="GET_JMS_HEADER" FIELD="CHECK" REQUIRED="false" NUM_ROW="40"
|
||||
SHOW_IF="(USE_CONNECTION == 'true') or (SERVER != 'WEBSPHERE')">
|
||||
SHOW_IF="(((USE_CONNECTION == 'true') AND (#LINK@NODE.CONNECTION.SERVER != 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER != 'WEBSPHERE')))">
|
||||
<DEFAULT>"false"</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="JMS_HEADERS" FIELD="TABLE" NB_LINES="3" REQUIRED="false" NUM_ROW="50"
|
||||
SHOW_IF="(GET_JMS_HEADER == 'true') AND ((USE_CONNECTION == 'true') or (SERVER != 'WEBSPHERE'))">
|
||||
SHOW_IF="(GET_JMS_HEADER == 'true') AND (((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER != 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER != 'WEBSPHERE')))">
|
||||
<ITEMS>
|
||||
<ITEM NAME="JMS_HEADER_NAME" FIELD="CLOSED_LIST">
|
||||
<ITEMS DEFAULT="JMSDESTINATION">
|
||||
@@ -241,11 +241,11 @@
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="GET_JMS_PROPERTIES" FIELD="CHECK" REQUIRED="false" NUM_ROW="60"
|
||||
SHOW_IF="(USE_CONNECTION == 'true') or (SERVER != 'WEBSPHERE')">
|
||||
SHOW_IF="(((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER != 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER != 'WEBSPHERE')))">
|
||||
<DEFAULT>"false"</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="JMS_PROPERTIES" FIELD="TABLE" NB_LINES="3" REQUIRED="false" NUM_ROW="65"
|
||||
SHOW_IF="(GET_JMS_PROPERTIES == 'true') AND ((USE_CONNECTION == 'true') or (SERVER != 'WEBSPHERE'))">
|
||||
SHOW_IF="(GET_JMS_PROPERTIES == 'true') AND (((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER != 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER != 'WEBSPHERE')))">
|
||||
<ITEMS>
|
||||
<ITEM NAME="JMS_PROPERTIES_NAME" FIELD="TEXT" />
|
||||
<ITEM NAME="JMS_PROPERTIES_TYPE" FIELD="CLOSED_LIST">
|
||||
@@ -266,11 +266,11 @@
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="GET_MQMD_FIELDS" FIELD="CHECK" REQUIRED="false" NUM_ROW="70"
|
||||
SHOW_IF="(USE_CONNECTION == 'false') or (SERVER == 'WEBSPHERE')">
|
||||
SHOW_IF="(((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')))">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="MQMD_FIELDS" FIELD="TABLE" NB_LINES="3" REQUIRED="false" NUM_ROW="75"
|
||||
SHOW_IF="(GET_MQMD_FIELDS == 'true') AND ((USE_CONNECTION == 'true') or (SERVER == 'WEBSPHERE'))">
|
||||
SHOW_IF="(GET_MQMD_FIELDS == 'true') AND (((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')))">
|
||||
<ITEMS>
|
||||
<ITEM NAME="MQMD_FIELD_NAME" FIELD="CLOSED_LIST">
|
||||
<ITEMS DEFAULT="ACCOUNTINGTOKEN">
|
||||
@@ -306,15 +306,15 @@
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="USE_MQ_HEADER" FIELD="CHECK" REQUIRED="false" NUM_ROW="80" GROUP="HEADERS"
|
||||
SHOW_IF="(USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')">
|
||||
SHOW_IF="(((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')))">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="USE_FIX_MQRFH2" FIELD="CHECK" REQUIRED="false" NUM_ROW="81" GROUP="HEADERS"
|
||||
SHOW_IF="(USE_MQ_HEADER=='true') AND ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE'))">
|
||||
SHOW_IF="(USE_MQ_HEADER=='true') AND (((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')))">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="MQRFH2_FIXED_FIELD" FIELD="TABLE" REQUIRED="false" NUM_ROW="82" GROUP="HEADERS"
|
||||
SHOW_IF="(USE_CONNECTION == 'false') and (USE_MQ_HEADER == 'true') AND (USE_FIX_MQRFH2=='true') AND (SERVER == 'WEBSPHERE')">
|
||||
SHOW_IF="(USE_MQ_HEADER == 'true') AND (USE_FIX_MQRFH2=='true') AND (((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')))">
|
||||
<ITEMS>
|
||||
<ITEM NAME="MQMD_FIELD_NAME" FIELD="CLOSED_LIST">
|
||||
<ITEMS DEFAULT="STRUC_ID">
|
||||
@@ -332,11 +332,11 @@
|
||||
</ITEMS>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="USE_MQRFH2_MCD" FIELD="CHECK" REQUIRED="false" NUM_ROW="83" GROUP="HEADERS"
|
||||
SHOW_IF="(USE_CONNECTION == 'false') and (USE_MQ_HEADER=='true') AND (SERVER == 'WEBSPHERE')">
|
||||
SHOW_IF="(USE_MQ_HEADER=='true') AND (((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')))">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="MQRFH2_MCD_FIELD" FIELD="TABLE" REQUIRED="false" NUM_ROW="84" GROUP="HEADERS"
|
||||
SHOW_IF="(USE_CONNECTION == 'false') and (USE_MQ_HEADER == 'true') AND (USE_MQRFH2_MCD=='true') AND (SERVER == 'WEBSPHERE')">
|
||||
SHOW_IF="(USE_MQ_HEADER == 'true') AND (USE_MQRFH2_MCD=='true') AND (((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')))">
|
||||
<ITEMS>
|
||||
<ITEM NAME="MQMD_FIELD_NAME" FIELD="CLOSED_LIST">
|
||||
<ITEMS DEFAULT="Type">
|
||||
@@ -350,11 +350,11 @@
|
||||
</ITEMS>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="USE_MQRFH2_JMS" FIELD="CHECK" REQUIRED="false" NUM_ROW="85" GROUP="HEADERS"
|
||||
SHOW_IF="(USE_CONNECTION == 'false') and (USE_MQ_HEADER=='true') AND (SERVER == 'WEBSPHERE')">
|
||||
SHOW_IF="(USE_MQ_HEADER=='true') AND (((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')))">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="MQRFH2_JMS_FIELD" FIELD="TABLE" REQUIRED="false" NUM_ROW="86" GROUP="HEADERS"
|
||||
SHOW_IF="(USE_CONNECTION == 'false') and (USE_MQ_HEADER == 'true') AND (USE_MQRFH2_JMS=='true') AND (SERVER == 'WEBSPHERE')">
|
||||
SHOW_IF="(USE_MQ_HEADER == 'true') AND (USE_MQRFH2_JMS=='true') AND (((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')))">
|
||||
<ITEMS>
|
||||
<ITEM NAME="MQMD_FIELD_NAME" FIELD="CLOSED_LIST" >
|
||||
<ITEMS DEFAULT="Destination">
|
||||
@@ -373,11 +373,11 @@
|
||||
</ITEMS>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="USE_MQRFH2_USR" FIELD="CHECK" REQUIRED="false" NUM_ROW="87" GROUP="HEADERS"
|
||||
SHOW_IF="(USE_CONNECTION == 'false') and (USE_MQ_HEADER=='true') AND (SERVER == 'WEBSPHERE')">
|
||||
SHOW_IF="(USE_MQ_HEADER=='true') AND (((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')))">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="MQRFH2_USR_FIELD" FIELD="TABLE" REQUIRED="false" NUM_ROW="88" GROUP="HEADERS"
|
||||
SHOW_IF="(USE_CONNECTION == 'false') and (USE_MQ_HEADER == 'true') AND (USE_MQRFH2_USR=='true') AND (SERVER == 'WEBSPHERE')">
|
||||
SHOW_IF="(USE_MQ_HEADER == 'true') AND (USE_MQRFH2_USR=='true') AND (((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')))">
|
||||
<ITEMS>
|
||||
<ITEM NAME="MQMD_FIELD_NAME" FIELD="TEXT" />
|
||||
<ITEM NAME="REFERENCE_COLUMN" FIELD="COLUMN_LIST" />
|
||||
@@ -385,11 +385,11 @@
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="SET_MQ_SSL_CIPHER" FIELD="CHECK" REQUIRED="false" NUM_ROW="95" GROUP="SSL"
|
||||
SHOW_IF="(USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')">
|
||||
SHOW_IF="(((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')))">
|
||||
<DEFAULT>"false"</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="MQ_SSL_CIPHER" FIELD="CLOSED_LIST" REQUIRED="false" NUM_ROW="96" GROUP="SSL"
|
||||
SHOW_IF="(USE_CONNECTION == 'false') and (SET_MQ_SSL_CIPHER == 'true') AND (SERVER == 'WEBSPHERE')">
|
||||
SHOW_IF="(SET_MQ_SSL_CIPHER == 'true') AND (((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')))">
|
||||
<ITEMS DEFAULT="NULL_MD5">
|
||||
<ITEM NAME="NULL_MD5" VALUE="SSL_RSA_WITH_NULL_MD5" />
|
||||
<ITEM NAME="NULL_SHA" VALUE="SSL_RSA_WITH_NULL_SHA" />
|
||||
|
||||
@@ -14,7 +14,7 @@ imports="
|
||||
INode node = (INode)codeGenArgument.getArgument();
|
||||
String cid = node.getUniqueName();
|
||||
cid = cid.replaceAll("_Loop", "");
|
||||
boolean isUseConnection = ("true").equals(ElementParameterParser.getValue(node, "__USE_CONNECTION__"));
|
||||
boolean isUseExistConnection = ("true").equals(ElementParameterParser.getValue(node, "__USE_CONNECTION__"));
|
||||
String connectionComponentName = ElementParameterParser.getValue(node, "__CONNECTION__");
|
||||
String serverType=ElementParameterParser.getValue(node, "__SERVER__");
|
||||
String host=ElementParameterParser.getValue(node, "__SERVERADDRESS__");
|
||||
@@ -42,15 +42,33 @@ imports="
|
||||
|
||||
boolean useMqHeader = "true".equals(ElementParameterParser.getValue(node, "__USE_MQ_HEADER__"));
|
||||
|
||||
boolean isCommitRollback = (!node.getProcess().getNodesOfType("tMomCommit").isEmpty()
|
||||
|| !node.getProcess().getNodesOfType("tMomRollback").isEmpty());
|
||||
List<? extends INode> commitNodes=node.getProcess().getNodesOfType("tMomCommit");
|
||||
List<? extends INode> rollBackNodes=node.getProcess().getNodesOfType("tMomRollback");
|
||||
|
||||
boolean isCommitRollback = false;
|
||||
for(INode cNode:commitNodes){
|
||||
String cNodeName = ElementParameterParser.getValue(cNode,"__CONNECTION__");
|
||||
if(cid.equals(cNodeName)){
|
||||
isCommitRollback = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!isCommitRollback){
|
||||
for(INode rNode:rollBackNodes){
|
||||
String rNodeName = ElementParameterParser.getValue(rNode,"__CONNECTION__");
|
||||
if(cid.equals(rNodeName)){
|
||||
isCommitRollback = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isUseConnection) {
|
||||
if (isUseExistConnection) {
|
||||
for (INode pNode : node.getProcess().getNodesOfType("tMomConnection")) {
|
||||
if (pNode.getUniqueName().equals(connectionComponentName)) {
|
||||
transacted = "true".equals(ElementParameterParser.getValue(pNode, "__IS_TRANSACTED__"));
|
||||
serverType = ElementParameterParser.getValue(pNode, "__SERVER__");
|
||||
failover = ("true").equals(ElementParameterParser.getValue(pNode, "__FAILOVER__"));
|
||||
failover = ("true").equals(ElementParameterParser.getValue(pNode, "__FAILOVER__"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -67,7 +85,7 @@ imports="
|
||||
javax.jms.Connection connection_<%=cid %> = null;
|
||||
try {
|
||||
|
||||
<% if (isUseConnection) { %>
|
||||
<% if (isUseExistConnection && ("ActiveMQ").equals(serverType)) { %>
|
||||
connection_<%=cid %> = null;
|
||||
javax.jms.Session session_<%=cid %> = null;
|
||||
try {
|
||||
@@ -165,7 +183,7 @@ imports="
|
||||
javax.jms.Message message_<%=cid%>;
|
||||
while ((message_<%=cid%> = consumer_<%=cid %>.receive(<%=receiveTimeOut%>*1000)) != null) {
|
||||
|
||||
<%if(("ActiveMQ").equals(serverType) /*&& !isUseConnection*/ && !isCommitRollback && transacted){%>
|
||||
<%if(("ActiveMQ").equals(serverType) /*&& !isUseExistConnection*/ && !isCommitRollback && transacted){%>
|
||||
try { // For rollback
|
||||
|
||||
<%
|
||||
@@ -211,7 +229,7 @@ imports="
|
||||
%>
|
||||
|
||||
|
||||
<%} else if (("JBoss").equals(serverType)||("ActiveMQ").equals(serverType)) {
|
||||
<%} else if (("JBoss").equals(serverType)||(!isUseExistConnection && ("ActiveMQ").equals(serverType))) {
|
||||
|
||||
/*---------------------------------------1.initial jms connection factry---------------------------------*/
|
||||
if(("JBoss").equals(serverType) ){ // server judgement
|
||||
@@ -389,7 +407,7 @@ imports="
|
||||
javax.jms.Message message_<%=cid%>;
|
||||
while ((message_<%=cid%> = consumer_<%=cid %>.receive()) != null) {
|
||||
|
||||
<%if(("ActiveMQ").equals(serverType) /*&& !isUseConnection*/ && !isCommitRollback && transacted){%>
|
||||
<%if(("ActiveMQ").equals(serverType) /*&& !isUseExistConnection*/ && !isCommitRollback && transacted){%>
|
||||
try { // For rollback
|
||||
|
||||
<%
|
||||
@@ -430,7 +448,7 @@ imports="
|
||||
javax.jms.Message message_<%=cid%>;
|
||||
while ((message_<%=cid%> = consumer_<%=cid %>.receive(<%=receiveTimeOut%>*1000)) != null) {
|
||||
|
||||
<%if(("ActiveMQ").equals(serverType) /*&& !isUseConnection*/ && !isCommitRollback && transacted){%>
|
||||
<%if(("ActiveMQ").equals(serverType) /*&& !isUseExistConnection*/ && !isCommitRollback && transacted){%>
|
||||
try { // For rollback
|
||||
<%
|
||||
}
|
||||
@@ -474,9 +492,44 @@ imports="
|
||||
%>
|
||||
|
||||
<%
|
||||
} else { //server judgement /***WebSphere MQ*****/
|
||||
String channel=ElementParameterParser.getValue(node, "__CHANNEL__");
|
||||
String qm=ElementParameterParser.getValue(node, "__QM__");
|
||||
} else if(("WebSphere").equals(serverType)){ //server judgement /***WebSphere MQ*****/
|
||||
%>
|
||||
com.ibm.mq.MQQueueManager qMgr_<%=cid%>=null;
|
||||
<%
|
||||
if(isUseExistConnection){
|
||||
String connection = ElementParameterParser.getValue(node, "__CONNECTION__");
|
||||
%>
|
||||
qMgr_<%=cid%> = (com.ibm.mq.MQQueueManager)globalMap.get("qMgr_<%=connection%>");
|
||||
globalMap.put("qMgr_<%=cid%>",qMgr_<%=cid%>);
|
||||
<%
|
||||
}else{
|
||||
String channel=ElementParameterParser.getValue(node, "__CHANNEL__");
|
||||
String qm=ElementParameterParser.getValue(node, "__QM__");
|
||||
%>
|
||||
java.util.Hashtable properties<%=cid%>=new java.util.Hashtable();
|
||||
properties<%=cid%>.put("hostname", <%=host%>);
|
||||
properties<%=cid%>.put("port", Integer.valueOf(<%=port%>));
|
||||
properties<%=cid%>.put("channel", <%=channel%>);
|
||||
properties<%=cid%>.put("CCSID", new Integer(1208));
|
||||
properties<%=cid%>.put("transport","MQSeries");
|
||||
<%
|
||||
if(!(dbuser == null) && !("\"\"").equals(dbuser) && !("").equals(dbuser)) {
|
||||
%>
|
||||
properties<%=cid%>.put("userID",<%=dbuser%>);
|
||||
<%
|
||||
String passwordFieldName = "__PASS__";
|
||||
%>
|
||||
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
|
||||
properties<%=cid%>.put("password",decryptedPassword_<%=cid%>);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
qMgr_<%=cid%>=new com.ibm.mq.MQQueueManager(<%=qm%>,properties<%=cid%>);
|
||||
globalMap.put("qMgr_<%=cid%>",qMgr_<%=cid%>);
|
||||
<%
|
||||
}
|
||||
String queue = ElementParameterParser.getValue(node, "__QUEUE__");
|
||||
boolean isRollback = ("true").equals(ElementParameterParser.getValue(node, "__ROLLBACK__"));
|
||||
boolean isCommit = ("true").equals(ElementParameterParser.getValue(node, "__COMMIT__"));
|
||||
@@ -486,36 +539,13 @@ imports="
|
||||
isCommit = isCommit && !isBrowse;
|
||||
isBrowse = isBrowse && !isRollback && !isCommit;
|
||||
%>
|
||||
java.util.Hashtable properties<%=cid%>=new java.util.Hashtable();
|
||||
properties<%=cid%>.put("hostname", <%=host%>);
|
||||
properties<%=cid%>.put("port", Integer.valueOf(<%=port%>));
|
||||
properties<%=cid%>.put("channel", <%=channel%>);
|
||||
properties<%=cid%>.put("CCSID", new Integer(1208));
|
||||
properties<%=cid%>.put("transport","MQSeries");
|
||||
com.ibm.mq.MQQueue remoteQ_<%=cid%>=null;
|
||||
<%
|
||||
if(needSSLCipher){
|
||||
%>
|
||||
com.ibm.mq.MQEnvironment.sslCipherSuite = "<%=sslCipher%>";
|
||||
<%
|
||||
}
|
||||
if(!(dbuser == null) && !("\"\"").equals(dbuser) && !("").equals(dbuser)) {
|
||||
%>
|
||||
properties<%=cid%>.put("userID",<%=dbuser%>);
|
||||
|
||||
<%
|
||||
String passwordFieldName = "__PASS__";
|
||||
%>
|
||||
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
|
||||
properties<%=cid%>.put("password",decryptedPassword_<%=cid%>);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
com.ibm.mq.MQQueueManager qMgr<%=cid%>=null;
|
||||
com.ibm.mq.MQQueue remoteQ<%=cid%>=null;
|
||||
<%
|
||||
if(("true").equals(useMsgId)){
|
||||
%>
|
||||
String msgId_<%=cid%> = <%=msgId%>;
|
||||
@@ -551,13 +581,12 @@ imports="
|
||||
com.ibm.mq.MQException.log = null;
|
||||
boolean flag<%=cid%>=true;
|
||||
|
||||
qMgr<%=cid%>=new com.ibm.mq.MQQueueManager(<%=qm%>,properties<%=cid%>);
|
||||
remoteQ<%=cid%>=qMgr<%=cid%>.accessQueue(<%=queue%>,openOptions<%=cid%>);
|
||||
remoteQ_<%=cid%>=qMgr_<%=cid%>.accessQueue(<%=queue%>,openOptions<%=cid%>);
|
||||
|
||||
<%
|
||||
if(("false").equals(kListen)) {
|
||||
%>
|
||||
if(Integer.valueOf(remoteQ<%=cid%>.getCurrentDepth()).equals(0))
|
||||
if(Integer.valueOf(remoteQ_<%=cid%>.getCurrentDepth()).equals(0))
|
||||
{
|
||||
flag<%=cid%>= false;
|
||||
}
|
||||
@@ -576,7 +605,7 @@ imports="
|
||||
<%
|
||||
if(("false").equals(kListen)){
|
||||
%>
|
||||
if(Integer.valueOf(remoteQ<%=cid%>.getCurrentDepth()).equals(1))
|
||||
if(Integer.valueOf(remoteQ_<%=cid%>.getCurrentDepth()).equals(1))
|
||||
{
|
||||
flag<%=cid%>= false;
|
||||
}
|
||||
@@ -603,7 +632,7 @@ imports="
|
||||
if(("false").equals(kListen) && ("true").equals(useMsgId) && !"Map".equals(msgBobyType) ){
|
||||
%>
|
||||
try{
|
||||
remoteQ<%=cid%>.get(inMessage<%=cid%>,gmo<%=cid%>);
|
||||
remoteQ_<%=cid%>.get(inMessage<%=cid%>,gmo<%=cid%>);
|
||||
}catch (com.ibm.mq.MQException me_<%=cid%>) {
|
||||
if (me_<%=cid%>.reasonCode == com.ibm.mq.MQException.MQRC_NO_MSG_AVAILABLE) {
|
||||
break;
|
||||
@@ -614,7 +643,7 @@ imports="
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
remoteQ<%=cid%>.get(inMessage<%=cid%>,gmo<%=cid%>);
|
||||
remoteQ_<%=cid%>.get(inMessage<%=cid%>,gmo<%=cid%>);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
@@ -648,7 +677,7 @@ imports="
|
||||
}
|
||||
if(isCommit){
|
||||
%>
|
||||
qMgr<%=cid%>.commit();
|
||||
qMgr_<%=cid%>.commit();
|
||||
<%
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
org.talend.core.model.process.INode
|
||||
org.talend.designer.codegen.config.CodeGeneratorArgument
|
||||
org.talend.core.model.process.ElementParameterParser
|
||||
|
||||
java.util.List
|
||||
"
|
||||
%>
|
||||
|
||||
@@ -10,7 +12,7 @@
|
||||
|
||||
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
|
||||
INode node = (INode)codeGenArgument.getArgument();
|
||||
boolean isUseConnection = ("true").equals(ElementParameterParser.getValue(node, "__USE_CONNECTION__"));
|
||||
boolean isUseExistConnection = ("true").equals(ElementParameterParser.getValue(node, "__USE_CONNECTION__"));
|
||||
String cid = node.getUniqueName();
|
||||
cid = cid.replaceAll("_Loop", "");
|
||||
String serverType=ElementParameterParser.getValue(node, "__SERVER__");
|
||||
@@ -21,24 +23,40 @@
|
||||
String msgBobyType = ElementParameterParser.getValue(node, "__MESSAGE_BODY_TYPE__");
|
||||
boolean transacted = "true".equals(ElementParameterParser.getValue(node, "__IS_TRANSACTED__"));
|
||||
String connectionComponentName = ElementParameterParser.getValue(node, "__CONNECTION__");
|
||||
|
||||
List<? extends INode> commitNodes=node.getProcess().getNodesOfType("tMomCommit");
|
||||
List<? extends INode> rollBackNodes=node.getProcess().getNodesOfType("tMomRollback");
|
||||
|
||||
boolean isCommitRollback = (!node.getProcess().getNodesOfType("tMomCommit").isEmpty()
|
||||
|| !node.getProcess().getNodesOfType("tMomRollback").isEmpty());
|
||||
boolean isCommitRollback = false;
|
||||
for(INode cNode:commitNodes){
|
||||
String cNodeName = ElementParameterParser.getValue(cNode,"__CONNECTION__");
|
||||
if(cid.equals(cNodeName)){
|
||||
isCommitRollback = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!isCommitRollback){
|
||||
for(INode rNode:rollBackNodes){
|
||||
String rNodeName = ElementParameterParser.getValue(rNode,"__CONNECTION__");
|
||||
if(cid.equals(rNodeName)){
|
||||
isCommitRollback = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
final boolean isLog4jEnabled = ("true").equals(ElementParameterParser.getValue(node.getProcess(), "__LOG4J_ACTIVATE__"));
|
||||
|
||||
|
||||
if (isUseConnection) {
|
||||
if (isUseExistConnection) {
|
||||
for (INode pNode : node.getProcess().getNodesOfType("tMomConnection")) {
|
||||
if (pNode.getUniqueName().equals(connectionComponentName)) {
|
||||
transacted = "true".equals(ElementParameterParser.getValue(pNode, "__IS_TRANSACTED__"));
|
||||
serverType=ElementParameterParser.getValue(pNode, "__SERVER__");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (("JBoss").equals(serverType) || ("ActiveMQ").equals(serverType) || isUseConnection) {
|
||||
if (("JBoss").equals(serverType) || ("ActiveMQ").equals(serverType)) {
|
||||
if ("CLIENT_ACKNOWLEDGE".equals(acknowledgmentMode)) {
|
||||
%>
|
||||
message_<%=cid%>.acknowledge();
|
||||
@@ -66,7 +84,7 @@
|
||||
break;
|
||||
<%
|
||||
}
|
||||
}else if(("ActiveMQ").equals(serverType) || isUseConnection) {
|
||||
}else if(("ActiveMQ").equals(serverType)) {
|
||||
if (("true").equals(ElementParameterParser.getValue(node,"__USEMAX__"))) {
|
||||
%>
|
||||
}
|
||||
@@ -121,7 +139,7 @@
|
||||
}
|
||||
<%}%>
|
||||
}
|
||||
<%if( ("ActiveMQ").equals(serverType) && !isCommitRollback && !isUseConnection){%>
|
||||
<%if( ("ActiveMQ").equals(serverType) && !isCommitRollback && !isUseExistConnection){%>
|
||||
<%
|
||||
if (isLog4jEnabled) {
|
||||
%>
|
||||
@@ -175,32 +193,44 @@
|
||||
|
||||
}
|
||||
<%
|
||||
if (isLog4jEnabled) {
|
||||
if (!isUseExistConnection && isLog4jEnabled && !isCommitRollback) {
|
||||
%>
|
||||
log.info("<%=cid%> - Closing connection...");
|
||||
log.info("<%=cid%> - Disconnecting connection...");
|
||||
<%
|
||||
}
|
||||
%>
|
||||
System.out.println("Closing connection");
|
||||
remoteQ<%=cid%>.close();
|
||||
System.out.println("Disconnecting queue...");
|
||||
<%
|
||||
if(isRollback){
|
||||
%>
|
||||
qMgr<%=cid%>.backout();
|
||||
qMgr_<%=cid%>.backout();
|
||||
<%
|
||||
}
|
||||
%>
|
||||
qMgr<%=cid%>.disconnect();
|
||||
<%
|
||||
if (isLog4jEnabled) {
|
||||
remoteQ_<%=cid%>.close();
|
||||
<%
|
||||
if(!isUseExistConnection && !isCommitRollback){
|
||||
%>
|
||||
log.info("<%=cid%> - Closed successfully.");
|
||||
System.out.println("Disconnecting queue manager...");
|
||||
qMgr_<%=cid%>.disconnect();
|
||||
<%
|
||||
}
|
||||
if (!isUseExistConnection && isLog4jEnabled && !isCommitRollback) {
|
||||
%>
|
||||
log.info("<%=cid%> - Disconnected successfully.");
|
||||
<%
|
||||
}
|
||||
%>
|
||||
}catch(com.ibm.mq.MQException ex){
|
||||
System.out.println("A WebSphere MQ error occurred : Completion code " + ex.completionCode + " Reason code " + ex.reasonCode);
|
||||
remoteQ<%=cid%>.close();
|
||||
<%
|
||||
if(!isUseExistConnection){
|
||||
%>
|
||||
System.out.println("Disconnecting queue...");
|
||||
remoteQ_<%=cid%>.close();
|
||||
<%
|
||||
}
|
||||
%>
|
||||
}
|
||||
<%
|
||||
}
|
||||
@@ -208,7 +238,7 @@
|
||||
|
||||
} finally {
|
||||
// System.out.println("close connection after loop!");
|
||||
<%if( ("ActiveMQ").equals(serverType) && !isUseConnection){%>
|
||||
<%if( ("ActiveMQ").equals(serverType) && !isUseExistConnection){%>
|
||||
<%
|
||||
if (isLog4jEnabled) {
|
||||
%>
|
||||
|
||||
@@ -253,20 +253,26 @@
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="JBOSS REMOTING" MODULE="jboss-remoting.jar" UrlPath="platform:/plugin/org.talend.libraries.jboss/lib/jboss-remoting.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="JNP-CLIENT" MODULE="jnp-client.jar" REQUIRED="true" />
|
||||
|
||||
<!-- ActiveMQ -->
|
||||
<IMPORT NAME="ACTIVEMQ LIB" MODULE="activemq-all-5.10.0.jar" UrlPath="platform:/plugin/org.talend.libraries.apache/lib/activemq-all-5.10.0.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'ACTIVEMQ')" />
|
||||
|
||||
<!-- JBOSS -->
|
||||
<IMPORT NAME="JAVA_SSIST" MODULE="javassist.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'JBOSS')" />
|
||||
<IMPORT NAME="TROVE" MODULE="trove.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'JBOSS')" />
|
||||
<IMPORT NAME="JBOSS MDR" MODULE="jboss-mdr.jar" UrlPath="platform:/plugin/org.talend.libraries.jboss/lib/jboss-mdr.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'JBOSS')" />
|
||||
<IMPORT NAME="JNP-CLIENT" MODULE="jnp-client.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'JBOSS')" />
|
||||
<IMPORT NAME="JBOSS COMMON" MODULE="jboss-common-core.jar" UrlPath="platform:/plugin/org.talend.libraries.jboss/lib/jboss-common-core.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'JBOSS')" />
|
||||
<IMPORT NAME="JBOSS AOP" MODULE="jboss-aop.jar" UrlPath="platform:/plugin/org.talend.libraries.jboss/lib/jboss-aop.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'JBOSS')" />
|
||||
<IMPORT NAME="JBOSS REMOTING" MODULE="jboss-remoting.jar" UrlPath="platform:/plugin/org.talend.libraries.jboss/lib/jboss-remoting.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'JBOSS')" />
|
||||
<IMPORT NAME="JBOSS MESSAGING CLIENT" MODULE="jboss-messaging-client.jar" UrlPath="platform:/plugin/org.talend.libraries.jboss/lib/jboss-messaging-client.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'JBOSS')" />
|
||||
<IMPORT NAME="JBOSS MQ LIB" MODULE="jbossall-client.jar" UrlPath="platform:/plugin/org.talend.libraries.jboss/lib/jbossall-client.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'JBOSS')" />
|
||||
<IMPORT NAME="LOG4J" MODULE="log4j-1.2.15.jar" UrlPath="platform:/base/plugins/org.apache.log4j_1.2.15.v201012070815.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'JBOSS')" />
|
||||
|
||||
<!-- Websphere MQ -->
|
||||
<IMPORT NAME="WEBSPHERE MQ LIB" MODULE="com.ibm.mq.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'WEBSPHERE')" />
|
||||
<IMPORT NAME="WEBSPHERE JMS LIB" MODULE="com.ibm.mqjms.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'WEBSPHERE')" />
|
||||
<IMPORT NAME="WEBSPHERE CONNECTOR" MODULE="websphere-connector-1_5.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'WEBSPHERE')" />
|
||||
<IMPORT NAME="ACTIVEMQ LIB" MODULE="activemq-all-5.10.0.jar" UrlPath="platform:/plugin/org.talend.libraries.apache/lib/activemq-all-5.10.0.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'ACTIVEMQ')" />
|
||||
<IMPORT NAME="JBOSS MESSAGING CLIENT" MODULE="jboss-messaging-client.jar" UrlPath="platform:/plugin/org.talend.libraries.jboss/lib/jboss-messaging-client.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="JBOSS AOP" MODULE="jboss-aop.jar" UrlPath="platform:/plugin/org.talend.libraries.jboss/lib/jboss-aop.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="JBOSS COMMON" MODULE="jboss-common-core.jar" UrlPath="platform:/plugin/org.talend.libraries.jboss/lib/jboss-common-core.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="JBOSS MDR" MODULE="jboss-mdr.jar" UrlPath="platform:/plugin/org.talend.libraries.jboss/lib/jboss-mdr.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="JAVA_SSIST" MODULE="javassist.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="TROVE" MODULE="trove.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="LOG4J" MODULE="log4j-1.2.15.jar" UrlPath="platform:/base/plugins/org.apache.log4j_1.2.15.v201012070815.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'JBOSS')" />
|
||||
<IMPORT NAME="TALENDMQRFH2" MODULE="talendMQRFH2.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'WEBSPHERE')" />
|
||||
<IMPORT NAME="Java Message Service" MODULE="jms.jar" UrlPath="platform:/plugin/org.talend.libraries.esb.ext/lib/jms.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'WEBSPHERE')" />
|
||||
</IMPORTS>
|
||||
|
||||
@@ -7,6 +7,7 @@ imports="
|
||||
org.talend.core.model.process.IConnection
|
||||
org.talend.designer.codegen.config.CodeGeneratorArgument
|
||||
org.talend.core.model.process.IConnectionCategory
|
||||
org.talend.core.model.utils.NodeUtil
|
||||
java.util.List
|
||||
"
|
||||
class="MomInput"
|
||||
@@ -17,9 +18,16 @@ class="MomInput"
|
||||
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
|
||||
INode node = (INode)codeGenArgument.getArgument();
|
||||
String cid = node.getUniqueName();
|
||||
boolean isExistConnection = ("true").equals(ElementParameterParser.getValue(node, "__USE_CONNECTION__"));
|
||||
String connection = ElementParameterParser.getValue(node, "__CONNECTION__");
|
||||
String serverType=ElementParameterParser.getValue(node, "__SERVER__");
|
||||
if(isExistConnection){
|
||||
INode connectionComponent = NodeUtil.getNodeByUniqueName(node.getProcess(),connection);
|
||||
serverType=ElementParameterParser.getValue(connectionComponent, "__SERVER__");
|
||||
}
|
||||
String host=ElementParameterParser.getValue(node, "__SERVERADDRESS__");
|
||||
String port=ElementParameterParser.getValue(node, "__SERVERPORT__");
|
||||
String dbuser= ElementParameterParser.getValue(node, "__USER__");
|
||||
final boolean isLog4jEnabled = ("true").equals(ElementParameterParser.getValue(node.getProcess(), "__LOG4J_ACTIVATE__"));
|
||||
|
||||
IMetadataTable metadata=null;
|
||||
@@ -30,198 +38,47 @@ class="MomInput"
|
||||
|
||||
%>
|
||||
int nb_line_<%=cid%> = 0;
|
||||
<%
|
||||
if(("JBoss").equals(serverType)){ // server judgement
|
||||
String msgType = ElementParameterParser.getValue(node, "__MSGTYPE__");
|
||||
String from=ElementParameterParser.getValue(node, "__FROM__");
|
||||
|
||||
%>
|
||||
class HelloInput implements javax.jms.MessageListener {
|
||||
javax.jms.<%=msgType%>Connection connection<%=cid%>;
|
||||
javax.jms.<%=msgType%>Session session<%=cid%>;
|
||||
javax.jms.<%=msgType%> topic<%=cid%>;
|
||||
java.util.Queue<String> msgQueue<%=cid%>=null;
|
||||
<%
|
||||
if (isLog4jEnabled) {
|
||||
%>
|
||||
private static org.apache.log4j.Logger log = null;
|
||||
<%
|
||||
}
|
||||
%>
|
||||
public HelloInput(String factoryJNDI, String topicJNDI) throws javax.jms.JMSException, javax.naming.NamingException{
|
||||
msgQueue<%=cid%>=new java.util.LinkedList<String>();
|
||||
java.util.Hashtable props<%=cid%>=new java.util.Hashtable();
|
||||
props<%=cid%>.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
|
||||
props<%=cid%>.put(javax.naming.Context.PROVIDER_URL, <%=host%>+":"+<%=port%>);
|
||||
props<%=cid%>.put("java.naming.rmi.security.manager", "yes");
|
||||
props<%=cid%>.put(javax.naming.Context.URL_PKG_PREFIXES, "org.jboss.naming");
|
||||
props<%=cid%>.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
|
||||
javax.naming.Context context<%=cid%>=new javax.naming.InitialContext(props<%=cid%>);
|
||||
javax.jms.<%=msgType%>ConnectionFactory factory<%=cid%>=(javax.jms.<%=msgType%>ConnectionFactory)context<%=cid%>.lookup(factoryJNDI);
|
||||
<%
|
||||
if(isLog4jEnabled){
|
||||
%>
|
||||
log.info("<%=cid%> - Attempt to create <%=msgType%> connection...;
|
||||
<%
|
||||
}
|
||||
%>
|
||||
connection<%=cid%>=factory<%=cid%>.create<%=msgType%>Connection();
|
||||
<%
|
||||
if(isLog4jEnabled){
|
||||
%>
|
||||
log.info("<%=cid%> - Created successfully.");
|
||||
log.info("<%=cid%> - Creating a <%=msgType%> session...");
|
||||
<%
|
||||
}
|
||||
%>
|
||||
session<%=cid%>=connection<%=cid%>.create<%=msgType%>Session(false, javax.jms.Session.AUTO_ACKNOWLEDGE);
|
||||
<%
|
||||
if(isLog4jEnabled){
|
||||
%>
|
||||
log.info("<%=cid%> - Created successfully.");
|
||||
<%
|
||||
}
|
||||
%>
|
||||
topic<%=cid%>=(javax.jms.<%=msgType%>)context<%=cid%>.lookup(topicJNDI);
|
||||
|
||||
<%
|
||||
if(("Queue").equals(msgType)){
|
||||
%>
|
||||
javax.jms.<%=msgType%>Receiver receiver<%=cid%>=session<%=cid%>.createReceiver(topic<%=cid%>);
|
||||
receiver<%=cid%>.setMessageListener(this);
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
javax.jms.<%=msgType%>Subscriber subscriber<%=cid%>=session<%=cid%>.createSubscriber(topic<%=cid%>);
|
||||
subscriber<%=cid%>.setMessageListener(this);
|
||||
<%
|
||||
}
|
||||
if(isLog4jEnabled){
|
||||
%>
|
||||
log.info("<%=cid%> - Activating the connection...");
|
||||
<%
|
||||
}
|
||||
%>
|
||||
connection<%=cid%>.start();
|
||||
<%
|
||||
if(isLog4jEnabled){
|
||||
%>
|
||||
log.info("<%=cid%> - Activated successfully.");
|
||||
<%
|
||||
}
|
||||
%>
|
||||
}
|
||||
|
||||
public void onMessage(javax.jms.Message m){
|
||||
try {
|
||||
String msg<%=cid%>=((javax.jms.TextMessage)m).getText();
|
||||
msgQueue<%=cid%>.add(msg<%=cid%>);
|
||||
} catch (javax.jms.JMSException e) {
|
||||
<%
|
||||
if(isLog4jEnabled){
|
||||
%>
|
||||
log.error("<%=cid%> - Could not get text message:" + e);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
System.err.println("Could not get text message:" + e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void close() throws javax.jms.JMSException{
|
||||
<%
|
||||
if (isLog4jEnabled) {
|
||||
%>
|
||||
log.info("<%=cid%> - Closing connection...");
|
||||
<%
|
||||
}
|
||||
%>
|
||||
session<%=cid%>.close();
|
||||
connection<%=cid%>.close();
|
||||
<%
|
||||
if (isLog4jEnabled) {
|
||||
%>
|
||||
log.info("<%=cid%> - Closed successfully.");
|
||||
<%
|
||||
}
|
||||
%>
|
||||
}
|
||||
<%
|
||||
if (isLog4jEnabled) {
|
||||
%>
|
||||
public void setLog(org.apache.log4j.Logger log){
|
||||
this.log=log;
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
}
|
||||
|
||||
HelloInput input<%=cid%>=null;
|
||||
try {
|
||||
//begin part
|
||||
input<%=cid%>=new HelloInput("<%if(("Topic").equals(msgType)){%>TopicConnectionFactory<%}else{%>ConnectionFactory<%}%>",<%=from%>);
|
||||
} catch (java.lang.Exception e) {
|
||||
<%
|
||||
if(isLog4jEnabled){
|
||||
%>
|
||||
log.error("<%=cid%> - An exception occurred while testing HelloSubscriber:" + e);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
System.err.println("An exception occurred while testing HelloSubscriber:" + e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
<%
|
||||
if(isLog4jEnabled){
|
||||
%>
|
||||
log.info("<%=cid%> - Ready to receive message.");
|
||||
log.info("<%=cid%> - Waiting...");
|
||||
<%
|
||||
}
|
||||
%>
|
||||
System.out.println("Ready to receive message");
|
||||
System.out.println("Waiting...");
|
||||
|
||||
Boolean flag<%=cid%>=true;
|
||||
while(flag<%=cid%>){
|
||||
while(!(input<%=cid%>.msgQueue<%=cid%>.size()==0)){
|
||||
String msg<%=cid%>=(String)input<%=cid%>.msgQueue<%=cid%>.poll();
|
||||
|
||||
<%
|
||||
List< ? extends IConnection> conns = node.getOutgoingSortedConnections();
|
||||
List<IMetadataColumn> columnList = metadata.getListColumns();
|
||||
for(IConnection conn:conns){
|
||||
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.MAIN)) {
|
||||
String firstConnName = conn.getName();
|
||||
%>
|
||||
|
||||
<%=firstConnName%>.from=<%=from%>;
|
||||
<%=firstConnName%>.message=msg<%=cid%>;
|
||||
|
||||
<%
|
||||
}
|
||||
}
|
||||
} //server judgement /***WebSphere MQ*****/
|
||||
else{
|
||||
String channel=ElementParameterParser.getValue(node, "__CHANNEL__");
|
||||
String qm=ElementParameterParser.getValue(node, "__QM__");
|
||||
String queue = ElementParameterParser.getValue(node, "__QUEUE__");
|
||||
String idMask = ElementParameterParser.getValue(node, "__IDMASK__");
|
||||
%>
|
||||
java.util.List<String> idList_<%=cid%> = new java.util.ArrayList<String>();
|
||||
|
||||
java.util.Hashtable properties_<%=cid%>=new java.util.Hashtable();
|
||||
properties_<%=cid%>.put("hostname", <%=host%>);
|
||||
properties_<%=cid%>.put("port", Integer.valueOf(<%=port%>));
|
||||
properties_<%=cid%>.put("channel", <%=channel%>);
|
||||
properties_<%=cid%>.put("CCSID", new Integer(1208));
|
||||
properties_<%=cid%>.put("transport","MQSeries");
|
||||
|
||||
<%
|
||||
if(("WebSphere").equals(serverType)){
|
||||
%>
|
||||
com.ibm.mq.MQQueueManager qMgr_<%=cid%>=null;
|
||||
com.ibm.mq.MQQueue remoteQ_<%=cid%>=null;
|
||||
try{
|
||||
java.util.List<String> idList_<%=cid%> = new java.util.ArrayList<String>();
|
||||
try{
|
||||
<%
|
||||
if(isExistConnection){
|
||||
%>
|
||||
qMgr_<%=cid%> = (com.ibm.mq.MQQueueManager)globalMap.get("qMgr_<%=connection%>");
|
||||
<%
|
||||
}else{
|
||||
String channel=ElementParameterParser.getValue(node, "__CHANNEL__");
|
||||
String qm=ElementParameterParser.getValue(node, "__QM__");
|
||||
%>
|
||||
java.util.Hashtable properties_<%=cid%>=new java.util.Hashtable();
|
||||
properties_<%=cid%>.put("hostname", <%=host%>);
|
||||
properties_<%=cid%>.put("port", Integer.valueOf(<%=port%>));
|
||||
properties_<%=cid%>.put("channel", <%=channel%>);
|
||||
properties_<%=cid%>.put("CCSID", new Integer(1208));
|
||||
properties_<%=cid%>.put("transport","MQSeries");
|
||||
<%
|
||||
if(!(dbuser == null) && !("\"\"").equals(dbuser) && !("").equals(dbuser)) {
|
||||
%>
|
||||
properties_<%=cid%>.put("userID",<%=dbuser%>);
|
||||
<%
|
||||
String passwordFieldName = "__PASS__";
|
||||
%>
|
||||
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
|
||||
properties_<%=cid%>.put("password",decryptedPassword_<%=cid%>);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
qMgr_<%=cid%>=new com.ibm.mq.MQQueueManager(<%=qm%>,properties_<%=cid%>);
|
||||
<%
|
||||
}
|
||||
String queue = ElementParameterParser.getValue(node, "__QUEUE__");
|
||||
%>
|
||||
int openOptions_<%=cid%>=com.ibm.mq.MQC.MQOO_FAIL_IF_QUIESCING | com.ibm.mq.MQC.MQOO_INPUT_AS_Q_DEF;
|
||||
|
||||
com.ibm.mq.MQGetMessageOptions gmo_<%=cid%>=new com.ibm.mq.MQGetMessageOptions();
|
||||
@@ -238,8 +95,7 @@ class="MomInput"
|
||||
log.info("<%=cid%> - Waiting...");
|
||||
<%
|
||||
}
|
||||
%>
|
||||
qMgr_<%=cid%>=new com.ibm.mq.MQQueueManager(<%=qm%>,properties_<%=cid%>);
|
||||
%>
|
||||
while(flag_<%=cid%>){
|
||||
remoteQ_<%=cid%>=qMgr_<%=cid%>.accessQueue(<%=queue%>,openOptions_<%=cid%>);
|
||||
com.ibm.mq.MQMessage inMessage_<%=cid%>=new com.ibm.mq.MQMessage();
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
org.talend.core.model.process.INode
|
||||
org.talend.designer.codegen.config.CodeGeneratorArgument
|
||||
org.talend.core.model.process.ElementParameterParser
|
||||
org.talend.core.model.utils.NodeUtil
|
||||
"
|
||||
%>
|
||||
|
||||
@@ -10,26 +11,24 @@
|
||||
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
|
||||
INode node = (INode)codeGenArgument.getArgument();
|
||||
String cid = node.getUniqueName();
|
||||
boolean isExistConnection = ("true").equals(ElementParameterParser.getValue(node, "__USE_CONNECTION__"));
|
||||
String connection = ElementParameterParser.getValue(node, "__CONNECTION__");
|
||||
String serverType=ElementParameterParser.getValue(node, "__SERVER__");
|
||||
String timeOut=ElementParameterParser.getValue(node, "__TIMEOUT__");
|
||||
if(isExistConnection){
|
||||
INode connectionComponent = NodeUtil.getNodeByUniqueName(node.getProcess(),connection);
|
||||
serverType=ElementParameterParser.getValue(connectionComponent, "__SERVER__");
|
||||
}
|
||||
final boolean isLog4jEnabled = ("true").equals(ElementParameterParser.getValue(node.getProcess(), "__LOG4J_ACTIVATE__"));
|
||||
if(("JBoss").equals(serverType)){
|
||||
%>
|
||||
|
||||
}
|
||||
flag<%=cid%>=false;
|
||||
input<%=cid%>.close();
|
||||
}
|
||||
<%
|
||||
}else{
|
||||
|
||||
if(("WebSphere").equals(serverType)){
|
||||
%>
|
||||
}
|
||||
<%
|
||||
}
|
||||
if (isLog4jEnabled) {
|
||||
%>
|
||||
log.info("<%=cid%> - Retrieved records count: "+ nb_line_<%=cid%> + " .");
|
||||
<%
|
||||
}
|
||||
%>
|
||||
if (isLog4jEnabled) {
|
||||
%>
|
||||
log.info("<%=cid%> - Retrieved records count: "+ nb_line_<%=cid%> + " .");
|
||||
<%
|
||||
}
|
||||
%>
|
||||
globalMap.put("<%=cid %>_NB_LINE",nb_line_<%=cid %>);
|
||||
@@ -34,74 +34,58 @@
|
||||
</CONNECTORS>
|
||||
|
||||
<PARAMETERS>
|
||||
|
||||
<!-- PARAMETER NAME="KEEPLISTENING" FIELD="CHECK" SHOW="true" NUM_ROW="10">
|
||||
<DEFAULT IF="(SERVER == 'JBOSS')">true</DEFAULT>
|
||||
<DEFAULT IF="(SERVER == 'WEBSPHERE')">false</DEFAULT>
|
||||
</PARAMETER -->
|
||||
|
||||
<PARAMETER NAME="TIMEOUT" FIELD="TEXT" NUM_ROW="10"
|
||||
SHOW_IF="(SERVER == 'JBOSS' and KEEPLISTENING == 'TRUE')">
|
||||
<DEFAULT>1</DEFAULT>
|
||||
|
||||
<PARAMETER NAME="USE_CONNECTION" FIELD="CHECK" NUM_ROW="1">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="CONNECTION" FIELD="COMPONENT_LIST" REQUIRED="true" FILTER="tMomConnection" NUM_ROW="1"
|
||||
SHOW_IF="USE_CONNECTION == 'true'" DYNAMIC_SETTINGS="true" />
|
||||
|
||||
<PARAMETER NAME="NOTE_CUSTOMER" FIELD="LABEL" NUM_ROW="2" COLOR="255;0;0"
|
||||
SHOW_IF="((USE_CONNECTION == 'true') AND (#LINK@NODE.CONNECTION.SERVER != 'WEBSPHERE'))">
|
||||
<DEFAULT>Connection server type is incorrect!
|
||||
This component only support Websphere MQ currently!
|
||||
</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="SERVER" FIELD="CLOSED_LIST" NUM_ROW="20">
|
||||
<PARAMETER NAME="SERVER" FIELD="CLOSED_LIST" NUM_ROW="20" SHOW_IF="(USE_CONNECTION == 'false')">
|
||||
<ITEMS DEFAULT="WEBSPHERE">
|
||||
<ITEM NAME="WEBSPHERE" VALUE="WebSphere" />
|
||||
<!-- ITEM NAME="JBOSS" VALUE="JBoss" / -->
|
||||
</ITEMS>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="SERVERADDRESS" FIELD="TEXT" NUM_ROW="20">
|
||||
<PARAMETER NAME="SERVERADDRESS" FIELD="TEXT" NUM_ROW="20" SHOW_IF="(USE_CONNECTION == 'false')">
|
||||
<DEFAULT>"localhost"</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="SERVERPORT" FIELD="TEXT" NUM_ROW="20">
|
||||
<DEFAULT IF="(SERVER == 'JBOSS')">"1099"</DEFAULT>
|
||||
<PARAMETER NAME="SERVERPORT" FIELD="TEXT" NUM_ROW="20" SHOW_IF="(USE_CONNECTION == 'false')">
|
||||
<DEFAULT IF="(SERVER == 'WEBSPHERE')">"1414"</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="FROM" FIELD="TEXT" SHOW="true" NUM_ROW="30"
|
||||
SHOW_IF="(SERVER == 'JBOSS')">
|
||||
<DEFAULT>""</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="MSGTYPE" FIELD="CLOSED_LIST" NUM_ROW="30"
|
||||
SHOW_IF="(SERVER == 'JBOSS')">
|
||||
<ITEMS DEFAULT="TOPIC">
|
||||
<ITEM NAME="TOPIC" VALUE="Topic" />
|
||||
<ITEM NAME="QUEUE" VALUE="Queue" />
|
||||
</ITEMS>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="CHANNEL" FIELD="TEXT" NUM_ROW="30"
|
||||
SHOW_IF="(SERVER == 'WEBSPHERE')">
|
||||
SHOW_IF="(USE_CONNECTION == 'false') AND (SERVER == 'WEBSPHERE')">
|
||||
<DEFAULT>"DC.SVRCONN"</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="QM" FIELD="TEXT" NUM_ROW="50"
|
||||
SHOW_IF="(SERVER == 'WEBSPHERE')">
|
||||
SHOW_IF="(USE_CONNECTION == 'false') AND (SERVER == 'WEBSPHERE')">
|
||||
<DEFAULT>""</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="QUEUE" FIELD="TEXT" NUM_ROW="50"
|
||||
SHOW_IF="(SERVER == 'WEBSPHERE')">
|
||||
SHOW_IF="(((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')))">
|
||||
<DEFAULT>""</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<!-- PARAMETER NAME="IDMASK" FIELD="TEXT" NUM_ROW="60">
|
||||
<DEFAULT>""</DEFAULT>
|
||||
</PARAMETER -->
|
||||
|
||||
</PARAMETERS>
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="JBOSSALL-CLIENT" MODULE="jbossall-client.jar" UrlPath="platform:/plugin/org.talend.libraries.jboss/lib/jbossall-client.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="JNP-CLIENT" MODULE="jnp-client.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="MQ" MODULE="com.ibm.mq.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="MQJMS" MODULE="com.ibm.mqjms.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="Java Message Service" MODULE="jms.jar" UrlPath="platform:/plugin/org.talend.libraries.esb.ext/lib/jms.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="MQ" MODULE="com.ibm.mq.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'WEBSPHERE')" />
|
||||
<IMPORT NAME="MQJMS" MODULE="com.ibm.mqjms.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'WEBSPHERE')" />
|
||||
<IMPORT NAME="WEBSPHERE CONNECTOR" MODULE="websphere-connector-1_5.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'WEBSPHERE')" />
|
||||
<IMPORT NAME="Java Message Service" MODULE="jms.jar" UrlPath="platform:/plugin/org.talend.libraries.esb.ext/lib/jms.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'WEBSPHERE')" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
|
||||
@@ -22,4 +22,7 @@ TIMEOUT.NAME=Sleeping time (in sec)
|
||||
MSG_ID.NAME=Message id
|
||||
IDMASK.NAME=Id mask
|
||||
|
||||
CURRENT_MESSAGE_ID.NAME=Current Message ID
|
||||
CURRENT_MESSAGE_ID.NAME=Current Message ID
|
||||
|
||||
USE_CONNECTION.NAME = Use existing connection
|
||||
CONNECTION.NAME = Connection
|
||||
@@ -15,7 +15,7 @@ class="MomInput"
|
||||
INode node = (INode)codeGenArgument.getArgument();
|
||||
String cid = node.getUniqueName();
|
||||
|
||||
boolean isUseSharedConnection = ("true").equals(ElementParameterParser.getValue(node, "__USE_CONNECTION__"));
|
||||
boolean isUseExistConnection = ("true").equals(ElementParameterParser.getValue(node, "__USE_CONNECTION__"));
|
||||
String connectionComponentName = ElementParameterParser.getValue(node, "__CONNECTION__");
|
||||
|
||||
String serverType=ElementParameterParser.getValue(node, "__SERVER__");
|
||||
@@ -48,10 +48,28 @@ class="MomInput"
|
||||
metadata = metadatas.get(0);
|
||||
}
|
||||
|
||||
boolean isCommitRollback = (!node.getProcess().getNodesOfType("tMomCommit").isEmpty()
|
||||
|| !node.getProcess().getNodesOfType("tMomRollback").isEmpty());
|
||||
List<? extends INode> commitNodes=node.getProcess().getNodesOfType("tMomCommit");
|
||||
List<? extends INode> rollBackNodes=node.getProcess().getNodesOfType("tMomRollback");
|
||||
|
||||
if (isUseSharedConnection) {
|
||||
boolean isCommitRollback = false;
|
||||
for(INode cNode:commitNodes){
|
||||
String cNodeName = ElementParameterParser.getValue(cNode,"__CONNECTION__");
|
||||
if(cid.equals(cNodeName)){
|
||||
isCommitRollback = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!isCommitRollback){
|
||||
for(INode rNode:rollBackNodes){
|
||||
String rNodeName = ElementParameterParser.getValue(rNode,"__CONNECTION__");
|
||||
if(cid.equals(rNodeName)){
|
||||
isCommitRollback = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isUseExistConnection) {
|
||||
for (INode pNode : node.getProcess().getNodesOfType("tMomConnection")) {
|
||||
if (pNode.getUniqueName().equals(connectionComponentName)) {
|
||||
transacted = "true".equals(ElementParameterParser.getValue(pNode, "__IS_TRANSACTED__"));
|
||||
@@ -65,7 +83,7 @@ class="MomInput"
|
||||
int nb_line_<%=cid%> = 0;
|
||||
|
||||
<%
|
||||
if (isUseSharedConnection) {
|
||||
if (isUseExistConnection && ("ActiveMQ").equals(serverType)) {
|
||||
%>
|
||||
javax.jms.Connection connection_<%=cid %> = null;
|
||||
javax.jms.Session session_<%=cid %> = null;
|
||||
@@ -295,49 +313,58 @@ class="MomInput"
|
||||
log.info("<%=cid%> - Start to produce " + (<%=!("Queue").equals(msgType)%> ? "topic" : "queue") + ": " + <%=to %>);
|
||||
<%
|
||||
}
|
||||
}else{ //server judgement /***WebSphere MQ*****/
|
||||
String channel=ElementParameterParser.getValue(node, "__CHANNEL__");
|
||||
String qm=ElementParameterParser.getValue(node, "__QM__");
|
||||
} else if(("WebSphere").equals(serverType)){ //server judgement /***WebSphere MQ*****/
|
||||
%>
|
||||
com.ibm.mq.MQQueueManager qMgr_<%=cid%>=null;
|
||||
<%
|
||||
String queue = ElementParameterParser.getValue(node, "__QUEUE__");
|
||||
boolean needSSLCipher = ("true").equals(ElementParameterParser.getValue(node,"__SET_MQ_SSL_CIPHER__"));
|
||||
String sslCipher = ElementParameterParser.getValue(node, "__MQ_SSL_CIPHER__");
|
||||
%>
|
||||
props_<%=cid%>.put("hostname", <%=host%>);
|
||||
props_<%=cid%>.put("port", Integer.valueOf(<%=port%>));
|
||||
props_<%=cid%>.put("channel", <%=channel%>);
|
||||
props_<%=cid%>.put("CCSID", new Integer(1208));
|
||||
props_<%=cid%>.put("transport", "MQSeries");
|
||||
|
||||
<%
|
||||
if(isUseExistConnection){
|
||||
String connection = ElementParameterParser.getValue(node, "__CONNECTION__");
|
||||
%>
|
||||
qMgr_<%=cid%> = (com.ibm.mq.MQQueueManager)globalMap.get("qMgr_<%=connection%>");
|
||||
globalMap.put("qMgr_<%=cid%>",qMgr_<%=cid%>);
|
||||
<%
|
||||
}else{
|
||||
String channel=ElementParameterParser.getValue(node, "__CHANNEL__");
|
||||
String qm=ElementParameterParser.getValue(node, "__QM__");
|
||||
%>
|
||||
props_<%=cid%>.put("hostname", <%=host%>);
|
||||
props_<%=cid%>.put("port", Integer.valueOf(<%=port%>));
|
||||
props_<%=cid%>.put("channel", <%=channel%>);
|
||||
props_<%=cid%>.put("CCSID", new Integer(1208));
|
||||
props_<%=cid%>.put("transport","MQSeries");
|
||||
<%
|
||||
if(!(dbuser == null) && !("\"\"").equals(dbuser) && !("").equals(dbuser)) {
|
||||
%>
|
||||
props_<%=cid%>.put("userID",<%=dbuser%>);
|
||||
<%
|
||||
String passwordFieldName = "__PASS__";
|
||||
%>
|
||||
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
|
||||
props_<%=cid%>.put("password",decryptedPassword_<%=cid%>);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
qMgr_<%=cid%>=new com.ibm.mq.MQQueueManager(<%=qm%>,props_<%=cid%>);
|
||||
globalMap.put("qMgr_<%=cid%>",qMgr_<%=cid%>);
|
||||
<%
|
||||
if(isLog4jEnabled){
|
||||
%>
|
||||
log.info("<%=cid%> - Created successfully.");
|
||||
<%
|
||||
}
|
||||
}
|
||||
if(needSSLCipher){
|
||||
%>
|
||||
com.ibm.mq.MQEnvironment.sslCipherSuite = "<%=sslCipher%>";
|
||||
<%
|
||||
}
|
||||
if(!(dbuser == null) && !("\"\"").equals(dbuser) && !("").equals(dbuser)) {
|
||||
%>
|
||||
props_<%=cid%>.put("userID",<%=dbuser%>);
|
||||
|
||||
<%
|
||||
String passwordFieldName = "__PASS__";
|
||||
%>
|
||||
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
|
||||
props_<%=cid%>.put("password",decryptedPassword_<%=cid%>);
|
||||
<%
|
||||
}
|
||||
if(isLog4jEnabled){
|
||||
%>
|
||||
log.info("<%=cid%> - Attempt to create Queue Manager from server.");
|
||||
<%
|
||||
}
|
||||
%>
|
||||
com.ibm.mq.MQQueueManager qMgr_<%=cid%> = new com.ibm.mq.MQQueueManager(<%=qm%>, props_<%=cid%>);
|
||||
<%
|
||||
if(isLog4jEnabled){
|
||||
%>
|
||||
log.info("<%=cid%> - Created successfully.");
|
||||
log.info("<%=cid%> - Creating queue instance for queue: "+<%=queue%>+"...");
|
||||
<%
|
||||
}
|
||||
@@ -363,7 +390,7 @@ class="MomInput"
|
||||
<%
|
||||
}
|
||||
}
|
||||
if(isUseSharedConnection ||("JBoss").equals(serverType) || ("ActiveMQ").equals(serverType)){
|
||||
if(("JBoss").equals(serverType) || ("ActiveMQ").equals(serverType)){
|
||||
if(setJmsHeader && jmsHeaders !=null && jmsHeaders.size()>0){
|
||||
%>
|
||||
if(producer_<%=cid %>!=null){
|
||||
|
||||
@@ -3,24 +3,44 @@
|
||||
org.talend.core.model.process.INode
|
||||
org.talend.designer.codegen.config.CodeGeneratorArgument
|
||||
org.talend.core.model.process.ElementParameterParser
|
||||
|
||||
java.util.List
|
||||
"
|
||||
%>
|
||||
|
||||
<%
|
||||
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
|
||||
INode node = (INode)codeGenArgument.getArgument();
|
||||
boolean isUseSharedConnection = ("true").equals(ElementParameterParser.getValue(node, "__USE_CONNECTION__"));
|
||||
boolean isUseExistConnection = ("true").equals(ElementParameterParser.getValue(node, "__USE_CONNECTION__"));
|
||||
String cid = node.getUniqueName();
|
||||
String serverType=ElementParameterParser.getValue(node, "__SERVER__");
|
||||
boolean transacted = "true".equals(ElementParameterParser.getValue(node, "__IS_TRANSACTED__"));
|
||||
String connectionComponentName = ElementParameterParser.getValue(node, "__CONNECTION__");
|
||||
|
||||
boolean isCommitRollback = (!node.getProcess().getNodesOfType("tMomCommit").isEmpty()
|
||||
|| !node.getProcess().getNodesOfType("tMomRollback").isEmpty());
|
||||
List<? extends INode> commitNodes=node.getProcess().getNodesOfType("tMomCommit");
|
||||
List<? extends INode> rollBackNodes=node.getProcess().getNodesOfType("tMomRollback");
|
||||
|
||||
boolean isCommitRollback = false;
|
||||
for(INode cNode:commitNodes){
|
||||
String cNodeName = ElementParameterParser.getValue(cNode,"__CONNECTION__");
|
||||
if(cid.equals(cNodeName)){
|
||||
isCommitRollback = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!isCommitRollback){
|
||||
for(INode rNode:rollBackNodes){
|
||||
String rNodeName = ElementParameterParser.getValue(rNode,"__CONNECTION__");
|
||||
if(cid.equals(rNodeName)){
|
||||
isCommitRollback = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
final boolean isLog4jEnabled = ("true").equals(ElementParameterParser.getValue(node.getProcess(), "__LOG4J_ACTIVATE__"));
|
||||
|
||||
|
||||
if (isUseSharedConnection) {
|
||||
if (isUseExistConnection) {
|
||||
for (INode pNode : node.getProcess().getNodesOfType("tMomConnection")) {
|
||||
if (pNode.getUniqueName().equals(connectionComponentName)) {
|
||||
transacted = "true".equals(ElementParameterParser.getValue(pNode, "__IS_TRANSACTED__"));
|
||||
@@ -29,7 +49,7 @@ if (isUseSharedConnection) {
|
||||
}
|
||||
}
|
||||
|
||||
if(("JBoss").equals(serverType) || ("ActiveMQ").equals(serverType) || isUseSharedConnection){
|
||||
if(("JBoss").equals(serverType) || ("ActiveMQ").equals(serverType)){
|
||||
String msgType = ElementParameterParser.getValue(node, "__MSGTYPE__");
|
||||
if( ("JBoss").equals(serverType) || ( ("ActiveMQ").equals(serverType)) ){
|
||||
// if no commmit or rollback component exists and set transacted - commit session
|
||||
@@ -61,7 +81,7 @@ if(("JBoss").equals(serverType) || ("ActiveMQ").equals(serverType) || isUseShare
|
||||
log.info("<%=cid%> - Closed successfully.");
|
||||
<%
|
||||
}
|
||||
if (!isCommitRollback && !isUseSharedConnection) {
|
||||
if (!isCommitRollback && !isUseExistConnection) {
|
||||
if (isLog4jEnabled) {
|
||||
%>
|
||||
log.info("<%=cid%> - Closing connection...");
|
||||
@@ -79,7 +99,7 @@ if(("JBoss").equals(serverType) || ("ActiveMQ").equals(serverType) || isUseShare
|
||||
}
|
||||
}
|
||||
}
|
||||
if((("ActiveMQ").equals(serverType) || isUseSharedConnection) && !isCommitRollback && transacted){
|
||||
if(("ActiveMQ").equals(serverType) && !isCommitRollback && transacted){
|
||||
%>
|
||||
resourceMap.put("finish_<%=cid%>", true);
|
||||
<%
|
||||
@@ -87,21 +107,25 @@ if(("JBoss").equals(serverType) || ("ActiveMQ").equals(serverType) || isUseShare
|
||||
}else{//server judgement /***WebSphere MQ*****/
|
||||
if (transacted) {
|
||||
%>
|
||||
globalMap.put("remoteQ_<%=cid%>",remoteQ_<%=cid%>);
|
||||
globalMap.put("qMgr_<%=cid%>",qMgr_<%=cid%>);
|
||||
<%
|
||||
} else {
|
||||
if (isLog4jEnabled) {
|
||||
if (!isUseExistConnection && isLog4jEnabled && !isCommitRollback) {
|
||||
%>
|
||||
log.info("<%=cid%> - Disconnecting connection...");
|
||||
<%
|
||||
}
|
||||
%>
|
||||
System.out.println("Closing connection");
|
||||
System.out.println("Disconnecting queue");
|
||||
remoteQ_<%=cid%>.close();
|
||||
qMgr_<%=cid%>.disconnect();
|
||||
<%
|
||||
if (isLog4jEnabled) {
|
||||
if(!isUseExistConnection && !isCommitRollback){
|
||||
%>
|
||||
System.out.println("Disconnecting queue manager");
|
||||
qMgr_<%=cid%>.disconnect();
|
||||
<%
|
||||
}
|
||||
if (!isUseExistConnection && isLog4jEnabled && !isCommitRollback) {
|
||||
%>
|
||||
log.info("<%=cid%> - Disconnected successfully.");
|
||||
<%
|
||||
|
||||
@@ -3,23 +3,42 @@
|
||||
org.talend.core.model.process.INode
|
||||
org.talend.designer.codegen.config.CodeGeneratorArgument
|
||||
org.talend.core.model.process.ElementParameterParser
|
||||
|
||||
java.util.List
|
||||
"
|
||||
%>
|
||||
|
||||
<%
|
||||
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
|
||||
INode node = (INode)codeGenArgument.getArgument();
|
||||
boolean isUseSharedConnection = ("true").equals(ElementParameterParser.getValue(node, "__USE_CONNECTION__"));
|
||||
boolean isUseExistConnection = ("true").equals(ElementParameterParser.getValue(node, "__USE_CONNECTION__"));
|
||||
String cid = node.getUniqueName();
|
||||
String serverType=ElementParameterParser.getValue(node, "__SERVER__");
|
||||
boolean transacted = "true".equals(ElementParameterParser.getValue(node, "__IS_TRANSACTED__"));
|
||||
String connectionComponentName = ElementParameterParser.getValue(node, "__CONNECTION__");
|
||||
|
||||
boolean isCommitRollback = (!node.getProcess().getNodesOfType("tMomCommit").isEmpty()
|
||||
|| !node.getProcess().getNodesOfType("tMomRollback").isEmpty());
|
||||
|
||||
List<? extends INode> commitNodes=node.getProcess().getNodesOfType("tMomCommit");
|
||||
List<? extends INode> rollBackNodes=node.getProcess().getNodesOfType("tMomRollback");
|
||||
|
||||
if (isUseSharedConnection) {
|
||||
boolean isCommitRollback = false;
|
||||
for(INode cNode:commitNodes){
|
||||
String cNodeName = ElementParameterParser.getValue(cNode,"__CONNECTION__");
|
||||
if(cid.equals(cNodeName)){
|
||||
isCommitRollback = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!isCommitRollback){
|
||||
for(INode rNode:rollBackNodes){
|
||||
String rNodeName = ElementParameterParser.getValue(rNode,"__CONNECTION__");
|
||||
if(cid.equals(rNodeName)){
|
||||
isCommitRollback = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isUseExistConnection) {
|
||||
for (INode pNode : node.getProcess().getNodesOfType("tMomConnection")) {
|
||||
if (pNode.getUniqueName().equals(connectionComponentName)) {
|
||||
transacted = "true".equals(ElementParameterParser.getValue(pNode, "__IS_TRANSACTED__"));
|
||||
@@ -28,13 +47,13 @@ if (isUseSharedConnection) {
|
||||
}
|
||||
}
|
||||
|
||||
if((("ActiveMQ").equals(serverType) || isUseSharedConnection) && !isCommitRollback && transacted){
|
||||
if((("ActiveMQ").equals(serverType)) && !isCommitRollback && transacted){
|
||||
%>
|
||||
|
||||
if(resourceMap.get("finish_<%=cid%>") == null){
|
||||
if(resourceMap.get("session_<%=cid%>") != null){
|
||||
((javax.jms.Session)resourceMap.get("session_<%=cid%>")).rollback();
|
||||
<%if(!isUseSharedConnection){%>
|
||||
<%if(!isUseExistConnection){%>
|
||||
if(resourceMap.get("producer_<%=cid%>") != null){
|
||||
((javax.jms.MessageProducer)resourceMap.get("producer_<%=cid%>")).close();
|
||||
}
|
||||
|
||||
@@ -88,12 +88,12 @@
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="TO" FIELD="TEXT" SHOW="true" NUM_ROW="30"
|
||||
SHOW_IF="(SERVER == 'JBOSS') OR (SERVER == 'ACTIVEMQ') or (USE_CONNECTION == 'true')">
|
||||
SHOW_IF="(((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER!= 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER != 'WEBSPHERE')))">
|
||||
<DEFAULT>""</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="MSGTYPE" FIELD="CLOSED_LIST" NUM_ROW="30"
|
||||
SHOW_IF="(SERVER == 'JBOSS') OR (SERVER == 'ACTIVEMQ') or (USE_CONNECTION == 'true')">
|
||||
SHOW_IF="(((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER!= 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER != 'WEBSPHERE')))">
|
||||
<ITEMS DEFAULT="TOPIC">
|
||||
<ITEM NAME="TOPIC" VALUE="Topic" />
|
||||
<ITEM NAME="QUEUE" VALUE="Queue" />
|
||||
@@ -143,12 +143,12 @@
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="QUEUE" FIELD="TEXT" NUM_ROW="50"
|
||||
SHOW_IF="(USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')">
|
||||
SHOW_IF="(((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')))">
|
||||
<DEFAULT>""</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="IS_USE_MESSAGE_ID" FIELD="CHECK" REQUIRED="true" NUM_ROW="60"
|
||||
SHOW_IF="(USE_CONNECTION == 'false') and (MESSAGE_BODY_TYPE != 'MAP') AND (SERVER == 'WEBSPHERE')">
|
||||
SHOW_IF="(MESSAGE_BODY_TYPE != 'MAP')">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
@@ -165,17 +165,17 @@
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="USE_FORMAT" FIELD="CHECK" REQUIRED="true" NUM_ROW="5"
|
||||
SHOW_IF="(USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')">
|
||||
SHOW_IF="(((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')))">
|
||||
<DEFAULT>"false"</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="WS_MQ_FORMAT" FIELD="TEXT" REQUIRED="true" NUM_ROW="5"
|
||||
SHOW_IF="(USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE') AND (USE_FORMAT == 'true')">
|
||||
SHOW_IF="(((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE'))) AND (USE_FORMAT == 'true')">
|
||||
<DEFAULT>"MQSTR"</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="DELIVERY_MODE" FIELD="CLOSED_LIST" REQUIRED="true" NUM_ROW="10"
|
||||
SHOW_IF="(SERVER != 'WEBSPHERE') or (USE_CONNECTION == 'true')">
|
||||
SHOW_IF="(((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER!= 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER != 'WEBSPHERE')))">
|
||||
<ITEMS DEFAULT="N_PERSISTENT">
|
||||
<ITEM NAME="N_PERSISTENT" VALUE="N_PERSISTENT" />
|
||||
<ITEM NAME="PERSISTENT" VALUE="PERSISTENT" />
|
||||
@@ -191,11 +191,11 @@
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="SET_JMS_HEADER" FIELD="CHECK" REQUIRED="false" NUM_ROW="25"
|
||||
SHOW_IF="(USE_CONNECTION == 'true') or (SERVER != 'WEBSPHERE')">
|
||||
SHOW_IF="(((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER!= 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER != 'WEBSPHERE')))">
|
||||
<DEFAULT>"false"</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="JMS_HEADERS" FIELD="TABLE" REQUIRED="false" NB_LINES="3" NUM_ROW="30"
|
||||
SHOW_IF="(SET_JMS_HEADER == 'true') AND ((USE_CONNECTION == 'true') or (SERVER != 'WEBSPHERE'))">
|
||||
SHOW_IF="(SET_JMS_HEADER == 'true') AND (((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER!= 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER != 'WEBSPHERE')))">
|
||||
<ITEMS>
|
||||
<ITEM NAME="JMS_HEADER_NAME" FIELD="CLOSED_LIST">
|
||||
<ITEMS DEFAULT="JMSDESTINATION">
|
||||
@@ -216,11 +216,11 @@
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="SET_JMS_PROPERTIES" FIELD="CHECK" REQUIRED="false" NUM_ROW="35"
|
||||
SHOW_IF="(USE_CONNECTION == 'true') or (SERVER != 'WEBSPHERE')">
|
||||
SHOW_IF="(((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER!= 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER != 'WEBSPHERE')))">
|
||||
<DEFAULT>"false"</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="JMS_PROPERTIES" FIELD="TABLE" REQUIRED="false" NB_LINES="3" NUM_ROW="40"
|
||||
SHOW_IF="(SET_JMS_PROPERTIES == 'true') AND ((USE_CONNECTION == 'true') or (SERVER != 'WEBSPHERE'))">
|
||||
SHOW_IF="(SET_JMS_PROPERTIES == 'true') AND (((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER!= 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER != 'WEBSPHERE')))">
|
||||
<ITEMS>
|
||||
<ITEM NAME="JMS_PROPERTIES_NAME" FIELD="TEXT" />
|
||||
<ITEM NAME="JMS_PROPERTIES_TYPE" FIELD="CLOSED_LIST">
|
||||
@@ -241,11 +241,11 @@
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="SET_MQMD_FIELDS" FIELD="CHECK" REQUIRED="false" NUM_ROW="45"
|
||||
SHOW_IF="(USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')">
|
||||
SHOW_IF="(((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')))">
|
||||
<DEFAULT>"false"</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="MQMD_FIELDS" FIELD="TABLE" REQUIRED="false" NB_LINES="3" NUM_ROW="46"
|
||||
SHOW_IF="(SET_MQMD_FIELDS == 'true') AND (SERVER == 'WEBSPHERE') and (USE_CONNECTION == 'false')">
|
||||
SHOW_IF="(SET_MQMD_FIELDS == 'true') AND (((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')))">
|
||||
<ITEMS>
|
||||
<ITEM NAME="MQMD_FIELD_NAME" FIELD="CLOSED_LIST">
|
||||
<ITEMS DEFAULT="ACCOUNTINGTOKEN">
|
||||
@@ -281,15 +281,15 @@
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="USE_MQ_HEADER" FIELD="CHECK" REQUIRED="false" NUM_ROW="50" GROUP="HEADERS"
|
||||
SHOW_IF="(USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')">
|
||||
SHOW_IF="(((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')))">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="USE_FIX_MQRFH2" FIELD="CHECK" REQUIRED="false" NUM_ROW="51" GROUP="HEADERS"
|
||||
SHOW_IF="(USE_CONNECTION == 'false') and (USE_MQ_HEADER=='true') AND (SERVER == 'WEBSPHERE')">
|
||||
SHOW_IF="(USE_MQ_HEADER=='true') AND (((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')))">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="MQRFH2_FIXED_FIELD" FIELD="TABLE" REQUIRED="false" NUM_ROW="52" GROUP="HEADERS"
|
||||
SHOW_IF="(USE_CONNECTION == 'false') and (USE_MQ_HEADER == 'true') AND (USE_FIX_MQRFH2=='true') AND (SERVER == 'WEBSPHERE')">
|
||||
SHOW_IF="(USE_MQ_HEADER == 'true') AND (USE_FIX_MQRFH2=='true') AND (((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')))">
|
||||
<ITEMS>
|
||||
<ITEM NAME="MQMD_FIELD_NAME" FIELD="CLOSED_LIST">
|
||||
<ITEMS DEFAULT="Version">
|
||||
@@ -305,11 +305,11 @@
|
||||
</ITEMS>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="USE_MQRFH2_MCD" FIELD="CHECK" REQUIRED="false" NUM_ROW="53" GROUP="HEADERS"
|
||||
SHOW_IF="(USE_CONNECTION == 'false') and (USE_MQ_HEADER=='true') AND (SERVER == 'WEBSPHERE')">
|
||||
SHOW_IF="(USE_MQ_HEADER=='true') AND (((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')))">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="MQRFH2_MCD_FIELD" FIELD="TABLE" REQUIRED="false" NUM_ROW="54" GROUP="HEADERS"
|
||||
SHOW_IF="(USE_CONNECTION == 'false') and (USE_MQ_HEADER == 'true') AND (USE_MQRFH2_MCD=='true') AND (SERVER == 'WEBSPHERE')">
|
||||
SHOW_IF="(USE_MQ_HEADER == 'true') AND (USE_MQRFH2_MCD=='true') AND (((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')))">
|
||||
<ITEMS>
|
||||
<ITEM NAME="MQMD_FIELD_NAME" FIELD="CLOSED_LIST">
|
||||
<ITEMS DEFAULT="Type">
|
||||
@@ -323,11 +323,11 @@
|
||||
</ITEMS>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="USE_MQRFH2_JMS" FIELD="CHECK" REQUIRED="false" NUM_ROW="55" GROUP="HEADERS"
|
||||
SHOW_IF="(USE_CONNECTION == 'false') and (USE_MQ_HEADER=='true') AND (SERVER == 'WEBSPHERE')">
|
||||
SHOW_IF="(USE_MQ_HEADER=='true') AND (((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')))">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="MQRFH2_JMS_FIELD" FIELD="TABLE" REQUIRED="false" NUM_ROW="56" GROUP="HEADERS"
|
||||
SHOW_IF="(USE_CONNECTION == 'false') and (USE_MQ_HEADER == 'true') AND (USE_MQRFH2_JMS=='true') AND (SERVER == 'WEBSPHERE')">
|
||||
SHOW_IF="(USE_MQ_HEADER == 'true') AND (USE_MQRFH2_JMS=='true') AND (((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')))">
|
||||
<ITEMS>
|
||||
<ITEM NAME="MQMD_FIELD_NAME" FIELD="CLOSED_LIST">
|
||||
<ITEMS DEFAULT="Destination">
|
||||
@@ -346,11 +346,11 @@
|
||||
</ITEMS>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="USE_MQRFH2_USR" FIELD="CHECK" REQUIRED="false" NUM_ROW="57" GROUP="HEADERS"
|
||||
SHOW_IF="(USE_CONNECTION == 'false') and (USE_MQ_HEADER=='true') AND (SERVER == 'WEBSPHERE')">
|
||||
SHOW_IF="(USE_MQ_HEADER=='true') AND (((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')))">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="MQRFH2_USR_FIELD" FIELD="TABLE" REQUIRED="false" NUM_ROW="58" GROUP="HEADERS"
|
||||
SHOW_IF="(USE_CONNECTION == 'false') and (USE_MQ_HEADER == 'true') AND (USE_MQRFH2_USR=='true') AND (SERVER == 'WEBSPHERE')">
|
||||
SHOW_IF="(USE_MQ_HEADER == 'true') AND (USE_MQRFH2_USR=='true') AND (((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')))">
|
||||
<ITEMS>
|
||||
<ITEM NAME="MQMD_FIELD_NAME" FIELD="TEXT" />
|
||||
<ITEM NAME="VALUE" FIELD="TEXT" />
|
||||
@@ -358,11 +358,11 @@
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="SET_MQ_SSL_CIPHER" FIELD="CHECK" REQUIRED="false" NUM_ROW="70" GROUP="SSL"
|
||||
SHOW_IF="(USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')">
|
||||
SHOW_IF="(((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')))">
|
||||
<DEFAULT>"false"</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="MQ_SSL_CIPHER" FIELD="CLOSED_LIST" REQUIRED="false" NUM_ROW="71" GROUP="SSL"
|
||||
SHOW_IF="(USE_CONNECTION == 'false') and (SET_MQ_SSL_CIPHER == 'true') AND (SERVER == 'WEBSPHERE')">
|
||||
SHOW_IF="(SET_MQ_SSL_CIPHER == 'true') AND (((USE_CONNECTION == 'true') and (#LINK@NODE.CONNECTION.SERVER== 'WEBSPHERE')) OR ((USE_CONNECTION == 'false') and (SERVER == 'WEBSPHERE')))">
|
||||
<ITEMS DEFAULT="NULL_MD5">
|
||||
<ITEM NAME="NULL_MD5" VALUE="SSL_RSA_WITH_NULL_MD5" />
|
||||
<ITEM NAME="NULL_SHA" VALUE="SSL_RSA_WITH_NULL_SHA" />
|
||||
@@ -387,20 +387,25 @@
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="JBOSS REMOTING" MODULE="jboss-remoting.jar" UrlPath="platform:/plugin/org.talend.libraries.jboss/lib/jboss-remoting.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="JNP-CLIENT" MODULE="jnp-client.jar" REQUIRED="true" />
|
||||
<!-- ActiveMQ -->
|
||||
<IMPORT NAME="ACTIVEMQ LIB" MODULE="activemq-all-5.10.0.jar" UrlPath="platform:/plugin/org.talend.libraries.apache/lib/activemq-all-5.10.0.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'ACTIVEMQ')" />
|
||||
|
||||
<!-- JBOSS -->
|
||||
<IMPORT NAME="JAVA_SSIST" MODULE="javassist.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'JBOSS')" />
|
||||
<IMPORT NAME="TROVE" MODULE="trove.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'JBOSS')" />
|
||||
<IMPORT NAME="JBOSS MDR" MODULE="jboss-mdr.jar" UrlPath="platform:/plugin/org.talend.libraries.jboss/lib/jboss-mdr.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'JBOSS')" />
|
||||
<IMPORT NAME="JNP-CLIENT" MODULE="jnp-client.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'JBOSS')" />
|
||||
<IMPORT NAME="JBOSS COMMON" MODULE="jboss-common-core.jar" UrlPath="platform:/plugin/org.talend.libraries.jboss/lib/jboss-common-core.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'JBOSS')" />
|
||||
<IMPORT NAME="JBOSS AOP" MODULE="jboss-aop.jar" UrlPath="platform:/plugin/org.talend.libraries.jboss/lib/jboss-aop.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'JBOSS')" />
|
||||
<IMPORT NAME="JBOSS REMOTING" MODULE="jboss-remoting.jar" UrlPath="platform:/plugin/org.talend.libraries.jboss/lib/jboss-remoting.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'JBOSS')" />
|
||||
<IMPORT NAME="JBOSS MESSAGING CLIENT" MODULE="jboss-messaging-client.jar" UrlPath="platform:/plugin/org.talend.libraries.jboss/lib/jboss-messaging-client.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'JBOSS')" />
|
||||
<IMPORT NAME="JBOSS MQ LIB" MODULE="jbossall-client.jar" UrlPath="platform:/plugin/org.talend.libraries.jboss/lib/jbossall-client.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'JBOSS')" />
|
||||
<IMPORT NAME="LOG4J" MODULE="log4j-1.2.15.jar" UrlPath="platform:/base/plugins/org.apache.log4j_1.2.15.v201012070815.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'JBOSS')" />
|
||||
|
||||
<!-- Websphere MQ -->
|
||||
<IMPORT NAME="WEBSPHERE MQ LIB" MODULE="com.ibm.mq.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'WEBSPHERE')" />
|
||||
<IMPORT NAME="WEBSPHERE JMS LIB" MODULE="com.ibm.mqjms.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'WEBSPHERE')" />
|
||||
<IMPORT NAME="WEBSPHERE CONNECTOR" MODULE="websphere-connector-1_5.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'WEBSPHERE')" />
|
||||
<IMPORT NAME="ACTIVEMQ LIB" MODULE="activemq-all-5.10.0.jar" UrlPath="platform:/plugin/org.talend.libraries.apache/lib/activemq-all-5.10.0.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'ACTIVEMQ')" />
|
||||
<IMPORT NAME="JBOSS MESSAGING CLIENT" MODULE="jboss-messaging-client.jar" UrlPath="platform:/plugin/org.talend.libraries.jboss/lib/jboss-messaging-client.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="JBOSS AOP" MODULE="jboss-aop.jar" UrlPath="platform:/plugin/org.talend.libraries.jboss/lib/jboss-aop.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="JBOSS COMMON" MODULE="jboss-common-core.jar" UrlPath="platform:/plugin/org.talend.libraries.jboss/lib/jboss-common-core.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="JBOSS MDR" MODULE="jboss-mdr.jar" UrlPath="platform:/plugin/org.talend.libraries.jboss/lib/jboss-mdr.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="JAVA_SSIST" MODULE="javassist.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="TROVE" MODULE="trove.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="LOG4J" MODULE="log4j-1.2.15.jar" UrlPath="platform:/base/plugins/org.apache.log4j_1.2.15.v201012070815.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'JBOSS')" />
|
||||
<IMPORT NAME="TALENDMQRFH2" MODULE="talendMQRFH2.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'WEBSPHERE')" />
|
||||
<IMPORT NAME="Java Message Service" MODULE="jms.jar" UrlPath="platform:/plugin/org.talend.libraries.esb.ext/lib/jms.jar" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'WEBSPHERE')" />
|
||||
</IMPORTS>
|
||||
|
||||
@@ -26,7 +26,16 @@ class="MomInput"
|
||||
String msgBobyType = ElementParameterParser.getValue(node, "__MESSAGE_BODY_TYPE__");
|
||||
|
||||
boolean isSetJMSDestination = false;
|
||||
boolean isUseSharedConnection = ("true").equals(ElementParameterParser.getValue(node, "__USE_CONNECTION__"));
|
||||
boolean isUseExistConnection = ("true").equals(ElementParameterParser.getValue(node, "__USE_CONNECTION__"));
|
||||
String connectionComponentName = ElementParameterParser.getValue(node, "__CONNECTION__");
|
||||
if (isUseExistConnection) {
|
||||
for (INode pNode : node.getProcess().getNodesOfType("tMomConnection")) {
|
||||
if (pNode.getUniqueName().equals(connectionComponentName)) {
|
||||
serverType=ElementParameterParser.getValue(pNode, "__SERVER__");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean setJmsHeader = ("true").equals(ElementParameterParser.getValue(node, "__SET_JMS_HEADER__"));
|
||||
List<Map<String,String>> jmsHeaders = (List<Map<String,String>>)ElementParameterParser.getObjectValue(node, "__JMS_HEADERS__");
|
||||
|
||||
@@ -64,7 +73,7 @@ class="MomInput"
|
||||
log.debug("<%=cid%> - Writing the record: " + (nb_line_<%=cid%>+1) + ".");
|
||||
<%
|
||||
}
|
||||
if (isUseSharedConnection || ("JBoss").equals(serverType) || ("ActiveMQ").equals(serverType)) {
|
||||
if (("JBoss").equals(serverType) || ("ActiveMQ").equals(serverType)) {
|
||||
|
||||
/*-------------------1.is use message id.this functions just use map message type-------------------------------------*/
|
||||
if(("true").equals(useMsgId)){
|
||||
|
||||
@@ -37,14 +37,6 @@
|
||||
<PARAMETER NAME="CONNECTION" FIELD="COMPONENT_LIST" NUM_ROW="10"
|
||||
REQUIRED="true" FILTER="REGEXP:^tMomOutput|tMomConnection|tMomInput$" />
|
||||
|
||||
<PARAMETER NAME="SERVER" FIELD="CLOSED_LIST" NUM_ROW="20">
|
||||
<ITEMS DEFAULT="WEBSPHERE">
|
||||
<ITEM NAME="WEBSPHERE" VALUE="WebSphere" />
|
||||
<ITEM NAME="JBOSS" VALUE="JBoss" />
|
||||
<ITEM NAME="ACTIVEMQ" VALUE="ActiveMQ"/>
|
||||
</ITEMS>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="CLOSE" FIELD="CHECK" NUM_ROW="100">
|
||||
<DEFAULT>true</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
@@ -3,14 +3,7 @@ imports="
|
||||
org.talend.core.model.process.INode
|
||||
org.talend.core.model.process.ElementParameterParser
|
||||
org.talend.designer.codegen.config.CodeGeneratorArgument
|
||||
"
|
||||
%>
|
||||
|
||||
<%@ jet
|
||||
imports="
|
||||
org.talend.core.model.process.INode
|
||||
org.talend.core.model.process.ElementParameterParser
|
||||
org.talend.designer.codegen.config.CodeGeneratorArgument
|
||||
org.talend.core.model.utils.NodeUtil
|
||||
"
|
||||
%>
|
||||
|
||||
@@ -24,7 +17,15 @@ imports="
|
||||
|
||||
boolean close = ("true").equals(ElementParameterParser.getValue(node,"__CLOSE__"));
|
||||
|
||||
String serverType=ElementParameterParser.getValue(node, "__SERVER__");
|
||||
INode connectionNode = NodeUtil.getNodeByUniqueName(node.getProcess(),connectionCid,true);
|
||||
|
||||
boolean isUseConnection = ("true").equals(ElementParameterParser.getValue(connectionNode, "__USE_CONNECTION__"));
|
||||
|
||||
if(isUseConnection){
|
||||
String realConnNodeName = ElementParameterParser.getValue(connectionNode,"__CONNECTION__");
|
||||
connectionNode = NodeUtil.getNodeByUniqueName(node.getProcess(),realConnNodeName);
|
||||
}
|
||||
String serverType=ElementParameterParser.getValue(connectionNode, "__SERVER__");
|
||||
|
||||
final boolean isLog4jEnabled = ("true").equals(ElementParameterParser.getValue(node.getProcess(), "__LOG4J_ACTIVATE__"));
|
||||
|
||||
@@ -89,8 +90,7 @@ imports="
|
||||
} else {
|
||||
%>
|
||||
com.ibm.mq.MQQueueManager qMgr_<%=cid%> = (com.ibm.mq.MQQueueManager)globalMap.get("qMgr_<%=connectionCid%>");
|
||||
com.ibm.mq.MQQueue remoteQ_<%=cid%> = (com.ibm.mq.MQQueue)globalMap.get("remoteQ_<%=connectionCid%>");
|
||||
if(qMgr_<%=cid%> != null && remoteQ_<%=cid%> != null) {
|
||||
if(qMgr_<%=cid%> != null) {
|
||||
<%
|
||||
if (isLog4jEnabled) {
|
||||
%>
|
||||
@@ -112,8 +112,7 @@ imports="
|
||||
<%
|
||||
}
|
||||
%>
|
||||
remoteQ_<%=cid%>.close();
|
||||
qMgr_<%=cid%>.disconnect();;
|
||||
qMgr_<%=cid%>.disconnect();
|
||||
<%
|
||||
if (isLog4jEnabled) {
|
||||
%>
|
||||
|
||||
@@ -182,7 +182,7 @@
|
||||
NUM_ROW="10"
|
||||
SHOW="false"
|
||||
>
|
||||
<DEFAULT>postgres_id</DEFAULT>
|
||||
<DEFAULT>redshift_id</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
</PARAMETERS>
|
||||
|
||||
@@ -213,7 +213,7 @@
|
||||
NUM_ROW="10"
|
||||
SHOW="false"
|
||||
>
|
||||
<DEFAULT>postgres_id</DEFAULT>
|
||||
<DEFAULT>redshift_id</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
</PARAMETERS>
|
||||
|
||||
@@ -63,6 +63,30 @@
|
||||
>
|
||||
<DEFAULT>""</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER
|
||||
NAME="REGION"
|
||||
FIELD="OPENED_LIST"
|
||||
RAW="true"
|
||||
NUM_ROW="30"
|
||||
REQUIRED="true"
|
||||
SHOW_IF="USE_EXISTING_CONNECTION == 'false'"
|
||||
>
|
||||
<ITEMS DEFAULT="DEFAULT">
|
||||
<ITEM NAME="DEFAULT" VALUE="DEFAULT" />
|
||||
<ITEM NAME="AP_SOUTHEAST_1" VALUE=""ap-southeast-1"" />
|
||||
<ITEM NAME="AP_SOUTHEAST_2" VALUE=""ap-southeast-2"" />
|
||||
<ITEM NAME="AP_NORTHEAST_1" VALUE=""ap-northeast-1"" />
|
||||
<ITEM NAME="CN_NORTH_1" VALUE=""cn-north-1"" />
|
||||
<ITEM NAME="EU_WEST_1" VALUE=""eu-west-1"" />
|
||||
<ITEM NAME="EU_CENTRAL_1" VALUE=""eu-central-1"" />
|
||||
<ITEM NAME="GovCloud" VALUE=""us-gov-west-1"" />
|
||||
<ITEM NAME="SA_EAST_1" VALUE=""sa-east-1"" />
|
||||
<ITEM NAME="US_EAST_1" VALUE=""us-east-1"" />
|
||||
<ITEM NAME="US_WEST_1" VALUE=""us-west-1"" />
|
||||
<ITEM NAME="US_WEST_2" VALUE=""us-west-2"" />
|
||||
</ITEMS>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER
|
||||
NAME="BUCKET"
|
||||
@@ -131,11 +155,15 @@
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="aws-java-sdk-1.5.4" MODULE="aws-java-sdk-1.5.4.jar" UrlPath="platform:/plugin/org.talend.libraries.s3/lib/aws-java-sdk-1.5.4.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="Driver-Commons-Logging-1.1.1" MODULE="commons-logging-1.1.1.jar" UrlPath="platform:/base/plugins/org.apache.commons.logging_1.1.1.v201101211721.jar" REQUIRED="true"/>
|
||||
<IMPORT NAME="httpcore-4.2.1" MODULE="httpcore-4.2.1.jar" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpcore-4.2.1.jar" REQUIRED="true"/>
|
||||
<IMPORT NAME="httpclient-4.2.1" MODULE="httpclient-4.2.1.jar" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpclient-4.2.1.jar" REQUIRED="true"/>
|
||||
<IMPORT NAME="commons-codec" MODULE="commons-codec-1.3.jar" UrlPath="platform:/base/plugins/org.apache.commons.codec_1.3.0.v201101211617.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="aws-java-sdk-1.9.13" MODULE="aws-java-sdk-1.9.13.jar" UrlPath="platform:/plugin/org.talend.libraries.s3/lib/aws-java-sdk-1.9.13.jar" REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'" />
|
||||
<IMPORT NAME="Driver-Commons-Logging-1.1.1" MODULE="commons-logging-1.1.1.jar" UrlPath="platform:/base/plugins/org.apache.commons.logging_1.1.1.v201101211721.jar" REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'"/>
|
||||
<IMPORT NAME="httpcore-4.2.1" MODULE="httpcore-4.2.1.jar" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpcore-4.2.1.jar" REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'"/>
|
||||
<IMPORT NAME="httpclient-4.2.1" MODULE="httpclient-4.2.1.jar" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpclient-4.2.1.jar" REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'"/>
|
||||
<IMPORT NAME="commons-codec" MODULE="commons-codec-1.6.jar" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-codec-1.6.jar" REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'" />
|
||||
<IMPORT NAME="jackson-annotations" MODULE="jackson-annotations-2.3.0.jar" UrlPath="platform:/plugin/org.talend.libraries.jackson/lib/jackson-annotations-2.3.0.jar" REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'"/>
|
||||
<IMPORT NAME="jackson-core" MODULE="jackson-core-2.3.2.jar" UrlPath="platform:/plugin/org.talend.libraries.jackson/lib/jackson-core-2.3.2.jar" REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'"/>
|
||||
<IMPORT NAME="jackson-databind" MODULE="jackson-databind-2.3.2.jar" UrlPath="platform:/plugin/org.talend.libraries.jackson/lib/jackson-databind-2.3.2.jar" REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'"/>
|
||||
<IMPORT NAME="joda-time" MODULE="joda-time-2.3.jar" UrlPath="platform:/plugin/org.talend.libraries.jackson/lib/joda-time-2.3.jar" REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'"/>
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
|
||||
@@ -5,15 +5,19 @@ CONNECTION.NAME=Component List
|
||||
ACCESS_KEY.NAME=Access Key
|
||||
SECRET_KEY.NAME=Secret Key
|
||||
BUCKET.NAME=Bucket
|
||||
REGION.ITEM.GovCloud=GovCloud
|
||||
REGION.ITEM.US_EAST_1=US_EAST_1
|
||||
REGION.ITEM.US_WEST_1=US_WEST_1
|
||||
REGION.ITEM.US_WEST_2=US_WEST_2
|
||||
REGION.ITEM.EU_WEST_1=EU_WEST_1
|
||||
REGION.ITEM.AP_SOUTHEAST_1=AP_SOUTHEAST_1
|
||||
REGION.ITEM.AP_SOUTHEAST_2=AP_SOUTHEAST_2
|
||||
REGION.ITEM.AP_NORTHEAST_1=AP_NORTHEAST_1
|
||||
REGION.ITEM.SA_EAST_1=SA_EAST_1
|
||||
REGION.NAME=Region
|
||||
REGION.ITEM.DEFAULT=DEFAULT
|
||||
REGION.ITEM.GovCloud=AWS GovCloud (US)
|
||||
REGION.ITEM.US_EAST_1=US Standard
|
||||
REGION.ITEM.US_WEST_1=US West (N. California)
|
||||
REGION.ITEM.US_WEST_2=US West (Oregon)
|
||||
REGION.ITEM.EU_WEST_1=EU (Ireland)
|
||||
REGION.ITEM.EU_CENTRAL_1=EU (Frankfurt)
|
||||
REGION.ITEM.CN_NORTH_1=China (Beijing)
|
||||
REGION.ITEM.AP_SOUTHEAST_1=Asia Pacific (Singapore)
|
||||
REGION.ITEM.AP_SOUTHEAST_2=Asia Pacific (Sydney)
|
||||
REGION.ITEM.AP_NORTHEAST_1=Asia Pacific (Tokyo)
|
||||
REGION.ITEM.SA_EAST_1=South America (Sao Paulo)
|
||||
CLIENT_CONFIGURATION.NAME=
|
||||
CONFIG_CLIENT.NAME=Config client
|
||||
CONNECTION_CONFIG.NAME=Connection
|
||||
|
||||
@@ -63,6 +63,31 @@
|
||||
>
|
||||
<DEFAULT>""</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER
|
||||
NAME="REGION"
|
||||
FIELD="OPENED_LIST"
|
||||
RAW="true"
|
||||
NUM_ROW="30"
|
||||
REQUIRED="true"
|
||||
SHOW_IF="USE_EXISTING_CONNECTION == 'false'"
|
||||
>
|
||||
<ITEMS DEFAULT="DEFAULT">
|
||||
<ITEM NAME="DEFAULT" VALUE="DEFAULT" />
|
||||
<ITEM NAME="AP_SOUTHEAST_1" VALUE=""ap-southeast-1"" />
|
||||
<ITEM NAME="AP_SOUTHEAST_2" VALUE=""ap-southeast-2"" />
|
||||
<ITEM NAME="AP_NORTHEAST_1" VALUE=""ap-northeast-1"" />
|
||||
<ITEM NAME="CN_NORTH_1" VALUE=""cn-north-1"" />
|
||||
<ITEM NAME="EU_WEST_1" VALUE=""eu-west-1"" />
|
||||
<ITEM NAME="EU_CENTRAL_1" VALUE=""eu-central-1"" />
|
||||
<ITEM NAME="GovCloud" VALUE=""us-gov-west-1"" />
|
||||
<ITEM NAME="SA_EAST_1" VALUE=""sa-east-1"" />
|
||||
<ITEM NAME="US_EAST_1" VALUE=""us-east-1"" />
|
||||
<ITEM NAME="US_WEST_1" VALUE=""us-west-1"" />
|
||||
<ITEM NAME="US_WEST_2" VALUE=""us-west-2"" />
|
||||
</ITEMS>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER
|
||||
NAME="BUCKET"
|
||||
FIELD="TEXT"
|
||||
@@ -129,11 +154,15 @@
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="aws-java-sdk-1.5.4" MODULE="aws-java-sdk-1.5.4.jar" UrlPath="platform:/plugin/org.talend.libraries.s3/lib/aws-java-sdk-1.5.4.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="Driver-Commons-Logging-1.1.1" MODULE="commons-logging-1.1.1.jar" UrlPath="platform:/base/plugins/org.apache.commons.logging_1.1.1.v201101211721.jar" REQUIRED="true"/>
|
||||
<IMPORT NAME="httpcore-4.2.1" MODULE="httpcore-4.2.1.jar" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpcore-4.2.1.jar" REQUIRED="true"/>
|
||||
<IMPORT NAME="httpclient-4.2.1" MODULE="httpclient-4.2.1.jar" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpclient-4.2.1.jar" REQUIRED="true"/>
|
||||
<IMPORT NAME="commons-codec" MODULE="commons-codec-1.3.jar" UrlPath="platform:/base/plugins/org.apache.commons.codec_1.3.0.v201101211617.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="aws-java-sdk-1.9.13" MODULE="aws-java-sdk-1.9.13.jar" UrlPath="platform:/plugin/org.talend.libraries.s3/lib/aws-java-sdk-1.9.13.jar" REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'" />
|
||||
<IMPORT NAME="Driver-Commons-Logging-1.1.1" MODULE="commons-logging-1.1.1.jar" UrlPath="platform:/base/plugins/org.apache.commons.logging_1.1.1.v201101211721.jar" REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'"/>
|
||||
<IMPORT NAME="httpcore-4.2.1" MODULE="httpcore-4.2.1.jar" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpcore-4.2.1.jar" REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'"/>
|
||||
<IMPORT NAME="httpclient-4.2.1" MODULE="httpclient-4.2.1.jar" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpclient-4.2.1.jar" REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'"/>
|
||||
<IMPORT NAME="commons-codec" MODULE="commons-codec-1.6.jar" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-codec-1.6.jar" REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'" />
|
||||
<IMPORT NAME="jackson-annotations" MODULE="jackson-annotations-2.3.0.jar" UrlPath="platform:/plugin/org.talend.libraries.jackson/lib/jackson-annotations-2.3.0.jar" REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'"/>
|
||||
<IMPORT NAME="jackson-core" MODULE="jackson-core-2.3.2.jar" UrlPath="platform:/plugin/org.talend.libraries.jackson/lib/jackson-core-2.3.2.jar" REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'"/>
|
||||
<IMPORT NAME="jackson-databind" MODULE="jackson-databind-2.3.2.jar" UrlPath="platform:/plugin/org.talend.libraries.jackson/lib/jackson-databind-2.3.2.jar" REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'"/>
|
||||
<IMPORT NAME="joda-time" MODULE="joda-time-2.3.jar" UrlPath="platform:/plugin/org.talend.libraries.jackson/lib/joda-time-2.3.jar" REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'"/>
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
|
||||
@@ -25,4 +25,17 @@ CLIENT_CONFIGURATION.ITEM.CLIENT_PARAMETER.ITEM.USERAGENT=User Agent
|
||||
CLIENT_CONFIGURATION.ITEM.CLIENT_PARAMETER.ITEM.SOCKETRECEIVEBUFFERSIZEHINT=Socket Receive Buffersize Hint
|
||||
CLIENT_CONFIGURATION.ITEM.CLIENT_PARAMETER.ITEM.SOCKETSENDBUFFERSIZEHINT=Socket Send Buffersize Hint
|
||||
CLIENT_CONFIGURATION.ITEM.VALUE=Value
|
||||
DIE_ON_ERROR.NAME=Die on error
|
||||
DIE_ON_ERROR.NAME=Die on error
|
||||
REGION.NAME=Region
|
||||
REGION.ITEM.DEFAULT=DEFAULT
|
||||
REGION.ITEM.GovCloud=AWS GovCloud (US)
|
||||
REGION.ITEM.US_EAST_1=US Standard
|
||||
REGION.ITEM.US_WEST_1=US West (N. California)
|
||||
REGION.ITEM.US_WEST_2=US West (Oregon)
|
||||
REGION.ITEM.EU_WEST_1=EU (Ireland)
|
||||
REGION.ITEM.EU_CENTRAL_1=EU (Frankfurt)
|
||||
REGION.ITEM.CN_NORTH_1=China (Beijing)
|
||||
REGION.ITEM.AP_SOUTHEAST_1=Asia Pacific (Singapore)
|
||||
REGION.ITEM.AP_SOUTHEAST_2=Asia Pacific (Sydney)
|
||||
REGION.ITEM.AP_NORTHEAST_1=Asia Pacific (Tokyo)
|
||||
REGION.ITEM.SA_EAST_1=South America (Sao Paulo)
|
||||
@@ -63,6 +63,30 @@
|
||||
>
|
||||
<DEFAULT>""</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER
|
||||
NAME="REGION"
|
||||
FIELD="OPENED_LIST"
|
||||
RAW="true"
|
||||
NUM_ROW="30"
|
||||
REQUIRED="true"
|
||||
SHOW_IF="USE_EXISTING_CONNECTION == 'false'"
|
||||
>
|
||||
<ITEMS DEFAULT="DEFAULT">
|
||||
<ITEM NAME="DEFAULT" VALUE="DEFAULT" />
|
||||
<ITEM NAME="AP_SOUTHEAST_1" VALUE=""ap-southeast-1"" />
|
||||
<ITEM NAME="AP_SOUTHEAST_2" VALUE=""ap-southeast-2"" />
|
||||
<ITEM NAME="AP_NORTHEAST_1" VALUE=""ap-northeast-1"" />
|
||||
<ITEM NAME="CN_NORTH_1" VALUE=""cn-north-1"" />
|
||||
<ITEM NAME="EU_WEST_1" VALUE=""eu-west-1"" />
|
||||
<ITEM NAME="EU_CENTRAL_1" VALUE=""eu-central-1"" />
|
||||
<ITEM NAME="GovCloud" VALUE=""us-gov-west-1"" />
|
||||
<ITEM NAME="SA_EAST_1" VALUE=""sa-east-1"" />
|
||||
<ITEM NAME="US_EAST_1" VALUE=""us-east-1"" />
|
||||
<ITEM NAME="US_WEST_1" VALUE=""us-west-1"" />
|
||||
<ITEM NAME="US_WEST_2" VALUE=""us-west-2"" />
|
||||
</ITEMS>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER
|
||||
NAME="BUCKET"
|
||||
@@ -130,11 +154,15 @@
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="aws-java-sdk-1.5.4" MODULE="aws-java-sdk-1.5.4.jar" UrlPath="platform:/plugin/org.talend.libraries.s3/lib/aws-java-sdk-1.5.4.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="Driver-Commons-Logging-1.1.1" MODULE="commons-logging-1.1.1.jar" UrlPath="platform:/base/plugins/org.apache.commons.logging_1.1.1.v201101211721.jar" REQUIRED="true"/>
|
||||
<IMPORT NAME="httpcore-4.2.1" MODULE="httpcore-4.2.1.jar" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpcore-4.2.1.jar" REQUIRED="true"/>
|
||||
<IMPORT NAME="httpclient-4.2.1" MODULE="httpclient-4.2.1.jar" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpclient-4.2.1.jar" REQUIRED="true"/>
|
||||
<IMPORT NAME="commons-codec" MODULE="commons-codec-1.3.jar" UrlPath="platform:/base/plugins/org.apache.commons.codec_1.3.0.v201101211617.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="aws-java-sdk-1.9.13" MODULE="aws-java-sdk-1.9.13.jar" UrlPath="platform:/plugin/org.talend.libraries.s3/lib/aws-java-sdk-1.9.13.jar" REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'" />
|
||||
<IMPORT NAME="Driver-Commons-Logging-1.1.1" MODULE="commons-logging-1.1.1.jar" UrlPath="platform:/base/plugins/org.apache.commons.logging_1.1.1.v201101211721.jar" REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'"/>
|
||||
<IMPORT NAME="httpcore-4.2.1" MODULE="httpcore-4.2.1.jar" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpcore-4.2.1.jar" REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'"/>
|
||||
<IMPORT NAME="httpclient-4.2.1" MODULE="httpclient-4.2.1.jar" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpclient-4.2.1.jar" REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'"/>
|
||||
<IMPORT NAME="commons-codec" MODULE="commons-codec-1.6.jar" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-codec-1.6.jar" REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'" />
|
||||
<IMPORT NAME="jackson-annotations" MODULE="jackson-annotations-2.3.0.jar" UrlPath="platform:/plugin/org.talend.libraries.jackson/lib/jackson-annotations-2.3.0.jar" REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'"/>
|
||||
<IMPORT NAME="jackson-core" MODULE="jackson-core-2.3.2.jar" UrlPath="platform:/plugin/org.talend.libraries.jackson/lib/jackson-core-2.3.2.jar" REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'"/>
|
||||
<IMPORT NAME="jackson-databind" MODULE="jackson-databind-2.3.2.jar" UrlPath="platform:/plugin/org.talend.libraries.jackson/lib/jackson-databind-2.3.2.jar" REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'"/>
|
||||
<IMPORT NAME="joda-time" MODULE="joda-time-2.3.jar" UrlPath="platform:/plugin/org.talend.libraries.jackson/lib/joda-time-2.3.jar" REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'"/>
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
|
||||
@@ -5,15 +5,19 @@ CONNECTION.NAME=Component List
|
||||
ACCESS_KEY.NAME=Access Key
|
||||
SECRET_KEY.NAME=Secret Key
|
||||
BUCKET.NAME=Bucket
|
||||
REGION.ITEM.GovCloud=GovCloud
|
||||
REGION.ITEM.US_EAST_1=US_EAST_1
|
||||
REGION.ITEM.US_WEST_1=US_WEST_1
|
||||
REGION.ITEM.US_WEST_2=US_WEST_2
|
||||
REGION.ITEM.EU_WEST_1=EU_WEST_1
|
||||
REGION.ITEM.AP_SOUTHEAST_1=AP_SOUTHEAST_1
|
||||
REGION.ITEM.AP_SOUTHEAST_2=AP_SOUTHEAST_2
|
||||
REGION.ITEM.AP_NORTHEAST_1=AP_NORTHEAST_1
|
||||
REGION.ITEM.SA_EAST_1=SA_EAST_1
|
||||
REGION.NAME=Region
|
||||
REGION.ITEM.DEFAULT=DEFAULT
|
||||
REGION.ITEM.GovCloud=AWS GovCloud (US)
|
||||
REGION.ITEM.US_EAST_1=US Standard
|
||||
REGION.ITEM.US_WEST_1=US West (N. California)
|
||||
REGION.ITEM.US_WEST_2=US West (Oregon)
|
||||
REGION.ITEM.EU_WEST_1=EU (Ireland)
|
||||
REGION.ITEM.EU_CENTRAL_1=EU (Frankfurt)
|
||||
REGION.ITEM.CN_NORTH_1=China (Beijing)
|
||||
REGION.ITEM.AP_SOUTHEAST_1=Asia Pacific (Singapore)
|
||||
REGION.ITEM.AP_SOUTHEAST_2=Asia Pacific (Sydney)
|
||||
REGION.ITEM.AP_NORTHEAST_1=Asia Pacific (Tokyo)
|
||||
REGION.ITEM.SA_EAST_1=South America (Sao Paulo)
|
||||
CLIENT_CONFIGURATION.NAME=
|
||||
CONFIG_CLIENT.NAME=Config client
|
||||
CONNECTION_CONFIG.NAME=Connection
|
||||
|
||||
@@ -63,6 +63,31 @@
|
||||
>
|
||||
<DEFAULT>""</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER
|
||||
NAME="REGION"
|
||||
FIELD="OPENED_LIST"
|
||||
RAW="true"
|
||||
NUM_ROW="30"
|
||||
REQUIRED="true"
|
||||
SHOW_IF="USE_EXISTING_CONNECTION == 'false'"
|
||||
>
|
||||
<ITEMS DEFAULT="DEFAULT">
|
||||
<ITEM NAME="DEFAULT" VALUE="DEFAULT" />
|
||||
<ITEM NAME="AP_SOUTHEAST_1" VALUE=""ap-southeast-1"" />
|
||||
<ITEM NAME="AP_SOUTHEAST_2" VALUE=""ap-southeast-2"" />
|
||||
<ITEM NAME="AP_NORTHEAST_1" VALUE=""ap-northeast-1"" />
|
||||
<ITEM NAME="CN_NORTH_1" VALUE=""cn-north-1"" />
|
||||
<ITEM NAME="EU_WEST_1" VALUE=""eu-west-1"" />
|
||||
<ITEM NAME="EU_CENTRAL_1" VALUE=""eu-central-1"" />
|
||||
<ITEM NAME="GovCloud" VALUE=""us-gov-west-1"" />
|
||||
<ITEM NAME="SA_EAST_1" VALUE=""sa-east-1"" />
|
||||
<ITEM NAME="US_EAST_1" VALUE=""us-east-1"" />
|
||||
<ITEM NAME="US_WEST_1" VALUE=""us-west-1"" />
|
||||
<ITEM NAME="US_WEST_2" VALUE=""us-west-2"" />
|
||||
</ITEMS>
|
||||
</PARAMETER>
|
||||
|
||||
</PARAMETERS>
|
||||
|
||||
<ADVANCED_PARAMETERS>
|
||||
@@ -112,11 +137,15 @@
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="aws-java-sdk-1.5.4" MODULE="aws-java-sdk-1.5.4.jar" UrlPath="platform:/plugin/org.talend.libraries.s3/lib/aws-java-sdk-1.5.4.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="Driver-Commons-Logging-1.1.1" MODULE="commons-logging-1.1.1.jar" UrlPath="platform:/base/plugins/org.apache.commons.logging_1.1.1.v201101211721.jar" REQUIRED="true"/>
|
||||
<IMPORT NAME="httpcore-4.2.1" MODULE="httpcore-4.2.1.jar" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpcore-4.2.1.jar" REQUIRED="true"/>
|
||||
<IMPORT NAME="httpclient-4.2.1" MODULE="httpclient-4.2.1.jar" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpclient-4.2.1.jar" REQUIRED="true"/>
|
||||
<IMPORT NAME="commons-codec" MODULE="commons-codec-1.3.jar" UrlPath="platform:/base/plugins/org.apache.commons.codec_1.3.0.v201101211617.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="aws-java-sdk-1.9.13" MODULE="aws-java-sdk-1.9.13.jar" UrlPath="platform:/plugin/org.talend.libraries.s3/lib/aws-java-sdk-1.9.13.jar" REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'" />
|
||||
<IMPORT NAME="Driver-Commons-Logging-1.1.1" MODULE="commons-logging-1.1.1.jar" UrlPath="platform:/base/plugins/org.apache.commons.logging_1.1.1.v201101211721.jar" REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'"/>
|
||||
<IMPORT NAME="httpcore-4.2.1" MODULE="httpcore-4.2.1.jar" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpcore-4.2.1.jar" REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'"/>
|
||||
<IMPORT NAME="httpclient-4.2.1" MODULE="httpclient-4.2.1.jar" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpclient-4.2.1.jar" REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'"/>
|
||||
<IMPORT NAME="commons-codec" MODULE="commons-codec-1.6.jar" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-codec-1.6.jar" REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'" />
|
||||
<IMPORT NAME="jackson-annotations" MODULE="jackson-annotations-2.3.0.jar" UrlPath="platform:/plugin/org.talend.libraries.jackson/lib/jackson-annotations-2.3.0.jar" REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'"/>
|
||||
<IMPORT NAME="jackson-core" MODULE="jackson-core-2.3.2.jar" UrlPath="platform:/plugin/org.talend.libraries.jackson/lib/jackson-core-2.3.2.jar" REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'"/>
|
||||
<IMPORT NAME="jackson-databind" MODULE="jackson-databind-2.3.2.jar" UrlPath="platform:/plugin/org.talend.libraries.jackson/lib/jackson-databind-2.3.2.jar" REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'"/>
|
||||
<IMPORT NAME="joda-time" MODULE="joda-time-2.3.jar" UrlPath="platform:/plugin/org.talend.libraries.jackson/lib/joda-time-2.3.jar" REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'"/>
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
|
||||
@@ -26,3 +26,16 @@ CLIENT_CONFIGURATION.ITEM.CLIENT_PARAMETER.ITEM.USERAGENT=User Agent
|
||||
CLIENT_CONFIGURATION.ITEM.CLIENT_PARAMETER.ITEM.SOCKETRECEIVEBUFFERSIZEHINT=Socket Receive Buffersize Hint
|
||||
CLIENT_CONFIGURATION.ITEM.CLIENT_PARAMETER.ITEM.SOCKETSENDBUFFERSIZEHINT=Socket Send Buffersize Hint
|
||||
CLIENT_CONFIGURATION.ITEM.VALUE=Value
|
||||
REGION.NAME=Region
|
||||
REGION.ITEM.DEFAULT=DEFAULT
|
||||
REGION.ITEM.GovCloud=AWS GovCloud (US)
|
||||
REGION.ITEM.US_EAST_1=US Standard
|
||||
REGION.ITEM.US_WEST_1=US West (N. California)
|
||||
REGION.ITEM.US_WEST_2=US West (Oregon)
|
||||
REGION.ITEM.EU_WEST_1=EU (Ireland)
|
||||
REGION.ITEM.EU_CENTRAL_1=EU (Frankfurt)
|
||||
REGION.ITEM.CN_NORTH_1=China (Beijing)
|
||||
REGION.ITEM.AP_SOUTHEAST_1=Asia Pacific (Singapore)
|
||||
REGION.ITEM.AP_SOUTHEAST_2=Asia Pacific (Sydney)
|
||||
REGION.ITEM.AP_NORTHEAST_1=Asia Pacific (Tokyo)
|
||||
REGION.ITEM.SA_EAST_1=South America (Sao Paulo)
|
||||
@@ -8,6 +8,7 @@
|
||||
boolean configClient = "true".equals(ElementParameterParser.getValue(node, "__CONFIG_CLIENT__"));
|
||||
String useExistingConn = ElementParameterParser.getValue(node,"__USE_EXISTING_CONNECTION__");
|
||||
List<Map<String,String>> clientConfiguration = (List<Map<String,String>>)ElementParameterParser.getObjectValue(node,"__CLIENT_CONFIGURATION__");
|
||||
String region = ElementParameterParser.getValue(node,"__REGION__");
|
||||
if(("true").equals(useExistingConn)) {
|
||||
String connection = ElementParameterParser.getValue(node,"__CONNECTION__");
|
||||
String conn = "conn_" + connection;;
|
||||
@@ -80,6 +81,11 @@
|
||||
com.amazonaws.services.s3.AmazonS3Client conn_<%=cid%> = new com.amazonaws.services.s3.AmazonS3Client(credentials_<%=cid%>);
|
||||
<%
|
||||
}
|
||||
if(!"DEFAULT".equalsIgnoreCase(region)){
|
||||
%>
|
||||
conn_<%=cid%>.setRegion(com.amazonaws.regions.RegionUtils.getRegion(<%=region%>));
|
||||
<%
|
||||
}
|
||||
if(isLog4jEnabled){
|
||||
%>
|
||||
log.info("<%=cid%> - Creating new connection successfully.");
|
||||
|
||||
@@ -53,6 +53,29 @@
|
||||
>
|
||||
<DEFAULT>""</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER
|
||||
NAME="REGION"
|
||||
FIELD="OPENED_LIST"
|
||||
RAW="true"
|
||||
NUM_ROW="30"
|
||||
REQUIRED="true"
|
||||
>
|
||||
<ITEMS DEFAULT="DEFAULT">
|
||||
<ITEM NAME="DEFAULT" VALUE="DEFAULT" />
|
||||
<ITEM NAME="AP_SOUTHEAST_1" VALUE=""ap-southeast-1"" />
|
||||
<ITEM NAME="AP_SOUTHEAST_2" VALUE=""ap-southeast-2"" />
|
||||
<ITEM NAME="AP_NORTHEAST_1" VALUE=""ap-northeast-1"" />
|
||||
<ITEM NAME="CN_NORTH_1" VALUE=""cn-north-1"" />
|
||||
<ITEM NAME="EU_WEST_1" VALUE=""eu-west-1"" />
|
||||
<ITEM NAME="EU_CENTRAL_1" VALUE=""eu-central-1"" />
|
||||
<ITEM NAME="GovCloud" VALUE=""us-gov-west-1"" />
|
||||
<ITEM NAME="SA_EAST_1" VALUE=""sa-east-1"" />
|
||||
<ITEM NAME="US_EAST_1" VALUE=""us-east-1"" />
|
||||
<ITEM NAME="US_WEST_1" VALUE=""us-west-1"" />
|
||||
<ITEM NAME="US_WEST_2" VALUE=""us-west-2"" />
|
||||
</ITEMS>
|
||||
</PARAMETER>
|
||||
</PARAMETERS>
|
||||
|
||||
<ADVANCED_PARAMETERS>
|
||||
@@ -101,10 +124,14 @@
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="aws-java-sdk-1.5.4" MODULE="aws-java-sdk-1.5.4.jar" UrlPath="platform:/plugin/org.talend.libraries.s3/lib/aws-java-sdk-1.5.4.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="aws-java-sdk-1.9.13" MODULE="aws-java-sdk-1.9.13.jar" UrlPath="platform:/plugin/org.talend.libraries.s3/lib/aws-java-sdk-1.9.13.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="Driver-Commons-Logging-1.1.1" MODULE="commons-logging-1.1.1.jar" UrlPath="platform:/base/plugins/org.apache.commons.logging_1.1.1.v201101211721.jar" REQUIRED="true"/>
|
||||
<IMPORT NAME="httpcore-4.2.1" MODULE="httpcore-4.2.1.jar" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpcore-4.2.1.jar" REQUIRED="true"/>
|
||||
<IMPORT NAME="httpclient-4.2.1" MODULE="httpclient-4.2.1.jar" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpclient-4.2.1.jar" REQUIRED="true"/>
|
||||
<IMPORT NAME="jackson-annotations" MODULE="jackson-annotations-2.3.0.jar" UrlPath="platform:/plugin/org.talend.libraries.jackson/lib/jackson-annotations-2.3.0.jar" REQUIRED="true"/>
|
||||
<IMPORT NAME="jackson-core" MODULE="jackson-core-2.3.2.jar" UrlPath="platform:/plugin/org.talend.libraries.jackson/lib/jackson-core-2.3.2.jar" REQUIRED="true"/>
|
||||
<IMPORT NAME="jackson-databind" MODULE="jackson-databind-2.3.2.jar" UrlPath="platform:/plugin/org.talend.libraries.jackson/lib/jackson-databind-2.3.2.jar" REQUIRED="true"/>
|
||||
<IMPORT NAME="joda-time" MODULE="joda-time-2.3.jar" UrlPath="platform:/plugin/org.talend.libraries.jackson/lib/joda-time-2.3.jar" REQUIRED="true"/>
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
|
||||
@@ -20,4 +20,17 @@ CLIENT_CONFIGURATION.ITEM.CLIENT_PARAMETER.ITEM.SOCKETTIMEOUT=Socket Timeout
|
||||
CLIENT_CONFIGURATION.ITEM.CLIENT_PARAMETER.ITEM.USERAGENT=User Agent
|
||||
CLIENT_CONFIGURATION.ITEM.CLIENT_PARAMETER.ITEM.SOCKETRECEIVEBUFFERSIZEHINT=Socket Receive Buffersize Hint
|
||||
CLIENT_CONFIGURATION.ITEM.CLIENT_PARAMETER.ITEM.SOCKETSENDBUFFERSIZEHINT=Socket Send Buffersize Hint
|
||||
CLIENT_CONFIGURATION.ITEM.VALUE=Value
|
||||
CLIENT_CONFIGURATION.ITEM.VALUE=Value
|
||||
REGION.NAME=Region
|
||||
REGION.ITEM.DEFAULT=DEFAULT
|
||||
REGION.ITEM.GovCloud=AWS GovCloud (US)
|
||||
REGION.ITEM.US_EAST_1=US Standard
|
||||
REGION.ITEM.US_WEST_1=US West (N. California)
|
||||
REGION.ITEM.US_WEST_2=US West (Oregon)
|
||||
REGION.ITEM.EU_WEST_1=EU (Ireland)
|
||||
REGION.ITEM.EU_CENTRAL_1=EU (Frankfurt)
|
||||
REGION.ITEM.CN_NORTH_1=China (Beijing)
|
||||
REGION.ITEM.AP_SOUTHEAST_1=Asia Pacific (Singapore)
|
||||
REGION.ITEM.AP_SOUTHEAST_2=Asia Pacific (Sydney)
|
||||
REGION.ITEM.AP_NORTHEAST_1=Asia Pacific (Tokyo)
|
||||
REGION.ITEM.SA_EAST_1=South America (Sao Paulo)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user