Compare commits

...

104 Commits

Author SHA1 Message Date
jding-tlnd
20bc8abd33 Merge remote-tracking branch 'origin/maintenance/8.0' into jding/TUP-35523_test 2022-08-29 20:00:52 +08:00
bhe-talendbj
3c2ccf0f38 feat(TUP-35886): add new method to rename tck component name (#5436)
* feat(TUP-35886): add new method to rename tck component name

* feat(TUP-35886): add junit

* feat(TUP-35886): add junit

* feat(TUP-35886): refactor name

* feat(TUP-35886): fix junit

* feat(TUP-35886): fix junit

* feat(TUP-35886): refactor and update doc
2022-08-29 17:45:27 +08:00
jding-tlnd
22960dae1d feat(TUP-35523):SSO pendo tracking
https://jira.talendforge.org/browse/TUP-35523
2022-08-29 16:23:35 +08:00
jding-tlnd
1b07c3c71d feat(TUP-35523):SSO pendo tracking
https://jira.talendforge.org/browse/TUP-35523
2022-08-29 16:20:04 +08:00
jding-tlnd
dce6c39cf0 Merge remote-tracking branch 'origin/kjwang/Feat_TUP-32606_Support_SSO_on_Studio' into jding/TUP-35523_SSO_pendo_tracking 2022-08-29 15:31:19 +08:00
kjwang-talend
9ef805a02b Merge remote-tracking branch 'origin/maintenance/8.0' into kjwang/Feat_TUP-32606_Support_SSO_on_Studio 2022-08-29 09:45:43 +08:00
Jane Ding
48905f03a9 feat(TUP-35712):Track item signature with Pendo (#5499)
* feat(TUP-35712):Track item signature with Pendo
https://jira.talendforge.org/browse/TUP-35712

* feat(TUP-35712):Track item signature with Pendo
https://jira.talendforge.org/browse/TUP-35712

* feat(TUP-35712):Track item signature with Pendo
https://jira.talendforge.org/browse/TUP-35712

* feat(TUP-35712):Track item signature with Pendo
https://jira.talendforge.org/browse/TUP-35712

* feat(TUP-35712):Track item signature with Pendo
https://jira.talendforge.org/browse/TUP-35712

* feat(TUP-35712):Track item signature with Pendo
https://jira.talendforge.org/browse/TUP-35712

* feat(TUP-35712):Track item signature with Pendo
https://jira.talendforge.org/browse/TUP-35712

* feat(TUP-35712):Track item signature with Pendo
https://jira.talendforge.org/browse/TUP-35712

* feat(TUP-35712):Track item signature with Pendo
https://jira.talendforge.org/browse/TUP-35712

* feat(TUP-35712):Track item signature with Pendo
https://jira.talendforge.org/browse/TUP-35712

* feat(TUP-35712):Track item signature with Pendo
https://jira.talendforge.org/browse/TUP-35712

* feat(TUP-35712):Track item signature with Pendo
https://jira.talendforge.org/browse/TUP-35712

* feat(TUP-35712):Track item signature with Pendo
https://jira.talendforge.org/browse/TUP-35712

* feat(TUP-35712):Track item signature with Pendo
https://jira.talendforge.org/browse/TUP-35712

* feat(TUP-35712):Track item signature with Pendo
https://jira.talendforge.org/browse/TUP-35712

* feat(TUP-35712):Track item signature with Pendo
https://jira.talendforge.org/browse/TUP-35712

* feat(TUP-35712):Track item signature with Pendo
https://jira.talendforge.org/browse/TUP-35712
2022-08-29 09:35:15 +08:00
sbieliaievl
c88e5002b3 Route and data services features versions behave differently in Talend Runtime (#5531)
* fix(APPINT-34581) - added try take cloud version

* fix(APPINT-34581) - removed version hardcode

* fix(APPINT-34581) - added version for features

* fix(APPINT-34962) - added bundle version to feature

* fix(APPINT-34581)
2022-08-26 11:27:13 +03:00
kjwang-talend
31b68cfdc7 temp commit 2022-08-19 20:53:01 +08:00
jding-tlnd
6681d6da80 feat(TUP-35523):SSO pendo tracking
https://jira.talendforge.org/browse/TUP-35523
2022-08-19 18:16:29 +08:00
AlixMetivier
af3ca0c30d Revert "feat(TBD-13810): add dynamic schema on thdfsinputformat components (#5442)" (#5544)
This reverts commit a5df51204e.
2022-08-17 17:15:55 +02:00
kjwang-talend
f18d8d6873 temp commit 2022-08-17 18:48:14 +08:00
kjwang-talend
f6925636a6 temp commit 2022-08-17 11:47:29 +08:00
kjwang-talend
7b800907cd temp commit 2022-08-16 11:37:31 +08:00
kjwang-talend
9c6e1c01df temp commit 2022-08-15 18:34:31 +08:00
kjwang-talend
8e886ba263 temp commit 2022-08-12 19:18:41 +08:00
kjwang-talend
65edd66fa4 temp commit 2022-08-12 17:38:31 +08:00
kjwang-talend
702834f478 Merge remote-tracking branch 'origin/maintenance/8.0' into kjwang/Feat_TUP-32606_Support_SSO_on_Studio 2022-08-11 18:59:37 +08:00
jiezhang-tlnd
dc687f1a50 Revert "feat(TUP-35808)Generate module name from maven url (#5425)" (#5536)
This reverts commit 4c0b9c6f91.
2022-08-11 15:03:30 +08:00
kjwang-talend
de883a38a8 temp commit 2022-08-10 18:56:00 +08:00
kjwang-talend
1631720240 temp commit 2022-08-10 12:00:14 +08:00
kjwang-talend
f274a32038 Merge remote-tracking branch 'origin/maintenance/8.0' into kjwang/Feat_TUP-32606_Support_SSO_on_Studio 2022-08-10 11:47:22 +08:00
kjwang-talend
a2174d727d temp commit 2022-08-10 11:42:15 +08:00
hzhao-talendbj
14a610a72b fix(TUP-36341): Unable to run DQ reports with subjob+joblet on a cloud (#5517)
* fix(TUP-36341): Unable to run DQ reports with subjob+joblet on a cloud

* fix(TUP-36341): Unable to run DQ reports with subjob+joblet on a cloud

* (TUP-36341): Unable to run DQ reports with subjob+joblet on a cloud
2022-08-09 16:21:30 +08:00
zyuan-talend
153a831b0b fix(TUP-35909):add missed context items for demo. (#5518) 2022-08-09 11:12:08 +08:00
hcyi
2bcc470833 fix(TUP-36012):CVE:com.h2database:h2:2.1.210 (#5454) 2022-08-09 11:00:19 +08:00
kjwang-talend
c6b96daf93 Merge remote-tracking branch 'origin/maintenance/8.0' into kjwang/Feat_TUP-32606_Support_SSO_on_Studio 2022-08-09 09:27:24 +08:00
ypiel
88d10b08ec Chore: bump tck 1.47.0 on maintenance 8.0 (#5491)
* bump to component-runtime 1.47.1

Co-authored-by: Emmanuel GALLOIS <egallois@talend.com>
2022-08-08 13:42:28 +02:00
kjwang-talend
6458c668c0 temp commit 2022-08-08 18:23:47 +08:00
jiezhang-tlnd
5687315bd2 fix(TUP-36127)Upgrade commons-configuration to 2.8.0 (#5514)
* fix(TUP-36127)Upgrade commons-configuration to 2.8.0

* exclude commons-configuration2

* chore(TUP-36127) exclude commons-configuration2

* add dependency commons-text
2022-08-08 14:09:34 +08:00
wang wei
7cfce8de2a fix(TDI-48203): fix for microservice case (#5526) 2022-08-05 15:05:42 +08:00
Jane Ding
da7f173be2 feat(TUP-35644):tMap - possible simplified metrics to send to Pendo (#5524)
https://jira.talendforge.org/browse/TUP-35644
2022-08-05 10:08:26 +08:00
kjwang-talend
af088f8b77 temp commit 2022-08-04 20:07:44 +08:00
jiezhang-tlnd
f5a6347377 Add localized files (#5520) (#5523)
Co-authored-by: jenkins-git <jenkins-git@talend.com>

Co-authored-by: Alexiane Yvonet <ayvonet@talend.com>
Co-authored-by: jenkins-git <jenkins-git@talend.com>
2022-08-04 17:17:37 +08:00
kjwang-talend
908397e237 temp commit 2022-08-04 16:27:03 +08:00
kjwang-talend
84ab54e3bc temp commit 2022-08-03 19:17:27 +08:00
kjwang-talend
bd325c25ca temp commit 2022-08-03 17:54:05 +08:00
kjwang-talend
83424e0bfe Merge remote-tracking branch 'origin/maintenance/8.0' into kjwang/Feat_TUP-32606_Support_SSO_on_Studio 2022-08-03 12:03:26 +08:00
kjwang-talend
35b76480d2 temp commit 2022-08-03 12:01:32 +08:00
Zhiwei Xue
e7ba1d5016 fix(TUP-36175):align bcprov-jdk15on to 1.70 (#5461) 2022-08-02 10:23:42 +08:00
zyuan-talend
ba1ee02e4e Add localized files (#5507)
* Add localized files (#5505)

Co-authored-by: jenkins-git <jenkins-git@talend.com>

* Add localized files (#5506)

Co-authored-by: jenkins-git <jenkins-git@talend.com>

Co-authored-by: jzhangbj <jzhang@talend.com>
Co-authored-by: jenkins-git <jenkins-git@talend.com>
Co-authored-by: tsasada-talend <51699524+tsasada-talend@users.noreply.github.com>
2022-07-29 15:51:09 +08:00
Samuel ANTOINE
a5df51204e feat(TBD-13810): add dynamic schema on thdfsinputformat components (#5442)
* feat(TBD-13810): add dynamic schema on thdfsinputformat components
2022-07-29 07:26:46 +02:00
kjwang-talend
2334fe101d Temp commit 2022-07-28 18:21:24 +08:00
kjwang
dfe132d87e TUP-36242 jobs changing Hadoop metadata distribution after changing (#5484)
TUP-36242 jobs changing Hadoop metadata distribution after changing project/branch
https://jira.talendforge.org/browse/TUP-36242
2022-07-28 16:03:38 +08:00
jiezhang-tlnd
4c0b9c6f91 feat(TUP-35808)Generate module name from maven url (#5425)
* feat(TUP-35808)Generate module name from maven url

* handle for component and plugin.xml

* handle for component

* move to moduleNeeded.java

* format code

* feat(TUP-35808)Generate module name from maven url

* feat(TUP-35808)Generate module name from maven url

* add junits

* feat(TUP-35808)Generate module name from maven url

* add warning for incorrect module name

* add warning log for module name

* Use MODULE (name in plugin.xml) to build MVN_URI

* handle log

* handle mssql metedata
2022-07-27 18:38:21 +08:00
sbliu
16b6699cc9 feat(TUP-29393) replace nexus connection timeout with default connection timeout (#5475) 2022-07-27 17:42:01 +08:00
kjwang-talend
d0620ccc8c temp commit 2022-07-27 15:54:34 +08:00
jiezhang-tlnd
3f57a592d1 fix(TUP-35446)CVE: org.apache.maven:maven-core:3.8.3 (#5446) 2022-07-27 11:25:19 +08:00
wang wei
74bc5ee66f fix(TDI-48203): [CVE]: routines.system.JSONObject(Object bean) use reflect to call method invoke, that's dangerous for evil script inject (#5426) 2022-07-27 09:29:03 +08:00
sbliu
6a0c96627f fix(TUP-36252) fix NPE for tos studio build job (#5482) 2022-07-26 14:25:12 +08:00
kjwang-talend
7b48310e61 Merge remote-tracking branch 'origin/maintenance/8.0' into kjwang/Feat_TUP-32606_Support_SSO_on_Studio 2022-07-25 16:25:44 +08:00
sbliu
ecf339a6ca chore(TUP-35865) upgrade wstx-asl-3.2.9.jar with wstx-core-asl-4.4.1 and stax2-api-4.2.1 (#5438) 2022-07-22 17:28:02 +08:00
Zhiwei Xue
dc5c3d0ec9 fix(TUP-18979):fix junit failure (#5492) 2022-07-22 16:15:34 +08:00
Jane Ding
503924aa75 Jding/add localized files 2022 07 21 (#5488)
* Add localized files (#5486)

Co-authored-by: jenkins-git <jenkins-git@talend.com>

* Add localized files (#5487)

Co-authored-by: jenkins-git <jenkins-git@talend.com>

Co-authored-by: Alexiane Yvonet <ayvonet@talend.com>
Co-authored-by: jenkins-git <jenkins-git@talend.com>
Co-authored-by: tsasada-talend <51699524+tsasada-talend@users.noreply.github.com>
2022-07-21 17:43:39 +08:00
hzhao-talendbj
4ed461840a fix jackson cve (#5480) 2022-07-19 20:37:51 +08:00
hzhao-talendbj
cafa72f52a Revert "chore(TUP-35265): upgrade 'crypto-utils' jar in low level (#5372)" (#5476)
This reverts commit aed39722eb.
2022-07-19 16:25:28 +08:00
pyzhou
af62f01007 fix(TDI-48024): ResumeUtil performance issue (#5458)
* fix(TDI-48024): ResumeUtil performance issue

* NPE
2022-07-19 12:01:41 +08:00
zyuan-talend
5e4b9311a9 fix(TUP-36231,TUP31721): deploy libs from custom component. (#5468) (#5473) 2022-07-19 10:07:24 +08:00
Zhiwei Xue
a6164bf006 fix(TUP-18979):fix sync mapping file error of job project (#5470) 2022-07-18 16:55:14 +08:00
sbliu
24622068ec chore(TUP-35863) remove lower version of maven-settings (#5419)
* chore(TUP-35863) remove lower version of maven-settings
2022-07-18 09:44:36 +08:00
kjwang-talend
72092ab66d temp commit 2022-06-15 18:51:14 +08:00
kjwang-talend
306d98aaae Merge remote-tracking branch 'origin/maintenance/8.0' into kjwang/Feat_TUP-32606_Support_SSO_on_Studio 2022-06-14 18:26:01 +08:00
kjwang-talend
8201c7818f Fix continue session issue 2022-06-14 17:55:20 +08:00
kjwang-talend
da623b1b42 Merge remote-tracking branch 'origin/maintenance/8.0' into kjwang/Feat_TUP-32606_Support_SSO_on_Studio 2022-06-11 18:52:15 +08:00
kjwang-talend
284a837d19 temp commit 2022-06-11 18:24:06 +08:00
kjwang-talend
81788c0666 temp commit 2022-06-11 16:21:29 +08:00
kjwang-talend
33ce610109 temp commit 2022-06-09 18:26:37 +08:00
kjwang-talend
b1fa13b7b7 temp commit 2022-06-08 19:01:41 +08:00
kjwang-talend
18c71f042a temp commit 2022-06-08 18:28:18 +08:00
kjwang-talend
5c33ff4e61 Merge remote-tracking branch 'origin/maintenance/8.0' into kjwang/Feat_TUP-32606_Support_SSO_on_Studio 2022-06-08 11:19:07 +08:00
kjwang-talend
8467406a05 temp commit 2022-06-07 19:05:27 +08:00
kjwang-talend
c2edc2c5fd temp commit 2 2022-05-28 11:47:41 +08:00
kjwang-talend
a5cc37c009 temp commit 2 2022-05-27 19:00:38 +08:00
kjwang-talend
f1ca94b489 temp commit 2 2022-05-27 18:33:48 +08:00
kjwang-talend
2ef9302aee temp commit 2 2022-05-27 17:50:37 +08:00
kjwang-talend
49915c6988 temp commit2 2022-05-27 17:02:19 +08:00
kjwang-talend
2bc89a95a2 temp commit 2 2022-05-27 17:01:58 +08:00
kjwang-talend
17f0b91204 temp commit 2022-05-27 11:43:42 +08:00
kjwang-talend
d4cad98307 temp commit 2022-05-26 11:41:34 +08:00
kjwang-talend
e632add200 temp commit 2022-05-26 10:32:02 +08:00
kjwang-talend
55ba970aa5 temp commit 2022-05-25 18:53:45 +08:00
kjwang-talend
f0a2b8c5a9 temp commit 2022-05-25 16:22:56 +08:00
kjwang-talend
55cf8b822a temp commit 2022-05-25 11:50:00 +08:00
kjwang-talend
ace4c7ae1a temp commit 2022-05-23 19:21:50 +08:00
kjwang-talend
55c1e5705d temp commit 2022-05-20 19:24:13 +08:00
kjwang-talend
938ed7d657 temp commit 2022-05-20 12:04:32 +08:00
kjwang-talend
ae64cbd608 Merge remote-tracking branch 'origin/maintenance/8.0' into kjwang/Feat_TUP-32606_Support_SSO_on_Studio 2022-05-19 18:36:53 +08:00
kjwang-talend
27f4d567ba temp commit 2022-05-19 17:36:48 +08:00
kjwang-talend
96653db1db temp commit 2022-05-19 17:18:48 +08:00
kjwang-talend
2f574219aa temp commit 2022-05-19 15:52:06 +08:00
kjwang-talend
156c93fd6d temp commit 2022-05-19 10:14:03 +08:00
kjwang-talend
4c29d7366e List project 2022-05-18 18:17:40 +08:00
kjwang-talend
53abd2c9a1 temp commit 2022-05-17 22:42:26 +08:00
kjwang-talend
245df26f6f Merge remote-tracking branch 'origin/maintenance/8.0' into kjwang/Feat_TUP-32606_Support_SSO_on_Studio 2022-05-17 21:17:16 +08:00
kjwang-talend
86615e45f4 temp commit 2022-05-17 20:09:41 +08:00
kjwang-talend
13fb3878d0 temp commit 2022-05-17 19:52:57 +08:00
kjwang-talend
135f60ddcf temp commit 2022-05-17 19:50:39 +08:00
kjwang-talend
f40e0fe89f Merge remote-tracking branch 'origin/maintenance/8.0' into kjwang/Feat_TUP-32606_Support_SSO_on_Studio 2022-05-13 09:20:20 +08:00
kjwang-talend
ea59b0dd7d Merge remote-tracking branch 'origin/maintenance/8.0' into kjwang/Feat_TUP-32606_Support_SSO_on_Studio 2022-05-12 19:08:58 +08:00
kjwang-talend
70705d3d4b Merge remote-tracking branch 'origin/maintenance/8.0' into kjwang/Feat_TUP-32606_Support_SSO_on_Studio 2022-05-11 18:07:25 +08:00
kjwang-talend
25e2c4011d Merge remote-tracking branch 'origin/maintenance/8.0' into kjwang/Feat_TUP-32606_Support_SSO_on_Studio 2022-05-10 09:35:26 +08:00
kjwang-talend
588901b430 temp commit 2022-05-09 19:24:06 +08:00
kjwang-talend
7cadac34f1 Merge remote-tracking branch 'origin/maintenance/8.0' into kjwang/Feat_TUP-32606_Support_SSO_on_Studio 2022-05-07 10:07:43 +08:00
kjwang-talend
ef62f63353 Temp commit 2022-05-05 15:11:08 +08:00
99 changed files with 3670 additions and 308 deletions

View File

@@ -5,7 +5,7 @@
<copyright url="http://www.example.com/copyright">[Enter Copyright Description here.]</copyright>
<license url="http://www.example.com/license">[Enter License Description here.]</license>
<requires>
<import plugin="org.bouncycastle.bcprov" version="1.69.0" match="greaterOrEqual"/>
<import plugin="org.bouncycastle.bcprov" version="1.70.0" match="greaterOrEqual"/>
<import plugin="com.cedarsoftware.json-io" version="0.0.0" match="greaterOrEqual"/>
<import plugin="com.fasterxml.jackson.core.jackson-annotations" version="2.9.0" match="greaterOrEqual"/>
<import plugin="com.fasterxml.jackson.core.jackson-core" version="2.9.8" match="greaterOrEqual"/>

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 B

View File

@@ -151,7 +151,9 @@ public enum EImage implements IImage {
OPEN_DATA_PREP("/icons/favicon.png"),
CHESS_GRAY("/icons/gray.gif"); //$NON-NLS-1$
CHESS_GRAY("/icons/gray.gif"), //$NON-NLS-1$
MANAGE_CONNECTION("/icons/manage_connection.gif");
private String path;

View File

@@ -55,6 +55,11 @@ public class NetworkUtil {
private static final int DEFAULT_NEXUS_TIMEOUT = 20000;// same as preference value
public static final String ORG_TALEND_DESIGNER_CORE = "org.talend.designer.core"; //$NON-NLS-1$
/*
* see ITalendCorePrefConstants.PERFORMANCE_TAC_READ_TIMEOUT
*/
private static final String PERFORMANCE_TAC_READ_TIMEOUT = "PERFORMANCE_TAC_READ_TIMEOUT"; //$NON-NLS-1$
private static final String PROP_DISABLEDSCHEMES_USE_DEFAULT = "talend.studio.jdk.http.auth.tunneling.disabledSchemes.useDefault";
@@ -149,10 +154,10 @@ public class NetworkUtil {
}
public static int getNexusTimeout() {
int timeout = DEFAULT_NEXUS_TIMEOUT;
int timeout = Integer.getInteger("nexus.timeout.min", DEFAULT_NEXUS_TIMEOUT);
try {
IEclipsePreferences node = InstanceScope.INSTANCE.getNode(ORG_TALEND_DESIGNER_CORE);
timeout = node.getInt(ITalendNexusPrefConstants.NEXUS_TIMEOUT, DEFAULT_NEXUS_TIMEOUT);
timeout = Math.max(timeout, node.getInt(PERFORMANCE_TAC_READ_TIMEOUT, 0) * 1000);
} catch (Throwable e) {
ExceptionHandler.process(e);
}

View File

@@ -0,0 +1,280 @@
// ============================================================================
//
// Copyright (C) 2006-2022 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.core.repository.model;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Level;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.core.ICoreService;
import org.talend.core.PluginChecker;
import org.talend.core.model.properties.Property;
import org.talend.core.model.properties.RoutineItem;
import org.talend.core.model.properties.SQLPatternItem;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.model.repository.IRepositoryViewObject;
import org.talend.core.pendo.PendoItemSignatureUtil;
import org.talend.core.pendo.PendoItemSignatureUtil.SignatureStatus;
import org.talend.core.pendo.PendoItemSignatureUtil.TOSProdNameEnum;
import org.talend.core.pendo.PendoItemSignatureUtil.ValueEnum;
import org.talend.core.pendo.PendoTrackDataUtil;
import org.talend.core.pendo.PendoTrackDataUtil.TrackEvent;
import org.talend.core.pendo.PendoTrackSender;
import org.talend.core.pendo.properties.PendoSignLogonProperties;
import org.talend.utils.migration.MigrationTokenUtil;
/**
* DOC jding class global comment. Detailled comment
*/
public class PendoItemSignatureManager {
private PendoSignLogonProperties itemSignProperties = new PendoSignLogonProperties();
private static PendoItemSignatureManager manager;
private static boolean isTrackAvailable;
static {
manager = new PendoItemSignatureManager();
try {
isTrackAvailable = PluginChecker.isTIS() && PendoTrackSender.getInstance().isTrackSendAvailable();
} catch (Exception e) {
ExceptionHandler.process(e, Level.WARN);
}
}
private PendoItemSignatureManager() {
}
public static PendoItemSignatureManager getInstance() {
return manager;
}
private Set<String> signByLoginMigrationItems = new HashSet<String>();
public void countItemSignByMigration(String file) {
if (!isTrackAvailable) {
return;
}
if (!ProxyRepositoryFactory.getInstance().isFullLogonFinished()) {
signByLoginMigrationItems.add(file);
}
}
public void collectProperties() {
ICoreService coreService = ICoreService.get();
if (coreService == null || !isTrackAvailable) {
return;
}
try {
itemSignProperties.setSignByMigration(signByLoginMigrationItems.size());
String seperator = "@";
Map<String, Integer> tosUnsignItemMap = new HashMap<String, Integer>();
Map<String, Integer> invalidItemVersionMap = new HashMap<String, Integer>();
Set<String> checkedItem = new HashSet<String>();
ProxyRepositoryFactory proxyRepositoryFactory = ProxyRepositoryFactory.getInstance();
ERepositoryObjectType[] types = (ERepositoryObjectType[]) ERepositoryObjectType.values();
for (ERepositoryObjectType type : types) {
List<IRepositoryViewObject> allObjectList = proxyRepositoryFactory.getAll(type);
for (IRepositoryViewObject repositoryObject : allObjectList) {
Property property = repositoryObject.getProperty();
if (property == null || property.eResource() == null) {
continue;
}
String itemKey = repositoryObject.getRepositoryObjectType() + seperator + property.getId() + seperator
+ property.getVersion();
if (isBuiltInItem(repositoryObject) || checkedItem.contains(itemKey)) {
continue;
}
checkedItem.add(itemKey);
Integer verifyResult = null;
try {
verifyResult = coreService.getSignatureVerifyResult(property, null, false);
if (verifyResult != null) {
switch (verifyResult) {
case SignatureStatus.V_VALID:
itemSignProperties.setValidItems(itemSignProperties.getValidItems() + 1);
break;
case SignatureStatus.V_UNSIGNED:
String itemProductName = PendoItemSignatureUtil
.getItemProductName(property);
if (StringUtils.isNotBlank(itemProductName)) {
String tosCategory = TOSProdNameEnum.getTOSCategoryByProdName(itemProductName);
if (StringUtils.isBlank(tosCategory)) {
itemSignProperties.setUnsignEEItems(itemSignProperties.getUnsignEEItems() + 1);
} else {
if (tosUnsignItemMap.get(tosCategory) == null) {
tosUnsignItemMap.put(tosCategory, 0);
}
tosUnsignItemMap.put(tosCategory, tosUnsignItemMap.get(tosCategory) + 1);
}
}
addInvalidItemVersion(property, invalidItemVersionMap);
break;
default:
addInvalidItemVersion(property, invalidItemVersionMap);
itemSignProperties.setInvalidSignItems(itemSignProperties.getInvalidSignItems() + 1);
}
}
} catch (Exception e) {
ExceptionHandler.process(e, Level.WARN);
if (verifyResult == null) {
// exception during verify
addInvalidItemVersion(property, invalidItemVersionMap);
itemSignProperties.setInvalidSignItems(itemSignProperties.getInvalidSignItems() + 1);
}
}
}
}
itemSignProperties.setInvalidItemSourceVersion(getSortInvalidItems(invalidItemVersionMap));
itemSignProperties.setUnsignSEItems(getSortTOSUnsignItems(tosUnsignItemMap));
itemSignProperties.setStudioVersion(PendoItemSignatureUtil.getStudioVersion());
if (coreService.isInValidGP()) {
itemSignProperties.setGracePeriod(ValueEnum.YES.getDisplayValue());
} else {
itemSignProperties.setGracePeriod(ValueEnum.NO.getDisplayValue());
}
String prodDate = PendoItemSignatureUtil.formatDate(System.getProperty(PendoItemSignatureUtil.PROD_DATE_ID),
"yyyy-MM-dd");
itemSignProperties.setInstallDate(prodDate);
String projectCreateDate = PendoItemSignatureUtil.getCurrentProjectCreateDate();
itemSignProperties.setProjectCreateDate(PendoItemSignatureUtil.formatDate(projectCreateDate, "yyyy-MM-dd"));
String value = System.getProperty(PendoItemSignatureUtil.MIGRATION_TOKEN_KEY);
Map<String, Date> tokenTime = MigrationTokenUtil.getMigrationTokenTime(value);
if (tokenTime == null || tokenTime.isEmpty()) {
itemSignProperties.setValidMigrationToken(ValueEnum.NOT_APPLICATE.getDisplayValue());
} else {
String customer = coreService.getLicenseCustomer();
Date tokenDate = tokenTime.get(customer);
Date currentDate = new Date();
if (tokenDate != null && tokenDate.after(currentDate)) {
itemSignProperties.setValidMigrationToken(ValueEnum.YES.getDisplayValue());
} else {
itemSignProperties.setValidMigrationToken(ValueEnum.NO.getDisplayValue());
}
}
} catch (Exception e) {
ExceptionHandler.process(e, Level.WARN);
}
}
private void addInvalidItemVersion(Property property, Map<String, Integer> invalidItemVersionMap) {
String itemProductVersion = PendoItemSignatureUtil.getItemProductVersion(property);
if (StringUtils.isNotBlank(itemProductVersion)) {
if (invalidItemVersionMap.get(itemProductVersion) == null) {
invalidItemVersionMap.put(itemProductVersion, 0);
}
invalidItemVersionMap.put(itemProductVersion, invalidItemVersionMap.get(itemProductVersion) + 1);
}
}
private boolean isBuiltInItem(IRepositoryViewObject repositoryObject) {
if (repositoryObject.getProperty().getItem() instanceof SQLPatternItem) {
SQLPatternItem sqlPatternItem = (SQLPatternItem) repositoryObject.getProperty().getItem();
if (sqlPatternItem.isSystem()) {
return true;
}
}
if (repositoryObject.getProperty().getItem() instanceof RoutineItem) {
RoutineItem routineItem = (RoutineItem) repositoryObject.getProperty().getItem();
if (routineItem.isBuiltIn()) {
return true;
}
}
return false;
}
private String getSortTOSUnsignItems(Map<String, Integer> tosUnsignItemMap) {
List<Map.Entry<String, Integer>> resultMapList = new ArrayList<Map.Entry<String, Integer>>(tosUnsignItemMap.entrySet());
Collections.sort(resultMapList, new Comparator<Map.Entry<String, Integer>>() {
@Override
public int compare(Entry<String, Integer> o1, Entry<String, Integer> o2) {
List<TOSProdNameEnum> categoryList = Arrays.asList(TOSProdNameEnum.values());
TOSProdNameEnum category1 = TOSProdNameEnum.valueOf(o1.getKey());
TOSProdNameEnum category2 = TOSProdNameEnum.valueOf(o2.getKey());
return categoryList.indexOf(category1) - categoryList.indexOf(category2);
}
});
Map<String, Integer> tosUnsignMap = new LinkedHashMap<String, Integer>();
resultMapList.forEach(entry -> {
tosUnsignMap.put(entry.getKey(), entry.getValue());
});
return PendoTrackDataUtil.convertEntityJsonString(tosUnsignMap);
}
private String getSortInvalidItems(Map<String, Integer> invalidItemVersionMap) {
List<Map.Entry<String, Integer>> resultMapList = new ArrayList<Map.Entry<String, Integer>>(
invalidItemVersionMap.entrySet());
Collections.sort(resultMapList, new Comparator<Map.Entry<String, Integer>>(){
@Override
public int compare(Entry<String, Integer> o1, Entry<String, Integer> o2) {
return o1.getKey().compareTo(o2.getKey());
}
});
Map<String, Integer> invalidMap = new LinkedHashMap<String, Integer>();
resultMapList.forEach(entry -> {
invalidMap.put(entry.getKey(), entry.getValue());
});
return PendoTrackDataUtil.convertEntityJsonString(invalidMap);
}
public void sendTrackToPendo() {
if (!isTrackAvailable) {
return;
}
Job job = new Job("send pendo track") {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
collectProperties();
PendoTrackSender.getInstance().sendTrackData(TrackEvent.ITEM_SIGNATURE, itemSignProperties);
} catch (Exception e) {
// warning only
ExceptionHandler.process(e, Level.WARN);
}
return Status.OK_STATUS;
}
};
job.setUser(false);
job.setPriority(Job.INTERACTIVE);
job.schedule();
}
}

View File

@@ -93,6 +93,7 @@ import org.talend.core.context.CommandLineContext;
import org.talend.core.context.Context;
import org.talend.core.context.RepositoryContext;
import org.talend.core.exception.TalendInternalPersistenceException;
import org.talend.core.hadoop.BigDataBasicUtil;
import org.talend.core.hadoop.IHadoopDistributionService;
import org.talend.core.model.components.IComponentsService;
import org.talend.core.model.general.ILibrariesService;
@@ -2209,6 +2210,9 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
ExceptionHandler.process(e);
}
// init dynamic distirbution after `beforeLogon`, before loading libraries.
initDynamicDistribution(monitor);
// need to set m2
LoginTaskRegistryReader loginTaskRegistryReader = new LoginTaskRegistryReader();
ILoginTask[] allLoginTasks = loginTaskRegistryReader.getAllCommandlineTaskListInstance();
@@ -2315,6 +2319,7 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
if (monitor != null && monitor.isCanceled()) {
throw new OperationCanceledException(""); //$NON-NLS-1$
}
PendoItemSignatureManager.getInstance().sendTrackToPendo();
boolean isCommandLineLocalRefProject = false;
CommandLineContext commandLineContext = (CommandLineContext) CoreRuntimePlugin.getInstance().getContext()
@@ -2404,6 +2409,18 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
throw e;
}
}
private void initDynamicDistribution(IProgressMonitor monitor) {
try {
if (BigDataBasicUtil.isDynamicDistributionLoaded(monitor)) {
BigDataBasicUtil.reloadAllDynamicDistributions(monitor);
} else {
BigDataBasicUtil.loadDynamicDistribution(monitor);
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
// to fix the ops4j and m2e.core maven handler conflict issue TUP-31484
private void unregisterM2EServiceBeforeLogon() {

View File

@@ -129,7 +129,8 @@ Require-Bundle: org.eclipse.jdt.core,
jackson-core-asl,
org.talend.libraries.jackson,
org.eclipse.m2e.core,
org.talend.libraries.apache.common
org.talend.libraries.apache.common,
org.talend.signon.util
Bundle-Activator: org.talend.core.runtime.CoreRuntimePlugin
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .,

View File

@@ -31,6 +31,7 @@ import org.talend.core.model.metadata.ColumnNameChanged;
import org.talend.core.model.metadata.IMetadataTable;
import org.talend.core.model.metadata.builder.connection.MetadataTable;
import org.talend.core.model.properties.Item;
import org.talend.core.model.properties.Property;
import org.talend.core.model.repository.IRepositoryViewObject;
import org.talend.core.runtime.process.ITalendProcessJavaProject;
import org.talend.designer.core.model.utils.emf.talendfile.NodeType;
@@ -134,6 +135,12 @@ public interface ICoreService extends IService {
*/
void installComponents(IProgressMonitor monitor);
Integer getSignatureVerifyResult(Property property, IPath resourcePath, boolean considerGP) throws Exception;
String getLicenseCustomer();
boolean isInValidGP();
public static ICoreService get() {
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreService.class)) {
return GlobalServiceRegister.getDefault().getService(ICoreService.class);

View File

@@ -156,6 +156,8 @@ public interface ILibraryManagerService extends IService {
public void clearCache();
public void clearCache(boolean cleanIndex);
public void deployLibsFromCustomComponents();
@Deprecated
public Set<String> list(boolean withComponent, IProgressMonitor... monitorWrap);

View File

@@ -15,8 +15,10 @@ package org.talend.core.context;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.core.model.general.Project;
import org.talend.core.model.properties.User;
import org.talend.core.service.ICloudSignOnService;
/**
* DOC smallet class global comment. Detailled comment <br/>
@@ -139,6 +141,14 @@ public class RepositoryContext {
* @return the clearPassword
*/
public String getClearPassword() {
try {
if (ICloudSignOnService.get() != null && ICloudSignOnService.get().isSignViaCloud()) {
return ICloudSignOnService.get().getLatestToken().getAccessToken();
}
}catch (Exception ex) {
ExceptionHandler.process(ex);
}
return clearPassword;
}

View File

@@ -56,14 +56,14 @@ public enum EDatabaseVersion4Drivers {
HSQLDB_SERVER(new DbVersion4Drivers(EDatabaseTypeName.HSQLDB_SERVER, "hsqldb.jar")), //$NON-NLS-1$
HSQLDB_WEBSERVER(new DbVersion4Drivers(EDatabaseTypeName.HSQLDB_WEBSERVER, "hsqldb.jar")), //$NON-NLS-1$
H2(new DbVersion4Drivers(EDatabaseTypeName.H2, "h2-2.1.210.jar")), //$NON-NLS-1$
H2(new DbVersion4Drivers(EDatabaseTypeName.H2, "h2-2.1.214.jar")), //$NON-NLS-1$
//
JAVADB_EMBEDED(new DbVersion4Drivers(EDatabaseTypeName.JAVADB_EMBEDED, "derby.jar")), //$NON-NLS-1$
SQLITE(new DbVersion4Drivers(EDatabaseTypeName.SQLITE, "sqlitejdbc-v056.jar")), //$NON-NLS-1$
FIREBIRD(new DbVersion4Drivers(EDatabaseTypeName.FIREBIRD, "jaybird-full-2.1.1.jar")), //$NON-NLS-1$
TERADATA(new DbVersion4Drivers(EDatabaseTypeName.TERADATA,
new String[] { "terajdbc4-17.10.00.27.jar" })), //$NON-NLS-1$ //$NON-NLS-2$
new String[] { "terajdbc4-17.10.00.27.jar" })), //$NON-NLS-1$
JAVADB_DERBYCLIENT(new DbVersion4Drivers(EDatabaseTypeName.JAVADB_DERBYCLIENT, "derbyclient.jar")), //$NON-NLS-1$
NETEZZA(new DbVersion4Drivers(EDatabaseTypeName.NETEZZA, "nzjdbc.jar")), //$NON-NLS-1$
INFORMIX(new DbVersion4Drivers(EDatabaseTypeName.INFORMIX, "ifxjdbc.jar")), //$NON-NLS-1$

View File

@@ -17,10 +17,14 @@ import java.util.Iterator;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.core.pendo.PendoTrackSender;
import org.talend.core.runtime.i18n.Messages;
import org.talend.repository.model.RepositoryConstants;
import org.talend.signon.util.TMCRepositoryUtil;
import org.talend.signon.util.TokenMode;
import org.talend.utils.json.JSONException;
import org.talend.utils.json.JSONObject;
@@ -58,12 +62,14 @@ public class ConnectionBean implements Cloneable {
private static final String TOKEN = "token"; //$NON-NLS-1$
private static final String URL = "url"; //$NON-NLS-1$
private static final String STORECREDENTIALS = "storeCredentials"; //$NON-NLS-1$
private String credentials = ""; //$NON-NLS-1$
public static final String CLOUD_TOKEN_ID ="cloud_token"; //$NON-NLS-1$
private static final String LOGIN_VIA_CLOUD = "login_via_cloud"; //$NON-NLS-1$
/**
* DOC smallet ConnectionBean constructor comment.
*/
@@ -89,6 +95,24 @@ public class ConnectionBean implements Cloneable {
newConnection.setPassword(""); //$NON-NLS-1$
return newConnection;
}
public static ConnectionBean getDefaultCloudConnectionBean(String dataCenter) {
ConnectionBean newConnection = new ConnectionBean();
newConnection.setName(Messages.getString("ConnectionBean.Cloud.name", TMCRepositoryUtil.getDisplayNameByDatacenter(dataCenter))); //$NON-NLS-1$
newConnection.setDescription(Messages.getString("ConnectionBean.CloudConnection.description", TMCRepositoryUtil.getDisplayNameByDatacenter(dataCenter))); //$NON-NLS-1$
newConnection.setRepositoryId(TMCRepositoryUtil.getRepositoryId(dataCenter));
newConnection.setToken(true);
newConnection.setStoreCredentials(true);
newConnection.setComplete(true);
newConnection.setLoginViaCloud(true);
newConnection.setWorkSpace(getRecentWorkSpace());
return newConnection;
}
protected static String getRecentWorkSpace() {
String filePath = new Path(Platform.getInstanceLocation().getURL().getPath()).toFile().getPath();
return filePath;
}
/**
* Getter for ID.
@@ -184,11 +208,16 @@ public class ConnectionBean implements Cloneable {
*/
public String getPassword() {
try {
if (conDetails.has(PASSWORD)) {
if (isStoreCredentials() && credentials != null) {
return this.credentials;
}
return conDetails.getString(PASSWORD);
} else if (conDetails.has(CLOUD_TOKEN_ID)){
String object = conDetails.getString(CLOUD_TOKEN_ID);
TokenMode token = TokenMode.parseFromJson(object, null);
return token.getAccessToken();
}
} catch (JSONException e) {
ExceptionHandler.process(e);
@@ -215,10 +244,10 @@ public class ConnectionBean implements Cloneable {
* @return the user
*/
public String getUser() {
try {
try {
if (conDetails.has(USER)) {
String user = conDetails.getString(USER);
if (isToken()) {
if (isToken() && StringUtils.isEmpty(user)) {
String url = getDynamicFields().get(RepositoryConstants.REPOSITORY_URL);
user = PendoTrackSender.getInstance().getTmcUser(url, getPassword());
if (StringUtils.isNotBlank(user)) {
@@ -226,7 +255,7 @@ public class ConnectionBean implements Cloneable {
}
}
return user;
}
}
} catch (JSONException e) {
ExceptionHandler.process(e);
}
@@ -320,6 +349,25 @@ public class ConnectionBean implements Cloneable {
ExceptionHandler.process(e);
}
}
public boolean isLoginViaCloud() {
try {
if (conDetails.has(LOGIN_VIA_CLOUD)) {
return (Boolean) conDetails.get(LOGIN_VIA_CLOUD);
}
} catch (JSONException e) {
// do nothing
}
return false;
}
public void setLoginViaCloud(boolean isLoginViaCloud) {
try {
conDetails.put(LOGIN_VIA_CLOUD, isLoginViaCloud);
} catch (JSONException e) {
// do nothing
}
}
@Override
public ConnectionBean clone() throws CloneNotSupportedException {
@@ -418,14 +466,21 @@ public class ConnectionBean implements Cloneable {
public String getUrl() {
try {
if (conDetails.has(URL)) {
return conDetails.getString(URL);
if (dynamicFields.containsKey(RepositoryConstants.REPOSITORY_URL)) {
return dynamicFields.get(RepositoryConstants.REPOSITORY_URL);
}
if (conDetails.has(RepositoryConstants.REPOSITORY_URL)) {
return conDetails.getString(RepositoryConstants.REPOSITORY_URL);
}
} catch (JSONException e) {
ExceptionHandler.process(e);
}
return "";
}
public void setUrl(String url) {
dynamicFields.put(RepositoryConstants.REPOSITORY_URL, url);
}
public boolean isStoreCredentials() {
try {
@@ -453,4 +508,27 @@ public class ConnectionBean implements Cloneable {
public void setCredentials(String credentials) {
this.credentials = credentials;
}
public TokenMode getConnectionToken() {
try {
if (conDetails.has(CLOUD_TOKEN_ID)) {
String object = conDetails.getString(CLOUD_TOKEN_ID);
return TokenMode.parseFromJson(object, null);
}
} catch (JSONException e) {
ExceptionHandler.process(e);
}
return null;
}
public void setConnectionToken(TokenMode connectionToken) {
try {
conDetails.put(CLOUD_TOKEN_ID, TokenMode.writeToJson(connectionToken));
} catch (JSONException e) {
ExceptionHandler.process(e);
}
}
}

View File

@@ -25,6 +25,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
@@ -515,14 +516,15 @@ public final class MetadataTalendType {
try {
Map<String, File> targetFileMap = Stream.of(arr).collect(Collectors.toMap(File::getName, Function.identity()));
Map<String, File> workingFileMap = getWorkingMappingFiles().stream()
.collect(Collectors.toMap(File::getName, Function.identity()));
.collect(Collectors.toMap(f -> getTargetName(f, rename), Function.identity(), (f1, f2) -> f1));
targetFileMap.entrySet().stream().filter(entry -> !workingFileMap.containsKey(entry.getKey()))
.forEach(entry -> entry.getValue().delete());
for (File workingMappingFile : workingFileMap.values()) {
for (Entry<String, File> entry : workingFileMap.entrySet()) {
String targetName = entry.getKey();
File workingMappingFile = entry.getValue();
boolean needUpdate = false;
String targetName = getTargetName(workingMappingFile, rename);
File targetMappingFile = targetFileMap.get(targetName);
if (targetMappingFile == null) {
targetMappingFile = new File(target, targetName);

View File

@@ -0,0 +1,161 @@
// ============================================================================
//
// Copyright (C) 2006-2022 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.core.pendo;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.apache.commons.lang.StringUtils;
import org.eclipse.emf.common.util.EMap;
import org.talend.commons.utils.VersionUtils;
import org.talend.core.model.general.Project;
import org.talend.core.model.properties.Property;
import org.talend.core.runtime.projectsetting.ProjectPreferenceManager;
import org.talend.core.runtime.util.EmfResourceUtil;
import org.talend.repository.ProjectManager;
import org.talend.utils.security.CryptoMigrationUtil;
import org.talend.utils.security.StudioEncryption;
/**
* DOC jding class global comment. Detailled comment
*/
public class PendoItemSignatureUtil {
public static final String MIGRATION_TOKEN_KEY = "force_import_unsupported_job";
public static final String REPOSITORY_PLUGIN_ID = "org.talend.repository";
public static final String PROJ_DATE_ID = "repository.project.id";
public static final String PROD_DATE_ID = "product.date.id";
public static String getCurrentProjectCreateDate() {
Project currentProject = ProjectManager.getInstance().getCurrentProject();
if (currentProject != null) {
ProjectPreferenceManager projectPrefManager = new ProjectPreferenceManager(
PendoItemSignatureUtil.REPOSITORY_PLUGIN_ID, false);
String projDate = projectPrefManager.getValue(PendoItemSignatureUtil.PROJ_DATE_ID);
if (StringUtils.isNotBlank(projDate)) {
String decrypt = null;
if (StudioEncryption.hasEncryptionSymbol(projDate)) {
decrypt = StudioEncryption.getStudioEncryption(StudioEncryption.EncryptionKeyName.MIGRATION_TOKEN)
.decrypt(projDate);
} else {
decrypt = CryptoMigrationUtil.decrypt(projDate);
}
return decrypt;
}
}
return null;
}
public static String getStudioVersion() {
String studioVersion = VersionUtils.getDisplayVersion();
String patchInstalledVersion = PendoTrackDataUtil.getLatestPatchInstalledVersion();
if (StringUtils.isNotBlank(patchInstalledVersion)) {
studioVersion = patchInstalledVersion;
}
return studioVersion;
}
public static String getItemProductVersion(Property property) {
String productVersion = null;
EMap additionalProperties = property.getAdditionalProperties();
if (additionalProperties.get("modified_product_version") != null) {
productVersion = additionalProperties.get("modified_product_version").toString();
} else if (additionalProperties.get("created_product_version") != null) {
productVersion = additionalProperties.get("created_product_version").toString();
}
if (StringUtils.isNotBlank(productVersion)) {
productVersion = VersionUtils.getTalendPureVersion(productVersion);
}
return productVersion;
}
public static String getItemProductName(Property property) {
String productName = null;
EMap additionalProperties = property.getAdditionalProperties();
if (additionalProperties.get("modified_product_fullname") != null) {
productName = additionalProperties.get("modified_product_fullname").toString();
} else if (additionalProperties.get("created_product_fullname") != null) {
productName = additionalProperties.get("created_product_fullname").toString();
}
return productName;
}
public static String formatDate(String dateString, String pattern) {
String formattedDate = "";
if (StringUtils.isNotBlank(dateString)) {
Date date = new Date(Long.parseLong(dateString));
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
formattedDate = sdf.format(date);
}
return formattedDate;
}
public interface SignatureStatus {
public static final int V_VALID = 0;
public static final int V_INVALID = EmfResourceUtil.V_INVALID << 0;
public static final int V_UNSIGNED = V_INVALID << 1;
}
public enum TOSProdNameEnum {
TOS_DI("Talend Open Studio for Data Integration"),
TOS_BD("Talend Open Studio for Big Data"),
TOS_ESB("Talend Open Studio for ESB"),
TOS_TOP("Talend Open Studio for Data Quality");
private String prodName;
TOSProdNameEnum(String prodName) {
this.prodName = prodName;
}
public String getProdName() {
return prodName;
}
public static String getTOSCategoryByProdName(String prodName) {
String category = null;
for (TOSProdNameEnum tosProdNameEnum : TOSProdNameEnum.values()) {
if (tosProdNameEnum.getProdName().equals(prodName)) {
category = tosProdNameEnum.name();
break;
}
}
return category;
}
}
public enum ValueEnum {
YES("Y"),
NO("N"),
NOT_APPLICATE("N/A");
private String displayValue;
ValueEnum(String displayValue) {
this.displayValue = displayValue;
}
public String getDisplayValue() {
return displayValue;
}
}
}

View File

@@ -25,6 +25,7 @@ import org.talend.core.model.general.Project;
import org.talend.core.model.properties.ProjectReference;
import org.talend.core.pendo.properties.IPendoDataProperties;
import org.talend.core.pendo.properties.PendoLoginProperties;
import org.talend.core.service.ICloudSignOnService;
import org.talend.core.service.IStudioLiteP2Service;
import org.talend.core.ui.IInstalledPatchService;
import org.talend.repository.ProjectManager;
@@ -61,11 +62,7 @@ public class PendoTrackDataUtil {
}
public static IPendoDataProperties getLoginEventProperties() {
String studioPatch = null;
IInstalledPatchService installedPatchService = IInstalledPatchService.get();
if (installedPatchService != null) {
studioPatch = installedPatchService.getLatestInstalledPatchVersion();
}
String studioPatch = getLatestPatchInstalledVersion();
PendoLoginProperties loginEvent = new PendoLoginProperties();
IStudioLiteP2Service studioLiteP2Service = IStudioLiteP2Service.get();
try {
@@ -85,6 +82,10 @@ public class PendoTrackDataUtil {
loginEvent.setEnabledFeatures(enabledFeatures);
}
setUpRefProjectsStructure(loginEvent);
loginEvent.setIsOneClickLogin(Boolean.FALSE.toString());
if (ICloudSignOnService.get() != null && ICloudSignOnService.get().isSignViaCloud()) {
loginEvent.setIsOneClickLogin(Boolean.TRUE.toString());
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
@@ -93,6 +94,15 @@ public class PendoTrackDataUtil {
return loginEvent;
}
public static String getLatestPatchInstalledVersion() {
String studioPatch = "";
IInstalledPatchService installedPatchService = IInstalledPatchService.get();
if (installedPatchService != null) {
studioPatch = installedPatchService.getLatestInstalledVersion(true);
}
return studioPatch;
}
private static void setUpRefProjectsStructure(PendoLoginProperties loginEvent) {
ProjectManager projectManager = ProjectManager.getInstance();
Project currentProject = projectManager.getCurrentProject();
@@ -162,7 +172,9 @@ public class PendoTrackDataUtil {
OPEN_IN_APITester("Open in API Tester"),
OPEN_API_DOCUMENTATION("Open API Documentation"),
AUTOMAP("tMap Automap"),
TMAP("Studio tMap");
TMAP("tMap"),
ITEM_IMPORT("Import items"),
ITEM_SIGNATURE("Item Signature");
private String event;

View File

@@ -55,9 +55,9 @@ import org.talend.utils.json.JSONObject;
*/
public class PendoTrackSender {
private static final String PROP_PENDO_LOCAL_CHECK = "talend.pendo.localDebug";
public static final String PROP_PENDO_LOCAL_CHECK = "talend.pendo.localDebug";
private static final String PROP_PENDO_LOG_DATA = "talend.pendo.logRuntimeData";
public static final String PROP_PENDO_LOG_DATA = "talend.pendo.logRuntimeData";
private static final String PREFIX_API = "api";
@@ -79,13 +79,18 @@ public class PendoTrackSender {
private static String pendoInfo;
public PendoTrackSender() {
private PendoTrackSender() {
}
static {
instance = new PendoTrackSender();
RepositoryContext repositoryContext = getRepositoryContext();
if (repositoryContext != null) {
adminUrl = repositoryContext.getFields().get(RepositoryConstants.REPOSITORY_URL);
}
}
public static PendoTrackSender getInstance() {
if (instance == null) {
instance = new PendoTrackSender();
}
if (StringUtils.isBlank(adminUrl)) {
RepositoryContext repositoryContext = getRepositoryContext();
if (repositoryContext != null) {
@@ -118,7 +123,7 @@ public class PendoTrackSender {
public void sendTrackData(TrackEvent event, IPendoDataProperties properties) throws Exception {
if (isPendoLocalDebug()) {
ExceptionHandler.log(PendoTrackDataUtil.convertEntityJsonString(properties));
ExceptionHandler.log(event.getEvent() + ":" + PendoTrackDataUtil.convertEntityJsonString(properties));
return;
}
DefaultHttpClient client = null;

View File

@@ -36,6 +36,9 @@ public class PendoLoginProperties implements IPendoDataProperties {
@JsonProperty("referenced_projects")
private List<String> refProjectList;
@JsonProperty("one_click_login")
private String isOneClickLogin;
/**
* Getter for studio_version.
*
@@ -126,4 +129,22 @@ public class PendoLoginProperties implements IPendoDataProperties {
this.refProjectList = refProjectList;
}
/**
* Getter for isOneClickLogin.
*
* @return the isOneClickLogin
*/
public String getIsOneClickLogin() {
return isOneClickLogin;
}
/**
* Sets the isOneClickLogin.
*
* @param isOneClickLogin the isOneClickLogin to set
*/
public void setIsOneClickLogin(String isOneClickLogin) {
this.isOneClickLogin = isOneClickLogin;
}
}

View File

@@ -0,0 +1,211 @@
// ============================================================================
//
// Copyright (C) 2006-2022 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.core.pendo.properties;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* DOC jding class global comment. Detailled comment
*/
public class PendoSignImportProperties implements IPendoDataProperties {
@JsonProperty("source_version")
private List<String> sourceVersion;
@JsonProperty("studio_version")
private String studioVersion;
@JsonProperty("valid_items")
private int validItems;
@JsonProperty("unsigned_items_from_SE")
private String unsignSEItems;
@JsonProperty("unsigned_items_from_EE")
private int unsignEEItems;
@JsonProperty("grace_period")
private String gracePeriod;
@JsonProperty("installed_date")
private String installDate;
@JsonProperty("project_creation_date")
private String projectCreateDate;
@JsonProperty("valid_migration_token")
private String validMigrationToken;
/**
* Getter for sourceVersion.
* @return the sourceVersion
*/
public List<String> getSourceVersion() {
return sourceVersion;
}
/**
* Sets the sourceVersion.
* @param sourceVersion the sourceVersion to set
*/
public void setSourceVersion(List<String> sourceVersion) {
this.sourceVersion = sourceVersion;
}
/**
* Getter for studioVersion.
*
* @return the studioVersion
*/
public String getStudioVersion() {
return studioVersion;
}
/**
* Sets the studioVersion.
*
* @param studioVersion the studioVersion to set
*/
public void setStudioVersion(String studioVersion) {
this.studioVersion = studioVersion;
}
/**
* Getter for validItems.
*
* @return the validItems
*/
public int getValidItems() {
return validItems;
}
/**
* Sets the validItems.
*
* @param validItems the validItems to set
*/
public void setValidItems(int validItems) {
this.validItems = validItems;
}
/**
* Getter for unsignSEItems.
* @return the unsignSEItems
*/
public String getUnsignSEItems() {
return unsignSEItems;
}
/**
* Sets the unsignSEItems.
* @param unsignSEItems the unsignSEItems to set
*/
public void setUnsignSEItems(String unsignSEItems) {
this.unsignSEItems = unsignSEItems;
}
/**
* Getter for unsignEEItems.
*
* @return the unsignEEItems
*/
public int getUnsignEEItems() {
return unsignEEItems;
}
/**
* Sets the unsignEEItems.
*
* @param unsignEEItems the unsignEEItems to set
*/
public void setUnsignEEItems(int unsignEEItems) {
this.unsignEEItems = unsignEEItems;
}
/**
* Getter for gracePeriod.
*
* @return the gracePeriod
*/
public String getGracePeriod() {
return gracePeriod;
}
/**
* Sets the gracePeriod.
*
* @param gracePeriod the gracePeriod to set
*/
public void setGracePeriod(String gracePeriod) {
this.gracePeriod = gracePeriod;
}
/**
* Getter for installDate.
*
* @return the installDate
*/
public String getInstallDate() {
return installDate;
}
/**
* Sets the installDate.
*
* @param installDate the installDate to set
*/
public void setInstallDate(String installDate) {
this.installDate = installDate;
}
/**
* Getter for projectCreateDate.
*
* @return the projectCreateDate
*/
public String getProjectCreateDate() {
return projectCreateDate;
}
/**
* Sets the projectCreateDate.
*
* @param projectCreateDate the projectCreateDate to set
*/
public void setProjectCreateDate(String projectCreateDate) {
this.projectCreateDate = projectCreateDate;
}
/**
* Getter for validMigrationToken.
*
* @return the validMigrationToken
*/
public String getValidMigrationToken() {
return validMigrationToken;
}
/**
* Sets the validMigrationToken.
*
* @param validMigrationToken the validMigrationToken to set
*/
public void setValidMigrationToken(String validMigrationToken) {
this.validMigrationToken = validMigrationToken;
}
}

View File

@@ -0,0 +1,251 @@
// ============================================================================
//
// Copyright (C) 2006-2022 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.core.pendo.properties;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* DOC jding class global comment. Detailled comment
*/
public class PendoSignLogonProperties implements IPendoDataProperties {
@JsonProperty("studio_version")
private String studioVersion;
@JsonProperty("valid_items")
private int validItems;
@JsonProperty("signature_invalid_items")
private int invalidSignItems;
@JsonProperty("unsigned_items_from_SE")
private String unsignSEItems;
@JsonProperty("unsigned_items_from_EE")
private int unsignEEItems;
@JsonProperty("invalid_item_source_version")
private String invalidItemSourceVersion;
@JsonProperty("signed_by_migration")
private int signByMigration;
@JsonProperty("grace_period")
private String gracePeriod;
@JsonProperty("installed_date")
private String installDate;
@JsonProperty("project_creation_date")
private String projectCreateDate;
@JsonProperty("valid_migration_token")
private String validMigrationToken;
/**
* Getter for studioVersion.
*
* @return the studioVersion
*/
public String getStudioVersion() {
return studioVersion;
}
/**
* Sets the studioVersion.
*
* @param studioVersion the studioVersion to set
*/
public void setStudioVersion(String studioVersion) {
this.studioVersion = studioVersion;
}
/**
* Getter for validItems.
*
* @return the validItems
*/
public int getValidItems() {
return validItems;
}
/**
* Sets the validItems.
*
* @param validItems the validItems to set
*/
public void setValidItems(int validItems) {
this.validItems = validItems;
}
/**
* Getter for invalidSignItems.
*
* @return the invalidSignItems
*/
public int getInvalidSignItems() {
return invalidSignItems;
}
/**
* Sets the invalidSignItems.
*
* @param invalidSignItems the invalidSignItems to set
*/
public void setInvalidSignItems(int invalidSignItems) {
this.invalidSignItems = invalidSignItems;
}
/**
* Getter for unsignSEItems.
* @return the unsignSEItems
*/
public String getUnsignSEItems() {
return unsignSEItems;
}
/**
* Sets the unsignSEItems.
* @param unsignSEItems the unsignSEItems to set
*/
public void setUnsignSEItems(String unsignSEItems) {
this.unsignSEItems = unsignSEItems;
}
/**
* Getter for unsignEEItems.
*
* @return the unsignEEItems
*/
public int getUnsignEEItems() {
return unsignEEItems;
}
/**
* Sets the unsignEEItems.
*
* @param unsignEEItems the unsignEEItems to set
*/
public void setUnsignEEItems(int unsignEEItems) {
this.unsignEEItems = unsignEEItems;
}
/**
* Getter for invalidItemSourceVersion.
*
* @return the invalidItemSourceVersion
*/
public String getInvalidItemSourceVersion() {
return invalidItemSourceVersion;
}
/**
* Sets the invalidItemSourceVersion.
*
* @param invalidItemSourceVersion the invalidItemSourceVersion to set
*/
public void setInvalidItemSourceVersion(String invalidItemSourceVersion) {
this.invalidItemSourceVersion = invalidItemSourceVersion;
}
/**
* Getter for signByMigration.
*
* @return the signByMigration
*/
public int getSignByMigration() {
return signByMigration;
}
/**
* Sets the signByMigration.
*
* @param signByMigration the signByMigration to set
*/
public void setSignByMigration(int signByMigration) {
this.signByMigration = signByMigration;
}
/**
* Getter for gracePeriod.
*
* @return the gracePeriod
*/
public String getGracePeriod() {
return gracePeriod;
}
/**
* Sets the gracePeriod.
*
* @param gracePeriod the gracePeriod to set
*/
public void setGracePeriod(String gracePeriod) {
this.gracePeriod = gracePeriod;
}
/**
* Getter for installDate.
*
* @return the installDate
*/
public String getInstallDate() {
return installDate;
}
/**
* Sets the installDate.
*
* @param installDate the installDate to set
*/
public void setInstallDate(String installDate) {
this.installDate = installDate;
}
/**
* Getter for projectCreateDate.
*
* @return the projectCreateDate
*/
public String getProjectCreateDate() {
return projectCreateDate;
}
/**
* Sets the projectCreateDate.
*
* @param projectCreateDate the projectCreateDate to set
*/
public void setProjectCreateDate(String projectCreateDate) {
this.projectCreateDate = projectCreateDate;
}
/**
* Getter for validMigrationToken.
*
* @return the validMigrationToken
*/
public String getValidMigrationToken() {
return validMigrationToken;
}
/**
* Sets the validMigrationToken.
*
* @param validMigrationToken the validMigrationToken to set
*/
public void setValidMigrationToken(String validMigrationToken) {
this.validMigrationToken = validMigrationToken;
}
}

View File

@@ -12,8 +12,6 @@
// ============================================================================
package org.talend.core.prefs;
import org.talend.commons.utils.network.ITalendNexusPrefConstants;
/**
* Core preferences. Detailled comment <br/>
*
@@ -187,8 +185,6 @@ public interface ITalendCorePrefConstants {
public static final String PERFORMANCE_JAVA_PROCESS_CODE_FORMATE_TIMEOUT = "PERFORMANCE_JAVA_PROCESS_CODE_FORMATE_TIMEOUT"; //$NON-NLS-1$
public static final String NEXUS_TIMEOUT = ITalendNexusPrefConstants.NEXUS_TIMEOUT;
public static final String NEXUS_REFRESH_FREQUENCY = "NEXUS_REFRESH_FREQUENCY"; //$NON-NLS-1$
/**

View File

@@ -552,6 +552,8 @@ BusinessAppearanceComposite.textAlignment.vertical.centre=Centre
ConnectionBean.Local=Local
ConnectionBean.Remote=Remote
ConnectionBean.DefaultConnection=Default connection
ConnectionBean.Cloud.name=Signed in: Cloud ({0})
ConnectionBean.CloudConnection.description=Remote connection to Cloud - Signed in: Cloud ({0})
InegerCellEditorListener.NegativeNumberMessage=The value of {0} can't be set by negative number.
InegerCellEditorListener.NumeralMessage=The value of {0} should be numeral.
OpenXSDFileDialog.cancel=Cancel

View File

@@ -402,7 +402,7 @@ repository.SAPIDoc=SAP iDoc
repository.SAPTable=SAP\u30C6\u30FC\u30D6\u30EB
repository.metadataSQLPatterns=SQL\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8
repository.metadataSQLPatterns.alias=SQLTemplates
repository.metadataFileDelimited=\u533A\u5207\u308A\u6587\u5B57\u4ED8\u304D\u30D5\u30A1\u30A4\u30EB
repository.metadataFileDelimited=\u533A\u5207\u308A\u4ED8\u304D\u30D5\u30A1\u30A4\u30EB
repository.metadataFileDelimited.alias=DELIM
repository.metadataTable=\u30E1\u30BF\u30C7\u30FC\u30BF\u30B9\u30AD\u30FC\u30DE
repository.metadataColumn=\u30E1\u30BF\u30C7\u30FC\u30BF\u30AB\u30E9\u30E0

View File

@@ -20,6 +20,8 @@ public interface MavenConstants {
static final String NAME_GROUP_ID = "GROUP_ID";
static final String CLOUD_VERSION = "CLOUD_VERSION";
static final String NAME_USER_VERSION = "USER_VERSION";
static final String NAME_PUBLISH_AS_SNAPSHOT = "PUBLISH_AS_SNAPSHOT";

View File

@@ -48,6 +48,10 @@ public interface TalendProcessOptionConstants {
public static final int GENERATE_POM_NOT_CLEAR_CACHE = 1 << 11;
/**
* for DQ clean item
*/
public static final int GENERATE_NO_RESET_DQ = 1 << 12;
/**
* clean options
*/

View File

@@ -0,0 +1,57 @@
// ============================================================================
//
// Copyright (C) 2006-2021 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.core.service;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.IService;
import org.talend.core.model.general.ConnectionBean;
import org.talend.signon.util.TokenMode;
import org.talend.signon.util.listener.LoginEventListener;
public interface ICloudSignOnService extends IService {
TokenMode getToken(String authCode, String codeVerifier, String dataCenter) throws Exception;
void startHeartBeat() throws Exception;
void stopHeartBeat();
String generateCodeVerifier();
String getCodeChallenge(String seed) throws Exception;
boolean hasValidToken() throws Exception;
String getTokenUser(String url, TokenMode token) throws Exception;
void signonCloud(LoginEventListener listener) throws Exception;
TokenMode getLatestToken() throws Exception;
public boolean refreshToken() throws Exception;
boolean isSignViaCloud();
void lastConnectionChanged(ConnectionBean bean);
public void showReloginDialog();
public boolean isReloginDialogRunning();
public static ICloudSignOnService get() {
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICloudSignOnService.class)) {
return GlobalServiceRegister.getDefault().getService(ICloudSignOnService.class);
}
return null;
}
}

View File

@@ -32,6 +32,7 @@ import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.PlatformUI;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.core.model.general.ConnectionBean;
import org.talend.core.service.ICloudSignOnService;
import org.talend.utils.json.JSONArray;
import org.talend.utils.json.JSONException;
import org.talend.utils.json.JSONObject;
@@ -158,6 +159,8 @@ public class ConnectionUserPerReader {
}
if (cons == null || cons.size() == 0) {
proper.remove("connection.users");//$NON-NLS-1$
proper.remove("connection.define");//$NON-NLS-1$
proper.remove("connection.lastConnection");//$NON-NLS-1$
} else {
JSONArray usersJsonArray = new JSONArray();
for (ConnectionBean currentConnection : cons) {
@@ -207,7 +210,7 @@ public class ConnectionUserPerReader {
} catch (Exception e) {
e.printStackTrace();
}
ICloudSignOnService.get().lastConnectionChanged(bean);
}
public void createPropertyFile() {

View File

@@ -309,7 +309,7 @@ repository.metadataSAPConnections.alias=SAP
repository.SAPFunction=SAP\u30D5\u30A1\u30F3\u30AF\u30B7\u30E7\u30F3
repository.metadataSQLPatterns=SQL\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8
repository.metadataSQLPatterns.alias=SQLTemplates
repository.metadataFileDelimited=\u533A\u5207\u308A\u6587\u5B57\u4ED8\u304D\u30D5\u30A1\u30A4\u30EB
repository.metadataFileDelimited=\u533A\u5207\u308A\u4ED8\u304D\u30D5\u30A1\u30A4\u30EB
repository.metadataFileDelimited.alias=DELIM
repository.metadataFileLdif=LDIF\u30D5\u30A1\u30A4\u30EB
repository.metadataFileLdif.alias=LDIF

View File

@@ -33,7 +33,7 @@ public class TalendDataCollectorPreferenceInitializer extends AbstractPreference
IPreferenceStore preferenceStore = CoreUIPlugin.getDefault().getPreferenceStore();
preferenceStore.setDefault(ITalendCorePrefConstants.DATA_COLLECTOR_ENABLED, true);
preferenceStore.setDefault(ITalendCorePrefConstants.DATA_COLLECTOR_UPLOAD_PERIOD, 5);
if(IRemoteService.get().isCloudConnection()) {
if(IRemoteService.get() != null && IRemoteService.get().isCloudConnection()) {
preferenceStore.setValue(ITalendCorePrefConstants.DATA_COLLECTOR_ENABLED, true);
}
}

View File

@@ -47,7 +47,7 @@ public class TalendDataCollectorPreferencePage extends FieldEditorPreferencePage
@Override
protected void createFieldEditors() {
if(!IRemoteService.get().isCloudConnection()) {
if(!(IRemoteService.get() != null && IRemoteService.get().isCloudConnection())) {
addField(new BooleanFieldEditor(ITalendCorePrefConstants.DATA_COLLECTOR_ENABLED,
Messages.getString("TalendDataCollectorPreferencePage_EnableCapture"), getFieldEditorParent())); //$NON-NLS-1$
}

View File

@@ -42,6 +42,7 @@ import org.talend.core.model.metadata.builder.ConvertionHelper;
import org.talend.core.model.metadata.builder.connection.MetadataTable;
import org.talend.core.model.process.ElementParameterParser;
import org.talend.core.model.properties.Item;
import org.talend.core.model.properties.Property;
import org.talend.core.model.relationship.RelationshipItemBuilder;
import org.talend.core.model.repository.IRepositoryViewObject;
import org.talend.core.model.repository.RepositoryManager;
@@ -56,6 +57,7 @@ import org.talend.core.model.utils.TalendTextUtils;
import org.talend.core.prefs.PreferenceManipulator;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.core.runtime.process.ITalendProcessJavaProject;
import org.talend.core.services.ICoreTisService;
import org.talend.core.services.IJobCheckService;
import org.talend.core.utils.KeywordsValidator;
import org.talend.designer.codegen.ICodeGeneratorService;
@@ -400,4 +402,31 @@ public class CoreService implements ICoreService {
}
});
}
@Override
public Integer getSignatureVerifyResult(Property property, IPath resourcePath, boolean considerGP) throws Exception {
ICoreTisService coreTisService = ICoreTisService.get();
if (coreTisService != null) {
return coreTisService.getSignatureVerifyResult(property, resourcePath, considerGP);
}
return null;
}
@Override
public String getLicenseCustomer() {
ICoreTisService coreTisService = ICoreTisService.get();
if (coreTisService != null) {
return coreTisService.getLicenseCustomer();
}
return null;
}
@Override
public boolean isInValidGP() {
ICoreTisService coreTisService = ICoreTisService.get();
if (coreTisService != null) {
return coreTisService.isInValidGP();
}
return false;
}
}

View File

@@ -21,6 +21,7 @@ import org.talend.commons.exception.PersistenceException;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.model.components.conversions.IComponentConversion;
import org.talend.core.model.components.conversions.RenameComponentConversion;
import org.talend.core.model.components.conversions.DefaultRenameComponentConversion;
import org.talend.core.model.components.filters.IComponentFilter;
import org.talend.core.model.components.filters.NameComponentFilter;
import org.talend.core.model.properties.Item;
@@ -56,6 +57,20 @@ public class ModifyComponentsAction {
throws PersistenceException {
searchAndModify(item, item.getProcess(), filter, conversions);
}
/**
* Rename component name
* @param item job item
* @param processType Process type
* @param oldName old base name, for tck component, name does not include prefix "t", while for non tck components, name includes prefix "t".
* @param newName new base name, for tck component, name does not include prefix "t", while for non tck components, name includes prefix "t".
* @return
* @throws PersistenceException
*/
public static boolean searchAndRenameComponent(Item item, ProcessType processType, String oldName, String newName) throws PersistenceException {
return searchAndModify(item, processType, new NameComponentFilter(oldName), Arrays.<IComponentConversion> asList(new DefaultRenameComponentConversion(oldName, newName)));
}
public static boolean searchAndModify(Item item, ProcessType processType, IComponentFilter filter,
List<IComponentConversion> conversions) throws PersistenceException {

View File

@@ -0,0 +1,118 @@
// ============================================================================
//
// Copyright (C) 2006-2022 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.core.model.components.conversions;
import org.eclipse.emf.common.util.EList;
import org.talend.commons.runtime.model.components.IComponentConstants;
import org.talend.core.model.components.ComponentUtilities;
import org.talend.designer.core.model.utils.emf.talendfile.ConnectionType;
import org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType;
import org.talend.designer.core.model.utils.emf.talendfile.MetadataType;
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.model.utils.emf.talendfile.SubjobType;
/**
* @author bhe created on Jul 6, 2022
*
*/
public class DefaultRenameComponentConversion implements IComponentConversion {
private String newName;
private String oldName;
/**
* Rename component name
*
* @param oldName old base name of the component, e.g. NetSuiteV2019Input
* @param newName new base name of the component, e.g. NetSuiteNewInput
*/
public DefaultRenameComponentConversion(String oldName, String newName) {
super();
this.newName = newName;
this.oldName = oldName;
}
public void transform(NodeType node) {
node.setComponentName(newName);
ProcessType item = (ProcessType) node.eContainer();
String oldNodeUniqueName = ComponentUtilities.getNodeUniqueName(node);
ComponentUtilities.setNodeUniqueName(node, oldNodeUniqueName.replaceAll(oldName, newName));
replaceAllInAllNodesParameterValue(item, this.oldName, this.newName);
}
protected static void replaceAllInAllNodesParameterValue(ProcessType item, String oldName, String newName) {
for (Object o : item.getNode()) {
NodeType nt = (NodeType) o;
ComponentUtilities.replaceInNodeParameterValue(nt, oldName, newName);
EList metaList = nt.getMetadata();
if (metaList != null) {
if (!metaList.isEmpty()) {
for (Object obj : metaList) {
MetadataType meta = (MetadataType) obj;
if (meta.getName().contains(oldName)) {
meta.setName(meta.getName().replaceAll(oldName, newName));
}
}
}
}
}
for (Object o : item.getConnection()) {
ConnectionType currentConnection = (ConnectionType) o;
if (currentConnection.getSource().contains(oldName)) {
currentConnection.setSource(currentConnection.getSource().replaceAll(oldName, newName));
}
if (currentConnection.getTarget().contains(oldName)) {
currentConnection.setTarget(currentConnection.getTarget().replaceAll(oldName, newName));
}
if (currentConnection.getMetaname().contains(oldName)) {
currentConnection.setMetaname(currentConnection.getMetaname().replaceAll(oldName, newName));
}
if ("RUN_IF".equals(currentConnection.getConnectorName())) {
for (Object obj : currentConnection.getElementParameter()) {
ElementParameterType type = (ElementParameterType) obj;
if ("CONDITION".equals(type.getName())) {
if (type.getValue() != null && type.getValue().contains(oldName)) {
String replaceAll = type.getValue().replaceAll(oldName, newName);
type.setValue(replaceAll);
}
break;
}
}
}
}
for (Object o : item.getSubjob()) {
SubjobType sj = (SubjobType) o;
for (Object obj : sj.getElementParameter()) {
ElementParameterType p = (ElementParameterType) obj;
if (p.getName().equals(IComponentConstants.UNIQUE_NAME)) {
if (p.getValue() != null && p.getValue().contains(oldName)) {
String replaceAll = p.getValue().replaceAll(oldName, newName);
p.setValue(replaceAll);
}
}
}
}
}
public String getNewName() {
return this.newName;
}
public void setNewName(String newName) {
this.newName = newName;
}
}

View File

@@ -18,6 +18,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.emf.common.util.URI;
import org.osgi.service.prefs.BackingStoreException;
@@ -84,6 +85,12 @@ public interface ICoreTisService extends IService {
public void afterImport (Property property) throws PersistenceException;
Integer getSignatureVerifyResult(Property property, IPath resourcePath, boolean considerGP) throws Exception;
String getLicenseCustomer();
boolean isInValidGP();
boolean hasNewPatchInPatchesFolder();
boolean isDefaultLicenseAndProjectType();

View File

@@ -278,6 +278,19 @@ public class ProcessorUtilities {
needExportItemsForDQ = false;
}
public static void resetExportConfig(boolean noResetDq) {
interpreter = null;
codeLocation = null;
libraryPath = null;
exportConfig = false;
exportAsOSGI = false;
exportTimeStamp = null;
exportJobAsMicroService = false;
if (!noResetDq) {
needExportItemsForDQ = false;
}
}
public static String getInterpreter() {
return interpreter;
}

View File

@@ -113,12 +113,12 @@
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.68</version>
<version>1.70</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.12.0</version>
<version>2.13.2.2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>

View File

@@ -84,12 +84,12 @@
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.68</version>
<version>1.70</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.12.0</version>
<version>2.13.2.2</version>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>

View File

@@ -38,7 +38,7 @@
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.68</version>
<version>1.70</version>
</dependency>
</dependencies>
<build>

View File

@@ -13,7 +13,7 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>3.8.3</version>
<version>3.8.6</version>
</dependency>
<dependency>
<groupId>org.eclipse.tycho</groupId>

View File

@@ -32,7 +32,7 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>3.8.3</version>
<version>3.8.6</version>
<exclusions>
<exclusion>
<groupId>commons-io</groupId>
@@ -123,7 +123,7 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-compat</artifactId>
<version>3.8.3</version>
<version>3.8.6</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>

View File

@@ -11,7 +11,7 @@
<packaging>pom</packaging>
<properties>
<tcomp.version>1.46.1</tcomp.version>
<tcomp.version>1.47.1</tcomp.version>
<slf4j.version>1.7.32</slf4j.version>
<reload4j.version>1.2.19</reload4j.version>
</properties>

View File

@@ -24,195 +24,27 @@
<exclusion>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.commons</groupId>
<artifactId>commons-configuration2</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.6.8</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.datastax.oss</groupId>
<artifactId>java-driver-bom</artifactId>
<version>4.13.0</version>
<type>pom</type>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-configuration2</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-parent</artifactId>
<version>4.2.9</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-bom</artifactId>
<version>4.2.9</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-bom</artifactId>
<version>3.0.10</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.jboss</groupId>
<artifactId>jboss-parent</artifactId>
<version>36</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-build-configuration-parent</artifactId>
<version>12.1.11.Final</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-bom</artifactId>
<version>12.1.11.Final</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson</groupId>
<artifactId>jackson-bom</artifactId>
<version>2.13.3</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.glassfish.jersey</groupId>
<artifactId>jersey-bom</artifactId>
<version>2.35</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-bom</artifactId>
<version>9.4.46.v20220331</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.8.2</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-bom</artifactId>
<version>1.6.21</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-coroutines-bom</artifactId>
<version>1.5.2</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.apache.logging</groupId>
<artifactId>logging-parent</artifactId>
<version>5</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-bom</artifactId>
<version>2.17.2</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.apache</groupId>
<artifactId>apache</artifactId>
<version>24</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-bom</artifactId>
<version>1.8.6</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-bom</artifactId>
<version>4.1.77.Final</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc-bom</artifactId>
<version>21.3.0.0</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>parent</artifactId>
<version>0.12.0</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_bom</artifactId>
<version>0.12.0</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-bom</artifactId>
<version>5.0.0</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>io.r2dbc</groupId>
<artifactId>r2dbc-bom</artifactId>
<version>Arabba-SR13</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-bom</artifactId>
<version>2020.0.19</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>io.rsocket</groupId>
<artifactId>rsocket-bom</artifactId>
<version>1.1.2</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-bom</artifactId>
<version>2021.1.4</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>5.3.20</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-bom</artifactId>
<version>5.5.12</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-bom</artifactId>
<version>5.6.5</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-bom</artifactId>
<version>2021.1.3</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson</groupId>
<artifactId>jackson-bom</artifactId>

View File

@@ -58,7 +58,7 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-compat</artifactId>
<version>3.8.3</version>
<version>3.8.6</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
@@ -68,7 +68,7 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>3.8.3</version>
<version>3.8.6</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
@@ -100,7 +100,7 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>3.8.3</version>
<version>3.8.6</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
@@ -147,7 +147,7 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>3.8.3</version>
<version>3.8.6</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
@@ -199,12 +199,12 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-compat</artifactId>
<version>3.8.3</version>
<version>3.8.6</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>3.8.3</version>
<version>3.8.6</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
@@ -228,6 +228,11 @@
<artifactId>junit</artifactId>
<version>4.13.2</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-settings</artifactId>
<version>3.8.3</version>
</dependency>
</dependencies>
</plugin>
<plugin>
@@ -254,7 +259,12 @@
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.8.0</version>
</dependency>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-settings</artifactId>
<version>3.8.3</version>
</dependency>
</dependencies>
</plugin>
<plugin>
@@ -267,6 +277,11 @@
<artifactId>plexus-utils</artifactId>
<version>3.0.24</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-settings</artifactId>
<version>3.8.3</version>
</dependency>
</dependencies>
</plugin>
</plugins>

View File

@@ -122,7 +122,7 @@ public class TalendMavenLaunchDelegate extends JavaLaunchDelegate implements Mav
this.extensionsSupport = MavenLaunchExtensionsSupport.create(configuration, launch);
log.info("" + getWorkingDirectory(configuration)); //$NON-NLS-1$
log.info(" mvn" + getProgramArguments(configuration, IRemoteService.get().isCloudConnection())); //$NON-NLS-1$
log.info(" mvn" + getProgramArguments(configuration, IRemoteService.get() == null ? false: IRemoteService.get().isCloudConnection())); //$NON-NLS-1$
this.programArguments = null;
extensionsSupport.configureSourceLookup(configuration, launch, monitor);

View File

@@ -241,7 +241,8 @@ public class BuildCacheManager {
property.getVersion(), true);
if (obj != null) {
IRunProcessService.get().generatePom(obj.getProperty().getItem(),
TalendProcessOptionConstants.GENERATE_POM_NOT_CLEAR_CACHE);
TalendProcessOptionConstants.GENERATE_POM_NOT_CLEAR_CACHE
| TalendProcessOptionConstants.GENERATE_NO_RESET_DQ);
}
}
}
@@ -331,7 +332,7 @@ public class BuildCacheManager {
private ITalendProcessJavaProject getTalendJobJavaProject(Property property) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
IRunProcessService service = (IRunProcessService) GlobalServiceRegister.getDefault()
IRunProcessService service = GlobalServiceRegister.getDefault()
.getService(IRunProcessService.class);
return service.getTalendJobJavaProject(property);
}
@@ -347,7 +348,7 @@ public class BuildCacheManager {
private boolean isBuildJob() {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
IRunProcessService service = (IRunProcessService) GlobalServiceRegister.getDefault()
IRunProcessService service = GlobalServiceRegister.getDefault()
.getService(IRunProcessService.class);
return service.isExportConfig();
}

View File

@@ -140,8 +140,14 @@ public abstract class AbstractMavenCodesTemplatePom extends AbstractMavenGeneral
Exclusion jacksonExclusion = new Exclusion();
jacksonExclusion.setGroupId("com.fasterxml.jackson.core"); //$NON-NLS-1$
jacksonExclusion.setArtifactId("jackson-databind "); //$NON-NLS-1$
Exclusion configuration2Exclusion = new Exclusion();
configuration2Exclusion.setGroupId("org.apache.commons"); //$NON-NLS-1$
configuration2Exclusion.setArtifactId("commons-configuration2"); //$NON-NLS-1$
dependency.addExclusion(exclusion);
dependency.addExclusion(jacksonExclusion);
dependency.addExclusion(configuration2Exclusion);
}
existedDependencies.add(dependency);
}

View File

@@ -128,7 +128,7 @@ public abstract class AbstractMavenProcessorPom extends CreateMavenBundleTemplat
if (ProcessUtils.isTestContainer(process)) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
ITestContainerProviderService testService = (ITestContainerProviderService) GlobalServiceRegister.getDefault()
ITestContainerProviderService testService = GlobalServiceRegister.getDefault()
.getService(ITestContainerProviderService.class);
try {
property = testService.getParentJobItem(property.getItem()).getProperty();
@@ -231,7 +231,7 @@ public abstract class AbstractMavenProcessorPom extends CreateMavenBundleTemplat
Dependency mavenCoreDep = new Dependency();
mavenCoreDep.setGroupId("org.apache.maven");
mavenCoreDep.setArtifactId("maven-core");
mavenCoreDep.setVersion("3.8.3");
mavenCoreDep.setVersion("3.8.6");
shade.getDependencies().add(guavaDep);
shade.getDependencies().add(codecDep);
@@ -454,6 +454,7 @@ public abstract class AbstractMavenProcessorPom extends CreateMavenBundleTemplat
*
* @param hasLoopDependency the hasLoopDependency to set
*/
@Override
public void setHasLoopDependency(boolean hasLoopDependency) {
this.hasLoopDependency = hasLoopDependency;
}

View File

@@ -45,6 +45,8 @@ public class PomIdsHelper {
private static Map<String, ProjectPreferenceManager> preferenceManagers = new HashMap<>();
private static final String ARTIFACT_ID = "artifactId";
/**
* get current project groupId.
*/
@@ -161,6 +163,27 @@ public class PomIdsHelper {
return getCodesVersion(projectTechName);
}
public static String getGroupId(Property property) {
if (null == getOldId(property)) {
final String path = property.getItem().getState().getPath();
if (null != path) {
return path.replace('/', '.');
}
}
return null;
}
private static String getOldId(Property property) {
final String oldId = (String) property.getAdditionalProperties().get(ARTIFACT_ID);
if (null != oldId) {
final String name = property.getLabel();
if (oldId.startsWith(name + '_')) {
return oldId;
}
}
return null;
}
@Deprecated
public static String getJobGroupId(String name) {
if (name != null && !name.trim().isEmpty()) {
@@ -268,7 +291,7 @@ public class PomIdsHelper {
public static String getJobVersion(Property property) {
String version = null;
if (property != null) {
boolean useSnapshot = false;
boolean useSnapshot = false;
if (property.getAdditionalProperties() != null) {
version = (String) property.getAdditionalProperties().get(MavenConstants.NAME_USER_VERSION);
useSnapshot = property.getAdditionalProperties().containsKey(MavenConstants.NAME_PUBLISH_AS_SNAPSHOT);
@@ -283,6 +306,35 @@ public class PomIdsHelper {
return version;
}
/**
* @return "<jobVersion>-<projectName>".
*/
public static String getJobFeatureVersion(Property property, String bundleVersion) {
String version = null;
if (property != null) {
boolean useSnapshot = false;
if (property.getAdditionalProperties() != null) {
version = (String) property.getAdditionalProperties().get(MavenConstants.NAME_USER_VERSION);
// APPINT-34581 - try to take cloud version if custom does not persist
useSnapshot = property.getAdditionalProperties().containsKey(MavenConstants.NAME_PUBLISH_AS_SNAPSHOT);
}
if(version == null) {
version = (String) property.getAdditionalProperties().get(MavenConstants.CLOUD_VERSION);
}
if(version == null) {
version = bundleVersion;
}
if (version == null) {
version = VersionUtils.getPublishVersion(property.getVersion());
}
if (useSnapshot) {
version += MavenConstants.SNAPSHOT;
}
}
return version;
}
public static String getJobVersion(JobInfo jobInfo) {
if (jobInfo != null) {
return jobInfo.getJobVersion();

View File

@@ -1,12 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="lib/stax2-api-4.2.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/woodstox-core-asl-4.4.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/woden-api-1.0M9.jar"/>
<classpathentry exported="true" kind="lib" path="lib/axiom-api-1.2.13.jar"/>
<classpathentry exported="true" kind="lib" path="lib/axiom-impl-1.2.13.jar"/>
<classpathentry exported="true" kind="lib" path="lib/geronimo-stax-api_1.0_spec-1.0.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/httpcore-4.0.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/neethi-3.0.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/wstx-asl-3.2.9.jar"/>
<classpathentry exported="true" kind="lib" path="lib/xmlschema-core-2.2.1.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>

View File

@@ -20,12 +20,13 @@ Bundle-ClassPath: lib/axiom-api-1.3.0.jar,
lib/geronimo-stax-api_1.0_spec-1.0.1.jar,
lib/mail-1.4.jar,
lib/neethi-3.0.1.jar,
lib/wstx-asl-3.2.9.jar,
lib/xmlschema-core-2.2.1.jar,
lib/woden-api-1.0M9.jar,
lib/axis2-codegen-1.8.0.jar,
lib/axis2-java2wsdl-1.8.0.jar,
lib/axis2-metadata-1.8.0.jar,
lib/woodstox-core-asl-4.4.1.jar,
lib/stax2-api-4.2.1.jar,
.
Export-Package: com.ctc.wstx.api,
com.ctc.wstx.cfg,

View File

@@ -80,6 +80,16 @@
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-impl</artifactId>
<version>1.3.0</version>
</artifactItem>
<artifactItem>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>woodstox-core-asl</artifactId>
<version>4.4.1</version>
</artifactItem>
<artifactItem>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>stax2-api</artifactId>
<version>4.2.1</version>
</artifactItem>
</artifactItems>
</configuration>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="lib" path="lib/h2-2.1.210.jar"/>
<classpathentry kind="lib" path="lib/h2-2.1.214.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@@ -4,7 +4,7 @@ Bundle-Name: H2
Bundle-SymbolicName: org.talend.libraries.jdbc.h2
Bundle-Version: 8.0.1.qualifier
Bundle-ClassPath: .,
lib/h2-2.1.210.jar
lib/h2-2.1.214.jar
Export-Package: org.h2,
org.h2.api;uses:="org.h2.command.ddl,org.h2.table",
org.h2.bnf;uses:="org.h2.server.web",

View File

@@ -1,4 +1,4 @@
output.. = bin/
bin.includes = META-INF/,\
.,\
lib/h2-2.1.210.jar
lib/h2-2.1.214.jar

View File

@@ -28,7 +28,7 @@
<artifactItem>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>2.1.210</version>
<version>2.1.214</version>
</artifactItem>
</artifactItems>
</configuration>

View File

@@ -243,10 +243,39 @@ public class JSONObject {
*
* @param bean An object that has getter methods that should be used to make a JSONObject.
*/
@Deprecated
public JSONObject(Object bean) {
this();
populateMap(bean);
}
/**
* Construct a JSONObject from an Object using bean getters. It reflects on all of the public methods of the object.
* For each of the methods with no parameters and a name starting with <code>"get"</code> or <code>"is"</code>
* followed by an uppercase letter, the method is invoked, and a key and the value returned from the getter method
* are put into the new JSONObject.
*
* The key is formed by removing the <code>"get"</code> or <code>"is"</code> prefix. If the second remaining
* character is not upper case, then the first character is converted to lower case.
*
* For example, if an object has a method named <code>"getName"</code>, and if the result of calling
* <code>object.getName()</code> is <code>"Larry Fine"</code>, then the JSONObject will contain
* <code>"name": "Larry Fine"</code>.
*
* @param bean An object that has getter methods that should be used to make a JSONObject.
* @param expectedClass Bean must be the instance of this class, for safe to avoid evil script inject
*/
public JSONObject(Object bean, Class<?> expectedClass) {
this();
Class<?> clazz = bean.getClass();
if((clazz == expectedClass) || (expectedClass!=null && expectedClass.isAssignableFrom(clazz))) {
populateMap(bean);
return;
}
throw new JSONException("expectedClass doesn't match the bean or is null");
}
/**
* Construct a JSONObject from an Object, using reflection to find the public members. The resulting JSONObject's

View File

@@ -105,7 +105,7 @@ public class ResumeUtil {
csvWriter.write("stackTrace");// stackTrace
csvWriter.write("dynamicData");// dynamicData
csvWriter.endRecord();
csvWriter.flush();
csvWriter.flush(true);
}
// shared
sharedWriterMap.put(this.root_pid, this.csvWriter);
@@ -171,7 +171,7 @@ public class ResumeUtil {
csvWriter.write(item.stackTrace);// stackTrace
csvWriter.write(item.dynamicData);// dynamicData--->it is the 17th field. @see:feature:11296
csvWriter.endRecord();
csvWriter.flush();
csvWriter.flush(false);
fileLock.release();
}
// for test the order
@@ -193,6 +193,12 @@ public class ResumeUtil {
}
}
}
public void flush() {
if(csvWriter != null) {
csvWriter.flush(true);
}
}
// Util: invoke target check point
@Deprecated
@@ -353,13 +359,12 @@ public class ResumeUtil {
String str = out.toString();
return str;
}
// to support encrypt the password in the resume
public static String convertToJsonText(Object context, List<String> parametersToEncrypt) {
public static String convertToJsonText(Object context, Class<?> expectedClass, List<String> parametersToEncrypt) {
String jsonText = "";
try {
JSONObject firstNode = new JSONObject();
JSONObject secondNode = new JSONObject(context);
JSONObject secondNode = new JSONObject(context, expectedClass);
if (parametersToEncrypt != null) {
for (String parameterToEncrypt : parametersToEncrypt) {
if (secondNode.isNull(parameterToEncrypt)) {
@@ -379,9 +384,15 @@ public class ResumeUtil {
return jsonText;
}
// to support encrypt the password in the resume
@Deprecated
public static String convertToJsonText(Object context, List<String> parametersToEncrypt) {
return convertToJsonText(context, context == null ? null : context.getClass(), parametersToEncrypt);
}
// Util: convert the context variable to json style text.
// feature:11296
// @Deprecated
@Deprecated
public static String convertToJsonText(Object context) {
return convertToJsonText(context, null);
}
@@ -459,6 +470,8 @@ public class ResumeUtil {
USER_DEF_LOG,
JOB_ENDED;
}
/**
* this class is reference with CsvWriter.
@@ -503,7 +516,10 @@ public class ResumeUtil {
private String lineSeparator = System.getProperty("line.separator");
private int capibility = 2<<14; //32k
private int capibility = 2 << 22; //8M
private int FLUSH_FACTOR = 6 *1024 *1024; //6M
public SimpleCsvWriter(FileChannel channel) {
this.channel = channel;
@@ -534,10 +550,8 @@ public class ResumeUtil {
}
byte[] contentByte = content.getBytes();
if(contentByte.length > capibility - 1024) {
flush();
capibility = contentByte.length * 2;
buf = ByteBuffer.allocate(capibility);
if(contentByte.length > capibility - buf.position()) {
flush(true);
}
buf.put(contentByte);
@@ -562,18 +576,20 @@ public class ResumeUtil {
/**
* flush
*/
public void flush() {
try {
((Buffer) buf).flip();
channel.position(channel.size());
while(buf.hasRemaining()) {
channel.write(buf);
public void flush(boolean force) {
if(force || buf.position() > FLUSH_FACTOR) {
try {
((Buffer) buf).flip();
channel.position(channel.size());
while(buf.hasRemaining()) {
channel.write(buf);
}
channel.force(true);
((Buffer) buf).clear();
} catch (IOException e) {
e.printStackTrace();
}
channel.force(true);
((Buffer) buf).clear();
} catch (IOException e) {
e.printStackTrace();
}
}
}
/**

View File

@@ -202,6 +202,9 @@ public class JavaLibrariesService extends AbstractLibrariesService {
if (!repositoryBundleService.isInitialized()) {
// 2. Components libraries and libraries from extension
repositoryBundleService.createModulesIndexFromComponentAndExtension(monitorWrap);
} else {
//TUP-31721 & TUP-36231:Handle the custom components deployment when studio index is not re-generated.
repositoryBundleService.deployLibsFromCustomComponents();
}
repositoryBundleService.installModules(ModulesNeededProvider.getSystemRunningModules(), null);

View File

@@ -1352,6 +1352,21 @@ public class LocalLibraryManager implements ILibraryManagerService, IChangedLibr
}
return mavenURIMap;
}
public void deployLibsFromCustomComponents() {
IComponentsService service = null;
if (GlobalServiceRegister.getDefault().isServiceRegistered(IComponentsService.class)) {
service = GlobalServiceRegister.getDefault().getService(IComponentsService.class);
}
if (service != null) {
Map<String, String> platformURLMap = new HashMap<>();
platformURLMap = LibrariesIndexManager.getInstance().getAllStudioLibsFromIndex();
// Need to read components first, otherwise FiltUtils.getFilesFromFolderByName() returns empty for custom
// component folder.
service.getComponentsFactory().readComponents();
deployLibsFromCustomComponents(service, platformURLMap);
}
}
/**
*

View File

@@ -510,10 +510,12 @@ InegerCellEditorListener.NumeralMessage=Valeur d'entr\u00E9e invalide
MetadataTalendTypeEditor.button.edit=Mo&difier
MetadataTalendTypeEditor.button.export=E&xporter
MetadataTalendTypeEditor.button.import=I&mporter
MetadataTalendTypeEditor.button.restore=R&estaurer
MetadataTalendTypeEditor.column1.Name=Fichier de mapping de m\u00E9tadonn\u00E9es
MetadataTalendTypeEditor.editMappingDialog.title=Modifier le fichier de mapping
MetadataTalendTypeEditor.error.message=Message d'erreur
MetadataTalendTypeEditor.fileIsImported=Le fichier a d\u00E9j\u00E0 \u00E9t\u00E9 import\u00E9.
MetadataTalendTypeEditor.fileOverwrite=Ce fichier existe d\u00E9j\u00E0. L'\u00E9craser\u00A0?
MetadataTalendTypeEditor.fileIsInvalid=Le fichier de m\u00E9tadonn\u00E9es import\u00E9 n'est pas valide.
MetadataTalendTypeEditor.fileNameStartRule=Le nom de fichier doit commencer par 'mapping_'.
ContextModeSelectPage.contextModes=Cr\u00E9er un contexte ou r\u00E9utiliser le contexte existant
@@ -549,5 +551,5 @@ MetadataTalendTypeEditor.confirmMessage=Voulez-vous remplacer les param\u00E8tre
PromptDialog.title=Ex\u00E9cuter le contexte {0} avec les param\u00E8tres\u00A0:
PromptDialog.stringTip=Le texte d'entr\u00E9e doit \u00EAtre entour\u00E9 par des guillemets.
PromptDialog.choose.title=Choisissez un contexte
PromptDialog.promptGroup.name=Variables \u00E0 compl\u00E9ter
PromptDialog.variablePrompts.name=Variables \u00E0 compl\u00E9ter
PromptDialog.context.environments.name=Environnement

View File

@@ -510,10 +510,12 @@ InegerCellEditorListener.NumeralMessage=\u5165\u529B\u5024\u304C\u7121\u52B9\u30
MetadataTalendTypeEditor.button.edit=\u7DE8\u96C6(&D)
MetadataTalendTypeEditor.button.export=\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8(&X)
MetadataTalendTypeEditor.button.import=\u30A4\u30F3\u30DD\u30FC\u30C8(&M)
MetadataTalendTypeEditor.button.restore=\u5FA9\u5143(&E)
MetadataTalendTypeEditor.column1.Name=\u30E1\u30BF\u30C7\u30FC\u30BF\u30DE\u30C3\u30D4\u30F3\u30B0\u30D5\u30A1\u30A4\u30EB
MetadataTalendTypeEditor.editMappingDialog.title=\u30DE\u30C3\u30D4\u30F3\u30B0\u30D5\u30A1\u30A4\u30EB\u3092\u7DE8\u96C6
MetadataTalendTypeEditor.error.message=\u30A8\u30E9\u30FC\u30E1\u30C3\u30BB\u30FC\u30B8
MetadataTalendTypeEditor.fileIsImported=\u3053\u306E\u30D5\u30A1\u30A4\u30EB\u306F\u65E2\u306B\u30A4\u30F3\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u3059\u3002
MetadataTalendTypeEditor.fileOverwrite=\u3053\u306E\u30D5\u30A1\u30A4\u30EB\u306F\u65E2\u306B\u5B58\u5728\u3057\u307E\u3059\u3002\u4E0A\u66F8\u304D\u3057\u307E\u3059\u304B?
MetadataTalendTypeEditor.fileIsInvalid=\u30A4\u30F3\u30DD\u30FC\u30C8\u3055\u308C\u305F\u30E1\u30BF\u30C7\u30FC\u30BF\u30D5\u30A1\u30A4\u30EB\u304C\u7121\u52B9\u3067\u3059\u3002
MetadataTalendTypeEditor.fileNameStartRule=\u30D5\u30A1\u30A4\u30EB\u540D\u306F 'mapping_' \u3067\u59CB\u3081\u3066\u304F\u3060\u3055\u3044\u3002
ContextModeSelectPage.contextModes=\u65B0\u898F\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u3092\u4F5C\u6210\u3059\u308B\u304B\u3001\u65E2\u5B58\u306E\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u3092\u518D\u4F7F\u7528

View File

@@ -510,10 +510,12 @@ InegerCellEditorListener.NumeralMessage=\u8F93\u5165\u503C\u65E0\u6548
MetadataTalendTypeEditor.button.edit=\u7F16\u8F91(&D)
MetadataTalendTypeEditor.button.export=\u5BFC\u51FA(&X)
MetadataTalendTypeEditor.button.import=\u5BFC\u5165 (&M)
MetadataTalendTypeEditor.button.restore=\u6062\u590D (&E)
MetadataTalendTypeEditor.column1.Name=\u5143\u6570\u636E\u6620\u5C04\u6587\u4EF6
MetadataTalendTypeEditor.editMappingDialog.title=\u7F16\u8F91\u6620\u5C04\u6587\u4EF6
MetadataTalendTypeEditor.error.message=\u9519\u8BEF\u6D88\u606F
MetadataTalendTypeEditor.fileIsImported=\u6B64\u6587\u4EF6\u5DF2\u88AB\u5BFC\u5165\u3002
MetadataTalendTypeEditor.fileOverwrite=\u6B64\u6587\u4EF6\u5DF2\u5B58\u5728\uFF0C\u8986\u76D6\u5417?
MetadataTalendTypeEditor.fileIsInvalid=\u5BFC\u5165\u7684\u5143\u6570\u636E\u6587\u4EF6\u65E0\u6548\u3002
MetadataTalendTypeEditor.fileNameStartRule=\u6587\u4EF6\u540D\u5FC5\u987B\u4EE5 'mapping_' \u5F00\u5934\u3002
ContextModeSelectPage.contextModes=\u521B\u5EFA\u4E00\u4E2A\u65B0\u7684\u73AF\u5883\u6216\u91CD\u65B0\u4F7F\u7528\u73B0\u6709\u7684\u73AF\u5883

View File

@@ -14,7 +14,7 @@
<!-- Seems those 3 are not useful -->
<classloader
index="HIVE:HORTONWORKS:HDP_1_0:EMBEDDED"
libraries="hive-hbase-handler-0.9.0.jar;hbase-0.92.0.jar;hadoop-core-1.0.3.jar;commons-logging-1.0.4.jar;datanucleus-api-jdo-3.0.7.jar;datanucleus-core-3.0.9.jar;datanucleus-rdbms-3.0.8.jar;hive-builtins-0.9.0.jar;hive-exec-0.9.0_hdp.jar;hive-jdbc-0.9.0_hdp.jar;hive-metastore-0.9.0_hdp.jar;hive-service-0.9.0_hdp.jar;libfb303-0.7.0.jar;libthrift-0.7.0.jar;commons-lang-2.4.jar;antlr-runtime-3.0.1.jar;commons-dbcp-1.4.jar;commons-pool-1.5.4.jar;derby-10.4.2.0.jar;commons-configuration-1.6.jar;jdo2-api-2.3-ec.jar;reload4j-1.2.19.jar;slf4j-api-1.6.1.jar;slf4j-log4j12-1.6.1.jar;jackson-core-asl-1.8.8.jar;jackson-mapper-asl-1.8.8.jar">
libraries="hive-hbase-handler-0.9.0.jar;hbase-0.92.0.jar;hadoop-core-1.0.3.jar;commons-logging-1.0.4.jar;datanucleus-api-jdo-3.0.7.jar;datanucleus-core-3.0.9.jar;datanucleus-rdbms-3.0.8.jar;hive-builtins-0.9.0.jar;hive-exec-0.9.0_hdp.jar;hive-jdbc-0.9.0_hdp.jar;hive-metastore-0.9.0_hdp.jar;hive-service-0.9.0_hdp.jar;libfb303-0.7.0.jar;libthrift-0.7.0.jar;commons-lang-2.4.jar;antlr-runtime-3.0.1.jar;commons-dbcp-1.4.jar;commons-pool-1.5.4.jar;derby-10.4.2.0.jar;commons-configuration2-2.8.0.jar;jdo2-api-2.3-ec.jar;reload4j-1.2.19.jar;slf4j-api-1.6.1.jar;slf4j-log4j12-1.6.1.jar;jackson-core-asl-1.8.8.jar;jackson-mapper-asl-1.8.8.jar">
</classloader>
<classloader
index="HIVE:AMAZON_EMR:MapR_EMR:STANDALONE"

View File

@@ -36,7 +36,8 @@ Require-Bundle: org.eclipse.core.runtime,
org.talend.core.runtime,
org.eclipse.e4.ui.workbench,
javax.inject,
org.eclipse.m2e.core
org.eclipse.m2e.core,
org.talend.singlesignon.client
Eclipse-LazyStart: true
Export-Package: org.talend.rcp,
org.talend.rcp.intro,

View File

@@ -112,7 +112,6 @@ public class Application implements IApplication {
Boolean.TRUE.toString(), false);
return IApplication.EXIT_RELAUNCH;
}
try {
String vmArgs = System.getProperty(EclipseCommandLine.PROP_VMARGS);
if (StringUtils.isNotBlank(vmArgs)) {

View File

@@ -32,6 +32,7 @@ import org.talend.commons.utils.system.EclipseCommandLine;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.core.repository.utils.LoginTaskRegistryReader;
import org.talend.core.service.ICloudSignOnService;
import org.talend.core.ui.branding.IBrandingConfiguration;
import org.talend.core.ui.branding.IBrandingService;
import org.talend.core.ui.services.IGitUIProviderService;
@@ -139,16 +140,23 @@ public class ApplicationWorkbenchAdvisor extends IDEWorkbenchAdvisor {
if (!ArrayUtils.contains(Platform.getApplicationArgs(), EclipseCommandLine.TALEND_DISABLE_LOGINDIALOG_COMMAND)) {
RegisterManagement.getInstance().validateRegistration();
}
// PerspectiveReviewUtil.checkPerspectiveDisplayItems();
}
@Override
public boolean preShutdown() {
if (IGitUIProviderService.get() != null && IGitUIProviderService.get().checkPendingChanges()) {
return false;
boolean preShutwond = super.preShutdown();
boolean commitChanges = true;
if (ICloudSignOnService.get() != null && ICloudSignOnService.get().isReloginDialogRunning()) {
commitChanges = false;
}
return super.preShutdown();
if (commitChanges && IGitUIProviderService.get() != null && IGitUIProviderService.get().checkPendingChanges()) {
preShutwond = false;
}
if (preShutwond && ICloudSignOnService.get() != null) {
ICloudSignOnService.get().stopHeartBeat();
}
return preShutwond;
}
}

View File

@@ -67,7 +67,7 @@ public class TalendForgeRegistHelper {
IntroContentParser parser = new IntroContentParser(result);
Document dom = parser.getDocument();
if (dom != null) {
boolean cloud = IRemoteService.get().isCloudConnection();
boolean cloud = IRemoteService.get() != null && IRemoteService.get().isCloudConnection();
Element ele = dom.createElement("licensetype");
ele.setAttribute("id", "license_cloud");
ele.setAttribute("isCloud",""+cloud);

View File

@@ -1207,6 +1207,7 @@ public class ImportItemsWizardPage extends WizardPage {
public boolean performFinish() {
final List<ImportItem> checkedItemRecords = getCheckedElements();
final IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
importManager.getPendoImportManager().cacheItemProperty(checkedItemRecords);
/*
* ?? prepare to do import, unlock the existed one, and make sure the overwrite to work well.
@@ -1260,11 +1261,12 @@ public class ImportItemsWizardPage extends WizardPage {
final ResourceOption importOption = ResourceOption.ITEM_IMPORTATION;
try {
EmfResourcesFactoryReader.INSTANCE.addOption(importOption, false);
importManager.getPendoImportManager().setStudioImport(true);
importManager.importItemRecords(monitor, resManager, checkedItemRecords, overwrite,
nodesBuilder.getAllImportItemRecords(), destinationPath, alwaysRegenId);
} finally {
EmfResourcesFactoryReader.INSTANCE.removOption(importOption, false);
importManager.getPendoImportManager().sendTrackToPendo();
}
Display.getDefault().syncExec(new Runnable() {

View File

@@ -102,6 +102,8 @@ public class ImportExportHandlersManager {
private ChangeIdManager changeIdManager = new ChangeIdManager();
private PendoImportManager pendoImportManager = new PendoImportManager();
public ImportExportHandlersManager() {
registryReader = ImportExportHandlersRegistryReader.getInstance();
}
@@ -796,7 +798,7 @@ public class ImportExportHandlersManager {
if (monitor.isCanceled()) {
return;
}
pendoImportManager.countItem(itemRecord);
// will import
importHandler.doImport(monitor, manager, itemRecord, overwriting, destinationPath);
@@ -1169,4 +1171,9 @@ public class ImportExportHandlersManager {
importItem.setProperty(null);
importItem.clear();
}
public PendoImportManager getPendoImportManager() {
return pendoImportManager;
}
}

View File

@@ -0,0 +1,255 @@
// ============================================================================
//
// Copyright (C) 2006-2022 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.repository.items.importexport.handlers;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Level;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.core.model.properties.Property;
import org.talend.core.pendo.PendoItemSignatureUtil;
import org.talend.core.pendo.PendoItemSignatureUtil.SignatureStatus;
import org.talend.core.pendo.PendoItemSignatureUtil.TOSProdNameEnum;
import org.talend.core.pendo.PendoItemSignatureUtil.ValueEnum;
import org.talend.core.pendo.PendoTrackDataUtil;
import org.talend.core.pendo.PendoTrackDataUtil.TrackEvent;
import org.talend.core.pendo.PendoTrackSender;
import org.talend.core.pendo.properties.PendoSignImportProperties;
import org.talend.core.services.ICoreTisService;
import org.talend.repository.items.importexport.handlers.model.ImportItem;
import org.talend.utils.migration.MigrationTokenUtil;
/**
* DOC jding class global comment. Detailled comment
*/
public class PendoImportManager {
private static final String seperator = "@";
private static boolean isTrackAvailable;
static {
try {
isTrackAvailable = PendoTrackSender.getInstance().isTrackSendAvailable();
} catch (Exception e) {
ExceptionHandler.process(e, Level.WARN);
}
}
private boolean isStudioImport;
private PendoSignImportProperties importProperties = new PendoSignImportProperties();
private Set<String> projectVersionSet = new HashSet<String>();
private Map<String, Integer> tosUnsignItemMap = new HashMap<String, Integer>();
private Map<String, Property> itemPropertyCache = new HashMap<String, Property>();
public void cacheItemProperty(List<ImportItem> importItemList) {
try {
// in case property change
importItemList.forEach(importItem -> {
Property property = importItem.getProperty();
if (property!=null) {
String key = property.getId() + seperator + property.getVersion();
Property propertyClone = EcoreUtil.copy(property);
itemPropertyCache.put(key, propertyClone);
}
});
} catch (Exception e) {
ExceptionHandler.process(e, Level.WARN);
}
}
public void countItem(ImportItem itemRecord) {
if (!isTrackRequired()) {
return;
}
try {
Property property = getCachedProperty(itemRecord);
if (property == null) {
property = itemRecord.getProperty();
}
ICoreTisService tisService = ICoreTisService.get();
if (tisService != null) {
Integer verifyResult = tisService.getSignatureVerifyResult(itemRecord.getProperty(), itemRecord.getPath(), false);
if (itemRecord.getProperty() != null && itemRecord.getProperty().eResource() != null && verifyResult == null) {
// item no need to sign
importProperties.setValidItems(importProperties.getValidItems() + 1);
} else {
switch (verifyResult) {
case SignatureStatus.V_VALID:
importProperties.setValidItems(importProperties.getValidItems() + 1);
break;
case SignatureStatus.V_UNSIGNED:
String itemProductName = PendoItemSignatureUtil.getItemProductName(property);
if (StringUtils.isNotBlank(itemProductName)) {
String tosCategory = TOSProdNameEnum.getTOSCategoryByProdName(itemProductName);
if (StringUtils.isBlank(tosCategory)) {
importProperties.setUnsignEEItems(importProperties.getUnsignEEItems() + 1);
} else {
if (tosUnsignItemMap.get(tosCategory) == null) {
tosUnsignItemMap.put(tosCategory, 0);
}
tosUnsignItemMap.put(tosCategory, tosUnsignItemMap.get(tosCategory) + 1);
}
}
break;
}
}
}
String itemProductVersion = PendoItemSignatureUtil.getItemProductVersion(property);
if (StringUtils.isNotBlank(itemProductVersion)) {
projectVersionSet.add(itemProductVersion);
}
} catch (Exception e) {
ExceptionHandler.process(e, Level.WARN);
}
}
protected void collectProperties() {
if (!isTrackRequired()) {
return;
}
importProperties.setUnsignSEItems(getSortTOSUnsignItems(tosUnsignItemMap));
List<String> sourceVersion = new ArrayList<String>(projectVersionSet);
Collections.sort(sourceVersion);
importProperties.setSourceVersion(sourceVersion);
importProperties.setStudioVersion(PendoItemSignatureUtil.getStudioVersion());
ICoreTisService tisService = ICoreTisService.get();
if (tisService != null) {
if (tisService.isInValidGP()) {
importProperties.setGracePeriod(ValueEnum.YES.getDisplayValue());
} else {
importProperties.setGracePeriod(ValueEnum.NO.getDisplayValue());
}
}
String prodDate = PendoItemSignatureUtil.formatDate(System.getProperty(PendoItemSignatureUtil.PROD_DATE_ID),
"yyyy-MM-dd");
importProperties.setInstallDate(prodDate);
String projectCreateDate = PendoItemSignatureUtil.getCurrentProjectCreateDate();
importProperties.setProjectCreateDate(PendoItemSignatureUtil.formatDate(projectCreateDate, "yyyy-MM-dd"));
String value = System.getProperty(PendoItemSignatureUtil.MIGRATION_TOKEN_KEY);
Map<String, Date> tokenTime = MigrationTokenUtil.getMigrationTokenTime(value);
if (tokenTime == null || tokenTime.isEmpty()) {
importProperties.setValidMigrationToken(ValueEnum.NOT_APPLICATE.getDisplayValue());
} else if (tisService != null) {
String customer = tisService.getLicenseCustomer();
Date tokenDate = tokenTime.get(customer);
Date currentDate = new Date();
if (tokenDate != null && tokenDate.after(currentDate)) {
importProperties.setValidMigrationToken(ValueEnum.YES.getDisplayValue());
} else {
importProperties.setValidMigrationToken(ValueEnum.NO.getDisplayValue());
}
}
}
private String getSortTOSUnsignItems(Map<String, Integer> tosUnsignItemMap) {
List<Map.Entry<String, Integer>> resultMapList = new ArrayList<Map.Entry<String, Integer>>(tosUnsignItemMap.entrySet());
Collections.sort(resultMapList, new Comparator<Map.Entry<String, Integer>>() {
@Override
public int compare(Entry<String, Integer> o1, Entry<String, Integer> o2) {
List<TOSProdNameEnum> categoryList = Arrays.asList(TOSProdNameEnum.values());
TOSProdNameEnum category1 = TOSProdNameEnum.valueOf(o1.getKey());
TOSProdNameEnum category2 = TOSProdNameEnum.valueOf(o2.getKey());
return categoryList.indexOf(category1) - categoryList.indexOf(category2);
}
});
Map<String, Integer> tosUnsignMap = new LinkedHashMap<String, Integer>();
resultMapList.forEach(entry -> {
tosUnsignMap.put(entry.getKey(), entry.getValue());
});
return PendoTrackDataUtil.convertEntityJsonString(tosUnsignMap);
}
private Property getCachedProperty(ImportItem itemRecord) {
Property property = null;
Property recordProperty = itemRecord.getProperty();
if (recordProperty != null) {
String key = recordProperty.getId() + seperator + recordProperty.getVersion();
return itemPropertyCache.get(key);
}
return property;
}
public boolean isTrackRequired() {
return ICoreTisService.get() != null && isStudioImport && isTrackAvailable;
}
public void setStudioImport(boolean isStudioImport) {
this.isStudioImport = isStudioImport;
}
public Set<String> getProjectVersionSet() {
return projectVersionSet;
}
public Map<String, Integer> getTosUnsignItemMap() {
return tosUnsignItemMap;
}
public PendoSignImportProperties getImportProperties() {
return importProperties;
}
public void sendTrackToPendo() {
if (!isTrackRequired()) {
return;
}
Job job = new Job("send pendo track") {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
if (isTrackAvailable) {
collectProperties();
PendoTrackSender.getInstance().sendTrackData(TrackEvent.ITEM_IMPORT, importProperties);
}
} catch (Exception e) {
// warning only
ExceptionHandler.process(e, Level.WARN);
}
return Status.OK_STATUS;
}
};
job.setUser(false);
job.setPriority(Job.INTERACTIVE);
job.schedule();
}
}

View File

@@ -17,5 +17,5 @@ repository.metadataGenericSchema=\u6C4E\u7528\u30B9\u30AD\u30FC\u30DE
repository.metadataGenericSchema.alias=GENERIC
repository.metadataDbConnection=DB\u63A5\u7D9A
repository.metadataConnections.alias=DB
repository.metadataFileDelimited=\u533A\u5207\u308A\u6587\u5B57\u4ED8\u304D\u30D5\u30A1\u30A4\u30EB
repository.metadataFileDelimited=\u533A\u5207\u308A\u4ED8\u304D\u30D5\u30A1\u30A4\u30EB
repository.metadataFileDelimited.alias=DELIM

Binary file not shown.

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry exported="true" kind="lib" path="lib/commons-exec.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.talend.signon.util</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature>
</natures>
</projectDescription>

View File

@@ -0,0 +1,20 @@
Manifest-Version: 1.0
Automatic-Module-Name: org.talend.signon.util
Bundle-ManifestVersion: 2
Bundle-Name: Cloud sign on util
Bundle-SymbolicName: org.talend.signon.util;singleton:=true
Bundle-Version: 8.0.1.qualifier
Eclipse-LazyStart: true
Bundle-ClassPath: .,
lib/commons-exec.jar
Bundle-Vendor: .Talend SA.
Import-Package: org.osgi.framework;version="1.10.0",
org.talend.utils.json
Export-Package: org.talend.signon.util,
org.talend.signon.util.i18n,
org.talend.signon.util.listener
Require-Bundle: org.talend.utils;bundle-version="8.0.1",
org.apache.log4j;bundle-version="1.2.19",
org.eclipse.osgi,
org.eclipse.equinox.common,
org.eclipse.core.runtime

View File

@@ -0,0 +1 @@
jarprocessor.exclude.children=true

View File

@@ -0,0 +1,8 @@
source.. = src/main/java/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
schema/,\
lib/commons-exec.jar

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
</plugin>

View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>8.0.1-SNAPSHOT</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.signon.util</artifactId>
<packaging>eclipse-plugin</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<!-- same as org.talend.libraries.excel -->
<id>copy-maven-repository</id>
<phase>generate-sources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<stripVersion>true</stripVersion>
<outputDirectory>${project.basedir}/lib</outputDirectory>
<artifactItems>
<artifactItem>
<groupId>org.apache.commons</groupId>
<artifactId>commons-exec</artifactId>
<version>1.3</version>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,6 @@
TMCRepositoryUtil.ap.displayName=Asia Pacific on AWS
TMCRepositoryUtil.au.displayName=Australia on AWS
TMCRepositoryUtil.eu.displayName=Europe on AWS
TMCRepositoryUtil.us.displayName=United States - East on AWS
TMCRepositoryUtil.us-west.displayName=United States - West on Azure
SSOClientExec.error.timeout=Timeout waiting for login

View File

@@ -0,0 +1,55 @@
// ============================================================================
//
// Copyright (C) 2006-2021 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.signon.util;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.core.runtime.Platform;
/**
* DOC amaumont class global comment. Detailled comment <br/>
*
*/
public class EnvironmentUtils {
public static boolean isWindowsSystem() {
return getEnvOs().startsWith("Windows"); //$NON-NLS-1$
}
public static boolean isLinuxUnixSystem() {
return !isWindowsSystem() && !isMacOsSytem();
}
/**
* DOC amaumont Comment method "isMacOsSytem".
*
* @return
*/
public static boolean isMacOsSytem() {
return getEnvOs().startsWith("Mac"); //$NON-NLS-1$
}
/**
* DOC amaumont Comment method "getEnv".
*/
public static String getEnvOs() {
return System.getProperty("os.name"); //$NON-NLS-1$
}
public static boolean isX86_64() {
return StringUtils.equals(Platform.ARCH_X86_64, Platform.getOSArch());
}
public static boolean isAarch64() {
return StringUtils.equals(Platform.ARCH_AARCH64, Platform.getOSArch());
}
}

View File

@@ -0,0 +1,120 @@
// ============================================================================
//
// Copyright (C) 2006-2021 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.signon.util;
import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import org.eclipse.osgi.service.datalocation.Location;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Filter;
import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceReference;
import org.osgi.util.tracker.ServiceTracker;
public class EquinoxUtils {
public static URL[] getConfigAreaURL(BundleContext context) {
Location configLocation = getConfigLocation(context);
if (configLocation == null) {
return null;
}
URL baseURL = configLocation.getURL();
if (configLocation.getParentLocation() != null && configLocation.getURL() != null) {
if (baseURL == null) {
return new URL[] { configLocation.getParentLocation().getURL() };
} else {
return new URL[] { baseURL, configLocation.getParentLocation().getURL() };
}
}
if (baseURL != null) {
return new URL[] { baseURL };
}
return null;
}
public static Location getConfigLocation(BundleContext context) {
Filter filter = null;
try {
filter = context.createFilter(Location.CONFIGURATION_FILTER);
} catch (InvalidSyntaxException e) {
// should not happen
}
ServiceTracker configLocationTracker = new ServiceTracker(context, filter, null);
configLocationTracker.open();
try {
return (Location) configLocationTracker.getService();
} finally {
configLocationTracker.close();
}
}
public static URI getInstallLocationURI(BundleContext context) {
try {
ServiceReference[] references = context.getServiceReferences(Location.class.getName(), Location.INSTALL_FILTER);
if (references != null && references.length > 0) {
ServiceReference reference = references[0];
Location installLocation = (Location) context.getService(reference);
if (installLocation != null) {
try {
if (installLocation.isSet()) {
URL location = installLocation.getURL();
return URIUtil.toURI(location);
}
} catch (URISyntaxException e) {
// TODO: log an error
} finally {
context.ungetService(reference);
}
}
}
} catch (InvalidSyntaxException e) {
// TODO: log an error
}
return null;
}
// always return a valid bundlesContext or throw a runtimeException
public static BundleContext getCurrentBundleContext() {
Bundle bundle = FrameworkUtil.getBundle(EquinoxUtils.class);
if (bundle != null) {
BundleContext bundleContext = bundle.getBundleContext();
if (bundleContext != null) {
return bundleContext;
} else {
throw new RuntimeException(
"could not find current BundleContext, this should never happen, check that the bunlde is activated when this class is accessed");
}
} else {
throw new RuntimeException(
"could not find current Bundle, this should never happen, check that the bunlde is activated when this class is accessed");
}
}
public static File getConfigurationFolder() {
BundleContext configuratorBundleContext = getCurrentBundleContext();
final URL url = getConfigLocation(configuratorBundleContext).getURL();
try {
return URIUtil.toFile(URIUtil.toURI(url));
} catch (URISyntaxException e) {
//
}
return null;
}
}

View File

@@ -0,0 +1,118 @@
// ============================================================================
//
// Copyright (C) 2006-2021 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.signon.util;
import java.io.File;
import java.io.UnsupportedEncodingException;
import org.apache.commons.exec.CommandLine;
import org.apache.commons.exec.DefaultExecutor;
import org.apache.commons.exec.ExecuteWatchdog;
import org.apache.log4j.Logger;
import org.eclipse.equinox.app.IApplication;
import org.talend.signon.util.i18n.Messages;
import org.talend.signon.util.listener.LoginEventListener;
public class SSOClientExec implements Runnable {
private static Logger LOGGER = Logger.getLogger(SSOClientExec.class);
public static final String STUDIO_CALL_PREFIX = "studioCall:";
private static final String STUDIO_SSO_CLIENT_DEBUG_PORT = "talend.studio.sso.client.debug.port";
private static final int EXIT_BY_TIMEOUT = -99;
private File execFile;
private String codeChallenge;
private String clientId;
private int port;
private ExecuteWatchdog executeWatchdog;
private Exception error;
private LoginEventListener listener;
public SSOClientExec(File execFile, String clientId, String codeChallenge, int port, LoginEventListener listener) {
this.execFile = execFile;
this.clientId = clientId;
this.codeChallenge = codeChallenge;
this.port = port;
this.listener = listener;
}
@Override
public void run() {
int exitValue = 0;
try {
CommandLine cmdLine = new CommandLine(execFile);
cmdLine.addArgument(getInvokeParameter(clientId, port));
if (getClientDebugPort() != null) {
cmdLine.addArgument("-vmargs");
cmdLine.addArgument("-Xdebug");
String cmd = "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=*:" + getClientDebugPort();
cmdLine.addArgument(cmd);
}
DefaultExecutor executor = new DefaultExecutor();
executeWatchdog = new ExecuteWatchdog(600000);
executor.setWatchdog(executeWatchdog);
executor.setExitValues(new int[] { 0, 24 });
if (!execFile.canExecute()) {
execFile.setExecutable(true);
}
executor.setWorkingDirectory(execFile.getParentFile());
exitValue = executor.execute(cmdLine);
if (IApplication.EXIT_RELAUNCH == exitValue) {
cmdLine = new CommandLine(execFile);
if (getClientDebugPort() != null) {
cmdLine.addArgument("-vmargs");
cmdLine.addArgument("-Xdebug");
String cmd = "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=*:" + getClientDebugPort();
cmdLine.addArgument(cmd);
}
exitValue = executor.execute(cmdLine);
}
} catch (Exception e) {
error = e;
if (EXIT_BY_TIMEOUT == exitValue) {
LOGGER.error("SSO client exited by timeout.");
listener.loginFailed(new Exception(Messages.getString("SSOClientExec.error.timeout")));
} else {
LOGGER.error(e);
listener.loginFailed(e);
}
}
}
private String getClientDebugPort() {
return System.getProperty(STUDIO_SSO_CLIENT_DEBUG_PORT);
}
private String getInvokeParameter(String clientID, int callbackPort) throws UnsupportedEncodingException {
return STUDIO_CALL_PREFIX + SSOClientUtil.getInstance().getSignOnURL(clientID, codeChallenge, callbackPort);
}
public void stop() {
if (executeWatchdog != null && !executeWatchdog.killedProcess()) {
executeWatchdog.destroyProcess();
}
}
public Exception getError() {
return error;
}
}

View File

@@ -0,0 +1,121 @@
// ============================================================================
//
// Copyright (C) 2006-2021 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.signon.util;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.Properties;
import org.apache.log4j.Logger;
import org.eclipse.core.runtime.FileLocator;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.talend.utils.io.FilesUtils;
public class SSOClientInstaller {
private static Logger LOGGER = Logger.getLogger(SSOClientInstaller.class);
private final String SIGN_CLIENT_BUNDLE_NAME = "org.talend.singlesignon.client";
private final String installFileName = "TalendSignTool.zip";
private final String version = "8.0.1.202206081050";
private static final SSOClientInstaller instance = new SSOClientInstaller();
public static SSOClientInstaller getInstance() {
return instance;
}
private SSOClientInstaller() {
}
public boolean isNeedInstall() {
String installedVersion = getInstalledVersion();
if (installedVersion != null && installedVersion.compareTo(version) >= 0) {
return false;
}
return true;
}
public void install() throws Exception {
File sourceFile = getInstallFile();
if (!sourceFile.exists()) {
LOGGER.error("Can't find install file:" + sourceFile.getAbsolutePath());
}
File targetFolder = getInstallDir();
if (targetFolder.exists()) {
targetFolder.delete();
LOGGER.info("Deleted target folder:" + targetFolder.getAbsolutePath());
}
targetFolder.mkdirs();
LOGGER.info("Created target folder:" + targetFolder.getAbsolutePath());
FilesUtils.unzip(sourceFile.getAbsolutePath(), targetFolder.getAbsolutePath(), true);
LOGGER.info("Installed login client:" + targetFolder.getAbsolutePath());
}
private String getInstalledVersion() {
FileInputStream in = null;
try {
File eclipseProductFile = getEclipseProductFile();
if (eclipseProductFile != null && eclipseProductFile.exists()) {
Properties p = new Properties();
in = new FileInputStream(eclipseProductFile);
p.load(in);
String productFileVersion = p.getProperty("version"); //$NON-NLS-1$
return productFileVersion;
}
} catch (Exception e) {
LOGGER.error(e);
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
LOGGER.error(e);
}
}
}
return null;
}
private File getEclipseProductFile() throws URISyntaxException {
File eclipseproductFile = new File(getInstallDir(), ".eclipseproduct");//$NON-NLS-1$
return eclipseproductFile;
}
protected File getInstallDir() {
return SSOClientUtil.getSSOClientFolder();
}
protected File getInstallFile() throws IOException {
BundleContext context = EquinoxUtils.getCurrentBundleContext();
Bundle[] bundles = context.getBundles();
Bundle bundle = null;
for (Bundle b : bundles) {
if (SIGN_CLIENT_BUNDLE_NAME.equals(b.getSymbolicName())) {
bundle = b;
break;
}
}
if (bundle != null) {
File bundleFile = FileLocator.getBundleFile(bundle).getAbsoluteFile();
File folder = new File(bundleFile, "repository");
File installFile = new File(folder, installFileName);
return installFile;
}
return null;
}
}

View File

@@ -0,0 +1,206 @@
// ============================================================================
//
// Copyright (C) 2006-2021 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.signon.util;
import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.apache.log4j.Logger;
import org.talend.signon.util.listener.LoginEventListener;
public class SSOClientMonitor implements Runnable {
private static Logger LOGGER = Logger.getLogger(SSOClientMonitor.class);
private static final String STUDIO_AUTH_CODE_KEY = "code";
private static final String STUDIO_AUTH_STATE_KEY = "state";
private static final String STUDIO_CALLBACK_PREFIX = "studioCallback:";
private static final SSOClientMonitor instance = new SSOClientMonitor();
private static int listenPort = -1;
private static volatile boolean isRunning = false;
private Set<LoginEventListener> listenerSet = new HashSet<LoginEventListener>();
public static SSOClientMonitor getInscance() {
return instance;
}
private SSOClientMonitor() {
}
private void processData(String msg) {
if (msg.startsWith(STUDIO_CALLBACK_PREFIX)) {
msg = msg.substring(STUDIO_CALLBACK_PREFIX.length());
}
Map<String, String> data = decodeMsg(msg);
String code = data.get(STUDIO_AUTH_CODE_KEY);
String state = data.get(STUDIO_AUTH_STATE_KEY);
String[] splits = state.split(",");
String dateCenter = TMCRepositoryUtil.getDefaultDataCenter();
if (splits.length == 2) {
dateCenter = splits[1];
}
fireLoginStop(code, dateCenter);
}
private Map<String, String> decodeMsg(String data) {
Map<String, String> map = new HashMap<String, String>();
if (data.startsWith(STUDIO_CALLBACK_PREFIX)) {
data = data.substring(STUDIO_CALLBACK_PREFIX.length());
}
if (data.startsWith(SSOUtil.STUDIO_REDIRECT_URL)) {
data = data.substring(SSOUtil.STUDIO_REDIRECT_URL.length());
}
if (data.startsWith("?")) {
data = data.substring("?".length());
}
String[] splits = data.split("&");
for (int i = 0; i < splits.length; i++) {
String str = splits[i];
String[] spls = str.split("=");
if (spls.length == 2) {
map.put(spls[0], spls[1]);
} else {
LOGGER.error("Parse msg error is should be contains =:" + str);
}
}
return map;
}
public void stop() {
isRunning = false;
listenPort = -1;
}
private Integer newPort() {
final Integer port = Integer.getInteger("stduio.login.client.monitor.port", -1);
if (port <= 0) {
try (ServerSocket socket = new ServerSocket(0)) {
socket.setReuseAddress(true);
return socket.getLocalPort();
} catch (final IOException e) {
throw new IllegalStateException(e);
}
}
return port;
}
private void fireLoginStop(String code, String dataCenter) {
for (LoginEventListener l : listenerSet) {
try {
l.loginStop(code, dataCenter);
} catch (Exception ex) {
LOGGER.info(ex);
}
}
}
private void fireLoginStart() {
for (LoginEventListener l : listenerSet) {
try {
l.loginStart();
} catch (Exception ex) {
LOGGER.info(ex);
}
}
}
private void fireLoginFailed(Exception ex) {
for (LoginEventListener l : listenerSet) {
try {
l.loginFailed(ex);
} catch (Exception e) {
LOGGER.info(e);
}
}
}
public void addLoginEventListener(LoginEventListener listener) {
listenerSet.add(listener);
}
public void removeLoginEventListener(LoginEventListener listener) {
if (listenerSet.contains(listener)) {
listenerSet.remove(listener);
}
}
public int getListenPort() {
return listenPort;
}
@Override
public void run() {
if (isRunning) {
LOGGER.info("Login client monitor started.");
return;
}
listenPort = newPort();
ServerSocket server;
try {
server = new ServerSocket(listenPort);
LOGGER.info("Start sso client monitor on " + listenPort);
isRunning = true;
fireLoginStart();
while (isRunning) {
Socket socket = server.accept();
try {
InputStream inputStream = socket.getInputStream();
byte[] bytes = new byte[1024];
int len;
StringBuilder sb = new StringBuilder();
while ((len = inputStream.read(bytes)) != -1) {
sb.append(new String(bytes, 0, len, StandardCharsets.UTF_8));
}
inputStream.close();
processData(sb.toString());
stop();
LOGGER.info("Stop sso client monitor");
break;
} catch (Exception e) {
LOGGER.error(e);
fireLoginFailed(e);
} finally {
try {
socket.close();
} catch (IOException e) {
LOGGER.error(e);
fireLoginFailed(e);
}
}
}
} catch (Exception ex) {
LOGGER.error(ex);
fireLoginFailed(ex);
}
}
public static boolean isRunning() {
return isRunning;
}
}

View File

@@ -0,0 +1,145 @@
// ============================================================================
//
// Copyright (C) 2006-2021 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.signon.util;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.concurrent.TimeUnit;
import org.apache.log4j.Logger;
import org.talend.signon.util.listener.LoginEventListener;
public class SSOClientUtil {
private static Logger LOGGER = Logger.getLogger(SSOClientUtil.class);
private static final String STUDIO_CLIENT_ID = "0c51933d-c542-4918-9baf-86ef709af5d8";
private static final String CLIENT_FILE_PATH_PROPERTY = "talend.studio.signon.client.path";
private static final String CLIENT_FILE_NAME_ON_WINDOWS = "Talend_Sign_On_Tool_win-x86_64.exe";
private static final String CLIENT_FILE_NAME_ON_LINUX_X86 = "Talend_Sign_On_Tool_linux_gtk_x86_64";
private static final String CLIENT_FILE_NAME_ON_LINUX_AARCH64 = "Talend_Sign_On_Tool_linux_gtk_aarch64";
private static final String CLIENT_FILE_NAME_ON_MAC_X86 = "Talend_Sign_On_Tool.app";
private static final String CLIENT_FILE_NAME_ON_MAC_AARCH64 = "Talend_Sign_On_Tool_aarch64.app";
private static final String CLIENT_FOLDER_NAME = "studio_sso_client";
static final String DATA_CENTER_KEY = "talend.tmc.datacenter";
static final String DATA_CENTER_DISPLAY_KEY = "talend.tmc.datacenter.display";
private static final SSOClientUtil instance = new SSOClientUtil();
private SSOClientExec signOnClientExec;
private SSOClientUtil() {
if (SSOClientInstaller.getInstance().isNeedInstall()) {
try {
SSOClientInstaller.getInstance().install();
} catch (Exception e) {
LOGGER.error(e);
}
}
}
public String getClientID() throws IOException {
return STUDIO_CLIENT_ID;
}
public File getSSOClientAppFile() throws Exception {
if (System.getProperty(CLIENT_FILE_PATH_PROPERTY) != null) {
return new File(System.getProperty(CLIENT_FILE_PATH_PROPERTY));
}
File folder = getSSOClientFolder();
if (EnvironmentUtils.isWindowsSystem()) {
return new File(folder, CLIENT_FILE_NAME_ON_WINDOWS);
} else if (EnvironmentUtils.isLinuxUnixSystem()) {
if (EnvironmentUtils.isX86_64()) {
return new File(folder, CLIENT_FILE_NAME_ON_LINUX_X86);
} else if (EnvironmentUtils.isAarch64()) {
return new File(folder, CLIENT_FILE_NAME_ON_LINUX_AARCH64);
}
} else if (EnvironmentUtils.isMacOsSytem()) {
File appFolder = null;
if (EnvironmentUtils.isX86_64()) {
appFolder = new File(folder, CLIENT_FILE_NAME_ON_MAC_X86);
} else if (EnvironmentUtils.isAarch64()) {
appFolder = new File(folder, CLIENT_FILE_NAME_ON_MAC_AARCH64);
}
if (appFolder != null) {
return new File(appFolder, "Contents/MacOS/Talend_Sign_On_Tool");
}
}
throw new Exception("Unsupported OS");
}
public static File getSSOClientFolder() {
File configFolder = EquinoxUtils.getConfigurationFolder();
File signClientFolder = new File(configFolder, CLIENT_FOLDER_NAME);
return signClientFolder;
}
private synchronized void startSignOnClient(LoginEventListener listener) throws Exception {
if (signOnClientExec != null) {
signOnClientExec.stop();
}
String clientId = getClientID();
File execFile = getSSOClientAppFile();
String codeChallenge = listener.getCodeChallenge();
LOGGER.info("Prepare to start login cloud client monitor");
SSOClientMonitor signOnClientListener = SSOClientMonitor.getInscance();
signOnClientListener.addLoginEventListener(listener);
new Thread(signOnClientListener).start();
LOGGER.info("Login cloud client monitor started.");
while (!SSOClientMonitor.isRunning()) {
TimeUnit.MILLISECONDS.sleep(100);
}
if (signOnClientListener.getListenPort() < 0) {
throw new Exception("Login cloud client monitor start failed.");
}
LOGGER.info("Prepare to start cloud client on " + signOnClientListener.getListenPort());
signOnClientExec = new SSOClientExec(execFile, clientId, codeChallenge, signOnClientListener.getListenPort(), listener);
new Thread(signOnClientExec).start();
LOGGER.info("Login cloud client started.");
}
public static SSOClientUtil getInstance() {
return instance;
}
public void signOnCloud(LoginEventListener listener) throws Exception {
SSOClientUtil.getInstance().startSignOnClient(listener);
}
public String getSignOnURL(String clientID, String codeChallenge, int callbackPort) throws UnsupportedEncodingException {
String dataCenter = TMCRepositoryUtil.getDefaultDataCenter();
StringBuffer urlSB = new StringBuffer();
urlSB.append(TMCRepositoryUtil.getBaseLoginURL(dataCenter)).append("?");
urlSB.append("client_id=").append(clientID).append("&");
urlSB.append("redirect_uri=").append(URLEncoder.encode(TMCRepositoryUtil.getRedirectURL(dataCenter), StandardCharsets.UTF_8.name())).append("&");
urlSB.append("scope=openid refreshToken&");
urlSB.append("response_type=code&");
urlSB.append("code_challenge_method=S256&");
urlSB.append("code_challenge=").append(codeChallenge).append("&");
urlSB.append("state=").append(callbackPort).append(SSOUtil.STATE_PARAM_SEPARATOR).append(TMCRepositoryUtil.getDefaultDataCenter());
return urlSB.toString();
}
}

View File

@@ -0,0 +1,39 @@
// ============================================================================
//
// Copyright (C) 2006-2021 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.signon.util;
import java.security.MessageDigest;
import java.security.SecureRandom;
import java.util.Base64;
public class SSOUtil {
public static final String STUDIO_REDIRECT_URL = "talendstudio://code";
public static final String STATE_PARAM_SEPARATOR = ",";
public static String generateCodeVerifier() {
SecureRandom secureRandom = new SecureRandom();
byte[] codeVerifier = new byte[32];
secureRandom.nextBytes(codeVerifier);
return Base64.getUrlEncoder().withoutPadding().encodeToString(codeVerifier);
}
public static String getCodeChallenge(String seed) throws Exception {
byte[] bytes = seed.getBytes("US-ASCII");
MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
messageDigest.update(bytes, 0, bytes.length);
byte[] digest = messageDigest.digest();
return Base64.getUrlEncoder().withoutPadding().encodeToString(digest);
}
}

View File

@@ -0,0 +1,102 @@
// ============================================================================
//
// Copyright (C) 2006-2021 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.signon.util;
import org.talend.signon.util.i18n.Messages;
public class TMCRepositoryUtil {
public static final String REPOSITORY_CLOUD_US_ID = "cloud_us"; //$NON-NLS-1$
public static final String REPOSITORY_CLOUD_EU_ID = "cloud_eu"; //$NON-NLS-1$
public static final String REPOSITORY_CLOUD_APAC_ID = "cloud_apac"; //$NON-NLS-1$
public static final String REPOSITORY_CLOUD_US_WEST_ID = "cloud_us_west"; //$NON-NLS-1$
public static final String REPOSITORY_CLOUD_AUS_ID = "cloud_aus"; //$NON-NLS-1$
public static final String REPOSITORY_CLOUD_CUSTOM_ID = "cloud_custom"; //$NON-NLS-1$
public static String getBaseLoginURL(String dataCenter) {
if (dataCenter == null) {
dataCenter = TMCRepositoryUtil.getDefaultDataCenter();
}
return "https://iam." + dataCenter + ".cloud.talend.com/oidc/idp/authorize";
}
public static String getDefaultDataCenter() {
String defaultDataCenter = "us";
if (System.getProperty(SSOClientUtil.DATA_CENTER_KEY) != null) {
defaultDataCenter = System.getProperty(SSOClientUtil.DATA_CENTER_KEY);
}
return defaultDataCenter;
}
public static String getCloudAdminURL(String dataCenter) {
return "https://tmc." + dataCenter + ".cloud.talend.com/studio_cloud_connection";
}
public static String getTokenURL(String dataCenter) {
return "https://iam." + dataCenter + ".cloud.talend.com/oidc/oauth2/token";
}
public static String getRedirectURL(String dataCenter) {
if (dataCenter == null) {
dataCenter = getDefaultDataCenter();
}
return "https://iam." + dataCenter + ".cloud.talend.com/idp/login-sso-success";
}
public static String getDisplayNameByDatacenter(String dataCenter) {
if ("ap".equals(dataCenter)) {
return Messages.getString("TMCRepositoryUtil.ap.displayName");
}
if ("us".equals(dataCenter)) {
return Messages.getString("TMCRepositoryUtil.us.displayName");
}
if ("us-west".equals(dataCenter)) {
return Messages.getString("TMCRepositoryUtil.us-west.displayName");
}
if ("eu".equals(dataCenter)) {
return Messages.getString("TMCRepositoryUtil.eu.displayName");
}
if ("au".equals(dataCenter)) {
return Messages.getString("TMCRepositoryUtil.au.displayName");
}
if (System.getProperty(SSOClientUtil.DATA_CENTER_DISPLAY_KEY) != null) {
return System.getProperty(SSOClientUtil.DATA_CENTER_DISPLAY_KEY);
}
return dataCenter;
}
public static String getRepositoryId(String dataCenter) {
if ("ap".equals(dataCenter)) {
return REPOSITORY_CLOUD_APAC_ID;
}
if ("us".equals(dataCenter)) {
return REPOSITORY_CLOUD_US_ID;
}
if ("us-west".equals(dataCenter)) {
return REPOSITORY_CLOUD_US_WEST_ID;
}
if ("eu".equals(dataCenter)) {
return REPOSITORY_CLOUD_EU_ID;
}
if ("au".equals(REPOSITORY_CLOUD_AUS_ID)) {
return REPOSITORY_CLOUD_EU_ID;
}
return REPOSITORY_CLOUD_CUSTOM_ID;
}
}

View File

@@ -0,0 +1,163 @@
// ============================================================================
//
// Copyright (C) 2006-2021 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.signon.util;
import org.talend.utils.json.JSONException;
import org.talend.utils.json.JSONObject;
public class TokenMode {
private static final String ACCESS_TOKEN_KEY = "access_token";
private static final String EXPIRES_IN_KEY = "expires_in";
private static final String ID_TOKEN_KEY = "id_token";
private static final String REFRESH_TOKEN_KEY = "refresh_token";
private static final String SCOPE_KEY = "scope";
private static final String TOKEN_TYPE_KEY = "token_type";
private static final String LAST_REFRESH_TIME_KEY = "last_refresh_time";
private static final String DATA_CENTER_KEY = "data_center";
private String clientId;
private String accessToken;
private String refreshToken;
private long expiresIn;
private String idToken;
private String scope;
private String tokenType;
private String dataCenter;
private long lastRefreshTime = System.currentTimeMillis();
public String getClientId() {
return clientId;
}
public void setClientId(String clientId) {
this.clientId = clientId;
}
public String getAccessToken() {
return accessToken;
}
public void setAccessToken(String accessToken) {
this.accessToken = accessToken;
}
public String getRefreshToken() {
return refreshToken;
}
public void setRefreshToken(String refreshToken) {
this.refreshToken = refreshToken;
}
public long getExpiresIn() {
return expiresIn;
}
public void setExpiresIn(long expiresIn) {
this.expiresIn = expiresIn;
}
public String getIdToken() {
return idToken;
}
public void setIdToken(String idToken) {
this.idToken = idToken;
}
public String getScope() {
return scope;
}
public void setScope(String scope) {
this.scope = scope;
}
public String getTokenType() {
return tokenType;
}
public void setTokenType(String tokenType) {
this.tokenType = tokenType;
}
public long getLastRefreshTime() {
return lastRefreshTime;
}
public void setLastRefreshTime(long lastRefreshTime) {
this.lastRefreshTime = lastRefreshTime;
}
public String getDataCenter() {
return dataCenter;
}
public void setDataCenter(String dataCenter) {
this.dataCenter = dataCenter;
}
public static TokenMode parseFromJson(String jsonString, String dataCenter) throws JSONException {
JSONObject jsonObj = new JSONObject(jsonString);
TokenMode token = new TokenMode();
token.setAccessToken(jsonObj.getString(TokenMode.ACCESS_TOKEN_KEY));
token.setExpiresIn(jsonObj.getLong(TokenMode.EXPIRES_IN_KEY));
token.setIdToken(jsonObj.getString(TokenMode.ID_TOKEN_KEY));
token.setRefreshToken(jsonObj.getString(TokenMode.REFRESH_TOKEN_KEY));
token.setScope(jsonObj.getString(TokenMode.SCOPE_KEY));
token.setTokenType(jsonObj.getString(TokenMode.TOKEN_TYPE_KEY));
if (jsonObj.has(TokenMode.LAST_REFRESH_TIME_KEY)) {
token.setLastRefreshTime(jsonObj.getLong(TokenMode.LAST_REFRESH_TIME_KEY));
}
if (dataCenter == null && jsonObj.has(TokenMode.DATA_CENTER_KEY)) {
token.setDataCenter(jsonObj.getString(TokenMode.DATA_CENTER_KEY));
} else {
token.setDataCenter(dataCenter);
}
return token;
}
public static JSONObject writeToJson(TokenMode token) throws JSONException {
JSONObject object = new JSONObject();
object.put(TokenMode.ACCESS_TOKEN_KEY, token.getAccessToken());
object.put(TokenMode.EXPIRES_IN_KEY, token.getExpiresIn());
object.put(TokenMode.ID_TOKEN_KEY, token.getIdToken());
object.put(TokenMode.REFRESH_TOKEN_KEY, token.getRefreshToken());
object.put(TokenMode.SCOPE_KEY, token.getScope());
object.put(TokenMode.TOKEN_TYPE_KEY, token.getTokenType());
object.put(TokenMode.LAST_REFRESH_TIME_KEY, token.getLastRefreshTime());
object.put(TokenMode.DATA_CENTER_KEY, token.getDataCenter());
return object;
}
public boolean isExpired() {
return false;
}
}

View File

@@ -0,0 +1,195 @@
// ============================================================================
//
// Copyright (C) 2006-2021 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.signon.util;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
/**
* This class copies various methods from the URIUtil class in org.eclipse.equinox.common. Unless otherwise noted the
* implementations here should mirror those in the common implementation.
*/
public class URIUtil {
public static final String SCHEME_FILE = "file"; //$NON-NLS-1$
private static final String UNC_PREFIX = "//"; //$NON-NLS-1$
/**
* Appends the given extension to the path of the give base URI and returns the corresponding new path.
*
* @param base The base URI to append to
* @param extension The path extension to be added
* @return The appended URI
*/
public static URI append(URI base, String extension) {
try {
String path = base.getPath();
if (path == null)
return appendOpaque(base, extension);
// if the base is already a directory then resolve will just do the right thing
if (path.endsWith("/")) {//$NON-NLS-1$
URI result = base.resolve(extension);
// Fix UNC paths that are incorrectly normalized by URI#resolve (see Java bug 4723726)
String resultPath = result.getPath();
if (path.startsWith(UNC_PREFIX) && (resultPath == null || !resultPath.startsWith(UNC_PREFIX)))
result = new URI(result.getScheme(), "///" + result.getSchemeSpecificPart(), result.getFragment()); //$NON-NLS-1$
return result;
}
path = path + "/" + extension; //$NON-NLS-1$
return new URI(base.getScheme(), base.getUserInfo(), base.getHost(), base.getPort(), path, base.getQuery(),
base.getFragment());
} catch (URISyntaxException e) {
// shouldn't happen because we started from a valid URI
throw new RuntimeException(e);
}
}
/**
* Special case of appending to an opaque URI. Since opaque URIs have no path segment the best we can do is append
* to the scheme-specific part
*/
private static URI appendOpaque(URI base, String extension) throws URISyntaxException {
String ssp = base.getSchemeSpecificPart();
if (ssp.endsWith("/")) //$NON-NLS-1$
ssp += extension;
else
ssp = ssp + "/" + extension; //$NON-NLS-1$
return new URI(base.getScheme(), ssp, base.getFragment());
}
/**
* Returns a URI corresponding to the given unencoded string.
*
* @throws URISyntaxException If the string cannot be formed into a valid URI
*/
public static URI fromString(String uriString) throws URISyntaxException {
int colon = uriString.indexOf(':');
int hash = uriString.lastIndexOf('#');
boolean noHash = hash < 0;
if (noHash)
hash = uriString.length();
String scheme = colon < 0 ? null : uriString.substring(0, colon);
String ssp = uriString.substring(colon + 1, hash);
String fragment = noHash ? null : uriString.substring(hash + 1);
// use java.io.File for constructing file: URIs
if (scheme != null && scheme.equals(SCHEME_FILE)) {
File file = new File(uriString.substring(5));
if (file.isAbsolute())
return file.toURI();
scheme = null;
if (File.separatorChar != '/')
ssp = ssp.replace(File.separatorChar, '/');
}
return new URI(scheme, ssp, fragment);
}
/*
* Compares two URI for equality. Return false if one of them is null
*/
public static boolean sameURI(URI url1, URI url2) {
if (url1 == url2)
return true;
if (url1 == null || url2 == null)
return false;
if (url1.equals(url2))
return true;
if (url1.isAbsolute() != url2.isAbsolute())
return false;
// check if we have two local file references that are case variants
File file1 = toFile(url1);
return file1 == null ? false : file1.equals(toFile(url2));
}
/**
* Returns the URI as a local file, or <code>null</code> if the given URI does not represent a local file.
*
* @param uri The URI to return the file for
* @return The local file corresponding to the given URI, or <code>null</code>
*/
public static File toFile(URI uri) {
try {
if (!SCHEME_FILE.equalsIgnoreCase(uri.getScheme()))
return null;
// assume all illegal characters have been properly encoded, so use URI class to unencode
return new File(uri);
} catch (IllegalArgumentException e) {
// File constructor does not support non-hierarchical URI
String path = uri.getPath();
// path is null for non-hierarchical URI such as file:c:/tmp
if (path == null)
path = uri.getSchemeSpecificPart();
return new File(path);
}
}
/**
* Returns a string representation of the given URI that doesn't have illegal characters encoded. This string is
* suitable for later passing to {@link #fromString(String)}.
*
* @param uri The URI to convert to string format
* @return An unencoded string representation of the URI
*/
public static String toUnencodedString(URI uri) {
StringBuffer result = new StringBuffer();
String scheme = uri.getScheme();
if (scheme != null)
result.append(scheme).append(':');
// there is always a ssp
result.append(uri.getSchemeSpecificPart());
String fragment = uri.getFragment();
if (fragment != null)
result.append('#').append(fragment);
return result.toString();
}
/**
* Returns the URL as a URI. This method will handle broken URLs that are not properly encoded (for example they
* contain unencoded space characters).
*/
public static URI toURI(URL url) throws URISyntaxException {
// URL behaves differently across platforms so for file: URLs we parse from string form
if (SCHEME_FILE.equals(url.getProtocol())) {
String pathString = url.toExternalForm().substring(5);
// ensure there is a leading slash to handle common malformed URLs such as file:c:/tmp
if (pathString.indexOf('/') != 0)
pathString = '/' + pathString;
else if (pathString.startsWith(UNC_PREFIX) && !pathString.startsWith(UNC_PREFIX, 2)) {
// URL encodes UNC path with two slashes, but URI uses four (see bug 207103)
pathString = UNC_PREFIX + pathString;
}
return new URI(SCHEME_FILE, null, pathString, null);
}
try {
return new URI(url.toExternalForm());
} catch (URISyntaxException e) {
// try multi-argument URI constructor to perform encoding
return new URI(url.getProtocol(), url.getUserInfo(), url.getHost(), url.getPort(), url.getPath(), url.getQuery(),
url.getRef());
}
}
/**
* Returns a URI as a URL.
*
* @throws MalformedURLException
*/
public static URL toURL(URI uri) throws MalformedURLException {
return new URL(uri.toString());
}
}

View File

@@ -0,0 +1,63 @@
// ============================================================================
//
// Copyright (C) 2006-2021 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.signon.util.i18n;
import java.util.Locale;
import java.util.ResourceBundle;
/**
* DOC zwzhao class global comment. Detailled comment
*/
public class Messages extends MessagesCore {
private static final String BUNDLE_NAME = "messages"; //$NON-NLS-1$
private static final String PLUGIN_ID = "org.talend.license.gui";
private static ResourceBundle resourceBundle = ResourceBundle.getBundle(BUNDLE_NAME);
/**
* Returns the i18n formatted message for <i>key</i> in the class bundle.
*
* @param key - the key for the desired string
* @return the string for the given key in the class resource bundle
* @see MessagesCore#getString(String, ResourceBundle)
*/
public static String getString(String key) {
return getString(key, PLUGIN_ID, resourceBundle);
}
/**
* Returns the i18n formatted message for <i>key</i> and <i>args</i> in the specified bundle.
*
* @param key - the key for the desired string
* @param args - arg to include in the string
* @return the string for the given key in the given resource bundle
* @see MessagesCore#getString(String, ResourceBundle, Object[])
*/
public static String getString(String key, Object... args) {
return getString(key, PLUGIN_ID, resourceBundle, args);
}
/**
* Returns the i18n formatted message for <i>key</i> and <i>locale<i> in the class bundle.
*
* @param key - the key for the desired string
* @param locale - the locale for which a resource bundle is desired
* @return the string for the given key in the given locale resource bundle
*/
public static String getLocaleString(String key, Locale locale) {
ResourceBundle resourceBundle = ResourceBundle.getBundle(BUNDLE_NAME, locale);
return getString(key, PLUGIN_ID, resourceBundle);
}
}

View File

@@ -0,0 +1,94 @@
// ============================================================================
//
// Copyright (C) 2006-2021 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.signon.util.i18n;
import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/**
* DOC zwzhao class global comment. Detailled comment
*/
public abstract class MessagesCore {
public static final String KEY_NOT_FOUND_PREFIX = "!!!"; //$NON-NLS-1$
public static final String KEY_NOT_FOUND_SUFFIX = "!!!"; //$NON-NLS-1$
// add by wzhang for 13249, MessageFormat will not indicate {0} as i18n args if in couple single quotes.
public static final String SINGLE_QUOTE = "'"; //$NON-NLS-1$
public static final String SINGLE_QUOTE_MUTI = "''"; //$NON-NLS-1$
/**
* Returns the i18n formatted message for <i>key</i> in the specified bundle.
*
* @param key - the key for the desired string
* @param resourceBundle - the ResourceBundle to search in
* @return the string for the given key in the given resource bundle
*/
public static String getString(String key, String pluginId, ResourceBundle resourceBundle) {
if (resourceBundle == null) {
return KEY_NOT_FOUND_PREFIX + key + KEY_NOT_FOUND_SUFFIX;
}
try {
return resourceBundle.getString(key);
} catch (MissingResourceException e) {
return KEY_NOT_FOUND_PREFIX + key + KEY_NOT_FOUND_SUFFIX;
}
}
/**
* Returns the i18n formatted message for <i>key</i> and <i>args</i> in the specified bundle.
*
* @param key - the key for the desired string
* @param resourceBundle - the ResourceBundle to search in
* @param args - arg to include in the string
* @return the string for the given key in the given resource bundle
*/
// modified by wzhang. add a pluginId parameter
public static String getString(String key, String pluginId, ResourceBundle resourceBundle, Object... args) {
try {
return MessageFormat.format(getString(key, pluginId, resourceBundle).replaceAll(SINGLE_QUOTE, SINGLE_QUOTE_MUTI),
args);
} catch (Exception e) {
return KEY_NOT_FOUND_PREFIX + key + KEY_NOT_FOUND_SUFFIX;
}
}
/**
* Returns the i18n formatted message for <i>key</i> and <i>args</i> in the specified bundle.
*
* @param key - the key for the desired string
* @param resourceBundle - the ResourceBundle to search in
* @param args - arg to include in the string
* @return the string for the given key in the given resource bundle
* @deprecated
*/
public static String getString(String key, ResourceBundle resourceBundle, Object... args) {
return getString(key, null, resourceBundle, args);
}
/**
* Returns the i18n formatted message for <i>key</i> in the specified bundle.
*
* @param key - the key for the desired string
* @param resourceBundle - the ResourceBundle to search in
* @return the string for the given key in the given resource bundle
* @deprecated
*/
public static String getString(String key, ResourceBundle resourceBundle) {
return getString(key, null, resourceBundle);
}
}

View File

@@ -1,18 +1,24 @@
// ============================================================================
//
// Copyright (C) 2006-2021 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.commons.utils.network;
public interface ITalendNexusPrefConstants {
public static final String NEXUS_TIMEOUT = "NEXUS_TIMEOUT"; //$NON-NLS-1$
}
// ============================================================================
//
// Copyright (C) 2006-2021 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.signon.util.listener;
public interface LoginEventListener {
public void loginStart();
public void loginStop(String authCode, String dataCenter);
public void loginFailed(Exception ex);
public String getCodeChallenge();
}

View File

@@ -112,6 +112,7 @@
<module>main/plugins/org.talend.themes.css.talend</module>
<module>main/plugins/org.talend.designer.maven.tos/resources</module>
<module>main/plugins/org.talend.designer.maven.tos</module>
<module>main/plugins/org.talend.signon.util</module>
<module>main/plugins/org.talend.designer.maven.repo.tck</module>
<module>main/plugins/org.talend.designer.maven.repo.tcksdk</module>

View File

@@ -13,6 +13,7 @@ import java.nio.file.Files;
import java.util.Arrays;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
@@ -44,7 +45,7 @@ public class MetadataTalendTypeTest {
public void testGetProjectForderURLOfMappingsFile() throws SystemException {
URL url = MetadataTalendType.getProjectFolderURLOfMappingsFile();
String projectLabel = ProjectManager.getInstance().getCurrentProject().getTechnicalLabel();
assertTrue(url.getFile().endsWith(projectLabel + "/.settings/mappings/"));
assertTrue(StringUtils.removeEnd(url.getFile(), "/").endsWith(projectLabel + "/.settings/mappings"));
}
@Test

View File

@@ -0,0 +1,113 @@
// ============================================================================
//
// Copyright (C) 2006-2022 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.core.components;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.eclipse.core.runtime.Path;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.talend.core.model.components.ModifyComponentsAction;
import org.talend.core.model.properties.ProcessItem;
import org.talend.core.model.properties.PropertiesFactory;
import org.talend.core.model.properties.Property;
import org.talend.core.model.relationship.RelationshipItemBuilder;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.designer.core.model.utils.emf.talendfile.ConnectionType;
import org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType;
import org.talend.designer.core.model.utils.emf.talendfile.MetadataType;
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.model.utils.emf.talendfile.TalendFileFactory;
/**
* @author bhe created on Jul 6, 2022
*
*/
public class ModifyComponentsActionTest {
private static final String OLDNAME = "NetSuite2019Input";
private static final String NEWNAME = "NetSuiteNewInput";
@Test
public void testSearchAndRenameComponent() throws Exception {
ProcessItem item = PropertiesFactory.eINSTANCE.createProcessItem();
Property property = PropertiesFactory.eINSTANCE.createProperty();
property.setId("_yVUx8NF4EeG5wOtnVeZxqf");
property.setVersion("0.1");
property.setLabel("testSearchAndRenameTckComponent");
item.setProperty(property);
ProcessType process = TalendFileFactory.eINSTANCE.createProcessType();
item.setProcess(process);
NodeType node = TalendFileFactory.eINSTANCE.createNodeType();
node.setComponentName(OLDNAME);
ElementParameterType param = TalendFileFactory.eINSTANCE.createElementParameterType();
param.setName("UNIQUE_NAME");
param.setValue("t" + OLDNAME + "_1");
MetadataType meta = TalendFileFactory.eINSTANCE.createMetadataType();
meta.setName("t" + OLDNAME + "_1");
meta.setConnector("FLOW");
node.getMetadata().add(meta);
node.getElementParameter().add(param);
process.getNode().add(node);
NodeType node2 = TalendFileFactory.eINSTANCE.createNodeType();
node2.setComponentName("NetSuite2019Output");
ElementParameterType param2 = TalendFileFactory.eINSTANCE.createElementParameterType();
param.setName("UNIQUE_NAME");
param.setValue("tNetSuite2019Output_1");
node2.getElementParameter().add(param2);
process.getNode().add(node2);
ConnectionType conn = TalendFileFactory.eINSTANCE.createConnectionType();
conn.setMetaname("t" + OLDNAME + "_1");
conn.setConnectorName("FLOW");
conn.setSource("t" + OLDNAME + "_1");
conn.setTarget("tNetSuite2019Output_1");
process.getConnection().add(conn);
ProxyRepositoryFactory.getInstance().create(item, new Path(""));
// rename
boolean modified = ModifyComponentsAction.searchAndRenameComponent(item, process, OLDNAME, NEWNAME);
assertTrue(modified);
boolean findNewNode = false;
for (Object o : process.getNode()) {
NodeType tempNode = (NodeType) o;
if (tempNode.getComponentName().equals(NEWNAME)) {
findNewNode = true;
for (Object obj : tempNode.getMetadata()) {
MetadataType tempMeta = (MetadataType) obj;
assertEquals(tempMeta.getName(), "t" + NEWNAME + "_1");
}
}
}
assertTrue(findNewNode);
ConnectionType newconn = (ConnectionType) process.getConnection().get(0);
assertEquals(newconn.getMetaname(), "t" + NEWNAME + "_1");
assertEquals(newconn.getSource(), "t" + NEWNAME + "_1");
}
}

View File

@@ -24,10 +24,23 @@ public class JSONObjectTest extends TestCase {
}
}
public class EvilBean {
public int id;
public int getId() {
//do something evil
return this.id;
}
public EvilBean(int id) {
this.id = id;
}
}
@Test
public void test() throws JSONException {
Bean bean = new Bean(1,"wangwei");
JSONObject object = new JSONObject(bean);
JSONObject object = new JSONObject(bean, Bean.class);
assertEquals(false, object.isNull("id"));
assertEquals(1, object.get("id"));
@@ -36,4 +49,15 @@ public class JSONObjectTest extends TestCase {
assertEquals(false, object.isNull("Name"));
assertEquals("wangwei", object.get("Name"));
}
@Test
public void testScriptInject() {
EvilBean evil = new EvilBean(1);
try {
new JSONObject(evil, Bean.class);
fail();
} catch(JSONException e) {
}
}
}

View File

@@ -0,0 +1,83 @@
// ============================================================================
//
// Copyright (C) 2006-2022 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.repository.items.importexport.handlers;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.lang.reflect.Field;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.talend.core.pendo.PendoItemSignatureUtil;
import org.talend.core.pendo.PendoItemSignatureUtil.ValueEnum;
import org.talend.core.pendo.properties.PendoSignImportProperties;
/**
* DOC jding class global comment. Detailled comment
*/
public class PendoImportManagerTest {
private String originalProdDate;
@Before
public void setUp() {
originalProdDate = System.getProperty(PendoItemSignatureUtil.PROD_DATE_ID);
System.setProperty(PendoItemSignatureUtil.PROD_DATE_ID, String.valueOf(System.currentTimeMillis()));
}
@After
public void clean() {
if (StringUtils.isBlank(originalProdDate)) {
originalProdDate = "";
}
System.setProperty(PendoItemSignatureUtil.PROD_DATE_ID, originalProdDate);
}
@Test
public void testCollectProperties() throws Exception {
PendoImportManager pendoImportManager = new PendoImportManager();
pendoImportManager.setStudioImport(true);
Field field = pendoImportManager.getClass().getDeclaredField("isTrackAvailable");
field.setAccessible(true);
field.setBoolean(pendoImportManager, true);
Map<String, Integer> tosUnsignMap = pendoImportManager.getTosUnsignItemMap();
Set<String> projectVersionSet = pendoImportManager.getProjectVersionSet();
tosUnsignMap.put("TOS_TOP", 0);
tosUnsignMap.put("TOS_ESB", 2);
tosUnsignMap.put("TOS_DI", 1);
tosUnsignMap.put("TOS_BD", 3);
projectVersionSet.add("7.3.1");
projectVersionSet.add("8.0.1");
projectVersionSet.add("7.2.1");
pendoImportManager.collectProperties();
PendoSignImportProperties properties = pendoImportManager.getImportProperties();
String projectCreateDate = PendoItemSignatureUtil.formatDate(PendoItemSignatureUtil.getCurrentProjectCreateDate(),
"yyyy-MM-dd");
String prodDate = PendoItemSignatureUtil.formatDate(System.getProperty(PendoItemSignatureUtil.PROD_DATE_ID),
"yyyy-MM-dd");
assertTrue(pendoImportManager.isTrackRequired());
assertEquals("[7.2.1, 7.3.1, 8.0.1]", properties.getSourceVersion().toString());
assertEquals("{\"TOS_DI\":1,\"TOS_BD\":3,\"TOS_ESB\":2,\"TOS_TOP\":0}", properties.getUnsignSEItems());
assertEquals(ValueEnum.YES.getDisplayValue(), properties.getGracePeriod());
assertEquals(ValueEnum.NOT_APPLICATE.getDisplayValue(), properties.getValidMigrationToken());
assertEquals(projectCreateDate, properties.getProjectCreateDate());
assertEquals(prodDate, properties.getInstallDate());
}
}