Compare commits

...

73 Commits

Author SHA1 Message Date
Jane Ding
51cb13c619 fix(TUP-30849):Improve build Job performance (#4151)
* fix(TUP-30849):Improve build Job performance
https://jira.talendforge.org/browse/TUP-30849

Signed-off-by: jding-tlnd <jding@talend.com>

* fix(TUP-30849):Improve build Job performance
https://jira.talendforge.org/browse/TUP-30849
Signed-off-by: jding-tlnd <jding@talend.com>

* fix(TUP-30849):Improve build Job performance
https://jira.talendforge.org/browse/TUP-30849

Signed-off-by: jding-tlnd <jding@talend.com>

* fix(TUP-30849):Improve build Job performance
https://jira.talendforge.org/browse/TUP-30849

Signed-off-by: jding-tlnd <jding@talend.com>

* fix(TUP-30849):Improve build Job performance
https://jira.talendforge.org/browse/TUP-30849

Signed-off-by: jding-tlnd <jding@talend.com>

* fix(TUP-30849):Improve build Job performance
https://jira.talendforge.org/browse/TUP-30849

Signed-off-by: jding-tlnd <jding@talend.com>

* fix(TUP-30849):Improve build Job performance
https://jira.talendforge.org/browse/TUP-30849

Signed-off-by: jding-tlnd <jding@talend.com>

* fix(TUP-30849):Improve build Job performance
https://jira.talendforge.org/browse/TUP-30849

* feat(TUP-31117):Improve performances related to recursive jobs (#4290)

* feat(TUP-31117):Improve performances related to recursive jobs
https://jira.talendforge.org/browse/TUP-31117

* feat(TUP-31117):Improve performances related to recursive jobs
https://jira.talendforge.org/browse/TUP-31117
2021-05-25 18:10:48 +08:00
bhe-talendbj
e9d7c4a43c chore(TUP-30451): remove cve jars (#4301)
* chore(TUP-30415): remove cve jars

* chore(TUP-30415): remove cve jars
2021-05-25 14:33:51 +08:00
jiezhang-tlnd
67d44985fa fix(TUP-31164)Guess schema button on the informix tDBinput component (#4281)
* fix(TUP-31164)Guess schema button on the informix tDBinput component
returns zero length datatype

* Guess schema button on the informix tDBinput component returns zero
length datatype
2021-05-25 11:28:47 +08:00
jiezhang-tlnd
41f5d459f6 chore(TUP-30461)CVE plexus-utils (#4274)
* chore(TUP-30461)CVE plexus-utils

* remove from classpath file
2021-05-24 15:53:07 +08:00
hcyi
b38b96fedc feat(TUP-30619):Missing Additional parameters in SAP Connection. (#4284)
* feat(TUP-30619):Missing Additional parameters in SAP Connection.

* feat(TUP-30619):update key for Additional parameters in SAP Connection.
2021-05-24 09:49:54 +08:00
bhe-talendbj
df53ee1a1f fix(TUP-31380): include all needed modules for routines in CI mode (#4282) 2021-05-21 16:59:54 +08:00
kjwang
035bc4a39c TUP-31227 Studio populate UnstagedChanges for Global Routines and SQL (#4303)
Templates when opening a new Feature Branch (Improve the code)
https://jira.talendforge.org/browse/TUP-31227
2021-05-21 14:26:10 +08:00
kjwang
1105d9c65c Kjwang/fix tup 31227 studio populate unstaged changes (#4277)
* TUP-31227 Studio populate UnstagedChanges for Global Routines and SQL
Templates when opening a new Feature Branch
https://jira.talendforge.org/browse/TUP-31227
2021-05-21 10:54:25 +08:00
Liu Xinquan
488e7aaedb fix(TDQ-19429) tDqReportRun failed when dbconneciton is context mode (#4294) 2021-05-19 17:28:36 +08:00
vdrokov
681dd59eb2 APPINT-32987: Fix dublicate variable (#4278) 2021-05-13 12:08:54 +03:00
sbliu
7a3c23cdb5 fix(TUP-31060): store real routine id in case recreated routine with same name. 2021-05-12 19:14:38 +08:00
Jane Ding
a6f4581b0a chore(APPINT-32936):CVE:Upgrade commons-codec-1.11 to 1.15 (#4261)
https://jira.talendforge.org/browse/APPINT-32936

Co-authored-by: SunChaoqun <csun@talend.com>
2021-05-12 13:59:23 +08:00
Denis Sergent
40e63f3c01 Revert "APPINT-32905: Issue with Rest service flow (#4263)" (#4276)
This reverts commit d88d513e4e.
2021-05-10 11:36:24 +02:00
Jane Ding
d54cddaedf fix(TUP-31237):Invalid username or password when creating a Snowflake (#4232)
* fix(TUP-31237):Invalid username or password when creating a Snowflake
Metadata Connection with a Snowflake password that has a slash character
https://jira.talendforge.org/browse/TUP-31237

* fix(TUP-31237):Invalid username or password when creating a Snowflake
Metadata Connection with a Snowflake password that has a slash character
https://jira.talendforge.org/browse/TUP-31237
2021-05-10 16:04:00 +08:00
Jane Ding
41e2ef2d2d chore(TUP-31030):Update CXF to 3.3.10 (#4242)
* chore(TUP-31030):Update CXF to 3.3.10
https://jira.talendforge.org/browse/TUP-31030

* chore(TUP-31030):Update CXF to 3.3.10
https://jira.talendforge.org/browse/TUP-31030
2021-05-10 09:42:05 +08:00
mbasiuk-talend
bccc406937 chore(TDI-46032): bump connectors version to 1.21.0 (#4269) 2021-05-08 17:04:57 +08:00
hzhao-talendbj
a9b3d20e06 chore(TUP-31403): Add log4j dependency in maven.tis/maven.tos (#4267)
* chore(TUP-31403): Add log4j dependency in maven.tis/maven.tos

* add log4j-1.2-api

* TUP-31403 add maven-shared-utils 3.3.3
2021-05-08 09:44:59 +08:00
Liu Xinquan
47b5a7e251 Revert "Revert "fix(TDQ-19030): fix complier error (#4172)" (#4212)" (#4268)
This reverts commit 137c543bfd.
2021-05-07 14:37:05 +08:00
kjwang
e9b5fa3ba7 Feat:TUP-30377 Move the "Allow specific characters (UTF8,...)" (#4238)
Feat:TUP-30377 Move the "Allow specific characters (UTF8,...) preference setting to project setting.
https://jira.talendforge.org/browse/TUP-30377
2021-05-06 14:48:48 +08:00
jiezhang-tlnd
39a730cae4 fix(TUP-30451)maven-shared-utils-3.0.0.jar,maven-shared-utils-3.0.1.jar,maven-shared-utils-3.1.0.jar (#4262) 2021-05-06 11:01:59 +08:00
vdrokov
d88d513e4e APPINT-32905: Issue with Rest service flow (#4263) 2021-05-05 12:31:14 +03:00
kjwang
75176b6f45 Revert the commit of TUP-31096 to test tuj (#4253)
Co-authored-by: kjwang <kjwang@LT-B1Z2R73.talend.com>
2021-04-30 10:21:23 +08:00
hzhao-talendbj
11ecc1cbfd fix(TUP-31248):impala metadata connection issues for Cloudera (#4246)
* fix(TUP-31248):impala metadata connection issues for Cloudera

* TUP-31248 revert mistake remove

* TUP-31248 remove some useless code

* TUP-31248 add connection info to log when connection failed
2021-04-29 15:29:56 +08:00
jiezhang-tlnd
53efef8de0 fix(TUP-29866)CVE on maven-shared-utils (#4225)
* fix(TUP-29866)CVE on maven-shared-utils

* exclude maven-shared-utils 3.2.1

* update pom_project_template.xml

* exclude maven-shared-utils:jar:3.1.0
2021-04-29 14:27:16 +08:00
Jane Ding
db2eb01c38 fix(TUP-31234):Build job fail with option "Execute tests" if any test (#4244)
case fail
https://jira.talendforge.org/browse/TUP-31234
2021-04-28 17:59:19 +08:00
hzhao-talendbj
f9af16ba90 fix(TUP-30524): Commandline login svn project tag fail (#4228) 2021-04-28 11:59:24 +08:00
kjwang
23f2926741 Fix TUP-31096 Could not find or load main class error on the jobs (#4245)
Fix TUP-31096 Could not find or load main class error on the jobs created on the Feature Branch which has #
https://jira.talendforge.org/browse/TUP-31096
2021-04-27 17:57:52 +08:00
Jane Ding
48653aa380 feat(TUP-30730):Deprecate SAS from metadata wizard (#4210)
https://jira.talendforge.org/browse/TUP-30730
2021-04-27 15:15:31 +08:00
bhe-talendbj
d80fefc234 fix(TUP-31069): remove beanutils-core (#4227)
* fix(TUP-31069): remove beanutils-core

* chore(TUP-31069): change commons-io to 2.4

* chore(TUP-31069): change commons-io to 2.7

* chore(TUP-31069): change commons-io to 2.7

* chore(TUP-31069): only remove unsed cve jars
2021-04-26 18:21:31 +08:00
sbliu
a0b395cd3a feat(TUP-30846) Unify studio version information & patch info in studio logs. 2021-04-25 10:50:31 +08:00
hzhao-talendbj
98bcc66479 chore(TUP-31155): change the way to check if it's CI mode (#4208)
* chore(TUP-31155): change the way to check if it's CI mode

* TUP-31155 code change

* TUP-31155 add comments
2021-04-23 18:22:37 +08:00
ypiel
a716257dd0 chore: bump to tck:1.32.0 2021-04-22 12:13:51 +02:00
wang wei
b164f8c447 fix(TDI-43921): backport to 73 (#4231) 2021-04-21 18:08:04 +08:00
jiezhang-tlnd
dd352b4a8f fix(TUP-29381)CVE on (#4222)
commons-codec-1.6.jar/commons-codec-1.9.jar/commons-codec-1.10.jar
2021-04-19 15:43:12 +08:00
Jane Ding
08ac05c23e fix(TUP-30992):CVE: junit-4.11,4.13 (#4220)
https://jira.talendforge.org/browse/TUP-30992

Signed-off-by: jding-tlnd <jding@talend.com>
2021-04-16 19:19:40 +08:00
Zhiwei Xue
90a37f8418 fix(TUP-30187):rename maven property (#4216) 2021-04-16 15:36:36 +08:00
Liu Xinquan
137c543bfd Revert "fix(TDQ-19030): fix complier error (#4172)" (#4212)
This reverts commit c22eba9ead.
2021-04-15 16:39:40 +08:00
jiezhang-tlnd
42e94c6508 fix(TUP-30992)CVE: junit-4.11,4.13 (#4202)
* fix(TUP-30992)CVE: junit-4.11,4.13

* fix(TUP-30992)CVE: junit-4.11,4.13
2021-04-15 16:13:04 +08:00
hzhao-talendbj
ff9c4c021a fix(TUP-30921):Job fails with "Could not find the context Default" after migration 7.2.1 to 7.3.1 R2021-01 (#4154)
* fix(TUP-30921): Job fails with "Could not find the context Default"
after migration 7.2.1 to 7.3.1 R2021-01

* TUP-30921 new code change
2021-04-15 15:13:28 +08:00
Zhiwei Xue
291f56e505 fix(TUP-30586):Routine/Bean custom jars dependency management issues left todo (#4201)
* fix(TUP-30782):Fail to run job if use a custom routine jar without inner
jar.

* fix(TUP-30791): fix test case run failure
2021-04-14 16:54:11 +08:00
hzhao-talendbj
c67b2f479e chore(TUP-30942): upgrade to httpclient-4.5.13.jar (#4193) 2021-04-14 09:38:28 +08:00
mbasiuk-talend
45d373f447 chore(TDI-45894): bump connectors version to 1.20.0 (#4190) 2021-04-13 13:29:33 +03:00
Emmanuel GALLOIS
edff6eeeb8 feat(TDI-45842): bump component-runtime to 1.31.2 (#4164)
* feat(TDI-45842): bump component-runtime to 1.31.1-SNAPSHOT

* chore(TDI-45842): bump component-runtime to 1.31.2

Co-authored-by: jzhao-talend <jzhao@talend.com>
Co-authored-by: mbasiuk <mbasiuk@talend.com>
2021-04-13 12:39:28 +03:00
bhe-talendbj
acd1555a2b fix(TUP-26813): upgrade bcprov-jdk15on (#4053)
* fix(TUP-26813): upgrade bcprov-jdk15on

* fix(TUP-26813): upgrade bcprov-jdk15on

* fix(TUP-26813): add test case
2021-04-13 11:42:21 +08:00
sbliu
97a77ec401 feat(TUP-30953) record install additional packages. 2021-04-13 11:07:46 +08:00
bhe-talendbj
a5f6364467 bugfix(TUP-30203): Search required groups only (#4174)
* fix(TUP-30203): only search required library groups

* fix(TUP-30203): only search required library groups, refactor

* fix(TUP-30203): only search required library groups, refactor

* fix(TUP-30203): exclude class file

* fix(TUP-30203): exclude class file

* fix(TUP-30203): share libs in background

* fix(TUP-30203): add i18n
2021-04-12 18:05:35 +08:00
hcyi
db39d84224 feat(TUP-30291):Add Suggestable support for Table options (List<Row>) in (#4150)
Studio.
2021-04-12 15:24:23 +08:00
jiezhang-tlnd
d153fe9fa0 feat(TUP-30381)Support greenplum driver for Greenplum Database in studio (#4138)
* feat(TUP-30381)Support greenplum driver for Greenplum Database in studio
metadata
https://jira.talendforge.org/browse/TUP-30381

* add dbversion for greeenplu

* add dbversion

* update mapping_greenplum file

* update greenplum_mapping

* update greenplum mapping
2021-04-12 10:02:25 +08:00
hzhao-talendbj
939e974d1c fix(TUP-30429): the job export from v6.5.1 can't be imported to v7.3.1 (#4180) 2021-04-09 11:33:04 +08:00
Zhiwei Xue
722a0b1341 fix(TUP-30786):Avoid to click finish button more than once when do (#4184)
create custom routine jar/bean jar.
2021-04-08 18:32:55 +08:00
sbliu
7b391d516f TUP-30768 Can't reset performance_record if first patch use manual installation then the second use Software update 2021-04-08 17:26:50 +08:00
Xilai Dai
b5478c3f2f chore(APPINT-32718) override the httpclient version (#4189)
* chore(APPINT-32718) override the httpclient version

* chore(APPINT-32718) override the httpclient version
2021-04-08 16:27:29 +08:00
hzhao-talendbj
0726cb38fd chore(TUP-30942): CVE: httpclient-4.5.3.jar (#4157)
* chore(TUP-30942): CVE: httpclient-4.5.3.jar

* TUP-30942 modify manifest
2021-04-08 15:55:37 +08:00
pyzhou
687ab637be fix(TDI-45881):Update jackson mapper (#4188) 2021-04-08 15:27:31 +08:00
hzhao-talendbj
4cb1deb115 chore(TUP-27039): Update Commons Compress to 1.19 backport to 7.3 (#4140)
* chore(TUP-27039): Update Commons Compress to 1.19 backport to 7.3

* TUP-27093 fix wrong code dependency

* TUP-27039 revert tycho to 1.4.0

* TUP-27039 change karaf-maven-plugin to 4.2.7

* TUP-27039 change karaf-maven-plugin to 4.2.7

* TUP-27039 if packaging pom ,then use origin one
2021-04-08 10:51:39 +08:00
Zhiwei Xue
c594011902 fix(TUP-30187):CI: Add options to disable compile error of (#4177)
routines/beans/codejars pom
2021-04-07 09:46:54 +08:00
vdrokov
c6d7da2121 TESB-32416: Importing route from a zip file, imports all the other jobs (Clone TESB-32400) (#4147) 2021-04-06 15:00:36 +02:00
Zhiwei Xue
90951dced8 fix(TUP-30780):Only check used custom jars when run/build Job (#4173) 2021-04-06 15:51:34 +08:00
msjian
c22eba9ead fix(TDQ-19030): fix complier error (#4172) 2021-04-06 14:14:56 +08:00
Zhiwei Xue
e466c31b88 fix(TUP-30977):test run map using custom routines and beans doesn't work (#4159)
after switch branch
2021-04-06 12:05:53 +08:00
bhe-talendbj
6a601fadd2 fix(TUP-30047): fix missing joblet (#4107)
* fix(TUP-30047): fix missing joblet

* fix(TUP-30047): add missing joblets for test case job

* fix(TUP-30047): add missing joblets for test case job, infinite loop

* feat(TUP-30047): support running dynamic jobs

* feat(TUP-30047): change location of classpath.jar if running ci test
2021-04-02 16:14:23 +08:00
sbliu
28a216d0af fix(TUP-30685) Mvn package job use joblet in subref project fail to run the bat file correct. 2021-04-01 17:27:24 +08:00
hzhao-talendbj
5622490ca4 chore(TUP-29181): upgrade cxf backport to 73 (#4142)
* chore(TUP-29181): upgrade cxf backport to 73

* TUP-29181 remove extra bundle activationpolicy

* TUP-29181 try add source src

* TUP-29181 remove jars from lib folder

* TUP-29181 remove jars from lib
2021-03-30 16:14:45 +08:00
jiezhang-tlnd
283fa4ac93 Jzhang/73/tup 29381 (#4057)
* fix(TUP-29381)CVE on
commons-codec-1.6.jar/commons-codec-1.9.jar/commons-codec-1.10.jar

* fix(TUP-29381)CVE on
commons-codec-1.6.jar/commons-codec-1.9.jar/commons-codec-1.10.jar

* update on tos

* remove common-codec-1.6

* remove commons-dodec 1.6
2021-03-30 15:57:45 +08:00
Zhiwei Xue
b55a302e9f fix(TUP-30813):Add Junits for dependency management feature (#4144) 2021-03-25 09:39:16 +08:00
Jane Ding
887d1249dc fix(TUP-30216):Commandline install patch and login project throw NPE (#4114)
https://jira.talendforge.org/browse/TUP-30216

Signed-off-by: jding-tlnd <jding@talend.com>
2021-03-25 00:39:52 +08:00
Zhiwei Xue
caa73983c8 fix(TUP-30779):Custom jar resource unload issue after git pull&merge. (#4133) 2021-03-24 16:20:48 +08:00
Jane Ding
7a502a7dc1 fix(TUP-30615):Schema Update Detection popping up everytime upon opening (#4131)
the job
https://jira.talendforge.org/browse/TUP-30615

Signed-off-by: jding-tlnd <jding@talend.com>
2021-03-23 11:30:29 +08:00
hzhao-talendbj
c395d11c00 TUP-30558 (#4111) (#4130) 2021-03-23 09:53:34 +08:00
Zhiwei Xue
1fc99eaa02 feat(TUP-29014): bugfix 2021-03-16 (#4128) 2021-03-16 17:11:55 +08:00
jiezhang-tlnd
77a076cea1 revert the commit 94914d676b 2021-03-16 16:06:51 +08:00
jiezhang-tlnd
94914d676b check if custom nexus is available or not before deploy the jar 2021-03-16 16:01:53 +08:00
Laurent BOURGEOIS
1faf28843b fix(TBD-11964): Different time zone for Standard jobs and BD Batch (#4082) 2021-03-15 17:01:22 +01:00
224 changed files with 3032 additions and 1391 deletions

View File

@@ -29,7 +29,7 @@
<import plugin="org.eclipse.jdt.launching" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.jdt.ui" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.hamcrest.core" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.junit" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.junit" version="4.13.2" match="greaterOrEqual"/>
</requires>
<plugin id="org.eclipse.jdt.launching.macosx" os="macosx" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.eclipse.jdt.launching.ui.macosx" os="macosx" download-size="0" install-size="0" version="0.0.0" unpack="false"/>

View File

@@ -18,7 +18,7 @@
<import plugin="org.apache.commons.lang3" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.apache.log4j" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.apache.servicemix.bundles.avro" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.junit" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.junit" version="4.13.2" match="greaterOrEqual"/>
<import plugin="org.slf4j.api" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.apache.commons.configuration" version="2.0.0" match="greaterOrEqual"/>
</requires>

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.commons.utils.time;
import java.io.File;
import java.util.Properties;
import org.eclipse.core.runtime.Platform;
public class PropertiesCollectorUtil {
private static final String ROOT_NODE = "additional_packages_records"; // additional packages
private static final String PREF_ADDITIONAL_PACKAGES = "AdditionalPackages"; // preference node
private static final String ADDITONAL_PACKAGE_FILE = "additionalPackages";
public static String getAdditionalPackageRecording() {
File file = getRecordFile(ADDITONAL_PACKAGE_FILE);
Properties props = PropertiesFileUtil.read(file, true);
String records = props.getProperty(ROOT_NODE, "");
return records;
}
public static void storeAdditionalPackageRecording(String records) {
File file = getRecordFile(ADDITONAL_PACKAGE_FILE);
Properties props = PropertiesFileUtil.read(file, false);
props.setProperty(ROOT_NODE, records);
PropertiesFileUtil.store(file, props);
}
private static File getRecordFile(String fileName) {
String configurationLocation = Platform.getConfigurationLocation().getURL().getPath();
File file = new File(configurationLocation + "/data_collector/" + fileName);
return file;
}
public static String getAdditionalPackagePreferenceNode() {
return PREF_ADDITIONAL_PACKAGES;
}
}

View File

@@ -12,11 +12,14 @@
// ============================================================================
package org.talend.core.repository.model;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -623,8 +626,7 @@ public abstract class AbstractEMFRepositoryFactory extends AbstractRepositoryFac
stream.close();
byte[] currentContent = item.getContent().getInnerContent();
if (!Arrays.equals(innerContent, currentContent)) {
if (!isSameStringContent(innerContent, currentContent)) {
item.getContent().setInnerContent(innerContent);
Project project = getRepositoryContext().getProject();
save(project, item);
@@ -641,6 +643,44 @@ public abstract class AbstractEMFRepositoryFactory extends AbstractRepositoryFac
throw new PersistenceException(ioe);
}
}
protected boolean isSameStringContent(byte[] data1, byte[] data2) throws IOException {
boolean isSame = true;
BufferedReader br1 = null, br2 = null;
try {
br1 = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(data1), StandardCharsets.UTF_8.toString()));
br2 = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(data2), StandardCharsets.UTF_8.toString()));
String line1 = null, line2 = null;
while (isSame) {
line1 = br1.readLine();
line2 = br2.readLine();
if ((line1 == null && line2 == null)) {
break;
}
if (!StringUtils.equals(line1, line2)) {
isSame = false;
break;
}
}
} finally {
if (br1 != null) {
try {
br1.close();
} catch (IOException e) {
ExceptionHandler.process(e);
}
}
if (br2 != null) {
try {
br2.close();
} catch (IOException e) {
ExceptionHandler.process(e);
}
}
}
return isSame;
}
private void createSQLPattern(URL url, String sqlPatternLabel, String categoryName) throws PersistenceException {
if (url == null) {
@@ -693,8 +733,7 @@ public abstract class AbstractEMFRepositoryFactory extends AbstractRepositoryFac
stream.close();
byte[] currentContent = item.getContent().getInnerContent();
if (!Arrays.equals(innerContent, currentContent)) {
if (!isSameStringContent(innerContent, currentContent)) {
item.getContent().setInnerContent(innerContent);
Project project = getRepositoryContext().getProject();
save(project, item);

View File

@@ -123,6 +123,7 @@ import org.talend.core.model.repository.LockInfo;
import org.talend.core.model.repository.RepositoryContentManager;
import org.talend.core.model.repository.RepositoryObject;
import org.talend.core.model.repository.RepositoryViewObject;
import org.talend.core.model.routines.CodesJarInfo;
import org.talend.core.repository.CoreRepositoryPlugin;
import org.talend.core.repository.constants.Constant;
import org.talend.core.repository.constants.FileConstants;
@@ -1369,21 +1370,15 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
}
@Override
public List<IRepositoryViewObject> getAllInnerCodes(ERepositoryObjectType codesJarType, Property jarProperty)
throws PersistenceException {
return getAllInnerCodes(projectManager.getCurrentProject(), codesJarType, jarProperty);
}
@Override
public List<IRepositoryViewObject> getAllInnerCodes(Project project, ERepositoryObjectType codesJarType, Property jarProperty)
throws PersistenceException {
public List<IRepositoryViewObject> getAllInnerCodes(CodesJarInfo info) throws PersistenceException {
Project project = ProjectManager.getInstance().getProjectFromProjectTechLabel(info.getProjectTechName());
// empty folder won't be commit in git, create if not exist
IFolder folder = ResourceUtils.getProject(project).getFolder(ERepositoryObjectType.getFolderName(codesJarType))
.getFolder(jarProperty.getLabel());
IFolder folder = ResourceUtils.getProject(project).getFolder(ERepositoryObjectType.getFolderName(info.getType()))
.getFolder(info.getLabel());
if (!folder.exists()) {
ResourceUtils.createFolder(folder);
}
return repositoryFactoryFromProvider.getAll(project, codesJarType, false, false, folder);
return repositoryFactoryFromProvider.getAll(project, info.getType(), false, false, folder);
}
@Override

View File

@@ -523,10 +523,10 @@ public class CopyObjectAction {
if (isInnerCode) {
CodesJarInfo info = CodesJarResourceCache.getCodesJarByInnerCode(item);
if (info.getProperty() != null) {
if (info != null) {
IDesignerMavenService designerMavenService = IDesignerMavenService.get();
if (designerMavenService != null) {
designerMavenService.updateCodeJarMavenProject(info.getProperty(), false);
designerMavenService.updateCodeJarMavenProject(info, false);
}
}
}

View File

@@ -12,17 +12,26 @@
<dbType type="BPCHAR" ignoreLen="true" ignorePre="true" />
<dbType type="BYTEA" ignoreLen="true" ignorePre="true" />
<dbType type="CHAR" defaultLength="50" ignorePre="true"/>
<dbType type="CHARACTER" defaultLength="50" ignorePre="true"/>
<dbType type="CID" ignoreLen="true" ignorePre="true" />
<dbType type="CIDR" ignoreLen="true" ignorePre="true" />
<dbType type="CIRCLE" ignoreLen="true" ignorePre="true" />
<dbType type="DATE" ignoreLen="true" ignorePre="true" />
<dbType type="FLOAT4" ignoreLen="true" ignorePre="true" />
<dbType type="REAL" ignoreLen="true" ignorePre="true" />
<dbType type="FLOAT8" ignoreLen="true" ignorePre="true" />
<dbType type="DOUBLE PRECISION" ignoreLen="true" ignorePre="true" />
<dbType type="INET" ignoreLen="true" ignorePre="true" />
<dbType type="INT2" ignoreLen="true" ignorePre="true" />
<dbType type="SMALLINT" ignoreLen="true" ignorePre="true" />
<dbType type="INT2VECTOR" ignoreLen="true" ignorePre="true" />
<dbType type="INT4" ignoreLen="true" ignorePre="true" />
<dbType type="INT8" ignoreLen="true" ignorePre="true" />
<dbType type="INTEGER" ignoreLen="true" ignorePre="true" />
<dbType type="CHARACTER VARYING" ignoreLen="true" ignorePre="true" />
<dbType type="BOOLEAN" ignoreLen="true" ignorePre="true" />
<dbType type="BIGINT" ignoreLen="true" ignorePre="true" />
<dbType type="BIT VARYING" ignoreLen="true" ignorePre="true" />
<dbType type="INTERVAL" ignorePre="true" />
<dbType type="LINE" ignoreLen="true" ignorePre="true" />
<dbType type="LSEG" ignoreLen="true" ignorePre="true" />
@@ -30,6 +39,7 @@
<dbType type="MONEY" ignoreLen="true" ignorePre="true" />
<dbType type="NAME" ignoreLen="true" ignorePre="true" />
<dbType type="NUMERIC" defaultLength="20" defaultPrecision="10"/>
<dbType type="DECIMAL" defaultLength="20" defaultPrecision="10"/>
<dbType type="OID" ignoreLen="true" ignorePre="true" />
<dbType type="OIDVECTOR" ignoreLen="true" ignorePre="true" />
<dbType type="PATH" ignoreLen="true" ignorePre="true" />
@@ -110,16 +120,19 @@
<talendToDbTypes><!-- Adviced mappings -->
<talendType type="id_List"/>
<talendType type="id_Boolean">
<dbType type="BOOL" default="true" />
<dbType type="BOOL" default="true" />
<dbType type="BOOLEAN" />
</talendType>
<talendType type="id_Byte">
</talendType>
<talendType type="id_byte[]">
<dbType type="BIT" default="true" />
<dbType type="VARBIT" />
<dbType type="VARBIT" />
<dbType type="BIT VARYING" />
</talendType>
<talendType type="id_Character">
<dbType type="CHAR" default="true" />
<dbType type="CHARACTER" />
<dbType type="BPCHAR" />
<dbType type="VARCHAR" />
<dbType type="TEXT" />
@@ -136,33 +149,47 @@
<dbType type="RELTIME" />
</talendType>
<talendType type="id_BigDecimal">
<dbType type="NUMERIC" default="true" />
<dbType type="NUMERIC" default="true" />
<dbType type="DECIMAL" />
<dbType type="FLOAT4" />
<dbType type="REAL" />
<dbType type="FLOAT8"/>
<dbType type="DOUBLE PRECISION"/>
</talendType>
<talendType type="id_Double">
<dbType type="FLOAT4" />
<dbType type="REAL" />
<dbType type="FLOAT8" default="true" />
<dbType type="NUMERIC" />
<dbType type="NUMERIC" />
<dbType type="DECIMAL" />
<dbType type="DOUBLE PRECISION"/>
</talendType>
<talendType type="id_Float">
<dbType type="FLOAT4" default="true" />
<dbType type="FLOAT8" />
<dbType type="NUMERIC" />
<dbType type="REAL" />
<dbType type="NUMERIC" />
<dbType type="DECIMAL" />
<dbType type="DOUBLE PRECISION"/>
</talendType>
<talendType type="id_Integer">
<dbType type="INT2" />
<dbType type="SMALLINT" />
<dbType type="INT4" default="true" />
<dbType type="SERIAL" />
<dbType type="INT8" />
<dbType type="BIGSERIAL" />
<dbType type="BIGINT" />
<dbType type="BIGSERIAL" />
<dbType type="INTEGER" />
</talendType>
<talendType type="id_Long">
<dbType type="INT2" />
<dbType type="INT4" />
<dbType type="SERIAL" />
<dbType type="INT8" default="true" />
<dbType type="BIGSERIAL" />
<dbType type="BIGINT" />
<dbType type="BIGSERIAL" />
<dbType type="SMALLINT" />
</talendType>
<talendType type="id_Object">
<dbType type="_POINT" />
@@ -209,18 +236,26 @@
<dbType type="_ABSTIME" />
<dbType type="_ACLITEM" />
<dbType type="_INT8" />
<dbType type="BIGINT" />
<dbType type="BIT VARYING" />
<dbType type="_VARBIT" />
<dbType type="_BIT" />
<dbType type="_BOOL" />
<dbType type="BOOLEAN" />
<dbType type="BOX" />
<dbType type="_BOX" />
<dbType type="_BYTEA" />
<dbType type="_VARCHAR" />
<dbType type="CHARACTER VARYING" />
<dbType type="CHARACTER" />
<dbType type="INTEGER" />
<dbType type="REAL" />
<dbType type="_BPCHAR" />
<dbType type="_CID" />
<dbType type="_CIDR" />
<dbType type="_CIRCLE" />
<dbType type="_DATE" />
<dbType type="DOUBLE PRECISION"/>
<dbType type="_FLOAT8" />
<dbType type="_INET" />
<dbType type="INT2VECTOR" />
@@ -236,6 +271,7 @@
<dbType type="NAME" />
<dbType type="_NAME" />
<dbType type="_NUMERIC" />
<dbType type="DECIMAL" />
<dbType type="_OID" />
<dbType type="OIDVECTOR" />
<dbType type="_OIDVECTOR" />
@@ -247,26 +283,44 @@
<dbType type="INT4" />
<dbType type="SERIAL" />
<dbType type="INT8" />
<dbType type="BIGSERIAL" />
<dbType type="BIGINT" />
<dbType type="BIGSERIAL" />
<dbType type="SMALLINT" />
</talendType>
<talendType type="id_String">
<dbType type="BPCHAR" />
<dbType type="VARCHAR" default="true" />
<dbType type="CHARACTER VARYING" />
<dbType type="TEXT" />
</talendType>
</talendToDbTypes>
<dbToTalendTypes>
<dbType type="INT2" >
<talendType type="id_Short" default="true" />
</dbType>
<dbType type="SMALLINT" >
<talendType type="id_Short" default="true" />
</dbType>
<dbType type="INT4" >
<talendType type="id_Integer" default="true" />
</dbType>
</dbType>
<dbType type="INTEGER" >
<talendType type="id_Integer" default="true" />
</dbType>
<dbType type="CHARACTER VARYING" >
<talendType type="id_String" default="true" />
</dbType>
<dbType type="BOOLEAN" >
<talendType type="id_Boolean" default="true" />
</dbType>
<dbType type="SERIAL" >
<talendType type="id_Integer" default="true" />
</dbType>
<dbType type="INT8" >
<talendType type="id_Long" default="true" />
</dbType>
<dbType type="BIGINT" >
<talendType type="id_Long" default="true" />
</dbType>
<dbType type="BIGSERIAL" >
<talendType type="id_Long" default="true" />
@@ -274,14 +328,26 @@
<dbType type="FLOAT4" >
<talendType type="id_Float" default="true" />
<talendType type="id_BigDecimal"/>
</dbType>
</dbType>
<dbType type="REAL" >
<talendType type="id_Float" default="true" />
<talendType type="id_BigDecimal"/>
</dbType>
<dbType type="FLOAT8" >
<talendType type="id_Double" default="true" />
<talendType type="id_BigDecimal"/>
</dbType>
<dbType type="DOUBLE PRECISION" >
<talendType type="id_Double" default="true" />
<talendType type="id_BigDecimal"/>
</dbType>
<dbType type="NUMERIC">
<talendType type="id_Double"/>
<talendType type="id_BigDecimal" default="true" />
</dbType>
<dbType type="DECIMAL">
<talendType type="id_Double"/>
<talendType type="id_BigDecimal" default="true" />
</dbType>
<dbType type="BOOL" >
<talendType type="id_Boolean" default="true" />
@@ -291,9 +357,15 @@
</dbType>
<dbType type="VARBIT" >
<talendType type="id_byte[]" default="true" />
</dbType>
</dbType>
<dbType type="BIT VARYING" >
<talendType type="id_byte[]" default="true" />
</dbType>
<dbType type="CHAR" >
<talendType type="id_String" default="true" />
</dbType>
<dbType type="CHARACTER" >
<talendType type="id_String" default="true" />
</dbType>
<dbType type="BPCHAR" >
<talendType type="id_String" default="true" />

View File

@@ -138,6 +138,10 @@ public class PluginChecker {
public static final String HELP_PLUGIN_ID = "org.talend.help"; //$NON-NLS-1$
public static final String APACHE_CXF_PLUGIN_ID = "org.talend.libraries.apache.cxf"; //$NON-NLS-1$
public static final String SWTBOT_PLUGIN_ID = "org.eclipse.swtbot.eclipse.core"; //$NON-NLS-1$
/**
* Check if specific plug-in is loaded.
*
@@ -370,6 +374,10 @@ public class PluginChecker {
return isPluginLoaded(BD_ROUTINE_PLUGIN_ID);
}
public static boolean isSWTBotLoaded() {
return isPluginLoaded(SWTBOT_PLUGIN_ID);
}
public static String getBundlePath(String bundleName) {
String bundlePath = ""; //$NON-NLS-1$
Bundle refBundle = Platform.getBundle(bundleName);

View File

@@ -67,8 +67,8 @@ public enum EDatabase4DriverClassName {
// if change the order, it might break the audit for PSQL.
PSQL(EDatabaseTypeName.PSQL, "org.postgresql.Driver"), //$NON-NLS-1$
PLUSPSQL(EDatabaseTypeName.PLUSPSQL, "org.postgresql.Driver"), //$NON-NLS-1$
GREENPLUM(EDatabaseTypeName.GREENPLUM, "org.postgresql.Driver"), //$NON-NLS-1$
GREENPLUM(EDatabaseTypeName.GREENPLUM, "com.pivotal.jdbc.GreenplumDriver"), //$NON-NLS-1$
GREENPLUM_PSQL(EDatabaseTypeName.GREENPLUM, "org.postgresql.Driver"), //$NON-NLS-1$
SAS(EDatabaseTypeName.SAS, "com.sas.rio.MVADriver"), //$NON-NLS-1$
SAPHana(EDatabaseTypeName.SAPHana, "com.sap.db.jdbc.Driver"), //$NON-NLS-1$
SQLITE(EDatabaseTypeName.SQLITE, "org.sqlite.JDBC"), //$NON-NLS-1$

View File

@@ -114,7 +114,10 @@ public enum EDatabaseTypeName {
"ParAccel", "ParAccel", Boolean.TRUE, "PARACCEL", "PARACCEL", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
NETEZZA(
"Netezza", "Netezza", Boolean.FALSE, "NETEZZA", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
SAS("SAS", "SAS", Boolean.TRUE, "SAS", EDatabaseSchemaOrCatalogMapping.None, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
/**
* @deprecated
*/
SAS("SAS", "SAS (Deprecated)", Boolean.TRUE, "SAS", EDatabaseSchemaOrCatalogMapping.None, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
// General JDBC not support schema defalut
GENERAL_JDBC(
"General JDBC", "General JDBC", Boolean.FALSE, "JDBC", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

View File

@@ -22,14 +22,14 @@ import org.talend.core.runtime.hd.hive.HiveMetadataHelper;
*/
public enum EImpalaDriver {
HIVE2("HIVE2", "HIVE2", "org.apache.hive.jdbc.HiveDriver"),
IMPALA40("IMPALA40", "IMPALA40", "com.cloudera.impala.jdbc4.Driver"),
IMPALA41("IMPALA41", "IMPALA41", "com.cloudera.impala.jdbc41.Driver");
HIVE2("HIVE2", "HIVE2", "org.apache.hive.jdbc.HiveDriver", "doSupportHive2"),
IMPALA("IMPALA", "IMPALA", "com.cloudera.impala.jdbc.Driver", "doSupportImpalaConnector");
EImpalaDriver(String displayName, String name, String driver) {
EImpalaDriver(String displayName, String name, String driver, String supportDriverMethodName) {
this.displayName = displayName;
this.name = name;
this.driver = driver;
this.supportDriverMethodName = supportDriverMethodName;
}
private String displayName;
@@ -38,6 +38,8 @@ public enum EImpalaDriver {
private String driver;
private String supportDriverMethodName;
public String getDisplayName() {
return displayName;
}
@@ -50,6 +52,10 @@ public enum EImpalaDriver {
return driver;
}
public String getSupportDriverMethodName() {
return supportDriverMethodName;
}
public static boolean isSupport(String distribution, String version, boolean byDisplay, String supportMethodName) {
return HiveMetadataHelper.doSupportMethod(distribution, version, byDisplay, supportMethodName);
}
@@ -57,7 +63,7 @@ public enum EImpalaDriver {
public static String[] getImpalaDriverDisplay(String distribution, String version, boolean byDisplay) {
List<String> list = new ArrayList<>(0);
for (EImpalaDriver driver : EImpalaDriver.values()) {
if (isSupport(distribution, version, byDisplay, "doSupportImpalaConnector")) {
if (isSupport(distribution, version, byDisplay, driver.getSupportDriverMethodName())) {
list.add(driver.getDisplayName());
}
}

View File

@@ -114,6 +114,13 @@ public class DatabaseConnStrUtil {
&& EDatabaseVersion4Drivers.SYBASEIQ_16_SA.getVersionValue().equals(dbVersion)) {
connStr = EDatabaseConnTemplate.SYBASEASE_16_SA;
}
if (EDatabaseTypeName.GREENPLUM.getDisplayName().equals(dbType)) {
if (EDatabaseVersion4Drivers.GREENPLUM.getVersionValue().equals(dbVersion)) {
connStr = EDatabaseConnTemplate.GREENPLUM;
}else if(EDatabaseVersion4Drivers.GREENPLUM_PSQL.getVersionValue().equals(dbVersion)) {
connStr = EDatabaseConnTemplate.GREENPLUM_PSQL;
}
}
EDatabaseVersion4Drivers version = EDatabaseVersion4Drivers.indexOfByVersion(dbVersion);
if (connStr != null) {
String s = connStr.getUrlTemplate(version);
@@ -221,8 +228,10 @@ public class DatabaseConnStrUtil {
.get(ConnParameterKeys.IMPALA_AUTHENTICATION_PRINCIPLA));
}
String url = null;
if (template.startsWith(DbConnStrForHive.URL_HIVE_2_TEMPLATE)) {
url = getImpalaURLString(false, server, port, sidOrDatabase, impalaPrincipal);
String driver = dbConn.getParameters().get(ConnParameterKeys.IMPALA_DRIVER);
if (template.startsWith(DbConnStrForHive.URL_HIVE_2_TEMPLATE)
|| template.startsWith(DbConnStrForHive.URL_IMPALA_TEMPLATE)) {
url = getImpalaURLString(false, server, port, sidOrDatabase, impalaPrincipal, driver);
}
url = attachAdditionalHiveParameters(url, dbConn, false);
return url;
@@ -369,9 +378,13 @@ public class DatabaseConnStrUtil {
return s;
}
private static String getImpalaURLString(boolean supportContext, String server, String port, String sid, String Principal) {
String s = EDatabaseConnTemplate.IMPALA.getUrlTemplate(null);
String standardURlString = getImpalaURlString(s, supportContext, server, port, sid);
private static String getImpalaURLString(boolean supportContext, String server, String port, String sid, String Principal,
String driver) {
String template = EDatabaseConnTemplate.IMPALA.getUrlTemplate(null);
if (EDatabaseTypeName.IMPALA.getDbType().equals(driver)) {
template = EDatabaseConnTemplate.IMPALA_IMPALA_DRIVER.getUrlTemplate(null);
}
String standardURlString = getImpalaURlString(template, supportContext, server, port, sid);
String principalSuffix = "principal="; //$NON-NLS-1$
boolean hasPrinc = false;
String[] urlArray = standardURlString.split(SEMICOLON);

View File

@@ -30,6 +30,8 @@ public class DbConnStrForHive extends DbConnStr {
public static final String URL_HIVE_2_TEMPLATE = "jdbc:hive2://";//$NON-NLS-1$
public static final String URL_IMPALA_TEMPLATE = "jdbc:impala://";//$NON-NLS-1$
/**
* DOC Marvin DbConnStrForHive constructor comment.
*

View File

@@ -54,6 +54,11 @@ public enum EDatabaseConnTemplate {
"5432")), //$NON-NLS-1$
GREENPLUM(new DbConnStr(EDatabaseTypeName.GREENPLUM, //
"jdbc:pivotal:greenplum://<host>:<port>;;DatabaseName=<sid>;<property>", //$NON-NLS-1$
"5432")), //$NON-NLS-1$
GREENPLUM_PSQL(new DbConnStr(EDatabaseTypeName.GREENPLUM, //
"jdbc:postgresql://<host>:<port>/<sid>?<property>", //$NON-NLS-1$
"5432")), //$NON-NLS-1$
@@ -209,6 +214,9 @@ public enum EDatabaseConnTemplate {
IMPALA(new DbConnStr(EDatabaseTypeName.IMPALA, "jdbc:hive2://<host>:<port>/<sid>;auth=noSasl", //$NON-NLS-1$
"21050", null, null, "localhost", "default")), //$NON-NLS-1$
IMPALA_IMPALA_DRIVER(new DbConnStr(EDatabaseTypeName.IMPALA, "jdbc:impala://<host>:<port>/<sid>;auth=noSasl", //$NON-NLS-1$
"21050", null, null, "localhost", "default")), //$NON-NLS-1$
HBASE(new DbConnStr(EDatabaseTypeName.HBASE, "127.0.0.1", //$NON-NLS-1$
"2181")), //$NON-NLS-1$

View File

@@ -99,8 +99,8 @@ public enum EDatabaseVersion4Drivers {
VERTICA_3(new DbVersion4Drivers(EDatabaseTypeName.VERTICA, "VERTICA 3 (Deprecated)", "VERTICA_3", "vertica_3.0_jdk_5.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
// for bug 0017930
GREENPLUM(new DbVersion4Drivers(EDatabaseTypeName.GREENPLUM, "postgresql-8.4-703.jdbc4.jar")), //$NON-NLS-1$
GREENPLUM_PSQL(new DbVersion4Drivers(EDatabaseTypeName.GREENPLUM,"PostgreSQL", "POSTGRESQL", "postgresql-8.4-703.jdbc4.jar")), //$NON-NLS-1$
GREENPLUM(new DbVersion4Drivers(EDatabaseTypeName.GREENPLUM,"Greenplum", "GREENPLUM", "greenplum-5.1.4.000275.jar")), //$NON-NLS-1$
// PSQL_V10(new DbVersion4Drivers(EDatabaseTypeName.PSQL, "v10", "V10", "postgresql-42.2.5.jar")),
PSQL_V9_X(new DbVersion4Drivers(EDatabaseTypeName.PSQL, "v9 and later", "V9_X", "postgresql-42.2.14.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
PSQL_PRIOR_TO_V9(new DbVersion4Drivers(EDatabaseTypeName.PSQL, "Prior to v9", "PRIOR_TO_V9", "postgresql-8.4-703.jdbc4.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

View File

@@ -27,8 +27,8 @@ import org.talend.core.model.process.IElement;
import org.talend.core.model.process.INode;
import org.talend.core.model.process.IProcess;
import org.talend.core.model.process.Problem;
import org.talend.core.model.properties.Property;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.model.routines.CodesJarInfo;
import org.talend.designer.codegen.PigTemplate;
/**
@@ -120,7 +120,7 @@ public interface ILibrariesService extends IService {
Set<ModuleNeeded> getAllCodesJarModuleNeededs();
Set<ModuleNeeded> getCodesJarModuleNeededs(Property property);
Set<ModuleNeeded> getCodesJarModuleNeededs(CodesJarInfo info);
List<ModuleNeeded> getModuleNeeded(String id, boolean isGroup);

View File

@@ -125,6 +125,10 @@ public interface IMetadataColumn {
public void setCustom(boolean custom);
public boolean isIgnoreCustomSort();
public void setIgnoreCustomSort(boolean ignoreCustomSort);
public void setCustomId(int customId); // only for custom columns to sort them
public int getCustomId(); // only for custom columns to sort them

View File

@@ -106,4 +106,6 @@ public interface ISAPConstant {
public static final String PROP_DB_USERNAME = "db.username";//$NON-NLS-1$
public static final String PROP_DB_PASSWORD = "db.password";//$NON-NLS-1$
}
public static final String PROP_DB_ADDITIONAL_PROPERTIES = "db.additionalProperties";//$NON-NLS-1$
}

View File

@@ -53,6 +53,8 @@ public class MetadataColumn implements IMetadataColumn, Cloneable {
private boolean custom = false;
private boolean ignoreCustomSort = false;
private boolean readOnly = false;
private int customId = 0;
@@ -574,6 +576,24 @@ public class MetadataColumn implements IMetadataColumn, Cloneable {
this.custom = custom;
}
/**
* Getter for ignoreCustomSort.
*
* @return the ignoreCustomSort
*/
public boolean isIgnoreCustomSort() {
return ignoreCustomSort;
}
/**
* Sets the ignoreCustomSort.
*
* @param ignoreCustomSort the ignoreCustomSort to set
*/
public void setIgnoreCustomSort(boolean ignoreCustomSort) {
this.ignoreCustomSort = ignoreCustomSort;
}
/**
* Getter for readOnly.
*

View File

@@ -360,7 +360,7 @@ public class MetadataTable implements IMetadataTable, Cloneable {
for (int i = 0; i < listColumns.size(); i++) {
IMetadataColumn column = listColumns.get(i);
if (column.isCustom()) {
if (column.isCustom() && !column.isIgnoreCustomSort()) {
customColumns.add(column);
}
}

View File

@@ -32,6 +32,8 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang.StringUtils;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
@@ -492,18 +494,55 @@ public final class MetadataTalendType {
}
}
private static String getSha1OfFile(File file) {
String sha1 = null;
FileInputStream fileInputStream = null;
try {
fileInputStream = new FileInputStream(file);
sha1 = DigestUtils.shaHex(fileInputStream);
} catch (Exception e) {
ExceptionHandler.process(e);
} finally {
if (fileInputStream != null) {
try {
fileInputStream.close();
} catch (IOException e) {
e.printStackTrace(); // Just print the exception for debug.
}
}
}
return sha1;
}
public static void copyFile(File in, IFile out) throws CoreException, IOException {
FileInputStream fis = new FileInputStream(in);
if (out.exists()) {
out.setContents(fis, true, false, null);
} else {
out.create(fis, true, null);
}
fis.close();
}
public static void syncNewMappingFileToProject() throws SystemException {
try {
File sysMappingFiles = new File(MetadataTalendType.getSystemForderURLOfMappingsFile().getPath());
IFolder projectMappingFolder = ResourceUtils.getProject(ProjectManager.getInstance().getCurrentProject())
.getFolder(MetadataTalendType.PROJECT_MAPPING_FOLDER);
File projectMappingFiles = projectMappingFolder.getFullPath().toFile();
if (sysMappingFiles.list().length == new File(projectMappingFolder.getLocationURI()).list().length) {
File projectMappingFiles = new File(projectMappingFolder.getLocationURI());
if (!sysMappingFiles.exists() || !projectMappingFiles.exists()) {
return;
}
for (File sysMapping : sysMappingFiles.listFiles()) {
IFile projectMapping = projectMappingFolder.getFile(sysMapping.getName());
if (projectMapping.exists() && StringUtils.equals(sysMapping.getName(), "mapping_Greenplum.xml")) {
String sha1OfFile = DigestUtils.shaHex(projectMapping.getContents());
String shalOfOldSystem = "8431f19215dacb3caa126778ae695954552cce2a";
if (StringUtils.equals(sha1OfFile, shalOfOldSystem)) {
copyFile(sysMapping, projectMapping);
}
}
if (!projectMapping.exists()) {
FileInputStream fis = null;
try {

View File

@@ -25,8 +25,10 @@ import org.apache.avro.SchemaBuilder.FieldAssembler;
import org.apache.avro.SchemaBuilder.FieldBuilder;
import org.apache.avro.SchemaBuilder.PropBuilder;
import org.apache.avro.SchemaBuilder.RecordBuilder;
import org.apache.avro.SchemaParseException;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.eclipse.emf.common.util.EList;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.core.GlobalServiceRegister;
@@ -49,6 +51,10 @@ import orgomg.cwm.objectmodel.core.TaggedValue;
*/
public final class MetadataToolAvroHelper {
private static Logger LOGGER = Logger.getLogger(MetadataToolAvroHelper.class);
private static final String COLUMN = "Column";
private static final String TALEND_DB_COLUMN_NAME = "talend.field.dbColumnName";
/**
* @return An Avro schema with enriched properties from the incoming metadata table.
@@ -66,7 +72,7 @@ public final class MetadataToolAvroHelper {
dynamicPosition = i;
dynColumn = column;
} else {
fa = convertToAvro(fa, column);
fa = convertToAvro(fa, column, i);
}
i++;
}
@@ -137,7 +143,7 @@ public final class MetadataToolAvroHelper {
* Build a field into a schema using enriched properties from the incoming column.
*/
private static FieldAssembler<Schema> convertToAvro(FieldAssembler<Schema> fa,
org.talend.core.model.metadata.builder.connection.MetadataColumn in) {
org.talend.core.model.metadata.builder.connection.MetadataColumn in, int i) {
ICoreService coreService = (ICoreService) GlobalServiceRegister.getDefault().getService(ICoreService.class);
String label = in.getLabel();
if (label != null && coreService != null) {
@@ -237,7 +243,27 @@ public final class MetadataToolAvroHelper {
}
type = in.isNullable() ? AvroUtils.wrapAsNullable(type) : type;
return defaultValue == null ? fb.type(type).noDefault() : fb.type(type).withDefault(defaultValue);
FieldAssembler<Schema> returnResult = null;
try {
if (defaultValue == null) {
returnResult = fb.type(type).noDefault();
} else {
returnResult = fb.type(type).withDefault(defaultValue);
}
} catch (SchemaParseException e) {
// if validation not pass from avro ,then generate a new name like Column0 to pass the validation, but
// actually the display name of schema and the column name is using TALEND_DB_COLUMN_NAME
String genColumn = COLUMN + i;
FieldBuilder<Schema> fbNew = fa.name(genColumn);
copyColumnProperties(fbNew, in);
if (defaultValue == null) {
returnResult = fbNew.type(type).noDefault();
} else {
returnResult = fbNew.type(type).withDefault(defaultValue);
}
LOGGER.info(e.getMessage() + ", use " + genColumn + " instead");
}
return returnResult;
}
private static Schema getLogicalTypeSchema(org.talend.core.model.metadata.builder.connection.MetadataColumn column) {

View File

@@ -281,9 +281,7 @@ public final class MetadataToolHelper {
}
public static boolean isAllowSpecificCharacters() {
IEclipsePreferences coreUIPluginNode = new InstanceScope().getNode(ITalendCorePrefConstants.CoreUIPlugin_ID);
return coreUIPluginNode
.getBoolean(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS, false);
return CoreRuntimePlugin.getInstance().getProjectPreferenceManager().isAllowSpecificCharacters();
}
/**
@@ -614,6 +612,7 @@ public final class MetadataToolHelper {
target.getListColumns().remove(targetColumn);
newTargetColumn.setCustom(targetColumn.isCustom());
newTargetColumn.setCustomId(targetColumn.getCustomId());
newTargetColumn.setIgnoreCustomSort(targetColumn.isIgnoreCustomSort());
columnsTAdd.add(newTargetColumn);
}
}
@@ -773,6 +772,7 @@ public final class MetadataToolHelper {
target.getListColumns().remove(targetColumn);
newTargetColumn.setCustom(targetColumn.isCustom());
newTargetColumn.setCustomId(targetColumn.getCustomId());
newTargetColumn.setIgnoreCustomSort(targetColumn.isIgnoreCustomSort());
columnsTAdd.add(newTargetColumn);
}
}

View File

@@ -443,6 +443,13 @@ public class RepositoryToComponentProperty {
} else {
return TalendQuoteUtils.addQuotes(connection.getValue(dbPassword, false));
}
} else if ("SAPHANA_PROPERTIES_STRING".equals(value)) { //$NON-NLS-1$
String dbParameters = TaggedValueHelper.getValueString(ISAPConstant.PROP_DB_ADDITIONAL_PROPERTIES, connection);
if (isContextMode(connection, dbParameters)) {
return dbParameters;
} else {
return TalendQuoteUtils.addQuotes(dbParameters);
}
}
return null;
}
@@ -1071,7 +1078,10 @@ public class RepositoryToComponentProperty {
return dbVersionString;
} else if (EDatabaseTypeName.SYBASEASE.getDisplayName().equals(databaseType)) {
return dbVersionString;
} else {
} else if (EDatabaseTypeName.GREENPLUM.getDisplayName().equals(databaseType)) {
return dbVersionString;
}else {
String driverValue = EDatabaseVersion4Drivers.getDriversStr(databaseType, dbVersionString);
if (EDatabaseConnTemplate.ORACLE_OCI.getDBDisplayName().equals(databaseType)
|| EDatabaseConnTemplate.ORACLE_CUSTOM.getDBDisplayName().equals(databaseType)

View File

@@ -146,7 +146,7 @@ public abstract class AbstractItemMigrationTask extends AbstractMigrationTask im
* this returns all type handled by this migration task even the extended type that could benefit from this
* migrations
* */
List<ERepositoryObjectType> getAllTypes() {
protected List<ERepositoryObjectType> getAllTypes() {
List<ERepositoryObjectType> declaredTypes = getTypes();
ArrayList<ERepositoryObjectType> allTypes = new ArrayList<ERepositoryObjectType>(declaredTypes.size());
allTypes.addAll(declaredTypes);

View File

@@ -124,6 +124,7 @@ public enum EParameterFieldType {
TACOKIT_BUTTON,
TACOKIT_SUGGESTABLE_TABLE,
TACOKIT_VALUE_SELECTION,
TACOKIT_TABLE,
TACOKIT_TEXT_AREA_SELECTION;
public String getName() {

View File

@@ -12,6 +12,7 @@
// ============================================================================
package org.talend.core.model.process;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@@ -133,4 +134,8 @@ public interface IProcess extends IElement {
public String getComponentsType();
public INode getNodeByUniqueName(String uniqueName);
default List<? extends INode> getProcessNodes() {
return new ArrayList<INode>();
}
}

View File

@@ -67,6 +67,8 @@ public class JobInfo {
private boolean needUnloadProcessor;
private int includeESBFlag = 0;
public JobInfo(String jobId, String contextName, String version) {
this.jobId = jobId;
this.contextName = contextName;
@@ -572,4 +574,13 @@ public class JobInfo {
public boolean isNeedUnloadProcessor() {
return this.needUnloadProcessor;
}
public int getIncludeESBFlag() {
return includeESBFlag;
}
public void setIncludeESBFlag(int includeESBFlag) {
this.includeESBFlag = includeESBFlag;
}
}

View File

@@ -12,9 +12,23 @@
// ============================================================================
package org.talend.core.model.routines;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.core.runtime.Assert;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.exception.PersistenceException;
import org.talend.core.model.properties.Property;
import org.talend.core.model.properties.RoutinesJarItem;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.model.repository.IRepositoryViewObject;
import org.talend.core.runtime.repository.item.ItemProductKeys;
import org.talend.cwm.helper.ResourceHelper;
import org.talend.designer.core.model.utils.emf.component.IMPORTType;
import org.talend.repository.ProjectManager;
import org.talend.repository.model.IProxyRepositoryService;
/**
* Could get most of codesjar's attribute in EMF model but some are lost when model is unloaded. Store those attributes
@@ -23,7 +37,7 @@ import org.talend.repository.ProjectManager;
public class CodesJarInfo {
private Property property;
private static final String EMPTY_DATE;
private String projectTechName;
@@ -35,24 +49,47 @@ public class CodesJarInfo {
private ERepositoryObjectType type;
private CodesJarInfo() {
private List<IMPORTType> imports;
private String modifiedDate;
static {
Calendar c = Calendar.getInstance();
c.setTimeInMillis(0);
EMPTY_DATE = ResourceHelper.dateFormat().format(c.getTime());
}
private CodesJarInfo() {
imports = new ArrayList<>();
}
public static CodesJarInfo create(Property property) {
Assert.isTrue(property.getItem() instanceof RoutinesJarItem);
CodesJarInfo info = new CodesJarInfo();
info.property = property;
info.projectTechName = ProjectManager.getInstance().getProject(property).getTechnicalLabel();
info.id = property.getId();
info.label = property.getLabel();
info.version = property.getVersion();
info.type = ERepositoryObjectType.getItemType(property.getItem());
if (((RoutinesJarItem) property.getItem()).getRoutinesJarType() != null) {
info.imports.addAll(((RoutinesJarItem) property.getItem()).getRoutinesJarType().getImports());
}
String modifiedDate = (String) property.getAdditionalProperties().get(ItemProductKeys.DATE.getModifiedKey());
info.modifiedDate = StringUtils.isNotBlank(modifiedDate) ? modifiedDate : EMPTY_DATE;
return info;
}
public Property getProperty() {
return property;
}
try {
IRepositoryViewObject obj = IProxyRepositoryService.get().getProxyRepositoryFactory().getLastVersion(id);
if (obj != null) {
return obj.getProperty();
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
return null;
}
public String getProjectTechName() {
return projectTechName;
@@ -74,6 +111,14 @@ public class CodesJarInfo {
return type;
}
public List<IMPORTType> getImports() {
return imports;
}
public String getModifiedDate() {
return modifiedDate;
}
public boolean isInCurrentMainProject() {
return projectTechName.equals(ProjectManager.getInstance().getCurrentProject().getTechnicalLabel());
}
@@ -82,36 +127,42 @@ public class CodesJarInfo {
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((projectTechName == null) ? 0 : projectTechName.hashCode());
result = prime * result + ((property == null) ? 0 : property.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((label == null) ? 0 : label.hashCode());
result = prime * result + ((type == null) ? 0 : type.hashCode());
result = prime * result + ((version == null) ? 0 : version.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
if (this == obj)
return true;
}
if (obj == null) {
if (obj == null)
return false;
}
if (getClass() != obj.getClass()) {
if (getClass() != obj.getClass())
return false;
}
CodesJarInfo other = (CodesJarInfo) obj;
if (projectTechName == null && other.projectTechName != null) {
return false;
} else if (!projectTechName.equals(other.projectTechName)) {
return false;
}
if (property == null && other.property != null) {
return false;
} else if (property != null && other.property != null) {
if (!property.getId().equals(other.property.getId()) || !property.getLabel().equals(other.property.getLabel())
|| !property.getVersion().equals(other.property.getVersion())) {
if (id == null) {
if (other.id != null)
return false;
}
}
} else if (!id.equals(other.id))
return false;
if (label == null) {
if (other.label != null)
return false;
} else if (!label.equals(other.label))
return false;
if (type == null) {
if (other.type != null)
return false;
} else if (!type.equals(other.type))
return false;
if (version == null) {
if (other.version != null)
return false;
} else if (!version.equals(other.version))
return false;
return true;
}

View File

@@ -36,6 +36,7 @@ import org.apache.oro.text.regex.Perl5Compiler;
import org.apache.oro.text.regex.Perl5Matcher;
import org.apache.oro.text.regex.Perl5Substitution;
import org.apache.oro.text.regex.Util;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.talend.commons.utils.PasswordEncryptUtil;
@@ -52,6 +53,7 @@ import org.talend.core.model.process.IContextManager;
import org.talend.core.model.process.IContextParameter;
import org.talend.core.model.repository.IRepositoryPrefConstants;
import org.talend.core.prefs.ITalendCorePrefConstants;
import org.talend.core.runtime.CoreRuntimePlugin;
import org.talend.core.runtime.services.IGenericDBService;
import org.talend.core.utils.TalendQuoteUtils;
import org.talend.designer.core.model.utils.emf.talendfile.ContextParameterType;
@@ -617,8 +619,12 @@ public final class ContextParameterUtils {
}
private static boolean isAllowSpecificCharacters() {
IEclipsePreferences coreUIPluginNode = new InstanceScope().getNode(ITalendCorePrefConstants.CoreUIPlugin_ID);
return coreUIPluginNode.getBoolean(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS, false);
if (Platform.isRunning()) {
return CoreRuntimePlugin.getInstance().getProjectPreferenceManager().isAllowSpecificCharacters();
} else {
IEclipsePreferences coreUIPluginNode = new InstanceScope().getNode(ITalendCorePrefConstants.CoreUIPlugin_ID);
return coreUIPluginNode.getBoolean(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS, false);
}
}
public static boolean isEmptyParameter(String source) {

View File

@@ -418,6 +418,52 @@ public class NodeUtil {
return conns;
}
/**
* DOC
* <p>
* The method searches for the incoming node connections of type
* on a processing path and returns the first ones only
* </p>
*
* @param node
* @param type - node type to look for
* @return
*/
public static List<? extends IConnection> getFirstIncomingLineConnectionsOfType(INode node, String type) {
if (type == null)
return new ArrayList<IConnection>();
Set<String> uniqueNamesDone = new HashSet<String>();
List<? extends IConnection> allIncomingConnections = getFirstIncomingLineConnectionsOfType(node, uniqueNamesDone, type);
return allIncomingConnections;
}
private static List<? extends IConnection> getFirstIncomingLineConnectionsOfType(INode node, Set<String> uniqueNamesDone, String type) {
List<IConnection> conns = new ArrayList<IConnection>();
List<? extends IConnection> incomingConnections = node.getIncomingConnections();
if (incomingConnections != null) {
for (int i = 0; i < incomingConnections.size(); i++) {
IConnection connection = incomingConnections.get(i);
INode nextNode = connection.getSource();
if (!uniqueNamesDone.contains(nextNode.getUniqueName())) {
uniqueNamesDone.add(nextNode.getUniqueName());
if (type.equals((String)nextNode.getElementParameter("COMPONENT_NAME").getValue())) {
conns.add(connection);
} else {
conns.addAll(getFirstIncomingLineConnectionsOfType(nextNode, uniqueNamesDone, type)); // follow this way
}
}
}
}
return conns;
}
public static INode getFirstMergeNode(INode node) {
INode mergeNode = null;
for (IConnection connection : node.getOutgoingConnections()) {

View File

@@ -126,6 +126,9 @@ public abstract class AbstractPropertyValueEvaluator implements PropertyValueEva
}
if (GenericTypeUtils.isStringType(property)) {
if (property.isFlag(Property.Flags.ENCRYPT)) {
return TalendQuoteUtils.removeQuotes(stringValue);
}
return TalendQuoteUtils.removeQuotes(StringEscapeUtils.unescapeJava(stringValue));
}
return rawValue;

View File

@@ -46,6 +46,8 @@ public interface MavenConstants {
static final String EXCLUDE_DELETED_ITEMS = "EXCLUDE_DELETED_ITEMS";
static final String SKIP_LOOP_DEPENDENCY_CHECK = "SKIP_LOOP_DEPENDENCY_CHECK";
static final String SKIP_FOLDERS = "SKIP_FOLDERS";
/*

View File

@@ -80,4 +80,13 @@ public interface TalendProcessOptionConstants {
*/
public static final int MODULES_WITH_CODESJAR = 1 << 6;
/**
* flag for check if is ESB job
*/
public static final int ISESB_CHECKED = 1;
public static final int ISESB_CHILDREN_INCLUDE = 1 << 1;
public static final int ISESB_CURRENT_INCLUDE = 1 << 2;
}

View File

@@ -15,6 +15,7 @@ package org.talend.core.runtime.projectsetting;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.Assert;
@@ -27,6 +28,7 @@ import org.talend.commons.exception.PersistenceException;
import org.talend.commons.utils.workbench.resources.ResourceUtils;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.model.general.Project;
import org.talend.core.model.repository.IRepositoryPrefConstants;
import org.talend.designer.runprocess.IRunProcessService;
import org.talend.repository.ProjectManager;
import org.talend.repository.documentation.ERepositoryActionName;
@@ -195,7 +197,19 @@ public class ProjectPreferenceManager {
// return qulifierPreference.getBoolean(key, false);
return getPreferenceStore().getBoolean(key);
}
public boolean isAllowSpecificCharacters() {
String value = getValue(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS);
if (StringUtils.isNotEmpty(value)) {
return Boolean.valueOf(value);
}
return false; // Default value
}
public void setAllowSpecificCharacters(boolean isAllow) {
setValue(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS, isAllow);
}
/**
* Save the configurations.
*/

View File

@@ -14,17 +14,16 @@ package org.talend.core.runtime.services;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.IService;
import org.talend.core.model.properties.Item;
import org.talend.core.model.properties.Property;
import org.talend.core.model.properties.RoutineItem;
import org.talend.core.model.routines.CodesJarInfo;
public interface IDesignerMavenService extends IService {
String getCodesJarPackageByInnerCode(RoutineItem innerCodeItem);
String getImportGAVPackageForCodesJar(String projectTechName, Item codesJarItem);
String getImportGAVPackageForCodesJar(CodesJarInfo info);
void updateCodeJarMavenProject(Property codeJarProperty, boolean needReSync) throws Exception;
void updateCodeJarMavenProject(CodesJarInfo info, boolean needReSync) throws Exception;
public static IDesignerMavenService get() {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerMavenService.class)) {

View File

@@ -47,4 +47,6 @@ public interface ICoreUIService extends IService {
String getPreferenceValue(String key);
void loadComponentsFromProviders(ERepositoryObjectType type);
void resetDataCollectorData();
}

View File

@@ -147,4 +147,6 @@ public interface IJobletProviderService extends IService {
public void updateJobleModifiedRelated(Item item, String oldName, String newName);
public IProcess getJobletGEFProcessFromNode(INode node);
}

View File

@@ -39,10 +39,11 @@ public class CodesJarResourceCache {
List<Project> allProjects = new ArrayList<>();
allProjects.addAll(ProjectManager.getInstance().getAllReferencedProjects(true));
allProjects.add(ProjectManager.getInstance().getCurrentProject());
IProxyRepositoryFactory factory = IProxyRepositoryService.get().getProxyRepositoryFactory();
try {
for (Project project : allProjects) {
for (ERepositoryObjectType codesJarType : ERepositoryObjectType.getAllTypesOfCodesJar()) {
List<IRepositoryViewObject> objects = getProxyRepositoryFactory().getAllCodesJars(project, codesJarType);
List<IRepositoryViewObject> objects = factory.getAllCodesJars(project, codesJarType);
for (IRepositoryViewObject obj : objects) {
CACHE.add(CodesJarInfo.create(obj.getProperty()));
}
@@ -63,8 +64,7 @@ public class CodesJarResourceCache {
public static CodesJarInfo getCodesJarById(String id) {
synchronized (LOCK) {
Optional<CodesJarInfo> optional = CACHE.stream().filter(info -> info.getProperty().getId().equals(id))
.findFirst();
Optional<CodesJarInfo> optional = CACHE.stream().filter(info -> info.getId().equals(id)).findFirst();
if (optional.isPresent()) {
return optional.get();
}
@@ -75,13 +75,12 @@ public class CodesJarResourceCache {
public static CodesJarInfo getCodesJarByLabel(ERepositoryObjectType type, String projectTechName, String label) {
synchronized (LOCK) {
Optional<CodesJarInfo> optional = CACHE.stream().filter(
info -> ERepositoryObjectType.getItemType(info.getProperty().getItem()) == type
&& info.getProperty().getLabel().equals(label) && info.getProjectTechName().equals(projectTechName))
.findFirst();
Optional<CodesJarInfo> optional = CACHE.stream().filter(info -> info.getType() == type
&& info.getLabel().equals(label) && info.getProjectTechName().equals(projectTechName)).findFirst();
if (optional.isPresent()) {
return optional.get();
}
ExceptionHandler.process(new Exception("Codes jar [" + label + "] is not found!")); //$NON-NLS-1$ //$NON-NLS-2$
return null;
}
}
@@ -89,19 +88,23 @@ public class CodesJarResourceCache {
public static CodesJarInfo getCodesJarByInnerCode(RoutineItem routineItem) throws PersistenceException {
String codesJarName = RoutinesUtil.getCodesJarLabelByInnerCode(routineItem);
String projectTechName = ProjectManager.getInstance().getProject(routineItem).getTechnicalLabel();
return getAllCodesJars().stream()
.filter(info -> info.getProperty().getLabel().equals(codesJarName)
&& info.getProjectTechName().equals(projectTechName))
.findFirst().get();
Optional<CodesJarInfo> optional = getAllCodesJars().stream()
.filter(info -> info.getLabel().equals(codesJarName) && info.getProjectTechName().equals(projectTechName))
.findFirst();
if (optional.isPresent()) {
return optional.get();
}
ExceptionHandler.process(new Exception("Codes jar [" + routineItem.getProperty().getLabel() + "] is not found!")); //$NON-NLS-1$ //$NON-NLS-2$
return null;
}
public static void addToCache(Property newProperty) {
synchronized (LOCK) {
Iterator<CodesJarInfo> iterator = CACHE.iterator();
while (iterator.hasNext()) {
Property oldProperty = iterator.next().getProperty();
if (newProperty.getId().equals(oldProperty.getId()) && newProperty.getLabel().equals(oldProperty.getLabel())
&& newProperty.getVersion().equals(oldProperty.getVersion())) {
CodesJarInfo oldInfo = iterator.next();
if (newProperty.getId().equals(oldInfo.getId()) && newProperty.getLabel().equals(oldInfo.getLabel())
&& newProperty.getVersion().equals(oldInfo.getVersion())) {
iterator.remove();
}
}
@@ -113,10 +116,9 @@ public class CodesJarResourceCache {
synchronized (LOCK) {
Iterator<CodesJarInfo> iterator = CACHE.iterator();
while (iterator.hasNext()) {
Property oldProperty = iterator.next().getProperty();
if ((oldId == null || (oldId != null && oldId.equals(oldProperty.getId())))
&& oldLabel.equals(oldProperty.getLabel())
&& oldVersion.equals(oldProperty.getVersion())) {
CodesJarInfo oldInfo = iterator.next();
if ((oldId == null || (oldId != null && oldId.equals(oldInfo.getId()))) && oldLabel.equals(oldInfo.getLabel())
&& oldVersion.equals(oldInfo.getVersion())) {
iterator.remove();
}
}
@@ -128,22 +130,15 @@ public class CodesJarResourceCache {
synchronized (LOCK) {
Iterator<CodesJarInfo> iterator = CACHE.iterator();
while (iterator.hasNext()) {
Property oldProperty = iterator.next().getProperty();
if (oldProperty.getId().equals(property.getId()) && oldProperty.getLabel().equals(property.getLabel())
&& oldProperty.getVersion().equals(property.getVersion())) {
CodesJarInfo oldInfo = iterator.next();
if (oldInfo.getId().equals(property.getId()) && oldInfo.getLabel().equals(property.getLabel())
&& oldInfo.getVersion().equals(property.getVersion())) {
iterator.remove();
}
}
}
}
private static IProxyRepositoryFactory getProxyRepositoryFactory() {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IProxyRepositoryService.class)) {
return GlobalServiceRegister.getDefault().getService(IProxyRepositoryService.class).getProxyRepositoryFactory();
}
return null;
}
public static void addCodesJarChangeListener() {
if (!isListenerAdded) {
synchronized (LOCK) {

View File

@@ -271,14 +271,10 @@ public abstract class AbstractRoutineSynchronizer implements ITalendSynchronizer
protected void syncInnerCodeItems(boolean forceUpdate) throws SystemException {
IProxyRepositoryFactory factory = getRepositoryService().getProxyRepositoryFactory();
for (CodesJarInfo info : CodesJarResourceCache.getAllCodesJars()) {
Property property = info.getProperty();
String projectTechName = info.getProjectTechName();
Project project = ProjectManager.getInstance().getProjectFromProjectTechLabel(projectTechName);
ERepositoryObjectType codesJarType = ERepositoryObjectType.getItemType(property.getItem());
List<IRepositoryViewObject> innerCodesObjects = factory.getAllInnerCodes(project, codesJarType, property);
List<IRepositoryViewObject> innerCodesObjects = factory.getAllInnerCodes(info);
for (IRepositoryViewObject codesObj : innerCodesObjects) {
RoutineItem codeItem = (RoutineItem) codesObj.getProperty().getItem();
syncRoutine(codeItem, projectTechName, true, forceUpdate);
syncRoutine(codeItem, info.getProjectTechName(), true, forceUpdate);
}
}
}
@@ -295,11 +291,8 @@ public abstract class AbstractRoutineSynchronizer implements ITalendSynchronizer
return;
}
CodesJarInfo info = CodesJarResourceCache.getCodesJarByInnerCode(routineItem);
Property codesJarProperty = info.getProperty();
IFolder innerCodeFolder = ResourceUtils.getFolder(ResourceUtils.getProject(info.getProjectTechName()),
ERepositoryObjectType.getFolderName(ERepositoryObjectType.getItemType(codesJarProperty.getItem())) + "/"
+ codesJarProperty.getLabel(),
true);
ERepositoryObjectType.getFolderName(info.getType()) + "/" + info.getLabel(), true);
IFile innerCodeFile = innerCodeFolder
.getFile(routineItem.getProperty().getLabel() + "_" + routineItem.getProperty().getVersion() + ".item");
if (innerCodeFile.exists()) {

View File

@@ -192,7 +192,7 @@ public interface IRunProcessService extends IService {
@Deprecated
public void buildJavaProject();
public void buildCodesJavaProject(IProgressMonitor monitor);
public void buildCodesJavaProject(IProgressMonitor monitor, Set<CodesJarInfo> toUpdate);
/**
* @deprecated use {@link IRunProcessService#getTalendJobJavaProject(Property)} instead
@@ -258,6 +258,8 @@ public interface IRunProcessService extends IService {
public boolean isExcludeDeletedItems(Property property);
public boolean getMavenPrefOptionStatus(String prefName);
public static IRunProcessService get() {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
return GlobalServiceRegister.getDefault().getService(IRunProcessService.class);

View File

@@ -186,7 +186,7 @@ public final class ProjectManager {
Set<String> resolvedProjectLabels, boolean force) {
if (p != null) {
String parentBranch = ProjectManager.getInstance().getMainProjectBranch(p);
if (parentBranch != null || force) {
if ((!p.isLocal() || parentBranch != null) || force) {
resolvedProjectLabels.add(p.getTechnicalLabel());
for (ProjectReference pr : new Project(p).getProjectReferenceList()) {
if (ProjectManager.validReferenceProject(p, pr)

View File

@@ -43,6 +43,7 @@ import org.talend.core.model.repository.Folder;
import org.talend.core.model.repository.IRepositoryViewObject;
import org.talend.core.model.repository.IRepositoryWorkUnitListener;
import org.talend.core.model.repository.LockInfo;
import org.talend.core.model.routines.CodesJarInfo;
import org.talend.repository.RepositoryWorkUnit;
/**
@@ -317,11 +318,7 @@ public interface IProxyRepositoryFactory {
public abstract List<IRepositoryViewObject> getAllCodesJars(Project project, ERepositoryObjectType type)
throws PersistenceException;
public abstract List<IRepositoryViewObject> getAllInnerCodes(ERepositoryObjectType codesJarType, Property jarProperty)
throws PersistenceException;
public abstract List<IRepositoryViewObject> getAllInnerCodes(Project project, ERepositoryObjectType codesJarType,
Property jarProperty) throws PersistenceException;
public abstract List<IRepositoryViewObject> getAllInnerCodes(CodesJarInfo info) throws PersistenceException;
public abstract List<String> getFolders(ERepositoryObjectType type) throws PersistenceException;

View File

@@ -12,6 +12,7 @@
// ============================================================================
package org.talend.repository.model;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.IService;
/**
@@ -20,4 +21,11 @@ import org.talend.core.IService;
public interface IProxyRepositoryService extends IService {
public IProxyRepositoryFactory getProxyRepositoryFactory();
public static IProxyRepositoryService get() {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IProxyRepositoryService.class)) {
return GlobalServiceRegister.getDefault().getService(IProxyRepositoryService.class);
}
return null;
}
}

View File

@@ -36,6 +36,12 @@
id="org.talend.core.ui.token.RepositroyActionsTokenCollector"
name="actions">
</provider>
<provider
collector="org.talend.core.ui.token.AdditionalPackagesTokenCollector"
description="installed addtional package, old iems, amc"
id="org.talend.core.ui.token.AdditionalPackageTokenCollector"
name="addtional package">
</provider>
</extension>
<extension

View File

@@ -27,6 +27,7 @@ import org.talend.core.ui.component.ComponentPaletteUtilities;
import org.talend.core.ui.component.ComponentsFactoryProvider;
import org.talend.core.ui.services.IDesignerCoreUIService;
import org.talend.core.ui.services.IRulesProviderService;
import org.talend.core.ui.token.TokenCollectorFactory;
/**
* DOC ggu class global comment. Detailled comment
@@ -107,4 +108,9 @@ public class CoreUIService implements ICoreUIService {
designerCoreUIService.loadComponentsFromProviders(type);
}
}
@Override
public void resetDataCollectorData() {
TokenCollectorFactory.getFactory().reset();
}
}

View File

@@ -12,17 +12,17 @@
// ============================================================================
package org.talend.core.ui.preference;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.talend.core.model.repository.IRepositoryPrefConstants;
import org.talend.core.ui.CoreUIPlugin;
public class SpecificSettingPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
public SpecificSettingPreferencePage() {
setPreferenceStore(CoreUIPlugin.getDefault().getPreferenceStore());
setDescription("Specific settings");
noDefaultAndApplyButton();
}
/*
@@ -32,8 +32,6 @@ public class SpecificSettingPreferencePage extends FieldEditorPreferencePage imp
*/
@Override
protected void createFieldEditors() {
addField(new BooleanFieldEditor(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS,
"Allow specific characters (UTF8,...) for columns of schemas", getFieldEditorParent()));
}

View File

@@ -14,7 +14,6 @@ package org.talend.core.ui.preference.metadata;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.jface.preference.IPreferenceStore;
import org.talend.core.model.repository.IRepositoryPrefConstants;
import org.talend.core.prefs.ITalendCorePrefConstants;
import org.talend.core.ui.CoreUIPlugin;
@@ -27,8 +26,6 @@ public class MetadataPreferenceInitializer extends AbstractPreferenceInitializer
public void initializeDefaultPreferences() {
IPreferenceStore store = CoreUIPlugin.getDefault().getPreferenceStore();
store.setDefault(ITalendCorePrefConstants.MAXIMUM_AMOUNT_OF_COLUMNS_FOR_XML, 500);
store.setDefault(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS, false);
}
}

View File

@@ -0,0 +1,40 @@
// ============================================================================
//
// 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.ui.token;
import org.talend.commons.utils.time.PropertiesCollectorUtil;
import us.monoid.json.JSONObject;
public class AdditionalPackagesTokenCollector extends AbstractTokenCollector {
public AdditionalPackagesTokenCollector() {
// TODO Auto-generated constructor stub
}
@Override
public JSONObject collect() throws Exception {
String records = PropertiesCollectorUtil.getAdditionalPackageRecording();
JSONObject allRecords;
try {
allRecords = new JSONObject(records);
} catch (Exception e) {
// the value is not set, or is empty
allRecords = new JSONObject();
allRecords.put(PropertiesCollectorUtil.getAdditionalPackagePreferenceNode(), new JSONObject());
}
return allRecords;
}
}

View File

@@ -32,7 +32,6 @@ import org.apache.commons.lang.StringUtils;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.exception.PersistenceException;
import org.talend.core.i18n.Messages;
import org.talend.core.model.context.ContextUtils;
import org.talend.core.model.general.Project;
import org.talend.core.model.process.IContextParameter;
import org.talend.core.model.properties.Item;
@@ -79,6 +78,9 @@ public class ContextOrderProperties extends Properties {
@Override
public Object put(Object key, Object value) {
keys.add(key);
if (value == null) {
return super.remove(key);
}
return super.put(key, value);
}

View File

@@ -19,9 +19,11 @@ import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import org.eclipse.core.resources.IFolder;
import org.eclipse.emf.common.util.EList;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.exception.PersistenceException;
import org.talend.commons.utils.workbench.resources.ResourceUtils;
import org.talend.core.CorePlugin;
import org.talend.core.language.ECodeLanguage;
import org.talend.core.language.LanguageManager;
@@ -36,6 +38,7 @@ import org.talend.core.model.properties.ProcessItem;
import org.talend.core.model.properties.RoutineItem;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.model.repository.IRepositoryViewObject;
import org.talend.core.model.routines.CodesJarInfo;
import org.talend.core.runtime.services.IDesignerMavenService;
import org.talend.core.ui.ITestContainerProviderService;
import org.talend.core.utils.CodesJarResourceCache;
@@ -151,9 +154,9 @@ public final class CodeGeneratorRoutine {
}
if (routinesParameterTypes != null) {
routinesParameterTypes.stream().filter(r -> r.getType() != null)
.map(r -> CodesJarResourceCache.getCodesJarById(r.getId())).filter(info -> info != null)
.forEach(info -> neededCodesJars.add(designerMavenService.getImportGAVPackageForCodesJar(
info.getProjectTechName(), info.getProperty().getItem())));
.map(r -> CodesJarResourceCache.getCodesJarById(r.getId()))
.filter(info -> info != null && hasInnerCodes(info))
.forEach(info -> neededCodesJars.add(designerMavenService.getImportGAVPackageForCodesJar(info)));
}
});
}
@@ -161,6 +164,18 @@ public final class CodeGeneratorRoutine {
return neededCodesJars;
}
private static boolean hasInnerCodes(CodesJarInfo info) {
try {
IFolder folder = ResourceUtils
.getProject(ProjectManager.getInstance().getProjectFromProjectTechLabel(info.getProjectTechName()))
.getFolder(ERepositoryObjectType.getFolderName(info.getType())).getFolder(info.getLabel());
return folder.exists() && folder.members().length > 0;
} catch (Exception e) {
ExceptionHandler.process(e);
}
return false;
}
/**
*
* Deprecate for won't use pigudf any more

View File

@@ -25,8 +25,10 @@ import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.jar.JarEntry;
import java.util.jar.JarOutputStream;
@@ -78,8 +80,6 @@ import org.talend.core.language.LanguageManager;
import org.talend.core.model.components.ComponentCategory;
import org.talend.core.model.components.EComponentType;
import org.talend.core.model.components.IComponent;
import org.talend.core.model.components.IComponentsFactory;
import org.talend.core.model.components.IComponentsService;
import org.talend.core.model.context.ContextUtils;
import org.talend.core.model.general.ModuleNeeded;
import org.talend.core.model.general.Project;
@@ -98,10 +98,8 @@ import org.talend.core.model.process.JobInfo;
import org.talend.core.model.process.ProcessUtils;
import org.talend.core.model.process.ReplaceNodesInProcessProvider;
import org.talend.core.model.properties.Item;
import org.talend.core.model.properties.JobletProcessItem;
import org.talend.core.model.properties.ProcessItem;
import org.talend.core.model.properties.Property;
import org.talend.core.model.relationship.Relation;
import org.talend.core.model.relationship.RelationshipItemBuilder;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.model.repository.IRepositoryObject;
@@ -109,9 +107,12 @@ import org.talend.core.model.repository.IRepositoryViewObject;
import org.talend.core.model.repository.RepositoryManager;
import org.talend.core.model.repository.job.JobResource;
import org.talend.core.model.repository.job.JobResourceManager;
import org.talend.core.model.routines.CodesJarInfo;
import org.talend.core.model.routines.RoutinesUtil;
import org.talend.core.model.utils.JavaResourcesHelper;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.core.runtime.CoreRuntimePlugin;
import org.talend.core.runtime.maven.MavenConstants;
import org.talend.core.runtime.process.ITalendProcessJavaProject;
import org.talend.core.runtime.process.LastGenerationInfo;
import org.talend.core.runtime.process.TalendProcessArgumentConstant;
@@ -124,6 +125,7 @@ import org.talend.core.services.ISVNProviderService;
import org.talend.core.ui.IJobletProviderService;
import org.talend.core.ui.ITestContainerProviderService;
import org.talend.core.utils.BitwiseOptionUtils;
import org.talend.core.utils.CodesJarResourceCache;
import org.talend.designer.core.IDesignerCoreService;
import org.talend.designer.core.model.utils.emf.talendfile.ContextParameterType;
import org.talend.designer.core.model.utils.emf.talendfile.ContextType;
@@ -189,11 +191,11 @@ public class ProcessorUtilities {
private static final Set<ModuleNeeded> retrievedJarsForCurrentBuild = new HashSet<ModuleNeeded>();
private static final Set<String> esbJobs = new HashSet<String>();
private static final Map<String, Integer> esbJobs = new HashMap<String, Integer>();
private static boolean isDebug = false;
private static boolean isCIMode = false;
private static boolean isDynamicJobAndCITest = false;
private static JobInfo mainJobInfo;
@@ -436,6 +438,81 @@ public class ProcessorUtilities {
return false;
}
public static boolean checkProcessLoopDependencies(IProcess mainProcess, String id, String version,
LinkedList<String> pathlink, Map<String, String> idToLatestVersion) {
if (ItemCacheManager.LATEST_VERSION.contains(version)) {
if (idToLatestVersion.get(id) == null) {
ProcessItem processItem = ItemCacheManager.getProcessItem(id);
version = processItem.getProperty().getVersion();
idToLatestVersion.put(id, version);
} else {
version = idToLatestVersion.get(id);
}
}
String pathNode = id + "-" + version;
if (pathlink.contains(pathNode)) {
return true;
}
pathlink.add(pathNode);
boolean hasLoop = false;
List<? extends INode> processNodes = mainProcess.getProcessNodes();
for (INode node : processNodes) {
if (!node.isActivate()) {
continue;
}
IElementParameter processIdParam = node.getElementParameter("PROCESS_TYPE_PROCESS");
if (processIdParam != null && StringUtils.isNotBlank((String) processIdParam.getValue())) {
String jobIds = (String) processIdParam.getValue();
String subNodeversion = (String) node.getElementParameter("PROCESS_TYPE_VERSION").getValue();
for (String jobId : jobIds.split(ProcessorUtilities.COMMA)) {
if (StringUtils.isBlank(jobId)) {
continue;
}
ProcessItem processItem = ItemCacheManager.getProcessItem(jobId, subNodeversion);
if (processItem != null) {
IDesignerCoreService service = CorePlugin.getDefault().getDesignerCoreService();
IProcess subProcess = service.getProcessFromProcessItem(processItem);
if (subProcess != null) {
hasLoop = checkProcessLoopDependencies(subProcess, jobId, subNodeversion, pathlink,
idToLatestVersion);
}
}
if (hasLoop) {
break;
}
}
} else {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IJobletProviderService.class)) {
IJobletProviderService jobletService = GlobalServiceRegister.getDefault()
.getService(IJobletProviderService.class);
if (jobletService != null) {
IProcess jobletProcess = jobletService.getJobletGEFProcessFromNode(node);
if (jobletProcess != null) {
String jobletId = jobletProcess.getId();
IElementParameter projectTecNameParam = jobletProcess.getElementParameter("PROJECT_TECHNICAL_NAME");
if (projectTecNameParam != null && StringUtils.isNotBlank((String) projectTecNameParam.getValue())) {
jobletId = projectTecNameParam.getValue() + ":" + jobletId;
}
hasLoop = checkProcessLoopDependencies(jobletProcess, jobletId, jobletProcess.getVersion(), pathlink,
idToLatestVersion);
}
}
}
}
if (hasLoop) {
break;
}
}
if (!hasLoop) {
pathlink.removeLast();
}
return hasLoop;
}
private static IProcessor generateCode(IProcessor processor2, JobInfo jobInfo, String selectedContextName,
boolean statistics, boolean trace, boolean needContext, int option, IProgressMonitor progressMonitor)
throws ProcessorException {
@@ -535,11 +612,12 @@ public class ProcessorUtilities {
jobInfo.setProcessor(processor);
if (isMainJob && selectedProcessItem != null) {
Relation mainRelation = new Relation();
mainRelation.setId(jobInfo.getJobId());
mainRelation.setVersion(jobInfo.getJobVersion());
mainRelation.setType(RelationshipItemBuilder.JOB_RELATION);
hasLoopDependency = checkLoopDependencies(mainRelation, new HashMap<String, String>());
if (!IRunProcessService.get().getMavenPrefOptionStatus(MavenConstants.SKIP_LOOP_DEPENDENCY_CHECK)) {
Property property = selectedProcessItem.getProperty();
String jobId = ProjectManager.getInstance().getCurrentProject().getTechnicalLabel() + ":" + property.getId();
hasLoopDependency = checkProcessLoopDependencies(currentProcess, jobId, property.getVersion(),
new LinkedList<String>(), new HashMap<String, String>());
}
// clean the previous code in case it has deleted subjob
cleanSourceFolder(progressMonitor, currentProcess, processor);
}
@@ -642,233 +720,6 @@ public class ProcessorUtilities {
return processor;
}
public static boolean checkLoopDependencies(Relation mainJobInfo, Map<String, String> idToLastestVersionMap)
throws ProcessorException {
List<Relation> itemsJobRelatedTo = getItemsRelation(mainJobInfo, idToLastestVersionMap);
List<Relation> relationChecked = new ArrayList<>();
relationChecked.add(mainJobInfo);
return checkLoopDependencies(mainJobInfo, mainJobInfo, itemsJobRelatedTo, relationChecked, idToLastestVersionMap);
}
private static boolean checkLoopDependencies(Relation mainRelation, Relation currentRelation,
List<Relation> itemsJobRelatedTo,
List<Relation> relationChecked, Map<String, String> idToLastestVersionMap) throws ProcessorException {
boolean hasDependency = false;
for (Relation relation : itemsJobRelatedTo) {
try {
// means the tRunjob deactivate, or one of the specific version tRunjon deactivate, skip
Map<String, Set<String>> actTrunjobHM = getActivateTRunjobMap(currentRelation.getId(),
currentRelation.getVersion());
if (actTrunjobHM.get(relation.getId()) == null
|| !actTrunjobHM.get(relation.getId()).contains(relation.getVersion())) {
continue;
}
} catch (Exception e) {
throw new ProcessorException(e);
}
hasDependency = relation.getId().equals(mainRelation.getId())
&& relation.getVersion().equals(mainRelation.getVersion());
if (!hasDependency) {
List<Relation> itemsChildJob = getItemsRelation(relation, idToLastestVersionMap);
if (!relationChecked.contains(relation)) {
relationChecked.add(relation);
hasDependency = checkLoopDependencies(mainRelation, relation, itemsChildJob, relationChecked,
idToLastestVersionMap);
}
if (!hasDependency) {
for (Relation childRelation : itemsChildJob) {
try {
// means the tRunjob deactivate, or one of the specific version tRunjon deactivate, skip
Map<String, Set<String>> activateTRunjobMap = getActivateTRunjobMap(relation.getId(),
relation.getVersion());
if (activateTRunjobMap.get(childRelation.getId()) == null
|| !activateTRunjobMap.get(childRelation.getId()).contains(childRelation.getVersion())) {
continue;
}
} catch (Exception e) {
throw new ProcessorException(e);
}
hasDependency = checkLoopDependencies(childRelation, idToLastestVersionMap);
if (hasDependency) {
break;
}
}
}
}
if (hasDependency) {
break;
}
}
return hasDependency;
}
private static Map<String, Set<String>> getActivateTRunjobMap(String id, String version) throws PersistenceException {
Map<String, Set<String>> actTrunjobHM = new HashMap<String, Set<String>>();
ProcessType processType = null;
try {
IRepositoryViewObject currentJobObject = ProxyRepositoryFactory.getInstance().getSpecificVersion(id, version, true);
if (currentJobObject != null) {
Item item = currentJobObject.getProperty().getItem();
if (item instanceof ProcessItem) {
processType = ((ProcessItem) item).getProcess();
} else if (item instanceof JobletProcessItem) {
processType = ((JobletProcessItem) item).getJobletProcess();
}
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
if (processType != null) {
List<Project> allProjects = new ArrayList<Project>();
allProjects.add(ProjectManager.getInstance().getCurrentProject());
allProjects.addAll(ProjectManager.getInstance().getAllReferencedProjects());
List<String> jobletsComponentsList = new ArrayList<String>();
IComponentsFactory componentsFactory = null;
if (GlobalServiceRegister.getDefault().isServiceRegistered(IComponentsService.class)) {
IComponentsService compService = GlobalServiceRegister.getDefault()
.getService(IComponentsService.class);
if (compService != null) {
componentsFactory = compService.getComponentsFactory();
for (IComponent component : componentsFactory.readComponents()) {
if (component.getComponentType() == EComponentType.JOBLET) {
jobletsComponentsList.add(component.getName());
}
}
}
}
String jobletPaletteType = null;
String frameWork = processType.getFramework();
if (StringUtils.isBlank(frameWork)) {
jobletPaletteType = ComponentCategory.CATEGORY_4_DI.getName();
} else if (frameWork.equals(HadoopConstants.FRAMEWORK_SPARK)) {
jobletPaletteType = ComponentCategory.CATEGORY_4_SPARK.getName();
} else if (frameWork.equals(HadoopConstants.FRAMEWORK_SPARK_STREAMING)) {
jobletPaletteType = ComponentCategory.CATEGORY_4_SPARKSTREAMING.getName();
}
for (Object nodeObject : processType.getNode()) {
NodeType node = (NodeType) nodeObject;
// not tRunjob && not joblet then continue
if (!node.getComponentName().equals("tRunJob") && !jobletsComponentsList.contains(node.getComponentName())) { // $NON-NLS-1$
continue;
}
boolean nodeActivate = true;
String processIds = null;
String processVersion = null;
for (Object elementParam : node.getElementParameter()) {
ElementParameterType elemParamType = (ElementParameterType) elementParam;
if ("PROCESS:PROCESS_TYPE_PROCESS".equals(elemParamType.getName())) { // $NON-NLS-1$
processIds = elemParamType.getValue();
if (StringUtils.isNotBlank(processIds)) {
for (String jobId : processIds.split(ProcessorUtilities.COMMA)) {
if (actTrunjobHM.get(jobId) == null) {
actTrunjobHM.put(jobId, new HashSet<String>());
}
}
}
} else if ("PROCESS:PROCESS_TYPE_VERSION".equals(elemParamType.getName()) // $NON-NLS-1$
|| "PROCESS_TYPE_VERSION".equals(elemParamType.getName())) { // $NON-NLS-1$
processVersion = elemParamType.getValue();
} else if ("ACTIVATE".equals(elemParamType.getName())) { // $NON-NLS-1$
nodeActivate = Boolean.parseBoolean(elemParamType.getValue());
}
}
if (nodeActivate) {
if (StringUtils.isNotBlank(processIds)) {
for (String jobId : processIds.split(ProcessorUtilities.COMMA)) {
String actualVersion = processVersion;
if (RelationshipItemBuilder.LATEST_VERSION.equals(processVersion)) {
for (Project project : allProjects) {
IRepositoryViewObject lastVersion = null;
lastVersion = ProxyRepositoryFactory.getInstance().getLastVersion(project, jobId);
if (lastVersion != null) {
actualVersion = lastVersion.getVersion();
break;
}
}
}
if (actTrunjobHM.get(jobId) != null) {
actTrunjobHM.get(jobId).add(actualVersion);
}
}
} else if (componentsFactory != null && jobletPaletteType != null) {
// for joblet
IComponent cc = componentsFactory.get(node.getComponentName(), jobletPaletteType);
if (GlobalServiceRegister.getDefault().isServiceRegistered(IJobletProviderService.class)) {
IJobletProviderService jobletService = GlobalServiceRegister.getDefault()
.getService(IJobletProviderService.class);
Property property = jobletService.getJobletComponentItem(cc);
if (property != null && StringUtils.isNotBlank(property.getId())) {
String jobletId = property.getId();
if (actTrunjobHM.get(jobletId) == null) {
actTrunjobHM.put(jobletId, new HashSet<String>());
}
String actualVersion = processVersion;
if (RelationshipItemBuilder.LATEST_VERSION.equals(processVersion)) {
for (Project project : allProjects) {
IRepositoryViewObject lastVersion = null;
lastVersion = ProxyRepositoryFactory.getInstance().getLastVersion(project, jobletId);
if (lastVersion != null) {
actualVersion = lastVersion.getVersion();
break;
}
}
}
actTrunjobHM.get(jobletId).add(actualVersion);
}
}
}
}
}
}
return actTrunjobHM;
}
private static List<Relation> getItemsRelation(Relation mainJobInfo, Map<String, String> idToLastestVersionMap) throws ProcessorException {
List<Relation> itemsJobRelatedTo = new ArrayList<Relation>();
try {
List<Project> allProjects = new ArrayList<Project>();
allProjects.add(ProjectManager.getInstance().getCurrentProject());
allProjects.addAll(ProjectManager.getInstance().getAllReferencedProjects());
RelationshipItemBuilder instance = RelationshipItemBuilder.getInstance();
if (instance != null) {
itemsJobRelatedTo.addAll(instance.getItemsChildRelatedTo(mainJobInfo.getId(), mainJobInfo.getVersion(),
mainJobInfo.getType(), RelationshipItemBuilder.JOB_RELATION));
itemsJobRelatedTo.addAll(instance.getItemsChildRelatedTo(mainJobInfo.getId(), mainJobInfo.getVersion(),
mainJobInfo.getType(), RelationshipItemBuilder.JOBLET_RELATION));
for (Relation relation : itemsJobRelatedTo) {
if (relation.getVersion().equals(RelationshipItemBuilder.LATEST_VERSION)) {
if (idToLastestVersionMap.containsKey(relation.getId())) {
relation.setVersion(idToLastestVersionMap.get(relation.getId()));
} else {
for (Project project : allProjects) {
IRepositoryViewObject lastVersion =
ProxyRepositoryFactory.getInstance().getLastVersion(project, relation.getId());
if (lastVersion != null) {
relation.setVersion(lastVersion.getVersion());
idToLastestVersionMap.put(relation.getId(), relation.getVersion());
break;
}
}
}
}
}
}
} catch (PersistenceException e) {
throw new ProcessorException(e);
}
return itemsJobRelatedTo;
}
private static void setNeededResources(final Map<String, Object> argumentsMap, JobInfo jobInfo) {
argumentsMap.put(TalendProcessArgumentConstant.ARG_NEED_XMLMAPPINGS,
@@ -1159,8 +1010,8 @@ public class ProcessorUtilities {
private static IProcessor generateCode(JobInfo jobInfo, String selectedContextName, boolean statistics,
boolean trace, boolean needContext, int option, IProgressMonitor progressMonitor)
throws ProcessorException {
if (!BitwiseOptionUtils.containOption(option, GENERATE_WITHOUT_COMPILING)) {
CorePlugin.getDefault().getRunProcessService().buildCodesJavaProject(progressMonitor);
if (!BitwiseOptionUtils.containOption(option, GENERATE_WITHOUT_COMPILING) && jobInfo.getFatherJobInfo() == null) {
buildCodesJavaProject(progressMonitor, jobInfo);
}
return generateCode(jobInfo, selectedContextName, statistics, trace, needContext, true, option,
progressMonitor);
@@ -1262,11 +1113,11 @@ public class ProcessorUtilities {
}
if (isMainJob && selectedProcessItem != null) {
Relation mainRelation = new Relation();
mainRelation.setId(jobInfo.getJobId());
mainRelation.setVersion(jobInfo.getJobVersion());
mainRelation.setType(RelationshipItemBuilder.JOB_RELATION);
hasLoopDependency = checkLoopDependencies(mainRelation, new HashMap<String, String>());
if (!IRunProcessService.get().getMavenPrefOptionStatus(MavenConstants.SKIP_LOOP_DEPENDENCY_CHECK)) {
Property property = selectedProcessItem.getProperty();
hasLoopDependency = checkProcessLoopDependencies(currentProcess, property.getId(), property.getVersion(),
new LinkedList<String>(), new HashMap<String, String>());
}
// clean the previous code in case it has deleted subjob
cleanSourceFolder(progressMonitor, currentProcess, processor);
}
@@ -1312,7 +1163,7 @@ public class ProcessorUtilities {
checkMetadataDynamic(currentProcess, jobInfo);
int options = TalendProcessOptionConstants.MODULES_DEFAULT;
if (isCIMode && BitwiseOptionUtils.containOption(option, GENERATE_MAIN_ONLY)) {
if (isCIMode() && BitwiseOptionUtils.containOption(option, GENERATE_MAIN_ONLY)) {
options |= TalendProcessOptionConstants.MODULES_WITH_CHILDREN;
}
Set<ModuleNeeded> neededLibraries = new HashSet<>();
@@ -1797,13 +1648,16 @@ public class ProcessorUtilities {
}
}
}
if (isEsbComponentName(componentName)) {
addEsbJob(jobInfo);
}
}
}
}
private static void recordESBIncludingFlag(JobInfo jobInfo, int esbIncludingOption) {
int includeESBFlag = jobInfo.getIncludeESBFlag();
includeESBFlag |= esbIncludingOption;
jobInfo.setIncludeESBFlag(includeESBFlag);
}
static void setGenerationInfoWithChildrenJob(INode node, JobInfo jobInfo, final JobInfo subJobInfo) {
final LastGenerationInfo generationInfo = LastGenerationInfo.getInstance();
@@ -1912,6 +1766,13 @@ public class ProcessorUtilities {
static boolean hasLoopDependency = false;
private static void resetBuildFlagsAndCaches() {
jobList.clear();
esbJobs.clear();
hasLoopDependency = false;
mainJobInfo = null;
}
/**
* This function will generate the code of the process and all of this sub process.
*
@@ -1926,15 +1787,10 @@ public class ProcessorUtilities {
if (monitors == null) {
monitor = new NullProgressMonitor();
}
jobList.clear();
esbJobs.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
JobInfo jobInfo = new JobInfo(processName, contextName, version);
IProcessor process = generateCode(jobInfo, contextName, statistics, trace, true, GENERATE_ALL_CHILDS, monitor);
jobList.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
return process;
}
@@ -1954,14 +1810,9 @@ public class ProcessorUtilities {
}
JobInfo jobInfo = new JobInfo(processId, contextName, version);
jobInfo.setApplyContextToChildren(applyContextToChildren);
jobList.clear();
esbJobs.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
IProcessor process = generateCode(jobInfo, contextName, statistics, trace, true, GENERATE_ALL_CHILDS, monitor);
jobList.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
return process;
}
@@ -1976,14 +1827,9 @@ public class ProcessorUtilities {
}
JobInfo jobInfo = new JobInfo(process, contextName);
jobInfo.setApplyContextToChildren(applyContextToChildren);
jobList.clear();
esbJobs.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
IProcessor result = generateCode(jobInfo, contextName, statistics, trace, true, GENERATE_ALL_CHILDS, monitor);
jobList.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
return result;
}
@@ -1998,15 +1844,10 @@ public class ProcessorUtilities {
}
JobInfo jobInfo = new JobInfo(process, contextName, version);
jobInfo.setApplyContextToChildren(applyContextToChildren);
jobList.clear();
esbJobs.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
IProcessor result =
generateCode(jobInfo, contextName, statistics, trace, needContext, GENERATE_ALL_CHILDS, monitor);
jobList.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
return result;
}
@@ -2030,14 +1871,9 @@ public class ProcessorUtilities {
ProcessUtils.isOptionChecked(argumentsMap, TalendProcessArgumentConstant.ARG_NEED_CONTEXT);
int option = ProcessUtils.getOptionValue(argumentsMap, TalendProcessArgumentConstant.ARG_GENERATE_OPTION, 0);
jobList.clear();
esbJobs.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
IProcessor result = generateCode(jobInfo, contextName, statistics, trace, needContext, option, monitor);
jobList.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
return result;
}
@@ -2055,28 +1891,18 @@ public class ProcessorUtilities {
JobInfo jobInfo = new JobInfo(process, contextName, version);
jobInfo.setContext(context);
jobInfo.setApplyContextToChildren(applyContextToChildren);
jobList.clear();
esbJobs.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
result = generateCode(jobInfo, contextName, statistics, trace, true, GENERATE_ALL_CHILDS, monitor);
jobList.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
}
return result;
}
public static IProcessor generateCode(ProcessItem process, String contextName, boolean statistics, boolean trace)
throws ProcessorException {
jobList.clear();
esbJobs.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
IProcessor returnValue = generateCode(process, contextName, statistics, trace, false);
jobList.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
return returnValue;
}
@@ -2104,29 +1930,19 @@ public class ProcessorUtilities {
jobInfo = new JobInfo(process, context);
}
jobInfo.setApplyContextToChildren(applyToChildren);
jobList.clear();
esbJobs.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
IProcessor genCode = generateCode(jobInfo, context.getName(), statistics, trace, contextProperties,
GENERATE_ALL_CHILDS, new NullProgressMonitor());
jobList.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
return genCode;
}
public static IProcessor generateCode(IProcess process, IContext context, boolean statistics, boolean trace,
boolean properties) throws ProcessorException {
jobList.clear();
esbJobs.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
IProcessor returnValue =
generateCode(process, context, statistics, trace, properties, new NullProgressMonitor());
jobList.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
return returnValue;
}
@@ -2154,15 +1970,10 @@ public class ProcessorUtilities {
} else {
jobInfo = new JobInfo(process, context);
}
jobList.clear();
esbJobs.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
IProcessor genCode = generateCode(jobInfo, context.getName(), statistics, trace, properties,
GENERATE_ALL_CHILDS, progressMonitor);
jobList.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
return genCode;
}
@@ -2177,8 +1988,6 @@ public class ProcessorUtilities {
RepositoryManager.syncRoutineAndJoblet(ERepositoryObjectType.ROUTINES);
}
CorePlugin.getDefault().getRunProcessService().buildCodesJavaProject(progressMonitor);
// achen modify to fix 0006107
ProcessItem pItem = null;
@@ -2196,6 +2005,9 @@ public class ProcessorUtilities {
} else {
jobInfo = new JobInfo(process, context);
}
buildCodesJavaProject(progressMonitor, jobInfo);
final boolean oldMeasureActived = TimeMeasure.measureActive;
if (!oldMeasureActived) { // not active before.
TimeMeasure.display = TimeMeasure.displaySteps = TimeMeasure.measureActive = CommonsPlugin.isDebugMode();
@@ -2204,15 +2016,10 @@ public class ProcessorUtilities {
+ (jobInfo.getJobName() != null ? jobInfo.getJobName() : jobInfo.getJobId());
TimeMeasure.begin(timeMeasureGenerateCodesId);
jobList.clear();
esbJobs.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
IProcessor genCode = generateCode(processor, jobInfo, context.getName(), statistics, trace, properties,
GENERATE_ALL_CHILDS, progressMonitor);
jobList.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
TimeMeasure.end(timeMeasureGenerateCodesId);
// if active before, not disable and active still.
@@ -2235,15 +2042,10 @@ public class ProcessorUtilities {
}
// achen modify to fix 0006107
JobInfo jobInfo = new JobInfo(process, context);
jobList.clear();
esbJobs.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
IProcessor genCode = generateCode(jobInfo, context.getName(), statistics, trace, properties, option,
new NullProgressMonitor());
jobList.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
return genCode;
}
@@ -2258,17 +2060,22 @@ public class ProcessorUtilities {
}
JobInfo jobInfo = new JobInfo(process, contextName);
jobInfo.setApplyContextToChildren(applyContextToChildren);
jobList.clear();
esbJobs.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
IProcessor result = generateCode(jobInfo, contextName, statistics, trace, true, option, monitor);
jobList.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
return result;
}
private static void buildCodesJavaProject(IProgressMonitor monitor, JobInfo jobInfo) {
Set<JobInfo> allJobInfo = getChildrenJobInfo(jobInfo.getProcessItem(), false, true);
allJobInfo.add(jobInfo);
Set<CodesJarInfo> toUpdate = allJobInfo.stream().filter(childInfo -> !childInfo.isTestContainer())
.flatMap(childInfo -> RoutinesUtil.getRoutinesParametersFromJobInfo(childInfo).stream())
.filter(r -> r.getType() != null).map(r -> CodesJarResourceCache.getCodesJarById(r.getId()))
.filter(info -> info != null).collect(Collectors.toSet());
IRunProcessService.get().buildCodesJavaProject(monitor, toUpdate);
}
/**
*
* @deprecated seems never use this one
@@ -2571,8 +2378,15 @@ public class ProcessorUtilities {
}
JobInfo jobInfo = new JobInfo(testItem, testProcess.getDefaultContext());
jobInfo.setTestContainer(true);
jobInfos.add(jobInfo);
jobInfo.setFatherJobInfo(parentJobInfo);
if (!jobInfos.contains(jobInfo)) {
jobInfos.add(jobInfo);
// if job contains testcase, we need to get joblets of testcase and add them to the job pom, we
// must
// pass parentJobInfo instead of testProcess, otherwise joblet will be filtered out
getSubjobInfo(testProcess.getNode(), testProcess, parentJobInfo, jobInfos, firstChildOnly, includeJoblet);
}
}
}
}
@@ -2590,6 +2404,8 @@ public class ProcessorUtilities {
} else if (frameWork.equals(HadoopConstants.FRAMEWORK_SPARK_STREAMING)) {
jobletPaletteType = ComponentCategory.CATEGORY_4_SPARKSTREAMING.getName();
}
boolean hasChildrenIncludeESB = false;
for (NodeType node : nodes) {
boolean activate = true;
// check if node is active at least.
@@ -2604,8 +2420,8 @@ public class ProcessorUtilities {
continue;
}
if (isEsbComponentName(node.getComponentName())) {
addEsbJob(parentJobInfo);
if (!firstChildOnly && isEsbComponentName(node.getComponentName())) {
recordESBIncludingFlag(parentJobInfo, TalendProcessOptionConstants.ISESB_CURRENT_INCLUDE);
}
boolean isCTalendJob = "cTalendJob".equalsIgnoreCase(node.getComponentName());
@@ -2634,6 +2450,18 @@ public class ProcessorUtilities {
jobInfo.setFatherJobInfo(parentJobInfo);
if (!firstChildOnly) {
getAllJobInfo(processItem.getProcess(), jobInfo, jobInfos, firstChildOnly, includeJoblet);
if (jobInfo.getIncludeESBFlag() >= 2) {
hasChildrenIncludeESB = true;
}
}
} else {
Optional<JobInfo> infoOptional = jobInfos.stream().filter(info -> info.equals(jobInfo))
.findFirst();
if (infoOptional.isPresent()) {
JobInfo matchJobInfo = infoOptional.get();
if (matchJobInfo.getIncludeESBFlag() >= 2) {
hasChildrenIncludeESB = true;
}
}
}
}
@@ -2685,6 +2513,16 @@ public class ProcessorUtilities {
}
}
}
// checked done set the esb including option
if (!firstChildOnly) {
recordESBIncludingFlag(parentJobInfo, TalendProcessOptionConstants.ISESB_CHECKED);
if (hasChildrenIncludeESB) {
recordESBIncludingFlag(parentJobInfo, TalendProcessOptionConstants.ISESB_CHILDREN_INCLUDE);
}
esbJobs.put(esbJobKey(parentJobInfo.getJobId(), parentJobInfo.getJobVersion()), parentJobInfo.getIncludeESBFlag());
}
return jobInfos;
}
@@ -2901,9 +2739,21 @@ public class ProcessorUtilities {
}
public static boolean isEsbJob(IProcess process, boolean checkCurrentProcess) {
// get includeESBFlag from cache
if (process instanceof IProcess2) {
Property property = ((IProcess2) process).getProperty();
String esbJobKey = esbJobKey(property.getId(), property.getVersion());
if (esbJobs.get(esbJobKey) != null) {
Integer esbOptions = esbJobs.get(esbJobKey);
if (BitwiseOptionUtils.containOption(esbOptions, TalendProcessOptionConstants.ISESB_CHECKED)) {
return checkCurrentProcess
? BitwiseOptionUtils.containOption(esbOptions, TalendProcessOptionConstants.ISESB_CURRENT_INCLUDE)
: esbOptions > 2;
}
}
}
if (process instanceof IProcess2) {
if (checkCurrentProcess) {
for (INode n : process.getGraphicalNodes()) {
if (isEsbComponentName(n.getComponent().getName())) {
@@ -2929,17 +2779,6 @@ public class ProcessorUtilities {
return false;
}
private static void addEsbJob(JobInfo jobInfo) {
if (esbJobs.contains(esbJobKey(jobInfo.getJobId(), jobInfo.getJobVersion()))) {
return;
}
esbJobs.add(esbJobKey(jobInfo.getJobId(), jobInfo.getJobVersion()));
if (jobInfo.getFatherJobInfo() != null) {
addEsbJob(jobInfo.getFatherJobInfo());
}
}
private static String esbJobKey(String processId, String version) {
return processId + "_" + version;
}
@@ -3021,13 +2860,11 @@ public class ProcessorUtilities {
}
public static boolean isCIMode() {
return isCIMode;
// if it's CI mode , then the system property of maven.local.repository will store the value of studio
// m2 path,otherwise it's null
return System.getProperty("maven.local.repository") != null;
}
public static void setCIMode(boolean isCIMode) {
ProcessorUtilities.isCIMode = isCIMode;
}
public static boolean hasRoutelet(ProcessItem prItem, String routelet) {
EList<NodeType> nodeList = prItem.getProcess().getNode();
@@ -3057,4 +2894,30 @@ public class ProcessorUtilities {
return false;
}
public static void setExportConfig(boolean export) {
setExportConfig(JavaUtils.JAVA_APP_NAME, null, null, export, new Date());
}
public static boolean isJobTest(String processId, String contextName, String version) {
for (JobInfo jobInfo : jobList) {
if (jobInfo.getJobId().equals(processId)) {
if (contextName != null && !contextName.equals("") && !jobInfo.getContextName().equals(contextName)) {
continue;
}
if (version != null && !version.equals(jobInfo.getJobVersion())) {
continue;
}
return jobInfo.isTestContainer();
}
}
return false;
}
public static void setDynamicJobAndCITest(boolean dynamicJobAndCITest) {
isDynamicJobAndCITest = dynamicJobAndCITest;
}
public static boolean isDynamicJobAndCITest() {
return isDynamicJobAndCITest;
}
}

View File

@@ -26,7 +26,6 @@
<classpathentry exported="true" kind="lib" path="lib/maven-model-builder-3.2.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/maven-repository-metadata-3.2.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/plexus-interpolation-1.19.jar"/>
<classpathentry exported="true" kind="lib" path="lib/plexus-utils-3.0.17.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/main/java"/>

View File

@@ -16,7 +16,6 @@ Bundle-ClassPath: .,
lib/maven-model-builder-3.2.1.jar,
lib/maven-repository-metadata-3.2.1.jar,
lib/plexus-interpolation-1.19.jar,
lib/plexus-utils-3.0.17.jar,
lib/commons-codec.jar,
lib/httpclient.jar,
lib/httpcore.jar,

View File

@@ -11,7 +11,7 @@
<packaging>eclipse-plugin</packaging>
<properties>
<maven.resolver.version>1.3.1</maven.resolver.version>
<wagon.version>3.0.0</wagon.version>
<wagon.version>3.4.3</wagon.version>
</properties>
<dependencies>

View File

@@ -40,6 +40,12 @@
<version>${project.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.talend.studio</groupId>
<artifactId>studio-log4j-dependencies-tos</artifactId>
<version>${project.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.talend.studio</groupId>
<artifactId>studio-maven-repository-build</artifactId>
@@ -78,13 +84,7 @@
</dependency>
<dependency>
<groupId>org.talend.studio</groupId>
<artifactId>karaf-maven-plugin-4-2-4-tos</artifactId>
<version>${project.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.talend.studio</groupId>
<artifactId>karaf-maven-plugin-4-2-4-tos</artifactId>
<artifactId>karaf-maven-plugin-4-2-7-tos</artifactId>
<version>${project.version}</version>
<type>pom</type>
</dependency>
@@ -100,6 +100,11 @@
<version>${project.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.15</version>
</dependency>
</dependencies>
<profiles>
<profile>

View File

@@ -14,6 +14,17 @@
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
<exclusions>
<exclusion>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-shared-utils</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-shared-utils</artifactId>
<version>3.3.3</version>
</dependency>
</dependencies>
<build>

View File

@@ -7,13 +7,23 @@
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>karaf-maven-plugin-4-2-4-tos</artifactId>
<artifactId>karaf-maven-plugin-4-2-7-tos</artifactId>
<packaging>pom</packaging>
<dependencies>
<dependency>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
<version>4.2.4</version>
<version>4.2.7</version>
<exclusions>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-shared-utils</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
@@ -36,6 +46,22 @@
<artifactId>xz</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.13</version>
<exclusions>
<exclusion>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.15</version>
</dependency>
</dependencies>
<build>
<plugins>

View File

@@ -14,6 +14,12 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.1</version>
<exclusions>
<exclusion>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

View File

@@ -14,6 +14,17 @@
<groupId>org.talend.ci</groupId>
<artifactId>osgihelper-maven-plugin</artifactId>
<version>7.3.1</version>
<exclusions>
<exclusion>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.15</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>

View File

@@ -12,7 +12,7 @@
<modules>
<module>plugins/maven-bundle-plugin-2-3-7</module>
<module>plugins/maven-bundle-plugin-2-5-3</module>
<module>plugins/karaf-maven-plugin-4-2-4</module>
<module>plugins/karaf-maven-plugin-4-2-7</module>
<module>plugins/maven-install-plugin-2-5-1</module>
<module>plugins/talend-compiler-plugin</module>
<module>plugins/talend-ci-osgihelper-maven-plugin</module>
@@ -23,27 +23,66 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
<exclusions>
<exclusion>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-shared-utils</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<exclusions>
<exclusion>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-shared-utils</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<exclusions>
<exclusion>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-shared-utils</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<version>3.2.0</version>
<exclusions>
<exclusion>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-shared-utils</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
<exclusions>
<exclusion>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-shared-utils</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.15</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>

View File

@@ -198,12 +198,12 @@
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.9.14-TALEND</version>
<version>${jackson-codehaus.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.14-TALEND</version>
<version>${jackson-codehaus.version}</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>

View File

@@ -0,0 +1,58 @@
<?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>studio-maven-repository-tos</artifactId>
<version>7.3.1-PATCH</version>
<relativePath>../</relativePath>
</parent>
<artifactId>studio-log4j-dependencies-tos</artifactId>
<packaging>pom</packaging>
<dependencies>
<!--add log4j dependency https://jira.talendforge.org/browse/TUP-31403 -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.12.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.12.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.12.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-1.2-api</artifactId>
<version>2.12.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeScope>runtime</includeScope>
<outputDirectory>${basedir}/../tmp/repository</outputDirectory>
<useRepositoryLayout>true</useRepositoryLayout>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -16,9 +16,11 @@
<module>tacokit/pom.xml</module>
<module>tcompv1/pom.xml</module>
<module>surefire/pom.xml</module>
<module>log4j/pom.xml</module>
<module>zip/pom.xml</module>
</modules>
<properties>
<m2.fasterxml.jackson.version>2.11.4</m2.fasterxml.jackson.version>
<jackson-codehaus.version>1.9.15-TALEND</jackson-codehaus.version>
</properties>
</project>

View File

@@ -10,7 +10,7 @@
<artifactId>studio-tacokit-dependencies</artifactId>
<packaging>pom</packaging>
<properties>
<tacokit.components.version>1.19.0</tacokit.components.version>
<tacokit.components.version>1.21.0</tacokit.components.version>
</properties>
<repositories>
<repository>
@@ -35,7 +35,18 @@
</repository>
</repositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.talend.components</groupId>
<artifactId>connectors-se</artifactId>
<version>${tacokit.components.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.talend.components</groupId>

View File

@@ -11,7 +11,7 @@
<packaging>pom</packaging>
<properties>
<tcomp.version>1.30.0</tcomp.version>
<tcomp.version>1.32.0</tcomp.version>
<slf4j.version>1.7.25</slf4j.version>
</properties>

View File

@@ -33,7 +33,7 @@
<artifactItem>
<groupId>org.talend.studio</groupId>
<artifactId>studio-maven-repository</artifactId>
<version>7.2.1.v20190226</version>
<version>7.3.1.v20210520</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${project.basedir}/../repository</outputDirectory>

View File

@@ -15,4 +15,5 @@ MavenProjectSettingPage.filterExampleMessage=Filter examples:\nlabel=myJob
MavenProjectSettingPage.refModuleText=Set reference project modules in profile
MavenProjectSettingPage.excludeDeletedItems=Exclude deleted items
MavenProjectSettingPage.syncAllPomsWarning=Click the Force full re-synchronize poms button to apply the new settings.
MavenProjectSettingPage.skipFolders=Skip folders
MavenProjectSettingPage.skipFolders=Skip folders
BuildProjectSettingPage.allowRecursiveJobs=Allow recursive jobs (Not recommended)

View File

@@ -12,15 +12,50 @@
// ============================================================================
package org.talend.designer.maven.ui.setting.project.page;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.talend.core.runtime.maven.MavenConstants;
import org.talend.core.runtime.projectsetting.EmptyProjectSettingPage;
import org.talend.designer.maven.DesignerMavenPlugin;
import org.talend.designer.maven.ui.i18n.Messages;
/**
* DOC ggu class global comment. Detailled comment
*/
public class BuildProjectSettingPage extends EmptyProjectSettingPage {
private IPreferenceStore preferenceStore;
private Button allowRecursiveJobsCheckbox;
public BuildProjectSettingPage() {
super();
}
@Override
protected String getPreferenceName() {
return DesignerMavenPlugin.PLUGIN_ID;
}
@Override
protected void createFieldEditors() {
Composite parent = getFieldEditorParent();
parent.setLayout(new GridLayout());
preferenceStore = getPreferenceStore();
allowRecursiveJobsCheckbox = new Button(parent, SWT.CHECK);
allowRecursiveJobsCheckbox.setText(Messages.getString("BuildProjectSettingPage.allowRecursiveJobs")); //$NON-NLS-1$
allowRecursiveJobsCheckbox.setSelection(!preferenceStore.getBoolean(MavenConstants.SKIP_LOOP_DEPENDENCY_CHECK));
}
@Override
public boolean performOk() {
boolean performOk = super.performOk();
if (preferenceStore != null) {
preferenceStore.setValue(MavenConstants.SKIP_LOOP_DEPENDENCY_CHECK, !allowRecursiveJobsCheckbox.getSelection());
}
return performOk;
}
}

View File

@@ -17,6 +17,8 @@
<properties>
<talend.codes.package>@CodesPackage@</talend.codes.package>
<codes.compile.failOnError>true</codes.compile.failOnError>
<maven.compiler.failOnError>${codes.compile.failOnError}</maven.compiler.failOnError>
</properties>
<dependencies>

View File

@@ -31,6 +31,11 @@
</configuration>
<dependencies>
<!-- This dependency provides the implementation of compiler "jdt": -->
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-shared-utils</artifactId>
<version>3.3.3</version>
</dependency>
<dependency>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-jdt</artifactId>
@@ -41,6 +46,16 @@
<artifactId>plexus-utils</artifactId>
<version>3.0.24</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.19</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.15</version>
</dependency>
</dependencies>
</plugin>
<plugin>
@@ -53,6 +68,11 @@
<artifactId>plexus-utils</artifactId>
<version>3.0.24</version>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-shared-utils</artifactId>
<version>3.3.3</version>
</dependency>
</dependencies>
</plugin>
<plugin>
@@ -65,6 +85,16 @@
<artifactId>plexus-utils</artifactId>
<version>3.0.24</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.19</version>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-shared-utils</artifactId>
<version>3.3.3</version>
</dependency>
</dependencies>
<configuration>
<archive>
@@ -77,17 +107,27 @@
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-shared-utils</artifactId>
<version>3.3.3</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.0.24</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.19</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
<version>2.12.4</version>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
@@ -106,6 +146,11 @@
<artifactId>plexus-utils</artifactId>
<version>3.0.24</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.15</version>
</dependency>
</dependencies>
</plugin>
<plugin>

View File

@@ -12,9 +12,8 @@
// ============================================================================
package org.talend.designer.maven;
import org.talend.core.model.properties.Item;
import org.talend.core.model.properties.Property;
import org.talend.core.model.properties.RoutineItem;
import org.talend.core.model.routines.CodesJarInfo;
import org.talend.core.runtime.services.IDesignerMavenService;
import org.talend.designer.maven.tools.CodesJarM2CacheManager;
import org.talend.designer.maven.utils.CodesJarMavenUtil;
@@ -27,13 +26,13 @@ public class DesignerMavenService implements IDesignerMavenService {
}
@Override
public String getImportGAVPackageForCodesJar(String projectTechName, Item codesJarItem) {
return CodesJarMavenUtil.getImportGAVPackageForCodesJar(projectTechName, codesJarItem);
public String getImportGAVPackageForCodesJar(CodesJarInfo info) {
return CodesJarMavenUtil.getImportGAVPackageForCodesJar(info);
}
@Override
public void updateCodeJarMavenProject(Property codeJarProperty, boolean needReSync) throws Exception {
CodesJarM2CacheManager.updateCodesJarProject(codeJarProperty, needReSync);
public void updateCodeJarMavenProject(CodesJarInfo info, boolean needReSync) throws Exception {
CodesJarM2CacheManager.updateCodesJarProject(info, needReSync);
}
}

View File

@@ -97,7 +97,7 @@ public abstract class MavenCommandLauncher {
private Map<String, Object> argumentsMap;
private static final String REGEX_TEST_CASE_FAILURES_STR = "\\[ERROR\\] Tests run:.*\\[ERROR\\] There are test\\p{Print}+\n";
private static final String REGEX_TEST_CASE_FAILURES_STR = "\\[ERROR\\] There are test failures.*\n";
private static final Pattern REGEX_TEST_CASE_FAILURES = Pattern.compile(REGEX_TEST_CASE_FAILURES_STR, Pattern.DOTALL);

View File

@@ -34,7 +34,7 @@ import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.m2e.core.MavenPlugin;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.utils.generation.JavaUtils;
import org.talend.core.model.properties.Property;
import org.talend.core.model.routines.CodesJarInfo;
import org.talend.core.runtime.projectsetting.IProjectSettingPreferenceConstants;
import org.talend.core.runtime.projectsetting.IProjectSettingTemplateConstants;
import org.talend.designer.maven.DesignerMavenPlugin;
@@ -293,11 +293,12 @@ public class MavenTemplateManager {
JavaUtils.JAVA_ROUTINES_DIRECTORY);
}
public static Model getRoutinesJarTempalteModel(Property property, String projectTechName) {
Model defaultModel = createDefaultCodesTempalteModel(
PomIdsHelper.getCodesGroupId(projectTechName, TalendMavenConstants.DEFAULT_ROUTINESJAR),
property.getLabel().toLowerCase(), PomIdsHelper.getCodesVersion(projectTechName));
return getCodesModelFromGeneralTemplate(defaultModel, projectTechName, property.getLabel().toLowerCase(),
public static Model getRoutinesJarTempalteModel(CodesJarInfo info) {
String projectTechName = info.getProjectTechName();
String label = info.getLabel();
Model defaultModel = createDefaultCodesTempalteModel(PomIdsHelper.getCodesJarGroupId(info), label.toLowerCase(),
PomIdsHelper.getCodesJarVersion(projectTechName));
return getCodesModelFromGeneralTemplate(defaultModel, projectTechName, label.toLowerCase(),
JavaUtils.JAVA_ROUTINESJAR_DIRECTORY);
}
@@ -308,11 +309,12 @@ public class MavenTemplateManager {
return getCodesModelFromGeneralTemplate(defaultModel, projectTechName, "Beans", JavaUtils.JAVA_BEANS_DIRECTORY); //$NON-NLS-1$
}
public static Model getBeansJarTempalteModel(Property property, String projectTechName) {
Model defaultModel = createDefaultCodesTempalteModel(
PomIdsHelper.getCodesGroupId(projectTechName, TalendMavenConstants.DEFAULT_BEANSJAR),
property.getLabel().toLowerCase(), PomIdsHelper.getCodesVersion(projectTechName));
return getCodesModelFromGeneralTemplate(defaultModel, projectTechName, property.getLabel().toLowerCase(),
public static Model getBeansJarTempalteModel(CodesJarInfo info) {
String projectTechName = info.getProjectTechName();
String label = info.getLabel();
Model defaultModel = createDefaultCodesTempalteModel(PomIdsHelper.getCodesJarGroupId(info), label.toLowerCase(),
PomIdsHelper.getCodesJarVersion(projectTechName));
return getCodesModelFromGeneralTemplate(defaultModel, projectTechName, label.toLowerCase(),
JavaUtils.JAVA_BEANSJAR_DIRECTORY);
}

View File

@@ -69,7 +69,6 @@ import org.talend.core.model.relationship.RelationshipItemBuilder;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.model.repository.IRepositoryViewObject;
import org.talend.core.model.routines.CodesJarInfo;
import org.talend.core.model.routines.RoutinesUtil;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.core.repository.utils.ItemResourceUtil;
import org.talend.core.runtime.CoreRuntimePlugin;
@@ -245,11 +244,6 @@ public class AggregatorPomsHelper {
createTemplatePom.create(monitor);
}
public static void buildAndInstallCodesProject(IProgressMonitor monitor, ERepositoryObjectType codeType)
throws Exception {
buildAndInstallCodesProject(monitor, codeType, true, false);
}
public static void buildAndInstallCodesProject(IProgressMonitor monitor, ERepositoryObjectType codeType,
boolean install, boolean forceBuild) throws Exception {
if (forceBuild || !BuildCacheManager.getInstance().isCodesBuild(codeType)) {
@@ -272,33 +266,29 @@ public class AggregatorPomsHelper {
}
}
// only compile for global/custom code projects
public static void buildCodesProject() {
IRunProcessService service = IRunProcessService.get();
if (service == null) {
return;
}
IProgressMonitor monitor = new NullProgressMonitor();
ERepositoryObjectType.getAllTypesOfCodes().forEach(type -> {
try {
buildAndInstallCodesProject(monitor, type, false, false);
buildAndInstallCodesProject(monitor, type, true, false);
} catch (Exception e) {
ExceptionHandler.process(e);
}
});
Set<CodesJarInfo> jarsToUpdate = CodesJarResourceCache.getAllCodesJars().stream()
.filter(info -> CodesJarM2CacheManager.needUpdateCodesJarProject(info)).collect(Collectors.toSet());
jarsToUpdate.stream().map(info -> service.getTalendCodesJarJavaProject(info)).forEach(p -> {
try {
p.buildModules(monitor, null, null);
} catch (Exception e) {
ExceptionHandler.process(e);
}
});
String currentProjectName = ProjectManager.getInstance().getCurrentProject().getTechnicalLabel();
jarsToUpdate.stream().filter(info -> !currentProjectName.equals(info.getProjectTechName()))
.forEach(info -> service.deleteTalendCodesJarProject(info, false));
CodesJarM2CacheManager.updateCodesJarProject(monitor);
}
public static void buildCodesProject(IProgressMonitor monitor, Set<CodesJarInfo> toUpdate) {
ERepositoryObjectType.getAllTypesOfCodes().forEach(type -> {
try {
buildAndInstallCodesProject(monitor, type, true, false);
} catch (Exception e) {
ExceptionHandler.process(e);
}
});
CodesJarM2CacheManager.updateCodesJarProject(monitor, toUpdate.stream()
.filter(info -> CodesJarM2CacheManager.needUpdateCodesJarProject(info)).collect(Collectors.toSet()), false, false,
false);
}
public void updateRefProjectModules(List<ProjectReference> references, IProgressMonitor monitor) {
@@ -587,14 +577,8 @@ public class AggregatorPomsHelper {
return getCodeFolder(codeType).getFolder(MavenSystemFolders.JAVA.getPath());
}
public IFolder getCodesJarFolder(Property property) {
String codesJarName = property.getLabel();
ERepositoryObjectType type = ERepositoryObjectType.getItemType(property.getItem());
if (RoutinesUtil.isInnerCodes(property)) {
type = RoutinesUtil.getInnerCodeType(property);
codesJarName = RoutinesUtil.getCodesJarLabelByInnerCode(property.getItem());
}
return getCodeFolder(type).getFolder(codesJarName);
public IFolder getCodesJarFolder(CodesJarInfo info) {
return getCodeFolder(info.getType()).getFolder(info.getLabel());
}
public IFolder getProcessFolder(ERepositoryObjectType type) {
@@ -983,11 +967,8 @@ public class AggregatorPomsHelper {
if (ProcessUtils.isRequiredBeans(null)) {
modules.add(getModulePath(service.getTalendCodeJavaProject(ERepositoryObjectType.BEANS).getProjectPom()));
}
String currentProjectTechName = ProjectManager.getInstance().getCurrentProject().getTechnicalLabel();
CodesJarResourceCache.getAllCodesJars().stream()
.filter(info -> info.getProjectTechName().equals(currentProjectTechName))
.forEach(info -> modules.add(
getModulePath(getCodesJarFolder(info.getProperty()).getFile(TalendMavenConstants.POM_FILE_NAME))));
CodesJarResourceCache.getAllCodesJars().stream().filter(info -> info.isInCurrentMainProject()).forEach(
info -> modules.add(getModulePath(getCodesJarFolder(info).getFile(TalendMavenConstants.POM_FILE_NAME))));
}
}

View File

@@ -21,7 +21,6 @@ import java.text.DateFormat;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -44,14 +43,11 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.emf.common.util.EList;
import org.eclipse.m2e.core.MavenPlugin;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.model.general.Project;
import org.talend.core.model.properties.Property;
import org.talend.core.model.properties.RoutineItem;
import org.talend.core.model.properties.RoutinesJarItem;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.model.repository.IRepositoryViewObject;
import org.talend.core.model.routines.CodesJarInfo;
@@ -60,7 +56,6 @@ import org.talend.core.repository.utils.RoutineUtils;
import org.talend.core.runtime.maven.MavenArtifact;
import org.talend.core.runtime.process.ITalendProcessJavaProject;
import org.talend.core.runtime.process.TalendProcessArgumentConstant;
import org.talend.core.runtime.repository.item.ItemProductKeys;
import org.talend.core.utils.CodesJarResourceCache;
import org.talend.cwm.helper.ResourceHelper;
import org.talend.designer.codegen.ICodeGeneratorService;
@@ -73,7 +68,6 @@ import org.talend.designer.maven.tools.creator.CreateMavenRoutinesJarPom;
import org.talend.designer.maven.utils.PomIdsHelper;
import org.talend.designer.maven.utils.PomUtil;
import org.talend.designer.runprocess.IRunProcessService;
import org.talend.repository.ProjectManager;
import org.talend.repository.RepositoryWorkUnit;
import org.talend.utils.io.FilesUtils;
@@ -89,17 +83,11 @@ public class CodesJarM2CacheManager {
private static final String DEP_SEPERATOR = ","; //$NON-NLS-1$
private static final String EMPTY_DATE;
public final static String BUILD_AGGREGATOR_POM_NAME = "build-codesjar-aggregator.pom"; //$NON-NLS-1$
private static File cacheFolder;
static {
Calendar c = Calendar.getInstance();
c.setTimeInMillis(0);
EMPTY_DATE = ResourceHelper.dateFormat().format(c.getTime());
cacheFolder = new File(MavenPlugin.getMaven().getLocalRepositoryPath()).toPath().resolve(".codecache").resolve("codesjar")
.toFile();
if (!cacheFolder.exists()) {
@@ -107,19 +95,16 @@ public class CodesJarM2CacheManager {
}
}
@SuppressWarnings("unchecked")
public static boolean needUpdateCodesJarProject(CodesJarInfo info) {
try {
Property property = info.getProperty();
String projectTechName = info.getProjectTechName();
File cacheFile = getCacheFile(projectTechName, property);
File cacheFile = getCacheFile(info);
if (!cacheFile.exists()) {
return true;
}
DateFormat format = ResourceHelper.dateFormat();
Properties cache = new Properties();
cache.load(new FileInputStream(cacheFile));
String currentTime = getModifiedDate(property);
String currentTime = info.getModifiedDate();
String cachedTime = cache.getProperty(KEY_MODIFIED_DATE);
// check codesjar modified date
if (cachedTime == null) {
@@ -137,7 +122,7 @@ public class CodesJarM2CacheManager {
} else {
cachedDepList = Arrays.asList(dependencies.split(DEP_SEPERATOR));
}
EList<IMPORTType> imports = ((RoutinesJarItem) property.getItem()).getRoutinesJarType().getImports();
List<IMPORTType> imports = info.getImports();
List<String> currentDepList = imports.stream().map(IMPORTType::getMVN).collect(Collectors.toList());
if (cachedDepList.size() != currentDepList.size()) {
return true;
@@ -182,14 +167,12 @@ public class CodesJarM2CacheManager {
@SuppressWarnings("unchecked")
public static void updateCodesJarProjectCache(CodesJarInfo info) {
Property property = info.getProperty();
String projectTechName = info.getProjectTechName();
Properties cache = new Properties();
File cacheFile = getCacheFile(projectTechName, property);
File cacheFile = getCacheFile(info);
// update codesjar modified date
cache.setProperty(KEY_MODIFIED_DATE, getModifiedDate(property));
cache.setProperty(KEY_MODIFIED_DATE, info.getModifiedDate());
// update dependencies
EList<IMPORTType> imports = ((RoutinesJarItem) property.getItem()).getRoutinesJarType().getImports();
List<IMPORTType> imports = info.getImports();
StringBuilder builder = new StringBuilder();
if (!imports.isEmpty()) {
imports.forEach(i -> builder.append(i.getMVN()).append(DEP_SEPERATOR));
@@ -215,8 +198,7 @@ public class CodesJarM2CacheManager {
}
public static void deleteCodesJarProjectCache(CodesJarInfo info) {
deleteCodesJarProjectCache(info.getProjectTechName(), ERepositoryObjectType.getItemType(info.getProperty().getItem()),
info.getProperty().getLabel());
deleteCodesJarProjectCache(info.getProjectTechName(), info.getType(), info.getLabel());
}
public static void deleteCodesJarProjectCache(String projectTechName, ERepositoryObjectType type, String label) {
@@ -245,9 +227,9 @@ public class CodesJarM2CacheManager {
*/
public static void updateCodesJarProjectPom(IProgressMonitor monitor, CodesJarInfo info) {
try {
IFile pomFile = new AggregatorPomsHelper(info.getProjectTechName()).getCodesJarFolder(info.getProperty())
IFile pomFile = new AggregatorPomsHelper(info.getProjectTechName()).getCodesJarFolder(info)
.getFile(TalendMavenConstants.POM_FILE_NAME);
ERepositoryObjectType type = ERepositoryObjectType.getItemType(info.getProperty().getItem());
ERepositoryObjectType type = info.getType();
if (type != null) {
if (ERepositoryObjectType.ROUTINESJAR == type) {
createRoutinesJarPom(info, pomFile, monitor);
@@ -261,13 +243,13 @@ public class CodesJarM2CacheManager {
}
private static void createRoutinesJarPom(CodesJarInfo info, IFile pomFile, IProgressMonitor monitor) throws Exception {
CreateMavenRoutinesJarPom createTemplatePom = new CreateMavenRoutinesJarPom(info.getProperty(), pomFile);
CreateMavenRoutinesJarPom createTemplatePom = new CreateMavenRoutinesJarPom(info, pomFile);
createTemplatePom.setProjectName(info.getProjectTechName());
createTemplatePom.create(monitor);
}
private static void createBeansJarPom(CodesJarInfo info, IFile pomFile, IProgressMonitor monitor) throws Exception {
CreateMavenBeansJarPom createTemplatePom = new CreateMavenBeansJarPom(info.getProperty(), pomFile);
CreateMavenBeansJarPom createTemplatePom = new CreateMavenBeansJarPom(info, pomFile);
createTemplatePom.setProjectName(info.getProjectTechName());
createTemplatePom.create(monitor);
}
@@ -276,13 +258,23 @@ public class CodesJarM2CacheManager {
updateCodesJarProject(monitor, false, false, false);
}
public static void updateCodesJarProjectForLogon(IProgressMonitor monitor) {
Set<CodesJarInfo> allCodesJars = CodesJarResourceCache.getAllCodesJars();
Set<CodesJarInfo> toUpdate = allCodesJars.stream()
.filter(info -> info.isInCurrentMainProject() && needUpdateCodesJarProject(info)).collect(Collectors.toSet());
allCodesJars.removeAll(toUpdate);
// compile directly for the rest of jar projects
allCodesJars.stream().map(info -> IRunProcessService.get().getExistingTalendCodesJarProject(info)).filter(p -> p != null)
.forEach(p -> p.buildWholeCodeProject());
updateCodesJarProject(monitor, toUpdate, false, false, false);
}
public static void updateCodesJarProject(IProgressMonitor monitor, boolean forceBuild, boolean onlyCurrentProject,
boolean syncCode) {
Set<CodesJarInfo> toUpdate;
if (onlyCurrentProject) {
String currentProject = ProjectManager.getInstance().getCurrentProject().getTechnicalLabel();
toUpdate = CodesJarResourceCache.getAllCodesJars().stream().filter(
info -> info.getProjectTechName().equals(currentProject) && (forceBuild || needUpdateCodesJarProject(info)))
toUpdate = CodesJarResourceCache.getAllCodesJars().stream()
.filter(info -> info.isInCurrentMainProject() && (forceBuild || needUpdateCodesJarProject(info)))
.collect(Collectors.toSet());
} else {
toUpdate = CodesJarResourceCache.getAllCodesJars().stream()
@@ -291,9 +283,9 @@ public class CodesJarM2CacheManager {
updateCodesJarProject(monitor, toUpdate, false, syncCode, false);
}
public static void updateCodesJarProject(Property property, boolean needReSync) throws Exception {
public static void updateCodesJarProject(CodesJarInfo info, boolean needReSync) throws Exception {
Set<CodesJarInfo> toUpdate = new HashSet<>();
toUpdate.add(CodesJarInfo.create(property));
toUpdate.add(info);
updateCodesJarProject(new NullProgressMonitor(), toUpdate, false, needReSync, true);
}
@@ -366,19 +358,13 @@ public class CodesJarM2CacheManager {
private static void syncSourceCode(CodesJarInfo info) {
try {
Property property = info.getProperty();
String projectTechName = info.getProjectTechName();
ITalendProcessJavaProject codesJarProject = IRunProcessService.get().getTalendCodesJarJavaProject(info);
codesJarProject.cleanFolder(new NullProgressMonitor(), codesJarProject.getSrcFolder());
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICodeGeneratorService.class)) {
ICodeGeneratorService codeGenService = (ICodeGeneratorService) GlobalServiceRegister.getDefault()
.getService(ICodeGeneratorService.class);
ICodeGeneratorService codeGenService = GlobalServiceRegister.getDefault().getService(ICodeGeneratorService.class);
ITalendSynchronizer routineSynchronizer = codeGenService.createRoutineSynchronizer();
Project project = ProjectManager.getInstance().getProjectFromProjectTechLabel(projectTechName);
ERepositoryObjectType codesJarType = ERepositoryObjectType.getItemType(property.getItem());
List<IRepositoryViewObject> allInnerCodes = ProxyRepositoryFactory.getInstance().getAllInnerCodes(project,
codesJarType, property);
List<IRepositoryViewObject> allInnerCodes = ProxyRepositoryFactory.getInstance().getAllInnerCodes(info);
for (IRepositoryViewObject codesObj : allInnerCodes) {
RoutineItem codeItem = (RoutineItem) codesObj.getProperty().getItem();
RoutineUtils.changeInnerCodePackage(codeItem, false, false);
@@ -449,15 +435,15 @@ public class CodesJarM2CacheManager {
private static String getModulePath(CodesJarInfo info) {
String projectTechName = info.getProjectTechName();
IPath basePath = new AggregatorPomsHelper().getProjectPomsFolder().getLocation();
IPath codeJarProjectPath = new AggregatorPomsHelper(projectTechName).getCodesJarFolder(info.getProperty()).getLocation();
IPath codeJarProjectPath = new AggregatorPomsHelper(projectTechName).getCodesJarFolder(info).getLocation();
String modulePath = codeJarProjectPath.makeRelativeTo(basePath).toPortableString();
return modulePath;
}
public static File getCacheFile(String projectTechName, Property property) {
String cacheFileName = PomIdsHelper.getCodesJarGroupId(projectTechName, property.getItem()) + "." //$NON-NLS-1$
+ property.getLabel().toLowerCase() + "-" //$NON-NLS-1$
+ PomIdsHelper.getCodesVersion(projectTechName) + ".cache"; // $NON-NLS-1$
public static File getCacheFile(CodesJarInfo info) {
String cacheFileName = PomIdsHelper.getCodesJarGroupId(info) + "." //$NON-NLS-1$
+ info.getLabel().toLowerCase() + "-" //$NON-NLS-1$
+ PomIdsHelper.getCodesVersion(info.getProjectTechName()) + ".cache"; // $NON-NLS-1$
return new File(cacheFolder, cacheFileName);
}
@@ -472,9 +458,4 @@ public class CodesJarM2CacheManager {
return KEY_INNERCODE_PREFIX + KEY_SEPERATOR + property.getId() + KEY_SEPERATOR + property.getVersion();
}
private static String getModifiedDate(Property property) {
String modifiedDate = (String) property.getAdditionalProperties().get(ItemProductKeys.DATE.getModifiedKey());
return StringUtils.isNotBlank(modifiedDate) ? modifiedDate : EMPTY_DATE;
}
}

View File

@@ -30,6 +30,7 @@ import org.talend.core.model.properties.Property;
import org.talend.core.runtime.projectsetting.IProjectSettingTemplateConstants;
import org.talend.designer.maven.template.MavenTemplateManager;
import org.talend.designer.maven.utils.PomUtil;
import org.talend.designer.runprocess.IRunProcessService;
/**
* DOC ggu class global comment. Detailled comment
@@ -116,7 +117,13 @@ public abstract class AbstractMavenCodesTemplatePom extends AbstractMavenGeneral
} else {
isDeployed = true;
}
if (ignoreModuleInstallationStatus() || isDeployed) {
boolean isCIMode = false;
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
IRunProcessService runProcessService = GlobalServiceRegister.getDefault()
.getService(IRunProcessService.class);
isCIMode = runProcessService.isCIMode();
}
if (isCIMode || ignoreModuleInstallationStatus() || isDeployed) {
dependency = PomUtil.createModuleDependency(module.getMavenUri());
if (module.isExcluded())
dependency.setScope("provided");

View File

@@ -329,10 +329,8 @@ public abstract class AbstractMavenProcessorPom extends CreateMavenBundleTemplat
}
return routineParameters.stream().filter(r -> r.getType() != null)
.map(r -> CodesJarResourceCache.getCodesJarById(r.getId())).filter(info -> info != null)
.map(info -> PomUtil.createDependency(
PomIdsHelper.getCodesJarGroupId(info.getProjectTechName(), info.getProperty().getItem()),
info.getProperty().getLabel().toLowerCase(), PomIdsHelper.getCodesJarVersion(info.getProjectTechName()),
null))
.map(info -> PomUtil.createDependency(PomIdsHelper.getCodesJarGroupId(info), info.getLabel().toLowerCase(),
PomIdsHelper.getCodesJarVersion(info.getProjectTechName()), null))
.collect(Collectors.toSet());
}

View File

@@ -20,21 +20,21 @@ import org.eclipse.core.resources.IFile;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.model.general.ILibrariesService;
import org.talend.core.model.general.ModuleNeeded;
import org.talend.core.model.properties.Property;
import org.talend.core.model.routines.CodesJarInfo;
import org.talend.designer.maven.template.MavenTemplateManager;
public class CreateMavenBeansJarPom extends AbstractMavenCodesTemplatePom {
private Property property;
private CodesJarInfo info;
public CreateMavenBeansJarPom(Property property, IFile pomFile) {
public CreateMavenBeansJarPom(CodesJarInfo info, IFile pomFile) {
super(pomFile);
this.property = property;
this.info = info;
}
@Override
protected Model getTemplateModel() {
return MavenTemplateManager.getBeansJarTempalteModel(property, getProjectName());
return MavenTemplateManager.getBeansJarTempalteModel(info);
}
@Override
@@ -43,7 +43,7 @@ public class CreateMavenBeansJarPom extends AbstractMavenCodesTemplatePom {
if (GlobalServiceRegister.getDefault().isServiceRegistered(ILibrariesService.class)) {
ILibrariesService libService = (ILibrariesService) GlobalServiceRegister.getDefault().getService(
ILibrariesService.class);
runningModules.addAll(libService.getCodesJarModuleNeededs(property));
runningModules.addAll(libService.getCodesJarModuleNeededs(info));
}
return runningModules;
}

View File

@@ -20,21 +20,21 @@ import org.eclipse.core.resources.IFile;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.model.general.ILibrariesService;
import org.talend.core.model.general.ModuleNeeded;
import org.talend.core.model.properties.Property;
import org.talend.core.model.routines.CodesJarInfo;
import org.talend.designer.maven.template.MavenTemplateManager;
public class CreateMavenRoutinesJarPom extends AbstractMavenCodesTemplatePom {
private Property property;
private CodesJarInfo info;
public CreateMavenRoutinesJarPom(Property property, IFile pomFile) {
public CreateMavenRoutinesJarPom(CodesJarInfo info, IFile pomFile) {
super(pomFile);
this.property = property;
this.info = info;
}
@Override
protected Model getTemplateModel() {
return MavenTemplateManager.getRoutinesJarTempalteModel(property, getProjectName());
return MavenTemplateManager.getRoutinesJarTempalteModel(info);
}
@Override
@@ -43,7 +43,7 @@ public class CreateMavenRoutinesJarPom extends AbstractMavenCodesTemplatePom {
if (GlobalServiceRegister.getDefault().isServiceRegistered(ILibrariesService.class)) {
ILibrariesService libService = (ILibrariesService) GlobalServiceRegister.getDefault().getService(
ILibrariesService.class);
runningModules.addAll(libService.getCodesJarModuleNeededs(property));
runningModules.addAll(libService.getCodesJarModuleNeededs(info));
}
return runningModules;
}

View File

@@ -49,6 +49,11 @@ public class ClasspathsJarGenerator {
public static String createJar(Property property, String classpath, String separator, boolean isRelativePath)
throws Exception {
return createJar(property, classpath, separator, isRelativePath, false);
}
public static String createJar(Property property, String classpath, String separator, boolean isRelativePath,
boolean usingTempDir) throws Exception {
String newClasspath = generateClasspathForManifest(classpath, separator, isRelativePath);
Manifest manifest = new Manifest();
@@ -57,7 +62,7 @@ public class ClasspathsJarGenerator {
a.put(Attributes.Name.IMPLEMENTATION_VENDOR, "Talend Open Studio"); //$NON-NLS-1$
a.put(Attributes.Name.CLASS_PATH, newClasspath);
String jarLocation = getJarLocation(property);
String jarLocation = getJarLocation(property, usingTempDir);
File jarFile = new File(jarLocation);
if (!jarFile.exists()) {
jarFile.createNewFile();
@@ -122,8 +127,8 @@ public class ClasspathsJarGenerator {
return finalClasspath.toString().trim();
}
public static String getClasspathFromManifest(Property property) throws Exception {
String jarLocation = getJarLocation(property);
public static String getClasspathFromManifest(Property property, boolean usingTempDir) throws Exception {
String jarLocation = getJarLocation(property, usingTempDir);
JarInputStream stream = null;
try {
stream = new JarInputStream(new FileInputStream(jarLocation));
@@ -148,10 +153,13 @@ public class ClasspathsJarGenerator {
return str;
}
private static String getJarLocation(Property property) {
private static String getJarLocation(Property property, boolean usingTempDir) {
ITalendProcessJavaProject jobProject = getRunProcessService().getTalendJobJavaProject(property);
String jarLocation = jobProject.getTargetFolder().getFile(CLASSPATHS_JAR_NAME).getLocation().toPortableString();
return jarLocation;
if (usingTempDir) {
return jobProject.getTempFolder().getFile(CLASSPATHS_JAR_NAME).getLocation().toPortableString();
} else {
return jobProject.getTargetFolder().getFile(CLASSPATHS_JAR_NAME).getLocation().toPortableString();
}
}
private static IRunProcessService getRunProcessService() {

View File

@@ -15,6 +15,7 @@ package org.talend.designer.maven.utils;
import org.apache.commons.lang3.StringUtils;
import org.talend.core.model.properties.Item;
import org.talend.core.model.properties.RoutineItem;
import org.talend.core.model.routines.CodesJarInfo;
import org.talend.core.model.routines.RoutinesUtil;
import org.talend.repository.ProjectManager;
@@ -28,13 +29,12 @@ public class CodesJarMavenUtil {
}
public static String getGAVPackageForCodesJar(Item codesJarItem) {
return StringUtils.replace(PomIdsHelper.getCodesJarGroupId(codesJarItem), ".", "/") + "/"
+ codesJarItem.getProperty().getLabel().toLowerCase();
return StringUtils.replace(PomIdsHelper.getCodesJarGroupId(CodesJarInfo.create(codesJarItem.getProperty())), ".", "/")
+ "/" + codesJarItem.getProperty().getLabel().toLowerCase();
}
public static String getImportGAVPackageForCodesJar(String projectTechName, Item codesJarItem) {
return PomIdsHelper.getCodesJarGroupId(projectTechName, codesJarItem) + "."
+ codesJarItem.getProperty().getLabel().toLowerCase() + ".*";
public static String getImportGAVPackageForCodesJar(CodesJarInfo info) {
return PomIdsHelper.getCodesJarGroupId(info) + "." + info.getLabel().toLowerCase() + ".*";
}
}

View File

@@ -26,14 +26,13 @@ import org.talend.core.model.process.JobInfo;
import org.talend.core.model.properties.Item;
import org.talend.core.model.properties.Property;
import org.talend.core.model.properties.RoutineItem;
import org.talend.core.model.properties.RoutinesJarItem;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.model.routines.CodesJarInfo;
import org.talend.core.model.routines.RoutinesUtil;
import org.talend.core.model.utils.JavaResourcesHelper;
import org.talend.core.repository.utils.ItemResourceUtil;
import org.talend.core.runtime.maven.MavenConstants;
import org.talend.core.runtime.projectsetting.ProjectPreferenceManager;
import org.talend.designer.core.ICamelDesignerCoreService;
import org.talend.designer.maven.DesignerMavenPlugin;
import org.talend.designer.maven.model.TalendMavenConstants;
import org.talend.repository.ProjectManager;
@@ -131,23 +130,12 @@ public class PomIdsHelper {
return getProjectVersion(projectTechName);
}
public static String getCodesJarGroupId(Item item) {
return getCodesJarGroupId(null, item);
}
public static String getCodesJarGroupId(String projectTechName, Item item) {
if (!(item instanceof RoutinesJarItem)) {
return null;
}
public static String getCodesJarGroupId(CodesJarInfo info) {
String baseName = TalendMavenConstants.DEFAULT_ROUTINESJAR;
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICamelDesignerCoreService.class)) {
ICamelDesignerCoreService camelService = GlobalServiceRegister.getDefault()
.getService(ICamelDesignerCoreService.class);
if (camelService.isInstanceofCamelBeansJar(item)) {
baseName = TalendMavenConstants.DEFAULT_BEANSJAR;
}
if (info.getType() == ERepositoryObjectType.BEANSJAR) {
baseName = TalendMavenConstants.DEFAULT_BEANSJAR;
}
return getCodesJarGroupId(projectTechName, baseName);
return getCodesJarGroupId(info.getProjectTechName(), baseName);
}
public static String getCodesJarGroupIdByInnerCode(String projectTechName, Item item) {
@@ -327,6 +315,12 @@ public class PomIdsHelper {
return manager.getBoolean(MavenConstants.EXCLUDE_DELETED_ITEMS);
}
public static boolean getMavenPrefOptionStatus(String prefName) {
String projectTechName = ProjectManager.getInstance().getCurrentProject().getTechnicalLabel();
ProjectPreferenceManager manager = getPreferenceManager(projectTechName);
return manager.getBoolean(prefName);
}
private static String getGroupId(String projectTechName, String baseName, Property property) {
if (projectTechName == null) {
projectTechName = ProjectManager.getInstance().getCurrentProject().getTechnicalLabel();
@@ -367,8 +361,9 @@ public class PomIdsHelper {
public static boolean skipFolders() {
String projectTechName = ProjectManager.getInstance().getCurrentProject().getTechnicalLabel();
ProjectPreferenceManager manager = getPreferenceManager(projectTechName);
return manager.getBoolean(MavenConstants.SKIP_FOLDERS);
Project project = ProjectManager.getInstance().getProjectFromProjectTechLabel(projectTechName);
ProjectPreferenceManager preferenceManager = new ProjectPreferenceManager(project, DesignerMavenPlugin.PLUGIN_ID, false);
return preferenceManager.getBoolean(MavenConstants.SKIP_FOLDERS);
}
public static boolean isValidGroupId(String text) {
@@ -404,6 +399,7 @@ public class PomIdsHelper {
if (PluginChecker.isTIS()) {
preferenceStore.setValue(MavenConstants.EXCLUDE_DELETED_ITEMS, true);
}
preferenceStore.setValue(MavenConstants.SKIP_LOOP_DEPENDENCY_CHECK, true);
}
preferenceManager.save();
preferenceManagers.put(projectTechName, preferenceManager);

View File

@@ -7,7 +7,7 @@
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry exported="true" kind="lib" path="lib/commons-digester-2.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/commons-cli-2.0-SNAPSHOT.jar"/>
<classpathentry exported="true" kind="lib" path="lib/commons-codec-1.6.jar"/>
<classpathentry exported="true" kind="lib" path="lib/commons-codec-1.15.jar"/>
<classpathentry exported="true" kind="lib" path="lib/commons-text-1.1.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@@ -4,7 +4,7 @@ Bundle-Name: Common
Bundle-SymbolicName: org.talend.libraries.apache.common
Bundle-Version: 7.3.1.qualifier
Bundle-ClassPath: .,
lib/commons-codec-1.6.jar,
lib/commons-codec-1.15.jar,
lib/commons-cli-2.0-SNAPSHOT.jar,
lib/commons-digester-2.1.jar,
lib/commons-math3-3.3.jar,

View File

@@ -2,7 +2,6 @@ output.. = bin/
bin.includes = META-INF/,\
lib/,\
lib/commons-lang-2.6.jar,\
lib/commons-codec-1.6.jar,\
lib/commons-cli-2.0-SNAPSHOT.jar,\
lib/commons-digester-2.1.jar,\
lib/commons-math3-3.3.jar,\

View File

@@ -9,4 +9,69 @@
</parent>
<artifactId>org.talend.libraries.apache.common</artifactId>
<packaging>eclipse-plugin</packaging>
<repositories>
<repository>
<id>talend-update</id>
<url>https://talend-update.talend.com/nexus/content/repositories/libraries/</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<id>copy-maven-repository</id>
<phase>generate-sources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${project.basedir}/lib</outputDirectory>
<artifactItems>
<artifactItem>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.15</version>
</artifactItem>
<artifactItem>
<groupId>commons-digester</groupId>
<artifactId>commons-digester</artifactId>
<version>2.1</version>
</artifactItem>
<artifactItem>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
<version>3.3</version>
</artifactItem>
<artifactItem>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<version>1.5.1</version>
</artifactItem>
<artifactItem>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
<version>2.4.2</version>
</artifactItem>
<artifactItem>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.2</version>
</artifactItem>
<artifactItem>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -1,21 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="lib/jakarta.activation-1.2.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-wsdl-3.3.4.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jakarta.activation-api-1.2.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jakarta.xml.bind-api-2.3.2.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jaxb-runtime-2.3.2.jar"/>
<classpathentry exported="true" kind="lib" path="lib/woodstox-core-asl-4.4.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/javax.annotation-api-1.3.2.jar"/>
<classpathentry exported="true" kind="lib" path="lib/stax2-api-3.1.4.jar"/>
<classpathentry kind="src" path="src"/>
<classpathentry exported="true" kind="lib" path="lib/jakarta.activation-1.2.2.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-wsdl-3.3.10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jakarta.activation-api-1.2.2.jar"/>
<classpathentry exported="true" kind="lib" path="lib/woodstox-core-6.2.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jakarta.annotation-api-1.3.5.jar"/>
<classpathentry exported="true" kind="lib" path="lib/stax2-api-4.2.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/neethi-3.1.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jakarta.ws.rs-api-2.1.5.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-core-3.3.4.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-bindings-xml-3.3.4.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-frontend-jaxrs-3.3.4.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-rs-client-3.3.4.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-transports-http-3.3.4.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jaxws-api-2.3.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jakarta.ws.rs-api-2.1.6.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-core-3.3.10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-bindings-xml-3.3.10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-frontend-jaxrs-3.3.10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-rs-client-3.3.10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-transports-http-3.3.10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-bindings-soap-3.3.10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-databinding-jaxb-3.3.10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-features-clustering-3.3.10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-frontend-jaxws-3.3.10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-frontend-simple-3.3.10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-security-3.3.10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-security-saml-3.3.10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-ws-addr-3.3.10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-ws-policy-3.3.10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-ws-security-3.3.10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/javax.ws.rs-api-2.0-m10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jakarta.xml.bind-api-2.3.3.jar"/>
<classpathentry exported="true" kind="lib" path="lib/xmlschema-core-2.2.5.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jaxb-runtime-2.3.3.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jakarta.jws-api-2.1.0.jar"/>
<classpathentry exported="true" kind="lib" path="lib/istack-commons-runtime-3.0.11.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jakarta.xml.soap-api-1.4.2.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>

View File

@@ -6,31 +6,81 @@ Bundle-Version: 7.3.1.qualifier
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .,
lib/neethi-3.1.1.jar,
lib/stax2-api-3.1.4.jar,
lib/stax2-api-4.2.1.jar,
lib/javax.activation-1.2.0.jar,
lib/jaxws-api-2.3.1.jar,
lib/cxf-core-3.3.4.jar,
lib/cxf-rt-bindings-xml-3.3.4.jar,
lib/cxf-rt-frontend-jaxrs-3.3.4.jar,
lib/cxf-rt-rs-client-3.3.4.jar,
lib/cxf-rt-transports-http-3.3.4.jar,
lib/cxf-rt-wsdl-3.3.4.jar,
lib/jakarta.ws.rs-api-2.1.5.jar,
lib/javax.annotation-api-1.3.2.jar,
lib/woodstox-core-asl-4.4.1.jar,
lib/jakarta.xml.bind-api-2.3.2.jar,
lib/jaxb-runtime-2.3.2.jar,
lib/jakarta.activation-api-1.2.1.jar,
lib/jakarta.activation-1.2.1.jar
Export-Package: javax.ws.rs,
lib/cxf-core-3.3.10.jar,
lib/cxf-rt-bindings-xml-3.3.10.jar,
lib/cxf-rt-frontend-jaxrs-3.3.10.jar,
lib/cxf-rt-rs-client-3.3.10.jar,
lib/cxf-rt-transports-http-3.3.10.jar,
lib/cxf-rt-wsdl-3.3.10.jar,
lib/cxf-rt-bindings-soap-3.3.10.jar,
lib/cxf-rt-databinding-jaxb-3.3.10.jar,
lib/cxf-rt-features-clustering-3.3.10.jar,
lib/cxf-rt-frontend-jaxws-3.3.10.jar,
lib/cxf-rt-frontend-simple-3.3.10.jar,
lib/cxf-rt-security-3.3.10.jar,
lib/cxf-rt-security-saml-3.3.10.jar,
lib/cxf-rt-ws-addr-3.3.10.jar,
lib/cxf-rt-ws-policy-3.3.10.jar,
lib/cxf-rt-ws-security-3.3.10.jar,
lib/jakarta.ws.rs-api-2.1.6.jar,
lib/jakarta.annotation-api-1.3.5.jar,
lib/woodstox-core-6.2.1.jar,
lib/jakarta.xml.bind-api-2.3.3.jar,
lib/jakarta.activation-api-1.2.2.jar,
lib/jakarta.activation-1.2.2.jar,
lib/javax.ws.rs-api-2.0-m10.jar,
lib/xmlschema-core-2.2.5.jar,
lib/jaxb-runtime-2.3.3.jar,
lib/jakarta.jws-api-2.1.0.jar,
lib/istack-commons-runtime-3.0.11.jar,
lib/jakarta.xml.soap-api-1.4.2.jar
Export-Package: com.sun.istack,
com.sun.istack.localization,
com.sun.istack.logging,
com.sun.xml.bind,
com.sun.xml.bind.annotation,
com.sun.xml.bind.api,
com.sun.xml.bind.api.impl,
com.sun.xml.bind.marshaller,
com.sun.xml.bind.unmarshaller,
com.sun.xml.bind.util,
com.sun.xml.bind.v2,
com.sun.xml.bind.v2.bytecode,
com.sun.xml.bind.v2.model.annotation,
com.sun.xml.bind.v2.model.core,
com.sun.xml.bind.v2.model.impl,
com.sun.xml.bind.v2.model.nav,
com.sun.xml.bind.v2.model.runtime,
com.sun.xml.bind.v2.model.util,
com.sun.xml.bind.v2.runtime,
com.sun.xml.bind.v2.runtime.output,
com.sun.xml.bind.v2.runtime.property,
com.sun.xml.bind.v2.runtime.reflect,
com.sun.xml.bind.v2.runtime.reflect.opt,
com.sun.xml.bind.v2.runtime.unmarshaller,
com.sun.xml.bind.v2.schemagen,
com.sun.xml.bind.v2.schemagen.episode,
com.sun.xml.bind.v2.schemagen.xmlschema,
com.sun.xml.bind.v2.util,
javax.jws,
javax.ws.rs,
javax.ws.rs.client,
javax.ws.rs.container,
javax.ws.rs.core,
javax.ws.rs.ext,
javax.xml.bind,
javax.xml.bind.annotation,
javax.xml.bind.annotation.adapters,
javax.xml.bind.attachment,
javax.xml.bind.helpers,
javax.xml.bind.util,
org.apache.cxf,
org.apache.cxf.annotations,
org.apache.cxf.attachment,
org.apache.cxf.binding,
org.apache.cxf.binding.soap,
org.apache.cxf.binding.xml,
org.apache.cxf.binding.xml.interceptor,
org.apache.cxf.binding.xml.wsdl11,
@@ -95,6 +145,9 @@ Export-Package: javax.ws.rs,
org.apache.cxf.jaxrs.utils,
org.apache.cxf.jaxrs.utils.multipart,
org.apache.cxf.jaxrs.utils.schemas,
org.apache.cxf.jaxws,
org.apache.cxf.jaxws.spi,
org.apache.cxf.jaxws22.spi,
org.apache.cxf.logging,
org.apache.cxf.management,
org.apache.cxf.management.annotation,
@@ -130,10 +183,20 @@ Export-Package: javax.ws.rs,
org.apache.cxf.ws.addressing.v200403,
org.apache.cxf.ws.addressing.v200408,
org.apache.cxf.ws.addressing.wsdl,
org.apache.cxf.ws.policy,
org.apache.cxf.ws.policy.mtom,
org.apache.cxf.wsdl,
org.apache.cxf.wsdl.binding,
org.apache.cxf.wsdl.http,
org.apache.cxf.wsdl11
org.apache.cxf.wsdl.service.factory,
org.apache.cxf.wsdl11,
org.apache.neethi,
org.apache.neethi.builders,
javax.xml.ws,
org.talend.libraries.apache.cxf
Require-Bundle: javax.wsdl;bundle-version="1.6.2",
org.apache.log4j
org.apache.log4j,
org.eclipse.core.runtime,
javax.xml.ws
Eclipse-BundleShape: dir
Bundle-Activator: org.talend.libraries.apache.cxf.ApacheCxfLibPlugin

View File

@@ -1,29 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
lib/stax2-api-3.1.4.jar,\
lib/woodstox-core-asl-4.4.1.jar,\
lib/xmlschema-core-2.2.1.jar,\
lib/commons-codec-1.10.jar,\
lib/wss4j-bindings-2.1.4.jar,\
lib/wss4j-policy-2.1.4.jar,\
lib/wss4j-ws-security-common-2.1.4.jar,\
lib/wss4j-ws-security-dom-2.1.4.jar,\
lib/wss4j-ws-security-policy-stax-2.1.4.jar,\
lib/wss4j-ws-security-stax-2.1.4.jar,\
lib/javax.activation-1.2.0.jar,\
lib/jaxws-api-2.3.1.jar,\
lib/cxf-core-3.3.4.jar,\
lib/cxf-rt-bindings-xml-3.3.4.jar,\
lib/cxf-rt-frontend-jaxrs-3.3.4.jar,\
lib/cxf-rt-rs-client-3.3.4.jar,\
lib/cxf-rt-transports-http-3.3.4.jar,\
lib/jakarta.ws.rs-api-2.1.5.jar,\
lib/neethi-3.1.1.jar,\
lib/javax.annotation-api-1.3.2.jar,\
lib/jaxb-runtime-2.3.2.jar,\
lib/jakarta.xml.bind-api-2.3.2.jar,\
lib/jakarta.activation-api-1.2.1.jar,\
lib/cxf-rt-wsdl-3.3.4.jar,\
lib/jakarta.activation-1.2.1.jar
lib/

Some files were not shown because too many files have changed in this diff Show More