Compare commits
33 Commits
patch/TPS-
...
bugfix/pat
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
614218e47f | ||
|
|
59bc8d1e2d | ||
|
|
12dd79ea3a | ||
|
|
1c41a93eae | ||
|
|
8e6231e008 | ||
|
|
085af13fc4 | ||
|
|
a0488e2318 | ||
|
|
710fd4c47d | ||
|
|
3f95ec9a9a | ||
|
|
a8f63cf6a2 | ||
|
|
6eb4fee6fd | ||
|
|
48c888fbd4 | ||
|
|
1b38f3f40a | ||
|
|
1815b86e25 | ||
|
|
6288747ebf | ||
|
|
1e6c0002c9 | ||
|
|
52f565ce42 | ||
|
|
2c5e280c3d | ||
|
|
5cae20af15 | ||
|
|
7bbc06f153 | ||
|
|
7a709f3056 | ||
|
|
55cd1934c9 | ||
|
|
b05d01e4fe | ||
|
|
cb6334969d | ||
|
|
8c78159f7c | ||
|
|
edaebf6bd7 | ||
|
|
931bc1d107 | ||
|
|
f19a2f73ea | ||
|
|
fc68a47bbb | ||
|
|
947666d009 | ||
|
|
e5c864c8ba | ||
|
|
962c04b466 | ||
|
|
083f8b3ec7 |
@@ -506,7 +506,7 @@
|
||||
if (inContext == null) {
|
||||
inContext = <%=className%>.class.getClassLoader().getResourceAsStream("config/contexts/" + contextStr + ".properties");
|
||||
}
|
||||
if (inContext != null) {
|
||||
if (inContext != null && context != null && context.isEmpty()) {
|
||||
//defaultProps is in order to keep the original context value
|
||||
defaultProps.load(inContext);
|
||||
inContext.close();
|
||||
|
||||
@@ -312,7 +312,7 @@ public <%=JavaTypesManager.getTypeToGenerate(ctxParam.getType(),true)%> get<%=Ch
|
||||
}
|
||||
%>
|
||||
}
|
||||
private ContextProperties context = new ContextProperties();
|
||||
protected ContextProperties context = new ContextProperties(); // will be instanciated by MS.
|
||||
public ContextProperties getContext() {
|
||||
return this.context;
|
||||
}
|
||||
|
||||
@@ -228,8 +228,8 @@ if (!sftp && !ftps) { // *** ftp *** //
|
||||
}
|
||||
|
||||
ftp_<%=cid %>.setFileType(org.apache.commons.net.ftp.FTP.BINARY_FILE_TYPE);
|
||||
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
|
||||
ftp_<%=cid %>.execPBSZ(<%=protectionBufferSize %>);
|
||||
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
|
||||
} catch (Exception e) {
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.error("<%=cid%> - Can't create connection: " + e.getMessage());
|
||||
|
||||
@@ -249,8 +249,8 @@ int nb_file_<%=cid%> = 0;
|
||||
throw new RuntimeException("Login failed");
|
||||
}
|
||||
|
||||
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
|
||||
ftp_<%=cid %>.execPBSZ(<%=protectionBufferSize %>);
|
||||
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
|
||||
} catch (Exception e) {
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.error("<%=cid%> - Can't create connection: " + e.getMessage());
|
||||
|
||||
@@ -235,8 +235,8 @@ if (sftp) { // *** sftp *** //
|
||||
throw new RuntimeException("Login failed");
|
||||
}
|
||||
|
||||
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
|
||||
ftp_<%=cid %>.execPBSZ(<%=protectionBufferSize %>);
|
||||
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
|
||||
} catch (Exception e) {
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.error("<%=cid%> - Can't create connection: " + e.getMessage());
|
||||
|
||||
@@ -317,8 +317,8 @@ if (sftp) {// *** sftp *** //
|
||||
throw new RuntimeException("Login failed");
|
||||
}
|
||||
|
||||
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
|
||||
ftp_<%=cid %>.execPBSZ(<%=protectionBufferSize %>);
|
||||
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
|
||||
} catch (Exception e) {
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.error("<%=cid%> - Can't create connection: " + e.getMessage());
|
||||
|
||||
@@ -284,8 +284,8 @@ if (sftp) { // *** sftp *** //
|
||||
}
|
||||
|
||||
ftp_<%=cid %>.setFileType(org.apache.commons.net.ftp.FTP.BINARY_FILE_TYPE); //to calculate md5 for binary files correctly
|
||||
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
|
||||
ftp_<%=cid %>.execPBSZ(<%=protectionBufferSize %>);
|
||||
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
|
||||
} catch (Exception e) {
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.error("<%=cid%> - Can't create connection: " + e.getMessage());
|
||||
|
||||
@@ -732,8 +732,8 @@ if (sftp) { // *** sftp *** //
|
||||
}
|
||||
|
||||
ftp_<%=cid %>.setFileType(org.apache.commons.net.ftp.FTP.BINARY_FILE_TYPE);
|
||||
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
|
||||
ftp_<%=cid %>.execPBSZ(<%=protectionBufferSize %>);
|
||||
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
|
||||
} catch (Exception e) {
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.error("<%=cid%> - Can't create connection: " + e.getMessage());
|
||||
|
||||
@@ -415,8 +415,8 @@ int nb_file_<%=cid%> = 0;
|
||||
}
|
||||
|
||||
ftp_<%=cid %>.setFileType(org.apache.commons.net.ftp.FTP.BINARY_FILE_TYPE);
|
||||
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
|
||||
ftp_<%=cid %>.execPBSZ(<%=protectionBufferSize %>);
|
||||
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
|
||||
} catch (Exception e) {
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.error("<%=cid%> - Can't create connection: " + e.getMessage());
|
||||
|
||||
@@ -254,8 +254,8 @@ if (sftp) { // *** sftp *** //
|
||||
throw new RuntimeException("Login failed");
|
||||
}
|
||||
|
||||
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
|
||||
ftp_<%=cid %>.execPBSZ(<%=protectionBufferSize %>);
|
||||
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
|
||||
} catch (Exception e) {
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.error("<%=cid%> - Can't create connection: " + e.getMessage());
|
||||
|
||||
@@ -252,8 +252,8 @@ if (sftp) {// *** sftp *** //
|
||||
throw new RuntimeException("Login failed");
|
||||
}
|
||||
|
||||
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
|
||||
ftp_<%=cid %>.execPBSZ(<%=protectionBufferSize %>);
|
||||
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
|
||||
} catch (Exception e) {
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.error("<%=cid%> - Can't create connection: " + e.getMessage());
|
||||
|
||||
@@ -182,7 +182,7 @@
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
|
||||
<IMPORT NAME="activemq-client-5.14.5.jar" MODULE="activemq-client-5.14.5.jar" MVN="mvn:org.talend.libraries/activemq-client-5.14.5/6.3.0" REQUIRED_IF="SERVER == 'ACTIVEMQ'" />
|
||||
<IMPORT NAME="activemq-client-5.15.5.jar" MODULE="activemq-client-5.15.5.jar" MVN="mvn:org.talend.libraries/activemq-client-5.15.5/6.3.0" REQUIRED_IF="SERVER == 'ACTIVEMQ'" BundleID="" />
|
||||
<IMPORT NAME="geronimo-jms_1.1_spec-1.1.1.jar" MODULE="geronimo-jms_1.1_spec-1.1.1.jar" MVN="mvn:org.talend.libraries/geronimo-jms_1.1_spec-1.1.1/6.3.0" REQUIRED_IF="SERVER == 'ACTIVEMQ'" />
|
||||
<IMPORT NAME="geronimo-j2ee-management_1.1_spec-1.0.1.jar" MODULE="geronimo-j2ee-management_1.1_spec-1.0.1.jar" MVN="mvn:org.talend.libraries/geronimo-j2ee-management_1.1_spec-1.0.1/6.3.0" REQUIRED_IF="SERVER == 'ACTIVEMQ'" />
|
||||
<IMPORT NAME="hawtbuf-1.11.jar" MODULE="hawtbuf-1.11.jar" MVN="mvn:org.talend.libraries/hawtbuf-1.11/6.3.0" REQUIRED_IF="SERVER == 'ACTIVEMQ'" />
|
||||
|
||||
@@ -308,7 +308,7 @@
|
||||
<IMPORTS>
|
||||
|
||||
<!-- ActiveMQ -->
|
||||
<IMPORT NAME="activemq-client-5.14.5.jar" MODULE="activemq-client-5.14.5.jar" MVN="mvn:org.talend.libraries/activemq-client-5.14.5/6.3.0" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'ACTIVEMQ')" />
|
||||
<IMPORT NAME="activemq-client-5.15.5.jar" MODULE="activemq-client-5.15.5.jar" MVN="mvn:org.talend.libraries/activemq-client-5.15.5/6.3.0" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'ACTIVEMQ')" BundleID="" />
|
||||
<IMPORT NAME="geronimo-jms_1.1_spec-1.1.1.jar" MODULE="geronimo-jms_1.1_spec-1.1.1.jar" MVN="mvn:org.talend.libraries/geronimo-jms_1.1_spec-1.1.1/6.3.0" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'ACTIVEMQ')" />
|
||||
<IMPORT NAME="geronimo-j2ee-management_1.1_spec-1.0.1.jar" MODULE="geronimo-j2ee-management_1.1_spec-1.0.1.jar" MVN="mvn:org.talend.libraries/geronimo-j2ee-management_1.1_spec-1.0.1/6.3.0" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'ACTIVEMQ')" />
|
||||
<IMPORT NAME="hawtbuf-1.11.jar" MODULE="hawtbuf-1.11.jar" MVN="mvn:org.talend.libraries/hawtbuf-1.11/6.3.0" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'ACTIVEMQ')" />
|
||||
|
||||
@@ -433,7 +433,7 @@
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<!-- ActiveMQ -->
|
||||
<IMPORT NAME="activemq-client-5.14.5.jar" MODULE="activemq-client-5.14.5.jar" MVN="mvn:org.talend.libraries/activemq-client-5.14.5/6.3.0" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'ACTIVEMQ')" />
|
||||
<IMPORT NAME="activemq-client-5.15.5.jar" MODULE="activemq-client-5.15.5.jar" MVN="mvn:org.talend.libraries/activemq-client-5.15.5/6.3.0" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'ACTIVEMQ')" BundleID="" />
|
||||
<IMPORT NAME="geronimo-jms_1.1_spec-1.1.1.jar" MODULE="geronimo-jms_1.1_spec-1.1.1.jar" MVN="mvn:org.talend.libraries/geronimo-jms_1.1_spec-1.1.1/6.3.0" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'ACTIVEMQ')" />
|
||||
<IMPORT NAME="geronimo-j2ee-management_1.1_spec-1.0.1.jar" MODULE="geronimo-j2ee-management_1.1_spec-1.0.1.jar" MVN="mvn:org.talend.libraries/geronimo-j2ee-management_1.1_spec-1.0.1/6.3.0" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'ACTIVEMQ')" />
|
||||
<IMPORT NAME="hawtbuf-1.11.jar" MODULE="hawtbuf-1.11.jar" MVN="mvn:org.talend.libraries/hawtbuf-1.11/6.3.0" REQUIRED_IF="(USE_CONNECTION=='false' AND SERVER == 'ACTIVEMQ')" />
|
||||
|
||||
@@ -398,10 +398,15 @@ skeleton="../templates/db_output_bulk.skeleton"
|
||||
|
||||
// added "print command" feature
|
||||
<% if (printCommand == true) { %>
|
||||
System.out.println("INFO: executing nzload command:");
|
||||
for( String cmd : cmds ) {
|
||||
System.out.print(cmd + " ");
|
||||
}
|
||||
System.out.println("INFO: executing nzload command:");
|
||||
for(int i = 0; i < cmds.length; i++) {
|
||||
if ("-pw".equals(cmds[i]) && decryptedPwd_<%=cid %>.equals(cmds[i+1])) {
|
||||
System.out.print(cmds[i] + " " + routines.system.PasswordEncryptUtil.PASSWORD_FOR_LOGS_VALUE + " ");
|
||||
i++;
|
||||
} else {
|
||||
System.out.print(cmds[i] + " ");
|
||||
}
|
||||
}
|
||||
<% } %>
|
||||
|
||||
Runtime rt = Runtime.getRuntime();
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
</projecttask>
|
||||
<projecttask
|
||||
beforeLogon="false"
|
||||
breaks="7.0.1"
|
||||
breaks="7.0.0"
|
||||
class="org.talend.designer.core.generic.model.migration.NewGoogleDriveMigrationTask"
|
||||
description="Migration task for jobs using Google Drive components to TCOMP"
|
||||
id="org.talend.designer.core.generic.model.migration.NewGoogleDriveMigrationTask"
|
||||
|
||||
@@ -1469,9 +1469,11 @@ public class Component extends AbstractBasicComponent {
|
||||
}
|
||||
if (GenericTypeUtils.isStringType(property)
|
||||
&& property.getTaggedValue(IGenericConstants.LINE_SEPARATOR_REPLACED_TO) != null) {
|
||||
String replacedTo = String.valueOf(property.getTaggedValue(IGenericConstants.LINE_SEPARATOR_REPLACED_TO));
|
||||
// "Win", "Linux/Unix", "Mac"
|
||||
return value.replaceAll("\r\n", replacedTo).replaceAll("\n", replacedTo).replaceAll("\r", replacedTo);
|
||||
//process for the sql field for jdbc, snowflake, salesforce, LINE_SEPARATOR_REPLACED_TO key can tell us which a sql type field,
|
||||
//as sql type value may have newline and return characters, which make compiler issue in java code,
|
||||
//so have to convert the newline characters to visible "\r", "\n" for pass the compiler issue and can't only convert them to white space as TDI-41898
|
||||
//jdbc drivers, salesforce driver can work like that sql : select * \nfrom Account, so it is ok
|
||||
return NodeUtil.replaceCRLFInMEMO_SQL(value);
|
||||
}
|
||||
if (GenericTypeUtils.isSchemaType(property)) {
|
||||
// Handles embedded escaped quotes which might occur
|
||||
|
||||
@@ -61,6 +61,9 @@ public class GenericTableUtils {
|
||||
List<String> valueList = new ArrayList<>();
|
||||
if(dbService != null){
|
||||
for(String v:values){
|
||||
if(v == null || v.length() <= 0){
|
||||
continue;
|
||||
}
|
||||
if(param.getName().equals(EConnectionParameterName.GENERIC_DRIVER_JAR.getDisplayName())){
|
||||
v = dbService.getMVNPath(v);
|
||||
}
|
||||
|
||||
@@ -6,12 +6,39 @@ import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.utils.TalendQuoteUtils;
|
||||
import org.talend.designer.core.generic.utils.ParameterUtilTool;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.NodeType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ProcessType;
|
||||
|
||||
public class NewGoogleDriveMigrationTask extends org.talend.designer.core.generic.model.migration.NewComponentFrameworkMigrationTask {
|
||||
|
||||
public static final String GOOGLE_DRIVE_PREFIX = "tGoogleDrive";
|
||||
|
||||
public static final String JAVAJET_VERSION = "0.102";
|
||||
|
||||
@Override
|
||||
public ExecutionResult execute(Item item) {
|
||||
ProcessType processType = getProcessType(item);
|
||||
if (processType != null) {
|
||||
for (Object obj : processType.getNode()) {
|
||||
if (obj != null && obj instanceof NodeType) {
|
||||
String componentName = ((NodeType) obj).getComponentName();
|
||||
String version = ((NodeType) obj).getComponentVersion();
|
||||
if (componentName != null && componentName.startsWith(GOOGLE_DRIVE_PREFIX)) {
|
||||
if (!JAVAJET_VERSION.equals(version)) {
|
||||
// not a javajet component (tcompv0), we skip this migration for not corrupting comps.
|
||||
return ExecutionResult.NOTHING_TO_DO;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.execute(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getOrder() {
|
||||
return new GregorianCalendar(2017, 10, 23, 10, 15, 0).getTime();
|
||||
@@ -33,44 +60,43 @@ public class NewGoogleDriveMigrationTask extends org.talend.designer.core.generi
|
||||
|
||||
@Override
|
||||
protected ElementParameterType getParameterType(NodeType node, String paramName) {
|
||||
// sanitize inexistent props
|
||||
ElementParameterType oAuthMethod = ParameterUtilTool.findParameterType(node, "OAUTH_METHOD");
|
||||
if (oAuthMethod == null) {
|
||||
ParameterUtilTool.addParameterType(node, "TEXT", "OAUTH_METHOD", "AccessToken");
|
||||
}
|
||||
ElementParameterType dsPath = ParameterUtilTool.findParameterType(node, "DATASTORE_PATH");
|
||||
if (dsPath == null) {
|
||||
String datastorePath = (System.getProperty("user.home", ".") + "/.credentials/talend-googledrive")
|
||||
.replace("\\", "/");
|
||||
ParameterUtilTool.addParameterType(node, "TEXT", "DATASTORE_PATH",
|
||||
TalendQuoteUtils.addQuotesIfNotExist(datastorePath));
|
||||
}
|
||||
ElementParameterType paramType = ParameterUtilTool.findParameterType(node, paramName);
|
||||
if (node != null && paramType != null) {
|
||||
Object value = ParameterUtilTool.convertParameterValue(paramType);
|
||||
String componentName = node.getComponentName();
|
||||
//
|
||||
if ("tGoogleDriveCopy".equals(componentName)) {
|
||||
if ("FILE_MODE".equals(paramName)) {
|
||||
if ("true".equals(String.valueOf(value))) {
|
||||
paramType.setValue("File");
|
||||
} else {
|
||||
paramType.setValue("Folder");
|
||||
}
|
||||
}
|
||||
if ("FILE_NAME".equals(paramName)) {
|
||||
ElementParameterType fileMode = ParameterUtilTool.findParameterType(node, "FILE_MODE");
|
||||
Object fileModeValue = ParameterUtilTool.convertParameterValue(fileMode);
|
||||
if ("true".equals(String.valueOf(fileModeValue))) {
|
||||
paramType.setValue(String.valueOf(value));
|
||||
} else {
|
||||
ElementParameterType folderName = ParameterUtilTool.findParameterType(node, "FOLDER_NAME");
|
||||
Object folderNameValue = ParameterUtilTool.convertParameterValue(folderName);
|
||||
paramType.setValue(String.valueOf(folderNameValue));
|
||||
}
|
||||
Object copyModeParam = ParameterUtilTool.findParameterType(node, "COPY_MODE");
|
||||
if (copyModeParam == null) {
|
||||
Object fileMode = ParameterUtilTool.getParameterValue(node, "FILE_MODE");
|
||||
Object fileName = ParameterUtilTool.getParameterValue(node, "FILE_NAME");
|
||||
Object folderName = ParameterUtilTool.getParameterValue(node, "FOLDER_NAME");
|
||||
String copyMode = "true".equals(fileMode) ? "File" : "Folder";
|
||||
String source = "File".equals(copyMode) ? String.valueOf(fileName) : String.valueOf(folderName);
|
||||
ParameterUtilTool.addParameterType(node, "TEXT", "COPY_MODE", copyMode);
|
||||
ParameterUtilTool.addParameterType(node, "TEXT", "SOURCE", source);
|
||||
}
|
||||
}
|
||||
if ("tGoogleDrivePut".equals(componentName)) {
|
||||
if ("READ_CONTENT_FROM_INPUT".equals(paramName)) {
|
||||
if ("true".equals(String.valueOf(value))) {
|
||||
paramType.setValue("READ_CONTENT_FROM_INPUT");
|
||||
} else {
|
||||
ElementParameterType upl = ParameterUtilTool.findParameterType(node, "UPLOAD_LOCAL_FILE");
|
||||
Object uplv = ParameterUtilTool.convertParameterValue(upl);
|
||||
if ("true".equals(String.valueOf(uplv))) {
|
||||
paramType.setValue("UPLOAD_LOCAL_FILE");
|
||||
} else {
|
||||
paramType.setValue("EXPOSE_OUTPUT_STREAM");
|
||||
}
|
||||
Object uploadModeParam = ParameterUtilTool.findParameterType(node, "UPLOAD_MODE");
|
||||
if (uploadModeParam == null) {
|
||||
Object isReadContentFromInput = ParameterUtilTool.getParameterValue(node, "READ_CONTENT_FROM_INPUT");
|
||||
Object uploadLocalFile = ParameterUtilTool.getParameterValue(node, "UPLOAD_LOCAL_FILE");
|
||||
String uploadMode = "READ_CONTENT_FROM_INPUT";
|
||||
if (!"true".equals(isReadContentFromInput)) {
|
||||
uploadMode = "true".equals(uploadLocalFile) ? "UPLOAD_LOCAL_FILE" : "EXPOSE_OUTPUT_STREAM";
|
||||
}
|
||||
ParameterUtilTool.addParameterType(node, "TEXT", "UPLOAD_MODE", uploadMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,11 +9,25 @@ tGoogleDriveConnection.useSSL=USE_SSL
|
||||
tGoogleDriveConnection.sslAlgorithm=SSL_ALGORITHM
|
||||
tGoogleDriveConnection.sslTrustStore=SSL_TRUST_STORE
|
||||
tGoogleDriveConnection.sslTrustStorePassword=SSL_TRUST_STORE_PASSWORD
|
||||
tGoogleDriveConnection.oAuthMethod=OAUTH_METHOD
|
||||
tGoogleDriveConnection.datastorePath=DATASTORE_PATH
|
||||
|
||||
# tGoogleDriveCopy
|
||||
tGoogleDriveCopy=tGoogleDriveCopy
|
||||
tGoogleDriveCopy.copyMode=FILE_MODE
|
||||
tGoogleDriveCopy.source=FILE_NAME
|
||||
tGoogleDriveCopy.connection.referencedComponent=CONNECTION
|
||||
tGoogleDriveCopy.connection.applicationName=APPLICATION_NAME
|
||||
tGoogleDriveCopy.connection.accessToken=ACCESS_TOKEN
|
||||
tGoogleDriveCopy.connection.useProxy=USE_PROXY
|
||||
tGoogleDriveCopy.connection.proxyHost=PROXY_HOST
|
||||
tGoogleDriveCopy.connection.proxyPort=PROXY_PORT
|
||||
tGoogleDriveCopy.connection.useSSL=USE_SSL
|
||||
tGoogleDriveCopy.connection.sslAlgorithm=SSL_ALGORITHM
|
||||
tGoogleDriveCopy.connection.sslTrustStore=SSL_TRUST_STORE
|
||||
tGoogleDriveCopy.connection.sslTrustStorePassword=SSL_TRUST_STORE_PASSWORD
|
||||
tGoogleDriveCopy.connection.oAuthMethod=OAUTH_METHOD
|
||||
tGoogleDriveCopy.connection.datastorePath=DATASTORE_PATH
|
||||
tGoogleDriveCopy.copyMode=COPY_MODE
|
||||
tGoogleDriveCopy.source=SOURCE
|
||||
tGoogleDriveCopy.destinationFolder=DESTINATION_FOLDER_NAME
|
||||
tGoogleDriveCopy.rename=RENAME
|
||||
tGoogleDriveCopy.newName=DESTINATION_FILE_NAME
|
||||
@@ -21,16 +35,52 @@ tGoogleDriveCopy.deleteSourceFile=REMOVE_SOURCE_FILE
|
||||
|
||||
# tGoogleDriveCreate
|
||||
tGoogleDriveCreate=tGoogleDriveCreate
|
||||
tGoogleDriveCreate.connection.referencedComponent=CONNECTION
|
||||
tGoogleDriveCreate.connection.applicationName=APPLICATION_NAME
|
||||
tGoogleDriveCreate.connection.accessToken=ACCESS_TOKEN
|
||||
tGoogleDriveCreate.connection.useProxy=USE_PROXY
|
||||
tGoogleDriveCreate.connection.proxyHost=PROXY_HOST
|
||||
tGoogleDriveCreate.connection.proxyPort=PROXY_PORT
|
||||
tGoogleDriveCreate.connection.useSSL=USE_SSL
|
||||
tGoogleDriveCreate.connection.sslAlgorithm=SSL_ALGORITHM
|
||||
tGoogleDriveCreate.connection.sslTrustStore=SSL_TRUST_STORE
|
||||
tGoogleDriveCreate.connection.sslTrustStorePassword=SSL_TRUST_STORE_PASSWORD
|
||||
tGoogleDriveCreate.connection.oAuthMethod=OAUTH_METHOD
|
||||
tGoogleDriveCreate.connection.datastorePath=DATASTORE_PATH
|
||||
tGoogleDriveCreate.parentFolder=FOLDER_NAME
|
||||
tGoogleDriveCreate.newFolder=NEW_FOLDER_NAME
|
||||
|
||||
# tGoogleDriveDelete
|
||||
tGoogleDriveDelete=tGoogleDriveDelete
|
||||
tGoogleDriveDelete.connection.referencedComponent=CONNECTION
|
||||
tGoogleDriveDelete.connection.applicationName=APPLICATION_NAME
|
||||
tGoogleDriveDelete.connection.accessToken=ACCESS_TOKEN
|
||||
tGoogleDriveDelete.connection.useProxy=USE_PROXY
|
||||
tGoogleDriveDelete.connection.proxyHost=PROXY_HOST
|
||||
tGoogleDriveDelete.connection.proxyPort=PROXY_PORT
|
||||
tGoogleDriveDelete.connection.useSSL=USE_SSL
|
||||
tGoogleDriveDelete.connection.sslAlgorithm=SSL_ALGORITHM
|
||||
tGoogleDriveDelete.connection.sslTrustStore=SSL_TRUST_STORE
|
||||
tGoogleDriveDelete.connection.sslTrustStorePassword=SSL_TRUST_STORE_PASSWORD
|
||||
tGoogleDriveDelete.connection.oAuthMethod=OAUTH_METHOD
|
||||
tGoogleDriveDelete.connection.datastorePath=DATASTORE_PATH
|
||||
tGoogleDriveDelete.file=FILE_NAME
|
||||
tGoogleDriveDelete.useTrash=USE_TRASH
|
||||
|
||||
# tGoogleDriveGet
|
||||
tGoogleDriveGet=tGoogleDriveGet
|
||||
tGoogleDriveGet.connection.referencedComponent=CONNECTION
|
||||
tGoogleDriveGet.connection.applicationName=APPLICATION_NAME
|
||||
tGoogleDriveGet.connection.accessToken=ACCESS_TOKEN
|
||||
tGoogleDriveGet.connection.useProxy=USE_PROXY
|
||||
tGoogleDriveGet.connection.proxyHost=PROXY_HOST
|
||||
tGoogleDriveGet.connection.proxyPort=PROXY_PORT
|
||||
tGoogleDriveGet.connection.useSSL=USE_SSL
|
||||
tGoogleDriveGet.connection.sslAlgorithm=SSL_ALGORITHM
|
||||
tGoogleDriveGet.connection.sslTrustStore=SSL_TRUST_STORE
|
||||
tGoogleDriveGet.connection.sslTrustStorePassword=SSL_TRUST_STORE_PASSWORD
|
||||
tGoogleDriveGet.connection.oAuthMethod=OAUTH_METHOD
|
||||
tGoogleDriveGet.connection.datastorePath=DATASTORE_PATH
|
||||
tGoogleDriveGet.file=FILE_NAME
|
||||
tGoogleDriveGet.storeToLocal=STORE_TO_LOCAL
|
||||
tGoogleDriveGet.outputFileName=OUTPUT
|
||||
@@ -43,6 +93,18 @@ tGoogleDriveGet.mainSchema.schema.connector=FLOW->FLOW
|
||||
|
||||
# tGoogleDriveList
|
||||
tGoogleDriveList=tGoogleDriveList
|
||||
tGoogleDriveList.connection.referencedComponent=CONNECTION
|
||||
tGoogleDriveList.connection.applicationName=APPLICATION_NAME
|
||||
tGoogleDriveList.connection.accessToken=ACCESS_TOKEN
|
||||
tGoogleDriveList.connection.useProxy=USE_PROXY
|
||||
tGoogleDriveList.connection.proxyHost=PROXY_HOST
|
||||
tGoogleDriveList.connection.proxyPort=PROXY_PORT
|
||||
tGoogleDriveList.connection.useSSL=USE_SSL
|
||||
tGoogleDriveList.connection.sslAlgorithm=SSL_ALGORITHM
|
||||
tGoogleDriveList.connection.sslTrustStore=SSL_TRUST_STORE
|
||||
tGoogleDriveList.connection.sslTrustStorePassword=SSL_TRUST_STORE_PASSWORD
|
||||
tGoogleDriveList.connection.oAuthMethod=OAUTH_METHOD
|
||||
tGoogleDriveList.connection.datastorePath=DATASTORE_PATH
|
||||
tGoogleDriveList.folder=FOLDER_NAME
|
||||
tGoogleDriveList.includeSubDirectories=INCLUDSUBDIR
|
||||
tGoogleDriveList.listMode=LIST_MODE
|
||||
@@ -50,7 +112,19 @@ tGoogleDriveList.includeTrashedFiles=INCLUDTRASHFILES
|
||||
|
||||
# tGoogleDrivePut
|
||||
tGoogleDrivePut=tGoogleDrivePut
|
||||
tGoogleDrivePut.uploadMode=READ_CONTENT_FROM_INPUT
|
||||
tGoogleDrivePut.connection.referencedComponent=CONNECTION
|
||||
tGoogleDrivePut.connection.applicationName=APPLICATION_NAME
|
||||
tGoogleDrivePut.connection.accessToken=ACCESS_TOKEN
|
||||
tGoogleDrivePut.connection.useProxy=USE_PROXY
|
||||
tGoogleDrivePut.connection.proxyHost=PROXY_HOST
|
||||
tGoogleDrivePut.connection.proxyPort=PROXY_PORT
|
||||
tGoogleDrivePut.connection.useSSL=USE_SSL
|
||||
tGoogleDrivePut.connection.sslAlgorithm=SSL_ALGORITHM
|
||||
tGoogleDrivePut.connection.sslTrustStore=SSL_TRUST_STORE
|
||||
tGoogleDrivePut.connection.sslTrustStorePassword=SSL_TRUST_STORE_PASSWORD
|
||||
tGoogleDrivePut.connection.oAuthMethod=OAUTH_METHOD
|
||||
tGoogleDrivePut.connection.datastorePath=DATASTORE_PATH
|
||||
tGoogleDrivePut.uploadMode=UPLOAD_MODE
|
||||
tGoogleDrivePut.fileName=FILE_TITLE
|
||||
tGoogleDrivePut.destinationFolder=DESTINATION_FOLDER_NAME
|
||||
tGoogleDrivePut.overwrite=OVERWRITE
|
||||
|
||||
@@ -19,8 +19,13 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.talend.components.api.component.ComponentDefinition;
|
||||
import org.talend.components.api.properties.ComponentProperties;
|
||||
import org.talend.components.api.properties.ComponentReferenceProperties;
|
||||
import org.talend.core.model.process.EParameterFieldType;
|
||||
import org.talend.core.model.process.IElementParameter;
|
||||
import org.talend.core.model.process.INode;
|
||||
import org.talend.core.runtime.services.IGenericService;
|
||||
import org.talend.daikon.properties.Properties;
|
||||
import org.talend.designer.core.generic.model.GenericElementParameter;
|
||||
import org.talend.designer.core.generic.utils.ComponentsUtils;
|
||||
|
||||
@@ -52,5 +57,56 @@ public class GenericService implements IGenericService {
|
||||
}
|
||||
return genericComponents;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetReferenceValue(INode curNode, String oldConnectionName, String newConnectionName) {
|
||||
ComponentReferenceProperties comPro = null;
|
||||
IElementParameter refPara = curNode.getElementParameterFromField(EParameterFieldType.COMPONENT_REFERENCE);
|
||||
if(refPara != null){
|
||||
comPro = ComponentsUtils.getReferencedComponent(refPara);
|
||||
}
|
||||
if(comPro != null){
|
||||
Object sValue = comPro.componentInstanceId.getStoredValue();
|
||||
if (oldConnectionName.equals(sValue)) {
|
||||
comPro.componentInstanceId.setValue(newConnectionName);
|
||||
return;
|
||||
}
|
||||
if (sValue != null && ((String)sValue).startsWith(oldConnectionName + "_")) { //$NON-NLS-1$
|
||||
comPro.componentInstanceId.setValue(((String)sValue).replaceFirst(oldConnectionName + "_", newConnectionName + "_")); //$NON-NLS-1$
|
||||
return;
|
||||
}
|
||||
}
|
||||
comPro = getComponentReferenceProperties(curNode);
|
||||
if(comPro == null){
|
||||
return;
|
||||
}
|
||||
Object sValue = comPro.componentInstanceId.getStoredValue();
|
||||
if (oldConnectionName.equals(sValue)) {
|
||||
comPro.componentInstanceId.setValue(newConnectionName);
|
||||
} else if (sValue != null && ((String)sValue).startsWith(oldConnectionName + "_")) { //$NON-NLS-1$
|
||||
comPro.componentInstanceId.setValue(((String)sValue).replaceFirst(oldConnectionName + "_", newConnectionName + "_")); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
private ComponentReferenceProperties getComponentReferenceProperties(INode curNode){
|
||||
ComponentProperties pros = curNode.getComponentProperties();
|
||||
if(pros == null){
|
||||
return null;
|
||||
}
|
||||
Properties ps = pros.getProperties("referencedComponent"); //$NON-NLS-1$
|
||||
if(ps == null){
|
||||
Properties conn = pros.getProperties("connection"); //$NON-NLS-1$
|
||||
if(conn != null){
|
||||
ps = conn.getProperties("referencedComponent"); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
if(ps == null){
|
||||
return null;
|
||||
}
|
||||
if(ps instanceof ComponentReferenceProperties){
|
||||
return (ComponentReferenceProperties)ps;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -837,6 +837,20 @@ public class ComponentsUtils {
|
||||
}
|
||||
return nals;
|
||||
}
|
||||
|
||||
public static ComponentReferenceProperties getReferencedComponent(IElementParameter refPara){
|
||||
if (!(refPara instanceof GenericElementParameter)) {
|
||||
return null;
|
||||
}
|
||||
Widget widget = ((GenericElementParameter) refPara).getWidget();
|
||||
NamedThing widgetProperty = widget.getContent();
|
||||
if (widgetProperty instanceof ComponentReferenceProperties
|
||||
&& Widget.COMPONENT_REFERENCE_WIDGET_TYPE.equals(widget.getWidgetType())) {
|
||||
ComponentReferenceProperties props = (ComponentReferenceProperties) widgetProperty;
|
||||
return props;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void initReferencedComponent(IElementParameter refPara, String newValue) {
|
||||
|
||||
|
||||
@@ -737,6 +737,12 @@ public class StatsAndLogsManager {
|
||||
|
||||
if (isGeneric) {// reset the show if
|
||||
resetShowIf(connectionNode);
|
||||
if (checkUrlContainsAutoCommit(connectionNode)) {
|
||||
IElementParameter autoCommitParam = connectionNode.getElementParameter("autocommit");//$NON-NLS-1$
|
||||
if (autoCommitParam != null) {
|
||||
autoCommitParam.setValue(Boolean.TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (connectionComponentName.contains("Oracle")) {//$NON-NLS-1$
|
||||
@@ -764,13 +770,44 @@ public class StatsAndLogsManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
DataConnection dataConnec = createDataConnectionForSubJobOK(dataNode, commitNode);
|
||||
((List<IConnection>) dataNode.getOutgoingConnections()).add(dataConnec);
|
||||
((List<IConnection>) commitNode.getIncomingConnections()).add(dataConnec);
|
||||
|
||||
boolean noCommitNode = false;
|
||||
if (checkUrlContainsAutoCommit(connectionNode)) {
|
||||
IElementParameter autoCommitParam = connectionNode.getElementParameter("autocommit");//$NON-NLS-1$
|
||||
if (autoCommitParam != null && autoCommitParam.getValue() != null) {
|
||||
noCommitNode = Boolean.parseBoolean(autoCommitParam.getValue().toString());
|
||||
if (noCommitNode && nodeList.contains(commitNode)) {
|
||||
nodeList.remove(commitNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!noCommitNode) {
|
||||
DataConnection dataConnec = createDataConnectionForSubJobOK(dataNode, commitNode);
|
||||
((List<IConnection>) dataNode.getOutgoingConnections()).add(dataConnec);
|
||||
((List<IConnection>) commitNode.getIncomingConnections()).add(dataConnec);
|
||||
}
|
||||
return connectionNode;
|
||||
}
|
||||
|
||||
private static boolean checkUrlContainsAutoCommit(DataNode connectionNode) {
|
||||
if (connectionNode != null) {
|
||||
boolean isGeneric = connectionNode.getComponent().getComponentType() == EComponentType.GENERIC;
|
||||
if (isGeneric) {
|
||||
IElementParameter urlParam = connectionNode
|
||||
.getElementParameter(EConnectionParameterName.GENERIC_URL.getDisplayName());
|
||||
if (urlParam != null) {
|
||||
Object obj = urlParam.getValue();
|
||||
if (obj != null && obj instanceof String) {
|
||||
String url = (String) obj;
|
||||
if (url != null && url.toLowerCase().contains("autocommit=true")) {//$NON-NLS-1$
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void resetShowIf(DataNode connectionNode) {
|
||||
ComponentProperties tcomp_properties = connectionNode.getComponentProperties();
|
||||
if (tcomp_properties != null) {
|
||||
|
||||
@@ -1883,7 +1883,15 @@ public class Node extends Element implements IGraphicalNode {
|
||||
|
||||
if (id.equals(EParameterName.CONNECTION_FORMAT.getName())) {
|
||||
connectionToParse = (String) value;
|
||||
setConnectionName(ElementParameterParser.parse(this, connectionToParse));
|
||||
boolean isTestCase = false;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
|
||||
ITestContainerProviderService testContainerService = (ITestContainerProviderService) GlobalServiceRegister
|
||||
.getDefault().getService(ITestContainerProviderService.class);
|
||||
isTestCase = getProcess() != null && testContainerService.isTestContainerProcess(getProcess());
|
||||
}
|
||||
if (!isTestCase) {
|
||||
setConnectionName(ElementParameterParser.parse(this, connectionToParse));
|
||||
}
|
||||
// to check
|
||||
// String newValue = ElementParameterParser.parse(this, connectionToParse);
|
||||
// setConnectionName(newValue);
|
||||
|
||||
@@ -48,6 +48,7 @@ import org.talend.core.model.process.IElement;
|
||||
import org.talend.core.model.process.IElementParameter;
|
||||
import org.talend.core.model.process.INode;
|
||||
import org.talend.core.model.process.IProcess2;
|
||||
import org.talend.core.runtime.services.IGenericService;
|
||||
import org.talend.core.ui.IJobletProviderService;
|
||||
import org.talend.core.ui.process.IGraphicalNode;
|
||||
import org.talend.core.ui.properties.tab.IDynamicProperty;
|
||||
@@ -209,6 +210,20 @@ public class ComponentListController extends AbstractElementPropertySectionContr
|
||||
} else if (value != null && value.startsWith(oldConnectionName + "_")) {
|
||||
curParam.setValue(value.replaceFirst(oldConnectionName + "_", newConnectionName + "_"));
|
||||
}
|
||||
}else if(curParam.getFieldType().equals(EParameterFieldType.COMPONENT_REFERENCE)){
|
||||
String value = (String)curParam.getValue();
|
||||
if (oldConnectionName.equals(value)) {
|
||||
curParam.setValue(newConnectionName);
|
||||
} else if (value != null && value.startsWith(oldConnectionName + "_")) {
|
||||
curParam.setValue(value.replaceFirst(oldConnectionName + "_", newConnectionName + "_"));
|
||||
}
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericService.class)) {
|
||||
IGenericService genericService = (IGenericService) GlobalServiceRegister.getDefault().getService(
|
||||
IGenericService.class);
|
||||
if(genericService != null){
|
||||
genericService.resetReferenceValue(curNode, oldConnectionName, newConnectionName);
|
||||
}
|
||||
}
|
||||
} else if (curParam.getFieldType().equals(EParameterFieldType.TABLE)) {
|
||||
final Object[] itemsValue = curParam.getListItemsValue();
|
||||
for (Object element : itemsValue) {
|
||||
|
||||
@@ -10,27 +10,29 @@
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.designer.runprocess.bigdata;
|
||||
package org.talend.designer.core.utils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.core.runtime.FileLocator;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.core.hadoop.HadoopConstants;
|
||||
import org.talend.core.hadoop.version.EHadoopDistributions;
|
||||
import org.talend.core.model.general.ModuleNeeded;
|
||||
import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.process.IElementParameter;
|
||||
import org.talend.core.model.process.IProcess;
|
||||
import org.talend.core.model.process.IProcess2;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType;
|
||||
|
||||
/**
|
||||
* created by nrousseau on Mar 24, 2018 Detailled comment
|
||||
@@ -38,10 +40,10 @@ import org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType;
|
||||
*/
|
||||
public class BigDataJobUtil {
|
||||
|
||||
private ProcessItem processItem;
|
||||
private IProcess process;
|
||||
|
||||
public BigDataJobUtil(ProcessItem processItem) {
|
||||
this.processItem = processItem;
|
||||
public BigDataJobUtil(IProcess process) {
|
||||
this.process = process;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,11 +70,10 @@ public class BigDataJobUtil {
|
||||
public boolean isSparkWithHDInsight() {
|
||||
boolean isSparkWithHDInsight = false;
|
||||
if (isBDJobWithFramework(ERepositoryObjectType.PROCESS_MR, HadoopConstants.FRAMEWORK_SPARK)
|
||||
|| isBDJobWithFramework(ERepositoryObjectType.PROCESS_STORM,
|
||||
HadoopConstants.FRAMEWORK_SPARKSTREAMING)) {
|
||||
EList<ElementParameterType> parameters = processItem.getProcess().getParameters().getElementParameter();
|
||||
|| isBDJobWithFramework(ERepositoryObjectType.PROCESS_STORM, HadoopConstants.FRAMEWORK_SPARKSTREAMING)) {
|
||||
List<? extends IElementParameter> parameters = process.getElementParametersWithChildrens();
|
||||
boolean modeParameterVisited = false;
|
||||
for (ElementParameterType pt : parameters) {
|
||||
for (IElementParameter pt : parameters) {
|
||||
if (pt.getName().equals("SPARK_LOCAL_MODE")) { //$NON-NLS-1$
|
||||
modeParameterVisited = true;
|
||||
if ("true".equals(pt.getValue())) { //$NON-NLS-1$
|
||||
@@ -96,11 +97,11 @@ public class BigDataJobUtil {
|
||||
|
||||
public boolean isMRWithHDInsight() {
|
||||
Boolean isMRWithHDInsight = false;
|
||||
if (processItem != null) {
|
||||
if (process != null) {
|
||||
isMRWithHDInsight = false;
|
||||
if (isBDJobWithFramework(ERepositoryObjectType.PROCESS_MR, HadoopConstants.FRAMEWORK_MAPREDUCE)) {
|
||||
EList<ElementParameterType> parameters = processItem.getProcess().getParameters().getElementParameter();
|
||||
for (ElementParameterType pt : parameters) {
|
||||
List<? extends IElementParameter> parameters = process.getElementParametersWithChildrens();
|
||||
for (IElementParameter pt : parameters) {
|
||||
if (pt.getName().equals("DISTRIBUTION") //$NON-NLS-1$
|
||||
&& EHadoopDistributions.MICROSOFT_HD_INSIGHT.getName().equals(pt.getValue())) {
|
||||
isMRWithHDInsight = true;
|
||||
@@ -119,11 +120,10 @@ public class BigDataJobUtil {
|
||||
Boolean isSparkInYarnClusterMode = false;
|
||||
// Test if we are in Spark or Spark streaming
|
||||
if (isBDJobWithFramework(ERepositoryObjectType.PROCESS_MR, HadoopConstants.FRAMEWORK_SPARK)
|
||||
|| isBDJobWithFramework(ERepositoryObjectType.PROCESS_STORM,
|
||||
HadoopConstants.FRAMEWORK_SPARKSTREAMING)) {
|
||||
|| isBDJobWithFramework(ERepositoryObjectType.PROCESS_STORM, HadoopConstants.FRAMEWORK_SPARKSTREAMING)) {
|
||||
|
||||
EList<ElementParameterType> parameters = processItem.getProcess().getParameters().getElementParameter();
|
||||
for (ElementParameterType pt : parameters) {
|
||||
List<? extends IElementParameter> parameters = process.getElementParametersWithChildrens();
|
||||
for (IElementParameter pt : parameters) {
|
||||
if (HadoopConstants.SPARK_MODE.equals(pt.getName())
|
||||
&& HadoopConstants.SPARK_MODE_YARN_CLUSTER.equals(pt.getValue())) {
|
||||
isSparkInYarnClusterMode = true;
|
||||
@@ -135,31 +135,23 @@ public class BigDataJobUtil {
|
||||
}
|
||||
|
||||
private boolean isBDJobWithFramework(ERepositoryObjectType objectType, String frameworkName) {
|
||||
if (processItem != null) {
|
||||
// Storm/SparkStreaming(PROCESS_STORM), MR/Spark(PROCESS_MR)
|
||||
if (ERepositoryObjectType.getItemType(processItem).equals(objectType)) { // have same type
|
||||
Property property = processItem.getProperty();
|
||||
if (property != null && property.getAdditionalProperties() != null
|
||||
&& frameworkName.equals(property.getAdditionalProperties().get(HadoopConstants.FRAMEWORK))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// Storm/SparkStreaming(PROCESS_STORM), MR/Spark(PROCESS_MR)
|
||||
if (process != null && process instanceof IProcess2 && ((IProcess2) process).getAdditionalProperties() != null
|
||||
&& frameworkName.equals(((IProcess2) process).getAdditionalProperties().get(HadoopConstants.FRAMEWORK))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Find the distribution where the generated jar rquired to have the context files inside **/
|
||||
public boolean needsToHaveContextInsideJar() {
|
||||
if (processItem.getProcess() != null && processItem.getProcess().getParameters() != null) {
|
||||
EList<ElementParameterType> parameters = processItem.getProcess().getParameters().getElementParameter();
|
||||
for (ElementParameterType pt : parameters) {
|
||||
List<? extends IElementParameter> parameters = process.getElementParametersWithChildrens();
|
||||
|
||||
if (process != null && parameters != null) {
|
||||
|
||||
for (IElementParameter pt : parameters) {
|
||||
if (pt.getName().equals("DISTRIBUTION")) { //$NON-NLS-1$
|
||||
String value = pt.getValue();
|
||||
if ("MICROSOFT_HD_INSIGHT".equals(value) //$NON-NLS-1$
|
||||
|| "GOOGLE_CLOUD_DATAPROC".equals(value) //$NON-NLS-1$
|
||||
|| "CLOUDERA_ALTUS".equals(value)) { //$NON-NLS-1$
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (isSparkWithYarnClusterMode()) {
|
||||
@@ -169,6 +161,27 @@ public class BigDataJobUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setExcludedModules(Collection<ModuleNeeded> modulesNeeded) {
|
||||
if (isMRWithHDInsight() || isSparkWithHDInsight()) {
|
||||
// we need to exclude every non-MR Required jars.
|
||||
for (ModuleNeeded currentModule : modulesNeeded) {
|
||||
if (currentModule.isMrRequired()) {
|
||||
currentModule.setExcluded(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void removeExcludedModules(Collection<ModuleNeeded> modulesNeeded) {
|
||||
Iterator<ModuleNeeded> itModules = modulesNeeded.iterator();
|
||||
while (itModules.hasNext()) {
|
||||
ModuleNeeded module = itModules.next();
|
||||
if (module.isExcluded()) {
|
||||
itModules.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC nrousseau Comment method "getShadedModulesExclude".
|
||||
*
|
||||
@@ -182,6 +195,8 @@ public class BigDataJobUtil {
|
||||
for (ModuleNeeded currentModule : modulesNeeded) {
|
||||
if (!currentModule.isMrRequired()) {
|
||||
excludedModules.add(currentModule);
|
||||
} else {
|
||||
currentModule.setExcluded(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,12 +27,9 @@ import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.talend.core.CorePlugin;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.ILibraryManagerService;
|
||||
import org.talend.core.hadoop.IHadoopClusterService;
|
||||
import org.talend.core.hadoop.repository.HadoopRepositoryUtil;
|
||||
import org.talend.core.model.general.ModuleNeeded;
|
||||
import org.talend.core.model.general.ModuleNeeded.ELibraryInstallStatus;
|
||||
import org.talend.core.model.process.EParameterFieldType;
|
||||
import org.talend.core.model.process.IContext;
|
||||
import org.talend.core.model.process.IContextParameter;
|
||||
@@ -106,6 +103,10 @@ public class JavaProcessUtil {
|
||||
}
|
||||
}
|
||||
|
||||
if (BitwiseOptionUtils.containOption(options, TalendProcessOptionConstants.MODULES_EXCLUDE_SHADED)) {
|
||||
new BigDataJobUtil(process).removeExcludedModules(modulesNeeded);
|
||||
}
|
||||
|
||||
return new HashSet<ModuleNeeded>(modulesNeeded);
|
||||
}
|
||||
|
||||
@@ -208,6 +209,7 @@ public class JavaProcessUtil {
|
||||
if (hadoopItemId != null) {
|
||||
useCustomConfsJarIfNeeded(modulesNeeded, hadoopItemId);
|
||||
}
|
||||
new BigDataJobUtil(process).setExcludedModules(modulesNeeded);
|
||||
}
|
||||
|
||||
public static String getHadoopClusterItemId(INode node) {
|
||||
|
||||
@@ -55,15 +55,5 @@
|
||||
</includes>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
<dependencySets>
|
||||
<!-- for all jobs -->
|
||||
<dependencySet>
|
||||
<includes>
|
||||
<!--@JobIncludes@-->
|
||||
</includes>
|
||||
<outputFileNameMapping>${artifact.build.finalName}.${artifact.extension}</outputFileNameMapping>
|
||||
<useProjectArtifact>true</useProjectArtifact>
|
||||
<unpack>true</unpack>
|
||||
</dependencySet>
|
||||
</dependencySets>
|
||||
<dependencySets></dependencySets>
|
||||
</assembly>
|
||||
|
||||
@@ -209,32 +209,5 @@
|
||||
</includes>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
<dependencySets>
|
||||
<dependencySet>
|
||||
<outputDirectory>lib</outputDirectory>
|
||||
<includes>
|
||||
<!--@TalendLibIncludes@-->
|
||||
</includes>
|
||||
<!-- without version for talend libraries -->
|
||||
<outputFileNameMapping>${artifact.artifactId}.${artifact.extension}
|
||||
</outputFileNameMapping>
|
||||
<useProjectArtifact>false</useProjectArtifact>
|
||||
</dependencySet>
|
||||
<dependencySet>
|
||||
<outputDirectory>lib</outputDirectory>
|
||||
<includes>
|
||||
<!--@3rdPartyLibIncludes@-->
|
||||
</includes>
|
||||
<useProjectArtifact>false</useProjectArtifact>
|
||||
</dependencySet>
|
||||
<!-- for all jobs -->
|
||||
<dependencySet>
|
||||
<outputDirectory>${talend.job.name}</outputDirectory>
|
||||
<includes>
|
||||
<!--@JobIncludes@-->
|
||||
</includes>
|
||||
<outputFileNameMapping>${artifact.build.finalName}.${artifact.extension}</outputFileNameMapping>
|
||||
<useProjectArtifact>true</useProjectArtifact>
|
||||
</dependencySet>
|
||||
</dependencySets>
|
||||
<dependencySets></dependencySets>
|
||||
</assembly>
|
||||
|
||||
@@ -742,6 +742,10 @@ public class DefaultRunProcessService implements IRunProcessService {
|
||||
return ProcessorUtilities.isExportConfig();
|
||||
}
|
||||
|
||||
public boolean isdebug() {
|
||||
return ProcessorUtilities.isdebug();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildCodesJavaProject(IProgressMonitor monitor) {
|
||||
try {
|
||||
|
||||
@@ -54,6 +54,7 @@ import org.talend.core.model.components.ComponentCategory;
|
||||
import org.talend.core.model.components.ComponentUtilities;
|
||||
import org.talend.core.model.process.IConnection;
|
||||
import org.talend.core.model.process.IContext;
|
||||
import org.talend.core.model.process.IContextParameter;
|
||||
import org.talend.core.model.process.IElementParameter;
|
||||
import org.talend.core.model.process.INode;
|
||||
import org.talend.core.model.process.IPerformance;
|
||||
@@ -66,7 +67,6 @@ import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.runprocess.IEclipseProcessor;
|
||||
import org.talend.core.model.runprocess.data.PerformanceData;
|
||||
import org.talend.core.model.utils.ContextParameterUtils;
|
||||
import org.talend.core.model.utils.TalendTextUtils;
|
||||
import org.talend.core.runtime.process.TalendProcessArgumentConstant;
|
||||
import org.talend.designer.core.model.components.EParameterName;
|
||||
@@ -1911,37 +1911,61 @@ public class RunProcessContext {
|
||||
* Foe ESB related processes, add a message to the console indicating the endpoint (domain + port) currently used.
|
||||
*/
|
||||
private void addEndpointURL() {
|
||||
|
||||
String defaultRestUri = Platform
|
||||
.getPreferencesService()
|
||||
.getString("org.talend.designer.esb.components.rs.provider", "restServiceDefaultUri",
|
||||
"http://127.0.0.1:8090/", null);
|
||||
|
||||
Collection<NodeType> restComponents = EmfModelUtils
|
||||
.getComponentsByName((ProcessItem) process.getProperty().getItem(), "cREST", "tRESTRequest");
|
||||
if (!restComponents.isEmpty() && running) {
|
||||
NodeType restComponent = restComponents.iterator().next();
|
||||
String endpoint;
|
||||
String url = null;
|
||||
|
||||
if ("cREST".equals(restComponent.getComponentName()))
|
||||
endpoint = ComponentUtilities.getNodePropertyValue(restComponent, "URL");
|
||||
else
|
||||
endpoint = ComponentUtilities.getNodePropertyValue(restComponent, "REST_ENDPOINT");
|
||||
|
||||
String decodedEndpoint = "";
|
||||
|
||||
if (!StringUtils.isEmpty(endpoint)) {
|
||||
if (TalendTextUtils.removeQuotes(endpoint).startsWith("http"))
|
||||
url = TalendTextUtils.removeQuotes(endpoint);
|
||||
else if (ContextParameterUtils.containContextVariables(endpoint)) {
|
||||
String variable = ContextParameterUtils.getVariableFromCode(endpoint);
|
||||
if (selectedContext != null) {
|
||||
url = TalendTextUtils.removeQuotes(selectedContext.getContextParameter(variable).getValue());
|
||||
|
||||
String[] allStrings = endpoint.split("[\\+]");
|
||||
|
||||
for (String endpointElement : allStrings) {
|
||||
|
||||
endpointElement = endpointElement.trim();
|
||||
|
||||
if (endpointElement.startsWith("context.")) {
|
||||
|
||||
// Context parameter
|
||||
String contextParamId = endpointElement.replaceFirst("context.", "");
|
||||
|
||||
for (IContextParameter param : selectedContext.getContextParameterList()) {
|
||||
if (param.getName().equals(contextParamId)) {
|
||||
decodedEndpoint += TalendTextUtils
|
||||
.removeQuotes(selectedContext.getContextParameter(param.getName()).getValue());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
decodedEndpoint += TalendTextUtils.removeQuotes(endpointElement);
|
||||
}
|
||||
}
|
||||
|
||||
if (decodedEndpoint.startsWith("http")) {
|
||||
url = decodedEndpoint;
|
||||
} else {
|
||||
String defaultRestUri = Platform
|
||||
.getPreferencesService()
|
||||
.getString("org.talend.designer.esb.components.rs.provider", "restServiceDefaultUri",
|
||||
"http://127.0.0.1:8090/", null);
|
||||
endpoint = TalendTextUtils.removeQuotes(endpoint);
|
||||
if (endpoint.startsWith("/"))
|
||||
endpoint = endpoint.substring(1);
|
||||
String fullURL = defaultRestUri + endpoint;
|
||||
String fullURL = defaultRestUri + decodedEndpoint;
|
||||
url = fullURL.replaceAll("(?<!(http:|https:))//", "/");
|
||||
}
|
||||
|
||||
if (url != null)
|
||||
addMessage(new ProcessMessage(MsgType.CORE_OUT, "Endpoint deployed at: " + url));
|
||||
addMessage(new ProcessMessage(MsgType.STD_OUT, "Endpoint deployed at: " + url));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -478,4 +478,10 @@ public class RunProcessService implements IRunProcessService {
|
||||
delegateService.handleJobDependencyLoop(mainJobInfo, listJobs, progressMonitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isdebug() {
|
||||
|
||||
return delegateService.isdebug();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ import org.talend.core.runtime.process.ITalendProcessJavaProject;
|
||||
import org.talend.core.runtime.process.LastGenerationInfo;
|
||||
import org.talend.core.runtime.process.TalendProcessOptionConstants;
|
||||
import org.talend.core.runtime.repository.build.IMavenPomCreator;
|
||||
import org.talend.designer.core.utils.BigDataJobUtil;
|
||||
import org.talend.designer.maven.tools.creator.CreateMavenJobPom;
|
||||
import org.talend.designer.maven.utils.PomUtil;
|
||||
import org.talend.designer.runprocess.IBigDataProcessor;
|
||||
@@ -224,7 +225,7 @@ public abstract class BigDataJavaProcessor extends MavenJavaProcessor implements
|
||||
// StringBuffer.
|
||||
boolean needAllLibJars = true;
|
||||
if (needsShade()) {
|
||||
BigDataJobUtil bdUtil = new BigDataJobUtil((ProcessItem) this.getProperty().getItem());
|
||||
BigDataJobUtil bdUtil = new BigDataJobUtil(process);
|
||||
if (bdUtil.isMRWithHDInsight()) {
|
||||
needAllLibJars = false;
|
||||
}
|
||||
@@ -410,7 +411,7 @@ public abstract class BigDataJavaProcessor extends MavenJavaProcessor implements
|
||||
@Override
|
||||
public boolean needsShade() {
|
||||
if (needsShade == null && property != null) {
|
||||
needsShade = new BigDataJobUtil((ProcessItem) property.getItem()).needsShade();
|
||||
needsShade = new BigDataJobUtil(process).needsShade();
|
||||
}
|
||||
return needsShade;
|
||||
}
|
||||
@@ -430,7 +431,7 @@ public abstract class BigDataJavaProcessor extends MavenJavaProcessor implements
|
||||
modulesNeeded);
|
||||
}
|
||||
|
||||
return new BigDataJobUtil((ProcessItem) property.getItem()).getShadedModulesExclude(modulesNeeded);
|
||||
return new BigDataJobUtil(getProcess()).getShadedModulesExclude(modulesNeeded);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -136,6 +136,7 @@ import org.talend.designer.core.model.utils.emf.talendfile.ProcessType;
|
||||
import org.talend.designer.core.ui.editor.CodeEditorFactory;
|
||||
import org.talend.designer.core.ui.editor.nodes.Node;
|
||||
import org.talend.designer.core.ui.editor.process.Process;
|
||||
import org.talend.designer.core.utils.BigDataJobUtil;
|
||||
import org.talend.designer.maven.utils.ClasspathsJarGenerator;
|
||||
import org.talend.designer.maven.utils.MavenVersionHelper;
|
||||
import org.talend.designer.maven.utils.PomUtil;
|
||||
@@ -145,7 +146,6 @@ import org.talend.designer.runprocess.ProcessorException;
|
||||
import org.talend.designer.runprocess.ProcessorUtilities;
|
||||
import org.talend.designer.runprocess.RunProcessContext;
|
||||
import org.talend.designer.runprocess.RunProcessPlugin;
|
||||
import org.talend.designer.runprocess.bigdata.BigDataJobUtil;
|
||||
import org.talend.designer.runprocess.i18n.Messages;
|
||||
import org.talend.designer.runprocess.prefs.RunProcessPrefsConstants;
|
||||
import org.talend.designer.runprocess.utils.JobVMArgumentsUtil;
|
||||
@@ -356,7 +356,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
|
||||
boolean needsToHaveContextInsideJar = true;
|
||||
|
||||
if (property != null && property.getItem() instanceof ProcessItem) {
|
||||
needsToHaveContextInsideJar = !new BigDataJobUtil((ProcessItem) property.getItem()).needsToHaveContextInsideJar();
|
||||
needsToHaveContextInsideJar = !new BigDataJobUtil(process).needsToHaveContextInsideJar();
|
||||
}
|
||||
|
||||
if (ProcessorUtilities.isExportConfig() && property != null && needsToHaveContextInsideJar) {
|
||||
@@ -1229,7 +1229,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
|
||||
libsStr = StringUtils.replace(libsStr, " ", "%20"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
// create classpath.jar
|
||||
if (!isExportConfig() && !isSkipClasspathJar()) {
|
||||
if (!isExportConfig() && !isSkipClasspathJar() && isCorrespondingOS()) {
|
||||
try {
|
||||
libsStr = ClasspathsJarGenerator.createJar(getProperty(), libsStr, classPathSeparator);
|
||||
} catch (Exception e) {
|
||||
@@ -1240,6 +1240,16 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
|
||||
return libsStr;
|
||||
}
|
||||
|
||||
private boolean isCorrespondingOS() {
|
||||
if (Platform.getOS().equals(Platform.OS_WIN32) && isWinTargetPlatform()) {
|
||||
return true;
|
||||
}
|
||||
if (!Platform.getOS().equals(Platform.OS_WIN32) && !isWinTargetPlatform()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected String getBasePathClasspath() throws ProcessorException {
|
||||
final String classPathSeparator = extractClassPathSeparator();
|
||||
final String rootWorkingDir = getRootWorkingDir(false);
|
||||
@@ -1356,7 +1366,12 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
|
||||
final String classPathSeparator = extractClassPathSeparator();
|
||||
final String libPrefixPath = getRootWorkingDir(true);
|
||||
|
||||
Set<ModuleNeeded> neededModules = getNeededModules(TalendProcessOptionConstants.MODULES_WITH_CHILDREN);
|
||||
int option = TalendProcessOptionConstants.MODULES_WITH_CHILDREN;
|
||||
|
||||
if (isExportConfig() || isSkipClasspathJar()) {
|
||||
option = option | TalendProcessOptionConstants.MODULES_EXCLUDE_SHADED;
|
||||
}
|
||||
Set<ModuleNeeded> neededModules = getNeededModules(option);
|
||||
JavaProcessorUtilities.checkJavaProjectLib(neededModules);
|
||||
|
||||
// Ignore hadoop confs jars in lib path.
|
||||
|
||||
@@ -72,6 +72,7 @@ import org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.NodeType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ProcessType;
|
||||
import org.talend.designer.core.ui.editor.process.Process;
|
||||
import org.talend.designer.core.utils.BigDataJobUtil;
|
||||
import org.talend.designer.core.utils.JavaProcessUtil;
|
||||
import org.talend.designer.maven.utils.PomUtil;
|
||||
import org.talend.designer.runprocess.IRunProcessService;
|
||||
@@ -104,7 +105,8 @@ public class JavaProcessorUtilities {
|
||||
* @return
|
||||
*/
|
||||
public static Set<ModuleNeeded> extractLibsOnlyForMapperAndReducer(IProcess process) {
|
||||
int options = TalendProcessOptionConstants.MODULES_WITH_CHILDREN | TalendProcessOptionConstants.MODULES_FOR_MR;
|
||||
int options = TalendProcessOptionConstants.MODULES_WITH_CHILDREN | TalendProcessOptionConstants.MODULES_FOR_MR
|
||||
| TalendProcessOptionConstants.MODULES_EXCLUDE_SHADED;
|
||||
Set<ModuleNeeded> allModules = JavaProcessUtil.getNeededModules(process, options);
|
||||
return allModules;
|
||||
}
|
||||
@@ -241,6 +243,11 @@ public class JavaProcessorUtilities {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (BitwiseOptionUtils.containOption(options, TalendProcessOptionConstants.MODULES_EXCLUDE_SHADED)) {
|
||||
new BigDataJobUtil(process).removeExcludedModules(neededLibraries);
|
||||
}
|
||||
|
||||
// move high priority modules to front.
|
||||
Set<ModuleNeeded> highPriorityModuleNeeded = LastGenerationInfo.getInstance().getHighPriorityModuleNeeded();
|
||||
if (!highPriorityModuleNeeded.isEmpty()) {
|
||||
|
||||
@@ -823,10 +823,13 @@ connections.form.field.description=Description
|
||||
connections.form.field.imcomplete=Incomplete
|
||||
connections.form.field.name=Name
|
||||
connections.form.field.password=User Password
|
||||
connections.form.field.token=Token
|
||||
connections.form.field.token.browse=Open the token page in browse
|
||||
connections.form.field.repository=Repository
|
||||
connections.form.field.username=User E-mail
|
||||
connections.form.field.usernameNoMail=User Name
|
||||
connections.form.malformedField.username=The username must be a valid email.
|
||||
connections.form.getTokenUrl.failed=Please check the server url.
|
||||
dataset.error.populateXMLTree=An invalid file is inputed, please input valid file.
|
||||
repository.title=Repository
|
||||
|
||||
|
||||
@@ -423,6 +423,7 @@ public class RepositoryService implements IRepositoryService, IRepositoryContext
|
||||
repositoryContext.setUser(userInfo);
|
||||
repositoryContext.setClearPassword(password);
|
||||
repositoryContext.setFields(bean.getDynamicFields());
|
||||
repositoryContext.setToken(bean.isToken());
|
||||
|
||||
repositoryFactory.setRepositoryFactoryFromProvider(RepositoryFactoryProvider.getRepositoriyById(bean
|
||||
.getRepositoryId()));
|
||||
|
||||
@@ -57,7 +57,9 @@ public class AutoUpdateRelationsMigrationTask extends AbstractJobMigrationTask {
|
||||
Resource processResource = ((ProcessItem) item).getProcess().eResource();
|
||||
Resource propertyResource = item.eResource();
|
||||
if (processResource != null && processResource.isLoaded() && (processResource instanceof XMIResource)) {
|
||||
propertyResource.unload();
|
||||
if (propertyResource != null) {
|
||||
propertyResource.unload();
|
||||
}
|
||||
processResource.unload();
|
||||
rM.resourceSet.getResources().remove(propertyResource);
|
||||
rM.resourceSet.getResources().remove(processResource);
|
||||
|
||||
@@ -23,9 +23,6 @@ public class UseOracle11VersionInsteadOfRemoved extends AbstractJobMigrationTask
|
||||
private static final String ORACLE_VERSION_PROPERTY_NAME = "DB_VERSION";
|
||||
private static final String REMOVED_ORACLE_VERSION = "ORACLE_11-6";
|
||||
|
||||
private static final String USE_CONNECTION_PROPERTY_NAME = "USE_EXISTING_CONNECTION";
|
||||
|
||||
private static final String MOVE_TO_DIR_PROPERTY_NAME = "MOVE_TO_THE_CURRENT_DIRECTORY";
|
||||
|
||||
@Override
|
||||
public Date getOrder() {
|
||||
@@ -83,12 +80,12 @@ public class UseOracle11VersionInsteadOfRemoved extends AbstractJobMigrationTask
|
||||
private class OracleVersionConversion implements IComponentConversion {
|
||||
@Override
|
||||
public void transform(NodeType node) {
|
||||
if ((!"true".equals(ComponentUtilities.getNodePropertyValue(node, USE_CONNECTION_PROPERTY_NAME)))) {
|
||||
String oracleVersion = ComponentUtilities.getNodePropertyValue(node, ORACLE_VERSION_PROPERTY_NAME);
|
||||
if (REMOVED_ORACLE_VERSION.equals(oracleVersion)) {
|
||||
ComponentUtilities.setNodeValue(node, ORACLE_VERSION_PROPERTY_NAME, "ORACLE_11");
|
||||
}
|
||||
|
||||
String oracleVersion = ComponentUtilities.getNodePropertyValue(node, ORACLE_VERSION_PROPERTY_NAME);
|
||||
if (REMOVED_ORACLE_VERSION.equals(oracleVersion)) {
|
||||
ComponentUtilities.setNodeValue(node, ORACLE_VERSION_PROPERTY_NAME, "ORACLE_11");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -374,6 +374,7 @@ public class LoginHelper {
|
||||
if (connBean != null) {
|
||||
repositoryContext.setFields(connBean.getDynamicFields());
|
||||
password = connBean.getPassword();
|
||||
repositoryContext.setToken(connBean.isToken());
|
||||
}
|
||||
repositoryContext.setClearPassword(password);
|
||||
if (project != null) {
|
||||
|
||||
@@ -13,15 +13,18 @@
|
||||
package org.talend.repository.ui.login.connections;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.draw2d.ColorConstants;
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.jface.layout.GridDataFactory;
|
||||
import org.eclipse.jface.viewers.ArrayContentProvider;
|
||||
import org.eclipse.jface.viewers.ComboViewer;
|
||||
@@ -39,6 +42,7 @@ import org.eclipse.swt.events.SelectionListener;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.program.Program;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Combo;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
@@ -54,6 +58,7 @@ import org.talend.commons.ui.swt.formtools.LabelText;
|
||||
import org.talend.commons.ui.swt.formtools.LabelledCombo;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.model.general.ConnectionBean;
|
||||
import org.talend.core.model.utils.TalendTextUtils;
|
||||
import org.talend.core.repository.model.DynamicButtonBean;
|
||||
import org.talend.core.repository.model.DynamicChoiceBean;
|
||||
import org.talend.core.repository.model.DynamicFieldBean;
|
||||
@@ -90,8 +95,24 @@ public class ConnectionFormComposite extends Composite {
|
||||
|
||||
private Text userText;
|
||||
|
||||
private Label tpPlaceHolder;
|
||||
|
||||
private Composite tpCompo;
|
||||
|
||||
private Button tokenButton;
|
||||
|
||||
private Composite tokenCompo;
|
||||
|
||||
private Text tokenText;
|
||||
|
||||
private Button tokenBrowseButton;
|
||||
|
||||
private Button passwordButton;
|
||||
|
||||
private Text passwordText;
|
||||
|
||||
private String password;
|
||||
|
||||
private Text workSpaceText;
|
||||
|
||||
private Button workSpaceButton;
|
||||
@@ -112,8 +133,9 @@ public class ConnectionFormComposite extends Composite {
|
||||
|
||||
public static final String URL_FIELD_NAME = "url"; //$NON-NLS-1$
|
||||
|
||||
Label passwordLabel = null;
|
||||
private static final String TOKEN_URL_SUFFIX = "/user/access-tokens"; //$NON-NLS-1$
|
||||
|
||||
Label passwordLabel = null;
|
||||
/**
|
||||
* DOC smallet ConnectionsComposite constructor comment.
|
||||
*
|
||||
@@ -171,15 +193,44 @@ public class ConnectionFormComposite extends Composite {
|
||||
userText = toolkit.createText(formBody, "", SWT.BORDER); //$NON-NLS-1$
|
||||
formDefaultFactory.copy().grab(true, false).span(2, 1).applyTo(userText);
|
||||
|
||||
// Password
|
||||
passwordLabel = toolkit.createLabel(formBody, Messages.getString("connections.form.field.password")); //$NON-NLS-1$
|
||||
formDefaultFactory.copy().applyTo(passwordLabel);
|
||||
|
||||
passwordText = toolkit.createText(formBody, "", SWT.PASSWORD | SWT.BORDER); //$NON-NLS-1$
|
||||
tpPlaceHolder = new Label(formBody, SWT.NONE);
|
||||
tpCompo = toolkit.createComposite(formBody);
|
||||
GridLayout tCompoLayout = new GridLayout(3, false);
|
||||
tCompoLayout.marginHeight = 0;
|
||||
tCompoLayout.marginWidth = 0;
|
||||
tpCompo.setLayout(tCompoLayout);
|
||||
formDefaultFactory.copy().grab(true, false).span(2, 1).applyTo(tpCompo);
|
||||
|
||||
// Password
|
||||
passwordButton = toolkit.createButton(tpCompo, Messages.getString("connections.form.field.password"), SWT.RADIO); //$NON-NLS-1$
|
||||
formDefaultFactory.copy().applyTo(passwordButton);
|
||||
|
||||
passwordText = toolkit.createText(tpCompo, "", SWT.PASSWORD | SWT.BORDER); //$NON-NLS-1$
|
||||
formDefaultFactory.copy().grab(true, false).span(2, 1).applyTo(passwordText);
|
||||
|
||||
Label workSpaceLabel = toolkit.createLabel(formBody, Messages.getString("ConnectionFormComposite.WORKSPACE")); //$NON-NLS-1$
|
||||
formDefaultFactory.copy().applyTo(workSpaceLabel);
|
||||
// Token
|
||||
tokenButton = toolkit.createButton(tpCompo, Messages.getString("connections.form.field.token"), SWT.RADIO); //$NON-NLS-1$
|
||||
formDefaultFactory.copy().applyTo(tokenButton);
|
||||
|
||||
tokenCompo = toolkit.createComposite(tpCompo);
|
||||
GridLayout tokenCompoLayout = new GridLayout(3, false);
|
||||
tokenCompoLayout.marginHeight = 0;
|
||||
tokenCompoLayout.marginWidth = 0;
|
||||
tokenCompo.setLayout(tokenCompoLayout);
|
||||
formDefaultFactory.copy().grab(true, false).span(2, 1).applyTo(tokenCompo);
|
||||
|
||||
tokenText = toolkit.createText(tokenCompo, "", SWT.PASSWORD | SWT.BORDER); //$NON-NLS-1$
|
||||
formDefaultFactory.copy().grab(true, false).span(2, 1).applyTo(tokenText);
|
||||
|
||||
tokenBrowseButton = toolkit.createButton(tokenCompo, null, SWT.PUSH);
|
||||
tokenBrowseButton.setToolTipText(Messages.getString("connections.form.field.token.browse")); //$NON-NLS-1$
|
||||
tokenBrowseButton.setImage(ImageProvider.getImage(EImage.THREE_DOTS_ICON));
|
||||
GridDataFactory.fillDefaults().applyTo(tokenBrowseButton);
|
||||
|
||||
Composite wsCompo = toolkit.createComposite(formBody);
|
||||
GridLayout wsCompoLayout = new GridLayout(2, false);
|
||||
@@ -275,6 +326,7 @@ public class ConnectionFormComposite extends Composite {
|
||||
deleteProjectsButton.setLayoutData(deleteButtonGridData);
|
||||
|
||||
addListeners();
|
||||
addTokenBrowseListener();
|
||||
addWorkSpaceListener();
|
||||
fillLists();
|
||||
showHideDynamicsControls();
|
||||
@@ -414,32 +466,67 @@ public class ConnectionFormComposite extends Composite {
|
||||
}
|
||||
|
||||
private void showHideTexts() {
|
||||
if (passwordText != null && !passwordText.isDisposed()) {
|
||||
boolean enablePasswordField = false;
|
||||
if (connection != null) {
|
||||
IRepositoryFactory factory = RepositoryFactoryProvider.getRepositoriyById(connection.getRepositoryId());
|
||||
if (factory != null && factory.isAuthenticationNeeded()) {
|
||||
enablePasswordField = true;
|
||||
}
|
||||
} else if (getRepository() != null && LoginHelper.isRemotesRepository(getRepository().getId())) {
|
||||
boolean token = false;
|
||||
if (connection != null && tokenText != null && !tokenText.isDisposed()) {
|
||||
token = connection.isToken();
|
||||
}
|
||||
// Check enable field or not
|
||||
boolean enablePasswordField = false;
|
||||
boolean enableTokenField = false;
|
||||
if (connection != null) {
|
||||
IRepositoryFactory factory = RepositoryFactoryProvider.getRepositoriyById(connection.getRepositoryId());
|
||||
if (factory != null && factory.isAuthenticationNeeded()) {
|
||||
enablePasswordField = true;
|
||||
if (LoginHelper.isCloudConnection(connection)) {
|
||||
enableTokenField = true;
|
||||
}
|
||||
}
|
||||
} else if (getRepository() != null && LoginHelper.isRemotesRepository(getRepository().getId())) {
|
||||
enablePasswordField = true;
|
||||
if (LoginHelper.isCloudRepository(getRepository().getId())) {
|
||||
enableTokenField = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (enablePasswordField) {
|
||||
// password
|
||||
boolean hidePasswordLabel = !enablePasswordField || enableTokenField;
|
||||
boolean enablePasswordText = passwordButton.getSelection() || !hidePasswordLabel;
|
||||
if (passwordText != null && !passwordText.isDisposed()) {
|
||||
if (enablePasswordField && enablePasswordText) {
|
||||
passwordText.setBackground(LoginDialogV2.WHITE_COLOR);
|
||||
} else {
|
||||
passwordText.setText(""); //$NON-NLS-1$
|
||||
passwordText.setBackground(LoginDialogV2.GREY_COLOR);
|
||||
}
|
||||
passwordText.setEnabled(enablePasswordField);
|
||||
passwordText.setEditable(enablePasswordField);
|
||||
|
||||
passwordText.setEnabled(enablePasswordField && enablePasswordText);
|
||||
passwordText.setEditable(enablePasswordField && enablePasswordText);
|
||||
hideControl(passwordText, !enablePasswordField, false);
|
||||
hideControl(passwordLabel, !enablePasswordField, false);
|
||||
|
||||
hideControl(passwordLabel, hidePasswordLabel, false);
|
||||
hideControl(passwordButton, !(enablePasswordField && enableTokenField), false);
|
||||
passwordText.getParent().layout();
|
||||
|
||||
passwordText.getParent().getParent().layout();
|
||||
}
|
||||
// token
|
||||
if (tokenText != null && !tokenText.isDisposed()) {
|
||||
if (enableTokenField && tokenButton.getSelection()) {
|
||||
tokenText.setBackground(LoginDialogV2.WHITE_COLOR);
|
||||
} else {
|
||||
tokenText.setText(""); //$NON-NLS-1$
|
||||
password = ""; //$NON-NLS-1$
|
||||
tokenText.setBackground(LoginDialogV2.GREY_COLOR);
|
||||
}
|
||||
tokenText.setEnabled(enableTokenField && tokenButton.getSelection());
|
||||
tokenText.setEditable(enableTokenField && tokenButton.getSelection());
|
||||
tokenBrowseButton.setEnabled(enableTokenField && tokenButton.getSelection());
|
||||
hideControl(tokenButton, !enableTokenField, false);
|
||||
hideControl(tokenCompo, !enableTokenField, false);
|
||||
tokenText.getParent().getParent().layout();
|
||||
tokenText.getParent().getParent().getParent().layout();
|
||||
}
|
||||
|
||||
hideControl(tpPlaceHolder, !enableTokenField, false);
|
||||
hideControl(tpCompo, !enablePasswordField, false);
|
||||
tpCompo.getParent().layout();
|
||||
}
|
||||
|
||||
private void hideControl(Control control, boolean hide, boolean autoLayout) {
|
||||
@@ -480,7 +567,7 @@ public class ConnectionFormComposite extends Composite {
|
||||
}
|
||||
|
||||
private String getPassword() {
|
||||
return passwordText.getText();
|
||||
return password;
|
||||
}
|
||||
|
||||
private String getWorkspace() {
|
||||
@@ -501,7 +588,16 @@ public class ConnectionFormComposite extends Composite {
|
||||
userText.setSelection(selection);
|
||||
}
|
||||
}
|
||||
fillBean(false);
|
||||
fillBean(false, false);
|
||||
validateFields();
|
||||
}
|
||||
};
|
||||
|
||||
ModifyListener standardTokenPasswordTextListener = new ModifyListener() {
|
||||
|
||||
@Override
|
||||
public void modifyText(ModifyEvent e) {
|
||||
fillBean(false, true);
|
||||
validateFields();
|
||||
}
|
||||
};
|
||||
@@ -512,7 +608,7 @@ public class ConnectionFormComposite extends Composite {
|
||||
public void selectionChanged(SelectionChangedEvent e) {
|
||||
showHideDynamicsControls();
|
||||
validateFields();
|
||||
fillBean(true);
|
||||
fillBean(true, true);
|
||||
showHideTexts();
|
||||
changeUserLabel();
|
||||
}
|
||||
@@ -536,12 +632,45 @@ public class ConnectionFormComposite extends Composite {
|
||||
}
|
||||
};
|
||||
|
||||
SelectionListener passwordClickListener = new SelectionListener() {
|
||||
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
tokenButton.setSelection(!passwordButton.getSelection());
|
||||
passwordButton.setSelection(passwordButton.getSelection());
|
||||
passwordText.setEnabled(passwordButton.getSelection());
|
||||
showHideTexts();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void widgetDefaultSelected(SelectionEvent e) {
|
||||
// nothing need to do
|
||||
}
|
||||
};
|
||||
|
||||
SelectionListener tokenClickListener = new SelectionListener() {
|
||||
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
passwordButton.setSelection(!tokenButton.getSelection());
|
||||
tokenButton.setSelection(tokenButton.getSelection());
|
||||
tokenText.setEnabled(tokenButton.getSelection());
|
||||
showHideTexts();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void widgetDefaultSelected(SelectionEvent e) {
|
||||
// nothing need to do
|
||||
}
|
||||
};
|
||||
|
||||
private void addListeners() {
|
||||
repositoryCombo.addPostSelectionChangedListener(repositoryListener);
|
||||
nameText.addModifyListener(standardTextListener);
|
||||
descriptionText.addModifyListener(standardTextListener);
|
||||
userText.addModifyListener(standardTextListener);
|
||||
passwordText.addModifyListener(standardTextListener);
|
||||
passwordText.addModifyListener(standardTokenPasswordTextListener);
|
||||
tokenText.addModifyListener(standardTokenPasswordTextListener);
|
||||
workSpaceText.addModifyListener(standardTextListener);
|
||||
|
||||
for (IRepositoryFactory f : dynamicControls.keySet()) {
|
||||
@@ -555,7 +684,8 @@ public class ConnectionFormComposite extends Composite {
|
||||
control.getCombo().addModifyListener(standardTextListener);
|
||||
}
|
||||
}
|
||||
|
||||
passwordButton.addSelectionListener(passwordClickListener);
|
||||
tokenButton.addSelectionListener(tokenClickListener);
|
||||
deleteProjectsButton.addSelectionListener(deleteProjectClickListener);
|
||||
}
|
||||
|
||||
@@ -587,12 +717,50 @@ public class ConnectionFormComposite extends Composite {
|
||||
});
|
||||
}
|
||||
|
||||
private void addTokenBrowseListener() {
|
||||
tokenBrowseButton.addSelectionListener(new SelectionAdapter() {
|
||||
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
String currentUrl = "";
|
||||
if (getRepository() != null) {
|
||||
for (LabelText currentUrlLabel : dynamicRequiredControls.get(getRepository()).values()) {
|
||||
if (currentUrlLabel.getText().length() != 0) {
|
||||
currentUrl = currentUrlLabel.getText();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(currentUrl)) {
|
||||
try {
|
||||
String tokenUrl = getTokenUrl(currentUrl);
|
||||
openBrower(tokenUrl);
|
||||
} catch (Exception exception) {
|
||||
MessageDialog.openError(getShell(), getShell().getText(),
|
||||
Messages.getString("connections.form.getTokenUrl.failed"));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private String getTokenUrl(String serverUrlStr) throws Exception {
|
||||
URL serverUrl = new URL(serverUrlStr);
|
||||
String host = serverUrl.getHost().replace("tmc.", "");
|
||||
URL tokenUrl = new URL(serverUrl.getProtocol(), host, TOKEN_URL_SUFFIX);
|
||||
return tokenUrl.toString();
|
||||
}
|
||||
|
||||
private void openBrower(String url) {
|
||||
Program.launch(url);
|
||||
}
|
||||
|
||||
private void removeListeners() {
|
||||
repositoryCombo.removePostSelectionChangedListener(repositoryListener);
|
||||
nameText.removeModifyListener(standardTextListener);
|
||||
descriptionText.removeModifyListener(standardTextListener);
|
||||
userText.removeModifyListener(standardTextListener);
|
||||
passwordText.removeModifyListener(standardTextListener);
|
||||
passwordText.removeModifyListener(standardTokenPasswordTextListener);
|
||||
tokenText.removeModifyListener(standardTokenPasswordTextListener);
|
||||
workSpaceText.removeModifyListener(standardTextListener);
|
||||
|
||||
for (IRepositoryFactory f : dynamicControls.keySet()) {
|
||||
@@ -606,10 +774,12 @@ public class ConnectionFormComposite extends Composite {
|
||||
control.getCombo().removeModifyListener(standardTextListener);
|
||||
}
|
||||
}
|
||||
passwordButton.removeSelectionListener(passwordClickListener);
|
||||
tokenButton.removeSelectionListener(tokenClickListener);
|
||||
deleteProjectsButton.removeSelectionListener(deleteProjectClickListener);
|
||||
}
|
||||
|
||||
private void fillBean(boolean cleanDynamicValue) {
|
||||
private void fillBean(boolean cleanDynamicValue, boolean enableHidePassword) {
|
||||
if (connection != null) {
|
||||
IRepositoryFactory repository = getRepository();
|
||||
if (repository != null) {
|
||||
@@ -662,7 +832,18 @@ public class ConnectionFormComposite extends Composite {
|
||||
connection.setName(nameText.getText());
|
||||
connection.setDescription(descriptionText.getText());
|
||||
connection.setUser(userText.getText());
|
||||
connection.setPassword(passwordText.getText());
|
||||
if (enableHidePassword) {
|
||||
String password = getPassword(); // $NON-NLS-1$
|
||||
if (StringUtils.isEmpty(password)) {
|
||||
if (tokenButton.getSelection()) {
|
||||
password = tokenText.getText();
|
||||
} else {
|
||||
password = passwordText.getText();
|
||||
}
|
||||
}
|
||||
connection.setPassword(password);
|
||||
connection.setToken(tokenButton.getSelection());
|
||||
}
|
||||
connection.setWorkSpace(workSpaceText.getText());
|
||||
|
||||
connectionsListComposite.refresh(connection);
|
||||
@@ -734,7 +915,17 @@ public class ConnectionFormComposite extends Composite {
|
||||
nameText.setText((connection.getName() == null ? "" : connection.getName())); //$NON-NLS-1$
|
||||
descriptionText.setText((connection.getDescription() == null ? "" : connection.getDescription())); //$NON-NLS-1$
|
||||
userText.setText((connection.getUser() == null ? "" : connection.getUser())); //$NON-NLS-1$
|
||||
passwordText.setText((connection.getPassword() == null ? "" : connection.getPassword())); //$NON-NLS-1$
|
||||
String passwordStr = TalendTextUtils.hidePassword(connection.getPassword());
|
||||
tokenButton.setSelection(connection.isToken());
|
||||
tokenText.setEnabled(connection.isToken());
|
||||
passwordButton.setSelection(!connection.isToken());
|
||||
passwordText.setEnabled(!connection.isToken());
|
||||
if (connection.isToken()) {
|
||||
tokenText.setText(passwordStr);
|
||||
} else {
|
||||
passwordText.setText(passwordStr);
|
||||
}
|
||||
password = connection.getPassword() == null ? "" : connection.getPassword(); // $NON-NLS-1$
|
||||
workSpaceText
|
||||
.setText(("".equals(connection.getWorkSpace()) || connection.getWorkSpace() == null) ? getRecentWorkSpace() : connection.getWorkSpace());//$NON-NLS-1$
|
||||
addListeners();
|
||||
|
||||
@@ -251,6 +251,7 @@ public class CreateSandboxProjectDialog extends TitleAreaDialog {
|
||||
RepositoryContext repositoryContext = new RepositoryContext();
|
||||
repositoryContext.setFields(new HashMap<String, String>());
|
||||
repositoryContext.setClearPassword(originRepCtx.getClearPassword());
|
||||
repositoryContext.setToken(bean != null ? bean.isToken() : false);
|
||||
repositoryContext.setUser(originRepCtx.getUser());
|
||||
repositoryContext.getFields().put(RepositoryConstants.REPOSITORY_URL, urlText.getText());
|
||||
ctx.putProperty(Context.REPOSITORY_CONTEXT_KEY, repositoryContext);
|
||||
|
||||
@@ -81,11 +81,10 @@ public class BuildOSGiBundleHandler extends BuildJobHandler {
|
||||
// to compute import-package for the manifest.mf. TalendJavaProjectManager.getTalendJobJavaProject is always
|
||||
// disabled MavenNature when create project(false), it will stop jdt to compile, and imporve this part will help
|
||||
// to avoid using maven in this step.
|
||||
final Map<String, Object> argumentsMap = new HashMap<String, Object>();
|
||||
argumentsMap.put(TalendProcessArgumentConstant.ARG_PROGRAM_ARGUMENTS, "-Dci.builder.skip=true");
|
||||
MavenPomCommandLauncher mavenLauncher = new MavenPomCommandLauncher(talendProcessJavaProject.getProjectPom(),
|
||||
TalendMavenConstants.GOAL_COMPILE);
|
||||
mavenLauncher.setArgumentsMap(argumentsMap);
|
||||
mavenLauncher.setSkipCIBuilder(true);
|
||||
mavenLauncher.setSkipTests(true);
|
||||
mavenLauncher.execute(monitor);
|
||||
|
||||
List<ExportFileResource> resources = osgiMavenManager
|
||||
|
||||
@@ -12,14 +12,17 @@
|
||||
// ============================================================================
|
||||
package org.talend.repository.ui.wizards.exportjob.scriptsmanager.esb;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
@@ -30,8 +33,11 @@ import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.jar.Manifest;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.collections.map.MultiKeyMap;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
@@ -55,6 +61,7 @@ import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.model.utils.JavaResourcesHelper;
|
||||
import org.talend.core.repository.constants.FileConstants;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
import org.talend.core.runtime.process.ITalendProcessJavaProject;
|
||||
import org.talend.core.runtime.process.LastGenerationInfo;
|
||||
import org.talend.core.runtime.repository.build.BuildExportManager;
|
||||
import org.talend.core.ui.branding.IBrandingService;
|
||||
@@ -670,6 +677,34 @@ public class JobJavaScriptOSGIForESBManager extends JobJavaScriptsManager {
|
||||
|
||||
private Manifest getManifest(ExportFileResource libResource, ProcessItem processItem) throws IOException {
|
||||
Analyzer analyzer = createAnalyzer(libResource, processItem);
|
||||
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
|
||||
IRunProcessService service = (IRunProcessService) GlobalServiceRegister.getDefault()
|
||||
.getService(IRunProcessService.class);
|
||||
ITalendProcessJavaProject talendProcessJavaProject = service.getTalendJobJavaProject(processItem.getProperty());
|
||||
if (talendProcessJavaProject != null) {
|
||||
String optional = ";resolution:=optional";
|
||||
String src = JavaResourcesHelper.getJobClassFilePath(processItem, true);
|
||||
IFile srcFile = talendProcessJavaProject.getSrcFolder().getFile(src);
|
||||
Set<String> imports = importCompiler(srcFile.getLocation().toString());
|
||||
String[] defaultPackages = analyzer.getProperty(Analyzer.IMPORT_PACKAGE).split(",");
|
||||
for (String dp : defaultPackages) {
|
||||
if (!imports.contains(dp) && !imports.contains(dp + optional)) {
|
||||
imports.add(dp);
|
||||
}
|
||||
}
|
||||
imports.remove("*;resolution:=optional");
|
||||
imports.remove("routines.system");
|
||||
imports.remove("routines.system" + optional);
|
||||
StringBuilder importPackage = new StringBuilder();
|
||||
for (String packageName : imports) {
|
||||
importPackage.append(packageName).append(',');
|
||||
}
|
||||
importPackage.append("*;resolution:=optional");
|
||||
analyzer.setProperty(Analyzer.IMPORT_PACKAGE, importPackage.toString());
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate the manifest
|
||||
Manifest manifest = null;
|
||||
try {
|
||||
@@ -900,4 +935,36 @@ public class JobJavaScriptOSGIForESBManager extends JobJavaScriptsManager {
|
||||
return processor.getProcess();
|
||||
}
|
||||
|
||||
private Set<String> importCompiler(String src) {
|
||||
Set<String> imports = new HashSet<String>();
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
ByteArrayOutputStream err = new ByteArrayOutputStream();
|
||||
try {
|
||||
org.eclipse.jdt.core.compiler.batch.BatchCompiler.compile(src + " -1.7 -nowarn -maxProblems 100000 ", new PrintWriter(out),
|
||||
new PrintWriter(err), null);
|
||||
String errString = new String(err.toByteArray());
|
||||
String[] errBlocks = errString.split("----------");
|
||||
String reg = "(^[a-z_0-9\\.]+)\\.";
|
||||
Pattern pattern = Pattern.compile(reg);
|
||||
for (String errBlock : errBlocks) {
|
||||
String[] lines = errBlock.trim().replaceAll("\r", "").split("\n");
|
||||
if (lines.length == 4) {
|
||||
if (lines[3].endsWith("cannot be resolved to a type") || lines[3].endsWith("cannot be resolved")) {
|
||||
int markerPos = lines[2].indexOf('^');
|
||||
Matcher m = pattern.matcher(lines[1].substring(markerPos));
|
||||
if (m.find()) {
|
||||
if (m.groupCount() == 1 && m.group(1).indexOf('.') > 0) {
|
||||
imports.add(m.group(1) + ";resolution:=optional");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
out.close();
|
||||
err.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return imports;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2018 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.designer.core.generic.service;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.talend.commons.utils.VersionUtils;
|
||||
import org.talend.components.api.properties.ComponentProperties;
|
||||
import org.talend.components.api.properties.ComponentReferenceProperties;
|
||||
import org.talend.core.CorePlugin;
|
||||
import org.talend.core.context.Context;
|
||||
import org.talend.core.context.RepositoryContext;
|
||||
import org.talend.core.model.components.ComponentCategory;
|
||||
import org.talend.core.model.components.IComponent;
|
||||
import org.talend.core.model.properties.PropertiesFactory;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.ui.component.ComponentsFactoryProvider;
|
||||
import org.talend.designer.core.ui.editor.nodes.Node;
|
||||
import org.talend.designer.core.ui.editor.process.Process;
|
||||
|
||||
/**
|
||||
* DOC hwang class global comment. Detailled comment
|
||||
*/
|
||||
public class GenericServiceTest {
|
||||
|
||||
@Test
|
||||
public void testResetReferenceValue() {
|
||||
GenericService service = new GenericService();
|
||||
//---first
|
||||
String oldConnectionName = "joblet3_1";
|
||||
String newConnectionName = "joblet1_1_joblet2_1_joblet3_1";
|
||||
|
||||
IComponent component = ComponentsFactoryProvider.getInstance().get("tJDBCInput",
|
||||
ComponentCategory.CATEGORY_4_DI.getName());
|
||||
Property property = PropertiesFactory.eINSTANCE.createProperty();
|
||||
property.setAuthor(((RepositoryContext) CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY)).getUser());
|
||||
property.setVersion(VersionUtils.DEFAULT_VERSION);
|
||||
Process process = new Process(property);
|
||||
Node node = new Node(component, process);
|
||||
|
||||
ComponentProperties pros = node.getComponentProperties();
|
||||
ComponentReferenceProperties comPro = (ComponentReferenceProperties) pros.getProperties("referencedComponent"); //$NON-NLS-1$
|
||||
comPro.componentInstanceId.setValue("joblet3_1_joblet4_1_joblet5_1_tJDBCConnection_1");
|
||||
|
||||
service.resetReferenceValue(node, oldConnectionName, newConnectionName);
|
||||
assertTrue(comPro.componentInstanceId.getStoredValue().equals("joblet1_1_joblet2_1_joblet3_1_joblet4_1_joblet5_1_tJDBCConnection_1"));
|
||||
//---second
|
||||
oldConnectionName = "tJDBCConnection_1";
|
||||
newConnectionName = "joblet1_1_joblet2_1_tJDBCConnection_1";
|
||||
comPro.componentInstanceId.setValue("tJDBCConnection_1_joblet4_1_joblet5_1_tJDBCConnection_1");
|
||||
service.resetReferenceValue(node, oldConnectionName, newConnectionName);
|
||||
assertTrue(comPro.componentInstanceId.getStoredValue().equals("joblet1_1_joblet2_1_tJDBCConnection_1_joblet4_1_joblet5_1_tJDBCConnection_1"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2018 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.designer.core.model.process;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.talend.core.model.components.ComponentCategory;
|
||||
import org.talend.core.model.components.IComponent;
|
||||
import org.talend.core.model.process.EConnectionType;
|
||||
import org.talend.core.model.process.IConnection;
|
||||
import org.talend.core.model.process.INode;
|
||||
import org.talend.core.ui.component.ComponentsFactoryProvider;
|
||||
|
||||
/**
|
||||
* DOC jding class global comment. Detailled comment
|
||||
*/
|
||||
public class DataNodeTest {
|
||||
|
||||
private static final String TEST_COMPONENT_NAME = "tMysqlInput";
|
||||
|
||||
private DataNode mainStartNode;
|
||||
|
||||
private DataNode lookupNode;
|
||||
|
||||
private DataNode tmapNode;
|
||||
|
||||
private DataNode logRowNode;
|
||||
|
||||
@Before
|
||||
public void before() {
|
||||
IComponent testComponent = ComponentsFactoryProvider.getInstance().get(TEST_COMPONENT_NAME,
|
||||
ComponentCategory.CATEGORY_4_DI.getName());
|
||||
IComponent tmapComponent = ComponentsFactoryProvider.getInstance().get("tMap", ComponentCategory.CATEGORY_4_DI.getName());
|
||||
IComponent logrowComponent = ComponentsFactoryProvider.getInstance().get("tLogRow",
|
||||
ComponentCategory.CATEGORY_4_DI.getName());
|
||||
mainStartNode = new DataNode(testComponent, TEST_COMPONENT_NAME + "_1");
|
||||
lookupNode = new DataNode(testComponent, TEST_COMPONENT_NAME + "_2");
|
||||
tmapNode = new DataNode(tmapComponent, "tMap_1");
|
||||
logRowNode = new DataNode(logrowComponent, "tLogRow_1");
|
||||
|
||||
// mainStartNode income mainStartNode->tmapNode (main row)
|
||||
((List<IConnection>) mainStartNode.getOutgoingConnections())
|
||||
.add(createDataConnection(mainStartNode, tmapNode, EConnectionType.FLOW_MAIN));
|
||||
// lookupNode outcome lookupNode->tmapNode (lookup row)
|
||||
((List<IConnection>) lookupNode.getOutgoingConnections())
|
||||
.add(createDataConnection(lookupNode, tmapNode, EConnectionType.FLOW_REF));
|
||||
((List<IConnection>) lookupNode.getIncomingConnections())
|
||||
.add(createDataConnection(mainStartNode, lookupNode, EConnectionType.RUN_AFTER));
|
||||
// tmapNode income mainStartNode->tmapNode (main row) lookupNode->tmapNode (lookup row)
|
||||
((List<IConnection>) tmapNode.getIncomingConnections())
|
||||
.add(createDataConnection(mainStartNode, tmapNode, EConnectionType.FLOW_MAIN));
|
||||
((List<IConnection>) tmapNode.getIncomingConnections())
|
||||
.add(createDataConnection(lookupNode, tmapNode, EConnectionType.FLOW_REF));
|
||||
// tmapNode outcome tmapNode->logRowNode (main row)
|
||||
((List<IConnection>) tmapNode.getOutgoingConnections())
|
||||
.add(createDataConnection(tmapNode, logRowNode, EConnectionType.FLOW_MAIN));
|
||||
// logRowNode income tmapNode->logRowNode (main row)
|
||||
((List<IConnection>) logRowNode.getIncomingConnections())
|
||||
.add(createDataConnection(tmapNode, logRowNode, EConnectionType.FLOW_MAIN));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetSubProcessStartNode() {
|
||||
INode startOftmap = tmapNode.getSubProcessStartNode(false);
|
||||
Assert.assertEquals(startOftmap, mainStartNode);
|
||||
INode startOflogrow = logRowNode.getSubProcessStartNode(false);
|
||||
Assert.assertEquals(startOflogrow, mainStartNode);
|
||||
INode startOflookup = lookupNode.getSubProcessStartNode(false);
|
||||
Assert.assertEquals(startOflookup, mainStartNode);
|
||||
}
|
||||
|
||||
@After
|
||||
public void after() {
|
||||
mainStartNode = null;
|
||||
lookupNode = null;
|
||||
tmapNode = null;
|
||||
logRowNode = null;
|
||||
}
|
||||
|
||||
private DataConnection createDataConnection(DataNode source, DataNode target, EConnectionType lineStyle) {
|
||||
DataConnection dataConnec = new DataConnection();
|
||||
dataConnec.setActivate(true);
|
||||
dataConnec.setLineStyle(EConnectionType.FLOW_MAIN);
|
||||
dataConnec.setConnectorName("FLOW");
|
||||
dataConnec.setName("row_" + source.getUniqueName());
|
||||
dataConnec.setSource(source);
|
||||
dataConnec.setTarget(target);
|
||||
return dataConnec;
|
||||
}
|
||||
|
||||
}
|
||||
Binary file not shown.
@@ -234,6 +234,8 @@ public class BuildJobHandlerTest {
|
||||
|
||||
Properties jobInfoProp = new Properties();
|
||||
jobInfoProp.load(jobInfoStream);
|
||||
jobInfoStream.close();
|
||||
|
||||
assertEquals(property.getId(), jobInfoProp.getProperty("jobId"));
|
||||
assertEquals(jobName, jobInfoProp.getProperty("job"));
|
||||
assertEquals(jobVersion, jobInfoProp.getProperty("jobVersion"));
|
||||
@@ -245,6 +247,14 @@ public class BuildJobHandlerTest {
|
||||
|
||||
ZipEntry libEntry = zip.getEntry("lib");
|
||||
assertNotNull("No lib folder", libEntry);
|
||||
if (jobItem == jobWithChildrenItem) {
|
||||
String dependencyFromParent = "commons-lang-2.5.jar";
|
||||
ZipEntry dependencyEntry = zip.getEntry("lib/" + dependencyFromParent);
|
||||
assertNotNull("No parent job dependency in lib folder", dependencyEntry);
|
||||
String dependencyFromChild = "commons-lang-2.6.jar";
|
||||
dependencyEntry = zip.getEntry("lib/" + dependencyFromChild);
|
||||
assertNotNull("No child job dependency in lib folder", dependencyEntry);
|
||||
}
|
||||
if (jobItem == jobWithJobletItem) {
|
||||
String dependencyFromJoblet = "commons-beanutils-1.9.2.jar";
|
||||
ZipEntry dependencyEntry = zip.getEntry("lib/" + dependencyFromJoblet);
|
||||
|
||||
Reference in New Issue
Block a user