Compare commits

...

57 Commits

Author SHA1 Message Date
bhe-talendbj
f55f2009bb fix(27078): Merge branch 'maintenance/7.3' into bhe/bugfix/TUP-27078_732 2020-06-01 17:00:31 +08:00
OleksiiNimych
45caecd7f2 fix(TDI-44169): remove xmlrpc_3.0 from studio (#3344) 2020-05-29 14:46:27 +03:00
Chao MENG
6e9daf05fb feat(TUP-26569): merge known conflicts automatically (#3347)
https://jira.talendforge.org/browse/TUP-26569
2020-05-29 10:59:18 +08:00
bhe-talendbj
f48c9c7c2e bugfix(TUP-27078): Fix parse response data get from artifactory which is runing with https 2020-05-28 11:09:08 +08:00
kjwang
3cfb30a9a0 Kjwang/feat tup 26288 enhance context b73 (#3335)
Fix TUP-26288 Enhance context propagation over reference project
https://jira.talendforge.org/browse/TUP-26288
2020-05-27 17:08:31 +08:00
jzhao
ea6595bab8 chore: bump tcompV0 version to 0.28.4 (#3327) 2020-05-25 15:09:31 +08:00
Zhiwei Xue
2454e6ba1c chore: Remove junit of Mojo version. (#3315) 2020-05-21 14:21:53 +08:00
hzhao-talendbj
c9600e040e fix(TUP-27072)_Unexpected behaviour occurred when context name is in (#3268) (#3311)
* fix(TUP-27072)_Unexpected behaviour occurred when context name is in
Japanese
2020-05-21 09:40:57 +08:00
pyzhou
6254945a6e fix(TDI-43717):backport cosmos to 7.3 (#3310) 2020-05-19 16:33:16 +08:00
hwang-talend
b54984ad2d Hwang/tup 26994 (#3282) (#3301)
* bugfix(TUP-26994):Usage data collector : change the way Studio Unique Id
is calculated
2020-05-19 16:15:05 +08:00
Jane Ding
59bb804cea Revert "fix(TUP-26990):Possible conflict in talend project (#3264) (#3271)" (#3306)
This reverts commit eafc630094.
2020-05-18 17:23:46 +08:00
jiezhang-tlnd
ba9a85f59f feat(TUP-26284)Upgrade AWS SDK for driver in metadata (#3300) 2020-05-18 12:08:38 +08:00
Zhiwei Xue
d7d0dcefb7 fix(TUP-27077): NoClassDefFoundException when using "independent process (#3286) (#3294)
to run subjob" and tAzureAdlsGen2Input
2020-05-15 12:01:22 +08:00
Zhiwei Xue
65a71ba142 fix(TUP-26961):When save/delete a test case, it might break the poms/CI (#3253) 2020-05-14 10:16:18 +08:00
hcyi
3f74eaa4d9 fix(TUP-27000):Talend Salesforce Einstein connector Repository (#3274)
connection issue in Talend 7.3
2020-05-14 10:06:30 +08:00
Jane Ding
dffac5bcb4 bugfix(TUP-26956):Update Studio top bar to reflect monthly deliveries (#3246) (#3280)
* bugfix(TUP-26956):Update Studio top bar to reflect monthly deliveries
for better understanding

* bugfix(TUP-26956):Update Studio top bar to reflect monthly deliveries
for better understanding

* bugfix(TUP-26956):Update Studio top bar to reflect monthly deliveries
for better understanding

* bugfix(TUP-26956):Update Studio top bar to reflect monthly deliveries
for better understanding

* bugfix(TUP-26956):Update Studio top bar to reflect monthly deliveries
for better understanding

Co-authored-by: hwang-talend <hwang@talend.com>
2020-05-12 09:21:53 +08:00
Jane Ding
d13cdc6349 fix(TUP-27003):Should disable the Commit button of Uncommitted files (#3273) (#3276)
found dialog when project is in MERGING state
https://jira.talendforge.org/browse/TUP-27003
2020-05-11 18:03:30 +08:00
Zhiwei Xue
1609837f67 chore(TUP-26710):update version (#3275)
* chore(TUP-26710):update version

* Set version to 7.3.1 PATCH

* chore(TUP-26710):update version for feature.xml

Co-authored-by: Jenkins Continuous Build server <jenkins@tal-rd02.talend.lan>
2020-05-11 17:03:05 +08:00
Jane Ding
eafc630094 fix(TUP-26990):Possible conflict in talend project (#3264) (#3271)
* fix(TUP-26990):Possible conflict in talend project
https://jira.talendforge.org/browse/TUP-26990

* fix(TUP-26990):Possible conflict in talend project
https://jira.talendforge.org/browse/TUP-26990
2020-05-09 14:59:20 +08:00
Jane Ding
ee68fe3be6 feat(TUP-16546)Prompt users for new password in Studio Connection when (#3119) (#3255)
* feat(TUP-16546)Prompt users for new password in Studio Connection when
AD/LDAP credentials change in TAC
https://jira.talendforge.org/browse/TUP-16546

* feat(TUP-16546)Prompt users for new password in Studio Connection when
AD/LDAP credentials change in TAC
https://jira.talendforge.org/browse/TUP-16546

* feat(TUP-16546)Prompt users for new password in Studio Connection when
AD/LDAP credentials change in TAC
https://jira.talendforge.org/browse/TUP-16546

* feat(TUP-16546)Prompt users for new password in Studio Connection when
AD/LDAP credentials change in TAC
https://jira.talendforge.org/browse/TUP-16546
2020-05-06 00:10:43 +08:00
Jane Ding
cfeb6118db fix(TUP-26639):Talend Cloud studio Issue -Changes to Context Parameter (#3249) (#3256)
* fix(TUP-26639):Talend Cloud studio Issue -Changes to Context Parameter
Names is not reflected on the Connection for Snowflake
https://jira.talendforge.org/browse/TUP-26639

* fix(TUP-26639):Talend Cloud studio Issue -Changes to Context Parameter
Names is not reflected on the Connection for Snowflake
https://jira.talendforge.org/browse/TUP-26639

* fix(TUP-26639):Talend Cloud studio Issue -Changes to Context Parameter
Names is not reflected on the Connection for Snowflake
https://jira.talendforge.org/browse/TUP-26639
2020-05-04 19:14:11 +08:00
jiezhang-tlnd
5c140eb8a2 fix(TUP-26896)Error create a Sybase connection in metadata and cannot (#3254)
retrieve tables (#3231)

* fix(TUP-26896)Error create a Sybase connection in metadata and cannot
retrieve tables
https://jira.talendforge.org/browse/TUP-26896

* fix(TUP-26896)retrieve schema on sybase 16 anywhere metadate get empry
value
https://jira.talendforge.org/browse/TUP-26896

* fix(TUP-26896)Error create a Sybase connection in metadata and cannot
retrieve tables

* fix(TUP-26896)Error create a Sybase connection in metadata and cannot
retrieve tables
https://jira.talendforge.org/browse/TUP-26896

* fix(TUP-26896)Error create a Sybase connection in metadata and cannot
retrieve tables

* fix(TUP-26896)Error create a Sybase connection in metadata and cannot
retrieve tables

* fix(TUP-26896)Error create a Sybase connection in metadata and cannot
retrieve tables

* fix(TUP-26896)Error create a Sybase connection in metadata and cannot
retrieve tables

* fix(TUP-26896)Error create a Sybase connection in metadata and cannot
retrieve tables

* fix(TUP-26896)Error create a Sybase connection in metadata and cannot
retrieve tables

* fix(TUP-26896)Error create a Sybase connection in metadata and cannot
retrieve tables
https://jira.talendforge.org/browse/TUP-26896

Conflicts:
	main/plugins/org.talend.metadata.managment/src/main/java/org/talend/metadata/managment/model/DBConnectionFillerImpl.java
2020-04-30 17:39:51 +08:00
Liu Xinquan
2f527b6195 fix(TDQ-18135) support context variable in tDataEncrypt (#3180) (#3207) (#3252) 2020-04-30 15:46:33 +08:00
Jane Ding
30119635cb fix(TUP-26639):Talend Cloud studio Issues - Group context and (#3233) (#3243)
connections
https://jira.talendforge.org/browse/TUP-26639
2020-04-27 23:20:59 +08:00
Zhiwei Xue
d50c690f42 fix(TUP-26809):Job zip should not contain jars from testcase only (#3237) 2020-04-27 18:05:28 +08:00
Emmanuel GALLOIS
10764112d7 feat(TCOMP-1681): Make ESB Studio job export TaCoKit compliant
- add TaCoKit dependency service (#3220)
2020-04-24 17:27:26 +02:00
hwang-talend
84b1dd3a01 Hwang/tup 26870 (#3214) (#3238)
* bugfix(TUP-26870):Incorrect sorting order
2020-04-23 14:17:36 +08:00
Zhiwei Xue
d8084ea4f0 fix(TUP-26876):NoClassDefFoundError when I run spark job with JobServer 2020-04-16 10:22:36 +08:00
Dmytro Sylaiev
8f2c264cc3 fix(TDI-44000): Bump locales version for maven.tos plugin (#3213) 2020-04-15 19:03:26 +03:00
hzhao-talendbj
8a24ecd296 fix missing db value (#3209) (#3210) 2020-04-15 09:50:56 +08:00
jiezhang-tlnd
14c79d9602 fix(TUP-26793)JDBC Redshift in context mode still asked for jars (#3205)
https://jira.talendforge.org/browse/TUP-26793
2020-04-13 14:16:51 +08:00
Zhiwei Xue
f682de08d2 fix(TUP-26728):fix regression on preview function. (#3197) 2020-04-09 16:04:20 +08:00
Zhiwei Xue
cec1999354 fix(TUP-26728):Missing spark dependencies when using test cases (#3194)
* fix(TUP-26728):The parent DI job misses to load some required libraries
from the Spark job

* fix(TUP-26728):Missing spark dependencies when using test cases
2020-04-09 16:03:44 +08:00
hzhao-talendbj
29b4de8ad7 fix(TUP-26388)Amazon Redshift Driver class not working with Implicit (#3181) (#3190)
* fix(TUP-26388)Amazon Redshift Driver class not working with Implicit
Context

* fix(TUP-26388)Amazon Redshift Driver class not working with Implicit
Context
2020-04-07 15:42:11 +08:00
hcyi
cc44671136 fix(TUP-26229):Dynamic Schema default Mapping can't be changed (#3143) (#3183) 2020-04-03 14:24:44 +08:00
Zhiwei Xue
2d4ce482ae fix(TUP-26233):update related extensions. (#3179) 2020-04-03 12:37:57 +08:00
bhe-talendbj
257d1aa94b fix(TUP-26539): Unassociate data from associateListeners (#3169) (#3176)
* fix(TUP-26539): Fix wrong tree node implmentation

* fix(TUP-26539): add test case

* fix(TUP-26539): Remove reference to itself

* fix(TUP-26539): Return root node

* fix(TUP-26539): Update test case

* fix(TUP-26539): update test case

* fix(TUP-26539): Unassociate unnecessary listeners

* fix(TUP-26539): Revert changes of RepositoryNode

* fix(TUP-26539): Add override annotation
2020-04-03 10:07:51 +08:00
Zhiwei Xue
c5d28b4480 fix(TUP-26233):[7.0.1] Sometimes , the ZIP file created by a commandline (#3168)
PublishJob is not correct, missing item files.
2020-03-31 18:27:33 +08:00
Liu Xinquan
1d0650170f fix(TDQ-18049) add the "transform" to avoid class conflict when shaded (#3085) (#3131)
Co-authored-by: qiongli <qiongli@talend.com>
2020-03-31 14:43:33 +08:00
hzhao-talendbj
28a9bf7542 fix(TUP-26596)Proxy of libraries not working when studio have no (#3165) (#3172)
* fix(TUP-26596)Proxy of libraries not working when studio have no
internet access

* fix(TUP-26596)Proxy of libraries not working when studio have no
internet access

* fix(TUP-26596)Proxy of libraries not working when studio have no
internet access

* fix(TUP-26596)Proxy of libraries not working when studio have no
internet access
2020-03-31 09:14:22 +08:00
sbliu
9a649d1c05 TMDM-14505 MDM connection in metadata randomly failed with error 'Failed to connect to MDM, please change MDM settings'
Moved interface IWebServiceHook from mdm bundle and renamed to IMDMWebServiceHook,re-use the implemented webservice hook in mdm for both mdm & di side to establish mdm connection token.
Add unit test to check presence of the required header that containing token.
2020-03-27 15:35:46 +08:00
hzhao-talendbj
8889b7f0e9 Hengzhao/backport73/tup 25889 display issue for the line between linker source and target on mac and ubuntu (#3166)
* fix(TUP-25889)Display issue for the line between Linker source and (#3103)

* fix(TUP-25889)Display issue for the line between Linker source and
target on Mac and Ubuntu

* fix(TUP-25889)Display issue for the line between Linker source and
target on Mac and Ubuntu

* fix column names are same issue (#3155)

* fix mac os display issue (#3160)
2020-03-26 19:22:32 +08:00
Ivan Gonchar
43e6cc4b99 chore: bump Components version to 0.28.4-SNAPSHOT (#3153) 2020-03-26 07:57:26 +08:00
Jane Ding
2735bef5ed fix(TUP-26576):Warning pops up cannot connect to the user libraries (#3154) (#3159)
artifact repository set in administrator
https://jira.talendforge.org/browse/TUP-26576
2020-03-25 09:21:11 +08:00
Zhiwei Xue
dfe11f5469 fix(TUP-26165):fix jar with classifier missing issue (#3152)
* fix(TUP-26165)jar referenced in bat or sh classpath missing in build ZIP (#3105)

* fix(TUP-26165)jar referenced in bat or sh classpath missing in build ZIP
file folder lib
https://jira.talendforge.org/browse/TUP-26165

* fix(TUP-26165)jar referenced in bat or sh classpath missing in build ZIP
file folder lib
https://jira.talendforge.org/browse/TUP-26165

* fix(TUP-26165)jar referenced in bat or sh classpath missing in build ZIP
file folder lib
https://jira.talendforge.org/browse/TUP-26165

* fix(TUP-26165)jar referenced in bat or sh classpath missing in build ZIP
file folder lib
https://jira.talendforge.org/browse/TUP-26165

* fix(TUP-26165)jar referenced in bat or sh classpath missing in build ZIP
file folder lib
https://jira.talendforge.org/browse/TUP-26165

* fix(TUP-26165):fix jar with classifier missing issue

Co-authored-by: Jane Ding <35018295+jding-tlnd@users.noreply.github.com>
2020-03-23 14:22:07 +08:00
Ivan Gonchar
cf96982dcf chore: bump TCK components version to 1.6.3-SNAPSHOT (#3150) 2020-03-20 11:06:13 +08:00
Ivan Gonchar
d7b24ab048 chore: bump Components version to 0.28.3-SNAPSHOT (#3148) 2020-03-20 10:53:50 +08:00
kjwang
ce527ba33e Fix TUP-26346 Files from custom component folders are uploaded to nexus multiple times (#3125) (#3144)
* Fix TUP-26346 Files from custom component folders are uploaded to nexus
multiple times
https://jira.talendforge.org/browse/TUP-26346

* Fix TUP-26346 Files from custom component folders are uploaded to nexus
multiple times
https://jira.talendforge.org/browse/TUP-26346

* Fix TUP-26346 Files from custom component folders are uploaded to nexus
multiple times
https://jira.talendforge.org/browse/TUP-26346
2020-03-20 09:43:59 +08:00
Zhiwei Xue
9b3037d3a8 update talend.properties 2020-03-19 09:56:00 +08:00
hcyi
49ae1fe789 fix(TUP-26155):improve for dataviewer if MongoDB with SSL (#3111) (#3130) 2020-03-16 12:37:34 +08:00
bhe-talendbj
e27dcbcef6 bugfix(TDQ-18070): Improve file path validation (#3095) (#3127)
* fix(TDQ-18070): Improve file path validation

* fix(TDQ-18070): Improve file path validation
2020-03-11 11:23:17 +08:00
kjwang
dd61f6d257 TUP-26308 Nexus 2 gets populated by different crypto-utils jar versions (#3116) (#3123)
https://jira.talendforge.org/browse/TUP-26308
2020-03-11 11:22:02 +08:00
bhe-talendbj
6c690a9314 bugfix(TUP-25965) Include subjob's test reports (#3055) (#3126)
* bugfix(TUP-25965) Synchronize test reports

* bugfix(TUP-25965) Ignore test failures and zip test reports

* bugfix(TUP-25965) Ignore test failures and zip test reports

* bugfix(TUP-25965) Ignore test failures and zip test reports

* bugfix(TUP-25965) Ignore test failures and zip test reports

* bugfix(TUP-25965) Ignore test failures

* bugfix(TUP-25965) Ignore test failures

* bugfix(TUP-25965) Skip tests when running job

* fix(TUP-25965): Call service to check is build job or not
2020-03-10 11:02:41 +08:00
Zhiwei Xue
a24e1fb363 fix(TUP-26344):Some job including customer component can't generate code (#3121)
migrated from 6.3.1 to 7.2.1
2020-03-10 10:47:17 +08:00
Chao MENG
0878fc8bac fix(TUP-26212): Share more than one car component to nexus3.19.1 will fail to generate the right index file (#3100) (#3120)
* fix(TUP-26212): Share more than one car component to nexus3.19.1 will
fail to generate the right index file

https://jira.talendforge.org/browse/TUP-26212

* fix(TUP-26212): Share more than one car component to nexus3.19.1 will
fail to generate the right index file

https://jira.talendforge.org/browse/TUP-26212

Co-authored-by: bhe-talendbj <52311292+bhe-talendbj@users.noreply.github.com>
2020-03-10 09:27:20 +08:00
kjwang
4375dcbc66 fix(TUP-26189): [7.2.1] snowflake metadata connection with proxy failure (#3101) (#3114)
* fix(TUP-26189): [7.2.1] snowflake metadata connection with proxy failure

https://jira.talendforge.org/browse/TUP-26189
2020-03-05 14:47:23 +08:00
Jenkins Continuous Build server
a1ee13acc5 Set version to 7.3.2 SNAPSHOT 2020-02-28 13:00:24 +01:00
298 changed files with 5471 additions and 2176 deletions

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.common.ui.runtime.nl</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.commons.runtime.nl</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.commons.ui.nl</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.core.nl</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.core.repository.nl</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.core.runtime.nl</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.core.ui.nl</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.cwm.mip.edit.nl</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.cwm.mip.nl</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.designer.maven.ui.nl</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.help.nl</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.helpers.nl</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.librariesmanager.nl</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.librariesmanager.ui.nl</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.metadata.managment.nl</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.metadata.managment.ui.nl</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.migrationTool.nl</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.model.edit.nl</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.model.migration.nl</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.model.nl</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.presentation.onboarding.nl</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.rcp.nl</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.registration.nl</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.repository.items.importexport.nl</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.repository.items.importexport.ui.nl</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.repository.localprovider.nl</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.repository.mdm.nl</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.repository.metadata.nl</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.repository.view.nl</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.resources.nl</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.commons.feature</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.core.feature</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.fragment.jars.common.feature</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.help.di.feature</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.help.feature</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.jdt.feature</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.libraries.jdbc.feature</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.m2e.feature</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.model.migration.feature</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.rcp.feature</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.update.p2.feature</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.updates.feature</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.utils.feature</artifactId>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.common.ui.runtime</artifactId>

View File

@@ -21,6 +21,7 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
@@ -38,6 +39,8 @@ public class ExceptionMessageDialog extends MessageDialog {
private String exceptionString = null;
private int[] diabledButtonIndex = new int[] {};
public ExceptionMessageDialog(Shell parentShell, String dialogTitle, Image dialogTitleImage, String dialogMessage,
int dialogImageType, String[] dialogButtonLabels, int defaultIndex, Throwable ex) {
super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex);
@@ -147,4 +150,21 @@ public class ExceptionMessageDialog extends MessageDialog {
this.exceptionString = exceptionString;
}
public void setDisabledButtons(int[] index) {
this.diabledButtonIndex = index;
}
@Override
protected void createButtonsForButtonBar(Composite parent) {
super.createButtonsForButtonBar(parent);
if (diabledButtonIndex == null) {
return;
}
for (int index : diabledButtonIndex) {
Button button = super.getButton(index);
button.setEnabled(false);
}
}
}

View File

@@ -13,7 +13,8 @@ Require-Bundle: org.apache.log4j;visibility:=reexport,
org.talend.libraries.apache,
com.ibm.icu,
org.apache.commons.io,
org.talend.utils
org.talend.utils,
org.eclipse.core.net
Export-Package: org.talend.commons,
org.talend.commons.exception,
org.talend.commons.i18n,

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.commons.runtime</artifactId>

View File

@@ -12,7 +12,7 @@
<parent>
<groupId>org.talend</groupId>
<artifactId>org.talend.tos</artifactId>
<version>7.3.1</version>
<version>7.3.2-SNAPSHOT</version>
<relativePath>../pom_server.xml</relativePath>
</parent>

View File

@@ -17,6 +17,7 @@ import java.io.InputStream;
import java.net.URL;
import org.apache.commons.lang.ArrayUtils;
import org.eclipse.core.net.proxy.IProxyService;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.preferences.InstanceScope;
@@ -24,6 +25,7 @@ import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.util.tracker.ServiceTracker;
import org.talend.commons.exception.ExceptionService;
import org.talend.commons.runtime.debug.TalendDebugHandler;
import org.talend.commons.utils.system.EclipseCommandLine;
@@ -55,6 +57,8 @@ public class CommonsPlugin implements BundleActivator {
// TESB-17856: For commandline builds ESB Micorservice bundle
private static boolean isESBMicorservice = false;
private static ServiceTracker proxyTracker;
public static boolean isWorkbenchCreated() {
return isWorkbenchCreated;
}
@@ -179,4 +183,13 @@ public class CommonsPlugin implements BundleActivator {
return FileLocator.toFileURL(entry);
}
public static IProxyService getProxyService() {
if (proxyTracker == null) {
proxyTracker = new ServiceTracker(Platform.getBundle(PLUGIN_ID).getBundleContext(), IProxyService.class.getName(),
null);
proxyTracker.open();
}
return (IProxyService) proxyTracker.getService();
}
}

View File

@@ -0,0 +1,58 @@
// ============================================================================
//
// Copyright (C) 2006-2020 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.exception;
public class ClientException extends PersistenceException {
private Integer httpCode;
public ClientException(String message) {
super(message);
}
public ClientException(Integer httpCode, String message) {
super(message);
this.httpCode = httpCode;
}
public ClientException(String message, Throwable cause) {
super(message, cause);
}
public ClientException(Integer httpCode, String message, Throwable cause) {
super(message, cause);
this.httpCode = httpCode;
}
public ClientException(Throwable cause) {
super(cause);
}
public ClientException(Integer httpCode, Throwable cause) {
super(cause);
this.httpCode = httpCode;
}
public Integer getHttpCode() {
return httpCode;
}
public void setHttpCode(Integer httpCode) {
this.httpCode = httpCode;
}
@Override
public String toString() {
return getLocalizedMessage();
}
}

View File

@@ -42,6 +42,8 @@ public interface ITaCoKitService {
boolean isNeedMigration(String componentName, Map<String, String> properties);
boolean isTaCoKitType(Object repoType);
public static ITaCoKitService getInstance() throws Exception {
BundleContext bc = FrameworkUtil.getBundle(ITaCoKitService.class).getBundleContext();
Collection<ServiceReference<ITaCoKitService>> tacokitServices = Collections.emptyList();

View File

@@ -0,0 +1,121 @@
// ============================================================================
//
// Copyright (C) 2006-2020 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.database;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
/**
* created by qiongli on 2013-11-13 Detailled comment
*
*/
public class Sybase16SADatabaseMetaData extends SybaseDatabaseMetaData {
private static Logger log = Logger.getLogger(Sybase16SADatabaseMetaData.class);
/**
* DOC qiongli SybaseIQDatabaseMetaData constructor comment.
*
* @param connection
* @throws SQLException
*/
public Sybase16SADatabaseMetaData(Connection connection) throws SQLException {
super(connection);
}
public ResultSet getCatalogs(String login, String database) throws SQLException {
List<String[]> list = new ArrayList<String[]>();
List<String> catList = new ArrayList<String>();
if (!StringUtils.isEmpty(database)) {
catList.add(database);
}
for (String catalogName : catList) {
String sql = createSqlByLoginAndCatalog(login, catalogName);
ResultSet rs = null;
Statement stmt = null;
try {
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
while (rs.next()) {
int temp = rs.getInt(1);
if (temp > 0) {
String[] r = new String[] { catalogName };
list.add(r);
}
}
} catch (SQLException e) {
log.error(e);
} finally {
try {
if (rs != null) {
rs.close();
}
if (stmt != null) {
stmt.close();
}
} catch (Exception e) {
log.error(e);
}
}
}
SybaseResultSet tableResultSet = new SybaseResultSet();
tableResultSet.setMetadata(new String[] { "TABLE_CAT" }); //$NON-NLS-1$
tableResultSet.setData(list);
return tableResultSet;
}
@Override
public ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern)
throws SQLException {
return super.getColumns(null, schemaPattern, tableNamePattern, columnNamePattern);
}
@Override
public ResultSet getPrimaryKeys(String catalog, String schema, String table) throws SQLException {
return super.getPrimaryKeys(null, schema, table);
}
@Override
public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types)
throws SQLException {
return super.getTables(null, schemaPattern, tableNamePattern, types);
}
/**
*
* get a sql query by login name and catalog name.
*
* @param loginName
* @param catalogName
* @return
*/
protected String createSqlByLoginAndCatalog(String loginName, String catalogName) {
String sql = "select count(*) from " + catalogName
+ ".dbo.sysusers where suid in (select suid from "+catalogName+".dbo.syslogins where name = '" + loginName
+ "')";
return sql;
}
}

View File

@@ -13,6 +13,8 @@
package org.talend.commons.utils.network;
import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.net.InetSocketAddress;
import java.net.PasswordAuthentication;
import java.net.Proxy;
@@ -35,8 +37,14 @@ import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Priority;
import org.eclipse.core.internal.net.ProxyManager;
import org.eclipse.core.net.proxy.IProxyService;
import org.talend.commons.CommonsPlugin;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.i18n.internal.Messages;
import org.talend.daikon.sandbox.properties.ClassLoaderIsolatedSystemProperties;
import sun.net.spi.DefaultProxySelector;
/**
* DOC cmeng class global comment. Detailled comment
@@ -51,9 +59,23 @@ public class TalendProxySelector extends ProxySelector {
private static final String PROP_ALLOW_PROXY_REDIRECT_EXCLUDE = "talend.studio.proxy.redirect.whiteList";
private static final String PROP_EXECUTE_CONNECTION_FAILED = "talend.studio.proxy.executeConnectionFailed";
private static final String PROP_UPDATE_SYSTEM_PROPERTIES_FOR_JRE = "talend.studio.proxy.jre.updateSystemProperties";
private static final String PROP_CHECK_PROXY = "talend.studio.proxy.checkProxy";
private static final String PROP_VALIDATE_URI = "talend.studio.proxy.validateUri";
private static final String PROP_PROXY_SELECTOR = "talend.studio.proxy.selector";
private static final String PROP_PROXY_SELECTOR_DEFAULT = "default";
private static final String PROP_PROXY_SELECTOR_JRE = "jre";
private static final String PROP_PROXY_HOST_MAP = "talend.studio.proxy.hostMap";
private static final String PROP_DISABLE_DEFAULT_SELECTOR = "talend.studio.proxy.disableDefaultSelector";
private static final String PROP_DISABLE_DEFAULT_SELECTOR_PROVIDER = "talend.studio.proxy.disableDefaultSelectorProvider";
/**
* Example: update.talend.com,socket:http,https:http;nexus.talend.com,socket,http;,socket:http
@@ -67,7 +89,20 @@ public class TalendProxySelector extends ProxySelector {
private static final String KEY_DEFAULT = ":default:";
private ProxySelector defaultSelector;
private static Field uriHostField;
private static Method proxyManagerUpdateSystemPropertiesFunc;
private static boolean checkProxy = Boolean.valueOf(System.getProperty(PROP_CHECK_PROXY, Boolean.TRUE.toString()));
/**
* Note: eclipse default selector may be different between TOS and TIS, TOS may use jre one, TIS may use egit one
*/
private ProxySelector eclipseDefaultSelector;
private ProxySelector jreDefaultSelector;
private EProxySelector eProxySelector;
final private Map<Object, Collection<IProxySelectorProvider>> selectorProviders;
@@ -83,15 +118,36 @@ public class TalendProxySelector extends ProxySelector {
private boolean allowProxyRedirect = false;
private boolean disableDefaultSelector = false;
private boolean disableDefaultSelectorProvider = false;
private TalendProxySelector(final ProxySelector defaultSelector) {
this.defaultSelector = defaultSelector;
private boolean validateUri = true;
private boolean executeConnectionFailed = true;
private boolean updateSystemPropertiesForJre = true;
private TalendProxySelector(final ProxySelector eclipseDefaultSelector) {
this.eclipseDefaultSelector = eclipseDefaultSelector;
this.jreDefaultSelector = new DefaultProxySelector();
selectorProviders = Collections.synchronizedMap(new HashMap<>());
allowProxyRedirect = Boolean.valueOf(System.getProperty(PROP_ALLOW_PROXY_REDIRECT, Boolean.FALSE.toString()));
disableDefaultSelector = Boolean.valueOf(System.getProperty(PROP_DISABLE_DEFAULT_SELECTOR, Boolean.FALSE.toString()));
disableDefaultSelectorProvider = Boolean
.valueOf(System.getProperty(PROP_DISABLE_DEFAULT_SELECTOR_PROVIDER, Boolean.FALSE.toString()));
printProxyLog = Boolean.valueOf(System.getProperty(PROP_PRINT_LOGS, Boolean.FALSE.toString()));
validateUri = Boolean.valueOf(System.getProperty(PROP_VALIDATE_URI, Boolean.TRUE.toString()));
executeConnectionFailed = Boolean.valueOf(System.getProperty(PROP_EXECUTE_CONNECTION_FAILED, Boolean.TRUE.toString()));
updateSystemPropertiesForJre = Boolean
.valueOf(System.getProperty(PROP_UPDATE_SYSTEM_PROPERTIES_FOR_JRE, Boolean.TRUE.toString()));
switch (System.getProperty(PROP_PROXY_SELECTOR, PROP_PROXY_SELECTOR_DEFAULT).toLowerCase()) {
case PROP_PROXY_SELECTOR_JRE:
this.eProxySelector = EProxySelector.jre;
break;
default:
this.eProxySelector = EProxySelector.eclipse_default;
break;
}
initHostMap();
initRedirectList();
@@ -176,6 +232,18 @@ public class TalendProxySelector extends ProxySelector {
synchronized (instanceLock) {
if (instance == null) {
instance = new TalendProxySelector(proxySelector);
try {
uriHostField = URI.class.getDeclaredField("host");
uriHostField.setAccessible(true);
} catch (Exception e) {
ExceptionHandler.process(e);
}
try {
proxyManagerUpdateSystemPropertiesFunc = ProxyManager.class.getDeclaredMethod("updateSystemProperties");
proxyManagerUpdateSystemPropertiesFunc.setAccessible(true);
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
}
}
@@ -188,34 +256,72 @@ public class TalendProxySelector extends ProxySelector {
return null;
}
});
if (instance.getDefaultProxySelector() == null
if (instance.getEclipseDefaultSelector() == null
|| (proxySelector != null && proxySelector.getClass().getName().endsWith(ECLIPSE_PROXY_SELECTOR))) {
instance.setDefaultProxySelector(proxySelector);
instance.setEclipseDefaultSelector(proxySelector);
}
}
return instance;
}
public static void checkProxy() {
if (!checkProxy) {
return;
}
try {
TalendProxySelector.getInstance();
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
@Override
public List<Proxy> select(final URI uri) {
if (printProxyLog) {
ExceptionHandler.log("TalendProxySelector.select " + uri);
}
if (uri == null) {
return Collections.EMPTY_LIST;
}
URI validatedUri = validateUri(uri);
Set<Proxy> results = new LinkedHashSet<>();
try {
final Set<Proxy> resultFromProviders = getProxysFromProviders(uri);
final Set<Proxy> resultFromProviders = getProxysFromProviders(validatedUri);
if (resultFromProviders != null && !resultFromProviders.isEmpty()) {
results.addAll(resultFromProviders);
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
if (printProxyLog) {
ExceptionHandler.log("TalendProxySelector.resultFromProviders " + results);
}
ProxySelector defaultProxySelector = getDefaultProxySelector();
if (printProxyLog) {
ExceptionHandler.log("TalendProxySelector.defaultProxySelector " + defaultProxySelector);
}
if (defaultProxySelector != null) {
URI newUri = getNewUri(uri);
List<Proxy> defaultProxys = defaultProxySelector.select(newUri);
/**
* don't validate uri here, so that we can know whether it is an issue uri
*/
URI newUri = getNewUri(validatedUri, false);
List<Proxy> defaultProxys = null;
if (validateUri && StringUtils.isBlank(newUri.getHost())) {
/**
* If host is blank, force to use jre proxy selector to avoid the eclipse proxy selector bug
*/
defaultProxys = getJreProxySelector().select(newUri);
} else {
defaultProxys = defaultProxySelector.select(newUri);
}
if (printProxyLog) {
ExceptionHandler.log("TalendProxySelector.defaultProxys " + defaultProxys);
}
try {
results.addAll(filterProxys(uri, defaultProxys));
results.addAll(filterProxys(validatedUri, defaultProxys));
} catch (Exception e) {
results.addAll(defaultProxys);
ExceptionHandler.process(e);
@@ -229,6 +335,54 @@ public class TalendProxySelector extends ProxySelector {
return new LinkedList<Proxy>(results);
}
private URI validateUri(URI uri) {
if (!validateUri) {
return uri;
}
URI validatedUri = null;
try {
/**
* DON'T use URI.create(), MUST use the conductor which requires authority
*/
validatedUri = new URI(uri.getScheme(), uri.getAuthority(), uri.getPath(), uri.getQuery(), uri.getFragment());
/**
* Validate the host, if the host is empty, it will cause the eclipse selector to return dirrect
*/
if (StringUtils.isBlank(validatedUri.getHost())) {
String authority = validatedUri.getAuthority();
if (StringUtils.isNotBlank(authority)) {
// example: https://u:p@www.company.com:8081/path/a?param=b
String host = null;
int userInfoIndex = authority.indexOf('@');
if (0 <= userInfoIndex) {
authority = authority.substring(userInfoIndex + 1);
}
int portIndex = authority.lastIndexOf(':');
if (0 <= portIndex) {
host = authority.substring(0, portIndex);
}
try {
uriHostField.set(validatedUri, host);
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
}
} catch (Exception e) {
ExceptionHandler.process(e);
if (validatedUri == null) {
validatedUri = uri;
}
}
if (printProxyLog) {
ExceptionHandler.log("After validate: " + uri + " -> " + validatedUri);
}
return validatedUri;
}
private List<Proxy> filterProxys(final URI uri, List<Proxy> defaultProxys) {
List<Proxy> result = new ArrayList<>();
if (defaultProxys != null && !defaultProxys.isEmpty()) {
@@ -264,38 +418,48 @@ public class TalendProxySelector extends ProxySelector {
return result;
}
private URI getNewUri(URI uri) {
private URI getNewUri(URI uri, boolean validateUri) {
URI newUri = uri;
if (newUri != null) {
String host = newUri.getHost();
Map<String, String> protocolMap = null;
if (StringUtils.isNotBlank(host)) {
protocolMap = hostMap.get(host.toLowerCase());
}
if (protocolMap == null) {
protocolMap = hostMap.get(KEY_DEFAULT);
}
try {
// get host before new URI, because the host may be set manually due to URI issue
String host = newUri.getHost();
newUri = new URI(newUri.getScheme(), newUri.getAuthority(), newUri.getPath(), newUri.getQuery(),
newUri.getFragment());
Map<String, String> protocolMap = null;
if (StringUtils.isNotBlank(host)) {
protocolMap = hostMap.get(host.toLowerCase());
}
if (protocolMap == null) {
protocolMap = hostMap.get(KEY_DEFAULT);
}
if (protocolMap != null) {
String schema = newUri.getScheme();
if (schema != null) {
String lowercasedProtocol = schema.toLowerCase();
String preferedProtocol = protocolMap.get(lowercasedProtocol);
if (StringUtils.isNotBlank(preferedProtocol)) {
try {
newUri = new URI(preferedProtocol, newUri.getUserInfo(), newUri.getHost(), newUri.getPort(),
newUri.getPath(), newUri.getQuery(), newUri.getFragment());
} catch (URISyntaxException e) {
if (printProxyLog) {
ExceptionHandler.process(new Exception(
Messages.getString("TalendProxySelector.exception.proxySelectionError", newUri), e),
Priority.WARN);
}
if (protocolMap != null) {
String schema = newUri.getScheme();
if (schema != null) {
String lowercasedProtocol = schema.toLowerCase();
String preferedProtocol = protocolMap.get(lowercasedProtocol);
if (StringUtils.isNotBlank(preferedProtocol)) {
/**
* Note: MUST use the constructor which requires authority, because some uri may be illegal,
* then host info will be stored in authority field instead of host filed
*/
newUri = new URI(preferedProtocol, newUri.getAuthority(), newUri.getPath(), newUri.getQuery(),
newUri.getFragment());
}
}
}
} catch (URISyntaxException e) {
if (printProxyLog) {
ExceptionHandler.process(
new Exception(Messages.getString("TalendProxySelector.exception.proxySelectionError", uri), e),
Priority.WARN);
}
}
}
if (validateUri) {
newUri = validateUri(newUri);
}
return newUri;
}
@@ -395,11 +559,45 @@ public class TalendProxySelector extends ProxySelector {
}
public ProxySelector getDefaultProxySelector() {
return defaultSelector;
switch (eProxySelector) {
case jre:
return getJreProxySelector();
default:
return eclipseDefaultSelector;
}
}
public void setDefaultProxySelector(final ProxySelector selector) {
defaultSelector = selector;
private ProxySelector getJreProxySelector() {
try {
/**
* for tcompv0, daikon may create an isolated system properties for it, so proxies may be ignored in the new
* system properties; here we try to call the method to add proxies into the isolated system properties
*/
if (updateSystemPropertiesForJre && ClassLoaderIsolatedSystemProperties.getInstance()
.isIsolated(Thread.currentThread().getContextClassLoader())) {
if (printProxyLog) {
ExceptionHandler.log("Before update jre proxy system properties for the isolated classloader, http.proxyHost="
+ System.getProperty("http.proxyHost"));
}
IProxyService proxyService = CommonsPlugin.getProxyService();
proxyManagerUpdateSystemPropertiesFunc.invoke(proxyService);
if (printProxyLog) {
ExceptionHandler.log("After updated jre proxy system properties for the isolated classloader, http.proxyHost="
+ System.getProperty("http.proxyHost"));
}
}
} catch (Throwable e) {
ExceptionHandler.process(e);
}
return this.jreDefaultSelector;
}
public ProxySelector getEclipseDefaultSelector() {
return eclipseDefaultSelector;
}
public void setEclipseDefaultSelector(ProxySelector eclipseDefaultSelector) {
this.eclipseDefaultSelector = eclipseDefaultSelector;
}
@Override
@@ -413,21 +611,26 @@ public class TalendProxySelector extends ProxySelector {
});
}
ProxySelector defaultProxySelector = getDefaultProxySelector();
if (defaultProxySelector != null) {
defaultProxySelector.connectFailed(uri, sa, ioe);
if (executeConnectionFailed) {
/**
* Just try to make the behavior of jre proxy selector same like eclipse proxy selector
*/
ProxySelector defaultProxySelector = getDefaultProxySelector();
if (defaultProxySelector != null) {
defaultProxySelector.connectFailed(uri, sa, ioe);
}
}
}
public IProxySelectorProvider createDefaultProxySelectorProvider() {
if (disableDefaultSelector) {
if (disableDefaultSelectorProvider) {
return null;
}
return new DefaultProxySelectorProvider(Thread.currentThread());
}
public IProxySelectorProvider createDefaultProxySelectorProvider(String host) {
if (disableDefaultSelector) {
if (disableDefaultSelectorProvider) {
return null;
}
return new DefaultProxySelectorProvider(host);
@@ -445,6 +648,11 @@ public class TalendProxySelector extends ProxySelector {
return possibleKeys;
}
private enum EProxySelector {
eclipse_default,
jre
}
private class DefaultProxySelectorProvider extends AbstractProxySelectorProvider {
private Thread currentThread = null;
@@ -475,7 +683,7 @@ public class TalendProxySelector extends ProxySelector {
@Override
public boolean canHandle(URI uri) {
if (disableDefaultSelector) {
if (disableDefaultSelectorProvider) {
return false;
}
if (currentThread != null && Thread.currentThread() == currentThread) {

View File

@@ -58,6 +58,8 @@ public class UpdatesHelper {
public static final String COMPONENT_SUFFIX = "_java.xml";
public static final String COMPONENT_TEMPLATES = "templates";
public static final String NEW_COMPONENT_PREFIX = "installer$$";
public static boolean existArtifacts(File base) {
@@ -296,6 +298,9 @@ public class UpdatesHelper {
public static boolean isOldComponent(File f) {
if (f != null && f.exists() && f.isDirectory()) {
if (f.getName().equals(COMPONENT_TEMPLATES)) {
return true;
}
File[] listFiles = f.listFiles();
if (listFiles != null) {
for (File subFile : listFiles) {

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.commons.ui</artifactId>

View File

@@ -104,7 +104,6 @@ public class TableToTreeLinker<D1, D2> extends BgDrawableComposite implements IB
this.source = sourceTable;
dataToTableItemCache = new DataToTableItemCache(sourceTable);
}
protected IStyleLink getDefaultStyleLink() {
@@ -232,7 +231,7 @@ public class TableToTreeLinker<D1, D2> extends BgDrawableComposite implements IB
int yStraight = sourceToCommonPoint.y + treeItemHeight / 2 + tableItemBounds.y;
pointEndStraight.x = sourceToCommonPoint.x + xStartBezierLink;
if (Platform.OS_MACOSX.equals(Platform.getOS())) {
if (Platform.OS_MACOSX.equals(Platform.getOS()) || Platform.OS_LINUX.equals(Platform.getOS())) {
pointStartStraight.x = sourceToCommonPoint.x + tableItem.getParent().getBounds().width;
pointEndStraight.x = pointStartStraight.x;
} else {
@@ -311,10 +310,10 @@ public class TableToTreeLinker<D1, D2> extends BgDrawableComposite implements IB
// Added by Marvin Wang on Nov. 28, 2012 for bug TDI-23378. This is not the best way to fix this issue,
// but till now I have not found the root cause.
if (Platform.OS_LINUX.equals(Platform.getOS())) {
pointEndCentralCurve.y = pointEndCentralCurve.y - tableItem.getBounds().height;
pointEndCentralCurve.y = pointEndCentralCurve.y - tableItem.getBounds().height - treeItemHeight / 2;
}
if (Platform.OS_MACOSX.equals(Platform.getOS())) {
pointEndCentralCurve.y = pointEndCentralCurve.y + tableItem.getBounds(0).height;
pointEndCentralCurve.y = pointEndCentralCurve.y - tableItem.getBounds().height;
}
drawableLink.setPoint1(pointEndStraight);
drawableLink.setPoint2(pointEndCentralCurve);

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.core.repository</artifactId>

View File

@@ -70,6 +70,7 @@ import org.talend.commons.runtime.service.ITaCoKitService;
import org.talend.commons.ui.gmf.util.DisplayUtils;
import org.talend.commons.ui.runtime.exception.MessageBoxExceptionHandler;
import org.talend.commons.utils.data.container.RootContainer;
import org.talend.commons.utils.network.TalendProxySelector;
import org.talend.commons.utils.time.TimeMeasure;
import org.talend.commons.utils.workbench.resources.ResourceUtils;
import org.talend.core.AbstractDQModelService;
@@ -872,6 +873,9 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
}
this.repositoryFactoryFromProvider.deleteObjectPhysical(project, object, version, fromEmptyRecycleBin);
if (isFullLogonFinished()) {
fireRepositoryPropertyChange(ERepositoryActionName.AFTER_DELETE.getName(), null, object);
}
// i18n
// log.info("Physical deletion [" + objToDelete + "] by " + getRepositoryContext().getUser() + ".");
String str[] = new String[] { object.toString(), getRepositoryContext().getUser().toString() };
@@ -2034,6 +2038,11 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
TimeMeasure.begin("logOnProject"); //$NON-NLS-1$
try {
/**
* init/check proxy selector, in case default proxy selector is not registed yet
*/
TalendProxySelector.checkProxy();
System.getProperties().put("ReadOnlyUser", Boolean.FALSE.toString()); //$NON-NLS-1$
// remove the auto-build to enhance the build speed and application's use
@@ -2409,9 +2418,14 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
@Override
@SuppressWarnings("unchecked")
public void executeRepositoryWorkUnit(RepositoryWorkUnit workUnit) {
checkProxySettings();
this.repositoryFactoryFromProvider.executeRepositoryWorkUnit(workUnit);
}
private void checkProxySettings() {
TalendProxySelector.checkProxy();
}
@Override
public void unloadResources(Property property) throws PersistenceException {
repositoryFactoryFromProvider.unloadResources(property);

View File

@@ -12,10 +12,14 @@
// ============================================================================
package org.talend.core.repository.model.dnd;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.model.components.IComponent;
import org.talend.core.model.components.IComponentsService;
import org.talend.core.model.properties.ConnectionItem;
import org.talend.core.model.properties.Item;
import org.talend.core.model.properties.SalesforceSchemaConnectionItem;
import org.talend.core.model.repository.ERepositoryObjectType;
@@ -28,6 +32,8 @@ import org.talend.repository.model.RepositoryNode;
*/
public class SalesforceComponentDndFilter extends DefaultRepositoryComponentDndFilter {
public static final String SALSEFORCE = "salesforce"; //$NON-NLS-1$
public static final String COMPONENT_T_SALSEFORCE_CONNECTION = "tSalesforceConnection"; //$NON-NLS-1$
public static final String COMPONENT_T_SALSEFORCE_WAVE_BULK_EXEC = "tSalesforceWaveBulkExec"; //$NON-NLS-1$
@@ -98,7 +104,16 @@ public class SalesforceComponentDndFilter extends DefaultRepositoryComponentDndF
}
}
}
}
if (item instanceof ConnectionItem && SALSEFORCE.equalsIgnoreCase(((ConnectionItem) item).getTypeName())) {
// Special for Javajet components: tSalesforceEinsteinBulkExec/tSalesforceEinsteinOutputBulkExec
IComponentsService service = GlobalServiceRegister.getDefault().getService(IComponentsService.class);
Collection<IComponent> componentAll = service.getComponentsFactory().readComponents();
for (IComponent component : componentAll) {
if (component.getName().startsWith("tSalesforceEinstein") && !components.contains(component)) { //$NON-NLS-1$
components.add(component);
}
}
}
return components;
}

View File

@@ -13,6 +13,8 @@
package org.talend.core.repository.ui.dialog;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -30,12 +32,14 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.talend.commons.exception.PersistenceException;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.model.properties.Item;
import org.talend.core.model.properties.ProcessItem;
import org.talend.core.model.properties.Property;
import org.talend.core.model.repository.IRepositoryObject;
import org.talend.core.model.repository.IRepositoryViewObject;
import org.talend.core.repository.utils.RepositoryNodeSortUtil;
import org.talend.core.ui.ITestContainerProviderService;
import org.talend.repository.model.RepositoryNode;
import org.talend.repository.model.IRepositoryNode.EProperties;
@@ -107,7 +111,8 @@ public class PastSelectorDialog extends Dialog {
modificationTime.setWidth(200);
modificationTime.setText("Modification Time");
for (IRepositoryViewObject object : versions) {
RepositoryNodeSortUtil util = new RepositoryNodeSortUtil();
for (IRepositoryViewObject object : util.getSortVersion(versions)) {
TableItem item = new TableItem(table, SWT.NONE);
item.setData(object);
item.setText(0, object.getVersion());
@@ -187,7 +192,7 @@ public class PastSelectorDialog extends Dialog {
});
return composite;
}
public Set<IRepositoryViewObject> getSelectedVersionItems() {
return this.selectedVersionItems;
}

View File

@@ -0,0 +1,47 @@
// ============================================================================
//
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.core.repository.utils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import org.talend.commons.utils.Version;
import org.talend.core.model.repository.IRepositoryViewObject;
/**
* @author hwang
*
*/
public class RepositoryNodeSortUtil {
public List<IRepositoryViewObject> getSortVersion(List<IRepositoryViewObject> versions) {
List<IRepositoryViewObject> temp = new ArrayList<IRepositoryViewObject>();
temp.addAll(versions);
Collections.sort(temp, new Comparator<IRepositoryViewObject>() {
@Override
public int compare(IRepositoryViewObject o1, IRepositoryViewObject o2) {
String version1 = o1.getVersion();
String version2 = o2.getVersion();
if(version1 != null && version2 != null) {
return new Version(version1).compareTo(new Version(version2));
}
return 0;
}
});
return temp;
}
}

View File

@@ -28,6 +28,7 @@ Export-Package: org.talend.commons.utils.generation,
org.talend.core.model.business,
org.talend.core.model.components,
org.talend.core.model.context,
org.talend.core.model.context.link,
org.talend.core.model.general,
org.talend.core.model.genhtml,
org.talend.core.model.metadata,

View File

@@ -19,6 +19,7 @@
<extension-point id="hadoopConnectionCreator" name="Hadoop Connection Creator" schema="schema/hadoopConnectionCreator.exsd"/>
<extension-point id="artifact_handler" name="Artifact Repository Handler" schema="schema/artifact_handler.exsd"/>
<extension-point id="actionFilterDelegate" name="Action Filter delegate" schema="schema/actionFilterDelegate.exsd"/>
<extension-point id="saveItemContextLinkService" name="Save Item Context Link Service" schema="schema/saveItemContextLinkService.exsd"/>
<extension
point="org.talend.core.runtime.repositoryComponent_provider">
@@ -53,4 +54,16 @@
name="Talend">
</category>
</extension>
<extension
point="org.talend.core.runtime.service">
<Service
class="org.talend.core.model.update.RepositoryContextUpdateService"
serviceId="IRepositoryContextUpdateService">
</Service>
<Service
class="org.talend.core.model.update.GenericDbContextUpdateService"
serviceId="IRepositoryContextUpdateService">
</Service>
</extension>
</plugin>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1</version>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.core.runtime</artifactId>

View File

@@ -0,0 +1,105 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.talend.core.runtime" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
<meta.schema plugin="org.talend.core.runtime" id="saveItemContextLinkService" name="Save Item Context Link Service"/>
</appinfo>
<documentation>
Save the context link data for item which contain ContextType object
The extension point must implements interface : org.talend.core.model.context.link.IItemContextLinkService
</documentation>
</annotation>
<element name="extension">
<annotation>
<appinfo>
<meta.element />
</appinfo>
</annotation>
<complexType>
<sequence minOccurs="1" maxOccurs="unbounded">
<element ref="creator" minOccurs="1" maxOccurs="unbounded"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="creator">
<complexType>
<attribute name="class" type="string" use="required">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute kind="java" basedOn=":org.talend.core.model.context.link.IItemContextLinkService"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appinfo>
<meta.section type="since"/>
</appinfo>
<documentation>
7.4.1
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="examples"/>
</appinfo>
<documentation>
[Enter extension point usage example here.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="apiinfo"/>
</appinfo>
<documentation>
boolean accept(Item item);
boolean saveItemLink(Item item);
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="implementation"/>
</appinfo>
<documentation>
[Enter information about supplied implementation of this extension point.]
</documentation>
</annotation>
</schema>

View File

@@ -254,6 +254,34 @@ public final class ResourceUtils {
}
}
/**
* Comment method "setFileContent".
*
* @param stream
* @param file
* @throws PersistenceException
*/
public static void setFileContent(InputStream stream, IFile file) throws PersistenceException {
try {
if (stream == null) {
String msg = Messages.getString("resources.file.notCreated", file.getName(), //$NON-NLS-1$
Messages.getString("ResourceUtils.streamNull")); //$NON-NLS-1$
throw new PersistenceException(msg);
}
file.setContents(stream, true, false, null);
} catch (CoreException e) {
String msg = Messages.getString("resources.file.notCreated", file.getName(), e.getMessage()); //$NON-NLS-1$
throw new PersistenceException(msg, e);
} finally {
try {
if (stream != null) {
stream.close();
}
} catch (IOException e) {
CommonExceptionHandler.process(e);
}
}
}
/**
* Convenience method to delete a file.<br/>
*

View File

@@ -12,35 +12,49 @@
// ============================================================================
package org.talend.core;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.talend.core.hadoop.repository.HadoopRepositoryUtil;
import org.talend.core.model.metadata.builder.connection.Connection;
import org.talend.core.runtime.services.IGenericDBService;
/**
* created by ldong on Mar 23, 2015 Detailled comment
*
*/
public class AbstractRepositoryContextUpdateService implements IRepositoryContextUpdateService {
@Override
public void updateRelatedContextVariable(Connection con, String oldValue, String newValue) {
}
public abstract class AbstractRepositoryContextUpdateService implements IRepositoryContextUpdateService {
protected IGenericDBService service = GlobalServiceRegister.getDefault().getService(IGenericDBService.class);
protected String updateHadoopProperties(List<Map<String, Object>> hadoopProperties, String oldValue, String newValue) {
String finalProperties = "";
String finalProperties = null;
boolean isModified = false;
if (!hadoopProperties.isEmpty()) {
for (Map<String, Object> propertyMap : hadoopProperties) {
String propertyValue = (String) propertyMap.get("VALUE");
if (propertyValue.equals(oldValue)) {
propertyMap.put("VALUE", newValue);
isModified = true;
}
}
finalProperties = HadoopRepositoryUtil.getHadoopPropertiesJsonStr(hadoopProperties);
if (isModified) {
finalProperties = HadoopRepositoryUtil.getHadoopPropertiesJsonStr(hadoopProperties);
}
}
return finalProperties;
}
protected boolean updateCompPropertiesContextParameter(Connection conn, String oldValue, String newValue) {
boolean isModified = false;
Map<String, String> oldToNewHM = new HashMap<String, String>();
oldToNewHM.put(oldValue, newValue);
String compProperties = conn.getCompProperties();
if (service != null && StringUtils.isNotBlank(compProperties)) {
service.updateCompPropertiesForContextMode(conn, oldToNewHM);
isModified = true;
}
return isModified;
}
}

View File

@@ -12,7 +12,9 @@
// ============================================================================
package org.talend.core;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.CoreException;
@@ -247,4 +249,29 @@ public class GlobalServiceRegister {
}
return null;
}
public List findAllService(Class klass) {
List serviceList = new ArrayList();
String key = klass.getName();
IConfigurationElement[] configElements = getConfigurationElements();
if (configElements != null) {
for (IConfigurationElement element : configElements) {
if (element.isValid()) {
String id = element.getAttribute("serviceId"); //$NON-NLS-1$
if (!key.endsWith(id)) {
continue;
}
try {
Object service = element.createExecutableExtension("class"); //$NON-NLS-1$
if (klass.isInstance(service)) {
serviceList.add(service);
};
} catch (CoreException e) {
ExceptionHandler.process(e);
}
}
}
}
return serviceList;
}
}

View File

@@ -20,5 +20,7 @@ import org.talend.core.model.metadata.builder.connection.Connection;
*/
public interface IRepositoryContextUpdateService extends IService {
public void updateRelatedContextVariable(Connection con, String oldValue, String newValue);
public boolean accept(Connection connection);
public boolean updateContextParameter(Connection conn, String oldValue, String newValue);
}

View File

@@ -53,6 +53,8 @@ public enum EDatabaseTypeName {
"IBM DB2 ZOS", "IBM DB2 ZOS", Boolean.TRUE, "IBM_DB2", "DB2", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
SYBASEASE(
"SybaseASE", "Sybase (ASE and IQ)", Boolean.TRUE, "SYBASE", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
SYBASEASE_SA(
"SybaseASE", "SQL Anywhere", Boolean.TRUE, "SYBASE", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
// this Sybase IQ not used.
SYBASEIQ(

View File

@@ -166,9 +166,9 @@ public enum EDatabaseVersion4Drivers {
REDSHIFT(new DbVersion4Drivers(EDatabaseTypeName.REDSHIFT, "redshift", "REDSHIFT", //$NON-NLS-1$ //$NON-NLS-2$
"redshift-jdbc42-no-awssdk-1.2.37.1061.jar")), //$NON-NLS-1$
REDSHIFT_SSO(new DbVersion4Drivers(EDatabaseTypeName.REDSHIFT_SSO, "redshift sso", "REDSHIFT_SSO", //$NON-NLS-1$ //$NON-NLS-2$
new String[] { "redshift-jdbc42-no-awssdk-1.2.37.1061.jar", "aws-java-sdk-1.11.406.jar", "jackson-core-2.9.9.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"jackson-databind-2.9.9.jar", "jackson-annotations-2.9.0.jar", "httpcore-4.4.9.jar", "httpclient-4.5.5.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$//$NON-NLS-4$
"joda-time-2.8.1.jar", "commons-logging-1.1.3.jar", "commons-codec-1.6.jar" })), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new String[] { "redshift-jdbc42-no-awssdk-1.2.37.1061.jar", "aws-java-sdk-1.11.729.jar", "jackson-core-2.10.1.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"jackson-databind-2.10.1.jar", "jackson-annotations-2.10.1.jar", "httpcore-4.4.11.jar", "httpclient-4.5.9.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$//$NON-NLS-4$
"joda-time-2.8.1.jar", "commons-logging-1.2.jar", "commons-codec-1.11.jar" })), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
AMAZON_AURORA(new DbVersion4Drivers(EDatabaseTypeName.AMAZON_AURORA, "mysql-connector-java-5.1.30-bin.jar")); //$NON-NLS-1$

View File

@@ -23,6 +23,8 @@ public interface IMultipleComponentConnection {
public String getConnectionType();
public String getConnectorName();
public void setConnectionType(String connectionType);
public String getNameTarget();

View File

@@ -14,6 +14,8 @@ package org.talend.core.model.components;
import java.util.List;
import org.talend.core.model.process.INode;
/**
* DOC nrousseau class global comment. Detailled comment <br/>
*
@@ -33,4 +35,7 @@ public interface IMultipleComponentItem {
public String getComponent();
public void setComponent(String component);
public void updateNode(INode newNode, INode oldNode);
}

View File

@@ -50,4 +50,6 @@ public interface IMultipleComponentManager {
public boolean isLookupMode();
public String getParamSeperator();
}

View File

@@ -21,8 +21,11 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.common.util.EList;
import org.eclipse.jdt.core.JavaConventions;
import org.eclipse.jdt.core.JavaCore;
import org.talend.commons.exception.ExceptionHandler;
@@ -30,6 +33,9 @@ import org.talend.commons.exception.PersistenceException;
import org.talend.commons.utils.platform.PluginChecker;
import org.talend.core.language.ECodeLanguage;
import org.talend.core.language.LanguageManager;
import org.talend.core.model.context.link.ContextLinkService;
import org.talend.core.model.context.link.ContextParamLink;
import org.talend.core.model.context.link.ItemContextLink;
import org.talend.core.model.metadata.MetadataTalendType;
import org.talend.core.model.metadata.MetadataToolHelper;
import org.talend.core.model.metadata.types.ContextParameterJavaTypeManager;
@@ -43,6 +49,7 @@ import org.talend.core.model.properties.JobletProcessItem;
import org.talend.core.model.properties.ProcessItem;
import org.talend.core.model.repository.IRepositoryViewObject;
import org.talend.core.runtime.CoreRuntimePlugin;
import org.talend.cwm.helper.ResourceHelper;
import org.talend.designer.core.model.utils.emf.talendfile.ContextParameterType;
import org.talend.designer.core.model.utils.emf.talendfile.ContextType;
import org.talend.designer.core.model.utils.emf.talendfile.ProcessType;
@@ -53,6 +60,8 @@ import org.talend.repository.model.IProxyRepositoryFactory;
*/
public class ContextUtils {
private static final Logger LOGGER = Logger.getLogger(ContextUtils.class);
private static final Set<String> JAVA_KEYWORDS = new HashSet<String>(Arrays.asList("abstract", "continue", "for", "new", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
"switch", "assert", "default", "goto", "package", "synchronized", "boolean", "do", "if", "private", "this", "break", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$
"double", "implements", "protected", "throw", "byte", "else", "import", "public", "throws", "case", "enum", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$
@@ -82,15 +91,25 @@ public class ContextUtils {
* update the JobContextParameter form repository ContextItem by context name.
*
*/
public static boolean updateParameterFromRepository(ContextItem sourceItem, IContextParameter contextParam, String contextName) {
public static boolean updateParameterFromRepository(Item sourceItem, IContextParameter contextParam, String contextName) {
return updateParameterFromRepository(sourceItem, contextParam, contextName, null);
}
public static boolean updateParameterFromRepository(Item sourceItem, IContextParameter contextParam, String contextName,
Map<String, String> renameMap) {
if (sourceItem == null || contextParam == null) {
return false;
}
// not found, use default.
ContextType contextType = getContextTypeByName(sourceItem, contextName, true);
ContextType contextType = getContextTypeByName(sourceItem, contextName);
if (contextType != null) {
ContextParameterType parameterType = getContextParameterTypeByName(contextType, contextParam.getName());
String paramName = contextParam.getName();
String newName = ContextUtils.getNewNameFromRenameMap(renameMap, paramName);
if (newName != null) {
paramName = newName;
}
ContextParameterType parameterType = getContextParameterTypeByName(contextType, paramName);
// found parameter, update it.
if (parameterType != null) {
contextParam.setComment(parameterType.getComment());
@@ -98,6 +117,9 @@ public class ContextUtils {
contextParam.setPromptNeeded(parameterType.isPromptNeeded());
contextParam.setType(parameterType.getType());
contextParam.setValue(parameterType.getRawValue());
if (!StringUtils.equals(contextParam.getName(), parameterType.getName())) {
contextParam.setName(parameterType.getName());
}
return true;
}
}
@@ -178,6 +200,28 @@ public class ContextUtils {
return parameterType;
}
public static ContextParameterType getContextParameterTypeById(ContextType contextType, final String uuId,
boolean isFromContextItem) {
if (contextType == null || uuId == null) {
return null;
}
ContextParameterType parameterType = null;
for (ContextParameterType param : (List<ContextParameterType>) contextType.getContextParameter()) {
String paramId = null;
if (isFromContextItem) {
paramId = ResourceHelper.getUUID(param);
} else {
paramId = param.getInternalId();
}
if (uuId.equals(paramId)) {
parameterType = param;
break;
}
}
return parameterType;
}
@SuppressWarnings("unchecked")
private static boolean checkObject(Object obj) {
if (obj == null) {
@@ -372,6 +416,7 @@ public class ContextUtils {
targetParam.setValue(sourceParam.getValue());
targetParam.setPromptNeeded(sourceParam.isPromptNeeded());
targetParam.setComment(sourceParam.getComment());
targetParam.setInternalId(sourceParam.getInternalId());
}
/**
@@ -411,7 +456,7 @@ public class ContextUtils {
targetParam.setValue(sourceParam.getRawValue());
targetParam.setPromptNeeded(sourceParam.isPromptNeeded());
targetParam.setComment(sourceParam.getComment());
targetParam.setInternalId(sourceParam.getInternalId());
}
public static Map<String, Item> getRepositoryContextItemIdMapping() {
@@ -538,8 +583,8 @@ public class ContextUtils {
}
// preference name must match TalendDesignerPrefConstants.PROPAGATE_CONTEXT_VARIABLE
return Boolean.parseBoolean(CoreRuntimePlugin.getInstance().getDesignerCoreService()
.getPreferenceStore("propagateContextVariable")); //$NON-NLS-1$
return Boolean.parseBoolean(
CoreRuntimePlugin.getInstance().getDesignerCoreService().getPreferenceStore("propagateContextVariable")); //$NON-NLS-1$
}
/**
@@ -573,17 +618,17 @@ public class ContextUtils {
boolean modified = false;
for (String varName : set) {
ContextParameterType contextParameterType = ContextUtils.getContextParameterTypeByName(
contextType, varName);
IContextParameter contextParameter = processJobManager.getDefaultContext().getContextParameter(
varName);
ContextParameterType contextParameterType = ContextUtils
.getContextParameterTypeByName(contextType, varName);
IContextParameter contextParameter = processJobManager.getDefaultContext()
.getContextParameter(varName);
if (contextParameter == null) { // added
addContextParameterType(processJobManager, contextItem, contextParameterType);
modified = true;
}
}
if (modified) {
processJobManager.saveToEmf(processType.getContext());
processJobManager.saveToEmf(processType.getContext(), true);
added = true;
}
}
@@ -672,8 +717,328 @@ public class ContextUtils {
contextParam.setPromptNeeded(contextParamType.isPromptNeeded());
contextParam.setComment(contextParamType.getComment());
contextParam.setInternalId(contextParamType.getInternalId());
contextParam.setSource(contextItem.getProperty().getId());
return contextParam;
}
/**
* Get the context type from item (ContextItem/JobletProcessItem/ProcessItem), If the name is null will use default
* context
*
* @param item
* @param contextName
* @return
*/
public static ContextType getContextTypeByName(Item item, String contextName) {
if (item instanceof ContextItem) {
ContextItem contextItem = (ContextItem) item;
if (contextName == null) {
contextName = contextItem.getDefaultContext();
}
return ContextUtils.getContextTypeByName(contextItem, contextName, true);
} else if (item instanceof JobletProcessItem) {
JobletProcessItem jobletProcessItem = (JobletProcessItem) item;
return ContextUtils.getContextTypeByName((List<ContextType>) jobletProcessItem.getJobletProcess().getContext(),
contextName, jobletProcessItem.getJobletProcess().getDefaultContext());
} else if (item instanceof ProcessItem) {
ProcessItem processItem = (ProcessItem) item;
return ContextUtils.getContextTypeByName((List<ContextType>) processItem.getProcess().getContext(), contextName,
processItem.getProcess().getDefaultContext());
}
return null;
}
public static String getDefaultContextName(Item item) {
if (item instanceof ContextItem) {
ContextItem contextItem = (ContextItem) item;
return contextItem.getDefaultContext();
} else if (item instanceof JobletProcessItem) {
JobletProcessItem jobletProcessItem = (JobletProcessItem) item;
return jobletProcessItem.getJobletProcess().getDefaultContext();
} else if (item instanceof ProcessItem) {
ProcessItem processItem = (ProcessItem) item;
return processItem.getProcess().getDefaultContext();
}
return null;
}
public static EList getAllContextType(Item item) {
if (item instanceof ContextItem) {
ContextItem contextItem = (ContextItem) item;
return contextItem.getContext();
} else if (item instanceof JobletProcessItem) {
JobletProcessItem jobletProcessItem = (JobletProcessItem) item;
return jobletProcessItem.getJobletProcess().getContext();
} else if (item instanceof ProcessItem) {
ProcessItem processItem = (ProcessItem) item;
return processItem.getProcess().getContext();
}
return null;
}
public static Map<String, String> getContextParamterRenamedMap(Item item) {
ItemContextLink itemContextLink = null;
try {
itemContextLink = ContextLinkService.getInstance().loadContextLinkFromJson(item);
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
if (itemContextLink != null) {
if (item instanceof ConnectionItem) {
return compareConnectionContextParamName((ConnectionItem) item, itemContextLink);
} else {
return compareContextParamName(item, itemContextLink);
}
}
return Collections.EMPTY_MAP;
}
private static Map<String, String> compareContextParamName(Item processItem, ItemContextLink itemContextLink) {
List<ContextType> contextTypeList = getAllContextType(processItem);
return compareContextParamName(contextTypeList, itemContextLink);
}
public static Map<String, String> compareContextParamName(List<ContextType> contextTypeList,
ItemContextLink itemContextLink) {
Map<String, String> renamedMap = new HashMap<String, String>();
Map<String, Item> tempItemMap = new HashMap<String, Item>();
for (ContextType contextType : contextTypeList) {
for (Object obj : contextType.getContextParameter()) {
if (obj instanceof ContextParameterType) {
ContextParameterType contextParameterType = (ContextParameterType) obj;
ContextParamLink paramLink = itemContextLink.findContextParamLinkByName(
contextParameterType.getRepositoryContextId(), contextType.getName(), contextParameterType.getName());
if (paramLink != null) {
Item item = tempItemMap.get(contextParameterType.getRepositoryContextId());
if (item == null) {
item = ContextUtils.getRepositoryContextItemById(contextParameterType.getRepositoryContextId());
tempItemMap.put(contextParameterType.getRepositoryContextId(), item);
}
if (item != null) {
final ContextType repoContextType = ContextUtils.getContextTypeByName(item, contextType.getName());
ContextParameterType repoContextParam = ContextUtils.getContextParameterTypeById(repoContextType,
paramLink.getId(), item instanceof ContextItem);
if (repoContextParam != null
&& !StringUtils.equals(repoContextParam.getName(), contextParameterType.getName())) {
renamedMap.put(repoContextParam.getName(), contextParameterType.getName());
}
}
}
}
}
}
return renamedMap;
}
private static Map<String, String> compareConnectionContextParamName(ConnectionItem connectionItem,
ItemContextLink itemContextLink) {
Map<String, String> renamedMap = new HashMap<String, String>();
if (connectionItem.getConnection().isContextMode()) {
ContextItem contextItem = ContextUtils.getContextItemById2(connectionItem.getConnection().getContextId());
if (contextItem != null) {
ContextType contextType = ContextUtils.getContextTypeByName(contextItem,
connectionItem.getConnection().getContextName(), false);
if (contextType != null) {
for (Object obj : contextType.getContextParameter()) {
if (obj instanceof ContextParameterType) {
ContextParameterType paramType = (ContextParameterType) obj;
ContextParamLink paramLink = itemContextLink.findContextParamLinkById(
connectionItem.getConnection().getContextId(),
connectionItem.getConnection().getContextName(), ResourceHelper.getUUID(paramType));
if (paramLink != null && !StringUtils.equals(paramType.getName(), paramLink.getName())) {
renamedMap.put(paramType.getName(), paramLink.getName());
}
}
}
}
}
}
return renamedMap;
}
/**
*
* @param itemId
* @param contextType
* @return rename map. Key is new name and value is old name.
*/
public static Map<String, String> calculateRenamedMapFromLinkFile(String projectLabel, String itemId, IContext context,
Item repoContextItem) {
Map<String, String> renamedMap = new HashMap<String, String>();
Map<String, Item> idToItemMap = new HashMap<String, Item>();
if (repoContextItem != null) {
idToItemMap.put(repoContextItem.getProperty().getId(), repoContextItem);
}
try {
ItemContextLink itemContextLink = ContextLinkService.getInstance().doLoadContextLinkFromJson(projectLabel, itemId);
if (itemContextLink != null) {
for (Object obj : context.getContextParameterList()) {
if (obj instanceof IContextParameter) {
IContextParameter parameterType = (IContextParameter) obj;
ContextParamLink parameterLink = itemContextLink.findContextParamLinkByName(parameterType.getSource(),
context.getName(), parameterType.getName());
if (parameterLink != null) {
Item item = idToItemMap.get(parameterType.getSource());
if (item == null) {
item = getRepositoryContextItemById(parameterType.getSource());
idToItemMap.put(parameterType.getSource(), item);
}
if (item != null) {
ContextType contextType = ContextUtils.getContextTypeByName(item, context.getName());
ContextParameterType repoParameterType = ContextUtils.getContextParameterTypeById(contextType,
parameterLink.getId(), item instanceof ContextItem);
if (repoParameterType != null
&& !StringUtils.equals(repoParameterType.getName(), parameterType.getName())) {
renamedMap.put(repoParameterType.getName(), parameterType.getName());
}
}
}
}
}
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
return renamedMap;
}
/**
*
* DOC hcw ProcessUpdateManager class global comment. Detailled comment
*/
public static class ContextItemParamMap {
private Map<Item, Set<String>> map = new HashMap<Item, Set<String>>();
public void add(Item item, String param) {
Set<String> params = map.get(item);
if (params == null) {
params = new HashSet<String>();
map.put(item, params);
}
params.add(param);
}
@SuppressWarnings("unchecked")
public Set<String> get(Item item) {
Set<String> params = map.get(item);
return (params == null) ? Collections.EMPTY_SET : params;
}
public boolean isEmpty() {
return map.isEmpty();
}
public Set<Item> getContexts() {
return map.keySet();
}
}
public static boolean compareContextParameter(Item contextItem, ContextType contextType, IContextParameter param,
ContextParamLink paramLink, Map<Item, Map<String, String>> repositoryRenamedMap, Map<Item, Set<String>> existedParams,
ContextItemParamMap unsameMap, ContextItemParamMap deleteParams, boolean onlySimpleShow, boolean isDefaultContext) {
boolean builtin = true;
String paramName = param.getName();
if (paramLink != null && paramLink.getId() != null && contextType != null) {// Compare use UUID
String paramId = paramLink.getId();
ContextParameterType contextParameterType = null;
contextParameterType = getContextParameterTypeById(contextType, paramId, contextItem instanceof ContextItem);
if (contextParameterType != null) {
if (!StringUtils.equals(contextParameterType.getName(), paramName)) {
if (isDefaultContext) {
Map<String, String> renameMap = repositoryRenamedMap.get(contextItem);
if (renameMap == null) {
renameMap = new HashMap<String, String>();
repositoryRenamedMap.put(contextItem, renameMap);
}
renameMap.put(contextParameterType.getName(), paramName);
}
} else {
if (isDefaultContext) {
if (existedParams.get(contextItem) == null) {
existedParams.put(contextItem, new HashSet<String>());
}
existedParams.get(contextItem).add(paramName);
}
if (onlySimpleShow || !samePropertiesForContextParameter(param, contextParameterType)) {
unsameMap.add(contextItem, paramName);
}
}
builtin = false;
} else {
// delete context variable
if (isPropagateContextVariable() && isDefaultContext) {
deleteParams.add(contextItem, paramName);
builtin = false;
}
}
} else { // Compare use Name
final ContextParameterType contextParameterType = ContextUtils.getContextParameterTypeByName(contextType, paramName);
if (contextParameterType != null) {
Item repositoryContext = contextItem;
if (isDefaultContext) {
if (existedParams.get(contextItem) == null) {
existedParams.put(repositoryContext, new HashSet<String>());
}
existedParams.get(repositoryContext).add(paramName);
}
if (onlySimpleShow || !ContextUtils.samePropertiesForContextParameter(param, contextParameterType)) {
unsameMap.add(contextItem, paramName);
}
builtin = false;
} else {
// delete context variable
if (ContextUtils.isPropagateContextVariable()) {
deleteParams.add(contextItem, paramName);
builtin = false;
}
}
}
return builtin && isDefaultContext;
}
public static String getParamId(IContextParameter param, ContextParamLink paramLink) {
if (paramLink != null) {
return paramLink.getId();
}
if (param != null) {
return param.getInternalId();
}
return null;
}
public static Item findContextItem(List<ContextItem> allContextItem, String source) {
if (allContextItem != null) {
for (ContextItem contextItem : allContextItem) {
if (StringUtils.equals(contextItem.getProperty().getId(), source)) {
return contextItem;
}
}
}
return getRepositoryContextItemById(source);
}
public static String getNewNameFromRenameMap(Map<String, String> renameMap, String oldName) {
if (renameMap != null) {
for (String key : renameMap.keySet()) {
String value = renameMap.get(key);
if (StringUtils.equals(value, oldName)) {
return key;
}
}
}
return null;
}
public static boolean isBuildInParameter(ContextParameterType paramType) {
if (paramType.getRepositoryContextId() == null || IContextParameter.BUILT_IN.equals(paramType.getRepositoryContextId())) {
return true;
}
return false;
}
}

View File

@@ -19,8 +19,10 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.talend.core.model.metadata.MetadataTalendType;
import org.talend.core.model.metadata.types.ContextParameterJavaTypeManager;
import org.talend.core.model.process.IContext;
@@ -30,6 +32,7 @@ import org.talend.core.model.process.IContextParameter;
import org.talend.core.model.properties.ContextItem;
import org.talend.core.model.properties.Item;
import org.talend.core.model.utils.ContextParameterUtils;
import org.talend.cwm.helper.ResourceHelper;
import org.talend.designer.core.model.utils.emf.talendfile.ContextParameterType;
import org.talend.designer.core.model.utils.emf.talendfile.ContextType;
import org.talend.designer.core.model.utils.emf.talendfile.TalendFileFactory;
@@ -74,7 +77,7 @@ public class JobContextManager implements IContextManager {
*/
private Set<String> originalParamerters = new HashSet<String>();
private Map<ContextItem, Set<String>> newParametersMap = new HashMap<ContextItem, Set<String>>();
private Map<Item, Set<String>> newParametersMap = new HashMap<Item, Set<String>>();
/*
* for context group
@@ -251,73 +254,7 @@ public class JobContextManager implements IContextManager {
*/
@Override
public void saveToEmf(EList contextTypeList) {
if (contextTypeList == null) {
return;
}
if (listContext.isEmpty()) {
retrieveDefaultContext();
}
EList newcontextTypeList = new BasicEList();
for (int i = 0; i < listContext.size(); i++) {
IContext context = listContext.get(i);
String contextGroupName = renameGroupContext.get(context);
if (contextGroupName == null) {
contextGroupName = context.getName();
}
ContextType contextType = findContextType(contextTypeList, contextGroupName);
if (contextType == null) {
contextType = TalendFileFactory.eINSTANCE.createContextType();
}
contextType.setName(context.getName());
contextType.setConfirmationNeeded(context.isConfirmationNeeded());
newcontextTypeList.add(contextType);
EList contextTypeParamList = contextType.getContextParameter();
List<IContextParameter> contextParameterList = context.getContextParameterList();
EList newContextTypeParamList = new BasicEList();
if (contextParameterList != null) {
for (int j = 0; j < contextParameterList.size(); j++) {
IContextParameter contextParam = contextParameterList.get(j);
String contexParameterName = nameMap.get(contextParam.getName());
if (contexParameterName == null) {
contexParameterName = contextParam.getName();
}
ContextParameterType contextParamType = findContextParameterType(contextTypeParamList, contexParameterName);
if (contextParamType == null) {
contextParamType = TalendFileFactory.eINSTANCE.createContextParameterType();
}
newContextTypeParamList.add(contextParamType);
contextParamType.setName(contextParam.getName());
contextParamType.setPrompt(contextParam.getPrompt());
contextParamType.setType(contextParam.getType());
contextParamType.setRawValue(contextParam.getValue());
contextParamType.setPromptNeeded(contextParam.isPromptNeeded());
contextParamType.setComment(contextParam.getComment());
if (!contextParam.isBuiltIn()) {
Item item = ContextUtils.getRepositoryContextItemById(contextParam.getSource());
if (item != null) {
contextParamType.setRepositoryContextId(item.getProperty().getId());
} else {
String contextId = contextParam.getSource();
if (!IContextParameter.BUILT_IN.equals(contextId)) {
contextParamType.setRepositoryContextId(contextId);
}
}
}
}
contextTypeParamList.clear(); // remove old
contextTypeParamList.addAll(newContextTypeParamList);
}
}
contextTypeList.clear(); // clear old
contextTypeList.addAll(newcontextTypeList);
saveToEmf(contextTypeList, false);
}
private ContextType findContextType(EList contextTypeList, String contextName) {
@@ -384,6 +321,7 @@ public class JobContextManager implements IContextManager {
contextParam.setContext(context);
contextParam.setName(contextParamType.getName());
contextParam.setPrompt(contextParamType.getPrompt());
contextParam.setInternalId(contextParamType.getInternalId());
originalParamerters.add(contextParam.getName());
boolean exists = true;
try {
@@ -486,16 +424,6 @@ public class JobContextManager implements IContextManager {
}
/**
*
* ggu Comment method "getLostParameters".
*
* @return
*/
public Set<String> getLostParameters() {
return this.lostParameters;
}
public Map<ContextItem, Map<String, String>> getRepositoryRenamedMap() {
return this.repositoryRenamedMap;
}
@@ -516,6 +444,16 @@ public class JobContextManager implements IContextManager {
}
/**
*
* ggu Comment method "getLostParameters".
*
* @return
*/
public Set<String> getLostParameters() {
return this.lostParameters;
}
public void addNewParameters(String param) {
newParameters.add(param);
}
@@ -540,11 +478,11 @@ public class JobContextManager implements IContextManager {
}
}
public Map<ContextItem, Set<String>> getNewParametersMap() {
public Map<Item, Set<String>> getNewParametersMap() {
return newParametersMap;
}
public void setNewParametersMap(Map<ContextItem, Set<String>> newParametersMap) {
public void setNewParametersMap(Map<Item, Set<String>> newParametersMap) {
this.newParametersMap = newParametersMap;
}
@@ -573,4 +511,98 @@ public class JobContextManager implements IContextManager {
public void setConfigContextGroup(boolean isConfigContextGroup) {
this.isConfigContextGroup = isConfigContextGroup;
}
@Override
public void saveToEmf(EList contextTypeList, boolean useInternalId) {
if (contextTypeList == null) {
return;
}
if (listContext.isEmpty()) {
retrieveDefaultContext();
}
EList newcontextTypeList = new BasicEList();
Map<String, Item> idToItemMap = new HashMap<String, Item>();
for (int i = 0; i < listContext.size(); i++) {
IContext context = listContext.get(i);
String contextGroupName = renameGroupContext.get(context);
if (contextGroupName == null) {
contextGroupName = context.getName();
}
ContextType contextType = findContextType(contextTypeList, contextGroupName);
if (contextType == null) {
contextType = TalendFileFactory.eINSTANCE.createContextType();
}
contextType.setName(context.getName());
contextType.setConfirmationNeeded(context.isConfirmationNeeded());
newcontextTypeList.add(contextType);
EList contextTypeParamList = contextType.getContextParameter();
List<IContextParameter> contextParameterList = context.getContextParameterList();
EList newContextTypeParamList = new BasicEList();
if (contextParameterList != null) {
for (int j = 0; j < contextParameterList.size(); j++) {
IContextParameter contextParam = contextParameterList.get(j);
String contexParameterName = nameMap.get(contextParam.getName());
if (contexParameterName == null) {
contexParameterName = contextParam.getName();
}
ContextParameterType contextParamType = findContextParameterType(contextTypeParamList, contexParameterName);
if (contextParamType == null) {
contextParamType = TalendFileFactory.eINSTANCE.createContextParameterType();
}
newContextTypeParamList.add(contextParamType);
contextParamType.setName(contextParam.getName());
contextParamType.setPrompt(contextParam.getPrompt());
contextParamType.setType(contextParam.getType());
contextParamType.setRawValue(contextParam.getValue());
contextParamType.setPromptNeeded(contextParam.isPromptNeeded());
contextParamType.setComment(contextParam.getComment());
if (!contextParam.isBuiltIn()) {
Item item = idToItemMap.get(contextParam.getSource());
if (item == null) {
item = ContextUtils.getRepositoryContextItemById(contextParam.getSource());
idToItemMap.put(contextParam.getSource(), item);
}
if (item != null) {
contextParamType.setRepositoryContextId(item.getProperty().getId());
if (item instanceof ContextItem) {
ContextType repoContextType = ContextUtils.getContextTypeByName(item, contextType.getName());
if (repoContextType != null) {
ContextParameterType repoContextParam = ContextUtils
.getContextParameterTypeByName(repoContextType, contextParam.getName());
if (repoContextParam != null) {
ResourceHelper.setUUid(contextParamType, ResourceHelper.getUUID(repoContextParam));
}
}
}
} else {
String contextId = contextParam.getSource();
if (!IContextParameter.BUILT_IN.equals(contextId)) {
contextParamType.setRepositoryContextId(contextId);
}
}
} else if (useInternalId) {
String internalId = contextParam.getInternalId();
if (StringUtils.isEmpty(internalId)) {
internalId = EcoreUtil.generateUUID();
contextParamType.setInternalId(internalId);
contextParam.setInternalId(internalId);
} else {
contextParamType.setInternalId(internalId);
}
}
}
contextTypeParamList.clear(); // remove old
contextTypeParamList.addAll(newContextTypeParamList);
}
}
contextTypeList.clear(); // clear old
contextTypeList.addAll(newcontextTypeList);
}
}

View File

@@ -45,13 +45,14 @@ public class JobContextParameter implements IContextParameter, Cloneable {
String[] valueList;
String internalId;
/**
* change to save id always for bug 13184.
*/
String source = ""; //$NON-NLS-1$
public JobContextParameter() {
}
@Override
@@ -310,6 +311,14 @@ public class JobContextParameter implements IContextParameter, Cloneable {
this.promptNeeded = promptNeeded;
}
public String getInternalId() {
return internalId;
}
public void setInternalId(String internalId) {
this.internalId = internalId;
}
@Override
public IContextParameter clone() {
IContextParameter clonedContextParameter = null;

View File

@@ -0,0 +1,85 @@
// ============================================================================
//
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.core.model.context.link;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import com.fasterxml.jackson.annotation.JsonProperty;
public class ContextLink {
@JsonProperty("contextName")
private String contextName;
@JsonProperty("repoId")
private String repoId;
@JsonProperty("parameterList")
private List<ContextParamLink> parameterList = new ArrayList<ContextParamLink>();
public String getRepoId() {
return repoId;
}
public void setRepoId(String repoId) {
this.repoId = repoId;
}
public List<ContextParamLink> getParameterList() {
return parameterList;
}
public void setParameterList(List<ContextParamLink> parameterList) {
this.parameterList = parameterList;
}
public String getContextName() {
return contextName;
}
public void setContextName(String contextName) {
this.contextName = contextName;
}
public ContextParamLink getParamLinkByName(String paramName) {
for (ContextParamLink paramLink : parameterList) {
if (StringUtils.equals(paramLink.getName(), paramName)) {
return paramLink;
}
}
return null;
}
public ContextParamLink getParamLinkById(String id) {
for (ContextParamLink paramLink : parameterList) {
if (StringUtils.equals(paramLink.getId(), id)) {
return paramLink;
}
}
return null;
}
public ContextLink cloneObj() {
ContextLink obj = new ContextLink();
obj.setContextName(contextName);
obj.setRepoId(repoId);
for (ContextParamLink p : parameterList) {
obj.getParameterList().add(p.cloneObj());
}
return obj;
}
}

View File

@@ -0,0 +1,392 @@
// ============================================================================
//
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.core.model.context.link;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.exception.PersistenceException;
import org.talend.commons.utils.workbench.resources.ResourceUtils;
import org.talend.core.model.context.ContextUtils;
import org.talend.core.model.metadata.builder.connection.Connection;
import org.talend.core.model.process.IContextParameter;
import org.talend.core.model.properties.ConnectionItem;
import org.talend.core.model.properties.ContextItem;
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.Project;
import org.talend.cwm.helper.ResourceHelper;
import org.talend.designer.core.model.utils.emf.talendfile.ContextParameterType;
import org.talend.designer.core.model.utils.emf.talendfile.ContextType;
import org.talend.repository.ProjectManager;
import org.talend.repository.model.RepositoryConstants;
import com.fasterxml.jackson.databind.ObjectMapper;
public class ContextLinkService {
private static final String CREATOR_EXT_ID = "org.talend.core.runtime.saveItemContextLinkService"; //$NON-NLS-1$
public static final String LINKS_FOLDER_NAME = "links";
public static final String LINK_FILE_POSTFIX = ".link";
private static final List<IItemContextLinkService> registeredService = new ArrayList<IItemContextLinkService>();
private static ContextLinkService instance = new ContextLinkService();
private static final String CURRENT_PROJECT_LABEL = ProjectManager.getInstance().getCurrentProject().getTechnicalLabel();
private ContextLinkService() {
initService();
}
public static ContextLinkService getInstance() {
return instance;
}
public synchronized boolean saveContextLink(Item item) throws PersistenceException {
for (IItemContextLinkService service : registeredService) {
if (service.accept(item)) {
return service.saveItemLink(item);
}
}
return doSaveContextLink(item);
}
public synchronized boolean doSaveContextLink(Item item) throws PersistenceException {
if (item instanceof ProcessItem) {
ProcessItem processItem = (ProcessItem) item;
return saveContextLink(processItem.getProcess().getContext(), item);
} else if (item instanceof JobletProcessItem) {
JobletProcessItem jobletItem = (JobletProcessItem) item;
return saveContextLink(jobletItem.getJobletProcess().getContext(), item);
} else if (item instanceof ConnectionItem) {
ConnectionItem connectionItem = (ConnectionItem) item;
return saveContextLink(connectionItem.getConnection(), item);
}
return false;
}
@SuppressWarnings("unchecked")
private synchronized boolean saveContextLink(Connection connection, Item item) throws PersistenceException {
boolean hasLinkFile = false;
ItemContextLink itemContextLink = new ItemContextLink();
itemContextLink.setItemId(item.getProperty().getId());
if (connection.isContextMode()) {
String contextId = connection.getContextId();
if (StringUtils.isEmpty(contextId) || IContextParameter.BUILT_IN.equals(contextId)) {
return hasLinkFile;
}
ContextLink contextLink = new ContextLink();
contextLink.setContextName(connection.getContextName());
contextLink.setRepoId(contextId);
itemContextLink.getContextList().add(contextLink);
ContextItem contextItem = ContextUtils.getContextItemById2(contextId);
if (contextItem != null) {
ContextType contextType = ContextUtils.getContextTypeByName(contextItem.getContext(),
connection.getContextName());
if (contextType != null) {
for (Object o : contextType.getContextParameter()) {
if (o instanceof ContextParameterType) {
ContextParameterType contextParameterType = (ContextParameterType) o;
ContextParamLink contextParamLink = new ContextParamLink();
contextParamLink.setName(contextParameterType.getName());
contextParamLink.setId(ResourceHelper.getUUID(contextParameterType));
contextLink.getParameterList().add(contextParamLink);
}
}
}
}
}
if (itemContextLink.getContextList().size() > 0) {
saveContextLinkToJson(item, itemContextLink);
hasLinkFile = true;
} else {
deleteContextLinkJsonFile(item);
}
return hasLinkFile;
}
public synchronized boolean saveContextLink(List<ContextType> contextTypeList, Item item) throws PersistenceException {
boolean hasLinkFile = false;
String itemId = item.getProperty().getId();
ItemContextLink itemContextLink = new ItemContextLink();
itemContextLink.setItemId(itemId);
Map<String, Item> tempCache = new HashMap<String, Item>();
if (contextTypeList != null && contextTypeList.size() > 0) {
ItemContextLink backupContextLink = this.loadContextLinkFromJson(item);
for (Object object : contextTypeList) {
if (object instanceof ContextType) {
ContextType jobContextType = (ContextType) object;
for (Object o : jobContextType.getContextParameter()) {
if (o instanceof ContextParameterType) {
ContextParameterType contextParameterType = (ContextParameterType) o;
String repositoryContextId = contextParameterType.getRepositoryContextId();
if (StringUtils.isEmpty(repositoryContextId)
|| IContextParameter.BUILT_IN.equals(repositoryContextId)) {
ContextLink contextLink = itemContextLink.findContextLink(item.getProperty().getId(),
jobContextType.getName());
if (contextLink == null) {
contextLink = new ContextLink();
contextLink.setContextName(jobContextType.getName());
contextLink.setRepoId(itemId);
itemContextLink.getContextList().add(contextLink);
}
ContextParamLink contextParamLink = createParamLink(itemId, jobContextType.getName(),
contextParameterType.getName(), contextParameterType.getInternalId(), tempCache,
backupContextLink);
contextLink.getParameterList().add(contextParamLink);
} else {
ContextLink contextLink = itemContextLink
.findContextLink(contextParameterType.getRepositoryContextId(), jobContextType.getName());
if (contextLink == null) {
contextLink = new ContextLink();
contextLink.setContextName(jobContextType.getName());
contextLink.setRepoId(repositoryContextId);
itemContextLink.getContextList().add(contextLink);
}
ContextParamLink contextParamLink = createParamLink(repositoryContextId, jobContextType.getName(),
contextParameterType.getName(), contextParameterType.getInternalId(), tempCache,
backupContextLink);
contextLink.getParameterList().add(contextParamLink);
}
}
}
}
}
}
if (itemContextLink.getContextList().size() > 0) {
saveContextLinkToJson(item, itemContextLink);
hasLinkFile = true;
} else {
deleteContextLinkJsonFile(item);
}
return hasLinkFile;
}
@SuppressWarnings("unchecked")
private ContextParamLink createParamLink(String repositoryContextId, String contextName, String paramName, String internalId,
Map<String, Item> tempCache, ItemContextLink oldContextLink) {
ContextParamLink contextParamLink = new ContextParamLink();
contextParamLink.setName(paramName);
contextParamLink.setId(internalId);
Item contextItem = tempCache.get(repositoryContextId);
if (contextItem == null) {
contextItem = ContextUtils.getRepositoryContextItemById(repositoryContextId);
tempCache.put(repositoryContextId, contextItem);
}
if (contextItem != null) {
ContextType contextType = ContextUtils.getContextTypeByName(contextItem, contextName);
ContextParameterType repoContextParameterType = ContextUtils.getContextParameterTypeByName(contextType, paramName);
String uuID = null;
if(repoContextParameterType != null) {
if (contextItem instanceof ContextItem) {
uuID = ResourceHelper.getUUID(repoContextParameterType);
} else if (repoContextParameterType.getInternalId() != null) {
uuID = repoContextParameterType.getInternalId();
}
}
if (repoContextParameterType == null && oldContextLink != null) {
ContextParamLink oldParamLink = oldContextLink.findContextParamLinkByName(repositoryContextId, contextName,
paramName);
if (oldParamLink != null) {
uuID = oldParamLink.getId();
}
}
contextParamLink.setId(uuID);
}
return contextParamLink;
}
private synchronized void saveContextLinkToJson(Item item, ItemContextLink itemContextLink) throws PersistenceException {
IFolder linksFolder = getLinksFolder(getItemProjectLabel(item));
if (!linksFolder.exists()) {
ResourceUtils.createFolder(linksFolder);
}
IFile linkFile = calContextLinkFile(item);
ObjectMapper objectMapper = new ObjectMapper();
try {
String content = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(itemContextLink);
if (!linkFile.exists()) {
ResourceUtils.createFile(new ByteArrayInputStream(content.getBytes()), linkFile);
} else {
ResourceUtils.setFileContent(new ByteArrayInputStream(content.getBytes()), linkFile);
}
} catch (Exception e) {
throw new PersistenceException(e);
}
}
public synchronized boolean changeRepositoryId(Item item, Map<String, String> old2NewMap) throws PersistenceException {
boolean isModofied = false;
ItemContextLink itemContextLink = loadContextLinkFromJson(item);
if (itemContextLink != null) {
for (ContextLink contextLink : itemContextLink.getContextList()) {
if (old2NewMap.containsKey(contextLink.getRepoId())) {
contextLink.setRepoId(old2NewMap.get(contextLink.getRepoId()));
isModofied = true;
}
}
}
if (isModofied) {
this.saveContextLinkToJson(item, itemContextLink);
}
return isModofied;
}
public synchronized ItemContextLink loadContextLinkFromJson(Item item) throws PersistenceException {
for (IItemContextLinkService service : registeredService) {
if (service.accept(item)) {
return service.loadItemLink(item);
}
}
return doLoadContextLinkFromJson(item);
}
public synchronized ItemContextLink doLoadContextLinkFromJson(Item item) throws PersistenceException {
IFile linkFile = calContextLinkFile(item);
return doLoadContextLinkFromFile(linkFile);
}
public synchronized ItemContextLink doLoadContextLinkFromJson(String projectLabel, String id) throws PersistenceException {
IFile linkFile = calContextLinkFile(projectLabel, id);
return doLoadContextLinkFromFile(linkFile);
}
public synchronized ItemContextLink doLoadContextLinkFromFile(IFile linkFile) throws PersistenceException {
if (linkFile == null || !linkFile.exists()) {
return null;
}
ItemContextLink contextLink = null;
try {
contextLink = new ObjectMapper().readValue(linkFile.getLocation().toFile(), ItemContextLink.class);
} catch (IOException e) {
throw new PersistenceException(e);
}
return contextLink;
}
public synchronized void deleteContextLinkJsonFile(Item item) throws PersistenceException {
IFile linkFile = calContextLinkFile(item);
if (linkFile != null && linkFile.exists()) {
try {
linkFile.delete(true, null);
} catch (CoreException e) {
throw new PersistenceException(e);
}
}
}
public static IFile calContextLinkFile(Item item) throws PersistenceException {
if (item == null) {
return null;
}
IFolder linksFolder = getLinksFolder(getItemProjectLabel(item));
return linksFolder.getFile(calLinkFileName(item.getProperty().getId()));
}
public static IFile calContextLinkFile(String projectLabel, String itemId) throws PersistenceException {
if (projectLabel == null || itemId == null) {
return null;
}
IFolder linksFolder = getLinksFolder(projectLabel);
return linksFolder.getFile(calLinkFileName(itemId));
}
public static String getItemProjectLabel(Item item) {
Project project = ProjectManager.getInstance().getProject(item);
if (project != null) {
return project.getTechnicalLabel();
}
return CURRENT_PROJECT_LABEL;
}
private static String calLinkFileName(String id) {
StringBuilder sb = new StringBuilder();
sb.append(id).append(LINK_FILE_POSTFIX);
return sb.toString();
}
public static IFile calLinksFile(IFolder projectFolder, String id) {
IFolder settingFolder = projectFolder.getFolder(RepositoryConstants.SETTING_DIRECTORY);
IFolder linksFolder = settingFolder.getFolder(LINKS_FOLDER_NAME);
return linksFolder.getFile(getLinkFileName(id));
}
public static String calLinksFilePath(String projectPath, String id) {
StringBuilder sb = new StringBuilder(projectPath);
sb.append(File.separator).append(RepositoryConstants.SETTING_DIRECTORY);
sb.append(File.separator).append(LINKS_FOLDER_NAME);
sb.append(File.separator).append(getLinkFileName(id));
return sb.toString();
}
public static IFile calLinksFile(IProject project, String id) {
IFolder settingFolder = project.getFolder(RepositoryConstants.SETTING_DIRECTORY);
IFolder linksFolder = settingFolder.getFolder(LINKS_FOLDER_NAME);
return linksFolder.getFile(getLinkFileName(id));
}
public static String getLinkFileName(String id) {
return id + LINK_FILE_POSTFIX;
}
private static IFolder getLinksFolder(String projectLabel) throws PersistenceException {
IProject iProject = ResourceUtils.getProject(projectLabel);
IFolder settingFolder = iProject.getFolder(RepositoryConstants.SETTING_DIRECTORY);
IFolder linksFolder = settingFolder.getFolder(LINKS_FOLDER_NAME);
return linksFolder;
}
private static void initService() {
IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
IExtensionPoint extensionPoint = extensionRegistry.getExtensionPoint(CREATOR_EXT_ID);
if (extensionPoint != null) {
IExtension[] extensions = extensionPoint.getExtensions();
for (IExtension extension : extensions) {
IConfigurationElement[] configurationElements = extension.getConfigurationElements();
for (IConfigurationElement configurationElement : configurationElements) {
try {
Object creator = configurationElement.createExecutableExtension("class"); //$NON-NLS-1$
if (creator instanceof IItemContextLinkService) {
IItemContextLinkService service = (IItemContextLinkService) creator;
registeredService.add(service);
}
} catch (CoreException e) {
ExceptionHandler.process(e);
}
}
}
}
}
}

View File

@@ -0,0 +1,48 @@
// ============================================================================
//
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.core.model.context.link;
import com.fasterxml.jackson.annotation.JsonProperty;
public class ContextParamLink {
@JsonProperty("id")
private String id;
@JsonProperty("name")
private String name;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public ContextParamLink cloneObj() {
ContextParamLink obj = new ContextParamLink();
obj.setId(id);
obj.setName(name);
return obj;
}
}

View File

@@ -0,0 +1,26 @@
// ============================================================================
//
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.core.model.context.link;
import org.talend.commons.exception.PersistenceException;
import org.talend.core.model.properties.Item;
public interface IItemContextLinkService {
boolean accept(Item item);
boolean saveItemLink(Item item) throws PersistenceException;
ItemContextLink loadItemLink(Item item) throws PersistenceException;
}

View File

@@ -0,0 +1,80 @@
// ============================================================================
//
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.core.model.context.link;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import com.fasterxml.jackson.annotation.JsonProperty;
public class ItemContextLink {
@JsonProperty("itemId")
private String itemId;
@JsonProperty("contextList")
private List<ContextLink> contextList = new ArrayList<ContextLink>();
public String getItemId() {
return itemId;
}
public void setItemId(String itemId) {
this.itemId = itemId;
}
public List<ContextLink> getContextList() {
return contextList;
}
public void setContextList(List<ContextLink> contextList) {
this.contextList = contextList;
}
public ContextParamLink findContextParamLinkByName(String repoContextId, String contextName, String paramName) {
ContextLink contextLink = findContextLink(repoContextId, contextName);
if (contextLink != null) {
return contextLink.getParamLinkByName(paramName);
}
return null;
}
public ContextParamLink findContextParamLinkById(String repoContextId, String contextName, String paramId) {
ContextLink contextLink = findContextLink(repoContextId, contextName);
if (contextLink != null) {
return contextLink.getParamLinkById(paramId);
}
return null;
}
public ContextLink findContextLink(String repoContextId, String contextName) {
for (ContextLink contextLink : contextList) {
if ((repoContextId == null || StringUtils.equals(repoContextId, contextLink.getRepoId()))
&& StringUtils.equals(contextName, contextLink.getContextName())) {
return contextLink;
}
}
return null;
}
public ItemContextLink cloneObj() {
ItemContextLink obj = new ItemContextLink();
obj.setItemId(itemId);
for (ContextLink c : contextList) {
obj.getContextList().add(c.cloneObj());
}
return obj;
}
}

View File

@@ -56,6 +56,7 @@ public class ConnectionBean implements Cloneable {
private static final String TOKEN = "token"; //$NON-NLS-1$
private static final String URL = "url"; //$NON-NLS-1$
/**
* DOC smallet ConnectionBean constructor comment.
*/
@@ -396,4 +397,15 @@ public class ConnectionBean implements Cloneable {
}
}
public String getUrl() {
try {
if (conDetails.has(URL)) {
return conDetails.getString(URL);
}
} catch (JSONException e) {
ExceptionHandler.process(e);
}
return "";
}
}

View File

@@ -76,6 +76,8 @@ public final class MetadataTalendType {
public static final String PROJECT_MAPPING_FOLDER = ".settings/mappings"; //$NON-NLS-1$
public static final String UPDATED_MAPPING_FILES = "updated.mapping.files"; //$NON-NLS-1$
private static ECodeLanguage codeLanguage;
private static final String[] PERL_TYPES = new String[] { PerlTypesManager.BOOLEAN, PerlTypesManager.DATE,
@@ -476,7 +478,7 @@ public final class MetadataTalendType {
if (!mappingFolder.exists() || mappingFolder.listFiles().length < 1) {
ICoreService service = null;
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreService.class)) {
service = (ICoreService) GlobalServiceRegister.getDefault().getService(ICoreService.class);
service = GlobalServiceRegister.getDefault().getService(ICoreService.class);
service.syncMappingsFileFromSystemToProject();
}
}

View File

@@ -87,6 +87,7 @@ import org.talend.core.model.repository.DragAndDropManager;
import org.talend.core.model.update.UpdatesConstants;
import org.talend.core.model.utils.IDragAndDropServiceHandler;
import org.talend.core.runtime.CoreRuntimePlugin;
import org.talend.core.runtime.services.IGenericWizardService;
import org.talend.core.service.IMetadataManagmentService;
import org.talend.core.service.IMetadataManagmentUiService;
import org.talend.core.utils.KeywordsValidator;
@@ -155,12 +156,12 @@ public class RepositoryToComponentProperty {
return getEDIFACTSchemaValue((EDIFACTConnection) connection, value);
}
for (IDragAndDropServiceHandler handler : DragAndDropManager.getHandlers()) {
if (handler.canHandle(connection)) {
return handler.getComponentValue(connection, value, table, targetComponent, contextMap);
}
// Special for Javajet components: tSalesforceEinsteinBulkExec/tSalesforceEinsteinOutputBulkExec
if (targetComponent != null && targetComponent.startsWith("tSalesforceEinstein")) { //$NON-NLS-1$
return getSpecialGenericValue(connection, value, table, targetComponent, contextMap);
}
return null;
return getHandlerComponentValue(connection, value, table, targetComponent, contextMap);
}
@@ -213,8 +214,7 @@ public class RepositoryToComponentProperty {
return;
}
SAPFunctionUnit unit = null;
for (int i = 0; i < conn.getFuntions().size(); i++) {
SAPFunctionUnit tmp = conn.getFuntions().get(i);
for (SAPFunctionUnit tmp : conn.getFuntions()) {
if (tmp.getLabel().equals(functionLabel)) {
unit = tmp;
break;
@@ -230,9 +230,8 @@ public class RepositoryToComponentProperty {
if (isInput) {
mergeColumn(table, table.getChildren(), value2);
} else {
for (int i = 0; i < table.getChildren().size(); i++) {
for (SAPFunctionParameter column : table.getChildren()) {
Map<String, Object> map = new HashMap<String, Object>();
SAPFunctionParameter column = table.getChildren().get(i);
// this part maybe no use , didn't find OUTPUT_PARAMS in sap component
map.put("SAP_PARAMETER_TYPE", column.getType().replace('.', '_')); //$NON-NLS-1$
map.put("SAP_TABLE_NAME", TalendQuoteUtils.addQuotes("")); //$NON-NLS-1$
@@ -298,8 +297,8 @@ public class RepositoryToComponentProperty {
if (conn == null) {
return null;
}
for (int i = 0; i < conn.getFuntions().size(); i++) {
unit = conn.getFuntions().get(i);
for (SAPFunctionUnit element : conn.getFuntions()) {
unit = element;
if (unit.getLabel().equals(functionLabel)) {
break;
}
@@ -626,6 +625,50 @@ public class RepositoryToComponentProperty {
return null;
}
private static Object getSpecialGenericValue(Connection connection, String value, IMetadataTable table,
String targetComponent,
Map<Object, Object> contextMap) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericWizardService.class)) {
IGenericWizardService wizardService = GlobalServiceRegister.getDefault().getService(IGenericWizardService.class);
if (wizardService != null && wizardService.isGenericConnection(connection)) {
if (value != null) {
if ("ENDPOINT".equals(value)) { //$NON-NLS-1$
value = "connection.endpoint"; //$NON-NLS-1$
} else if ("USER_NAME".equals(value)) { //$NON-NLS-1$
value = "connection.userPassword.userId"; //$NON-NLS-1$
} else if ("PASSWORD".equals(value)) { //$NON-NLS-1$
// salesforce javajet component:pwd = pwd + token
value = "connection.userPassword.password"; //$NON-NLS-1$
Object password = getHandlerComponentValue(connection, value, table, targetComponent, contextMap);
String skValue = "connection.userPassword.securityKey"; //$NON-NLS-1$
Object securityKey = getHandlerComponentValue(connection, skValue, table, targetComponent, contextMap);
if (securityKey != null) {
if (isContextMode(connection, String.valueOf(password))) {
return String.valueOf(password) + "+" + String.valueOf(securityKey); //$NON-NLS-1$
} else {
return TalendQuoteUtils.addQuotes(TalendQuoteUtils.removeQuotesIfExist(String.valueOf(password))
+ TalendQuoteUtils.removeQuotesIfExist(String.valueOf(securityKey)));
}
}
return password;
}
return getHandlerComponentValue(connection, value, table, targetComponent, contextMap);
}
}
}
return null;
}
private static Object getHandlerComponentValue(Connection connection, String value, IMetadataTable table,
String targetComponent, Map<Object, Object> contextMap) {
for (IDragAndDropServiceHandler handler : DragAndDropManager.getHandlers()) {
if (handler.canHandle(connection)) {
return handler.getComponentValue(connection, value, table, targetComponent, contextMap);
}
}
return null;
}
private static SalesforceModuleUnit getSaleforceModuleUnitByTable(IMetadataTable table,
EList<SalesforceModuleUnit> moduleList) {
for (SalesforceModuleUnit unit : moduleList) {
@@ -746,9 +789,9 @@ public class RepositoryToComponentProperty {
public static List<Map<String, String>> getOutputWSDLValue(EList list) {
List<Map<String, String>> newList = new ArrayList<Map<String, String>>();
for (int i = 0; i < list.size(); i++) {
for (Object element : list) {
Map<String, String> map = new HashMap<String, String>();
WSDLParameter node = (WSDLParameter) list.get(i);
WSDLParameter node = (WSDLParameter) element;
map.put("EXPRESSION", node.getExpression());
map.put("COLUMN", node.getColumn());
map.put("SOURCE", node.getSource());
@@ -1001,8 +1044,9 @@ public class RepositoryToComponentProperty {
} else {
String version = connection.getDbVersionString();
if (EDatabaseVersion4Drivers.ORACLE_18.name().equals(version)) {
if (StringUtils.equals(CDCTypeMode.LOG_MODE.getName(), connection.getCdcTypeMode()))
if (StringUtils.equals(CDCTypeMode.LOG_MODE.getName(), connection.getCdcTypeMode())) {
return CDCTypeMode.LOG_UNSUPPORTED_MODE.getName();
}
}
return connection.getCdcTypeMode();
}
@@ -1491,7 +1535,7 @@ public class RepositoryToComponentProperty {
String clusterID = connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HADOOP_CLUSTER_ID);
if (clusterID != null) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IHadoopClusterService.class)) {
IHadoopClusterService hadoopClusterService = (IHadoopClusterService) GlobalServiceRegister.getDefault()
IHadoopClusterService hadoopClusterService = GlobalServiceRegister.getDefault()
.getService(IHadoopClusterService.class);
Map<String, String> hadoopCustomLibraries = hadoopClusterService.getHadoopCustomLibraries(clusterID);
@@ -1735,7 +1779,7 @@ public class RepositoryToComponentProperty {
private static boolean isContextMode(Connection connection, String value) {
IMetadataManagmentUiService mmService = null;
if (GlobalServiceRegister.getDefault().isServiceRegistered(IMetadataManagmentUiService.class)) {
mmService = (IMetadataManagmentUiService) GlobalServiceRegister.getDefault()
mmService = GlobalServiceRegister.getDefault()
.getService(IMetadataManagmentUiService.class);
}
if (mmService != null) {
@@ -2022,7 +2066,7 @@ public class RepositoryToComponentProperty {
Path p = new Path(connection.getXmlFilePath());
if ((p.toPortableString()).endsWith("xsd")) { //$NON-NLS-1$
if (GlobalServiceRegister.getDefault().isServiceRegistered(IMetadataManagmentUiService.class)) {
IMetadataManagmentUiService mmUIService = (IMetadataManagmentUiService) GlobalServiceRegister.getDefault()
IMetadataManagmentUiService mmUIService = GlobalServiceRegister.getDefault()
.getService(IMetadataManagmentUiService.class);
String newPath = mmUIService.getAndOpenXSDFileDialog(p);
if (newPath != null) {
@@ -2142,9 +2186,9 @@ public class RepositoryToComponentProperty {
public static List<Map<String, String>> getOutputXmlValue(EList list) {
List<Map<String, String>> newList = new ArrayList<Map<String, String>>();
for (int i = 0; i < list.size(); i++) {
for (Object element : list) {
Map<String, String> map = new HashMap<String, String>();
XMLFileNode node = (XMLFileNode) list.get(i);
XMLFileNode node = (XMLFileNode) element;
String defaultValue = node.getDefaultValue();
if (defaultValue == null) {
defaultValue = ""; //$NON-NLS-1$
@@ -2388,7 +2432,7 @@ public class RepositoryToComponentProperty {
} else {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IMetadataManagmentService.class)) {
IMetadataManagmentService mmService = (IMetadataManagmentService) GlobalServiceRegister.getDefault()
IMetadataManagmentService mmService = GlobalServiceRegister.getDefault()
.getService(IMetadataManagmentService.class);
IMetadataTable convert = mmService.convertMetadataTable(repTable);
String uinqueTableName = node.getProcess()
@@ -2643,8 +2687,7 @@ public class RepositoryToComponentProperty {
boolean foundColumn = false;
Map<String, Object> map = new HashMap<String, Object>();
map.put("QUERY", null); //$NON-NLS-1$
for (int i = 0; i < schemaTargets.size(); i++) {
SchemaTarget sch = schemaTargets.get(i);
for (SchemaTarget sch : schemaTargets) {
if (col.getLabel().equals(sch.getTagName())) {
// map.put("SCHEMA_COLUMN", sch.getTagName());
foundColumn = true;
@@ -2653,8 +2696,7 @@ public class RepositoryToComponentProperty {
}
if (!foundColumn && colRenameMap != null && !colRenameMap.isEmpty()) {
Set<String> newNameSet = colRenameMap.keySet();
for (int i = 0; i < schemaTargets.size(); i++) {
SchemaTarget sch = schemaTargets.get(i);
for (SchemaTarget sch : schemaTargets) {
if (newNameSet.contains(sch.getTagName())) {
String oldColLabel = colRenameMap.get(sch.getTagName());
if (col.getLabel().equals(oldColLabel)) {
@@ -2713,8 +2755,7 @@ public class RepositoryToComponentProperty {
for (IMetadataColumn col : metadataTable.getListColumns()) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("QUERY", null); //$NON-NLS-1$
for (int i = 0; i < conceptTargets.size(); i++) {
ConceptTarget cpt = conceptTargets.get(i);
for (ConceptTarget cpt : conceptTargets) {
if (col.getLabel().equals(cpt.getTargetName())) {
// map.put("SCHEMA_COLUMN", sch.getTagName());
map.put("QUERY", TalendQuoteUtils.addQuotes(cpt.getRelativeLoopExpression())); //$NON-NLS-1$

View File

@@ -44,6 +44,8 @@ public interface IContextManager {
public void saveToEmf(EList contextTypeList);
public void saveToEmf(EList contextTypeList, boolean useInternalId);
public void loadFromEmf(EList contextTypeList, String defaultContextName);
public boolean sameAs(IContextManager contextManager);

View File

@@ -71,4 +71,8 @@ public interface IContextParameter {
public void setSource(final String sourceName);
public boolean isBuiltIn();
public String getInternalId();
public void setInternalId(String internalId);
}

View File

@@ -426,6 +426,11 @@ public class ERepositoryObjectType extends DynaEnum<ERepositoryObjectType> {
*/
public final static ERepositoryObjectType JOBLET = ERepositoryObjectType.valueOf("JOBLET"); //$NON-NLS-1$
/**
* <font color="red">This value may be <b>null</b> in some products, <b>should add NPE check</b></font>
*/
public final static ERepositoryObjectType SERVICES = ERepositoryObjectType.valueOf("SERVICES"); //$NON-NLS-1$
public final static ERepositoryObjectType JOBLET_DESIGNS = ERepositoryObjectType.valueOf("JOBLET_DESIGNS"); //$NON-NLS-1$
public final static ERepositoryObjectType SPARK_JOBLET = ERepositoryObjectType.valueOf("SPARK_JOBLET"); //$NON-NLS-1$
@@ -438,6 +443,8 @@ public class ERepositoryObjectType extends DynaEnum<ERepositoryObjectType> {
public final static ERepositoryObjectType ROUTINES = ERepositoryObjectType.valueOf("ROUTINES"); //$NON-NLS-1$
public final static ERepositoryObjectType BEANS = ERepositoryObjectType.valueOf("BEANS"); //$NON-NLS-1$
public final static ERepositoryObjectType METADATA_HEADER_FOOTER = ERepositoryObjectType.valueOf("METADATA_HEADER_FOOTER"); //$NON-NLS-1$
public final static ERepositoryObjectType JOB_SCRIPT = ERepositoryObjectType.valueOf("JOB_SCRIPT"); //$NON-NLS-1$

View File

@@ -0,0 +1,34 @@
// ============================================================================
//
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.core.model.update;
import org.talend.core.AbstractRepositoryContextUpdateService;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.model.metadata.builder.connection.Connection;
import org.talend.core.runtime.services.IGenericDBService;
public class GenericDbContextUpdateService extends AbstractRepositoryContextUpdateService {
IGenericDBService service = GlobalServiceRegister.getDefault().getService(IGenericDBService.class);
@Override
public boolean accept(Connection connection) {
return connection.getCompProperties() != null;
}
@Override
public boolean updateContextParameter(Connection conn, String oldValue, String newValue) {
return updateCompPropertiesContextParameter(conn, oldValue, newValue);
}
}

View File

@@ -0,0 +1,427 @@
// ============================================================================
//
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.core.model.update;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.apache.commons.lang.StringUtils;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.EMap;
import org.talend.core.AbstractRepositoryContextUpdateService;
import org.talend.core.database.conn.ConnParameterKeys;
import org.talend.core.database.conn.template.EDatabaseConnTemplate;
import org.talend.core.hadoop.repository.HadoopRepositoryUtil;
import org.talend.core.model.metadata.builder.connection.AdditionalConnectionProperty;
import org.talend.core.model.metadata.builder.connection.Connection;
import org.talend.core.model.metadata.builder.connection.DatabaseConnection;
import org.talend.core.model.metadata.builder.connection.DelimitedFileConnection;
import org.talend.core.model.metadata.builder.connection.FileExcelConnection;
import org.talend.core.model.metadata.builder.connection.LdifFileConnection;
import org.talend.core.model.metadata.builder.connection.PositionalFileConnection;
import org.talend.core.model.metadata.builder.connection.RegexpFileConnection;
import org.talend.core.model.metadata.builder.connection.SAPConnection;
import org.talend.core.model.metadata.builder.connection.SalesforceSchemaConnection;
import org.talend.core.model.metadata.builder.connection.WSDLSchemaConnection;
import org.talend.core.model.metadata.builder.connection.XmlFileConnection;
import org.talend.core.model.metadata.builder.connection.XmlXPathLoopDescriptor;
public class RepositoryContextUpdateService extends AbstractRepositoryContextUpdateService {
@Override
public boolean updateContextParameter(Connection conn, String oldValue, String newValue) {
boolean isModified = false;
if (conn.isContextMode()) {
if (conn instanceof DatabaseConnection) {
return updateDatabaseConnectinParam((DatabaseConnection) conn, oldValue, newValue);
}
if (conn instanceof FileExcelConnection) {
return updateFileExcelConnectionParam((FileExcelConnection) conn, oldValue, newValue);
}
if (conn instanceof DelimitedFileConnection) {
return updatDelimitedFileConnectionParam((DelimitedFileConnection) conn, oldValue, newValue);
}
if (conn instanceof RegexpFileConnection) {
return updateRegexpFileConnectionParam((RegexpFileConnection) conn, oldValue, newValue);
}
if (conn instanceof LdifFileConnection) {
return updateLdifFileConnectionParam((LdifFileConnection) conn, oldValue, newValue);
}
if (conn instanceof PositionalFileConnection) {
return updatePositionalFileConnectionParam((PositionalFileConnection) conn, oldValue, newValue);
}
if (conn instanceof XmlFileConnection) {
return updateXmlFileConnectionParam((XmlFileConnection) conn, oldValue, newValue);
}
if (conn instanceof SalesforceSchemaConnection) {
return updateSalesforceSchemaConnectionParam((SalesforceSchemaConnection) conn, oldValue, newValue);
}
if (conn instanceof WSDLSchemaConnection) {
return updateWSDLSchemaConnectionParam((WSDLSchemaConnection) conn, oldValue, newValue);
}
if (conn instanceof SAPConnection) {
return updateSAPConnectionParam((SAPConnection) conn, oldValue, newValue);
}
}
return isModified;
}
private boolean updateParameters(DatabaseConnection dbConn, String oldValue, String newValue) {
boolean isModified = false;
EMap<String, String> parameters = dbConn.getParameters();
if (parameters != null && !parameters.isEmpty()) {
for (Entry<String, String> entry : parameters.entrySet()) {
if (entry != null) {
String value = entry.getValue();
if (StringUtils.equals(value, oldValue)) {
entry.setValue(newValue);
isModified = true;
}
}
}
}
boolean hadoopUpdateResult = updateHadoopPropertiesForDbConnection(dbConn, oldValue, newValue);
return isModified || hadoopUpdateResult;
}
private boolean updateHadoopPropertiesForDbConnection(DatabaseConnection dbConn, String oldValue, String newValue) {
boolean isModified = false;
EMap<String, String> parameters = dbConn.getParameters();
String databaseType = parameters.get(ConnParameterKeys.CONN_PARA_KEY_DB_TYPE);
String hadoopProperties = "";
if (databaseType != null) {
if (EDatabaseConnTemplate.HIVE.getDBDisplayName().equals(databaseType)) {
hadoopProperties = parameters.get(ConnParameterKeys.CONN_PARA_KEY_HIVE_PROPERTIES);
} else if (EDatabaseConnTemplate.HBASE.getDBDisplayName().equals(databaseType)) {
hadoopProperties = parameters.get(ConnParameterKeys.CONN_PARA_KEY_HBASE_PROPERTIES);
} else if (EDatabaseConnTemplate.MAPRDB.getDBDisplayName().equals(databaseType)) {
hadoopProperties = parameters.get(ConnParameterKeys.CONN_PARA_KEY_MAPRDB_PROPERTIES);
}
List<Map<String, Object>> hadoopPropertiesList = HadoopRepositoryUtil.getHadoopPropertiesList(hadoopProperties);
if (!hadoopPropertiesList.isEmpty()) {
for (Map<String, Object> propertyMap : hadoopPropertiesList) {
String propertyValue = (String) propertyMap.get("VALUE");
if (propertyValue.equals(oldValue)) {
propertyMap.put("VALUE", newValue);
isModified = true;
}
}
String hadoopPropertiesJson = HadoopRepositoryUtil.getHadoopPropertiesJsonStr(hadoopPropertiesList);
if (EDatabaseConnTemplate.HIVE.getDBDisplayName().equals(databaseType)) {
dbConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_HIVE_PROPERTIES, hadoopPropertiesJson);
isModified = true;
} else if (EDatabaseConnTemplate.HBASE.getDBDisplayName().equals(databaseType)) {
dbConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_HBASE_PROPERTIES, hadoopPropertiesJson);
isModified = true;
} else if (EDatabaseConnTemplate.MAPRDB.getDBDisplayName().equals(databaseType)) {
dbConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_MAPRDB_PROPERTIES, hadoopPropertiesJson);
isModified = true;
}
}
}
return isModified;
}
private boolean updateDatabaseConnectinParam(DatabaseConnection dbConn, String oldValue, String newValue) {
boolean compPropertiesResult = updateCompPropertiesContextParameter(dbConn, oldValue, newValue);
boolean isModified = false;
if (dbConn.getAdditionalParams() != null && dbConn.getAdditionalParams().equals(oldValue)) {
dbConn.setAdditionalParams(newValue);
isModified = true;
} else if (dbConn.getUsername() != null && dbConn.getUsername().equals(oldValue)) {
dbConn.setUsername(newValue);
isModified = true;
} else if (dbConn.getPassword() != null && dbConn.getPassword().equals(oldValue)) {
dbConn.setPassword(newValue);
isModified = true;
} else if (dbConn.getServerName() != null && dbConn.getServerName().equals(oldValue)) {
dbConn.setServerName(newValue);
isModified = true;
} else if (dbConn.getPort() != null && dbConn.getPort().equals(oldValue)) {
dbConn.setPort(newValue);
isModified = true;
} else if (dbConn.getSID() != null && dbConn.getSID().equals(oldValue)) {
dbConn.setSID(newValue);
isModified = true;
} else if (dbConn.getDbmsId() != null && dbConn.getDbmsId().equals(oldValue)) {
dbConn.setDbmsId(newValue);
isModified = true;
} else if (dbConn.getDriverClass() != null && dbConn.getDriverClass().equals(oldValue)) {
dbConn.setDriverClass(newValue);
isModified = true;
} else if (dbConn.getDriverJarPath() != null && dbConn.getDriverJarPath().equals(oldValue)) {
dbConn.setDriverJarPath(newValue);
isModified = true;
} else if (dbConn.getURL() != null && dbConn.getURL().equals(oldValue)) {
dbConn.setURL(newValue);
isModified = true;
} else if (dbConn.getUiSchema() != null && dbConn.getUiSchema().equals(oldValue)) {
// Added by Marvin Wang on Nov.7, 2012 for bug TDI-12596, because schema can not
// be
// propagated to metadata db.
dbConn.setUiSchema(newValue);
isModified = true;
} else if (dbConn.getDatasourceName() != null && dbConn.getDatasourceName().equals(oldValue)) {
dbConn.setDatasourceName(newValue);
isModified = true;
} else {
isModified = updateParameters(dbConn, oldValue, newValue);
}
return isModified || compPropertiesResult;
}
private boolean updateFileExcelConnectionParam(FileExcelConnection conn, String oldValue, String newValue) {
boolean isModified = false;
if (conn.getFirstColumn() != null && conn.getFirstColumn().equals(oldValue)) {
conn.setFirstColumn(newValue);
isModified = true;
} else if (conn.getLastColumn() != null && conn.getLastColumn().equals(oldValue)) {
conn.setLastColumn(newValue);
isModified = true;
} else if (conn.getThousandSeparator() != null && conn.getThousandSeparator().equals(oldValue)) {
conn.setThousandSeparator(newValue);
isModified = true;
} else if (conn.getDecimalSeparator() != null && conn.getDecimalSeparator().equals(oldValue)) {
conn.setDecimalSeparator(newValue);
isModified = true;
} else if (conn.getFilePath() != null && conn.getFilePath().equals(oldValue)) {
conn.setFilePath(newValue);
isModified = true;
} else if (conn.getEncoding() != null && conn.getEncoding().equals(oldValue)) {
conn.setEncoding(newValue);
isModified = true;
} else if (conn.getLimitValue() != null && conn.getLimitValue().equals(oldValue)) {
conn.setLimitValue(newValue);
isModified = true;
} else if (conn.getHeaderValue() != null && conn.getHeaderValue().equals(oldValue)) {
conn.setHeaderValue(newValue);
isModified = true;
} else if (conn.getFooterValue() != null && conn.getFooterValue().equals(oldValue)) {
conn.setFooterValue(newValue);
isModified = true;
}
return isModified;
}
private boolean updatDelimitedFileConnectionParam(DelimitedFileConnection conn, String oldValue, String newValue) {
boolean isModified = false;
if (conn.getFilePath() != null && conn.getFilePath().equals(oldValue)) {
conn.setFilePath(newValue);
isModified = true;
} else if (conn.getEncoding() != null && conn.getEncoding().equals(oldValue)) {
conn.setEncoding(newValue);
isModified = true;
} else if (conn.getLimitValue() != null && conn.getLimitValue().equals(oldValue)) {
conn.setLimitValue(newValue);
isModified = true;
} else if (conn.getHeaderValue() != null && conn.getHeaderValue().equals(oldValue)) {
conn.setHeaderValue(newValue);
isModified = true;
} else if (conn.getFooterValue() != null && conn.getFooterValue().equals(oldValue)) {
conn.setFooterValue(newValue);
isModified = true;
} else if (conn.getRowSeparatorValue() != null && conn.getRowSeparatorValue().equals(oldValue)) {
conn.setRowSeparatorValue(newValue);
isModified = true;
} else if (conn.getFieldSeparatorValue() != null && conn.getFieldSeparatorValue().equals(oldValue)) {
conn.setFieldSeparatorValue(newValue);
isModified = true;
}
return isModified;
}
private boolean updateRegexpFileConnectionParam(RegexpFileConnection conn, String oldValue, String newValue) {
boolean isModified = false;
if (conn.getFilePath() != null && conn.getFilePath().equals(oldValue)) {
conn.setFilePath(newValue);
isModified = true;
} else if (conn.getEncoding() != null && conn.getEncoding().equals(oldValue)) {
conn.setEncoding(newValue);
isModified = true;
} else if (conn.getLimitValue() != null && conn.getLimitValue().equals(oldValue)) {
conn.setLimitValue(newValue);
isModified = true;
} else if (conn.getHeaderValue() != null && conn.getHeaderValue().equals(oldValue)) {
conn.setHeaderValue(newValue);
isModified = true;
} else if (conn.getFooterValue() != null && conn.getFooterValue().equals(oldValue)) {
conn.setFooterValue(newValue);
isModified = true;
} else if (conn.getRowSeparatorValue() != null && conn.getRowSeparatorValue().equals(oldValue)) {
conn.setRowSeparatorValue(newValue);
isModified = true;
} else if (conn.getFieldSeparatorValue() != null && conn.getFieldSeparatorValue().equals(oldValue)) {
conn.setFieldSeparatorValue(newValue);
isModified = true;
}
return isModified;
}
private boolean updateLdifFileConnectionParam(LdifFileConnection conn, String oldValue, String newValue) {
boolean isModified = false;
if (conn.getFilePath() != null && conn.getFilePath().equals(oldValue)) {
conn.setFilePath(newValue);
isModified = true;
}
return isModified;
}
private boolean updatePositionalFileConnectionParam(PositionalFileConnection dbConn, String oldValue, String newValue) {
boolean isModified = false;
if (dbConn.getFilePath() != null && dbConn.getFilePath().equals(oldValue)) {
dbConn.setFilePath(newValue);
isModified = true;
} else if (dbConn.getEncoding() != null && dbConn.getEncoding().equals(oldValue)) {
dbConn.setEncoding(newValue);
isModified = true;
} else if (dbConn.getLimitValue() != null && dbConn.getLimitValue().equals(oldValue)) {
dbConn.setLimitValue(newValue);
isModified = true;
} else if (dbConn.getHeaderValue() != null && dbConn.getHeaderValue().equals(oldValue)) {
dbConn.setHeaderValue(newValue);
isModified = true;
} else if (dbConn.getFooterValue() != null && dbConn.getFooterValue().equals(oldValue)) {
dbConn.setFooterValue(newValue);
isModified = true;
} else if (dbConn.getRowSeparatorValue() != null && dbConn.getRowSeparatorValue().equals(oldValue)) {
dbConn.setRowSeparatorValue(newValue);
isModified = true;
} else if (dbConn.getFieldSeparatorValue() != null && dbConn.getFieldSeparatorValue().equals(oldValue)) {
dbConn.setFieldSeparatorValue(newValue);
isModified = true;
}
return isModified;
}
private boolean updateXmlFileConnectionParam(XmlFileConnection dbConn, String oldValue, String newValue) {
boolean isModified = false;
if (dbConn.getXmlFilePath() != null && dbConn.getXmlFilePath().equals(oldValue)) {
dbConn.setXmlFilePath(newValue);
isModified = true;
} else if (dbConn.getEncoding() != null && dbConn.getEncoding().equals(oldValue)) {
dbConn.setEncoding(newValue);
isModified = true;
} else if (dbConn.getOutputFilePath() != null && dbConn.getOutputFilePath().equals(oldValue)) {
dbConn.setOutputFilePath(newValue);
isModified = true;
}
EList schema = dbConn.getSchema();
if (schema != null && schema.size() > 0) {
if (schema.get(0) instanceof XmlXPathLoopDescriptor) {
XmlXPathLoopDescriptor descriptor = (XmlXPathLoopDescriptor) schema.get(0);
if (descriptor.getAbsoluteXPathQuery() != null && descriptor.getAbsoluteXPathQuery().equals(oldValue)) {
descriptor.setAbsoluteXPathQuery(newValue);
isModified = true;
}
}
}
return isModified;
}
private boolean updateSalesforceSchemaConnectionParam(SalesforceSchemaConnection ssConn, String oldValue, String newValue) {
boolean isModified = false;
if (ssConn.getWebServiceUrl() != null && ssConn.getWebServiceUrl().equals(oldValue)) {
ssConn.setWebServiceUrl(newValue);
isModified = true;
} else if (ssConn.getPassword() != null && ssConn.getPassword().equals(oldValue)) {
// in fact, because in context mode. can setPassword directly.
// ssConn.setPassword(ssConn.getValue(newValue,true));
ssConn.setPassword(newValue);
isModified = true;
} else if (ssConn.getUserName() != null && ssConn.getUserName().equals(oldValue)) {
ssConn.setUserName(newValue);
isModified = true;
} else if (ssConn.getTimeOut() != null && ssConn.getTimeOut().equals(oldValue)) {
ssConn.setTimeOut(newValue);
isModified = true;
} else if (ssConn.getBatchSize() != null && ssConn.getBatchSize().equals(oldValue)) {
ssConn.setBatchSize(newValue);
isModified = true;
} else if (ssConn.getQueryCondition() != null && ssConn.getQueryCondition().equals(oldValue)) {
ssConn.setQueryCondition(newValue);
isModified = true;
}
return isModified;
}
private boolean updateWSDLSchemaConnectionParam(WSDLSchemaConnection dbConn, String oldValue, String newValue) {
boolean isModified = false;
if (dbConn.getUserName() != null && dbConn.getUserName().equals(oldValue)) {
dbConn.setUserName(newValue);
isModified = true;
} else if (dbConn.getPassword() != null && dbConn.getPassword().equals(oldValue)) {
dbConn.setPassword(newValue);
isModified = true;
} else if (dbConn.getProxyHost() != null && dbConn.getProxyHost().equals(oldValue)) {
dbConn.setProxyHost(newValue);
isModified = true;
} else if (dbConn.getProxyPassword() != null && dbConn.getProxyPassword().equals(oldValue)) {
dbConn.setProxyPassword(newValue);
isModified = true;
} else if (dbConn.getProxyUser() != null && dbConn.getProxyUser().equals(oldValue)) {
dbConn.setProxyUser(newValue);
isModified = true;
} else if (dbConn.getProxyPort() != null && dbConn.getProxyPort().equals(oldValue)) {
dbConn.setProxyPort(newValue);
isModified = true;
}
return isModified;
}
private boolean updateSAPConnectionParam(SAPConnection sapConn, String oldValue, String newValue) {
boolean isModified = false;
if (sapConn.getClient() != null && sapConn.getClient().equals(oldValue)) {
sapConn.setClient(newValue);
isModified = true;
} else if (sapConn.getUsername() != null && sapConn.getUsername().equals(oldValue)) {
sapConn.setUsername(newValue);
isModified = true;
} else if (sapConn.getPassword() != null && sapConn.getPassword().equals(oldValue)) {
sapConn.setPassword(newValue);
isModified = true;
} else if (sapConn.getHost() != null && sapConn.getHost().equals(oldValue)) {
sapConn.setHost(newValue);
isModified = true;
} else if (sapConn.getSystemNumber() != null && sapConn.getSystemNumber().equals(oldValue)) {
sapConn.setSystemNumber(newValue);
isModified = true;
} else if (sapConn.getLanguage() != null && sapConn.getLanguage().equals(oldValue)) {
sapConn.setLanguage(newValue);
isModified = true;
} else {
for (AdditionalConnectionProperty sapProperty : sapConn.getAdditionalProperties()) {
if (sapProperty.getValue() != null && sapProperty.getValue().equals(oldValue)) {
sapProperty.setValue(newValue);
isModified = true;
}
}
}
return isModified;
}
@Override
public boolean accept(Connection connection) {
if (connection instanceof DatabaseConnection || connection instanceof FileExcelConnection
|| connection instanceof DelimitedFileConnection || connection instanceof RegexpFileConnection
|| connection instanceof LdifFileConnection || connection instanceof PositionalFileConnection
|| connection instanceof XmlFileConnection || connection instanceof SalesforceSchemaConnection
|| connection instanceof WSDLSchemaConnection || connection instanceof SAPConnection) {
return true;
}
return false;
}
}

View File

@@ -21,14 +21,12 @@ import java.util.HashSet;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.EMap;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
@@ -41,11 +39,8 @@ import org.talend.commons.exception.PersistenceException;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.ICoreService;
import org.talend.core.IRepositoryContextUpdateService;
import org.talend.core.IService;
import org.talend.core.ITDQPatternService;
import org.talend.core.ITDQRepositoryService;
import org.talend.core.database.conn.ConnParameterKeys;
import org.talend.core.database.conn.template.EDatabaseConnTemplate;
import org.talend.core.hadoop.BigDataBasicUtil;
import org.talend.core.hadoop.HadoopConstants;
import org.talend.core.hadoop.IHadoopClusterService;
@@ -54,28 +49,23 @@ import org.talend.core.model.context.ContextUtils;
import org.talend.core.model.context.JobContext;
import org.talend.core.model.context.JobContextManager;
import org.talend.core.model.context.JobContextParameter;
import org.talend.core.model.context.link.ContextLink;
import org.talend.core.model.context.link.ContextLinkService;
import org.talend.core.model.context.link.ContextParamLink;
import org.talend.core.model.context.link.ItemContextLink;
import org.talend.core.model.metadata.IMetadataColumn;
import org.talend.core.model.metadata.IMetadataTable;
import org.talend.core.model.metadata.MetadataSchemaType;
import org.talend.core.model.metadata.builder.connection.AdditionalConnectionProperty;
import org.talend.core.model.metadata.builder.connection.Connection;
import org.talend.core.model.metadata.builder.connection.DatabaseConnection;
import org.talend.core.model.metadata.builder.connection.DelimitedFileConnection;
import org.talend.core.model.metadata.builder.connection.FileExcelConnection;
import org.talend.core.model.metadata.builder.connection.GenericSchemaConnection;
import org.talend.core.model.metadata.builder.connection.LdifFileConnection;
import org.talend.core.model.metadata.builder.connection.MetadataTable;
import org.talend.core.model.metadata.builder.connection.PositionalFileConnection;
import org.talend.core.model.metadata.builder.connection.QueriesConnection;
import org.talend.core.model.metadata.builder.connection.Query;
import org.talend.core.model.metadata.builder.connection.RegexpFileConnection;
import org.talend.core.model.metadata.builder.connection.SAPConnection;
import org.talend.core.model.metadata.builder.connection.SAPFunctionUnit;
import org.talend.core.model.metadata.builder.connection.SAPIDocUnit;
import org.talend.core.model.metadata.builder.connection.SalesforceSchemaConnection;
import org.talend.core.model.metadata.builder.connection.WSDLSchemaConnection;
import org.talend.core.model.metadata.builder.connection.XmlFileConnection;
import org.talend.core.model.metadata.builder.connection.XmlXPathLoopDescriptor;
import org.talend.core.model.process.IContext;
import org.talend.core.model.process.IContextManager;
import org.talend.core.model.process.IContextParameter;
@@ -94,10 +84,12 @@ 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.update.extension.UpdateManagerProviderDetector;
import org.talend.core.model.utils.ContextParameterUtils;
import org.talend.core.model.utils.UpdateRepositoryHelper;
import org.talend.core.prefs.ITalendCorePrefConstants;
import org.talend.core.runtime.CoreRuntimePlugin;
import org.talend.core.runtime.i18n.Messages;
import org.talend.core.runtime.services.IGenericDBService;
import org.talend.core.service.IMRProcessService;
import org.talend.core.service.IMetadataManagmentService;
import org.talend.core.service.IStormProcessService;
@@ -110,7 +102,6 @@ import org.talend.designer.core.model.utils.emf.talendfile.ContextParameterType;
import org.talend.designer.core.model.utils.emf.talendfile.ContextType;
import org.talend.designer.runprocess.ItemCacheManager;
import org.talend.repository.model.IProxyRepositoryFactory;
import org.talend.repository.model.IProxyRepositoryService;
import org.talend.repository.model.IRepositoryService;
import org.talend.repository.model.RepositoryNode;
@@ -119,6 +110,12 @@ import org.talend.repository.model.RepositoryNode;
*/
public abstract class RepositoryUpdateManager {
private static final Logger LOGGER = Logger.getLogger(RepositoryUpdateManager.class);
private static final IProxyRepositoryFactory FACTORY = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
private static List<IRepositoryContextUpdateService> CONTEXT_UPDATE_SERVICE_LIST = null;
/**
* for repository context rename.
*/
@@ -147,7 +144,7 @@ public abstract class RepositoryUpdateManager {
*/
protected Object parameter;
private Map<ContextItem, Set<String>> newParametersMap = new HashMap<ContextItem, Set<String>>();
private Map<Item, Set<String>> newParametersMap = new HashMap<Item, Set<String>>();
private boolean onlyOpeningJob = false;
@@ -279,7 +276,7 @@ public abstract class RepositoryUpdateManager {
private boolean openRenameCheckedDialog() {
return MessageDialog.openQuestion(Display.getCurrent().getActiveShell(),
Messages.getString("RepositoryUpdateManager.RenameContextTitle"), //$NON-NLS-1$
Messages.getString("RepositoryUpdateManager.RenameContextMessages")); //$NON-NLS-1$
Messages.getString("RepositoryUpdateManager.RenameContextMessagesNoBuiltIn")); //$NON-NLS-1$
}
@@ -288,7 +285,7 @@ public abstract class RepositoryUpdateManager {
}
public boolean needForcePropagation() {
return needForcePropagationForContext() || (getSchemaRenamedMap() != null && !getSchemaRenamedMap().isEmpty());
return getSchemaRenamedMap() != null && !getSchemaRenamedMap().isEmpty();
}
private boolean needForcePropagationForContext() {
@@ -687,469 +684,191 @@ public abstract class RepositoryUpdateManager {
if (valueMap == null) {
return;
}
Set<String> set = valueMap.keySet();
List<String> list = new ArrayList<String>(set);
IProxyRepositoryFactory factory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
for (String newValue : list) {
String oldValue = valueMap.get(newValue);
oldValue = "context." + oldValue;
newValue = "context." + newValue;
List<IRepositoryViewObject> dbConnList = factory.getAll(ERepositoryObjectType.METADATA_CONNECTIONS, true);
for (IRepositoryViewObject obj : dbConnList) {
Item item = obj.getProperty().getItem();
if (item instanceof ConnectionItem) {
Connection conn = ((ConnectionItem) item).getConnection();
if (conn.isContextMode()) {
ContextItem contextItem = ContextUtils.getContextItemById2(conn.getContextId());
if (contextItem == null) {
continue;
}
if (citem == contextItem) {
if (conn instanceof DatabaseConnection) {
DatabaseConnection dbConn = (DatabaseConnection) conn;
if (dbConn.getAdditionalParams() != null && dbConn.getAdditionalParams().equals(oldValue)) {
dbConn.setAdditionalParams(newValue);
} else if (dbConn.getUsername() != null && dbConn.getUsername().equals(oldValue)) {
dbConn.setUsername(newValue);
} else if (dbConn.getPassword() != null && dbConn.getPassword().equals(oldValue)) {
dbConn.setPassword(newValue);
} else if (dbConn.getServerName() != null && dbConn.getServerName().equals(oldValue)) {
dbConn.setServerName(newValue);
} else if (dbConn.getPort() != null && dbConn.getPort().equals(oldValue)) {
dbConn.setPort(newValue);
} else if (dbConn.getSID() != null && dbConn.getSID().equals(oldValue)) {
dbConn.setSID(newValue);
} else if (dbConn.getDbmsId() != null && dbConn.getDbmsId().equals(oldValue)) {
dbConn.setDbmsId(newValue);
} else if (dbConn.getDriverClass() != null && dbConn.getDriverClass().equals(oldValue)) {
dbConn.setDriverClass(newValue);
} else if (dbConn.getDriverJarPath() != null && dbConn.getDriverJarPath().equals(oldValue)) {
dbConn.setDriverJarPath(newValue);
} else if (dbConn.getURL() != null && dbConn.getURL().equals(oldValue)) {
dbConn.setURL(newValue);
} else if (dbConn.getUiSchema() != null && dbConn.getUiSchema().equals(oldValue)) {
// Added by Marvin Wang on Nov.7, 2012 for bug TDI-12596, because schema can not be
// propagated to metadata db.
dbConn.setUiSchema(newValue);
} else {
updateParameters(dbConn, oldValue, newValue);
}
factory.save(item);
}
}
}
}
List<IRepositoryViewObject> dbConnList = FACTORY.getAll(ERepositoryObjectType.METADATA_CONNECTIONS, true);
for (IRepositoryViewObject obj : dbConnList) {
Item item = obj.getProperty().getItem();
if (item instanceof ConnectionItem) {
updateConnectionContextParam((ConnectionItem) item, citem, valueMap);
}
List<IRepositoryViewObject> excelConnList = factory.getAll(ERepositoryObjectType.METADATA_FILE_EXCEL, true);
for (IRepositoryViewObject obj : excelConnList) {
Item item = obj.getProperty().getItem();
if (item instanceof ConnectionItem) {
Connection conn = ((ConnectionItem) item).getConnection();
if (conn.isContextMode()) {
ContextItem contextItem = ContextUtils.getContextItemById2(conn.getContextId());
if (contextItem == null) {
continue;
}
if (citem == contextItem) {
if (conn instanceof FileExcelConnection) {
if (((FileExcelConnection) conn).getFirstColumn() != null
&& ((FileExcelConnection) conn).getFirstColumn().equals(oldValue)) {
((FileExcelConnection) conn).setFirstColumn(newValue);
} else if (((FileExcelConnection) conn).getLastColumn() != null
&& ((FileExcelConnection) conn).getLastColumn().equals(oldValue)) {
((FileExcelConnection) conn).setLastColumn(newValue);
} else if (((FileExcelConnection) conn).getThousandSeparator() != null
&& ((FileExcelConnection) conn).getThousandSeparator().equals(oldValue)) {
((FileExcelConnection) conn).setThousandSeparator(newValue);
} else if (((FileExcelConnection) conn).getDecimalSeparator() != null
&& ((FileExcelConnection) conn).getDecimalSeparator().equals(oldValue)) {
((FileExcelConnection) conn).setDecimalSeparator(newValue);
} else if (((FileExcelConnection) conn).getFilePath() != null
&& ((FileExcelConnection) conn).getFilePath().equals(oldValue)) {
((FileExcelConnection) conn).setFilePath(newValue);
} else if (((FileExcelConnection) conn).getEncoding() != null
&& ((FileExcelConnection) conn).getEncoding().equals(oldValue)) {
((FileExcelConnection) conn).setEncoding(newValue);
} else if (((FileExcelConnection) conn).getLimitValue() != null
&& ((FileExcelConnection) conn).getLimitValue().equals(oldValue)) {
((FileExcelConnection) conn).setLimitValue(newValue);
} else if (((FileExcelConnection) conn).getHeaderValue() != null
&& ((FileExcelConnection) conn).getHeaderValue().equals(oldValue)) {
((FileExcelConnection) conn).setHeaderValue(newValue);
} else if (((FileExcelConnection) conn).getFooterValue() != null
&& ((FileExcelConnection) conn).getFooterValue().equals(oldValue)) {
((FileExcelConnection) conn).setFooterValue(newValue);
}
factory.save(item);
}
}
}
}
}
List<IRepositoryViewObject> excelConnList = FACTORY.getAll(ERepositoryObjectType.METADATA_FILE_EXCEL, true);
for (IRepositoryViewObject obj : excelConnList) {
Item item = obj.getProperty().getItem();
if (item instanceof ConnectionItem) {
updateConnectionContextParam((ConnectionItem) item, citem, valueMap);
}
}
List<IRepositoryViewObject> deliConnList = factory.getAll(ERepositoryObjectType.METADATA_FILE_DELIMITED, true);
for (IRepositoryViewObject obj : deliConnList) {
Item item = obj.getProperty().getItem();
if (item instanceof ConnectionItem) {
Connection conn = ((ConnectionItem) item).getConnection();
if (conn.isContextMode()) {
ContextItem contextItem = ContextUtils.getContextItemById2(conn.getContextId());
if (contextItem == null) {
continue;
}
if (citem == contextItem) {
if (conn instanceof DelimitedFileConnection) {
if (((DelimitedFileConnection) conn).getFilePath() != null
&& ((DelimitedFileConnection) conn).getFilePath().equals(oldValue)) {
((DelimitedFileConnection) conn).setFilePath(newValue);
} else if (((DelimitedFileConnection) conn).getEncoding() != null
&& ((DelimitedFileConnection) conn).getEncoding().equals(oldValue)) {
((DelimitedFileConnection) conn).setEncoding(newValue);
} else if (((DelimitedFileConnection) conn).getLimitValue() != null
&& ((DelimitedFileConnection) conn).getLimitValue().equals(oldValue)) {
((DelimitedFileConnection) conn).setLimitValue(newValue);
} else if (((DelimitedFileConnection) conn).getHeaderValue() != null
&& ((DelimitedFileConnection) conn).getHeaderValue().equals(oldValue)) {
((DelimitedFileConnection) conn).setHeaderValue(newValue);
} else if (((DelimitedFileConnection) conn).getFooterValue() != null
&& ((DelimitedFileConnection) conn).getFooterValue().equals(oldValue)) {
((DelimitedFileConnection) conn).setFooterValue(newValue);
} else if (((DelimitedFileConnection) conn).getRowSeparatorValue() != null
&& ((DelimitedFileConnection) conn).getRowSeparatorValue().equals(oldValue)) {
((DelimitedFileConnection) conn).setRowSeparatorValue(newValue);
} else if (((DelimitedFileConnection) conn).getFieldSeparatorValue() != null
&& ((DelimitedFileConnection) conn).getFieldSeparatorValue().equals(oldValue)) {
((DelimitedFileConnection) conn).setFieldSeparatorValue(newValue);
}
factory.save(item);
}
List<IRepositoryViewObject> deliConnList = FACTORY.getAll(ERepositoryObjectType.METADATA_FILE_DELIMITED, true);
for (IRepositoryViewObject obj : deliConnList) {
Item item = obj.getProperty().getItem();
if (item instanceof ConnectionItem) {
updateConnectionContextParam((ConnectionItem) item, citem, valueMap);
}
}
List<IRepositoryViewObject> regConnList = FACTORY.getAll(ERepositoryObjectType.METADATA_FILE_REGEXP, true);
for (IRepositoryViewObject obj : regConnList) {
Item item = obj.getProperty().getItem();
if (item instanceof ConnectionItem) {
updateConnectionContextParam((ConnectionItem) item, citem, valueMap);
}
}
List<IRepositoryViewObject> ldifConnList = FACTORY.getAll(ERepositoryObjectType.METADATA_FILE_LDIF, true);
for (IRepositoryViewObject obj : ldifConnList) {
Item item = obj.getProperty().getItem();
if (item instanceof ConnectionItem) {
updateConnectionContextParam((ConnectionItem) item, citem, valueMap);
}
}
List<IRepositoryViewObject> posiConnList = FACTORY.getAll(ERepositoryObjectType.METADATA_FILE_POSITIONAL, true);
for (IRepositoryViewObject obj : posiConnList) {
Item item = obj.getProperty().getItem();
if (item instanceof ConnectionItem) {
updateConnectionContextParam((ConnectionItem) item, citem, valueMap);
}
}
List<IRepositoryViewObject> xmlConnList = FACTORY.getAll(ERepositoryObjectType.METADATA_FILE_XML, true);
for (IRepositoryViewObject obj : xmlConnList) {
Item item = obj.getProperty().getItem();
if (item instanceof ConnectionItem) {
updateConnectionContextParam((ConnectionItem) item, citem, valueMap);
}
}
List<IRepositoryViewObject> saleConnList = FACTORY.getAll(ERepositoryObjectType.METADATA_SALESFORCE_SCHEMA, true);
for (IRepositoryViewObject obj : saleConnList) {
Item item = obj.getProperty().getItem();
if (item instanceof ConnectionItem) {
updateConnectionContextParam((ConnectionItem) item, citem, valueMap);
}
}
List<IRepositoryViewObject> wsdlConnList = FACTORY.getAll(ERepositoryObjectType.METADATA_WSDL_SCHEMA, true);
for (IRepositoryViewObject obj : wsdlConnList) {
Item item = obj.getProperty().getItem();
if (item instanceof ConnectionItem) {
updateConnectionContextParam((ConnectionItem) item, citem, valueMap);
}
}
}
}
}
List<IRepositoryViewObject> sapConnList = FACTORY.getAll(ERepositoryObjectType.METADATA_SAPCONNECTIONS, true);
for (IRepositoryViewObject obj : sapConnList) {
Item item = obj.getProperty().getItem();
if (item instanceof ConnectionItem) {
updateConnectionContextParam((ConnectionItem) item, citem, valueMap);
}
List<IRepositoryViewObject> regConnList = factory.getAll(ERepositoryObjectType.METADATA_FILE_REGEXP, true);
for (IRepositoryViewObject obj : regConnList) {
}
for (String updateType : UpdateRepositoryHelper.getAllHadoopConnectionTypes()) {
List<IRepositoryViewObject> hadoopConnList = FACTORY
.getAll(ERepositoryObjectType.valueOf(ERepositoryObjectType.class, updateType), true);
for (IRepositoryViewObject obj : hadoopConnList) {
Item item = obj.getProperty().getItem();
if (item instanceof ConnectionItem) {
Connection conn = ((ConnectionItem) item).getConnection();
if (conn.isContextMode()) {
ContextItem contextItem = ContextUtils.getContextItemById2(conn.getContextId());
if (contextItem == null) {
continue;
}
if (citem == contextItem) {
if (conn instanceof RegexpFileConnection) {
if (((RegexpFileConnection) conn).getFilePath() != null
&& ((RegexpFileConnection) conn).getFilePath().equals(oldValue)) {
((RegexpFileConnection) conn).setFilePath(newValue);
} else if (((RegexpFileConnection) conn).getEncoding() != null
&& ((RegexpFileConnection) conn).getEncoding().equals(oldValue)) {
((RegexpFileConnection) conn).setEncoding(newValue);
} else if (((RegexpFileConnection) conn).getLimitValue() != null
&& ((RegexpFileConnection) conn).getLimitValue().equals(oldValue)) {
((RegexpFileConnection) conn).setLimitValue(newValue);
} else if (((RegexpFileConnection) conn).getHeaderValue() != null
&& ((RegexpFileConnection) conn).getHeaderValue().equals(oldValue)) {
((RegexpFileConnection) conn).setHeaderValue(newValue);
} else if (((RegexpFileConnection) conn).getFooterValue() != null
&& ((RegexpFileConnection) conn).getFooterValue().equals(oldValue)) {
((RegexpFileConnection) conn).setFooterValue(newValue);
} else if (((RegexpFileConnection) conn).getRowSeparatorValue() != null
&& ((RegexpFileConnection) conn).getRowSeparatorValue().equals(oldValue)) {
((RegexpFileConnection) conn).setRowSeparatorValue(newValue);
} else if (((RegexpFileConnection) conn).getFieldSeparatorValue() != null
&& ((RegexpFileConnection) conn).getFieldSeparatorValue().equals(oldValue)) {
((RegexpFileConnection) conn).setFieldSeparatorValue(newValue);
}
factory.save(item);
}
updateConnectionContextParam((ConnectionItem) item, citem, valueMap);
}
}
}
}
}
}
}
List<IRepositoryViewObject> ldifConnList = factory.getAll(ERepositoryObjectType.METADATA_FILE_LDIF, true);
for (IRepositoryViewObject obj : ldifConnList) {
Item item = obj.getProperty().getItem();
if (item instanceof ConnectionItem) {
Connection conn = ((ConnectionItem) item).getConnection();
if (conn.isContextMode()) {
ContextItem contextItem = ContextUtils.getContextItemById2(conn.getContextId());
if (contextItem == null) {
continue;
}
if (citem == contextItem) {
if (conn instanceof LdifFileConnection) {
LdifFileConnection dbConn = (LdifFileConnection) conn;
if (dbConn.getFilePath() != null && dbConn.getFilePath().equals(oldValue)) {
dbConn.setFilePath(newValue);
}
factory.save(item);
}
}
}
}
}
List<IRepositoryViewObject> posiConnList = factory.getAll(ERepositoryObjectType.METADATA_FILE_POSITIONAL, true);
for (IRepositoryViewObject obj : posiConnList) {
Item item = obj.getProperty().getItem();
if (item instanceof ConnectionItem) {
Connection conn = ((ConnectionItem) item).getConnection();
if (conn.isContextMode()) {
ContextItem contextItem = ContextUtils.getContextItemById2(conn.getContextId());
if (contextItem == null) {
continue;
}
if (citem == contextItem) {
if (conn instanceof PositionalFileConnection) {
PositionalFileConnection dbConn = (PositionalFileConnection) conn;
if (dbConn.getFilePath() != null && dbConn.getFilePath().equals(oldValue)) {
dbConn.setFilePath(newValue);
} else if (dbConn.getEncoding() != null && dbConn.getEncoding().equals(oldValue)) {
dbConn.setEncoding(newValue);
} else if (dbConn.getLimitValue() != null && dbConn.getLimitValue().equals(oldValue)) {
dbConn.setLimitValue(newValue);
} else if (dbConn.getHeaderValue() != null && dbConn.getHeaderValue().equals(oldValue)) {
dbConn.setHeaderValue(newValue);
} else if (dbConn.getFooterValue() != null && dbConn.getFooterValue().equals(oldValue)) {
dbConn.setFooterValue(newValue);
} else if (dbConn.getRowSeparatorValue() != null
&& dbConn.getRowSeparatorValue().equals(oldValue)) {
dbConn.setRowSeparatorValue(newValue);
} else if (dbConn.getFieldSeparatorValue() != null
&& dbConn.getFieldSeparatorValue().equals(oldValue)) {
dbConn.setFieldSeparatorValue(newValue);
}
factory.save(item);
}
}
}
}
}
List<IRepositoryViewObject> xmlConnList = factory.getAll(ERepositoryObjectType.METADATA_FILE_XML, true);
for (IRepositoryViewObject obj : xmlConnList) {
Item item = obj.getProperty().getItem();
if (item instanceof ConnectionItem) {
Connection conn = ((ConnectionItem) item).getConnection();
if (conn.isContextMode()) {
ContextItem contextItem = ContextUtils.getContextItemById2(conn.getContextId());
if (contextItem == null) {
continue;
}
if (citem == contextItem) {
if (conn instanceof XmlFileConnection) {
XmlFileConnection dbConn = (XmlFileConnection) conn;
if (dbConn.getXmlFilePath() != null && dbConn.getXmlFilePath().equals(oldValue)) {
dbConn.setXmlFilePath(newValue);
} else if (dbConn.getEncoding() != null && dbConn.getEncoding().equals(oldValue)) {
dbConn.setEncoding(newValue);
} else if (dbConn.getOutputFilePath() != null && dbConn.getOutputFilePath().equals(oldValue)) {
dbConn.setOutputFilePath(newValue);
}
EList schema = dbConn.getSchema();
if (schema != null && schema.size() > 0) {
if (schema.get(0) instanceof XmlXPathLoopDescriptor) {
XmlXPathLoopDescriptor descriptor = (XmlXPathLoopDescriptor) schema.get(0);
if (descriptor.getAbsoluteXPathQuery() != null
&& descriptor.getAbsoluteXPathQuery().equals(oldValue)) {
descriptor.setAbsoluteXPathQuery(newValue);
}
}
}
factory.save(item);
}
}
}
}
}
List<IRepositoryViewObject> saleConnList = factory.getAll(ERepositoryObjectType.METADATA_SALESFORCE_SCHEMA, true);
for (IRepositoryViewObject obj : saleConnList) {
Item item = obj.getProperty().getItem();
if (item instanceof ConnectionItem) {
Connection conn = ((ConnectionItem) item).getConnection();
if (conn.isContextMode()) {
ContextItem contextItem = ContextUtils.getContextItemById2(conn.getContextId());
if (contextItem == null) {
continue;
}
if (citem == contextItem) {
if (conn instanceof SalesforceSchemaConnection) {
SalesforceSchemaConnection ssConn = (SalesforceSchemaConnection) conn;
if (ssConn.getWebServiceUrl() != null && ssConn.getWebServiceUrl().equals(oldValue)) {
ssConn.setWebServiceUrl(newValue);
} else if (ssConn.getPassword() != null && ssConn.getPassword().equals(oldValue)) {
// in fact, because in context mode. can setPassword directly.
// ssConn.setPassword(ssConn.getValue(newValue,true));
ssConn.setPassword(newValue);
} else if (ssConn.getUserName() != null && ssConn.getUserName().equals(oldValue)) {
ssConn.setUserName(newValue);
} else if (ssConn.getTimeOut() != null && ssConn.getTimeOut().equals(oldValue)) {
ssConn.setTimeOut(newValue);
} else if (ssConn.getBatchSize() != null && ssConn.getBatchSize().equals(oldValue)) {
ssConn.setBatchSize(newValue);
} else if (ssConn.getQueryCondition() != null && ssConn.getQueryCondition().equals(oldValue)) {
ssConn.setQueryCondition(newValue);
}
factory.save(item);
}
}
}
}
}
List<IRepositoryViewObject> wsdlConnList = factory.getAll(ERepositoryObjectType.METADATA_WSDL_SCHEMA, true);
for (IRepositoryViewObject obj : wsdlConnList) {
Item item = obj.getProperty().getItem();
if (item instanceof ConnectionItem) {
Connection conn = ((ConnectionItem) item).getConnection();
if (conn.isContextMode()) {
ContextItem contextItem = ContextUtils.getContextItemById2(conn.getContextId());
if (contextItem == null) {
continue;
}
if (citem == contextItem) {
if (conn instanceof WSDLSchemaConnection) {
WSDLSchemaConnection dbConn = (WSDLSchemaConnection) conn;
if (dbConn.getUserName() != null && dbConn.getUserName().equals(oldValue)) {
dbConn.setUserName(newValue);
} else if (dbConn.getPassword() != null && dbConn.getPassword().equals(oldValue)) {
dbConn.setPassword(newValue);
} else if (dbConn.getProxyHost() != null && dbConn.getProxyHost().equals(oldValue)) {
dbConn.setProxyHost(newValue);
} else if (dbConn.getProxyPassword() != null && dbConn.getProxyPassword().equals(oldValue)) {
dbConn.setProxyPassword(newValue);
} else if (dbConn.getProxyUser() != null && dbConn.getProxyUser().equals(oldValue)) {
dbConn.setProxyUser(newValue);
} else if (dbConn.getProxyPort() != null && dbConn.getProxyPort().equals(oldValue)) {
dbConn.setProxyPort(newValue);
}
factory.save(item);
}
}
}
}
}
List<IRepositoryViewObject> sapConnList = factory.getAll(ERepositoryObjectType.METADATA_SAPCONNECTIONS, true);
for (IRepositoryViewObject obj : sapConnList) {
Item item = obj.getProperty().getItem();
if (item instanceof ConnectionItem) {
Connection conn = ((ConnectionItem) item).getConnection();
if (conn.isContextMode()) {
ContextItem contextItem = ContextUtils.getContextItemById2(conn.getContextId());
if (contextItem == null) {
continue;
}
if (citem == contextItem) {
if (conn instanceof SAPConnection) {
SAPConnection sapConn = (SAPConnection) conn;
if (sapConn.getClient() != null && sapConn.getClient().equals(oldValue)) {
sapConn.setClient(newValue);
} else if (sapConn.getUsername() != null && sapConn.getUsername().equals(oldValue)) {
sapConn.setUsername(newValue);
} else if (sapConn.getPassword() != null && sapConn.getPassword().equals(oldValue)) {
sapConn.setPassword(newValue);
} else if (sapConn.getHost() != null && sapConn.getHost().equals(oldValue)) {
sapConn.setHost(newValue);
} else if (sapConn.getSystemNumber() != null && sapConn.getSystemNumber().equals(oldValue)) {
sapConn.setSystemNumber(newValue);
} else if (sapConn.getLanguage() != null && sapConn.getLanguage().equals(oldValue)) {
sapConn.setLanguage(newValue);
} else {
for (AdditionalConnectionProperty sapProperty : sapConn.getAdditionalProperties()) {
if (sapProperty.getValue() != null && sapProperty.getValue().equals(oldValue)) {
sapProperty.setValue(newValue);
}
}
}
factory.save(item);
}
}
}
}
}
for (String updateType : UpdateRepositoryHelper.getAllHadoopConnectionTypes()) {
List<IRepositoryViewObject> hadoopConnList = factory
.getAll(ERepositoryObjectType.valueOf(ERepositoryObjectType.class, updateType), true);
for (IRepositoryViewObject obj : hadoopConnList) {
Item item = obj.getProperty().getItem();
if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericDBService.class)) {
IGenericDBService service = GlobalServiceRegister.getDefault().getService(IGenericDBService.class);
for (ERepositoryObjectType objectType : service.getAllGenericMetadataDBRepositoryType()) {
List<IRepositoryViewObject> repositoryObjects = FACTORY.getAll(objectType);
for (IRepositoryViewObject object : repositoryObjects) {
Item item = object.getProperty().getItem();
if (item instanceof ConnectionItem) {
Connection conn = ((ConnectionItem) item).getConnection();
if (conn.isContextMode()) {
ContextItem contextItem = ContextUtils.getContextItemById2(conn.getContextId());
if (contextItem == null) {
continue;
}
if (citem == contextItem) {
if (GlobalServiceRegister.getDefault()
.isServiceRegistered(IRepositoryContextUpdateService.class)) {
IService service = GlobalServiceRegister.getDefault()
.getService(IRepositoryContextUpdateService.class);
IRepositoryContextUpdateService repositoryContextUpdateService = (IRepositoryContextUpdateService) service;
repositoryContextUpdateService.updateRelatedContextVariable(conn, oldValue, newValue);
}
factory.save(item);
updateConnectionContextParam((ConnectionItem) item, citem, valueMap);
}
}
}
}
}
private static void updateConnectionContextParam(ConnectionItem conntectionItem, ContextItem citem,
Map<String, String> newToOldValueMap) throws PersistenceException {
boolean isModified = false;
if (conntectionItem != null && conntectionItem.getConnection() != null && citem != null
&& citem.getProperty() != null
&& StringUtils.equals(conntectionItem.getConnection().getContextId(), citem.getProperty().getId())) {
for (String newValue : newToOldValueMap.keySet()) {
String oldValue = newToOldValueMap.get(newValue);
boolean result = updateConnectionContextParam(conntectionItem, oldValue, newValue);
isModified = isModified || result;
}
if (isModified) {
FACTORY.save(conntectionItem, false);
}
}
}
private static boolean updateConnectionContextParam(ConnectionItem conntectionItem, String oldValue, String newValue) {
Connection conn = conntectionItem.getConnection();
if (conn.isContextMode()) {
IRepositoryContextUpdateService updater = null;
updater = findContextParameterUpdater(conn);
if (updater != null) {
return updater.updateContextParameter(conn, addContextParamPrefix(oldValue), addContextParamPrefix(newValue));
}
}
return false;
}
public static void updateConnectionContextParam(RepositoryNode connNode) throws PersistenceException {
if (connNode.getObject() == null || connNode.getObject().getProperty() == null
|| connNode.getObject().getProperty().getItem() == null) {
return;
}
ConnectionItem conntectionItem = (ConnectionItem) connNode.getObject().getProperty().getItem();
updateConnectionContextParam(conntectionItem);
}
public static void updateConnectionContextParam(ConnectionItem conntectionItem)
throws PersistenceException {
Connection conn = conntectionItem.getConnection();
if (conn.isContextMode()) {
ContextItem contextItem = ContextUtils.getContextItemById2(conn.getContextId());
ItemContextLink itemContextLink = null;
try {
itemContextLink = ContextLinkService.getInstance().loadContextLinkFromJson(conntectionItem);
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
ContextLink contextLink = null;
if (itemContextLink != null) {
contextLink = itemContextLink.findContextLink(null, conn.getContextName());
}
if (contextLink != null) {
ContextType contextType = ContextUtils.getContextTypeByName(contextItem, conn.getContextName(), false);
IRepositoryContextUpdateService updateServce = findContextParameterUpdater(conn);
if (updateServce != null) {
boolean isModified = false;
for (ContextParamLink paramLink : contextLink.getParameterList()) {
ContextParameterType paramType = ContextUtils.getContextParameterTypeByName(contextType,
paramLink.getName());
if (paramType == null) {
paramType = ContextUtils.getContextParameterTypeById(contextType, paramLink.getId(), true);
if (paramType != null) {
boolean result = updateServce.updateContextParameter(conn,
addContextParamPrefix(paramLink.getName()), addContextParamPrefix(paramType.getName()));
isModified = isModified || result;
}
}
}
}
}
}
}
private void updateParameters(DatabaseConnection dbConn, String oldValue, String newValue) {
EMap<String, String> parameters = dbConn.getParameters();
if (parameters != null && !parameters.isEmpty()) {
for (Entry<String, String> entry : parameters.entrySet()) {
if (entry != null) {
String value = entry.getValue();
if (StringUtils.equals(value, oldValue)) {
entry.setValue(newValue);
if (isModified) {
FACTORY.save(conntectionItem, false);
}
}
}
}
updateHadoopPropertiesForDbConnection(dbConn, oldValue, newValue);
}
private void updateHadoopPropertiesForDbConnection(DatabaseConnection dbConn, String oldValue, String newValue) {
EMap<String, String> parameters = dbConn.getParameters();
String databaseType = parameters.get(ConnParameterKeys.CONN_PARA_KEY_DB_TYPE);
String hadoopProperties = "";
if (databaseType != null) {
if (EDatabaseConnTemplate.HIVE.getDBDisplayName().equals(databaseType)) {
hadoopProperties = parameters.get(ConnParameterKeys.CONN_PARA_KEY_HIVE_PROPERTIES);
} else if (EDatabaseConnTemplate.HBASE.getDBDisplayName().equals(databaseType)) {
hadoopProperties = parameters.get(ConnParameterKeys.CONN_PARA_KEY_HBASE_PROPERTIES);
} else if (EDatabaseConnTemplate.MAPRDB.getDBDisplayName().equals(databaseType)) {
hadoopProperties = parameters.get(ConnParameterKeys.CONN_PARA_KEY_MAPRDB_PROPERTIES);
}
List<Map<String, Object>> hadoopPropertiesList = HadoopRepositoryUtil.getHadoopPropertiesList(hadoopProperties);
if (!hadoopPropertiesList.isEmpty()) {
for (Map<String, Object> propertyMap : hadoopPropertiesList) {
String propertyValue = (String) propertyMap.get("VALUE");
if (propertyValue.equals(oldValue)) {
propertyMap.put("VALUE", newValue);
}
}
String hadoopPropertiesJson = HadoopRepositoryUtil.getHadoopPropertiesJsonStr(hadoopPropertiesList);
if (EDatabaseConnTemplate.HIVE.getDBDisplayName().equals(databaseType)) {
dbConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_HIVE_PROPERTIES, hadoopPropertiesJson);
} else if (EDatabaseConnTemplate.HBASE.getDBDisplayName().equals(databaseType)) {
dbConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_HBASE_PROPERTIES, hadoopPropertiesJson);
} else if (EDatabaseConnTemplate.MAPRDB.getDBDisplayName().equals(databaseType)) {
dbConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_MAPRDB_PROPERTIES, hadoopPropertiesJson);
}
}
private static String addContextParamPrefix(String value) {
if (!value.startsWith(ContextParameterUtils.JAVA_NEW_CONTEXT_PREFIX)) {
value = ContextParameterUtils.JAVA_NEW_CONTEXT_PREFIX + value;
}
return value;
}
public static IEditorReference[] getEditors() {
if (CommonsPlugin.isHeadless() || !getProxyRepositoryFactory().isFullLogonFinished()) {
if (CommonsPlugin.isHeadless() || !FACTORY.isFullLogonFinished()) {
return new IEditorReference[0];
}
final List<IEditorReference> list = new ArrayList<IEditorReference>();
@@ -1245,6 +964,7 @@ public abstract class RepositoryUpdateManager {
jobParam.setSource(repositoryId);
jobParam.setType(repoParam.getType());
jobParam.setValue(repoParam.getValue());
jobParam.setInternalId(repoParam.getInternalId());
jobContext.getContextParameterList().add(jobParam);
}
addContextGroupList.add(jobContext);
@@ -1529,7 +1249,6 @@ public abstract class RepositoryUpdateManager {
*/
public static boolean updateServices(ConnectionItem connectionItem, boolean show, final boolean onlySimpleShow) {
List<IRepositoryViewObject> updateList = new ArrayList<IRepositoryViewObject>();
IProxyRepositoryFactory factory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
List<Relation> relations = RelationshipItemBuilder.getInstance().getItemsRelatedTo(connectionItem.getProperty().getId(),
RelationshipItemBuilder.LATEST_VERSION, RelationshipItemBuilder.SERVICES_RELATION);
@@ -1623,7 +1342,6 @@ public abstract class RepositoryUpdateManager {
* @return
*/
public static boolean updateValidationRuleConnection(ConnectionItem connectionItem, boolean show, boolean onlySimpleShow) {
IProxyRepositoryFactory factory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
List<IRepositoryViewObject> updateList = new ArrayList<IRepositoryViewObject>();
List<Relation> relations = RelationshipItemBuilder.getInstance().getItemsRelatedTo(connectionItem.getProperty().getId(),
RelationshipItemBuilder.LATEST_VERSION, RelationshipItemBuilder.VALIDATION_RULE_RELATION);
@@ -1977,7 +1695,6 @@ public abstract class RepositoryUpdateManager {
public static boolean updateWSDLConnection(ConnectionItem connectionItem, boolean show, final boolean onlySimpleShow) {
List<IRepositoryViewObject> updateList = new ArrayList<IRepositoryViewObject>();
IProxyRepositoryFactory factory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
List<Relation> relations = RelationshipItemBuilder.getInstance().getItemsRelatedTo(connectionItem.getProperty().getId(),
RelationshipItemBuilder.LATEST_VERSION, RelationshipItemBuilder.PROPERTY_RELATION);
@@ -2062,7 +1779,6 @@ public abstract class RepositoryUpdateManager {
* @return
*/
public static boolean updateSAPFunction(final SAPFunctionUnit sapFunction, boolean show, boolean onlySimpleShow) {
IProxyRepositoryFactory factory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
List<IRepositoryViewObject> updateList = new ArrayList<IRepositoryViewObject>();
List<Relation> relations = RelationshipItemBuilder.getInstance().getItemsRelatedTo(sapFunction.getId(),
RelationshipItemBuilder.LATEST_VERSION, RelationshipItemBuilder.PROPERTY_RELATION);
@@ -2091,8 +1807,6 @@ public abstract class RepositoryUpdateManager {
* @return
*/
public static boolean updateSAPIDoc(final SAPIDocUnit sapIDoc, boolean show, boolean onlySimpleShow) {
IProxyRepositoryFactory factory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
List<IRepositoryViewObject> updateList = new ArrayList<IRepositoryViewObject>();
List<Relation> relations = RelationshipItemBuilder.getInstance().getItemsRelatedTo(sapIDoc.getId(),
RelationshipItemBuilder.LATEST_VERSION, RelationshipItemBuilder.PROPERTY_RELATION);
@@ -2151,8 +1865,6 @@ public abstract class RepositoryUpdateManager {
protected static boolean updateSchema(final Object table, ConnectionItem connItem, Map<String, String> schemaRenamedMap,
boolean show, boolean onlySimpleShow) {
IProxyRepositoryFactory factory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
List<IRepositoryViewObject> updateList = new ArrayList<IRepositoryViewObject>();
List<Relation> relations = RelationshipItemBuilder.getInstance().getItemsRelatedTo((connItem).getProperty().getId(),
RelationshipItemBuilder.LATEST_VERSION, RelationshipItemBuilder.PROPERTY_RELATION);
@@ -2208,8 +1920,6 @@ public abstract class RepositoryUpdateManager {
}
private static boolean updateQueryObject(Object parameter, boolean show, boolean onlySimpleShow) {
IProxyRepositoryFactory factory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
List<IRepositoryViewObject> updateList = new ArrayList<IRepositoryViewObject>();
List<Relation> relations = null;
if (parameter instanceof Query) {
relations = RelationshipItemBuilder.getInstance().getItemsRelatedTo(((Query) parameter).getId(),
@@ -2340,7 +2050,7 @@ public abstract class RepositoryUpdateManager {
repositoryUpdateManager.setContextRenamedMap(repositoryRenamedMap);
// newly added parameters
Map<ContextItem, Set<String>> newParametersMap = new HashMap<ContextItem, Set<String>>();
Map<Item, Set<String>> newParametersMap = new HashMap<Item, Set<String>>();
if (!repositoryContextManager.getNewParameters().isEmpty()) {
newParametersMap.put(item, repositoryContextManager.getNewParameters());
}
@@ -2352,16 +2062,14 @@ public abstract class RepositoryUpdateManager {
ExceptionHandler.process(e);
}
return repositoryUpdateManager.doWork(show, onlySimpleShow);
}
public Map<ContextItem, Set<String>> getNewParametersMap() {
public Map<Item, Set<String>> getNewParametersMap() {
return newParametersMap;
}
public void setNewParametersMap(Map<ContextItem, Set<String>> newParametersMap) {
public void setNewParametersMap(Map<Item, Set<String>> newParametersMap) {
this.newParametersMap = newParametersMap;
}
@@ -2464,7 +2172,6 @@ public abstract class RepositoryUpdateManager {
// Added TDQ-11688 20170309 yyin
public static boolean updateDQPattern(Item patternItem) {
List<IRepositoryViewObject> updateList = new ArrayList<IRepositoryViewObject>();
IProxyRepositoryFactory factory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
List<Relation> relations = RelationshipItemBuilder.getInstance().getItemsRelatedTo(patternItem.getProperty().getId(),
RelationshipItemBuilder.LATEST_VERSION, RelationshipItemBuilder.PATTERN_RELATION);
@@ -2482,9 +2189,19 @@ public abstract class RepositoryUpdateManager {
return repositoryUpdateManager.doWork(true, false);
}
private static IProxyRepositoryFactory getProxyRepositoryFactory() {
return ((IProxyRepositoryService) GlobalServiceRegister.getDefault().getService(IProxyRepositoryService.class))
.getProxyRepositoryFactory();
}
public static IRepositoryContextUpdateService findContextParameterUpdater(Connection connection) {
if (CONTEXT_UPDATE_SERVICE_LIST == null) {
CONTEXT_UPDATE_SERVICE_LIST = GlobalServiceRegister.getDefault()
.findAllService(IRepositoryContextUpdateService.class);
}
for (IRepositoryContextUpdateService updater : CONTEXT_UPDATE_SERVICE_LIST) {
if (updater.accept(connection)) {
return updater;
}
}
LOGGER.error(
"Can't find any connection context parameter updater for connection type:" + connection.getClass().getName());
return null;
}
}

View File

@@ -36,6 +36,8 @@ 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.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.talend.commons.utils.PasswordEncryptUtil;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.language.ECodeLanguage;
@@ -48,6 +50,8 @@ import org.talend.core.model.metadata.types.JavaTypesManager;
import org.talend.core.model.process.IContext;
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.services.IGenericDBService;
import org.talend.core.utils.TalendQuoteUtils;
import org.talend.designer.core.model.utils.emf.talendfile.ContextParameterType;
@@ -595,8 +599,12 @@ public final class ContextParameterUtils {
if (ContextUtils.isJavaKeyWords(name)) {
return false;
}
Pattern regex = Pattern.compile(RepositoryConstants.CONTEXT_AND_VARIABLE_PATTERN, Pattern.UNICODE_CHARACTER_CLASS);
Pattern regex = null;
if (isAllowSpecificCharacters()) {
regex = Pattern.compile(RepositoryConstants.CONTEXT_AND_VARIABLE_PATTERN, Pattern.UNICODE_CHARACTER_CLASS);
} else {
regex = Pattern.compile(RepositoryConstants.COLUMN_NAME_PATTERN, Pattern.UNICODE_CHARACTER_CLASS);
}
Matcher regexMatcher = regex.matcher(name);
return regexMatcher.matches();
@@ -604,6 +612,11 @@ public final class ContextParameterUtils {
return false;
}
private static boolean isAllowSpecificCharacters() {
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) {
return source.equals(StringUtils.EMPTY);
}

View File

@@ -70,5 +70,7 @@ public interface IRepositoryArtifactHandler {
public IRepositoryArtifactHandler clone();
public String getRepositoryURL(boolean isRelease);
public String resolveRemoteSha1(MavenArtifact artifact, boolean fromRelease) throws Exception;
}

View File

@@ -187,11 +187,13 @@ public class TalendLibsServerManager {
* Check user library connection with the setting from remote administrator
*
* @return
* @throws PersistenceException
*/
public boolean canConnectUserLibrary() {
public boolean canConnectUserLibrary() throws PersistenceException {
boolean canConnect = false;
IProxyRepositoryFactory factory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
RepositoryContext repositoryContext = factory.getRepositoryContext();
ArtifactRepositoryBean bean = null;
try {
if (repositoryContext != null && repositoryContext.getFields() != null && !factory.isLocalConnectionProvider()
&& !repositoryContext.isOffline()) {
@@ -208,7 +210,7 @@ public class TalendLibsServerManager {
&& GlobalServiceRegister.getDefault().isServiceRegistered(IRemoteService.class)) {
IRemoteService remoteService = (IRemoteService) GlobalServiceRegister.getDefault()
.getService(IRemoteService.class);
ArtifactRepositoryBean bean = remoteService.getLibNexusServer(userName, password, adminUrl);
bean = remoteService.getLibNexusServer(userName, password, adminUrl);
if (bean != null) {
IRepositoryArtifactHandler handler = RepositoryArtifactHandlerManager.getRepositoryHandler(bean);
if (handler.checkConnection()) {
@@ -223,6 +225,9 @@ public class TalendLibsServerManager {
} catch (Exception e) {
ExceptionHandler.process(e);
}
if (bean == null) {
throw new PersistenceException(Messages.getString("TalendLibsServerManager.cannotGetUserLibraryServer"));
}
return canConnect;
}

View File

@@ -32,8 +32,12 @@ public class LastGenerationInfo {
private HashMap<String, Set<ModuleNeeded>> modulesNeededWithSubjobPerJob;
private HashMap<String, Set<ModuleNeeded>> highPriorityModuleNeededPerJob;
private HashMap<String, Set<ModuleNeeded>> highPriorityModuleNeeded;
private HashMap<String, Set<ModuleNeeded>> testcaseModuleNeeded;
private HashMap<String, Set<String>> routinesNeededWithSubjobPerJob;
private HashMap<String, Set<String>> contextPerJob;
@@ -52,7 +56,9 @@ public class LastGenerationInfo {
modulesNeededPerJob = new HashMap<String, Set<ModuleNeeded>>();
contextPerJob = new HashMap<String, Set<String>>();
modulesNeededWithSubjobPerJob = new HashMap<String, Set<ModuleNeeded>>();
highPriorityModuleNeededPerJob = new HashMap<>();
highPriorityModuleNeeded = new HashMap<>();
testcaseModuleNeeded = new HashMap<>();
lastGeneratedjobs = new HashSet<JobInfo>();
routinesNeededPerJob = new HashMap<String, Set<String>>();
routinesNeededWithSubjobPerJob = new HashMap<String, Set<String>>();
@@ -235,6 +241,22 @@ public class LastGenerationInfo {
return routinesNeededPerJob.get(key);
}
public Set<ModuleNeeded> getHighPriorityModuleNeededPerJob(String jobId, String jobVersion) {
String key = getProcessKey(jobId, jobVersion);
if (!highPriorityModuleNeededPerJob.containsKey(key)) {
highPriorityModuleNeededPerJob.put(key, new LinkedHashSet<>());
}
return highPriorityModuleNeededPerJob.get(key);
}
public void setHighPriorityModuleNeededPerJob(String jobId, String jobVersion, Set<ModuleNeeded> moduleNeeded) {
String key = getProcessKey(jobId, jobVersion);
if (!highPriorityModuleNeededPerJob.containsKey(key)) {
highPriorityModuleNeededPerJob.put(key, new LinkedHashSet<>());
}
highPriorityModuleNeededPerJob.get(key).addAll(moduleNeeded);
}
public Set<ModuleNeeded> getHighPriorityModuleNeeded(String jobId, String jobVersion) {
String key = getProcessKey(jobId, jobVersion);
if (!highPriorityModuleNeeded.containsKey(key)) {
@@ -251,7 +273,20 @@ public class LastGenerationInfo {
highPriorityModuleNeeded.get(key).addAll(moduleNeeded);
}
public Set<ModuleNeeded> getTestcaseModuleNeeded(String jobId, String jobVersion) {
String key = getProcessKey(jobId, jobVersion);
if (!testcaseModuleNeeded.containsKey(key)) {
testcaseModuleNeeded.put(key, new HashSet<>());
}
return testcaseModuleNeeded.get(key);
}
public void setTestcaseModuleNeeded(String jobId, String jobVersion, Set<ModuleNeeded> modulesNeeded) {
testcaseModuleNeeded.put(getProcessKey(jobId, jobVersion), new HashSet<>(modulesNeeded));
}
public void clearHighPriorityModuleNeeded() {
highPriorityModuleNeededPerJob.clear();
highPriorityModuleNeeded.clear();
}
@@ -292,26 +327,19 @@ public class LastGenerationInfo {
routinesNeededWithSubjobPerJob.put(key, new HashSet<String>(modulesNeeded));
}
public void clearModulesNeededWithSubjobPerJob() {
if (!modulesNeededWithSubjobPerJob.isEmpty()) {
modulesNeededWithSubjobPerJob.clear();
}
}
/**
* Clear modules per job cache, not thread safe
*/
public void clearModulesNeededPerJob() {
if (!modulesNeededPerJob.isEmpty()) {
modulesNeededPerJob.clear();
}
public void clearCaches() {
clearHighPriorityModuleNeeded();
modulesNeededPerJob.clear();
modulesNeededWithSubjobPerJob.clear();
testcaseModuleNeeded.clear();
}
public void clean() {
modulesNeededPerJob.clear();
routinesNeededPerJob.clear();
modulesNeededWithSubjobPerJob.clear();
highPriorityModuleNeeded.clear();
clearHighPriorityModuleNeeded();
testcaseModuleNeeded.clear();
routinesNeededWithSubjobPerJob.clear();
contextPerJob.clear();

View File

@@ -64,7 +64,10 @@ public interface TalendProcessOptionConstants {
public static final int MODULES_WITH_INDEPENDENT = 1 << 2;
// include joblet module but without joblet's dependencies
/**
* @Deprecated will get all modules of node inside joblet recursively, use {@link #MODULES_DEFAULT} instead.
*/
@Deprecated
public static final int MODULES_WITH_JOBLET = 1 << 3;
public static final int MODULES_FOR_MR = 1 << 4;

View File

@@ -64,4 +64,8 @@ public interface IGenericDBService extends IService{
public ERepositoryObjectType getExtraDBType(ERepositoryObjectType type);
public void updateCompPropertiesForContextMode(Connection connection, Map<String, String> contextVarMap);
public List<ERepositoryObjectType> getAllGenericMetadataDBRepositoryType();
}

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