Compare commits

..

2 Commits

48 changed files with 139 additions and 614 deletions

View File

@@ -5,13 +5,13 @@ product:
- https://talend.poolparty.biz/coretaxonomy/23
---
# TPS-3290
# TPS-4124
| Info | Value |
| ---------------- | ---------------- |
| Patch Name | Patch\_20190805\_TPS-3290\_v1-7.2.1 |
| Release Date | 2019-08-05 |
| Target Version | 20190620_1446-V7.2.1 |
| Patch Name | Patch\_20200615\_TPS-4124\_v1-7.2.1 |
| Release Date | 2020-06-15 |
| Target Version | 20190620\_1446-V7.2.1 |
| Product affected | Talend Studio |
## Introduction
@@ -24,7 +24,7 @@ This is a self-contained patch.
This patch contains the following fixes:
- TPS-3290 [7.2.1] SSO enabled Redshift connectivity with Talend 7.2.1 Big Data Platform (Standard Job) (TDI-42674)
- TPS-4124 [7.2.1] ClassCastException with tLibraryLoad's Dynamics Libs in Java 11 (TDI-44305)
## Prerequisites
@@ -55,3 +55,12 @@ 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/tLibraryLoad/tLibraryLoad\_begin.javajet

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,7 +16,6 @@
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,7 +17,6 @@
java.util.HashSet
"
%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%

View File

@@ -18,56 +18,8 @@
"
%>
<%
//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

@@ -17,17 +17,19 @@
<% if(hotLibs!=null&&hotLibs.size() > 0){%>
java.net.URLClassLoader sysloader_<%=cid %> = (java.net.URLClassLoader) ClassLoader.getSystemClassLoader();
java.lang.reflect.Method method_<%=cid %> = java.net.URLClassLoader.class.getDeclaredMethod("addURL", new Class[] { java.net.URL.class });
method_<%=cid %>.setAccessible(true);
String[] libPaths_<%=cid %> = new String[] { <% for(Map<String, String> item : hotLibs) {%> <%=item.get("LIBPATH") %>, <%}%> };
String[] libPaths_<%=cid %> = new String[] { <% for(Map<String, String> item : hotLibs){%> <%=item.get("LIBPATH") %>, <%}%> };
for(String lib_<%=cid %>:libPaths_<%=cid %> ){
java.util.List<java.net.URL> libURL_<%=cid %> = new java.util.ArrayList<>();
for(String lib_<%=cid %>:libPaths_<%=cid %>) {
String separator_<%=cid %> = System.getProperty("path.separator");
String[] jarFiles_<%=cid %> = lib_<%=cid %>.split(separator_<%=cid %>);
for(String jarFile_<%=cid %>:jarFiles_<%=cid %>){
method_<%=cid %>.invoke(sysloader_<%=cid %>, new Object[] { new java.io.File(jarFile_<%=cid %>).toURL() });
for(String jarFile_<%=cid %> : jarFiles_<%=cid %>) {
libURL_<%=cid %>.add( new java.io.File(jarFile_<%=cid %>).toURI().toURL() );
}
}
java.net.URL[] libURLArray_<%=cid %> = libURL_<%=cid %>.toArray(new java.net.URL[] {});
ClassLoader threadClassLoader_<%=cid %> = Thread.currentThread().getContextClassLoader();
java.net.URLClassLoader newthreadClassLoader_<%=cid %> = new java.net.URLClassLoader(libURLArray_<%=cid %>, threadClassLoader_<%=cid %>);
Thread.currentThread().setContextClassLoader(newthreadClassLoader_<%=cid %>);
<%}%>

View File

@@ -15,7 +15,6 @@ 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,7 +6,6 @@ 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,7 +13,6 @@ 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,7 +17,6 @@ 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,7 +6,6 @@ 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,7 +18,6 @@ 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,7 +9,6 @@ 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,7 +14,6 @@ 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,7 +6,6 @@ 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,7 +13,6 @@ 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,7 +17,6 @@ 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,7 +6,6 @@ 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,7 +8,6 @@ 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,7 +18,6 @@ skeleton="../templates/db_output_bulk.skeleton"
%>
<%@ include file="../templates/Log4j/Log4jDBConnUtil.javajet"%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
@@ -97,57 +96,6 @@ 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,56 +7,6 @@ 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,56 +14,6 @@ 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,56 +51,6 @@ 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,58 +6,8 @@ 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,56 +18,6 @@ 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,57 +14,8 @@ 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,57 +7,8 @@ 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,7 +14,6 @@ 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();
@@ -100,17 +99,17 @@ skeleton="../templates/db_output_bulk.skeleton"
}
%>
String url_<%=cid%> = sbuilder_<%=cid%>.toString();
<%
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%>;
<%
<% 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%>;
<% }
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') " GROUP="DB_CONFIG">
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (JDBC_URL=='STANDARD')" 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') " GROUP="DB_CONFIG">
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (JDBC_URL=='STANDARD')" 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:commons-codec/commons-codec/1.6"
MVN="mvn:org.talend.libraries/commons-codec-1.6/6.0.0"
UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-codec-1.6.jar"
REQUIRED="true" />
</IMPORTS>

View File

@@ -6,7 +6,6 @@ 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,6 +99,7 @@
NUM_ROW="4"
REPOSITORY_VALUE="USERNAME"
REQUIRED="true"
SHOW_IF="JDBC_URL=='STANDARD'"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
@@ -109,6 +110,7 @@
NUM_ROW="4"
REPOSITORY_VALUE="PASSWORD"
REQUIRED="true"
SHOW_IF="JDBC_URL=='STANDARD'"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
@@ -205,7 +207,6 @@
<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,7 +13,6 @@ imports="
"
%>
<%@ include file="../templates/DB/Input/HelpClass.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
class DBInputBeginUtil extends DefaultDBInputUtil{
@@ -77,7 +76,8 @@ imports="
public void createConnection(INode node) {
String jdbcUrl = ElementParameterParser.getValue(node, "__JDBC_URL__");
super.createConnection(node);
if ("SSO".equals(jdbcUrl)) needUserAndPassword = false;
super.createConnection(node, needUserAndPassword);
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') "
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (JDBC_URL=='STANDARD')"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
@@ -131,7 +131,7 @@
NUM_ROW="5"
REPOSITORY_VALUE="PASSWORD"
REQUIRED="true"
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') "
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (JDBC_URL=='STANDARD')"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
@@ -288,7 +288,6 @@
<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,7 +16,6 @@ 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();
@@ -222,7 +221,11 @@ if(("true").equals(useExistingConn)) {
jdbcUrl = ElementParameterParser.getValue(ne, "__JDBC_URL__");
}
}
dbLog.conn().useExistConn("conn_"+cid+".getMetaData().getURL()", "conn_"+cid+".getMetaData().getUserName()");
if ("SSO".equals(jdbcUrl)){
dbLog.conn().useExistConn("conn_"+cid+".getMetaData().getURL()", null);
} else {
dbLog.conn().useExistConn("conn_"+cid+".getMetaData().getURL()", "conn_"+cid+".getMetaData().getUserName()");
}
%>
<%
} else {
@@ -258,18 +261,23 @@ if(("true").equals(useExistingConn)) {
String dbUser_<%=cid %> = <%=dbuser%>;
<%
String passwordFieldName = "__PASS__";
%>
<% 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__";
%>
<%@ 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') "
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (JDBC_URL=='STANDARD')"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
@@ -135,7 +135,7 @@
NUM_ROW="5"
REPOSITORY_VALUE="PASSWORD"
REQUIRED="true"
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') "
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (JDBC_URL=='STANDARD')"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
@@ -378,7 +378,6 @@
<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') "
<PARAMETER NAME="USER" FIELD="TEXT" NUM_ROW="5" SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (JDBC_URL=='STANDARD')"
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') "
<PARAMETER NAME="PASS" FIELD="PASSWORD" NUM_ROW="5" SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (JDBC_URL=='STANDARD')"
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:commons-codec/commons-codec/1.6"
MVN="mvn:org.talend.libraries/commons-codec-1.6/6.0.0"
UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-codec-1.6.jar"
REQUIRED="true" />
</IMPORTS>

View File

@@ -8,7 +8,6 @@ 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') "
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (JDBC_URL=='STANDARD')"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
@@ -133,7 +133,7 @@
NUM_ROW="5"
REPOSITORY_VALUE="PASSWORD"
REQUIRED="true"
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') "
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (JDBC_URL=='STANDARD')"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
@@ -306,7 +306,6 @@
<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,7 +14,6 @@ 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();
@@ -49,7 +48,8 @@ imports="
jdbcUrl = ElementParameterParser.getValue(ne, "__JDBC_URL__");
}
}
log4jCodeGenerateUtil.useExistConnection(node);
boolean needUserAndPassword = !"SSO".equals(jdbcUrl);
log4jCodeGenerateUtil.useExistConnection(node, needUserAndPassword);
} else {
%>
String driverClass_<%=cid%> = "com.amazon.redshift.jdbc42.Driver";
@@ -78,16 +78,17 @@ imports="
%>
String url_<%=cid%> = sbuilder_<%=cid%>.toString();
<%
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%>;
<%
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%>;
<% }
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') "
<PARAMETER NAME="USER" FIELD="TEXT" NUM_ROW="5" SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (JDBC_URL=='STANDARD')"
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') "
<PARAMETER NAME="PASS" FIELD="PASSWORD" NUM_ROW="5" SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (JDBC_URL=='STANDARD')"
REPOSITORY_VALUE="PASSWORD" REQUIRED="true" GROUP="DB_CONFIG">
<DEFAULT>""</DEFAULT>
</PARAMETER>
@@ -281,7 +281,6 @@
<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,17 +26,22 @@ imports="
connUtil.beforeComponentProcess(node);
connUtil.createURL(node);
%>
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%>;
<%}%>
<%
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%>;
<%}%>
<%
}
%>
java.sql.Connection conn_<%=cid%> = null;
<%@ include file="../Log4j/Log4jDBConnUtil.javajet"%>
<%
@@ -58,8 +63,13 @@ imports="
<%connUtil.classForName(node);%>
<%
log4jCodeGenerateUtil.debugConnectionParams(node);
log4jCodeGenerateUtil.connect_begin();
connUtil.createConnection(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_end();
%>

View File

@@ -1,50 +0,0 @@
<%@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

@@ -73,8 +73,7 @@ imports="
jdbcUrl = ElementParameterParser.getValue(ne, "__JDBC_URL__");
}
}
//TODO changeme
boolean needUserAndPassword = true;
boolean needUserAndPassword = !"SSO".equals(jdbcUrl);
log4jCodeGenerateUtil.useExistConnection(node, needUserAndPassword);
} else {
log4jCodeGenerateUtil.useExistConnection(node);

View File

@@ -93,7 +93,7 @@ imports="
<%this.setURL(node);%>
<%
log4jCodeGenerateUtil.debugConnectionParams(node);
if (!needUserAndPassword){
if ("SSO".equals(ElementParameterParser.getValue(node, "__JDBC_URL__")) || !needUserAndPassword){
log4jCodeGenerateUtil.connect_begin_noUser();
} else {
log4jCodeGenerateUtil.connect_begin();

View File

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

View File

@@ -81,8 +81,7 @@
jdbcUrl = ElementParameterParser.getValue(ne, "__JDBC_URL__");
}
}
//TODO changeme
needUserAndPassword = true;
needUserAndPassword = !"SSO".equals(jdbcUrl);
this.afterUseExistConnection(node, needUserAndPassword);
} else {
this.afterUseExistConnection(node);

View File

@@ -88,7 +88,11 @@ imports="
public void connect(INode node){
beforeComponentProcess(node);
connect();
if ("SSO".equals(ElementParameterParser.getValue(node, "__JDBC_URL__"))){
connectWithSSO();
} else {
connect();
}
}
public void connect(){
@@ -99,6 +103,14 @@ 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+" + \"'.");
}