Compare commits

...

58 Commits

Author SHA1 Message Date
SunChaoqun
c9d5c32b50 Fix the issue when using TOS missing commons-lang3-3.11 2021-06-30 17:24:30 +08:00
Chao MENG
eee3febc64 fix(TUP-31997): Commandline fails start studio with error 'Could not load SWT library' on Ubuntu 18 LTS without UI (#4393)
* chore: try to avoid swt jni loading issue in commandline

* chore: try to avoid swt jni loading issue in commandline
2021-06-29 11:54:21 +08:00
Zhiwei Xue
fb350a5c17 feat(TUP-31886):Support login tasks to run in background (#4387) 2021-06-25 14:36:51 +08:00
Zhiwei Xue
ca6cc22ba0 feat(TUP-31214):Improve component cache and lazy loading (#4320)
* feat(TUP-29651): Components loading improvement (#4247)

* feat(TUP-29651): partially load components

* feat(TUP-29651): partially load components

* feat(TUP-29651): other oprimization

* feat(TUP-29651): fix saveResource

* feat(TUP-29651): fix junit

* feat(TUP-29651): revert index calculation

* feat(TUP-29651): fix plugin.xml

* feat(TUP-29651): refactor load joblet components

* feat(TUP-29651): revert unnecessary changes

Co-authored-by: bhe-talendbj <bhe@talend.com>

* feat(TUP-31214):Improve component cache and lazy loading

* item(TUP-29873): Improve performance effected by dynamic distribution
(#4324)

* item(TUP-29873): Improve performance effected by dynamic distribution

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



* item(TUP-29873): Improve performance effected by dynamic distribution

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



Co-authored-by: Chao MENG <cmeng@talend.com>

* feat(TUP-31214): fix reset for ModulesNeededProvider

* feat(TUP-31214): fix generating index problem

* feat(TUP-31214): full lazy load for ComponentsFactory
feat(TUP-31577): Improve speed of installation of routines / root poms

* feat(TUP-29653):Improve Tacokit loading

* feat(TUP-31879):Improve performance for checking network for welcome
page

* feat(TUP-31577):fix custom jar cache init problem

Co-authored-by: bhe-talendbj <bhe@talend.com>
Co-authored-by: Chao MENG <cmeng@talend.com>
2021-06-25 14:15:57 +08:00
kjwang
69fa22f6f5 TUP-31795 Add a parameter to setup a JVM for runtime / build with Java 8 (#4384)
* TUP-31795 Add a parameter to setup a JVM for runtime / build with Java 8
https://jira.talendforge.org/browse/TUP-31795
2021-06-24 19:11:51 +08:00
Xilai Dai
db654746c1 Feature/master/tesb 32199 (#4380)
* TESB-32475: Add camel family property on project level

* TESB-32475:Add camel family property on project level

* Create Camel 3 Project by default

* Create Camel 3 Project by default

* Remove null dependencies

* Auto Convert Camel 2 -> Camel 3

* Bean dependencies:
Camel3 already included related jar file so the jars which needed be
imported in Camel2 should remove.

* APPINT-32438:Camel 3: Build a 7.4.1 Studio supporting Camel 3

* APPINT-33007:
Code cleanup related to Camel 3 support only

* APPINT-33007:Code cleanup related to Camel 3 support only

* APPINT-32438 Icons update

Co-authored-by: SunChaoqun <csun@talend.com>
Co-authored-by: apoltavtsev <apoltavtsev@gmail.com>
2021-06-24 11:03:31 +02:00
kjwang
513997726f TUP-31081 Improve download of jars from the studio (#4358)
* TUP-31081 Improve download of jars from the studio
https://jira.talendforge.org/browse/TUP-31081
2021-06-24 15:04:11 +08:00
nrousseau
cda9d85938 feat(TUP-31484) fix issues with eclipse upgrade (#4389) 2021-06-23 15:26:36 +08:00
sbliu
c028037013 feat(TUP-30834) backport - fix ClassCastException (#4388) 2021-06-22 10:52:40 +08:00
hzhao-talendbj
9628d3377a feat(TUP-29701): upgrade eclipse (#3966)
* feat(TUP-29701): upgrade eclipse

* change assert

* fix assert issue

* fix compilation error

* change StringMatcher

* change to apache StringUtils because split function was removed from
eclipse one

* change manifest

* TUP-29701 modify pom to fix NoClassDefFoundError:
com/sun/jna/platform/win32/VersionHelpers

* TUP-29701  change pom for jna

* TUP-29701 try add javax.inject to require bundle

* TUP-29701 try add javax.inject to manifest

* TUP-29701 fix missing required class when start studio

* TUP-29701 change to public

* TUP-31484 fix xerces issue

* TUP-31484 add plugins to features to make it exist in license

* try change version to force use 1.68.0
org.bouncycastle.bcprov 1.68.0
2021-06-18 17:36:29 +08:00
jiezhang-tlnd
cea69e78d5 feat(TUP-31122)new Data Center in AWS Australia (#4342)
https://jira.talendforge.org/browse/TUP-31122

Co-authored-by: jie.zhang <jie.zhang@LT-DDC8R73.talend.com>
2021-06-18 12:06:11 +08:00
zyuan-talend
6063838154 feat(TUP-26268): fix the NPE. (#4378) (#4381) 2021-06-17 10:47:48 +08:00
hcyi
ba13aa44e0 fix(TUP-31238):Library sync with JFrog/Nexus on studio startup doesn't use proxy. (#4357)
* fix(TUP-31238):Library sync with JFrog/Nexus on studio startup doesn't
use proxy.

* fix(TUP-31238):improve for Library sync with JFrog/Nexus on studio
startup doesn't use proxy.

* fix(TUP-31238):add log for Library sync with JFrog/Nexus on studio
startup doesn't use proxy.
2021-06-11 17:26:03 +08:00
Zhiwei Xue
df65549c46 fix(TUP-31759):fix codes install issues on CI (#4374) 2021-06-11 15:51:30 +08:00
Xilai Dai
87f5232e74 APPINT-33200 update the maven-jar-plugin, maven-bundle-plugin (#4366)
* APPINT-33200 update the maven-jar-plugin, maven-bundle-plugin

* APPINT-33200 update the pom_project_template.xml
2021-06-10 19:05:43 +08:00
zyuan-talend
1fcea62d28 feat(TUP-26268): Add button of manipulating Db Column field. (#4354) (#4370)
* feat(TUP-26268): Add button of manipulating Db Column field.
2021-06-10 18:58:40 +08:00
Jane Ding
77833ed44c fix(TUP-31159):When use remote mode with Custom log / unlocked, have (#4325) (#4371)
only one popup of commit
https://jira.talendforge.org/browse/TUP-31159
2021-06-10 17:43:31 +08:00
chmyga
a6810bf733 chore(TDI-46267): bump connectors to 1.23.0-SNAPSHOT (#4364)
Co-authored-by: Dmytro Chmyga <dmytro.chmyga@globallogic.com>
2021-06-09 14:13:34 +03:00
Xilai Dai
84f6219d5f APPINT-32986 update the pom_project_template.xml (#4361) 2021-06-09 18:23:07 +08:00
Chao MENG
42f187c8e2 fix(TUP-31796): Pictures in welcom page are missing (#4360)
https://jira.talendforge.org/browse/TUP-31796
2021-06-09 16:31:30 +08:00
sbliu
1560e256dc feat(TUP-30489) add progress bar to indicate install patch. (#4347) 2021-06-08 14:46:03 +08:00
sbliu
59207f8232 fix(TUP-31252) Improve the data collector for AMC. (#4350) 2021-06-08 14:25:49 +08:00
Xilai Dai
82966f5ba8 chore(APPINT-32986) upgrade commons-io to 2.8.0 (#4345) 2021-06-07 18:01:47 +08:00
bhe-talendbj
03cdc22509 fix(TUP-31729): add missing com.fasterxml.jackson:jackon-bom:2.10.0:pom and com.fasterxml.jackson:oss-parent:38:pom (#4348) 2021-06-07 17:26:03 +08:00
Emmanuel GALLOIS
43fc091be8 feat(TDI-46215): bump component-runtime to 1.33.1 (#4338) 2021-06-07 09:44:44 +02:00
bhe-talendbj
4c41c51472 fix(TUP-31580): execlude other dependencies (#4352) 2021-06-07 15:11:58 +08:00
bhe-talendbj
c226736a04 fix(TUP-31580): replace javascriptengine (#4334) (#4344)
* fix(TUP-31580): replace javascriptengine

* fix(TUP-31580): fix test case

* fix(TUP-31580): fix test case
2021-06-04 09:58:22 +08:00
sbliu
79da2594c0 feat(TUP-30834) remove extra tag. (#4343) 2021-06-03 12:20:59 +08:00
sbliu
13f057c49e feat(TUP-30834) fix unit test failure introduced by api change. (#4341) 2021-06-03 10:55:59 +08:00
sbliu
32e8d6357d feat(TUP-30834) add 2 axis2 module to classpath and export package. (#4317)
add 2 axis2 module to classpath and export package.
replace axis1 with axis2 for S56MDMConnetionHelper
remove salesforce code&dependency from tup, adpt the 'create salesforce connection' toolbar action to generic salesforce connection creation action.
2021-06-03 10:34:04 +08:00
zshen-talend
b267b0dc76 fix(TDQ-19437): tDqReportRun failed when dbconneciton is context mode (#4316) 2021-06-02 07:27:40 +00:00
bhe-talendbj
b51103d01b chore(TUP-31095): Use prepareStatement instead of plain sql execution (#4248) (#4331)
* fix(TUP-31095): initial impl

* fix(TUP-31095): initial impl

* chore(TUP-31095): use prepared statement

* chore(TUP-31095): fix param index

* fix(TUP-31095): fix parameter index
2021-06-01 15:13:32 +08:00
jiezhang-tlnd
ccdbc33869 fix(TUP-31527)CVE lucene-queries (#4295)
* fix(TUP-31527)CVE lucene-queries

* CVE: lucene-queries:4.10.4

* CVE: lucene-queries:4.10.4

* remove plugin org.talend.libraries.apache.lucene4

* remove plugin org.talend.libraries.apache.lucene4

* remove org.talend.libraries.apache.lucene4
2021-05-31 17:14:09 +08:00
hcyi
8560039492 fix(TUP-31553):Hadoop Metadata Wizard when using custom distro dialog (#4307)
box doesnt pop up to import dependencies.
2021-05-28 14:37:21 +08:00
Jane Ding
5fbdc38ebf fix(TUP-31316):Error connecting to Azure SQL database with Azure Active (#4271) (#4319)
* fix(TUP-31316):Error connecting to Azure SQL database with Azure Active
directory method
https://jira.talendforge.org/browse/TUP-31316

* fix(TUP-31316):Error connecting to Azure SQL database with Azure Active
directory method
https://jira.talendforge.org/browse/TUP-31316
2021-05-26 17:46:49 +08:00
zyuan-talend
93be98ff85 feat(TUP-30343):have the "Export Dependencies" option checked by default (#4312) (#4314) 2021-05-26 14:32:56 +08:00
bhe-talendbj
b5f39fba54 fix(TUP-31380): port (#4306) 2021-05-26 10:56:49 +08:00
bhe-talendbj
e18b7dfbf5 fix(TUP-31473): add missing parent poms (#4298) 2021-05-26 10:55:57 +08:00
Jane Ding
280be6425f fix(TUP-30849):Improve build Job performance (#4310)
https://jira.talendforge.org/browse/TUP-30849
2021-05-25 18:43:43 +08:00
Jane Ding
ef22ca920f feat(TUP-31117):Improve performances related to recursive jobs (#4292)
* feat(TUP-31117):Improve performances related to recursive jobs
https://jira.talendforge.org/browse/TUP-31117

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

* feat(TUP-31117):Improve performances related to recursive jobs
https://jira.talendforge.org/browse/TUP-31117
2021-05-25 17:43:00 +08:00
jiezhang-tlnd
7b1d49ae69 fix(TUP-31164)Guess schema button on the informix tDBinput component (#4308)
returns zero length datatype
https://jira.talendforge.org/browse/TUP-31164
2021-05-25 15:21:41 +08:00
jiezhang-tlnd
03de72105c chore(TUP-30461)CVE plexus-utils (#4272)
* chore(TUP-30461)CVE plexus-utils

* remove plexus-utils-3.0.17

* remove from classpatch
2021-05-24 15:53:00 +08:00
hcyi
c1398000c1 feat(TUP-30619):Missing Additional parameters in SAP Connection. (#4285)
* feat(TUP-30619):Missing Additional parameters in SAP Connection.

* feat(TUP-30619):update key for Additional parameters in SAP Connection.
2021-05-24 09:52:01 +08:00
kjwang
454d6ecd84 Kjwang/fix tup 31227 studio populate unstaged changes (#4277) (#4302)
TUP-31227 Studio populate UnstagedChanges for Global Routines and SQL
Templates when opening a new Feature Branch
https://jira.talendforge.org/browse/TUP-31227
2021-05-21 14:27:41 +08:00
Chao MENG
7b5f7b3935 feat(TUP-30475): studio lite (#4299)
https://jira.talendforge.org/browse/TUP-30475

Add missing org.talend.migrationTool.nl
2021-05-19 15:33:33 +02:00
Chao MENG
0a1ebc33ac feat(TUP-30475): studio lite (#4286)
https://jira.talendforge.org/browse/TUP-30475
2021-05-18 14:43:36 +08:00
vdrokov
5271d9bdb8 APPINT-32987: Fix dublicate variable (#4279) 2021-05-13 12:08:56 +03:00
sbliu
7b484be397 fix(TUP-31060): store real routine id in case recreated routine with same name. 2021-05-13 10:57:32 +08:00
Jane Ding
895635738f chore(APPINT-32936):CVE:Upgrade commons-codec-1.11 to 1.15 (#4260)
https://jira.talendforge.org/browse/APPINT-32936
2021-05-12 13:59:45 +08:00
hzhao-talendbj
e53ee0fe2e chore(TUP-30255): Upgrade httpclient-4.5.5,4.5.7 to 4.5.13 (#4237) 2021-05-10 18:13:47 +08:00
Denis Sergent
562018e483 Revert "APPINT-32905: Issue with Rest service flow (#4264)" (#4275)
This reverts commit 5f1c19871c.
2021-05-10 11:47:43 +02:00
Jane Ding
03f01de063 fix(TUP-31237):Invalid username or password when creating a Snowflake (#4232) (#4273)
* fix(TUP-31237):Invalid username or password when creating a Snowflake
Metadata Connection with a Snowflake password that has a slash character
https://jira.talendforge.org/browse/TUP-31237

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

* chore(TUP-31030):Update CXF to 3.3.10
https://jira.talendforge.org/browse/TUP-31030
2021-05-10 09:46:42 +08:00
mbasiuk-talend
a38c309608 chore(TDI-46032): bump connectors version to 1.22.0-SNAPSHOT (#4270) 2021-05-08 17:09:13 +08:00
hzhao-talendbj
0eddc3b1b9 fix(TUP-31248):impala metadata connection issues for Cloudera (#4246) (#4252)
* fix(TUP-31248):impala metadata connection issues for Cloudera

* TUP-31248 revert mistake remove

* TUP-31248 remove some useless code

* TUP-31248 add connection info to log when connection failed
2021-05-07 15:46:08 +08:00
kjwang
afe5d2e74b Feat:TUP-30377 Move the "Allow specific characters (UTF8,...)" (#4238) (#4266)
Feat:TUP-30377 Move the "Allow specific characters (UTF8,...) preference
setting to project setting.
https://jira.talendforge.org/browse/TUP-30377
2021-05-06 17:22:35 +08:00
jiezhang-tlnd
c3277931c1 fix(TUP-30451)CVE: (#4256)
maven-shared-utils-3.0.0.jar,maven-shared-utils-3.0.1.jar,maven-shared-utils-3.1.0.jar
2021-05-06 11:01:46 +08:00
vdrokov
5f1c19871c APPINT-32905: Issue with Rest service flow (#4264) 2021-05-05 17:28:43 +03:00
260 changed files with 5930 additions and 14674 deletions

View File

@@ -8,7 +8,7 @@
<discovery label="Talend web site" url="http://www.talend.com"/>
</url>
<requires>
<import plugin="org.bouncycastle.bcprov" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.bouncycastle.bcprov" version="1.68.0" match="greaterOrEqual"/>
<import plugin="com.fasterxml.jackson.core.jackson-databind" version="2.9.8" match="greaterOrEqual"/>
<import plugin="jackson-core-asl" version="0.0.0" match="greaterOrEqual"/>
<import plugin="jackson-mapper-asl" version="0.0.0" match="greaterOrEqual"/>

View File

@@ -39,6 +39,7 @@
<import plugin="org.eclipse.compare" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.compare.core" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.ops4j.pax.url.mvn" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.collections" version="0.0.0" match="greaterOrEqual"/>
</requires>
<plugin id="org.talend.core" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.talend.core.nl" download-size="0" install-size="0" version="0.0.0" fragment="true" unpack="false"/>
@@ -62,6 +63,7 @@
<plugin id="org.talend.metadata.managment.ui" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.talend.metadata.managment.ui.nl" download-size="0" install-size="0" version="0.0.0" fragment="true" unpack="false"/>
<plugin id="org.talend.migrationTool" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.talend.migrationTool.nl" download-size="0" install-size="0" version="0.0.0" fragment="true" unpack="false"/>
<plugin id="org.talend.model" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.talend.model.edit" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.talend.model.edit.nl" download-size="0" install-size="0" version="0.0.0" fragment="true" unpack="false"/>

View File

@@ -57,11 +57,4 @@
version="0.0.0"
unpack="true"/>
<plugin
id="org.talend.libraries.apache.lucene4"
download-size="0"
install-size="0"
version="0.0.0"
unpack="true"/>
</feature>

View File

@@ -38,5 +38,7 @@
<import plugin="org.slf4j.api" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.slf4j.impl.log4j12" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.wst.server.discovery" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.ui.genericeditor" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.e4.ui.ide" version="0.0.0" match="greaterOrEqual"/>
</requires>
</feature>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 404 B

View File

@@ -132,3 +132,8 @@ GlobalServiceRegister.ServiceNotRegistered=The service {0} has not been register
MessageBoxExceptionHandler.showMessageForSchemaImportXml.unParseXML.title=The xml can't parse.
MessageBoxExceptionHandler.showMessageForSchemaImportXml.unParseXML.msg=The xml can't parse in this format.
HibernateUtils.auditDBIsNotUsable=The audit database must be empty or only contains tables related to audit.
CasePushButton.CaseButton.Tip=Uppercase/Lowercase Db column
QuotePushButton.QuoteButton.Tip=Add/Remove Quote on Db column
QuoteManipulateDialog.title=Add/Remove quote on Db column
QuoteManipulateDialog.addQuote=Add quote
QuoteManipulateDialog.removeQuote=Remove quote

View File

@@ -88,6 +88,8 @@ public enum EImage implements IImage {
LEFTX_ICON("/icons/leftx.png"), //$NON-NLS-1$
RIGHT_ICON("/icons/right.gif"), //$NON-NLS-1$
RIGHTX_ICON("/icons/rightx.png"), //$NON-NLS-1$
LOWERCASE_ICON("/icons/lowercase.jpg"), //$NON-NLS-1$
UPPERCASE_ICON("/icons/uppercase.jpg"), //$NON-NLS-1$
KEY_ICON("/icons/key.gif"), //$NON-NLS-1$
HIERARCHY_ICON("/icons/hierarchicalLayout.gif"), //$NON-NLS-1$

View File

@@ -14,7 +14,7 @@ package org.talend.commons.ui.runtime.swt.celleditor;
import java.text.MessageFormat;
import org.eclipse.jface.util.Assert;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ComboBoxCellEditor;
import org.eclipse.swt.SWT;

View File

@@ -19,7 +19,7 @@ import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.eclipse.jface.util.Assert;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ColumnLayoutData;
import org.eclipse.jface.viewers.ColumnPixelData;

View File

@@ -22,7 +22,7 @@ package org.talend.commons.ui.runtime.swt.tableviewer.behavior;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jface.util.Assert;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.viewers.ColumnLayoutData;
import org.eclipse.jface.viewers.ColumnPixelData;
import org.eclipse.jface.viewers.ColumnWeightData;

View File

@@ -0,0 +1,56 @@
package org.talend.commons.runtime.service;
import java.util.Collection;
import java.util.Collections;
import java.util.Properties;
import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceReference;
import org.talend.commons.exception.CommonExceptionHandler;
public interface ICollectDataService {
final String KEY_SOURCE = "source";
//
final String AMC_FILE_TYPE_USED = "FILE_TYPE_USED";
final String AMC_DATABASE_TYPE_USED = "DATABASE_TYPE_USED";
final String AMC_PREVIEW_KEY = "amc.datasource";
final String AMC_PREVIEW_FILEVALUE = "File";
final String AMC_PREVIEW_DATABASEVALUE = "Database";
/**
* @return json string
*/
String getCollectedDataJSON();
Properties getCollectedData();
public static ICollectDataService getInstance(String from) throws Exception {
BundleContext bc = FrameworkUtil.getBundle(ICollectDataService.class).getBundleContext();
Collection<ServiceReference<ICollectDataService>> tacokitServices = Collections.emptyList();
try {
tacokitServices = bc.getServiceReferences(ICollectDataService.class, null);
} catch (InvalidSyntaxException e) {
CommonExceptionHandler.process(e);
}
if (tacokitServices != null) {
for (ServiceReference<ICollectDataService> sr : tacokitServices) {
if (from == null || from.equals(sr.getProperty(KEY_SOURCE))) {
ICollectDataService tacokitService = bc.getService(sr);
if (tacokitService != null) {
return tacokitService;
}
}
}
}
return null;
}
}

View File

@@ -32,10 +32,12 @@ import org.talend.commons.i18n.internal.Messages;
*/
public interface ITaCoKitService {
void start() throws Exception;
void start();
boolean isStarted() throws Exception;
void waitForStart();
String reload(IProgressMonitor monitor) throws Exception;
boolean isTaCoKitCar(File file, IProgressMonitor monitor) throws Exception;
@@ -44,7 +46,7 @@ public interface ITaCoKitService {
boolean isTaCoKitType(Object repoType);
public static ITaCoKitService getInstance() throws Exception {
public static ITaCoKitService getInstance() {
BundleContext bc = FrameworkUtil.getBundle(ITaCoKitService.class).getBundleContext();
Collection<ServiceReference<ITaCoKitService>> tacokitServices = Collections.emptyList();
try {

View File

@@ -12,6 +12,8 @@
// ============================================================================
package org.talend.commons.runtime.service;
import org.eclipse.core.runtime.IProgressMonitor;
/**
* DOC ggu class global comment. Detailled comment
*/
@@ -19,6 +21,10 @@ public interface P2InstallComponent {
boolean install();
default boolean install(IProgressMonitor monitor) {
return false;
}
boolean needRelaunch();
String getInstalledMessages();

View File

@@ -29,6 +29,8 @@ public interface IExtendedList<T> extends List<T> {
public void swapElements(List<Integer> indicesOrigin, List<Integer> indicesTarget);
public void swapElement(T object1, T object2);
public void replaceElement(int index, T object2);
/**
* Getter for useEquals.

View File

@@ -537,6 +537,11 @@ public class ListenableList<T> implements IExtendedList<T> {
fireReplacedEvent(index, replacedObject, element, false);
return replacedObject;
}
@Override
public void replaceElement(int index, T element) {
this.list.set(index, element);
}
/*
* (non-Javadoc)

View File

@@ -16,7 +16,6 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
@@ -109,11 +108,11 @@ public class DB2ForZosDataBaseMetadata extends PackageFakeDatabaseMetadata {
// MOD yyin 2012-05-15 TDQ-5190
String sql = "SELECT DISTINCT CREATOR FROM SYSIBM.SYSTABLES"; //$NON-NLS-1$
ResultSet rs = null;
Statement stmt = null;
PreparedStatement stmt = null;
List<String[]> list = new ArrayList<String[]>();
try {
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
stmt = connection.prepareStatement(sql);
rs = stmt.executeQuery();
while (rs.next()) {
String creator = rs.getString("CREATOR"); //$NON-NLS-1$
@@ -331,18 +330,20 @@ public class DB2ForZosDataBaseMetadata extends PackageFakeDatabaseMetadata {
public ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern)
throws SQLException {
// for real
String sql = "SELECT * FROM SYSIBM.SYSCOLUMNS where TBNAME='" + tableNamePattern + "' AND TBCREATOR = '" //$NON-NLS-1$ //$NON-NLS-2$
+ schemaPattern + "' ORDER BY TBCREATOR, TBNAME, COLNO"; //$NON-NLS-1$
String sql = "SELECT * FROM SYSIBM.SYSCOLUMNS where TBNAME=? AND TBCREATOR = ? ORDER BY TBCREATOR, TBNAME, COLNO"; //$NON-NLS-1$
// for test
// String sql = "SELECT * FROM SYSIBM.SYSCOLUMNS where NAME='NAME'";
ResultSet rs = null;
Statement stmt = null;
PreparedStatement stmt = null;
List<String[]> list = new ArrayList<String[]>();
try {
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
stmt = connection.prepareStatement(sql);
stmt.setString(1, tableNamePattern);
stmt.setString(2, schemaPattern);
rs = stmt.executeQuery();
while (rs.next()) {
// For real db2 for zos, should use these code.

View File

@@ -25,7 +25,6 @@ public class JtdsDatabaseMetadata extends PackageFakeDatabaseMetadata {
@Override
public ResultSet getSchemas() throws SQLException {
java.sql.Statement statement = connection.createStatement();
String sql;
if (((PackageFakeDatabaseMetadata) connection).getDatabaseMajorVersion() >= 9) {
sql = JDBC3 ? "SELECT name AS TABLE_SCHEM, NULL as TABLE_CATALOG FROM " + connection.getCatalog() + ".sys.schemas"
@@ -36,6 +35,7 @@ public class JtdsDatabaseMetadata extends PackageFakeDatabaseMetadata {
}
sql += " ORDER BY TABLE_SCHEM";
return statement.executeQuery(sql);
java.sql.PreparedStatement statement = connection.prepareStatement(sql);
return statement.executeQuery();
}
}

View File

@@ -13,9 +13,9 @@
package org.talend.commons.utils.database;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
@@ -152,15 +152,19 @@ public class SAPHanaDataBaseMetadata extends FakeDatabaseMetaData {
// check if the type is contained is in the types needed.
String sqlcv = "SELECT OBJECT_NAME,PACKAGE_ID FROM _SYS_REPO.ACTIVE_OBJECT WHERE OBJECT_SUFFIX = 'calculationview'"; //$NON-NLS-1$
if (tableNamePattern != null && !tableNamePattern.equals("%")) { //$NON-NLS-1$
sqlcv += " AND (OBJECT_NAME LIKE '" + tableNamePattern + "'"; //$NON-NLS-1$ //$NON-NLS-2$
sqlcv += " OR PACKAGE_ID LIKE '" + tableNamePattern + "')"; //$NON-NLS-1$ //$NON-NLS-2$
sqlcv += " AND (OBJECT_NAME LIKE ?"; //$NON-NLS-1$ //$NON-NLS-2$
sqlcv += " OR PACKAGE_ID LIKE ? )"; //$NON-NLS-1$ //$NON-NLS-2$
}
ResultSet rscv = null;
Statement stmtcv = null;
PreparedStatement stmtcv = null;
List<String[]> listcv = new ArrayList<String[]>();
try {
stmtcv = connection.createStatement();
rscv = stmtcv.executeQuery(sqlcv);
stmtcv = connection.prepareStatement(sqlcv);
if (tableNamePattern != null && !tableNamePattern.equals("%")) {
stmtcv.setString(1, tableNamePattern);
stmtcv.setString(2, tableNamePattern);
}
rscv = stmtcv.executeQuery();
while (rscv.next()) {
String objectName = rscv.getString("OBJECT_NAME"); //$NON-NLS-1$
if (objectName != null) {
@@ -303,11 +307,11 @@ public class SAPHanaDataBaseMetadata extends FakeDatabaseMetaData {
if (!load) {
String sqlcv = "SELECT * from \"" + schemaPattern + "\".\"" + tableNamePattern + "\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
ResultSet rscv = null;
Statement stmtcv = null;
PreparedStatement stmtcv = null;
List<String[]> listcv = new ArrayList<String[]>();
try {
stmtcv = connection.createStatement();
rscv = stmtcv.executeQuery(sqlcv);
stmtcv = connection.prepareStatement(sqlcv);
rscv = stmtcv.executeQuery();
int i = 1;
while (rscv.next()) {
String tableName = tableNamePattern;

View File

@@ -13,9 +13,9 @@
package org.talend.commons.utils.database;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
@@ -62,11 +62,11 @@ public class SASDataBaseMetadata extends FakeDatabaseMetaData {
// see the feature 5827
String sql = "SELECT DISTINCT LIBNAME FROM SASHELP.VTABLE"; //$NON-NLS-1$
ResultSet rs = null;
Statement stmt = null;
PreparedStatement stmt = null;
List<String[]> list = new ArrayList<String[]>();
try {
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
stmt = connection.prepareStatement(sql);
rs = stmt.executeQuery();
while (rs.next()) {
String creator = rs.getString("LIBNAME"); //$NON-NLS-1$
@@ -147,17 +147,21 @@ public class SASDataBaseMetadata extends FakeDatabaseMetaData {
public ResultSet getTables(String catalog, String schema, String tableNamePattern, String[] types) throws SQLException {
String sql;
if (schema != null) {
sql = "SELECT * FROM SASHELP.VTABLE where LIBNAME = '" + schema + "'"; //$NON-NLS-1$ //$NON-NLS-2$
sql = "SELECT * FROM SASHELP.VTABLE where LIBNAME = ?"; //$NON-NLS-1$ //$NON-NLS-2$
} else {
sql = "SELECT * FROM SASHELP.VTABLE"; //$NON-NLS-1$
}
ResultSet rs = null;
Statement stmt = null;
PreparedStatement stmt = null;
List<String[]> list = new ArrayList<String[]>();
try {
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
stmt = connection.prepareStatement(sql);
if (schema != null) {
stmt.setString(1, schema);
}
rs = stmt.executeQuery();
while (rs.next()) {
String name = rs.getString("MEMNAME"); //$NON-NLS-1$
@@ -229,18 +233,20 @@ public class SASDataBaseMetadata extends FakeDatabaseMetaData {
public ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern)
throws SQLException {
// for real
String sql = "SELECT * FROM SASHELP.VCOLUMN where MEMNAME='" + tableNamePattern + "' AND LIBNAME = '" //$NON-NLS-1$ //$NON-NLS-2$
+ schemaPattern + "' ORDER BY LIBNAME, MEMNAME, VARNUM"; //$NON-NLS-1$
String sql = "SELECT * FROM SASHELP.VCOLUMN where MEMNAME=? AND LIBNAME = ? ORDER BY LIBNAME, MEMNAME, VARNUM"; //$NON-NLS-1$
// for test
// String sql = "SELECT * FROM SYSIBM.SYSCOLUMNS where NAME='NAME'";
ResultSet rs = null;
Statement stmt = null;
PreparedStatement stmt = null;
List<String[]> list = new ArrayList<String[]>();
try {
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
stmt = connection.prepareStatement(sql);
stmt.setString(1, tableNamePattern);
stmt.setString(2, schemaPattern);
rs = stmt.executeQuery();
while (rs.next()) {
String tableName = rs.getString("MEMNAME"); //$NON-NLS-1$
if (tableName != null) {

View File

@@ -13,9 +13,9 @@
package org.talend.commons.utils.database;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
@@ -52,10 +52,12 @@ public class Sybase16SADatabaseMetaData extends SybaseDatabaseMetaData {
for (String catalogName : catList) {
String sql = createSqlByLoginAndCatalog(login, catalogName);
ResultSet rs = null;
Statement stmt = null;
PreparedStatement stmt = null;
try {
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
stmt = connection.prepareStatement(sql);
stmt.setString(1, login);
rs = stmt.executeQuery();
while (rs.next()) {
int temp = rs.getInt(1);
@@ -113,8 +115,7 @@ public class Sybase16SADatabaseMetaData extends SybaseDatabaseMetaData {
*/
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
+ "')";
+ ".dbo.sysusers where suid in (select suid from " + catalogName + ".dbo.syslogins where name = ? )";
return sql;
}

View File

@@ -13,9 +13,9 @@
package org.talend.commons.utils.database;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
@@ -54,10 +54,13 @@ public class SybaseDatabaseMetaData extends PackageFakeDatabaseMetadata {
for (String catalogName : catList) {
String sql = createSqlByLoginAndCatalog(login, catalogName);
ResultSet rs = null;
Statement stmt = null;
PreparedStatement stmt = null;
try {
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
stmt = connection.prepareStatement(sql);
stmt.setString(1, login);
stmt.setString(2, login);
rs = stmt.executeQuery();
while (rs.next()) {
int temp = rs.getInt(1);
@@ -92,11 +95,11 @@ public class SybaseDatabaseMetaData extends PackageFakeDatabaseMetadata {
public ResultSet getSchemas(String catalog, String schemaPattern) throws SQLException {
String sql = "SELECT DISTINCT name FROM " + catalog + ".dbo.sysusers where suid > 0"; //$NON-NLS-1$ //$NON-NLS-2$
ResultSet rs = null;
Statement stmt = null;
PreparedStatement stmt = null;
List<String[]> list = new ArrayList<String[]>();
try {
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
stmt = connection.prepareStatement(sql);
rs = stmt.executeQuery();
while (rs.next()) {
String name = rs.getString("name"); //$NON-NLS-1$
@@ -136,9 +139,9 @@ public class SybaseDatabaseMetaData extends PackageFakeDatabaseMetadata {
*/
protected String createSqlByLoginAndCatalog(String loginName, String catalogName) {
return "select count(*) from " + catalogName //$NON-NLS-1$
+ ".dbo.sysusers where suid in (select suid from master.dbo.syslogins where name = '" + loginName //$NON-NLS-1$
+ "') or suid in (select altsuid from " + catalogName //$NON-NLS-1$
+ ".dbo.sysalternates a, master.dbo.syslogins b where b.name = '" + loginName + "' and a.suid = b.suid)"; //$NON-NLS-1$ //$NON-NLS-2$
+ ".dbo.sysusers where suid in (select suid from master.dbo.syslogins where name = ?"
+ ") or suid in (select altsuid from " + catalogName //$NON-NLS-1$
+ ".dbo.sysalternates a, master.dbo.syslogins b where b.name = ? and a.suid = b.suid)"; //$NON-NLS-1$ //$NON-NLS-2$
}
@Override

View File

@@ -13,9 +13,9 @@
package org.talend.commons.utils.database;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
@@ -97,13 +97,12 @@ public class TeradataDataBaseMetadata extends FakeDatabaseMetaData {
int dbMajorVersion = connection.getMetaData().getDatabaseMajorVersion();
String sql = "HELP COLUMN \"" + schema + "\".\"" + table + "\".* ";//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
ResultSet rs = null;
Statement stmt = null;
PreparedStatement stmt = null;
String columnName = null;
List<String[]> list = new ArrayList<String[]>();
try {
if (dbMajorVersion > 12) {
sql = "SELECT * from DBC.INDICESV WHERE UPPER(databasename) = UPPER('" + schema //$NON-NLS-1$
+ "') AND UPPER(tablename) = UPPER('" + table + "') AND UPPER(UniqueFlag) = UPPER('Y')"; //$NON-NLS-1$//$NON-NLS-2$
sql = "SELECT * from DBC.INDICESV WHERE UPPER(databasename) = UPPER(?) AND UPPER(tablename) = UPPER(?) AND UPPER(UniqueFlag) = UPPER('Y')"; //$NON-NLS-1$ //$NON-NLS-2$
rs = getResultSet(catalog, schema, table, sql);
while (rs.next()) {
columnName = rs.getString("ColumnName").trim(); //$NON-NLS-1$
@@ -112,8 +111,11 @@ public class TeradataDataBaseMetadata extends FakeDatabaseMetaData {
list.add(r);
}
} else {
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
stmt = connection.prepareStatement(sql);
stmt.setString(1, schema);
stmt.setString(2, table);
rs = stmt.executeQuery();
while (rs.next()) {
columnName = rs.getString("Column Name").trim(); //$NON-NLS-1$
String pk = rs.getString("Primary?");//$NON-NLS-1$
@@ -138,10 +140,10 @@ public class TeradataDataBaseMetadata extends FakeDatabaseMetaData {
public ResultSet getResultSet(String catalog, String schema, String table, String sql) throws SQLException {
ResultSet rs = null;
Statement stmt = null;
PreparedStatement stmt = null;
try {
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
stmt = connection.prepareStatement(sql);
rs = stmt.executeQuery();
} catch (SQLException e) {
throw new RuntimeException(e);
}
@@ -203,17 +205,15 @@ public class TeradataDataBaseMetadata extends FakeDatabaseMetaData {
sysTable = "DBC.TABLESV";//$NON-NLS-1$
}
if (types != null && types.length > 0) {
sql = "SELECT * from " + sysTable + " WHERE UPPER(databasename) = UPPER('" + database //$NON-NLS-1$//$NON-NLS-2$
+ "') AND tablekind " + addTypesToSql(types); //$NON-NLS-1$
sql = "SELECT * from " + sysTable + " WHERE UPPER(databasename) = UPPER(?) AND tablekind " + addTypesToSql(types); //$NON-NLS-1$
} else {
// When the types is empty, all the tables and views will be retrieved.
sql = "SELECT * from " + sysTable + " WHERE UPPER(databasename) = UPPER('" + database //$NON-NLS-1$//$NON-NLS-2$
+ "') AND (tablekind = 'T' or tablekind = 'V')"; //$NON-NLS-1$
sql = "SELECT * from " + sysTable + " WHERE UPPER(databasename) = UPPER(?) AND (tablekind = 'T' or tablekind = 'V')"; //$NON-NLS-1$
}
// add the filter for table/views
if (!StringUtils.isEmpty(tableNamePattern)) {
sql = sql + " AND tablename LIKE '" + tableNamePattern + "'";//$NON-NLS-1$//$NON-NLS-2$
sql = sql + " AND tablename LIKE ?";//$NON-NLS-1$ //$NON-NLS-2$
}
if (types != null && types.length > 0) {
@@ -223,11 +223,18 @@ public class TeradataDataBaseMetadata extends FakeDatabaseMetaData {
}
ResultSet rs = null;
Statement stmt = null;
PreparedStatement stmt = null;
List<String[]> list = new ArrayList<String[]>();
try {
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
stmt = connection.prepareStatement(sql);
stmt.setString(1, database);
// add the filter for table/views
if (!StringUtils.isEmpty(tableNamePattern)) {
stmt.setString(2, tableNamePattern);
}
rs = stmt.executeQuery();
while (rs.next()) {
String name = rs.getString("TableName").trim(); //$NON-NLS-1$
@@ -326,21 +333,33 @@ public class TeradataDataBaseMetadata extends FakeDatabaseMetaData {
if (!StringUtils.isEmpty(database)) {
sql = "HELP COLUMN \"" + database + "\".\"" + tableNamePattern + "\".* ";//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
if (dbMajorVersion > 12) {
sql = "SELECT * from DBC.COLUMNSV WHERE UPPER(databasename) = UPPER('" + database //$NON-NLS-1$
+ "') AND UPPER(tablename) = UPPER('" + tableNamePattern + "')" + " Order by tablename "; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
sql = "SELECT * from DBC.COLUMNSV WHERE UPPER(databasename) = UPPER(?) AND UPPER(tablename) = UPPER(?)" //$NON-NLS-1$
+ " Order by tablename "; //$NON-NLS-1$ //$NON-NLS-3$
}
} else {
sql = "HELP COLUMN \"" + tableNamePattern + "\".* ";//$NON-NLS-1$//$NON-NLS-2$
if (dbMajorVersion > 12) {
sql = "SELECT * from DBC.COLUMNSV WHERE UPPER(tablename) = UPPER('" + tableNamePattern + "')" + " Order by tablename "; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
sql = "SELECT * from DBC.COLUMNSV WHERE UPPER(tablename) = UPPER(?)" + " Order by tablename "; //$NON-NLS-1$//$NON-NLS-2$
// //$NON-NLS-3$
}
}
ResultSet rs = null;
Statement stmt = null;
PreparedStatement stmt = null;
List<String[]> list = new ArrayList<String[]>();
try {
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
stmt = connection.prepareStatement(sql);
if (!StringUtils.isEmpty(database)) {
if (dbMajorVersion > 12) {
stmt.setString(1, database);
stmt.setString(2, tableNamePattern);
}
} else {
if (dbMajorVersion > 12) {
stmt.setString(1, tableNamePattern);
}
}
rs = stmt.executeQuery();
while (rs.next()) {
String tableName = tableNamePattern;
String columnName = null;

View File

@@ -66,10 +66,22 @@ public class NetworkUtil {
private static final String PROP_HTTP_PROXY_SET = "http.proxySet";
private static final String PROP_NETWORK_STATUS = "network.status"; //$NON-NLS-1$
public static boolean isNetworkValid() {
return isNetworkValid(DEFAULT_TIMEOUT);
}
public static boolean isNetworkValidByStatus() {
String status = System.getProperty(PROP_NETWORK_STATUS);
if (status != null) {
return Boolean.valueOf(status);
}
Boolean isValid = isNetworkValid();
System.setProperty(PROP_NETWORK_STATUS, isValid.toString());
return isValid;
}
public static boolean isNetworkValid(Integer timeout) {
String disableInternet = System.getProperty(TALEND_DISABLE_INTERNET);
if ("true".equals(disableInternet)) { //$NON-NLS-1$

View File

@@ -76,6 +76,8 @@ ExtendedTableMoveCommand.MoveLabel=Move up or down, one or more table entries
ExtendedTablePasteCommand.Paste.Label=Paste data from the internal clipoard
ExtendedTableRemoveCommand.Romve.Label=Remove table entries
ExtendedTableResetDBTypesCommand.ResetDBTypes.Label=Reset all DB Types to get the defaults
ExtendedTableCaseCommand.case.Label=Change selected DB columns to uppercase/lowercase
ExtendedTableQuoteCommand.Quote.Label=Quote selected DB columns
ImportPushButton.ImportButton.Tip=Replace all rows by import from xml file
ImportPushButtonForExtendedTable.ErrorMsg.Text=Error occurred
LabelledFileField.BrowseButton.Text=Browse...

View File

@@ -27,11 +27,13 @@ import org.talend.commons.ui.swt.advanced.dataeditor.button.MoveDownPushButtonFo
import org.talend.commons.ui.swt.advanced.dataeditor.button.MoveUpPushButton;
import org.talend.commons.ui.swt.advanced.dataeditor.button.MoveUpPushButtonForExtendedTable;
import org.talend.commons.ui.swt.advanced.dataeditor.button.PastePushButton;
import org.talend.commons.ui.swt.advanced.dataeditor.button.QuotePushButton;
import org.talend.commons.ui.swt.advanced.dataeditor.button.RemovePushButton;
import org.talend.commons.ui.swt.advanced.dataeditor.button.RemovePushButtonForExtendedTable;
import org.talend.commons.ui.swt.advanced.dataeditor.button.ResetDBTypesPushButton;
import org.talend.commons.ui.swt.advanced.dataeditor.button.SaveAsGenericSchemaPushButton;
import org.talend.commons.ui.swt.advanced.dataeditor.button.SelectContextVariablesPushButton;
import org.talend.commons.ui.swt.advanced.dataeditor.button.CasePushButton;
import org.talend.commons.ui.swt.advanced.dataeditor.control.ExtendedPushButton;
import org.talend.commons.ui.swt.extended.table.AbstractExtendedTableViewer;
@@ -67,7 +69,11 @@ public class ExtendedToolbarView extends AbstractExtendedToolbar {
protected ResetDBTypesPushButton resetDBTypesButton;
protected SelectContextVariablesPushButton selectContextVariablesButton;
protected CasePushButton caseButton;
protected QuotePushButton quoteButton;
/**
* DOC amaumont MatadataToolbarEditor constructor comment.
*
@@ -103,7 +109,11 @@ public class ExtendedToolbarView extends AbstractExtendedToolbar {
pasteButton = createPastePushButton();
addallButton = createAddAllPushButton();
caseButton = createCasePushButton();
quoteButton = createQuotePushButton();
exportButton = createExportPushButton();
importButton = createImportPushButton();
@@ -169,6 +179,14 @@ public class ExtendedToolbarView extends AbstractExtendedToolbar {
protected SelectContextVariablesPushButton createSelectContextVariablesPushButton() {
return null;
}
protected CasePushButton createCasePushButton() {
return null;
}
protected QuotePushButton createQuotePushButton() {
return null;
}
/**
* Getter for addButton.
@@ -327,6 +345,14 @@ public class ExtendedToolbarView extends AbstractExtendedToolbar {
if (getAddallButton() != null) {
list.add(getAddallButton());
}
if (getCaseButton() != null) {
list.add(getCaseButton());
}
if (getQuoteButton() != null) {
list.add(getQuoteButton());
}
return list;
}
@@ -348,6 +374,26 @@ public class ExtendedToolbarView extends AbstractExtendedToolbar {
public AddAllPushButton getAddallButton() {
return this.addallButton;
}
/**
* Getter for caseButton.
*
* @return the caseButton
*/
public CasePushButton getCaseButton() {
return this.caseButton;
}
/**
* Getter for quoteButton.
*
* @return the quoteButton
*/
public QuotePushButton getQuoteButton() {
return this.quoteButton;
}
}
//

View File

@@ -0,0 +1,48 @@
// ============================================================================
//
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.commons.ui.swt.advanced.dataeditor.button;
import org.eclipse.gef.commands.Command;
import org.eclipse.swt.widgets.Composite;
import org.talend.commons.ui.runtime.i18n.Messages;
import org.talend.commons.ui.runtime.image.EImage;
import org.talend.commons.ui.runtime.image.ImageProvider;
import org.talend.commons.ui.swt.advanced.dataeditor.control.ExtendedPushButton;
import org.talend.commons.ui.swt.extended.table.AbstractExtendedControlViewer;
public abstract class CasePushButton extends ExtendedPushButton {
/**
* DOC CasePushButton constructor comment.
*
* @param parent
* @param extendedControlViewer
*/
public CasePushButton(Composite parent, AbstractExtendedControlViewer extendedControlViewer) {
super(parent, extendedControlViewer,
Messages.getString("CasePushButton.CaseButton.Tip"), ImageProvider.getImage(EImage.UPPERCASE_ICON)); //$NON-NLS-1$
}
protected abstract Command getCommandToExecute();
/*
* (non-Javadoc)
*
* @see org.talend.commons.ui.swt.advanced.dataeditor.control.ExtendedPushButton#getEnabledState()
*/
@Override
public boolean getEnabledState() {
return super.getEnabledState() && !getExtendedControlViewer().isReadOnly();
}
}

View File

@@ -0,0 +1,87 @@
// ============================================================================
//
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.commons.ui.swt.advanced.dataeditor.button;
import java.util.Arrays;
import java.util.List;
import org.eclipse.gef.commands.Command;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.widgets.Composite;
import org.talend.commons.ui.runtime.i18n.Messages;
import org.talend.commons.ui.runtime.image.EImage;
import org.talend.commons.ui.runtime.image.ImageProvider;
import org.talend.commons.ui.swt.extended.table.AbstractExtendedTableViewer;
import org.talend.commons.ui.swt.extended.table.ExtendedTableModel;
public abstract class CasePushButtonForExtendedTable extends CasePushButton implements IExtendedTablePushButton {
private EnableStateListenerForTableButton enableStateHandler;
private boolean isUpperCase = true;
/**
* DOC CasePushButtonForExtendedTable constructor comment.
*
* @param parent
* @param extendedControlViewer
*/
public CasePushButtonForExtendedTable(Composite parent, AbstractExtendedTableViewer extendedTableViewer) {
super(parent, extendedTableViewer);
this.enableStateHandler = new EnableStateListenerForTableButton(this);
}
@Override
protected void afterCommandExecution(Command executedCommand) {
super.afterCommandExecution(executedCommand);
if (isUpperCase) {
this.getButton().setToolTipText( Messages.getString("CasePushButton.CaseButton.Tip"));
this.getButton().setImage(ImageProvider.getImage(EImage.LOWERCASE_ICON));
this.isUpperCase = false;
} else {
this.getButton().setToolTipText( Messages.getString("CasePushButton.CaseButton.Tip"));
this.getButton().setImage(ImageProvider.getImage(EImage.UPPERCASE_ICON));
this.isUpperCase = true;
}
}
@Override
protected Command getCommandToExecute() {
AbstractExtendedTableViewer extendedTableViewer = (AbstractExtendedTableViewer) extendedControlViewer;
ExtendedTableModel extendedTableModel = extendedTableViewer.getExtendedTableModel();
TableViewer tableViewer = extendedTableViewer.getTableViewerCreator().getTableViewer();
ISelection selection = tableViewer.getSelection();
StructuredSelection structuredSelection = (StructuredSelection) selection;
Object[] objects = structuredSelection.toArray();
int[] selectionIndices = extendedTableViewer.getTableViewerCreator().getTable().getSelectionIndices();
return getCommandToExecute(extendedTableModel, Arrays.asList(objects), selectionIndices, isUpperCase);
}
protected abstract Command getCommandToExecute(ExtendedTableModel extendedTable, List beansToUppercase, int[] selectionIndices, boolean isUpperCase);
/*
* (non-Javadoc)
*
* @see org.talend.core.ui.extended.button.IExtendedTablePushButton#getExtendedTableViewer()
*/
public AbstractExtendedTableViewer getExtendedTableViewer() {
return (AbstractExtendedTableViewer) getExtendedControlViewer();
}
@Override
public boolean getEnabledState() {
return super.getEnabledState() && this.enableStateHandler.getEnabledState();
}
}

View File

@@ -0,0 +1,57 @@
// ============================================================================
//
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.commons.ui.swt.advanced.dataeditor.button;
import org.eclipse.swt.widgets.Composite;
import org.talend.commons.ui.runtime.i18n.Messages;
import org.talend.commons.ui.runtime.image.EImage;
import org.talend.commons.ui.runtime.image.ImageProvider;
import org.talend.commons.ui.swt.advanced.dataeditor.control.ExtendedPushButton;
import org.talend.commons.ui.swt.extended.table.AbstractExtendedControlViewer;
public abstract class QuotePushButton extends ExtendedPushButton {
private String dbmsId = null;
/**
* DOC QuotePushButton constructor comment.
*
* @param parent
* @param extendedControlViewer
*/
public QuotePushButton(Composite parent, AbstractExtendedControlViewer extendedControlViewer) {
super(parent, extendedControlViewer,
Messages.getString("QuotePushButton.QuoteButton.Tip"), ImageProvider.getImage(EImage.EDIT_ICON)); //$NON-NLS-1$
}
/*
* (non-Javadoc)
*
* @see org.talend.commons.ui.swt.advanced.dataeditor.control.ExtendedPushButton#getEnabledState()
*/
@Override
public boolean getEnabledState() {
return super.getEnabledState() && !getExtendedControlViewer().isReadOnly();
}
public String getDbmsId() {
return dbmsId;
}
public void setDbmsId(String dbmsId) {
this.dbmsId = dbmsId;
}
}

View File

@@ -0,0 +1,205 @@
// ============================================================================
//
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.commons.ui.swt.advanced.dataeditor.button;
import java.util.Arrays;
import java.util.List;
import org.eclipse.gef.commands.Command;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.talend.commons.ui.runtime.i18n.Messages;
import org.talend.commons.ui.swt.extended.table.AbstractExtendedTableViewer;
import org.talend.commons.ui.swt.extended.table.ExtendedTableModel;
public abstract class QuotePushButtonForExtendedTable extends QuotePushButton implements IExtendedTablePushButton {
private String quote = null;
private boolean isAddingQuote = true;
private EnableStateListenerForTableButton enableStateHandler;
/**
* DOC SchemaTargetAddPushButton constructor comment.
*
* @param parent
* @param extendedControlViewer
*/
public QuotePushButtonForExtendedTable(Composite parent, AbstractExtendedTableViewer extendedTableViewer) {
super(parent, extendedTableViewer);
this.enableStateHandler = new EnableStateListenerForTableButton(this);
}
/*
* (non-Javadoc)
*
* @see org.talend.commons.ui.swt.advanced.dataeditor.control.ExtendedPushButton#beforeCommandExecution()
*/
@Override
protected void beforeCommandExecution() {
QuoteManipulateDialog dlg = new QuoteManipulateDialog(getButton().getShell());
if (dlg.open() == Window.OK) {
this.quote = dlg.getQuote();
this.isAddingQuote = dlg.isAddingQuote();
}
}
protected Command getCommandToExecute() {
if (quote == null) return null;
AbstractExtendedTableViewer extendedTableViewer = (AbstractExtendedTableViewer) extendedControlViewer;
ExtendedTableModel extendedTableModel = extendedTableViewer.getExtendedTableModel();
TableViewer tableViewer = extendedTableViewer.getTableViewerCreator().getTableViewer();
ISelection selection = tableViewer.getSelection();
StructuredSelection structuredSelection = (StructuredSelection) selection;
Object[] objects = structuredSelection.toArray();
int[] selectionIndices = extendedTableViewer.getTableViewerCreator().getTable().getSelectionIndices();
return getCommandToExecute(extendedTableModel, Arrays.asList(objects), selectionIndices, quote, isAddingQuote );
}
protected abstract Command getCommandToExecute(ExtendedTableModel extendedTable, List beansToUppercase, int[] selectionIndices, String quote, boolean isAddingQuote);
/*
* (non-Javadoc)
*
* @see org.talend.core.ui.extended.button.IExtendedTablePushButton#getExtendedTableViewer()
*/
public AbstractExtendedTableViewer getExtendedTableViewer() {
return (AbstractExtendedTableViewer) getExtendedControlViewer();
}
@Override
public boolean getEnabledState() {
return super.getEnabledState() && this.enableStateHandler.getEnabledState();
}
class QuoteManipulateDialog extends Dialog {
private Button addBtn;
private Button removeBtn;
private Text quoteTxt;
private Button okBtn;
boolean isAddingQuote = true;
String quote = "";
public QuoteManipulateDialog(Shell parentShel) {
super(parentShel);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
*/
protected void configureShell(Shell shell) {
super.configureShell(shell);
shell.setText(Messages.getString("QuoteManipulateDialog.title"));
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
*/
protected void createButtonsForButtonBar(Composite parent) {
// create OK and Cancel buttons by default
okBtn = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
okBtn.setEnabled(false);
}
/*
* (non-Javadoc) Method declared on Dialog.
*/
protected Control createDialogArea(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 4;
composite.setLayout(layout);
GridData layoutData = new GridData(GridData.FILL_BOTH);
layoutData.widthHint = 400;
composite.setLayoutData(layoutData);
addBtn = new Button(composite, SWT.RADIO);
addBtn.setSelection(true);
Label label = new Label(composite, SWT.WRAP);
label.setText(Messages.getString("QuoteManipulateDialog.addQuote")); //$NON-NLS-1$
removeBtn = new Button(composite, SWT.RADIO);
Label label1 = new Label(composite, SWT.WRAP);
label1.setText(Messages.getString("QuoteManipulateDialog.removeQuote")); //$NON-NLS-1$
quoteTxt = new Text(composite, SWT.SINGLE | SWT.BORDER);
layoutData = new GridData(GridData.FILL_HORIZONTAL);
layoutData.horizontalSpan = 4;
quoteTxt.setLayoutData(layoutData);
quoteTxt.setText("");
quoteTxt.setFocus();
addBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
isAddingQuote = true;
quoteTxt.setFocus();
quote = quoteTxt.getText();
}
});
removeBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
isAddingQuote = false;
quoteTxt.setFocus();
quote = quoteTxt.getText();
}
});
quoteTxt.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
quote = quoteTxt.getText();
if ( quote != null && quote.length() > 0) {
okBtn.setEnabled(true);
} else {
okBtn.setEnabled(false);
}
}
});
return composite;
}
public boolean isAddingQuote() {
return this.isAddingQuote;
}
public String getQuote() {
return this.quote;
}
}
}

View File

@@ -0,0 +1,88 @@
// ============================================================================
//
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.commons.ui.swt.advanced.dataeditor.commands;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.gef.commands.Command;
import org.talend.commons.ui.runtime.i18n.Messages;
import org.talend.commons.ui.swt.extended.table.ExtendedTableModel;
public abstract class ExtendedTableCaseCommand extends Command implements IExtendedTableCommand {
private ExtendedTableModel extendedTable;
private List beansToCovertCase;
private int[] selectionIndices;
private boolean isUpperCase;
public static final String LABEL = Messages.getString("ExtendedTableCaseCommand.case.Label"); //$NON-NLS-1$
/**
* DOC ExtendedTableCaseCommand constructor comment.
*/
@SuppressWarnings("unchecked")//$NON-NLS-1$
public ExtendedTableCaseCommand(ExtendedTableModel extendedTable, List beansToCovertCase, int[] selectionIndices, boolean isUpperCase) {
super(LABEL);
this.extendedTable = extendedTable;
this.beansToCovertCase = new ArrayList(beansToCovertCase);
this.selectionIndices = selectionIndices;
this.isUpperCase = isUpperCase;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.commands.Command#execute()
*/
@Override
public void execute() {
convertCase(extendedTable, beansToCovertCase, selectionIndices, isUpperCase);
}
public abstract void convertCase(ExtendedTableModel extendedTable, List copiedObjectsList, int[] selectionIndices, boolean isUpperCase);
/*
* (non-Javadoc)
*
* @see org.talend.commons.ui.command.CommonCommand#canUndo()
*/
@Override
public boolean canUndo() {
return false;
}
/*
* (non-Javadoc)
*
* @see org.talend.commons.ui.command.CommonCommand#redo()
*/
@Override
public void redo() {
}
/*
* (non-Javadoc)
*
* @see org.talend.commons.ui.command.CommonCommand#undo()
*/
@Override
public void undo() {
}
}

View File

@@ -0,0 +1,90 @@
// ============================================================================
//
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.commons.ui.swt.advanced.dataeditor.commands;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.gef.commands.Command;
import org.talend.commons.ui.runtime.i18n.Messages;
import org.talend.commons.ui.swt.extended.table.ExtendedTableModel;
public abstract class ExtendedTableQuoteCommand extends Command implements IExtendedTableCommand {
private ExtendedTableModel extendedTable;
private List beansToQuote;
private int[] selectionIndices;
private String quote;
boolean isAddingQuote;
public static final String LABEL = Messages.getString("ExtendedTableQuoteCommand.Quote.Label"); //$NON-NLS-1$
/**
* DOC ExtendedTableQuoteCommand constructor comment.
*/
@SuppressWarnings("unchecked")//$NON-NLS-1$
public ExtendedTableQuoteCommand(ExtendedTableModel extendedTable, List beansToQuote, int[] selectionIndices, String quote, boolean isAddingQuote) {
super(LABEL);
this.extendedTable = extendedTable;
this.beansToQuote = new ArrayList(beansToQuote);
this.selectionIndices = selectionIndices;
this.quote = quote;
this.isAddingQuote = isAddingQuote;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.commands.Command#execute()
*/
@Override
public void execute() {
toQuote(extendedTable, beansToQuote, selectionIndices, quote, isAddingQuote);
}
public abstract void toQuote(ExtendedTableModel extendedTable, List copiedObjectsList, int[] selectionIndices, String quote, boolean isAddingQuote);
/*
* (non-Javadoc)
*
* @see org.talend.commons.ui.command.CommonCommand#canUndo()
*/
@Override
public boolean canUndo() {
return false;
}
/*
* (non-Javadoc)
*
* @see org.talend.commons.ui.command.CommonCommand#redo()
*/
@Override
public void redo() {
}
/*
* (non-Javadoc)
*
* @see org.talend.commons.ui.command.CommonCommand#undo()
*/
@Override
public void undo() {
}
}

View File

@@ -15,12 +15,12 @@ package org.talend.commons.ui.swt.colorstyledtext.rules;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.text.rules.ICharacterScanner;
import org.eclipse.jface.text.rules.IRule;
import org.eclipse.jface.text.rules.IToken;
import org.eclipse.jface.text.rules.IWordDetector;
import org.eclipse.jface.text.rules.Token;
import org.eclipse.jface.util.Assert;
/**
* An implementation of <code>IRule</code> capable of detecting words Word rules also allow for the association of

View File

@@ -12,7 +12,7 @@
// ============================================================================
package org.talend.commons.ui.swt.colorstyledtext.rules;
import org.eclipse.jface.util.Assert;
import org.eclipse.core.runtime.Assert;
import org.talend.commons.ui.swt.colorstyledtext.jedit.Rule;
import org.talend.commons.ui.swt.colorstyledtext.jedit.Type;

View File

@@ -178,6 +178,23 @@ public class ExtendedTableModel<B> extends AbstractExtendedControlModel {
public void setUseEquals(boolean useEquals) {
beansList.setUseEquals(useEquals);
}
/**
*
* Replace bean.
*
* @param bean
* @param index can be null
*/
public void replace(B bean, Integer index) {
if (tableViewer != null && !tableViewer.getTable().isDisposed()) {
tableViewer.replace(bean, index);
tableViewer.refresh(bean, true, true);
}
this.beansList.replaceElement(index, bean);
}
/**
* DOC amaumont Comment method "remove".

View File

@@ -27,6 +27,7 @@ import org.apache.oro.text.regex.PatternCompiler;
import org.apache.oro.text.regex.PatternMatcher;
import org.apache.oro.text.regex.Perl5Compiler;
import org.apache.oro.text.regex.Perl5Matcher;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.jface.bindings.keys.KeyStroke;
import org.eclipse.jface.dialogs.PopupDialog;
@@ -34,7 +35,6 @@ import org.eclipse.jface.fieldassist.IContentProposal;
import org.eclipse.jface.fieldassist.IContentProposalListener;
import org.eclipse.jface.fieldassist.IContentProposalProvider;
import org.eclipse.jface.fieldassist.IControlContentAdapter;
import org.eclipse.jface.util.Assert;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;

View File

@@ -12,7 +12,7 @@
// ============================================================================
package org.talend.commons.ui.utils.data.text.rules;
import org.eclipse.jface.text.Assert;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.text.rules.ICharacterScanner;
import org.eclipse.jface.text.rules.IPredicateRule;
import org.eclipse.jface.text.rules.IRule;

View File

@@ -12,8 +12,8 @@
// ============================================================================
package org.talend.commons.ui.utils.workbench.preferences;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.preference.FieldEditor;
import org.eclipse.jface.util.Assert;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

View File

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

View File

@@ -23,8 +23,6 @@ import java.util.Map;
import java.util.Optional;
import java.util.Set;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.PredicateUtils;
import org.apache.commons.lang.ArrayUtils;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.ISafeRunnable;
@@ -95,6 +93,7 @@ import org.talend.core.repository.model.repositoryObject.SalesforceModuleReposit
import org.talend.core.repository.recyclebin.RecycleBinManager;
import org.talend.core.repository.ui.utils.ProjectRepositoryNodeCache;
import org.talend.core.runtime.services.IGenericDBService;
import org.talend.core.runtime.services.IGenericService;
import org.talend.core.runtime.services.IGenericWizardService;
import org.talend.core.ui.ICDCProviderService;
import org.talend.core.ui.ITestContainerProviderService;
@@ -392,10 +391,7 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
}
private void initNodesFromComponentSerivice(RepositoryNode curParentNode) {
IGenericWizardService wizardService = null;
if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericWizardService.class)) {
wizardService = GlobalServiceRegister.getDefault().getService(IGenericWizardService.class);
}
IGenericService wizardService = IGenericService.getService();
if (wizardService != null) {
List<RepositoryNode> nodes = wizardService.createNodesFromComponentService(curParentNode);
for (RepositoryNode repNode : nodes) {

View File

@@ -40,10 +40,12 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
@@ -70,8 +72,10 @@ import org.talend.commons.exception.SystemException;
import org.talend.commons.runtime.model.repository.ERepositoryStatus;
import org.talend.commons.runtime.service.ITaCoKitService;
import org.talend.commons.ui.gmf.util.DisplayUtils;
import org.talend.commons.ui.runtime.CommonUIPlugin;
import org.talend.commons.ui.runtime.exception.MessageBoxExceptionHandler;
import org.talend.commons.utils.data.container.RootContainer;
import org.talend.commons.utils.generation.JavaUtils;
import org.talend.commons.utils.network.TalendProxySelector;
import org.talend.commons.utils.time.TimeMeasurePerformance;
import org.talend.commons.utils.workbench.resources.ResourceUtils;
@@ -85,7 +89,8 @@ import org.talend.core.context.CommandLineContext;
import org.talend.core.context.Context;
import org.talend.core.context.RepositoryContext;
import org.talend.core.exception.TalendInternalPersistenceException;
import org.talend.core.hadoop.BigDataBasicUtil;
import org.talend.core.hadoop.IHadoopDistributionService;
import org.talend.core.model.components.IComponentsService;
import org.talend.core.model.general.ILibrariesService;
import org.talend.core.model.general.ModuleNeeded;
import org.talend.core.model.general.Project;
@@ -134,10 +139,12 @@ import org.talend.core.repository.utils.ProjectDataJsonProvider;
import org.talend.core.repository.utils.RepositoryPathProvider;
import org.talend.core.repository.utils.XmiResourceManager;
import org.talend.core.runtime.CoreRuntimePlugin;
import org.talend.core.runtime.hd.IDynamicDistributionManager;
import org.talend.core.runtime.repository.item.ItemProductKeys;
import org.talend.core.runtime.services.IGenericWizardService;
import org.talend.core.runtime.services.IMavenUIService;
import org.talend.core.runtime.util.ItemDateParser;
import org.talend.core.runtime.util.JavaHomeUtil;
import org.talend.core.runtime.util.SharedStudioUtils;
import org.talend.core.service.ICoreUIService;
import org.talend.core.utils.CodesJarResourceCache;
@@ -2191,9 +2198,6 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
ExceptionHandler.process(e);
}
// init dynamic distirbution after `beforeLogon`, before loading libraries.
initDynamicDistribution(monitor);
// init sdk component
try {
currentMonitor = subMonitor.newChild(1, SubMonitor.SUPPRESS_NONE);
@@ -2224,6 +2228,14 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
}
}
if (CommonsPlugin.isJUnitTest() || PluginChecker.isSWTBotLoaded()) {
// component init for cmdline is done in another place
currentMonitor = subMonitor.newChild(1, SubMonitor.SUPPRESS_NONE);
currentMonitor.beginTask(Messages.getString("ProxyRepositoryFactory.load.componnents"), 1); //$NON-NLS-1$
IComponentsService.get().getComponentsFactory().getComponents();
TimeMeasurePerformance.step("logOnProject", "Initialize components"); //$NON-NLS-1$
}
ICoreService coreService = getCoreService();
if (coreService != null) {
currentMonitor = subMonitor.newChild(1, SubMonitor.SUPPRESS_NONE);
@@ -2240,8 +2252,6 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
ExceptionHandler.process(e);
}
CodesJarResourceCache.initCodesJarCache();
currentMonitor = subMonitor.newChild(1, SubMonitor.SUPPRESS_NONE);
currentMonitor.beginTask("Execute before logon migrations tasks", 1); //$NON-NLS-1$
ProjectManager.getInstance().getMigrationRecords().clear();
@@ -2260,15 +2270,10 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
emptyTempFolder(project);
currentMonitor = subMonitor.newChild(1, SubMonitor.SUPPRESS_NONE);
currentMonitor.beginTask(Messages.getString("ProxyRepositoryFactory.load.componnents"), 1); //$NON-NLS-1$
ICoreUIService coreUiService = null;
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreUIService.class)) {
coreUiService = GlobalServiceRegister.getDefault().getService(ICoreUIService.class);
}
if (coreUiService != null) {
coreUiService.componentsReset();
}
fireRepositoryPropertyChange(ERepositoryActionName.PROJECT_PREFERENCES_RELOAD.getName(), null, null);
@@ -2295,6 +2300,7 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
}
if (coreService != null) {
updateProjectJavaVersionIfNeed();
// clean workspace
currentMonitor.beginTask(Messages.getString("ProxyRepositoryFactory.cleanWorkspace"), 1); //$NON-NLS-1$
@@ -2309,27 +2315,13 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
currentMonitor.beginTask(Messages.getString("ProxyRepositoryFactory.synch.repo.items"), 1); //$NON-NLS-1$
if (!isCommandLineLocalRefProject) {
try {
coreService.syncAllRoutines();
// PTODO need refactor later, this is not good, I think
coreService.syncAllBeans();
} catch (SystemException e1) {
//
ExceptionHandler.process(e1);
}
syncAndInstallCodes(currentMonitor);
}
}
if (monitor != null && monitor.isCanceled()) {
throw new OperationCanceledException(""); //$NON-NLS-1$
}
// rules
if (coreUiService != null && PluginChecker.isRulesPluginLoaded()) {
coreUiService.syncAllRules();
}
if (monitor != null && monitor.isCanceled()) {
throw new OperationCanceledException(""); //$NON-NLS-1$
}
TimeMeasurePerformance.step("logOnProject", "sync repository (routines/rules/beans)"); //$NON-NLS-1$ //$NON-NLS-2$
// log4j prefs
if (coreUiService != null && coreService != null) {
@@ -2348,11 +2340,6 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
ExceptionHandler.process(e);
}
if (runProcessService != null && !isCommandLineLocalRefProject) {
runProcessService.initializeRootPoms(monitor);
TimeMeasurePerformance.step("logOnProject", "install / setup root poms"); //$NON-NLS-1$ //$NON-NLS-2$
}
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITDQRepositoryService.class)) {
ITDQRepositoryService tdqRepositoryService = GlobalServiceRegister.getDefault()
.getService(ITDQRepositoryService.class);
@@ -2360,8 +2347,10 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
tdqRepositoryService.initProxyRepository();
}
}
// regenerate relationship index
if (project.getEmfProject().getItemsRelations().isEmpty()) {
// regenerate relationship index if error index found
try {
ProjectDataJsonProvider.checkRelationShipSetting(project.getEmfProject());
} catch (Exception e) {
RelationshipItemBuilder.getInstance().buildAndSaveIndex();
}
@@ -2386,16 +2375,67 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
throw e;
}
}
private void initDynamicDistribution(IProgressMonitor monitor) {
private void updateProjectJavaVersionIfNeed() {
String specifiedVersion = null;
String currentVersion = JavaUtils.getProjectJavaVersion();
String newVersion = null;
try {
if (BigDataBasicUtil.isDynamicDistributionLoaded(monitor)) {
BigDataBasicUtil.reloadAllDynamicDistributions(monitor);
} else {
BigDataBasicUtil.loadDynamicDistribution(monitor);
JavaHomeUtil.initializeJavaHome();
} catch (CoreException ex) {
ExceptionHandler.process(ex);
}
if (CommonUIPlugin.isFullyHeadless()) {
specifiedVersion = JavaHomeUtil.getSpecifiedJavaVersion();
}
if (specifiedVersion == null) {
newVersion = currentVersion != null ? currentVersion : JavaUtils.DEFAULT_VERSION;
} else {
newVersion = specifiedVersion;
}
JavaUtils.updateProjectJavaVersion(newVersion);
}
private void syncAndInstallCodes(IProgressMonitor monitor) {
if (CommonsPlugin.isHeadless() || CommonsPlugin.isJUnitTest() || PluginChecker.isSWTBotLoaded()) {
try {
doSyncAndInstallCodes(monitor);
} catch (SystemException e) {
ExceptionHandler.process(e);
}
} catch (Exception e) {
ExceptionHandler.process(e);
} else {
Job job = new Job("Synchronize and install codes") {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
doSyncAndInstallCodes(monitor);
return org.eclipse.core.runtime.Status.OK_STATUS;
} catch (Exception e) {
return new org.eclipse.core.runtime.Status(IStatus.ERROR, CoreRepositoryPlugin.PLUGIN_ID, 1,
e.getMessage(), e);
}
}
};
job.setUser(false);
job.setPriority(Job.LONG);
job.schedule();
}
}
private void doSyncAndInstallCodes(IProgressMonitor monitor) throws SystemException {
ICoreService coreService = getCoreService();
if (coreService != null) {
CodesJarResourceCache.reset();
coreService.syncAllRoutines();
coreService.syncAllBeans();
TimeMeasurePerformance.step("logOnProject", "sync repository (routines/beans)"); //$NON-NLS-1$ //$NON-NLS-2$
}
if (IRunProcessService.get() != null) {
IRunProcessService.get().initializeRootPoms(monitor);
TimeMeasurePerformance.step("logOnProject", "install / setup root poms"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -2456,6 +2496,25 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
if (runProcessService != null) {
runProcessService.clearProjectRelatedSettings();
}
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreUIService.class)) {
ICoreUIService coreUiService = GlobalServiceRegister.getDefault().getService(ICoreUIService.class);
if (coreUiService != null) {
coreUiService.componentsReset();
}
}
if (GlobalServiceRegister.getDefault().isServiceRegistered(IHadoopDistributionService.class)) {
IHadoopDistributionService hdService = GlobalServiceRegister.getDefault()
.getService(IHadoopDistributionService.class);
if (hdService != null) {
IDynamicDistributionManager dynamicDistrManager = hdService.getDynamicDistributionManager();
dynamicDistrManager.reset(null);
}
}
CodesJarResourceCache.reset();
ReferenceProjectProvider.clearTacReferenceList();
ReferenceProjectProblemManager.getInstance().clearAll();
fullLogonFinished = false;
@@ -2774,7 +2833,7 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
ILoginTask[] allLoginTasks = LOGIN_TASK_REGISTRY_READER.getAllTaskListInstance();
for (ILoginTask task : allLoginTasks) {
if (task.isRequiredAlways()) {
task.run(monitor);
task.execute(monitor);
}
}
}

View File

@@ -224,14 +224,15 @@ public class ProjectDataJsonProvider {
ExceptionHandler.process(e);
}
}
public static List<ItemRelationsJson> checkRelationShipSetting(Project project) throws PersistenceException {
List<ItemRelationsJson> itemRelationsJsonsList = null;
public static void checkAndRectifyRelationShipSetting(Project project) throws PersistenceException {
File file = getSavingConfigurationFile(project.getTechnicalLabel(), FileConstants.RELATIONSHIP_FILE_NAME);
if (file == null || !file.exists()) {
return;
return itemRelationsJsonsList;
}
List<ItemRelationsJson> itemRelationsJsonsList = null;
TypeReference<List<ItemRelationsJson>> typeReference = new TypeReference<List<ItemRelationsJson>>() {
};
FileInputStream input = null;
@@ -243,6 +244,11 @@ public class ProjectDataJsonProvider {
} finally {
closeInputStream(input);
}
return itemRelationsJsonsList;
}
public static void checkAndRectifyRelationShipSetting(Project project) throws PersistenceException {
List<ItemRelationsJson> itemRelationsJsonsList = checkRelationShipSetting(project);
if (itemRelationsJsonsList == null || itemRelationsJsonsList.isEmpty()) {
return;

View File

@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry exported="true" kind="lib" path="lib/resty-0.3.2.jar" />
<classpathentry exported="true" kind="lib" path="lib/delight-rhino-sandbox-0.0.15.jar"/>
<classpathentry exported="true" kind="lib" path="lib/rhino-1.7.13.jar"/>
<classpathentry exported="true" kind="lib" path="lib/resty-0.3.2.jar"/>
<classpathentry exported="true" kind="lib" path="lib/json_simple-1.1.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>

View File

@@ -130,5 +130,7 @@ Bundle-Activator: org.talend.core.runtime.CoreRuntimePlugin
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .,
lib/resty-0.3.2.jar,
lib/json_simple-1.1.jar
lib/json_simple-1.1.jar,
lib/delight-rhino-sandbox-0.0.15.jar,
lib/rhino-1.7.13.jar
Eclipse-RegisterBuddy: org.talend.testutils

View File

@@ -12,7 +12,9 @@ bin.includes = META-INF/,\
lib/,\
talend_metadata_columns_schema.xsd,\
talend_targetschema_columns_schema.xsd,\
dist/
dist/,\
lib/delight-rhino-sandbox-0.0.15.jar,\
lib/rhino-1.7.13.jar
src.includes = META-INF/,\
mappingMetadataTypes.xml,\
mappings/,\

View File

@@ -9,19 +9,61 @@
</parent>
<artifactId>org.talend.core.runtime</artifactId>
<packaging>eclipse-plugin</packaging>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.javadelight/delight-rhino-sandbox -->
<dependency>
<groupId>org.javadelight</groupId>
<artifactId>delight-rhino-sandbox</artifactId>
<version>0.0.15</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mozilla/rhino -->
<dependency>
<groupId>org.mozilla</groupId>
<artifactId>rhino</artifactId>
<version>1.7.13</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<executions>
<execution>
<id>default-deploy</id>
<phase>deploy</phase>
</execution>
</executions>
</plugin>
</plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>generate-sources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${project.basedir}/lib</outputDirectory>
<artifactItems>
<artifactItem>
<groupId>org.javadelight</groupId>
<artifactId>delight-rhino-sandbox</artifactId>
<version>0.0.15</version>
</artifactItem>
<artifactItem>
<groupId>org.mozilla</groupId>
<artifactId>rhino</artifactId>
<version>1.7.13</version>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<executions>
<execution>
<id>default-deploy</id>
<phase>deploy</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -40,8 +40,6 @@ public interface ILibraryManagerService extends IService {
*/
public boolean isInitialized();
public void setInitialized();
public void installModules(Collection<ModuleNeeded> modules, IProgressMonitor monitorWrap);
/**

View File

@@ -34,6 +34,7 @@ import org.talend.core.ILibraryManagerService;
import org.talend.core.database.conn.ConnParameterKeys;
import org.talend.core.database.conn.template.DbConnStrForHive;
import org.talend.core.hadoop.BigDataBasicUtil;
import org.talend.core.hadoop.IHadoopDistributionService;
import org.talend.core.model.general.ModuleNeeded;
import org.talend.core.model.general.Project;
import org.talend.core.model.metadata.IMetadataConnection;
@@ -82,7 +83,7 @@ public class ClassLoaderFactory {
}
public static DynamicClassLoader getClassLoader(String index, boolean showDownloadIfNotExist) {
DynamicClassLoader classLoader = getClassLoaderMap().get(index);
DynamicClassLoader classLoader = getClassLoaderMap(index).get(index);
if (classLoader == null) {
classLoader = findLoader(index, null, showDownloadIfNotExist);
}
@@ -91,7 +92,7 @@ public class ClassLoaderFactory {
}
public static DynamicClassLoader getClassLoader(String index, ClassLoader parentClassLoader) {
DynamicClassLoader classLoader = getClassLoaderMap().get(index);
DynamicClassLoader classLoader = getClassLoaderMap(index).get(index);
if (classLoader == null) {
classLoader = findLoader(index, parentClassLoader, true);
}
@@ -154,12 +155,12 @@ public class ClassLoaderFactory {
private static DynamicClassLoader createCustomClassLoader(String index, Set<String> libraries) {
DynamicClassLoader classLoader = new DynamicClassLoader();
loadLibraries(classLoader, libraries.toArray(new String[0]), true);
getClassLoaderMap().put(index, classLoader);
getClassLoaderMap(index).put(index, classLoader);
return classLoader;
}
private static void init() {
private static void init(String index) {
File tmpFolder = getTmpFolder();
if (tmpFolder.exists()) {
FilesUtils.removeFolder(tmpFolder, true);
@@ -168,7 +169,7 @@ public class ClassLoaderFactory {
}
public static IConfigurationElement findIndex(String index) {
IConfigurationElement[] elements = getConfigurationElements();
IConfigurationElement[] elements = getConfigurationElements(index);
if (StringUtils.isNotEmpty(index) && elements != null) {
for (IConfigurationElement current : elements) {
String key = current.getAttribute(INDEX_ATTR);
@@ -225,7 +226,7 @@ public class ClassLoaderFactory {
}
if (putInCache) {
// if any libraries can't be retreived , do not put it in cache
getClassLoaderMap().put(index, classLoader);
getClassLoaderMap(index).put(index, classLoader);
}
return classLoader;
}
@@ -337,7 +338,7 @@ public class ClassLoaderFactory {
}
public static String[] getDriverModuleList(String connKeyString) {
IConfigurationElement[] elements = getConfigurationElements();
IConfigurationElement[] elements = getConfigurationElements(connKeyString);
if (connKeyString != null && elements != null) {
for (IConfigurationElement current : elements) {
String key = current.getAttribute(INDEX_ATTR);
@@ -365,12 +366,36 @@ public class ClassLoaderFactory {
return hdClassLoader;
}
private static IConfigurationElement[] getConfigurationElements() {
checkCache();
private static IConfigurationElement[] getConfigurationElements(String index) {
checkCache(index);
return configurationElements;
}
private synchronized static void checkCache() {
private static String getVersion(String index) {
if (StringUtils.isBlank(index)) {
return null;
}
String[] split = index.split(":");
if (2 < split.length) {
return split[2];
} else {
return null;
}
}
private synchronized static void checkCache(String index) {
try {
String version = getVersion(index);
if (StringUtils.isNotBlank(version)) {
IHadoopDistributionService hdService = IHadoopDistributionService.get();
if (hdService != null) {
hdService.checkDynamicDistributionExtensions(version);
}
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
boolean isCacheChanged = false;
if (configurationElements != null) {
for (IConfigurationElement configElement : configurationElements) {
@@ -379,17 +404,17 @@ public class ClassLoaderFactory {
}
}
}
if (!StringUtils.equals(cacheVersion, BigDataBasicUtil.getDynamicDistributionCacheVersion())) {
if (!StringUtils.equals(cacheVersion, BigDataBasicUtil.getDynamicDistributionPluginExtensionCacheVersion())) {
isCacheChanged = true;
}
if (isCacheChanged) {
init();
init(index);
IExtensionRegistry registry = Platform.getExtensionRegistry();
configurationElements = registry.getConfigurationElementsFor(EXTENSION_POINT_ID);
cacheVersion = BigDataBasicUtil.getDynamicDistributionCacheVersion();
cacheVersion = BigDataBasicUtil.getDynamicDistributionPluginExtensionCacheVersion();
} else {
if (classLoadersMap == null) {
init();
init(index);
}
if (configurationElements == null) {
IExtensionRegistry registry = Platform.getExtensionRegistry();
@@ -398,8 +423,8 @@ public class ClassLoaderFactory {
}
}
private static Map<String, DynamicClassLoader> getClassLoaderMap() {
checkCache();
private static Map<String, DynamicClassLoader> getClassLoaderMap(String index) {
checkCache(index);
return classLoadersMap;
}
}

View File

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

View File

@@ -228,8 +228,10 @@ public class DatabaseConnStrUtil {
.get(ConnParameterKeys.IMPALA_AUTHENTICATION_PRINCIPLA));
}
String url = null;
if (template.startsWith(DbConnStrForHive.URL_HIVE_2_TEMPLATE)) {
url = getImpalaURLString(false, server, port, sidOrDatabase, impalaPrincipal);
String driver = dbConn.getParameters().get(ConnParameterKeys.IMPALA_DRIVER);
if (template.startsWith(DbConnStrForHive.URL_HIVE_2_TEMPLATE)
|| template.startsWith(DbConnStrForHive.URL_IMPALA_TEMPLATE)) {
url = getImpalaURLString(false, server, port, sidOrDatabase, impalaPrincipal, driver);
}
url = attachAdditionalHiveParameters(url, dbConn, false);
return url;
@@ -376,9 +378,13 @@ public class DatabaseConnStrUtil {
return s;
}
private static String getImpalaURLString(boolean supportContext, String server, String port, String sid, String Principal) {
String s = EDatabaseConnTemplate.IMPALA.getUrlTemplate(null);
String standardURlString = getImpalaURlString(s, supportContext, server, port, sid);
private static String getImpalaURLString(boolean supportContext, String server, String port, String sid, String Principal,
String driver) {
String template = EDatabaseConnTemplate.IMPALA.getUrlTemplate(null);
if (EDatabaseTypeName.IMPALA.getDbType().equals(driver)) {
template = EDatabaseConnTemplate.IMPALA_IMPALA_DRIVER.getUrlTemplate(null);
}
String standardURlString = getImpalaURlString(template, supportContext, server, port, sid);
String principalSuffix = "principal="; //$NON-NLS-1$
boolean hasPrinc = false;
String[] urlArray = standardURlString.split(SEMICOLON);

View File

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

View File

@@ -214,6 +214,9 @@ public enum EDatabaseConnTemplate {
IMPALA(new DbConnStr(EDatabaseTypeName.IMPALA, "jdbc:hive2://<host>:<port>/<sid>;auth=noSasl", //$NON-NLS-1$
"21050", null, null, "localhost", "default")), //$NON-NLS-1$
IMPALA_IMPALA_DRIVER(new DbConnStr(EDatabaseTypeName.IMPALA, "jdbc:impala://<host>:<port>/<sid>;auth=noSasl", //$NON-NLS-1$
"21050", null, null, "localhost", "default")), //$NON-NLS-1$
HBASE(new DbConnStr(EDatabaseTypeName.HBASE, "127.0.0.1", //$NON-NLS-1$
"2181")), //$NON-NLS-1$

View File

@@ -84,7 +84,11 @@ public enum EDatabaseVersion4Drivers {
MSSQL_2012(new DbVersion4Drivers(EDatabaseTypeName.MSSQL,
"Microsoft SQL Server 2012", "Microsoft SQL Server 2012", "jtds-1.3.1-patch-20190523.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
MSSQL_PROP(new DbVersion4Drivers(EDatabaseTypeName.MSSQL,
"Microsoft", "MSSQL_PROP", "mssql-jdbc.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"Microsoft", "MSSQL_PROP", //$NON-NLS-1$ //$NON-NLS-2$
new String[] { "mssql-jdbc.jar", "slf4j-api-1.7.25.jar", "slf4j-log4j12-1.7.25.jar", "adal4j-1.6.5.jar", //$NON-NLS-1$
"commons-lang3-3.10.jar", "commons-codec-1.14.jar", "gson-2.8.6.jar", "oauth2-oidc-sdk-6.5.jar",
"json-smart-2.4.2.jar", "nimbus-jose-jwt-8.11.jar", "javax.mail-1.6.2.jar", "log4j-1.2.17.jar",
"accessors-smart-1.1.jar", "asm-5.0.3.jar" })),
VERTICA_9(new DbVersion4Drivers(EDatabaseTypeName.VERTICA, "VERTICA 9.X", "VERTICA_9_0", "vertica-jdbc-9.3.1-0.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
VERTICA_7_1_X(new DbVersion4Drivers(EDatabaseTypeName.VERTICA, "VERTICA 7.1.X (Deprecated)", "VERTICA_7_1_X", "vertica-jdbc-7.1.2-0.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

View File

@@ -37,5 +37,7 @@ public interface DownloadListener {
* Notify after download complete.
*/
void downloadComplete();
default void downloadFailed(Exception ex) {
}
}

View File

@@ -24,5 +24,13 @@ public interface IDownloadHelper {
public void setCancel(boolean cancel);
public void download(URL componentUrl, File destination) throws Exception;
default URL getDownloadingURL() {
return null;
}
default long getContentLength() {
return -1l;
}
}

View File

@@ -132,4 +132,17 @@ public class BigDataBasicUtil {
}
return null;
}
public static String getDynamicDistributionPluginExtensionCacheVersion() {
try {
IDynamicDistributionManager ddManager = getDynamicDistributionManager(new NullProgressMonitor());
if (ddManager != null && ddManager.isLoaded()) {
return ddManager.getPluginExtensionCacheVersion();
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
return null;
}
}

View File

@@ -14,6 +14,7 @@ package org.talend.core.hadoop;
import java.util.Map;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.IService;
import org.talend.core.runtime.hd.IDistributionsManager;
import org.talend.core.runtime.hd.IDynamicDistributionManager;
@@ -64,6 +65,8 @@ public interface IHadoopDistributionService extends IService {
*/
IHDistributionVersion getHadoopDistributionVersion(String version, boolean byDisplay);
boolean checkDynamicDistributionExtensions(String version);
/**
*
* for Hadoop Distribution {@link HadoopComponent}.
@@ -128,4 +131,13 @@ public interface IHadoopDistributionService extends IService {
boolean doSupportMapRTicket(IHDistributionVersion distributionVersion);
IDynamicDistributionManager getDynamicDistributionManager();
public static IHadoopDistributionService get() {
GlobalServiceRegister gsr = GlobalServiceRegister.getDefault();
if (gsr.isServiceRegistered(IHadoopDistributionService.class)) {
return gsr.getService(IHadoopDistributionService.class);
}
return null;
}
}

View File

@@ -26,11 +26,6 @@ public enum ECustomVersionGroup {
MAPRDB,
PIG,
PIG_HBASE,
PIG_HCATALOG,
MAP_REDUCE,
SPARK,

View File

@@ -18,12 +18,6 @@ public enum ECustomVersionType {
MAPRDB("Maprdb", ECustomVersionGroup.MAPRDB), //$NON-NLS-1$
PIG("Pig", ECustomVersionGroup.PIG), //$NON-NLS-1$
PIG_HBASE("Pig for HBase", ECustomVersionGroup.PIG_HBASE), //$NON-NLS-1$
PIG_HCATALOG("Pig for Hcatalog", ECustomVersionGroup.PIG_HCATALOG), //$NON-NLS-1$
MAP_REDUCE("Map Reduce", ECustomVersionGroup.MAP_REDUCE), //$NON-NLS-1$
SPARK("Spark", ECustomVersionGroup.SPARK), //$NON-NLS-1$

View File

@@ -483,7 +483,7 @@ public class HadoopCustomVersionDefineDialog extends TitleAreaDialog {
private boolean isSupportHadoop() {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IHadoopService.class)) {
hadoopService = (IHadoopService) GlobalServiceRegister.getDefault().getService(IHadoopService.class);
hadoopService = GlobalServiceRegister.getDefault().getService(IHadoopService.class);
}
return hadoopService != null;
@@ -503,11 +503,7 @@ public class HadoopCustomVersionDefineDialog extends TitleAreaDialog {
private ECustomVersionType[] filterTypes(Object[] types) {
Object[] filteredTypes = ArrayUtils.removeElement(types, ECustomVersionType.ALL);
IDesignerCoreService designerCoreService = CoreRuntimePlugin.getInstance().getDesignerCoreService();
INode node = designerCoreService.getRefrenceNode("tPigLoad"); //$NON-NLS-1$
if (node == null) {
filteredTypes = ArrayUtils.removeElement(filteredTypes, ECustomVersionType.PIG);
}
node = designerCoreService.getRefrenceNode("tMRConfiguration", ComponentCategory.CATEGORY_4_MAPREDUCE.getName());//$NON-NLS-1$
INode node = designerCoreService.getRefrenceNode("tMRConfiguration", ComponentCategory.CATEGORY_4_MAPREDUCE.getName());//$NON-NLS-1$
if (node == null) {
filteredTypes = ArrayUtils.removeElement(filteredTypes, ECustomVersionType.MAP_REDUCE);
}

View File

@@ -425,7 +425,7 @@ public class HadoopVersionDialog extends TitleAreaDialog {
if (isFromExistVersion) {
IHadoopService hadoopService = null;
if (GlobalServiceRegister.getDefault().isServiceRegistered(IHadoopService.class)) {
hadoopService = (IHadoopService) GlobalServiceRegister.getDefault().getService(IHadoopService.class);
hadoopService = GlobalServiceRegister.getDefault().getService(IHadoopService.class);
}
if (hadoopService != null) {
for (ECustomVersionGroup group : existVersionSelectionMap.keySet()) {
@@ -437,10 +437,7 @@ public class HadoopVersionDialog extends TitleAreaDialog {
for (ECustomVersionType type : types) {
if (type.getGroup() == group) {
Set<String> hadoopLibraries = new HashSet<String>();
if (ECustomVersionType.PIG == type || ECustomVersionType.PIG_HBASE == type
|| ECustomVersionType.PIG_HCATALOG == type) {
hadoopLibraries = getLibrariesForPig(type);
} else if (ECustomVersionType.MAP_REDUCE == type) {
if (ECustomVersionType.MAP_REDUCE == type) {
hadoopLibraries = getLibrariesForMapReduce(type);
} else if (ECustomVersionType.SPARK == type || ECustomVersionType.SPARK_STREAMING == type) {
hadoopLibraries = getLibrariesForSpark(type);
@@ -542,42 +539,6 @@ public class HadoopVersionDialog extends TitleAreaDialog {
return neededLibraries;
}
private Set<String> getLibrariesForPig(ECustomVersionType type) {
Set<String> neededLibraries = new HashSet<String>();
INode node = CoreRuntimePlugin.getInstance().getDesignerCoreService().getRefrenceNode("tPigLoad");//$NON-NLS-1$
IElementParameter elementParameter = node.getElementParameter("MAPREDUCE");//$NON-NLS-1$
if (elementParameter != null) {
elementParameter.setValue(true);
}
elementParameter = node.getElementParameter("DISTRIBUTION");//$NON-NLS-1$
if (elementParameter != null) {
elementParameter.setValue(distribution);
}
elementParameter = node.getElementParameter("PIG_VERSION");//$NON-NLS-1$
if (elementParameter != null) {
elementParameter.setValue(version);
}
elementParameter = node.getElementParameter("LOAD");//$NON-NLS-1$
if (elementParameter != null) {
if (ECustomVersionType.PIG_HBASE == type) {
elementParameter.setValue("HBASESTORAGE");//$NON-NLS-1$
} else if (ECustomVersionType.PIG_HCATALOG == type) {
elementParameter.setValue("HCATLOADER");//$NON-NLS-1$
}
}
List<ModuleNeeded> modulesNeeded = node.getModulesNeeded();
for (ModuleNeeded module : modulesNeeded) {
if (module.isRequired(node.getElementParameters())) {
neededLibraries.add(module.getModuleName());
}
}
return neededLibraries;
}
public Map<ECustomVersionType, Map<String, Object>> getTypeConfigurations() {
return this.typeConfigurations;
}

View File

@@ -12,89 +12,126 @@
// ============================================================================
package org.talend.core.model.components;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import java.io.File;
import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.xmi.XMLResource;
import org.eclipse.emf.ecore.xmi.impl.XMLParserPoolImpl;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.exception.PersistenceException;
import org.talend.commons.runtime.model.emf.EmfHelper;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.ILibraryManagerService;
import org.talend.core.language.LanguageManager;
import org.talend.core.model.component_cache.ComponentCacheFactory;
import org.talend.core.model.component_cache.ComponentCachePackage;
import org.talend.core.model.component_cache.ComponentsCache;
import org.talend.core.model.component_cache.util.ComponentCacheResourceFactoryImpl;
import org.talend.core.model.general.ILibrariesService;
import org.talend.core.utils.TalendCacheUtils;
/**
* DOC zwzhao class global comment. Detailled comment
*/
public class ComponentManager {
private static ComponentsCache cache;
private static final String TALEND_COMPONENTS_CACHE_FILE = "components.cache"; //$NON-NLS-1$
private static final String TALEND_COMPONENT_CACHE = "ComponentsCache.";
private static Map<String, ComponentsCache> caches = new HashMap<>();
private static final String TALEND_FILE_NAME = "cache";
private static Set<File> providerInstallationFolders;
private static boolean modified = false;
private static Set<String> modified = new HashSet<>();
public static ComponentsCache getComponentCache() {
if (cache == null) {
cache = ComponentCacheFactory.eINSTANCE.createComponentsCache();
public static Map<String, ComponentsCache> getComponentCaches() {
if (caches.isEmpty()) {
getProviderInstallationFolders()
.forEach(f -> caches.put(f.getAbsolutePath(), ComponentCacheFactory.eINSTANCE.createComponentsCache()));
}
return cache;
return caches;
}
public static void saveResource() {
if (isModified()) {
String installLocation = new Path(Platform.getConfigurationLocation().getURL().getPath()).toFile().getAbsolutePath();
try {
Resource resource = createComponentCacheResource(installLocation);
resource.getContents().add(cache);
EmfHelper.saveResource(cache.eResource());
} catch (PersistenceException e1) {
ExceptionHandler.process(e1);
}
ILibraryManagerService repositoryBundleService = (ILibraryManagerService) GlobalServiceRegister.getDefault()
if (!modified.isEmpty()) {
caches.entrySet().stream().filter(entry -> modified.contains(entry.getKey())).forEach(entry -> {
try {
Resource resource = createComponentCacheResource(entry.getKey());
resource.getContents().add(entry.getValue());
EmfHelper.saveResource(entry.getValue().eResource());
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
});
ILibraryManagerService repositoryBundleService = GlobalServiceRegister.getDefault()
.getService(ILibraryManagerService.class);
repositoryBundleService.clearCache();
if (GlobalServiceRegister.getDefault().isServiceRegistered(ILibrariesService.class)) {
ILibrariesService libService = (ILibrariesService) GlobalServiceRegister.getDefault().getService(
ILibrariesService.class);
if (libService != null) {
libService.syncLibraries();
}
}
setModified(false);
modified.clear();
}
}
public static Resource createComponentCacheResource(String installLocation) {
String filePath = ComponentManager.TALEND_COMPONENT_CACHE + LanguageManager.getCurrentLanguage().toString().toLowerCase()
+ ComponentManager.TALEND_FILE_NAME;
URI uri = URI.createFileURI(installLocation).appendSegment(filePath);
public static boolean needRegenerateCache(String installLocation) {
// if there is no index file or -clean is added to command
return !hasComponentFile(installLocation) || TalendCacheUtils.isSetCleanComponentCache();
}
public static boolean hasComponentFile(String installLocation) {
File file = new File(installLocation, TALEND_COMPONENTS_CACHE_FILE);
return file != null && file.exists();
}
public static void loadComponentResource() throws IOException {
caches.clear();
for (File installationFolder : getProviderInstallationFolders()) {
URI uri = URI.createFileURI(installationFolder.getAbsolutePath()).appendSegment(TALEND_COMPONENTS_CACHE_FILE);
ComponentCacheResourceFactoryImpl compFact = new ComponentCacheResourceFactoryImpl();
Resource resource = compFact.createResource(uri);
Map<Object, Object> optionMap = new HashMap<>();
optionMap.put(XMLResource.OPTION_DEFER_ATTACHMENT, Boolean.TRUE);
optionMap.put(XMLResource.OPTION_DEFER_IDREF_RESOLUTION, Boolean.TRUE);
optionMap.put(XMLResource.OPTION_USE_PARSER_POOL, new XMLParserPoolImpl());
optionMap.put(XMLResource.OPTION_USE_XML_NAME_TO_FEATURE_MAP, new HashMap<>());
optionMap.put(XMLResource.OPTION_USE_DEPRECATED_METHODS, Boolean.FALSE);
// TODO remove the try catch block after merge commits for TDM
try {
resource.load(optionMap);
} catch (IOException e) {
ExceptionHandler.process(e);
continue;
}
caches.put(installationFolder.getAbsolutePath(), (ComponentsCache) EcoreUtil.getObjectByType(resource.getContents(),
ComponentCachePackage.eINSTANCE.getComponentsCache()));
}
}
public static void clearAllCaches() {
caches.clear();
}
public static void setModified(String installationFolder) {
modified.add(installationFolder);
}
private static Resource createComponentCacheResource(String installLocation) {
URI uri = URI.createFileURI(installLocation).appendSegment(TALEND_COMPONENTS_CACHE_FILE);
ComponentCacheResourceFactoryImpl compFact = new ComponentCacheResourceFactoryImpl();
return compFact.createResource(uri);
}
/**
* Getter for modified.
*
* @return the modified
*/
public static boolean isModified() {
return modified;
}
/**
* Sets the modified.
*
* @param modified the modified to set
*/
public static void setModified(boolean modified) {
ComponentManager.modified = modified;
private static Set<File> getProviderInstallationFolders() {
if (providerInstallationFolders == null && IComponentsService.get() != null) {
providerInstallationFolders = IComponentsService.get().getComponentsFactory().getProviderInstallationFolders();
}
if (providerInstallationFolders == null) {
return Collections.emptySet();
}
return providerInstallationFolders;
}
}

View File

@@ -55,7 +55,7 @@ public interface IComponentsFactory {
*/
public Set<IComponent> getComponents();
public boolean isInitialising();
public boolean isInitializing();
/**
* Get a readonly components collection to avoid ConcurrentModificationException caused by multiple thread
@@ -113,4 +113,9 @@ public interface IComponentsFactory {
public List<ComponentProviderInfo> getComponentsProvidersInfo();
public String getCustomComponentBundlePath();
public Set<IComponent> getComponentsForInit();
public Set<File> getProviderInstallationFolders();
}

View File

@@ -12,6 +12,7 @@
// ============================================================================
package org.talend.core.model.components;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.IService;
/**
@@ -26,4 +27,11 @@ public interface IComponentsService extends IService {
public IComponentFileNaming getComponentFileNaming();
public static IComponentsService get() {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IComponentsService.class)) {
return GlobalServiceRegister.getDefault().getService(IComponentsService.class);
}
return null;
}
}

View File

@@ -14,12 +14,14 @@ package org.talend.core.model.general;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.eclipse.core.runtime.Path;
import org.osgi.framework.Version;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.ILibraryManagerService;
import org.talend.core.database.conn.version.DatabaseDriversCache;
@@ -29,6 +31,9 @@ import org.talend.core.runtime.maven.MavenArtifact;
import org.talend.core.runtime.maven.MavenConstants;
import org.talend.core.runtime.maven.MavenUrlHelper;
import org.talend.core.utils.TalendQuoteUtils;
import org.talend.utils.json.JSONException;
import org.talend.utils.json.JSONObject;
import org.talend.utils.json.JSONTokener;
/**
* This bean is use to manage needed moduless (perl) and libraries (java).<br/>
@@ -38,6 +43,8 @@ import org.talend.core.utils.TalendQuoteUtils;
*/
public class ModuleNeeded {
public static final String ATTR_USED_BY_DYNAMIC_DISTRIBUTION = "dynamicDistribution";
private String id;
private String context;
@@ -94,6 +101,8 @@ public class ModuleNeeded {
*/
private boolean useReleaseVersion = false;
private Map<String, String> attributes;
ILibraryManagerService libManagerService = (ILibraryManagerService) GlobalServiceRegister.getDefault()
.getService(ILibraryManagerService.class);
@@ -162,6 +171,10 @@ public class ModuleNeeded {
this.required = required;
this.installURL = installURL;
this.requiredIf = requiredIf;
this.attributes = analyseMessage(informationMsg);
if (!this.attributes.isEmpty()) {
this.informationMsg = "";
}
String name = moduleName;
String uri = mavenUrl;
if (moduleName != null) {
@@ -184,6 +197,32 @@ public class ModuleNeeded {
setMavenUri(uri);
}
private Map<String, String> analyseMessage(String msg) {
Map<String, String> attrMap = new HashMap<>();
if (StringUtils.isBlank(msg) || !msg.startsWith("{") || !msg.endsWith("}")) {
return attrMap;
}
try {
JSONObject jo = new JSONObject(new JSONTokener(msg));
Iterator<String> keys = jo.keys();
keys.forEachRemaining(key -> {
try {
Object object = jo.get(key);
if (object != null) {
attrMap.put(key, object.toString());
}
} catch (JSONException e) {
ExceptionHandler.process(e);
}
});
} catch (Exception e) {
if (Boolean.getBoolean("talend.studio.moduleNeeded.init.debug")) {
ExceptionHandler.process(e);
}
}
return attrMap;
}
@Override
public ModuleNeeded clone() {
ModuleNeeded cloned = new ModuleNeeded(context, moduleName, informationMsg, mrRequired, installURL, requiredIf, mavenUri);
@@ -212,6 +251,7 @@ public class ModuleNeeded {
cloned.requiredIf = requiredIf;
cloned.status = status;
cloned.useReleaseVersion = useReleaseVersion;
cloned.attributes = attributes;
return cloned;
}
@@ -671,6 +711,10 @@ public class ModuleNeeded {
}
}
public boolean usedByDynamicDistribution() {
return Boolean.valueOf(attributes.get(ATTR_USED_BY_DYNAMIC_DISTRIBUTION));
}
public boolean isDynamic() {
return this.dynamic;
}

View File

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

View File

@@ -281,9 +281,7 @@ public final class MetadataToolHelper {
}
public static boolean isAllowSpecificCharacters() {
IEclipsePreferences coreUIPluginNode = new InstanceScope().getNode(ITalendCorePrefConstants.CoreUIPlugin_ID);
return coreUIPluginNode
.getBoolean(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS, false);
return CoreRuntimePlugin.getInstance().getProjectPreferenceManager().isAllowSpecificCharacters();
}
/**

View File

@@ -32,9 +32,7 @@ import org.talend.core.database.EDatabaseTypeName;
import org.talend.core.database.conn.ConnParameterKeys;
import org.talend.core.database.conn.template.EDatabaseConnTemplate;
import org.talend.core.database.conn.version.EDatabaseVersion4Drivers;
import org.talend.core.hadoop.IHadoopClusterService;
import org.talend.core.hadoop.repository.HadoopRepositoryUtil;
import org.talend.core.hadoop.version.custom.ECustomVersionGroup;
import org.talend.core.language.ECodeLanguage;
import org.talend.core.language.LanguageManager;
import org.talend.core.model.metadata.EMetadataEncoding;
@@ -443,6 +441,13 @@ public class RepositoryToComponentProperty {
} else {
return TalendQuoteUtils.addQuotes(connection.getValue(dbPassword, false));
}
} else if ("SAPHANA_PROPERTIES_STRING".equals(value)) { //$NON-NLS-1$
String dbParameters = TaggedValueHelper.getValueString(ISAPConstant.PROP_DB_ADDITIONAL_PROPERTIES, connection);
if (isContextMode(connection, dbParameters)) {
return dbParameters;
} else {
return TalendQuoteUtils.addQuotes(dbParameters);
}
}
return null;
}
@@ -1532,22 +1537,6 @@ public class RepositoryToComponentProperty {
}
if (value.equals("HADOOP_CUSTOM_JARS")) {
if (targetComponent != null && targetComponent.startsWith("tPig")) {
// for pig component
String clusterID = connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HADOOP_CLUSTER_ID);
if (clusterID != null) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IHadoopClusterService.class)) {
IHadoopClusterService hadoopClusterService = GlobalServiceRegister.getDefault()
.getService(IHadoopClusterService.class);
Map<String, String> hadoopCustomLibraries = hadoopClusterService.getHadoopCustomLibraries(clusterID);
if (EDatabaseTypeName.HBASE.getDisplayName().equals(connection.getDatabaseType())) {
return hadoopCustomLibraries.get(ECustomVersionGroup.PIG_HBASE.getName()) == null ? ""
: hadoopCustomLibraries.get(ECustomVersionGroup.PIG_HBASE.getName());
}
}
}
}
return connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HADOOP_CUSTOM_JARS);
}

View File

@@ -21,6 +21,7 @@ import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.text.StringEscapeUtils;
import org.eclipse.emf.common.util.EList;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.exception.PersistenceException;
@@ -62,7 +63,6 @@ import org.talend.designer.core.model.utils.emf.talendfile.RoutinesParameterType
import org.talend.designer.runprocess.ItemCacheManager;
import org.talend.repository.ProjectManager;
import org.talend.repository.model.IProxyRepositoryFactory;
import org.apache.commons.text.StringEscapeUtils;
/**
* DOC bqian class global comment. Detailled comment

View File

@@ -52,4 +52,6 @@ public interface IRepositoryPrefConstants {
public static final String ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS = "allow_specific_characters_for_schema_columns";
public static final String REF_PROJECT_BRANCH_SETTING = "ref_project_branch_setting";
public static final String ITEM_EXPORT_DEPENDENCIES = "item_export_dependencies";
}

View File

@@ -21,14 +21,13 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.script.Bindings;
import javax.script.ScriptContext;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import org.apache.commons.lang.StringUtils;
import org.apache.oro.text.regex.MalformedPatternException;
import org.apache.oro.text.regex.PatternCompiler;
@@ -36,8 +35,7 @@ import org.apache.oro.text.regex.Perl5Compiler;
import org.apache.oro.text.regex.Perl5Matcher;
import org.apache.oro.text.regex.Perl5Substitution;
import org.apache.oro.text.regex.Util;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.core.runtime.Platform;
import org.talend.commons.utils.PasswordEncryptUtil;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.language.ECodeLanguage;
@@ -50,14 +48,16 @@ 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.CoreRuntimePlugin;
import org.talend.core.runtime.services.IGenericDBService;
import org.talend.core.utils.TalendQuoteUtils;
import org.talend.designer.core.model.utils.emf.talendfile.ContextParameterType;
import org.talend.designer.core.model.utils.emf.talendfile.ContextType;
import org.talend.repository.model.RepositoryConstants;
import delight.rhinosandox.RhinoSandbox;
import delight.rhinosandox.RhinoSandboxes;
/**
* Utilities to work with IContextParamet objects. <br/>
*
@@ -84,6 +84,12 @@ public final class ContextParameterUtils {
private static final String NON_CONTEXT_PATTERN = "[^a-zA-Z0-9_]"; //$NON-NLS-1$
private static final RhinoSandbox SANDBOX = RhinoSandboxes.create();
private static final Map<String, Object> CTX_VARS_LAST = new HashMap<String, Object>();
private static ReadWriteLock CTX_VARS_LOCK = new ReentrantReadWriteLock();
/**
* Constructs a new ContextParameterUtils.
*/
@@ -206,10 +212,37 @@ public final class ContextParameterUtils {
}
}
private static ScriptEngine engine = new ScriptEngineManager().getEngineByName("JavaScript");
public static ScriptEngine getScriptEngine() {
return engine;
private static String preProcessScript(String script) {
String newCode = script;
CTX_VARS_LOCK.readLock().lock();
try {
Set<Entry<String, Object>> entries = CTX_VARS_LAST.entrySet();
for (Entry<String, Object> entry : entries) {
String val = entry.getValue().toString();
if (entry.getValue() instanceof String) {
val = "\"" + val.replace("\"", "\\\"") + "\"";
}
newCode = newCode.replace(JAVA_NEW_CONTEXT_PREFIX + entry.getKey(), val);
}
} finally {
CTX_VARS_LOCK.readLock().unlock();
}
return newCode;
}
public static boolean isValidLiteralValue(String value) {
String newCode = preProcessScript(value);
try {
SANDBOX.eval(null, newCode);
return true;
} catch (Exception e) {
// ignore
}
return false;
}
public static String convertContext2Literal4AnyVar(final String code, final IContext context) {
@@ -223,23 +256,22 @@ public final class ContextParameterUtils {
Object result = code;
if (engine == null) {
engine = new ScriptEngineManager().getEngineByName("JavaScript");
Map<String, Object> varMap = getVarMapForScriptEngine(context);
CTX_VARS_LOCK.writeLock().lock();
try {
CTX_VARS_LAST.clear();
CTX_VARS_LAST.putAll(varMap);
} finally {
CTX_VARS_LOCK.writeLock().unlock();
}
if (engine == null) {
throw new RuntimeException("can't find the script engine");
}
String newCode = preProcessScript(code);
Bindings binding = engine.getBindings(ScriptContext.ENGINE_SCOPE);
if (binding != null) {
binding.clear();
Map<String, Object> varMap = getVarMapForScriptEngine(context);
binding.put("context", varMap);
}
try {
String replacement = " ";
result = engine.eval(code.replace("\r\n", replacement).replace("\n", replacement).replace("\r", replacement));
result = SANDBOX.eval(null,
newCode.replace("\r\n", replacement).replace("\n", replacement).replace("\r", replacement));
} catch (Exception e) {
// ignore the exception
}
@@ -617,8 +649,12 @@ public final class ContextParameterUtils {
}
private static boolean isAllowSpecificCharacters() {
IEclipsePreferences coreUIPluginNode = new InstanceScope().getNode(ITalendCorePrefConstants.CoreUIPlugin_ID);
return coreUIPluginNode.getBoolean(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS, false);
if (Platform.isRunning()) {
return CoreRuntimePlugin.getInstance().getProjectPreferenceManager().isAllowSpecificCharacters();
} else {
// Can not get the value if current code is not working in studio
return false;
}
}
public static boolean isEmptyParameter(String source) {

View File

@@ -27,9 +27,6 @@ import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.script.ScriptEngine;
import javax.script.ScriptException;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.model.components.ComponentCategory;
import org.talend.core.model.components.IComponent;
@@ -418,6 +415,52 @@ public class NodeUtil {
return conns;
}
/**
* DOC
* <p>
* The method searches for the incoming node connections of type
* on a processing path and returns the first ones only
* </p>
*
* @param node
* @param type - node type to look for
* @return
*/
public static List<? extends IConnection> getFirstIncomingLineConnectionsOfType(INode node, String type) {
if (type == null)
return new ArrayList<IConnection>();
Set<String> uniqueNamesDone = new HashSet<String>();
List<? extends IConnection> allIncomingConnections = getFirstIncomingLineConnectionsOfType(node, uniqueNamesDone, type);
return allIncomingConnections;
}
private static List<? extends IConnection> getFirstIncomingLineConnectionsOfType(INode node, Set<String> uniqueNamesDone, String type) {
List<IConnection> conns = new ArrayList<IConnection>();
List<? extends IConnection> incomingConnections = node.getIncomingConnections();
if (incomingConnections != null) {
for (int i = 0; i < incomingConnections.size(); i++) {
IConnection connection = incomingConnections.get(i);
INode nextNode = connection.getSource();
if (!uniqueNamesDone.contains(nextNode.getUniqueName())) {
uniqueNamesDone.add(nextNode.getUniqueName());
if (type.equals((String)nextNode.getElementParameter("COMPONENT_NAME").getValue())) {
conns.add(connection);
} else {
conns.addAll(getFirstIncomingLineConnectionsOfType(nextNode, uniqueNamesDone, type)); // follow this way
}
}
}
}
return conns;
}
public static INode getFirstMergeNode(INode node) {
INode mergeNode = null;
for (IConnection connection : node.getOutgoingConnections()) {
@@ -1040,14 +1083,7 @@ public class NodeUtil {
}
private static boolean isValidLiteralValue(String value) {
ScriptEngine se = ContextParameterUtils.getScriptEngine();
if(se==null) return true;
try {
se.eval(value);
return true;
} catch (ScriptException e) {
return false;
}
return ContextParameterUtils.isValidLiteralValue(value);
}
private static String checkStringQuotationMarks(String str) {

View File

@@ -146,7 +146,7 @@ public class TalendMavenResolver {
getMavenResolver();
}
private static MavenResolver getMavenResolver() throws RuntimeException {
public static MavenResolver getMavenResolver() throws RuntimeException {
if (mavenResolver == null) {
final BundleContext context = CoreRuntimePlugin.getInstance().getBundle().getBundleContext();
ServiceReference<org.ops4j.pax.url.mvn.MavenResolver> mavenResolverService = context

View File

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

View File

@@ -31,6 +31,8 @@ public interface IDynamicDistributionManager {
public void reloadAllDynamicDistributions(IProgressMonitor monitor) throws Exception;
public void reset(IProgressMonitor monitor);
public boolean isLoaded();
public void load(IProgressMonitor monitor, boolean resetModulesCache) throws Exception;
@@ -40,4 +42,7 @@ public interface IDynamicDistributionManager {
public boolean isUsersDynamicDistribution(String dynamicDistributionId);
public String getDynamicDistributionCacheVersion();
public String getPluginExtensionCacheVersion();
}

View File

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

View File

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

View File

@@ -21,6 +21,7 @@ import org.talend.core.model.components.IComponent;
import org.talend.core.model.metadata.builder.connection.Connection;
import org.talend.core.model.process.IElementParameter;
import org.talend.core.model.process.INode;
import org.talend.repository.model.RepositoryNode;
/**
* created by ycbai on 2016年3月24日 Detailled comment
@@ -28,6 +29,20 @@ import org.talend.core.model.process.INode;
*/
public interface IGenericService extends IService {
/**
* Get all the names of generic type.
*
* @return
*/
public List<String> getGenericTypeNames();
/**
* Create repository nodes by component service.
*
* @param curParentNode
*/
public List<RepositoryNode> createNodesFromComponentService(RepositoryNode curParentNode);
/**
* Call method <code>callBeforeActivate()</code> of <code>parameter</code>.
*

View File

@@ -0,0 +1,52 @@
// ============================================================================
//
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.core.runtime.services;
import java.util.List;
import org.talend.components.api.properties.ComponentProperties;
import org.talend.components.api.service.ComponentService;
import org.talend.components.api.wizard.ComponentWizard;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.IService;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.repository.model.IRepositoryNode.ENodeType;
import org.talend.repository.model.RepositoryNode;
/**
* created by ycbai on 2015年9月21日 Detailled comment
*
*/
public interface IGenericWizardInternalService extends IService {
public ERepositoryObjectType createRepositoryType(String type, String label, String alias, String folder, int ordinal);
public RepositoryNode createRepositoryNode(RepositoryNode curParentNode, String label, ERepositoryObjectType type,
ENodeType nodeType);
public ComponentService getComponentService();
public ComponentWizard getComponentWizard(String name, String location);
public List<ComponentWizard> getComponentWizardsForProperties(ComponentProperties properties, String location);
public ComponentWizard getTopLevelComponentWizard(ComponentProperties properties, String location);
public static IGenericWizardInternalService getService() {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericWizardInternalService.class)) {
return GlobalServiceRegister.getDefault().getService(IGenericWizardInternalService.class);
}
return null;
}
}

View File

@@ -39,20 +39,6 @@ import org.talend.repository.model.RepositoryNode;
*/
public interface IGenericWizardService extends IService {
/**
* Create repository nodes by component service.
*
* @param curParentNode
*/
public List<RepositoryNode> createNodesFromComponentService(RepositoryNode curParentNode);
/**
* Get all the names of generic type.
*
* @return
*/
public List<String> getGenericTypeNames();
/**
*
* Estimate whether <code>repObjType</code> is a generic type or not.
@@ -150,6 +136,8 @@ public interface IGenericWizardService extends IService {
*/
public ITreeContextualAction getDefaultAction(RepositoryNode node);
public ITreeContextualAction getGenericAction(String typeName, String location);
public void loadAdditionalJDBC();
public List<String> getAllAdditionalJDBCTypes();

View File

@@ -0,0 +1,118 @@
// ============================================================================
//
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.core.runtime.util;
import java.io.File;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jdt.launching.IVMInstall;
import org.eclipse.jdt.launching.IVMInstall2;
import org.eclipse.jdt.launching.JavaRuntime;
import org.talend.commons.utils.generation.JavaUtils;
/**
* created by nrousseau on Jun 13, 2015 Detailled comment
*
*/
public class JavaHomeUtil {
/**
* Initialize Java Home to the preferences if needed only.<br>
*
* @throws CoreException
*/
public static void initializeJavaHome() throws CoreException {
IEclipsePreferences pref = InstanceScope.INSTANCE.getNode(JavaRuntime.ID_PLUGIN); //$NON-NLS-1$
String defaultVM = pref.get(JavaRuntime.PREF_VM_XML, ""); //$NON-NLS-1$//$NON-NLS-2$
boolean needSetupJVM = false;
if (!"".equals(defaultVM)) { //$NON-NLS-1$
if (isSetJdkHomeVariable() && !getJDKHomeVariable().equals(getCurrentJavaHomeString())) {
needSetupJVM = true;
}
} else {
needSetupJVM = true;
}
if (needSetupJVM) {
IVMInstall currentVM = JavaRuntime.getDefaultVMInstall();
if (isSetJdkHomeVariable()) {
if (currentVM != null) {
File installLocation = new File(getJDKHomeVariable());
currentVM.setInstallLocation(installLocation);
currentVM.setName(installLocation.getName());
}
}
}
}
/**
* Only for TUJ to setup JDK version
* Should invoke after initializeJavaHome()
*/
public static String getSpecifiedJavaVersion() {
if (isSetJdkHomeVariable()) {
IVMInstall currentVM = JavaRuntime.getDefaultVMInstall();
if (currentVM instanceof IVMInstall2) {
return JavaUtils.getCompilerCompliance((IVMInstall2) currentVM, null);
}
}
return null;
}
public static boolean isSetJdkHomeVariable() {
String jdkHomeValue = getJDKHomeVariable();
return jdkHomeValue != null && !"".equals(jdkHomeValue); //$NON-NLS-1$
}
public static String getJDKHomeVariable() {
String jdkHome = System.getProperty("job.compilation.jvm"); //$NON-NLS-1$
if (jdkHome == null || "".equals(jdkHome)) { //$NON-NLS-1$
jdkHome = System.getProperty("jdk.home"); //$NON-NLS-1$
}
if (StringUtils.isNoneEmpty(jdkHome)) {
File jvmFile = new File(jdkHome);
if (jvmFile.exists()) {
return getJDKPath(jvmFile);
}
}
return null;
}
private static String getJDKPath(File file) {
if (file == null) {
return null;
}
if ("bin".equals(file.getName())) {//$NON-NLS-1$
return file.getParent();
} else {
return getJDKPath(file.getParentFile());
}
}
public static File getCurrentJavaHomeFile() {
IVMInstall currentVM = JavaRuntime.getDefaultVMInstall();
if (currentVM == null) {
return null;
}
return currentVM.getInstallLocation();
}
public static String getCurrentJavaHomeString() {
IVMInstall currentVM = JavaRuntime.getDefaultVMInstall();
if (currentVM == null) {
return null;
}
return currentVM.getInstallLocation().getAbsolutePath();
}
}

View File

@@ -7,6 +7,7 @@ import java.util.LinkedHashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.exception.PersistenceException;
@@ -22,6 +23,7 @@ import org.talend.designer.runprocess.IRunProcessService;
import org.talend.repository.ProjectManager;
import org.talend.repository.model.IProxyRepositoryFactory;
import org.talend.repository.model.IProxyRepositoryService;
import org.talend.repository.model.IRepositoryService;
public class CodesJarResourceCache {
@@ -29,12 +31,14 @@ public class CodesJarResourceCache {
private static final Object LOCK = new Object();
private static boolean isListenerAdded;
private static AtomicBoolean isInitialized = new AtomicBoolean(false);
private static AtomicBoolean isInitializing = new AtomicBoolean(true);
private static PropertyChangeListener listener;
public static void initCodesJarCache() {
synchronized (LOCK) {
if (isInitialized.compareAndSet(false, true)) {
CACHE.clear();
List<Project> allProjects = new ArrayList<>();
allProjects.addAll(ProjectManager.getInstance().getAllReferencedProjects(true));
@@ -49,40 +53,43 @@ public class CodesJarResourceCache {
}
}
}
addCodesJarChangeListener();
if (listener == null) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
IRunProcessService service = GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
listener = service.addCodesJarChangeListener();
}
}
isInitializing.set(false);
} catch (PersistenceException e) {
ExceptionHandler.process(e);
throw new RuntimeException("Failed to init resource cache for custom jars", e);
}
}
}
public static Set<CodesJarInfo> getAllCodesJars() {
synchronized (LOCK) {
return new LinkedHashSet<>(CACHE);
}
waitForInit();
return new LinkedHashSet<>(CACHE);
}
public static CodesJarInfo getCodesJarById(String id) {
synchronized (LOCK) {
Optional<CodesJarInfo> optional = CACHE.stream().filter(info -> info.getId().equals(id)).findFirst();
if (optional.isPresent()) {
return optional.get();
}
ExceptionHandler.process(new Exception("Codes jar id [" + id + "] is not found!")); //$NON-NLS-1$ //$NON-NLS-2$
return null;
waitForInit();
Optional<CodesJarInfo> optional = CACHE.stream().filter(info -> info.getId().equals(id)).findFirst();
if (optional.isPresent()) {
return optional.get();
}
ExceptionHandler.process(new Exception("Codes jar id [" + id + "] is not found!")); //$NON-NLS-1$ //$NON-NLS-2$
return null;
}
public static CodesJarInfo getCodesJarByLabel(ERepositoryObjectType type, String projectTechName, String label) {
synchronized (LOCK) {
Optional<CodesJarInfo> optional = CACHE.stream().filter(info -> info.getType() == type
&& info.getLabel().equals(label) && info.getProjectTechName().equals(projectTechName)).findFirst();
if (optional.isPresent()) {
return optional.get();
}
ExceptionHandler.process(new Exception("Codes jar [" + label + "] is not found!")); //$NON-NLS-1$ //$NON-NLS-2$
return null;
waitForInit();
Optional<CodesJarInfo> optional = CACHE.stream().filter(info -> info.getType() == type && info.getLabel().equals(label)
&& info.getProjectTechName().equals(projectTechName)).findFirst();
if (optional.isPresent()) {
return optional.get();
}
ExceptionHandler.process(new Exception("Codes jar [" + label + "] is not found!")); //$NON-NLS-1$ //$NON-NLS-2$
return null;
}
public static CodesJarInfo getCodesJarByInnerCode(RoutineItem routineItem) throws PersistenceException {
@@ -99,6 +106,7 @@ public class CodesJarResourceCache {
}
public static void addToCache(Property newProperty) {
waitForInit();
synchronized (LOCK) {
Iterator<CodesJarInfo> iterator = CACHE.iterator();
while (iterator.hasNext()) {
@@ -113,6 +121,7 @@ public class CodesJarResourceCache {
}
public static void updateCache(String oldId, String oldLabel, String oldVersion, Property newProperty) {
waitForInit();
synchronized (LOCK) {
Iterator<CodesJarInfo> iterator = CACHE.iterator();
while (iterator.hasNext()) {
@@ -127,6 +136,7 @@ public class CodesJarResourceCache {
}
public static void removeCache(Property property) {
waitForInit();
synchronized (LOCK) {
Iterator<CodesJarInfo> iterator = CACHE.iterator();
while (iterator.hasNext()) {
@@ -139,18 +149,31 @@ public class CodesJarResourceCache {
}
}
public static void addCodesJarChangeListener() {
if (!isListenerAdded) {
synchronized (LOCK) {
if (!isListenerAdded) {
if (listener == null) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
IRunProcessService service = GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
listener = service.addCodesJarChangeListener();
isListenerAdded = true;
}
}
}
public static void reset() {
if (isInitialized.compareAndSet(true, false)) {
if (listener != null) {
IRepositoryService.get().getProxyRepositoryFactory().removePropertyChangeListener(listener);
listener = null;
}
isInitializing.set(true);
}
}
public static void waitForInit() {
initCodesJarCache();
int spent = 0;
int time = 500;
int timeout = 1000 * 60 * 10;
while (isInitializing.get()) {
try {
Thread.sleep(time);
spent += time;
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
if (spent >= timeout) {
// may be track in dead lock, throw exception to try to break dead lock
throw new RuntimeException("Waiting for custom jar cache initialization timeout!"); //$NON-NLS-1$
}
}
}

View File

@@ -258,6 +258,8 @@ public interface IRunProcessService extends IService {
public boolean isExcludeDeletedItems(Property property);
public boolean getMavenPrefOptionStatus(String prefName);
public static IRunProcessService get() {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
return GlobalServiceRegister.getDefault().getService(IRunProcessService.class);

View File

@@ -47,4 +47,9 @@ public abstract class AbstractLoginTask implements ILoginTask {
return false;
}
@Override
public boolean isBackground() {
return false;
}
}

View File

@@ -16,6 +16,9 @@ import java.lang.reflect.InvocationTargetException;
import java.util.Date;
import org.eclipse.core.runtime.IProgressMonitor;
import org.talend.commons.CommonsPlugin;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.core.PluginChecker;
/**
* created by wchen on 2015-5-15 Detailled comment Define a login taks that will be execute when login project
@@ -28,9 +31,26 @@ public interface ILoginTask {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException;
default void execute(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
if (CommonsPlugin.isHeadless() || CommonsPlugin.isJUnitTest() || PluginChecker.isSWTBotLoaded()
|| CommonsPlugin.isTUJTest() || !isBackground()) {
run(monitor);
} else {
new Thread(() -> {
try {
run(monitor);
} catch (InvocationTargetException | InterruptedException e) {
ExceptionHandler.process(e);
}
}, getClass().getCanonicalName()).start();
}
}
/**
* Which indicates the task will be executed for each logon of a project, by default return false(execute only once
* at the time of logon studio).
*/
boolean isRequiredAlways();
boolean isBackground();
}

View File

@@ -23,7 +23,6 @@ import org.talend.commons.exception.PersistenceException;
import org.talend.commons.utils.data.container.RootContainer;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.ILibraryManagerService;
import org.talend.core.model.general.ModuleNeeded;
import org.talend.core.model.process.IProcess;
import org.talend.core.model.process.IProcess2;
import org.talend.core.model.properties.Property;
@@ -159,7 +158,7 @@ public abstract class AbsMigrationCheckHandler implements IMigrationCheckHandler
return hasCompilationError;
}
protected void checkModules(Set<String> neededLibraries, Set<ModuleNeeded> allModulesWithStatus, MigrateItemInfo itemInfo) {
protected void checkModules(Set<String> neededLibraries, MigrateItemInfo itemInfo) {
// check libraries status
if (neededLibraries == null || neededLibraries.isEmpty()) {
return;

View File

@@ -22,6 +22,7 @@ import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorPart;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.IService;
import org.talend.core.model.components.IComponentsFactory;
import org.talend.core.model.general.ModuleNeeded;
@@ -149,4 +150,11 @@ public interface IRepositoryService extends IService {
List<ModuleNeeded> getLog4j2Modules();
public static IRepositoryService get() {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRepositoryService.class)) {
return GlobalServiceRegister.getDefault().getService(IRepositoryService.class);
}
return null;
}
}

View File

@@ -103,6 +103,8 @@ public class RepositoryConstants {
public static final String REPOSITORY_CLOUD_APAC_ID = "cloud_apac"; //$NON-NLS-1$
public static final String REPOSITORY_CLOUD_US_WEST_ID = "cloud_us_west"; //$NON-NLS-1$
public static final String REPOSITORY_CLOUD_AUS_ID = "cloud_aus"; //$NON-NLS-1$
public static final String REPOSITORY_CLOUD_CUSTOM_ID = "cloud_custom"; //$NON-NLS-1$

View File

@@ -35,7 +35,8 @@ Require-Bundle: org.apache.commons.lang,
org.apache.httpcomponents.httpcore,
org.apache.httpcomponents.httpclient,
org.slf4j.api,
org.apache.ant
org.apache.ant,
org.eclipse.m2e.maven.runtime
Import-Package: org.eclipse.jdt.internal.ui.workingsets
Export-Package: org.talend.core.ui,
org.talend.core.ui.actions,

View File

@@ -42,6 +42,10 @@
id="org.talend.core.ui.token.AdditionalPackageTokenCollector"
name="addtional package">
</provider>
<provider
collector="org.talend.core.ui.token.AMCUsageTokenCollector"
id="AMCUsageTokenCollector">
</provider>
</extension>
<extension

View File

@@ -9,21 +9,7 @@
</parent>
<artifactId>org.talend.core.ui</artifactId>
<packaging>eclipse-plugin</packaging>
<dependencies>
<dependency>
<groupId>com.github.oshi</groupId>
<artifactId>oshi-core</artifactId>
<version>5.2.5</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
@@ -32,17 +18,33 @@
<version>3.0.2</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeScope>runtime</includeScope>
<outputDirectory>${project.basedir}/lib</outputDirectory>
<stripVersion>true</stripVersion>
</configuration>
</execution>
<id>copy</id>
<phase>generate-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${project.basedir}/lib</outputDirectory>
<stripVersion>true</stripVersion>
<artifactItems>
<artifactItem>
<groupId>com.github.oshi</groupId>
<artifactId>oshi-core</artifactId>
<version>5.2.5</version>
</artifactItem>
<artifactItem>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>5.6.0</version>
</artifactItem>
<artifactItem>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna-platform</artifactId>
<version>5.6.0</version>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>

View File

@@ -15,13 +15,13 @@ package org.talend.core.ui.advanced.composite;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.text.StringMatcher;
import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.ui.internal.misc.StringMatcher;
/**
* DOC ggu class global comment. Detailled comment

View File

@@ -644,11 +644,6 @@ public class ContextTreeTable {
super(treeList);
}
@Override
public String formatDataForDepth(int depth, ContextTreeNode object) {
return object.getName();
}
}
private static class ContextExpansionModel implements TreeList.ExpansionModel<ContextTreeNode> {

View File

@@ -14,10 +14,10 @@ package org.talend.core.ui.context;
import java.text.MessageFormat;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.util.Assert;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.DialogCellEditor;
import org.eclipse.swt.SWT;

View File

@@ -37,7 +37,7 @@ import org.talend.core.ui.i18n.Messages;
* created by ldong on Aug 14, 2014 Detailled comment
*
*/
public class ContextMenuItemProviders extends MenuItemProviders {
public class ContextMenuItemProviders {
// the item of change the context parameter's mode such as from repositroy to build-in
public static IMenuItemProvider changeModeMenuItemProvider(final IDataProvider dataProvider,
@@ -122,7 +122,7 @@ public class ContextMenuItemProviders extends MenuItemProviders {
}
private static ContextTreeNode getTreeNodeByRightClickPostion(final IDataProvider dataProvider, SelectionEvent e) {
NatEventData natEventData = getNatEventData(e);
NatEventData natEventData = MenuItemProviders.getNatEventData(e);
NatTable nt = natEventData.getNatTable();
int rowPosition = natEventData.getRowPosition();
int rowIndex = nt.getRowIndexByPosition(rowPosition);

View File

@@ -14,10 +14,10 @@ package org.talend.core.ui.context.nattableTree;
import org.eclipse.nebula.widgets.nattable.NatTable;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.edit.action.CellEditDragMode;
import org.eclipse.nebula.widgets.nattable.edit.action.MouseEditAction;
import org.eclipse.nebula.widgets.nattable.edit.config.DefaultEditBindings;
import org.eclipse.nebula.widgets.nattable.layer.LabelStack;
import org.eclipse.nebula.widgets.nattable.selection.action.CellSelectionDragMode;
import org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry;
import org.eclipse.nebula.widgets.nattable.ui.matcher.CellEditorMouseEventMatcher;
import org.eclipse.swt.events.MouseEvent;
@@ -53,6 +53,6 @@ public class ContextSelectBindings extends DefaultEditBindings {
};
pUiBindingRegistry.registerSingleClickBinding(mouseEventMatcher, new MouseEditAction());
pUiBindingRegistry.registerFirstMouseDragMode(mouseEventMatcher, new CellEditDragMode());
pUiBindingRegistry.registerFirstMouseDragMode(mouseEventMatcher, new CellSelectionDragMode());
}
}

View File

@@ -24,6 +24,8 @@ import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.RGB;
import org.talend.commons.ui.runtime.swt.tableviewer.TableViewerCreatorColumnNotModifiable;
import org.talend.commons.ui.runtime.swt.tableviewer.behavior.DefaultTableLabelProvider;
import org.talend.commons.ui.swt.advanced.dataeditor.button.CasePushButton;
import org.talend.commons.ui.swt.advanced.dataeditor.button.QuotePushButton;
import org.talend.commons.ui.swt.advanced.dataeditor.button.ResetDBTypesPushButton;
import org.talend.commons.ui.swt.advanced.dataeditor.control.ExtendedPushButton;
import org.talend.commons.ui.swt.tableviewer.TableViewerCreator;
@@ -88,6 +90,14 @@ public class CustomTableManager {
if (resetDBTypesButton != null) {
resetDBTypesButton.getButton().setEnabled(false);
}
CasePushButton caseButton = tableEditorView.getExtendedToolbar().getCaseButton();
if (caseButton != null) {
caseButton.getButton().setEnabled(false);
}
QuotePushButton quoteButton = tableEditorView.getExtendedToolbar().getQuoteButton();
if (quoteButton != null) {
quoteButton.getButton().setEnabled(false);
}
} else {
tableEditorView.getToolBar().getAddButton().getButton().addSelectionListener(new SelectionListener() {
@@ -170,6 +180,14 @@ public class CustomTableManager {
if (resetDBTypesButton != null) {
resetDBTypesButton.getButton().setEnabled(false);
}
CasePushButton caseButton = tableEditorView.getExtendedToolbar().getCaseButton();
if (caseButton != null) {
caseButton.getButton().setEnabled(false);
}
QuotePushButton quoteButton = tableEditorView.getExtendedToolbar().getQuoteButton();
if (quoteButton != null) {
quoteButton.getButton().setEnabled(false);
}
}
if (linkedTable != null) {
if (linkedTable.isReadOnly() && linkedTableEditorView != null) {

View File

@@ -43,6 +43,7 @@ import org.talend.commons.ui.command.CommandStackForComposite;
import org.talend.commons.ui.runtime.image.EImage;
import org.talend.commons.ui.runtime.image.ImageProvider;
import org.talend.commons.ui.swt.advanced.composite.ThreeCompositesSashForm;
import org.talend.commons.ui.swt.advanced.dataeditor.ExtendedToolbarView;
import org.talend.commons.ui.swt.extended.table.ExtendedTableModel;
import org.talend.commons.ui.swt.tableviewer.IModifiedBeanListener;
import org.talend.commons.ui.swt.tableviewer.ModifiedBeanEvent;
@@ -67,6 +68,7 @@ import org.talend.core.model.utils.NodeUtil;
import org.talend.core.ui.CoreUIPlugin;
import org.talend.core.ui.i18n.Messages;
import org.talend.core.ui.metadata.editor.AbstractMetadataTableEditorView;
import org.talend.core.ui.metadata.editor.MetadataQuoteToolbarEditorView;
import org.talend.core.ui.metadata.editor.MetadataTableEditor;
import org.talend.core.ui.metadata.editor.MetadataTableEditorView;
import org.talend.core.utils.TalendQuoteUtils;
@@ -376,8 +378,19 @@ public class MetadataDialog extends Dialog {
} else {
metadataTableEditor = new MetadataTableEditor(outputMetaTable, titleOutput);
}
outputMetaView = new DialogMetadataTableEditorView(composite, SWT.NONE, metadataTableEditor, outputReadOnly, true,
true, false);
//enable dbcolumn manipulate feature only on Database output component
String nodeFamily = "", rootFamily = "";
if ( outputNode != null && outputNode.getComponent() != null ) {
nodeFamily = outputNode.getComponent().getOriginalFamilyName();
rootFamily = nodeFamily != null ? nodeFamily.split("/")[0] : "";
}
if (rootFamily.equals("Databases")) {
outputMetaView = new DialogMetadataDBOutputTableEditorView(composite, SWT.NONE, metadataTableEditor, outputReadOnly, true,
true, false);
} else {
outputMetaView = new DialogMetadataTableEditorView(composite, SWT.NONE, metadataTableEditor, outputReadOnly, true,
true, false);
}
outputMetaView.setMetadataTalendTypeFilter(NodeUtil.createMetadataTalendTypeFilter(outputNode));
outputMetaView.setIsRepository(isRepository(outputNode, outputMetaTable));
initializeMetadataTableView(outputMetaView, outputNode, outputMetaTable);
@@ -544,8 +557,21 @@ public class MetadataDialog extends Dialog {
} else {
metadataTableEditorForOutput = new MetadataTableEditor(outputMetaTable, titleOutput + " (Output)");
}
outputMetaView = new DialogMetadataTableEditorView(compositesSachForm.getRightComposite(), SWT.NONE,
metadataTableEditorForOutput, outputReadOnly, true, true, false);
//Enable dbcolumn manipulate feature only on Database output component
String nodeFamily = "", rootFamily = "";
if ( outputNode != null && outputNode.getComponent() != null ) {
nodeFamily = outputNode.getComponent().getOriginalFamilyName();
rootFamily = nodeFamily != null ? nodeFamily.split("/")[0] : "";
}
if (rootFamily.equals("Databases")) {
outputMetaView = new DialogMetadataDBOutputTableEditorView(compositesSachForm.getRightComposite(), SWT.NONE,
metadataTableEditorForOutput, outputReadOnly, true, true, false);
} else {
outputMetaView = new DialogMetadataTableEditorView(compositesSachForm.getRightComposite(), SWT.NONE,
metadataTableEditorForOutput, outputReadOnly, true, true, false);
}
outputMetaView.setMetadataTalendTypeFilter(NodeUtil.createMetadataTalendTypeFilter(outputNode));
outputMetaView.setIsRepository(isRepository(outputNode, outputMetaTable));
initializeMetadataTableView(outputMetaView, outputNode, outputMetaTable);
@@ -799,7 +825,22 @@ public class MetadataDialog extends Dialog {
newTableViewerCreator.setLazyLoad(TableViewerCreator.getRecommandLazyLoad());
}
}
class DialogMetadataDBOutputTableEditorView extends MetadataTableEditorView {
public DialogMetadataDBOutputTableEditorView(Composite parentComposite, int mainCompositeStyle,
ExtendedTableModel<IMetadataColumn> extendedTableModel, boolean readOnly, boolean toolbarVisible,
boolean labelVisible, boolean initGraphicsComponents) {
super(parentComposite, mainCompositeStyle, extendedTableModel, readOnly, toolbarVisible, labelVisible,
initGraphicsComponents);
}
@Override
protected ExtendedToolbarView initToolBar() {
return new MetadataQuoteToolbarEditorView(getMainComposite(), SWT.NONE, this.getExtendedTableViewer(), this.getCurrentDbms());
}
}
public static void setSingleAndStruct(boolean isSingle) {
isSingleAndStruct = isSingle;
}

View File

@@ -0,0 +1,65 @@
// ============================================================================
//
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.core.ui.metadata.editor;
import java.util.List;
import org.eclipse.gef.commands.Command;
import org.eclipse.swt.widgets.Composite;
import org.talend.commons.ui.swt.advanced.dataeditor.button.QuotePushButton;
import org.talend.commons.ui.swt.advanced.dataeditor.button.QuotePushButtonForExtendedTable;
import org.talend.commons.ui.swt.advanced.dataeditor.button.CasePushButton;
import org.talend.commons.ui.swt.advanced.dataeditor.button.CasePushButtonForExtendedTable;
import org.talend.commons.ui.swt.extended.table.AbstractExtendedTableViewer;
import org.talend.commons.ui.swt.extended.table.ExtendedTableModel;
import org.talend.core.ui.metadata.extended.command.MetadataCaseCommand;
import org.talend.core.ui.metadata.extended.command.MetadataQuoteCommand;
public class MetadataQuoteToolbarEditorView extends MetadataToolbarEditorView {
public MetadataQuoteToolbarEditorView(Composite parent, int style, AbstractExtendedTableViewer extendedTableViewer) {
super(parent, style, extendedTableViewer);
}
public MetadataQuoteToolbarEditorView(Composite parent, int style, AbstractExtendedTableViewer extendedTableViewer, String dbmsId) {
super(parent, style, extendedTableViewer, dbmsId);
this.getQuoteButton().setDbmsId(dbmsId);
}
@Override
public CasePushButton createCasePushButton() {
return new CasePushButtonForExtendedTable(toolbar, extendedTableViewer) {
@Override
protected Command getCommandToExecute(ExtendedTableModel extendedTable, List beansToConvertCase, int[] selectionIndices, boolean isUpperCase) {
return new MetadataCaseCommand(extendedTable, beansToConvertCase, selectionIndices, isUpperCase);
}
};
}
@Override
protected QuotePushButton createQuotePushButton() {
return new QuotePushButtonForExtendedTable(toolbar, extendedTableViewer) {
@Override
protected Command getCommandToExecute(ExtendedTableModel extendedTable, List beansToQuote, int[] selectionIndices, String quote, boolean isAddingQuote) {
return new MetadataQuoteCommand(extendedTable, beansToQuote, selectionIndices, quote, isAddingQuote);
}
};
}
}

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