Compare commits

...

8 Commits

Author SHA1 Message Date
roman.voievidko
c4a984f453 patch(TPS-3546): add TUP meatdata fix to patch release notes 2019-11-14 11:29:44 +02:00
pyzhou
4c7707d3d8 patch(TPS-3546): integrate TPS-3290 2019-11-14 10:25:03 +02:00
Dmytro Chmyga
1219db1a38 patch(TPS-3546): finish integration of TPS-3315 2019-11-14 10:22:27 +02:00
Dmytro Chmyga
8f630dad90 patch(TPS-3546): integrate TPS-3315 2019-11-14 10:20:46 +02:00
Dmytro Chmyga
c2fbdc337e patch(TPS-3546): remove patch relase notes from TPS-3315 2019-11-14 10:18:53 +02:00
roman.voievidko
9dd8414b69 patch(TPS-3546): add related patches to Patch release notes 2019-11-14 09:59:21 +02:00
roman.voievidko
8b73fcbfef patch(TPS-3546): remove class with migration task 2019-11-13 16:19:12 +02:00
Roman
183d676d0d patch(TPS-3546): remove migration task from plugin.xml 2019-11-13 16:17:32 +02:00
49 changed files with 698 additions and 214 deletions

85
PATCH_RELEASE_NOTE.md Normal file
View File

@@ -0,0 +1,85 @@
---
version: 7.2.1
module: https://talend.poolparty.biz/coretaxonomy/42
product:
- https://talend.poolparty.biz/coretaxonomy/23
---
# TPS-3546
| Info | Value |
| ---------------- | ---------------- |
| Patch Name | Patch\_20191113_TPS-3546\_v1-7.2.1 |
| Release Date | 2019-11-13 |
| Target Version | 20190620\_1446-V7.2.1 |
| Product affected | Talend Studio |
## Introduction
This is a self-contained patch.
**NOTE**: For information on how to obtain this patch, reach out to your Support contact at Talend.
## Fixed issues
This patch contains the following fixes:
- TPS-3546 [7.2.1] Redshift SSO support with Ping Federate (TDI-42766)
## Prerequisites
Consider the following requirements for your system:
- Talend Studio 7.2.1 must be installed.
- TPS-3315 - Additional JDBC Parameter exposes the password when using a context variable of password type (TDI-42721) must be installed.
- TPS-3290 - SSO enabled Redshift connectivity with Talend 7.2.1 Big Data Platform (Standard Job) (TDI-42674) must be installed.
## Installation
### Installing the patch using Software update
1) Logon TAC and switch to Configuration->Software Update, then enter the correct values and save referring to the documentation: https://help.talend.com/reader/f7Em9WV_cPm2RRywucSN0Q/j9x5iXV~vyxMlUafnDejaQ
2) Switch to Software update page, where the new patch will be listed. The patch can be downloaded from here into the nexus repository.
3) On Studio Side: Logon Studio with remote mode, on the logon page the Update button is displayed: click this button to install the patch.
### Installing the patch using Talend Studio
1) Create a folder named "patches" under your studio installer directory and copy the patch .zip file to this folder.
2) Restart your studio: a window pops up, then click OK to install the patch, or restart the commandline and the patch will be installed automatically.
### Installing the patch using Commandline
Execute the following commands:
1. Talend-Studio-win-x86_64.exe -nosplash -application org.talend.commandline.CommandLine -consoleLog -data commandline-workspace startServer -p 8002 --talendDebug
2. initRemote {tac_url} -ul {TAC login username} -up {TAC login password}
3. checkAndUpdate -tu {TAC login username} -tup {TAC login password}
## Uninstallation
Backup the Affected files list below. Uninstall the patch by restore the backup files.
## Affected files for this patch
The following files are installed by this patch:
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tRedshiftBulkExec/tRedshiftBulkExec\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tRedshiftBulkExec/tRedshiftBulkExec\_java.xml
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tRedshiftConnection/tRedshiftConnection\_java.xml
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tRedshiftInput/tRedshiftInput\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tRedshiftInput/tRedshiftInput\_java.xml
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tRedshiftOutput/tRedshiftOutput\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tRedshiftOutput/tRedshiftOutput\_java.xml
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tRedshiftOutputBulkExec/tRedshiftOutputBulkExec_java.xml
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tRedshiftRow/tRedshiftRow\_java.xml
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tRedshiftUnload/tRedshiftUnload_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tRedshiftUnload/tRedshiftUnload_java.xml
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/templates/DB/AbstractDBConnection.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/templates/DB/HelpClass/HelpClass.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/templates/DB/Input/AbstractDBInputBegin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/templates/DB/Input/HelpClass.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/templates/DB/Row/AbstractDBRowBegin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/templates/DB/Row/HelpClass.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/templates/Log4j/Log4jDBConnUtil.javajet
- {Talend\_Studio\_path}/plugins/org.talend.repository.metadata\_7.2.1.20190610_1534.jar

View File

@@ -1,6 +1,6 @@
<%@ jet
imports="
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
java.util.List
org.talend.core.model.process.IConnection
@@ -16,6 +16,7 @@
java.util.HashSet
"
%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%

View File

@@ -1,6 +1,6 @@
<%@ jet
imports="
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
java.util.List
@@ -17,6 +17,7 @@
java.util.HashSet
"
%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%

View File

@@ -18,8 +18,56 @@
"
%>
<%
//TPS-3315
org.talend.designer.codegen.config.CodeGeneratorArgument codeGenArgument_pwdCheck = (org.talend.designer.codegen.config.CodeGeneratorArgument)argument;
org.talend.core.model.process.INode node_pwdCheck = (org.talend.core.model.process.INode)codeGenArgument_pwdCheck.getArgument();
boolean useExistingConnection_pwdCheck = "true".equalsIgnoreCase(ElementParameterParser.getValue(node_pwdCheck,"__USE_EXISTING_CONNECTION__"));
if(!useExistingConnection_pwdCheck) {
String user_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__USER__");
String dbhost_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__HOST__");
String dbport_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PORT__");
String dbname_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__DBNAME__");
String dbproperties_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PROPERTIES__");
String localServiceName_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__LOCAL_SERVICE_NAME__");
final class ValueChecker {
public boolean checkValueForPassword(String inputValue, org.talend.core.model.process.IContext context) {
if(null == inputValue) {
return false;
}
java.util.List<String> parsed = new java.util.ArrayList<String>();
String value = inputValue.trim();
while(org.talend.core.model.utils.ContextParameterUtils.containContextVariables(value)) {
String nonQuoteStr = org.talend.core.utils.TalendQuoteUtils.filterQuote(value);
String contextVar = org.talend.core.model.utils.ContextParameterUtils.getVariableFromCode(nonQuoteStr);
parsed.add(contextVar);
String curValue = org.talend.core.model.utils.ContextParameterUtils.JAVA_NEW_CONTEXT_PREFIX + contextVar;
int index = value.indexOf(curValue);
if(index != -1) {
value = value.substring(index + curValue.length(), value.length());
}
}
for(String parsedParam : parsed) {
org.talend.core.model.process.IContextParameter param = context.getContextParameter(parsedParam);
if(org.talend.core.model.utils.ContextParameterUtils.isPasswordType(param)) {
return true;
}
}
return false;
}
}
ValueChecker checker = new ValueChecker();
org.talend.core.model.process.IContext context_pwdCheck = node_pwdCheck.getProcess().getContextManager().getDefaultContext();
if(checker.checkValueForPassword(dbhost_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbport_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbname_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbproperties_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(localServiceName_pwdCheck, context_pwdCheck)) {
%>
if(true) {
throw new RuntimeException("Password context variable is used in plain text field!");
}
<%
}
}
//
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
DbMapComponent node = (DbMapComponent) codeGenArgument.getArgument();
boolean stats = codeGenArgument.isStatistics();

View File

@@ -15,6 +15,7 @@ imports="
skeleton="../templates/db_output_bulk.skeleton"
%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/Log4j/DBLogUtil.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();

View File

@@ -6,6 +6,7 @@ imports="
"
%>
<%@ include file="../templates/DB/HelpClass/HelpClass.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
class ConnectionUtil extends DefaultConnectionUtil{

View File

@@ -13,6 +13,7 @@ imports="
"
%>
<%@ include file="../templates/DB/Input/HelpClass.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
class DBInputBeginUtil extends DefaultDBInputUtil{

View File

@@ -17,6 +17,7 @@ imports="
skeleton="../templates/db_output_bulk.skeleton"
%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/Log4j/DBLogUtil.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();

View File

@@ -6,6 +6,7 @@ imports="
"
%>
<%@ include file="../templates/DB/Row/HelpClass.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
class DBRowBeginUtil extends DefaultDBRowUtil{

View File

@@ -18,6 +18,7 @@ imports="
skeleton="../templates/slowly_change_dimension.skeleton"
%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/Log4j/DBLogUtil.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode) codeGenArgument.getArgument();

View File

@@ -9,6 +9,7 @@ imports="
"
%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/Log4j/DBLogUtil.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode) codeGenArgument.getArgument();

View File

@@ -14,6 +14,7 @@ imports="
skeleton="../templates/db_output_bulk.skeleton"
%>
<%@ include file="../templates/Log4j/Log4jDBConnUtil.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();

View File

@@ -6,6 +6,7 @@ imports="
"
%>
<%@ include file="../templates/DB/HelpClass/HelpClass.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
class ConnectionUtil extends DefaultConnectionUtil{

View File

@@ -13,6 +13,7 @@ imports="
"
%>
<%@ include file="../templates/DB/Input/HelpClass.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
class DBInputBeginUtil extends DefaultDBInputUtil{

View File

@@ -17,6 +17,7 @@ imports="
skeleton="../templates/db_output_bulk.skeleton"
%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/Log4j/DBLogUtil.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();

View File

@@ -6,6 +6,7 @@ imports="
"
%>
<%@ include file="../templates/DB/Row/HelpClass.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
class DBRowBeginUtil extends DefaultDBRowUtil{

View File

@@ -16,7 +16,7 @@ imports="
"
skeleton="../templates/slowly_change_dimension.skeleton"
%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode) codeGenArgument.getArgument();

View File

@@ -14,7 +14,7 @@ imports="
"
skeleton="../templates/db_output_bulk.skeleton"
%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();

View File

@@ -8,6 +8,7 @@ imports="
"
%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/Log4j/DBLogUtil.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode) codeGenArgument.getArgument();

View File

@@ -18,6 +18,7 @@ skeleton="../templates/db_output_bulk.skeleton"
%>
<%@ include file="../templates/Log4j/Log4jDBConnUtil.javajet"%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
@@ -96,6 +97,57 @@ String url_<%=cid%> = null;
int deletedCount_<%=cid%>=0;
<%
boolean useExistingConnection = "true".equalsIgnoreCase(ElementParameterParser.getValue(node,"__USE_EXISTING_CONNECTION__"));
//TPS-3315
org.talend.designer.codegen.config.CodeGeneratorArgument codeGenArgument_pwdCheck = (org.talend.designer.codegen.config.CodeGeneratorArgument)argument;
org.talend.core.model.process.INode node_pwdCheck = (org.talend.core.model.process.INode)codeGenArgument_pwdCheck.getArgument();
boolean useExistingConnection_pwdCheck = "true".equalsIgnoreCase(ElementParameterParser.getValue(node_pwdCheck,"__USE_EXISTING_CONNECTION__"));
if(!useExistingConnection_pwdCheck) {
String user_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__USER__");
String dbhost_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__HOST__");
String dbport_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PORT__");
String dbname_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__DBNAME__");
String dbproperties_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PROPERTIES__");
String localServiceName_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__LOCAL_SERVICE_NAME__");
final class ValueChecker {
public boolean checkValueForPassword(String inputValue, org.talend.core.model.process.IContext context) {
if(null == inputValue) {
return false;
}
java.util.List<String> parsed = new java.util.ArrayList<String>();
String value = inputValue.trim();
while(org.talend.core.model.utils.ContextParameterUtils.containContextVariables(value)) {
String nonQuoteStr = org.talend.core.utils.TalendQuoteUtils.filterQuote(value);
String contextVar = org.talend.core.model.utils.ContextParameterUtils.getVariableFromCode(nonQuoteStr);
parsed.add(contextVar);
String curValue = org.talend.core.model.utils.ContextParameterUtils.JAVA_NEW_CONTEXT_PREFIX + contextVar;
int index = value.indexOf(curValue);
if(index != -1) {
value = value.substring(index + curValue.length(), value.length());
}
}
for(String parsedParam : parsed) {
org.talend.core.model.process.IContextParameter param = context.getContextParameter(parsedParam);
if(org.talend.core.model.utils.ContextParameterUtils.isPasswordType(param)) {
return true;
}
}
return false;
}
}
ValueChecker checker = new ValueChecker();
org.talend.core.model.process.IContext context_pwdCheck = node_pwdCheck.getProcess().getContextManager().getDefaultContext();
if(checker.checkValueForPassword(dbhost_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbport_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbname_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbproperties_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(localServiceName_pwdCheck, context_pwdCheck)) {
%>
if(true) {
throw new RuntimeException("Password context variable is used in plain text field!");
}
<%
}
}
//
if(useExistingConnection) {
String connection = ElementParameterParser.getValue(node,"__CONNECTION__");
String conn = "conn_" + connection;

View File

@@ -7,6 +7,56 @@ imports="
%>
<%@ include file="../templates/DB/HelpClass/HelpClass.javajet"%>
<%
//TPS-3315
org.talend.designer.codegen.config.CodeGeneratorArgument codeGenArgument_pwdCheck = (org.talend.designer.codegen.config.CodeGeneratorArgument)argument;
org.talend.core.model.process.INode node_pwdCheck = (org.talend.core.model.process.INode)codeGenArgument_pwdCheck.getArgument();
boolean useExistingConnection_pwdCheck = "true".equalsIgnoreCase(ElementParameterParser.getValue(node_pwdCheck,"__USE_EXISTING_CONNECTION__"));
if(!useExistingConnection_pwdCheck) {
String user_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__USER__");
String dbhost_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__HOST__");
String dbport_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PORT__");
String dbname_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__DBNAME__");
String dbproperties_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PROPERTIES__");
String localServiceName_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__LOCAL_SERVICE_NAME__");
final class ValueChecker {
public boolean checkValueForPassword(String inputValue, org.talend.core.model.process.IContext context) {
if(null == inputValue) {
return false;
}
java.util.List<String> parsed = new java.util.ArrayList<String>();
String value = inputValue.trim();
while(org.talend.core.model.utils.ContextParameterUtils.containContextVariables(value)) {
String nonQuoteStr = org.talend.core.utils.TalendQuoteUtils.filterQuote(value);
String contextVar = org.talend.core.model.utils.ContextParameterUtils.getVariableFromCode(nonQuoteStr);
parsed.add(contextVar);
String curValue = org.talend.core.model.utils.ContextParameterUtils.JAVA_NEW_CONTEXT_PREFIX + contextVar;
int index = value.indexOf(curValue);
if(index != -1) {
value = value.substring(index + curValue.length(), value.length());
}
}
for(String parsedParam : parsed) {
org.talend.core.model.process.IContextParameter param = context.getContextParameter(parsedParam);
if(org.talend.core.model.utils.ContextParameterUtils.isPasswordType(param)) {
return true;
}
}
return false;
}
}
ValueChecker checker = new ValueChecker();
org.talend.core.model.process.IContext context_pwdCheck = node_pwdCheck.getProcess().getContextManager().getDefaultContext();
if(checker.checkValueForPassword(dbhost_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbport_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbname_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbproperties_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(localServiceName_pwdCheck, context_pwdCheck)) {
%>
if(true) {
throw new RuntimeException("Password context variable is used in plain text field!");
}
<%
}
}
//
class ConnectionUtil extends DefaultConnectionUtil{
public void beforeComponentProcess(INode node){

View File

@@ -14,6 +14,56 @@ imports="
%>
<%@ include file="../templates/DB/Input/HelpClass.javajet"%>
<%
//TPS-3315
org.talend.designer.codegen.config.CodeGeneratorArgument codeGenArgument_pwdCheck = (org.talend.designer.codegen.config.CodeGeneratorArgument)argument;
org.talend.core.model.process.INode node_pwdCheck = (org.talend.core.model.process.INode)codeGenArgument_pwdCheck.getArgument();
boolean useExistingConnection_pwdCheck = "true".equalsIgnoreCase(ElementParameterParser.getValue(node_pwdCheck,"__USE_EXISTING_CONNECTION__"));
if(!useExistingConnection_pwdCheck) {
String user_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__USER__");
String dbhost_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__HOST__");
String dbport_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PORT__");
String dbname_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__DBNAME__");
String dbproperties_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PROPERTIES__");
String localServiceName_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__LOCAL_SERVICE_NAME__");
final class ValueChecker {
public boolean checkValueForPassword(String inputValue, org.talend.core.model.process.IContext context) {
if(null == inputValue) {
return false;
}
java.util.List<String> parsed = new java.util.ArrayList<String>();
String value = inputValue.trim();
while(org.talend.core.model.utils.ContextParameterUtils.containContextVariables(value)) {
String nonQuoteStr = org.talend.core.utils.TalendQuoteUtils.filterQuote(value);
String contextVar = org.talend.core.model.utils.ContextParameterUtils.getVariableFromCode(nonQuoteStr);
parsed.add(contextVar);
String curValue = org.talend.core.model.utils.ContextParameterUtils.JAVA_NEW_CONTEXT_PREFIX + contextVar;
int index = value.indexOf(curValue);
if(index != -1) {
value = value.substring(index + curValue.length(), value.length());
}
}
for(String parsedParam : parsed) {
org.talend.core.model.process.IContextParameter param = context.getContextParameter(parsedParam);
if(org.talend.core.model.utils.ContextParameterUtils.isPasswordType(param)) {
return true;
}
}
return false;
}
}
ValueChecker checker = new ValueChecker();
org.talend.core.model.process.IContext context_pwdCheck = node_pwdCheck.getProcess().getContextManager().getDefaultContext();
if(checker.checkValueForPassword(dbhost_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbport_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbname_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbproperties_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(localServiceName_pwdCheck, context_pwdCheck)) {
%>
if(true) {
throw new RuntimeException("Password context variable is used in plain text field!");
}
<%
}
}
//
class DBInputBeginUtil extends DefaultDBInputUtil{
private INode node = null;

View File

@@ -51,6 +51,56 @@ skeleton="../templates/db_output_bulk.skeleton"
boolean createGeometryColumns = ("true").equals(ElementParameterParser.getValue(node,"__GEOMETRY_COLUMNS__"));
boolean useExistingConnection = "true".equals(ElementParameterParser.getValue(node,"__USE_EXISTING_CONNECTION__"));
String connection = ElementParameterParser.getValue(node,"__CONNECTION__");
//TPS-3315
org.talend.designer.codegen.config.CodeGeneratorArgument codeGenArgument_pwdCheck = (org.talend.designer.codegen.config.CodeGeneratorArgument)argument;
org.talend.core.model.process.INode node_pwdCheck = (org.talend.core.model.process.INode)codeGenArgument_pwdCheck.getArgument();
boolean useExistingConnection_pwdCheck = "true".equalsIgnoreCase(ElementParameterParser.getValue(node_pwdCheck,"__USE_EXISTING_CONNECTION__"));
if(!useExistingConnection_pwdCheck) {
String user_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__USER__");
String dbhost_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__HOST__");
String dbport_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PORT__");
String dbname_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__DBNAME__");
String dbproperties_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PROPERTIES__");
String localServiceName_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__LOCAL_SERVICE_NAME__");
final class ValueChecker {
public boolean checkValueForPassword(String inputValue, org.talend.core.model.process.IContext context) {
if(null == inputValue) {
return false;
}
java.util.List<String> parsed = new java.util.ArrayList<String>();
String value = inputValue.trim();
while(org.talend.core.model.utils.ContextParameterUtils.containContextVariables(value)) {
String nonQuoteStr = org.talend.core.utils.TalendQuoteUtils.filterQuote(value);
String contextVar = org.talend.core.model.utils.ContextParameterUtils.getVariableFromCode(nonQuoteStr);
parsed.add(contextVar);
String curValue = org.talend.core.model.utils.ContextParameterUtils.JAVA_NEW_CONTEXT_PREFIX + contextVar;
int index = value.indexOf(curValue);
if(index != -1) {
value = value.substring(index + curValue.length(), value.length());
}
}
for(String parsedParam : parsed) {
org.talend.core.model.process.IContextParameter param = context.getContextParameter(parsedParam);
if(org.talend.core.model.utils.ContextParameterUtils.isPasswordType(param)) {
return true;
}
}
return false;
}
}
ValueChecker checker = new ValueChecker();
org.talend.core.model.process.IContext context_pwdCheck = node_pwdCheck.getProcess().getContextManager().getDefaultContext();
if(checker.checkValueForPassword(dbhost_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbport_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbname_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbproperties_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(localServiceName_pwdCheck, context_pwdCheck)) {
%>
if(true) {
throw new RuntimeException("Password context variable is used in plain text field!");
}
<%
}
}
//
String rejectConnName = null;
List<? extends IConnection> rejectConns = node.getOutgoingConnections("REJECT");

View File

@@ -6,8 +6,58 @@ imports="
"
%>
<%@ include file="../templates/DB/Row/HelpClass.javajet"%>
<%
<%
//TPS-3315
org.talend.designer.codegen.config.CodeGeneratorArgument codeGenArgument_pwdCheck = (org.talend.designer.codegen.config.CodeGeneratorArgument)argument;
org.talend.core.model.process.INode node_pwdCheck = (org.talend.core.model.process.INode)codeGenArgument_pwdCheck.getArgument();
boolean useExistingConnection_pwdCheck = "true".equalsIgnoreCase(ElementParameterParser.getValue(node_pwdCheck,"__USE_EXISTING_CONNECTION__"));
if(!useExistingConnection_pwdCheck) {
String user_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__USER__");
String dbhost_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__HOST__");
String dbport_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PORT__");
String dbname_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__DBNAME__");
String dbproperties_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PROPERTIES__");
String localServiceName_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__LOCAL_SERVICE_NAME__");
final class ValueChecker {
public boolean checkValueForPassword(String inputValue, org.talend.core.model.process.IContext context) {
if(null == inputValue) {
return false;
}
java.util.List<String> parsed = new java.util.ArrayList<String>();
String value = inputValue.trim();
while(org.talend.core.model.utils.ContextParameterUtils.containContextVariables(value)) {
String nonQuoteStr = org.talend.core.utils.TalendQuoteUtils.filterQuote(value);
String contextVar = org.talend.core.model.utils.ContextParameterUtils.getVariableFromCode(nonQuoteStr);
parsed.add(contextVar);
String curValue = org.talend.core.model.utils.ContextParameterUtils.JAVA_NEW_CONTEXT_PREFIX + contextVar;
int index = value.indexOf(curValue);
if(index != -1) {
value = value.substring(index + curValue.length(), value.length());
}
}
for(String parsedParam : parsed) {
org.talend.core.model.process.IContextParameter param = context.getContextParameter(parsedParam);
if(org.talend.core.model.utils.ContextParameterUtils.isPasswordType(param)) {
return true;
}
}
return false;
}
}
ValueChecker checker = new ValueChecker();
org.talend.core.model.process.IContext context_pwdCheck = node_pwdCheck.getProcess().getContextManager().getDefaultContext();
if(checker.checkValueForPassword(dbhost_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbport_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbname_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbproperties_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(localServiceName_pwdCheck, context_pwdCheck)) {
%>
if(true) {
throw new RuntimeException("Password context variable is used in plain text field!");
}
<%
}
}
//
class DBRowBeginUtil extends DefaultDBRowUtil{
public void beforeComponentProcess(INode node){

View File

@@ -18,6 +18,56 @@ skeleton="../templates/slowly_change_dimension.skeleton"
%>
<%
//TPS-3315
org.talend.designer.codegen.config.CodeGeneratorArgument codeGenArgument_pwdCheck = (org.talend.designer.codegen.config.CodeGeneratorArgument)argument;
org.talend.core.model.process.INode node_pwdCheck = (org.talend.core.model.process.INode)codeGenArgument_pwdCheck.getArgument();
boolean useExistingConnection_pwdCheck = "true".equalsIgnoreCase(ElementParameterParser.getValue(node_pwdCheck,"__USE_EXISTING_CONNECTION__"));
if(!useExistingConnection_pwdCheck) {
String user_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__USER__");
String dbhost_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__HOST__");
String dbport_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PORT__");
String dbname_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__DBNAME__");
String dbproperties_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PROPERTIES__");
String localServiceName_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__LOCAL_SERVICE_NAME__");
final class ValueChecker {
public boolean checkValueForPassword(String inputValue, org.talend.core.model.process.IContext context) {
if(null == inputValue) {
return false;
}
java.util.List<String> parsed = new java.util.ArrayList<String>();
String value = inputValue.trim();
while(org.talend.core.model.utils.ContextParameterUtils.containContextVariables(value)) {
String nonQuoteStr = org.talend.core.utils.TalendQuoteUtils.filterQuote(value);
String contextVar = org.talend.core.model.utils.ContextParameterUtils.getVariableFromCode(nonQuoteStr);
parsed.add(contextVar);
String curValue = org.talend.core.model.utils.ContextParameterUtils.JAVA_NEW_CONTEXT_PREFIX + contextVar;
int index = value.indexOf(curValue);
if(index != -1) {
value = value.substring(index + curValue.length(), value.length());
}
}
for(String parsedParam : parsed) {
org.talend.core.model.process.IContextParameter param = context.getContextParameter(parsedParam);
if(org.talend.core.model.utils.ContextParameterUtils.isPasswordType(param)) {
return true;
}
}
return false;
}
}
ValueChecker checker = new ValueChecker();
org.talend.core.model.process.IContext context_pwdCheck = node_pwdCheck.getProcess().getContextManager().getDefaultContext();
if(checker.checkValueForPassword(dbhost_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbport_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbname_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbproperties_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(localServiceName_pwdCheck, context_pwdCheck)) {
%>
if(true) {
throw new RuntimeException("Password context variable is used in plain text field!");
}
<%
}
}
//
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode) codeGenArgument.getArgument();
String cid = node.getUniqueName();

View File

@@ -14,8 +14,57 @@ imports="
"
skeleton="../templates/db_output_bulk.skeleton"
%>
<%
//TPS-3315
org.talend.designer.codegen.config.CodeGeneratorArgument codeGenArgument_pwdCheck = (org.talend.designer.codegen.config.CodeGeneratorArgument)argument;
org.talend.core.model.process.INode node_pwdCheck = (org.talend.core.model.process.INode)codeGenArgument_pwdCheck.getArgument();
boolean useExistingConnection_pwdCheck = "true".equalsIgnoreCase(ElementParameterParser.getValue(node_pwdCheck,"__USE_EXISTING_CONNECTION__"));
if(!useExistingConnection_pwdCheck) {
String user_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__USER__");
String dbhost_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__HOST__");
String dbport_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PORT__");
String dbname_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__DBNAME__");
String dbproperties_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PROPERTIES__");
String localServiceName_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__LOCAL_SERVICE_NAME__");
final class ValueChecker {
public boolean checkValueForPassword(String inputValue, org.talend.core.model.process.IContext context) {
if(null == inputValue) {
return false;
}
java.util.List<String> parsed = new java.util.ArrayList<String>();
String value = inputValue.trim();
while(org.talend.core.model.utils.ContextParameterUtils.containContextVariables(value)) {
String nonQuoteStr = org.talend.core.utils.TalendQuoteUtils.filterQuote(value);
String contextVar = org.talend.core.model.utils.ContextParameterUtils.getVariableFromCode(nonQuoteStr);
parsed.add(contextVar);
String curValue = org.talend.core.model.utils.ContextParameterUtils.JAVA_NEW_CONTEXT_PREFIX + contextVar;
int index = value.indexOf(curValue);
if(index != -1) {
value = value.substring(index + curValue.length(), value.length());
}
}
for(String parsedParam : parsed) {
org.talend.core.model.process.IContextParameter param = context.getContextParameter(parsedParam);
if(org.talend.core.model.utils.ContextParameterUtils.isPasswordType(param)) {
return true;
}
}
return false;
}
}
ValueChecker checker = new ValueChecker();
org.talend.core.model.process.IContext context_pwdCheck = node_pwdCheck.getProcess().getContextManager().getDefaultContext();
if(checker.checkValueForPassword(dbhost_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbport_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbname_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbproperties_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(localServiceName_pwdCheck, context_pwdCheck)) {
%>
if(true) {
throw new RuntimeException("Password context variable is used in plain text field!");
}
<%
}
}
//
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();

View File

@@ -7,8 +7,57 @@ imports="
java.util.Map
"
%>
<%
//TPS-3315
org.talend.designer.codegen.config.CodeGeneratorArgument codeGenArgument_pwdCheck = (org.talend.designer.codegen.config.CodeGeneratorArgument)argument;
org.talend.core.model.process.INode node_pwdCheck = (org.talend.core.model.process.INode)codeGenArgument_pwdCheck.getArgument();
boolean useExistingConnection_pwdCheck = "true".equalsIgnoreCase(ElementParameterParser.getValue(node_pwdCheck,"__USE_EXISTING_CONNECTION__"));
if(!useExistingConnection_pwdCheck) {
String user_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__USER__");
String dbhost_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__HOST__");
String dbport_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PORT__");
String dbname_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__DBNAME__");
String dbproperties_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PROPERTIES__");
String localServiceName_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__LOCAL_SERVICE_NAME__");
final class ValueChecker {
public boolean checkValueForPassword(String inputValue, org.talend.core.model.process.IContext context) {
if(null == inputValue) {
return false;
}
java.util.List<String> parsed = new java.util.ArrayList<String>();
String value = inputValue.trim();
while(org.talend.core.model.utils.ContextParameterUtils.containContextVariables(value)) {
String nonQuoteStr = org.talend.core.utils.TalendQuoteUtils.filterQuote(value);
String contextVar = org.talend.core.model.utils.ContextParameterUtils.getVariableFromCode(nonQuoteStr);
parsed.add(contextVar);
String curValue = org.talend.core.model.utils.ContextParameterUtils.JAVA_NEW_CONTEXT_PREFIX + contextVar;
int index = value.indexOf(curValue);
if(index != -1) {
value = value.substring(index + curValue.length(), value.length());
}
}
for(String parsedParam : parsed) {
org.talend.core.model.process.IContextParameter param = context.getContextParameter(parsedParam);
if(org.talend.core.model.utils.ContextParameterUtils.isPasswordType(param)) {
return true;
}
}
return false;
}
}
ValueChecker checker = new ValueChecker();
org.talend.core.model.process.IContext context_pwdCheck = node_pwdCheck.getProcess().getContextManager().getDefaultContext();
if(checker.checkValueForPassword(dbhost_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbport_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbname_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbproperties_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(localServiceName_pwdCheck, context_pwdCheck)) {
%>
if(true) {
throw new RuntimeException("Password context variable is used in plain text field!");
}
<%
}
}
//
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode) codeGenArgument.getArgument();
String cid = node.getUniqueName();

View File

@@ -14,6 +14,7 @@ imports="
skeleton="../templates/db_output_bulk.skeleton"
%>
<%@ include file="../templates/Log4j/Log4jDBConnUtil.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
@@ -62,16 +63,7 @@ skeleton="../templates/db_output_bulk.skeleton"
%>
conn_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
<%
//Retrieve connection node and check if SSO was used for correct logging
List< ? extends INode> nodes = node.getProcess().getNodesOfType("tRedshiftConnection");
String connectionRedShift = ElementParameterParser.getValue(node,"__CONNECTION__");
for (INode ne : nodes) {
if (connectionRedShift.equals(ne.getUniqueName())) {
jdbcUrl = ElementParameterParser.getValue(ne, "__JDBC_URL__");
}
}
boolean needUserAndPassword = !"SSO".equals(jdbcUrl);
log4jCodeGenerateUtil.useExistConnection(node, needUserAndPassword);
log4jCodeGenerateUtil.useExistConnection(node);
} else {
%>
String driverClass_<%=cid%> = "com.amazon.redshift.jdbc42.Driver";
@@ -99,17 +91,17 @@ skeleton="../templates/db_output_bulk.skeleton"
}
%>
String url_<%=cid%> = sbuilder_<%=cid%>.toString();
<% if (!"SSO".equals(jdbcUrl)){
String passwordFieldName = "__PASS__";
if (ElementParameterParser.canEncrypt(node, passwordFieldName)) {%>
final String decryptedPass_<%=cid%> = routines.system.PasswordEncryptUtil.decryptPassword(<%=ElementParameterParser.getEncryptedValue(node, passwordFieldName)%>);
<%} else {%>
final String decryptedPass_<%=cid%> = <%= ElementParameterParser.getValue(node, passwordFieldName)%>;
<%}%>
String dbUser_<%=cid %> = <%=userName%>;
String dbPwd_<%=cid %> = decryptedPass_<%=cid%>;
<% }
<%
String passwordFieldName = "__PASS__";
if (ElementParameterParser.canEncrypt(node, passwordFieldName)) {%>
final String decryptedPass_<%=cid%> = routines.system.PasswordEncryptUtil.decryptPassword(<%=ElementParameterParser.getEncryptedValue(node, passwordFieldName)%>);
<%} else {%>
final String decryptedPass_<%=cid%> = <%= ElementParameterParser.getValue(node, passwordFieldName)%>;
<%}%>
String dbUser_<%=cid %> = <%=userName%>;
String dbPwd_<%=cid %> = decryptedPass_<%=cid%>;
<%
log4jCodeGenerateUtil.connect(node);
}

View File

@@ -70,13 +70,13 @@
<PARAMETER NAME="USER" FIELD="TEXT" NUM_ROW="5"
REPOSITORY_VALUE="USERNAME" REQUIRED="true"
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (JDBC_URL=='STANDARD')" GROUP="DB_CONFIG">
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') " GROUP="DB_CONFIG">
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER NAME="PASS" FIELD="PASSWORD" NUM_ROW="5"
REPOSITORY_VALUE="PASSWORD" REQUIRED="true"
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (JDBC_URL=='STANDARD')" GROUP="DB_CONFIG">
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') " GROUP="DB_CONFIG">
<DEFAULT>""</DEFAULT>
</PARAMETER>
@@ -419,7 +419,7 @@
UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-logging-1.1.3.jar"
REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="commons-codec-1.6.jar" MODULE="commons-codec-1.6.jar"
MVN="mvn:org.talend.libraries/commons-codec-1.6/6.0.0"
MVN="mvn:commons-codec/commons-codec/1.6"
UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-codec-1.6.jar"
REQUIRED="true" />
</IMPORTS>

View File

@@ -6,6 +6,7 @@ imports="
"
%>
<%@ include file="../templates/DB/HelpClass/HelpClass.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
class ConnectionUtil extends DefaultConnectionUtil{

View File

@@ -99,7 +99,6 @@
NUM_ROW="4"
REPOSITORY_VALUE="USERNAME"
REQUIRED="true"
SHOW_IF="JDBC_URL=='STANDARD'"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
@@ -110,7 +109,6 @@
NUM_ROW="4"
REPOSITORY_VALUE="PASSWORD"
REQUIRED="true"
SHOW_IF="JDBC_URL=='STANDARD'"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
@@ -207,6 +205,7 @@
<IMPORT NAME="httpcore-4.4.9.jar" MODULE="httpcore-4.4.9.jar" MVN="mvn:org.apache.httpcomponents/httpcore/4.4.9" REQUIRED_IF="(JDBC_URL == 'SSO')" />
<IMPORT NAME="httpclient-4.5.5.jar" MODULE="httpclient-4.5.5.jar" MVN="mvn:org.apache.httpcomponents/httpclient/4.5.5" REQUIRED_IF="(JDBC_URL == 'SSO')" />
<IMPORT NAME="joda-time-2.8.1.jar" MODULE="joda-time-2.8.1.jar" MVN="mvn:joda-time/joda-time/2.8.1" REQUIRED_IF="(JDBC_URL == 'SSO')" />
<IMPORT NAME="commons-codec-1.6.jar" MODULE="commons-codec-1.6.jar" MVN="mvn:commons-codec/commons-codec/1.6" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-codec-1.6.jar" REQUIRED_IF="(JDBC_URL == 'SSO')" />
</IMPORTS>
</CODEGENERATION>

View File

@@ -13,12 +13,11 @@ imports="
"
%>
<%@ include file="../templates/DB/Input/HelpClass.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
class DBInputBeginUtil extends DefaultDBInputUtil{
private boolean needUserAndPassword = true;
public void setURL(INode node) {
boolean useLogFile= "true".equals(ElementParameterParser.getValue(node, "__USE_LOG_FILE__"));
@@ -76,8 +75,7 @@ imports="
public void createConnection(INode node) {
String jdbcUrl = ElementParameterParser.getValue(node, "__JDBC_URL__");
if ("SSO".equals(jdbcUrl)) needUserAndPassword = false;
super.createConnection(node, needUserAndPassword);
super.createConnection(node);
String useCursor= ElementParameterParser.getValue(node, "__USE_CURSOR__");
if(("true").equals(useCursor)) {
log4jCodeGenerateUtil.autoCommit(node,false);

View File

@@ -120,7 +120,7 @@
NUM_ROW="5"
REPOSITORY_VALUE="USERNAME"
REQUIRED="true"
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (JDBC_URL=='STANDARD')"
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') "
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
@@ -131,7 +131,7 @@
NUM_ROW="5"
REPOSITORY_VALUE="PASSWORD"
REQUIRED="true"
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (JDBC_URL=='STANDARD')"
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') "
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
@@ -288,6 +288,7 @@
<IMPORT NAME="httpcore-4.4.9.jar" MODULE="httpcore-4.4.9.jar" MVN="mvn:org.apache.httpcomponents/httpcore/4.4.9" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpclient-4.5.5.jar" MODULE="httpclient-4.5.5.jar" MVN="mvn:org.apache.httpcomponents/httpclient/4.5.5" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="joda-time-2.8.1.jar" MODULE="joda-time-2.8.1.jar" MVN="mvn:joda-time/joda-time/2.8.1" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="commons-codec-1.6.jar" MODULE="commons-codec-1.6.jar" MVN="mvn:commons-codec/commons-codec/1.6" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-codec-1.6.jar" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
</IMPORTS>
</CODEGENERATION>

View File

@@ -16,6 +16,7 @@ imports="
skeleton="../templates/db_output_bulk.skeleton"
%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/Log4j/DBLogUtil.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
@@ -211,21 +212,8 @@ if(("true").equals(useExistingConn)) {
String conn = "conn_" + connection;
%>
conn_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
<%
//Retrieve connection node and check if SSO was used for correct logging
List< ? extends INode> nodes = node.getProcess().getNodesOfType("tRedshiftConnection");
String connectionRedShift = ElementParameterParser.getValue(node,"__CONNECTION__");
for (INode ne : nodes) {
if (connectionRedShift.equals(ne.getUniqueName())) {
jdbcUrl = ElementParameterParser.getValue(ne, "__JDBC_URL__");
}
}
if ("SSO".equals(jdbcUrl)){
dbLog.conn().useExistConn("conn_"+cid+".getMetaData().getURL()", null);
} else {
dbLog.conn().useExistConn("conn_"+cid+".getMetaData().getURL()", "conn_"+cid+".getMetaData().getUserName()");
}
dbLog.conn().useExistConn("conn_"+cid+".getMetaData().getURL()", "conn_"+cid+".getMetaData().getUserName()");
%>
<%
} else {
@@ -254,30 +242,19 @@ if(("true").equals(useExistingConn)) {
<%
}
%>
String url_<%=cid%> = sbuilder_<%=cid%>.toString();
<% if ("SSO".equals(jdbcUrl)){%>
conn_<%=cid%> = java.sql.DriverManager.getConnection(url_<%=cid %>);
<%dbLog.conn().connTry(dbLog.var("url"), null);%>
<%dbLog.conn().connDone(dbLog.var("url"));%>
<% } else {%>
String dbUser_<%=cid %> = <%=dbuser%>;
<%
String passwordFieldName = "__PASS__";
%>
String url_<%=cid%> = sbuilder_<%=cid%>.toString();
String dbUser_<%=cid %> = <%=dbuser%>;
<%
String passwordFieldName = "__PASS__";
%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
String dbPwd_<%=cid %> = decryptedPassword_<%=cid%>;
conn_<%=cid%> = java.sql.DriverManager.getConnection(url_<%=cid %>,dbUser_<%=cid%>,dbPwd_<%=cid%>);
<%dbLog.conn().connTry(dbLog.var("url"), dbLog.var("dbUser"));%>
<%dbLog.conn().connDone(dbLog.var("url"));%>
<% }%>
String dbPwd_<%=cid %> = decryptedPassword_<%=cid%>;
conn_<%=cid%> = java.sql.DriverManager.getConnection(url_<%=cid %>,dbUser_<%=cid%>,dbPwd_<%=cid%>);
<%dbLog.conn().connTry(dbLog.var("url"), dbLog.var("dbUser"));%>
<%dbLog.conn().connDone(dbLog.var("url"));%>
resourceMap.put("conn_<%=cid%>", conn_<%=cid%>);
conn_<%=cid%>.setAutoCommit(false);
<%

View File

@@ -124,7 +124,7 @@
NUM_ROW="5"
REPOSITORY_VALUE="USERNAME"
REQUIRED="true"
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (JDBC_URL=='STANDARD')"
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') "
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
@@ -135,7 +135,7 @@
NUM_ROW="5"
REPOSITORY_VALUE="PASSWORD"
REQUIRED="true"
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (JDBC_URL=='STANDARD')"
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') "
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
@@ -378,6 +378,7 @@
<IMPORT NAME="httpcore-4.4.9.jar" MODULE="httpcore-4.4.9.jar" MVN="mvn:org.apache.httpcomponents/httpcore/4.4.9" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpclient-4.5.5.jar" MODULE="httpclient-4.5.5.jar" MVN="mvn:org.apache.httpcomponents/httpclient/4.5.5" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="joda-time-2.8.1.jar" MODULE="joda-time-2.8.1.jar" MVN="mvn:joda-time/joda-time/2.8.1" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="commons-codec-1.6.jar" MODULE="commons-codec-1.6.jar" MVN="mvn:commons-codec/commons-codec/1.6" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-codec-1.6.jar" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
</IMPORTS>
</CODEGENERATION>

View File

@@ -63,12 +63,12 @@
<DEFAULT>Redshift</DEFAULT>
</PARAMETER>
<PARAMETER NAME="USER" FIELD="TEXT" NUM_ROW="5" SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (JDBC_URL=='STANDARD')"
<PARAMETER NAME="USER" FIELD="TEXT" NUM_ROW="5" SHOW_IF="(USE_EXISTING_CONNECTION == 'false') "
REPOSITORY_VALUE="USERNAME" REQUIRED="true" GROUP="DB_CONFIG">
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER NAME="PASS" FIELD="PASSWORD" NUM_ROW="5" SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (JDBC_URL=='STANDARD')"
<PARAMETER NAME="PASS" FIELD="PASSWORD" NUM_ROW="5" SHOW_IF="(USE_EXISTING_CONNECTION == 'false') "
REPOSITORY_VALUE="PASSWORD" REQUIRED="true" GROUP="DB_CONFIG">
<DEFAULT>""</DEFAULT>
</PARAMETER>
@@ -538,7 +538,7 @@
UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-logging-1.1.3.jar"
REQUIRED="true" />
<IMPORT NAME="commons-codec-1.6.jar" MODULE="commons-codec-1.6.jar"
MVN="mvn:org.talend.libraries/commons-codec-1.6/6.0.0"
MVN="mvn:commons-codec/commons-codec/1.6"
UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-codec-1.6.jar"
REQUIRED="true" />
</IMPORTS>

View File

@@ -8,6 +8,7 @@ imports="
"
%>
<%@ include file="../templates/DB/Row/HelpClass.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
class DBRowBeginUtil extends DefaultDBRowUtil{

View File

@@ -122,7 +122,7 @@
NUM_ROW="5"
REPOSITORY_VALUE="USERNAME"
REQUIRED="true"
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (JDBC_URL=='STANDARD')"
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') "
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
@@ -133,7 +133,7 @@
NUM_ROW="5"
REPOSITORY_VALUE="PASSWORD"
REQUIRED="true"
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (JDBC_URL=='STANDARD')"
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') "
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
@@ -306,6 +306,7 @@
<IMPORT NAME="httpcore-4.4.9.jar" MODULE="httpcore-4.4.9.jar" MVN="mvn:org.apache.httpcomponents/httpcore/4.4.9" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpclient-4.5.5.jar" MODULE="httpclient-4.5.5.jar" MVN="mvn:org.apache.httpcomponents/httpclient/4.5.5" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="joda-time-2.8.1.jar" MODULE="joda-time-2.8.1.jar" MVN="mvn:joda-time/joda-time/2.8.1" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="commons-codec-1.6.jar" MODULE="commons-codec-1.6.jar" MVN="mvn:commons-codec/commons-codec/1.6" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-codec-1.6.jar" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
</IMPORTS>
</CODEGENERATION>

View File

@@ -14,6 +14,7 @@ imports="
"
%>
<%@ include file="../templates/Log4j/Log4jDBConnUtil.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
@@ -40,16 +41,7 @@ imports="
%>
conn_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
<%
//Retrieve connection node and check if SSO was used for correct logging
List< ? extends INode> nodes = node.getProcess().getNodesOfType("tRedshiftConnection");
String connectionRedShift = ElementParameterParser.getValue(node,"__CONNECTION__");
for (INode ne : nodes) {
if (connectionRedShift.equals(ne.getUniqueName())) {
jdbcUrl = ElementParameterParser.getValue(ne, "__JDBC_URL__");
}
}
boolean needUserAndPassword = !"SSO".equals(jdbcUrl);
log4jCodeGenerateUtil.useExistConnection(node, needUserAndPassword);
log4jCodeGenerateUtil.useExistConnection(node);
} else {
%>
String driverClass_<%=cid%> = "com.amazon.redshift.jdbc42.Driver";
@@ -78,17 +70,16 @@ imports="
%>
String url_<%=cid%> = sbuilder_<%=cid%>.toString();
<%
if (!"SSO".equals(jdbcUrl)){
String passwordFieldName = "__PASS__";
%>
<%if (ElementParameterParser.canEncrypt(node, passwordFieldName)) {%>
final String decryptedPass_<%=cid%> = routines.system.PasswordEncryptUtil.decryptPassword(<%=ElementParameterParser.getEncryptedValue(node, passwordFieldName)%>);
<%} else {%>
final String decryptedPass_<%=cid%> = <%= ElementParameterParser.getValue(node, passwordFieldName)%>;
<%}%>
String dbUser_<%=cid %> = <%=userName%>;
String dbPwd_<%=cid %> = decryptedPass_<%=cid%>;
<% }
String passwordFieldName = "__PASS__";
%>
<%if (ElementParameterParser.canEncrypt(node, passwordFieldName)) {%>
final String decryptedPass_<%=cid%> = routines.system.PasswordEncryptUtil.decryptPassword(<%=ElementParameterParser.getEncryptedValue(node, passwordFieldName)%>);
<%} else {%>
final String decryptedPass_<%=cid%> = <%= ElementParameterParser.getValue(node, passwordFieldName)%>;
<%}%>
String dbUser_<%=cid %> = <%=userName%>;
String dbPwd_<%=cid %> = decryptedPass_<%=cid%>;
<%
log4jCodeGenerateUtil.connect(node);
}

View File

@@ -62,12 +62,12 @@
<DEFAULT>Redshift</DEFAULT>
</PARAMETER>
<PARAMETER NAME="USER" FIELD="TEXT" NUM_ROW="5" SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (JDBC_URL=='STANDARD')"
<PARAMETER NAME="USER" FIELD="TEXT" NUM_ROW="5" SHOW_IF="(USE_EXISTING_CONNECTION == 'false') "
REPOSITORY_VALUE="USERNAME" REQUIRED="true" GROUP="DB_CONFIG">
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER NAME="PASS" FIELD="PASSWORD" NUM_ROW="5" SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (JDBC_URL=='STANDARD')"
<PARAMETER NAME="PASS" FIELD="PASSWORD" NUM_ROW="5" SHOW_IF="(USE_EXISTING_CONNECTION == 'false') "
REPOSITORY_VALUE="PASSWORD" REQUIRED="true" GROUP="DB_CONFIG">
<DEFAULT>""</DEFAULT>
</PARAMETER>
@@ -281,6 +281,7 @@
<IMPORT NAME="httpcore-4.4.9.jar" MODULE="httpcore-4.4.9.jar" MVN="mvn:org.apache.httpcomponents/httpcore/4.4.9" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpclient-4.5.5.jar" MODULE="httpclient-4.5.5.jar" MVN="mvn:org.apache.httpcomponents/httpclient/4.5.5" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="joda-time-2.8.1.jar" MODULE="joda-time-2.8.1.jar" MVN="mvn:joda-time/joda-time/2.8.1" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="commons-codec-1.6.jar" MODULE="commons-codec-1.6.jar" MVN="mvn:commons-codec/commons-codec/1.6" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-codec-1.6.jar" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
</IMPORTS>
</CODEGENERATION>
<RETURNS />

View File

@@ -26,22 +26,17 @@ imports="
connUtil.beforeComponentProcess(node);
connUtil.createURL(node);
%>
<%
if (!"SSO".equals(ElementParameterParser.getValue(node, "__JDBC_URL__"))){
%>
String dbUser_<%=cid%> = <%=(dbuser != null && dbuser.trim().length() == 0)? "null":dbuser%>;<%//the tSQLiteConnection component not contain user and pass return null%>
<%if(dbpass != null && dbpass.trim().length() == 0) {%>
String dbPwd_<%=cid%> = null;
<%} else {
String passwordFieldName = "__PASS__";
%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
String dbPwd_<%=cid%> = decryptedPassword_<%=cid%>;
<%}%>
<%
}
%>
String dbUser_<%=cid%> = <%=(dbuser != null && dbuser.trim().length() == 0)? "null":dbuser%>;<%//the tSQLiteConnection component not contain user and pass return null%>
<%if(dbpass != null && dbpass.trim().length() == 0) {%>
String dbPwd_<%=cid%> = null;
<%} else {
String passwordFieldName = "__PASS__";
%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
String dbPwd_<%=cid%> = decryptedPassword_<%=cid%>;
<%}%>
java.sql.Connection conn_<%=cid%> = null;
<%@ include file="../Log4j/Log4jDBConnUtil.javajet"%>
<%
@@ -63,13 +58,8 @@ imports="
<%connUtil.classForName(node);%>
<%
log4jCodeGenerateUtil.debugConnectionParams(node);
if ("SSO".equals(ElementParameterParser.getValue(node, "__JDBC_URL__"))){
log4jCodeGenerateUtil.connect_begin_noUser();
connUtil.createConnection(node, false);
} else {
log4jCodeGenerateUtil.connect_begin();
connUtil.createConnection(node);
}
log4jCodeGenerateUtil.connect_begin();
connUtil.createConnection(node);
log4jCodeGenerateUtil.connect_end();
%>

View File

@@ -0,0 +1,50 @@
<%@jet%>
<%
org.talend.designer.codegen.config.CodeGeneratorArgument codeGenArgument_pwdCheck = (org.talend.designer.codegen.config.CodeGeneratorArgument)argument;
org.talend.core.model.process.INode node_pwdCheck = (org.talend.core.model.process.INode)codeGenArgument_pwdCheck.getArgument();
boolean useExistingConnection_pwdCheck = "true".equalsIgnoreCase(ElementParameterParser.getValue(node_pwdCheck,"__USE_EXISTING_CONNECTION__"));
if(!useExistingConnection_pwdCheck) {
String dbhost_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__HOST__");
String dbuser_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__USER__");
String dbport_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PORT__");
String dbname_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__DBNAME__");
String dbproperties_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PROPERTIES__");
final class ValueChecker {
public boolean checkValueForPassword(String inputValue, org.talend.core.model.process.IContext context) {
if(null == inputValue) {
return false;
}
java.util.List<String> parsed = new java.util.ArrayList<String>();
String value = inputValue.trim();
while(org.talend.core.model.utils.ContextParameterUtils.containContextVariables(value)) {
String nonQuoteStr = org.talend.core.utils.TalendQuoteUtils.filterQuote(value);
String contextVar = org.talend.core.model.utils.ContextParameterUtils.getVariableFromCode(nonQuoteStr);
parsed.add(contextVar);
String curValue = org.talend.core.model.utils.ContextParameterUtils.JAVA_NEW_CONTEXT_PREFIX + contextVar;
int index = value.indexOf(curValue);
if(index != -1) {
value = value.substring(index + curValue.length(), value.length());
}
}
for(String parsedParam : parsed) {
org.talend.core.model.process.IContextParameter param = context.getContextParameter(parsedParam);
if(org.talend.core.model.utils.ContextParameterUtils.isPasswordType(param)) {
return true;
}
}
return false;
}
}
ValueChecker checker = new ValueChecker();
org.talend.core.model.process.IContext context_pwdCheck = node_pwdCheck.getProcess().getContextManager().getDefaultContext();
if(checker.checkValueForPassword(dbhost_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbport_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbname_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbproperties_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbuser_pwdCheck, context_pwdCheck)) {
%>
if(true) {
throw new RuntimeException("Password context variable is used in plain text field!");
}
<%
}
}
%>

View File

@@ -66,17 +66,10 @@ imports="
}
public void createConnection(INode node) {
this.createConnection(node, true);
%>
conn_<%=cid%> = java.sql.DriverManager.getConnection(url_<%=cid%>,dbUser_<%=cid%>,dbPwd_<%=cid%>);
<%
}
public void createConnection(INode node, boolean needUserAndPassword) {%>
<% if(needUserAndPassword){%>
conn_<%=cid%> = java.sql.DriverManager.getConnection(url_<%=cid%>,dbUser_<%=cid%>,dbPwd_<%=cid%>);
<% } else {%>
conn_<%=cid%> = java.sql.DriverManager.getConnection(url_<%=cid%>);
<% }
}
public void setAutoCommit(INode node) {
boolean setAutoCommit = "true".equals(ElementParameterParser.getValue(node, "__AUTO_COMMIT__"));
if(isLog4jEnabled){

View File

@@ -61,24 +61,8 @@ imports="
conn += "_in";
}
%>
conn_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
<%
if ("REDSHIFT".equals(type)){
String jdbcUrl = "";
//Retrieve connection node and check if SSO was used for correct logging
List< ? extends INode> nodes = node.getProcess().getNodesOfType("tRedshiftConnection");
String connectionRedShift = ElementParameterParser.getValue(node,"__CONNECTION__");
for (INode ne : nodes) {
if (connectionRedShift.equals(ne.getUniqueName())) {
jdbcUrl = ElementParameterParser.getValue(ne, "__JDBC_URL__");
}
}
boolean needUserAndPassword = !"SSO".equals(jdbcUrl);
log4jCodeGenerateUtil.useExistConnection(node, needUserAndPassword);
} else {
log4jCodeGenerateUtil.useExistConnection(node);
}
%>
conn_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
<%log4jCodeGenerateUtil.useExistConnection(node);%>
<%
dbInputBeginUtil.afterUseExistConnection(node);
} else {

View File

@@ -79,21 +79,18 @@ imports="
java.lang.Class jdbcclazz_<%=cid%> = java.lang.Class.forName(driverClass_<%=cid%>);
<%
newInstance(node);
%>
String dbUser_<%=cid %> = <%=dbuser%>;
<%
String passwordFieldName = "__PASS__";
%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
if (needUserAndPassword){%>
String dbUser_<%=cid %> = <%=dbuser%>;
<%
String passwordFieldName = "__PASS__";
%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
String dbPwd_<%=cid %> = decryptedPassword_<%=cid%>;
<% }%>
String dbPwd_<%=cid %> = decryptedPassword_<%=cid%>;
<%this.setURL(node);%>
<%
log4jCodeGenerateUtil.debugConnectionParams(node);
if ("SSO".equals(ElementParameterParser.getValue(node, "__JDBC_URL__")) || !needUserAndPassword){
if (!needUserAndPassword){
log4jCodeGenerateUtil.connect_begin_noUser();
} else {
log4jCodeGenerateUtil.connect_begin();

View File

@@ -27,11 +27,7 @@ imports="
String query_<%=cid %> = "";
boolean whetherReject_<%=cid%> = false;
<%
if ("SSO".equals(ElementParameterParser.getValue(node, "__JDBC_URL__"))){
dbRowBeginUtil.createConnection(node, false);
} else {
dbRowBeginUtil.createConnection(node);
}
dbRowBeginUtil.createConnection(node);
%>
resourceMap.put("conn_<%=cid%>", conn_<%=cid%>);
<%

View File

@@ -28,10 +28,6 @@
log4jCodeGenerateUtil.useExistConnection(node);
}
public void afterUseExistConnection(INode node, boolean needUserAndPassword) {
log4jCodeGenerateUtil.useExistConnection(node, needUserAndPassword);
}
public String getDirverClassName(INode node){
return "";
}
@@ -69,23 +65,8 @@
String conn = "conn_" + connection;;
%>
conn_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
<%
String type = ElementParameterParser.getValue(node, "__TYPE__");
if ("REDSHIFT".equals(type)){
String jdbcUrl = "";
//Retrieve connection node and check if SSO was used for correct logging
java.util.List< ? extends INode> nodes = node.getProcess().getNodesOfType("tRedshiftConnection");
String connectionRedShift = ElementParameterParser.getValue(node,"__CONNECTION__");
for (INode ne : nodes) {
if (connectionRedShift.equals(ne.getUniqueName())) {
jdbcUrl = ElementParameterParser.getValue(ne, "__JDBC_URL__");
}
}
needUserAndPassword = !"SSO".equals(jdbcUrl);
this.afterUseExistConnection(node, needUserAndPassword);
} else {
<%
this.afterUseExistConnection(node);
}
} else {
boolean specify_alias = "true".equals(ElementParameterParser.getValue(node, "__SPECIFY_DATASOURCE_ALIAS__"));
if(specify_alias){

View File

@@ -64,10 +64,6 @@ imports="
}
public void useExistConnection(INode node){
useExistConnection(node, true);
}
public void useExistConnection(INode node, boolean needUserAndPassword){
beforeComponentProcess(node);
if(isLog4jEnabled) {
%>
@@ -75,8 +71,6 @@ imports="
if(conn_<%=cid%>.getMetaData() != null) {
<%if (cid.contains("tImpala") || cid.contains("tHive")) {%>
log.debug("<%=cid%> - Uses an existing connection <%=connection %>.");
<%} else if (!needUserAndPassword){%>
log.debug("<%=cid%> - Uses an existing connection. Connection URL: " + conn_<%=cid%>.getMetaData().getURL() + ".");
<%} else {%>
log.debug("<%=cid%> - Uses an existing connection with username '" + conn_<%=cid%>.getMetaData().getUserName() + "'. Connection URL: " + conn_<%=cid%>.getMetaData().getURL() + ".");
<%}%>
@@ -88,11 +82,7 @@ imports="
public void connect(INode node){
beforeComponentProcess(node);
if ("SSO".equals(ElementParameterParser.getValue(node, "__JDBC_URL__"))){
connectWithSSO();
} else {
connect();
}
connect();
}
public void connect(){
@@ -103,14 +93,6 @@ imports="
connect_end();
}
public void connectWithSSO(){
connect_begin_noUser();
%>
conn_<%=cid%> = java.sql.DriverManager.getConnection(url_<%=cid %>);
<%
connect_end();
}
public void connect_begin(){
logInfo(node,"debug",cid+" - Connection attempt to '\" + url_"+cid+" + \"' with the username '\" + dbUser_"+cid+" + \"'.");
}

View File

@@ -3506,4 +3506,4 @@
</loginTask>
</extension>
</plugin>
</plugin>