Compare commits

..

1 Commits

Author SHA1 Message Date
Sébastien Gandon
0292b0364a Merge release/5.4.2/tis_shared and release/5.4.2/tos for release/5.4.2. 2014-06-22 14:17:21 +02:00
10814 changed files with 35058 additions and 230563 deletions

6
.gitignore vendored
View File

@@ -1,6 +0,0 @@
*.class
bin/
target/
class/
classes/
dist/

View File

@@ -1,47 +0,0 @@
# Talend Common Repository
http://www.talend.com
![alt text](http://www.talend.com/sites/default/files/logo-talend.jpg "Talend")
## Contents
This repository contains the source files that are common across all Talend Open Studio products. These files must be used together with one or more of the following: [tdi-studio-se](https://github.com/Talend/tdi-studio-se), [tdq-studio-se](https://github.com/Talend/tdq-studio-se), [tmdm-studio-se](https://github.com/Talend/tmdm-studio-se), [tesb-studio-se](https://github.com/Talend/tesb-studio-se) or [tbd-studio-se](https://github.com/Talend/tbd-studio-se).
## Repository Structure
All Talend Studio repositories follow the same file structure:
```
|_ main Main Eclipse plugins and features
|_ features
|_ plugins
|_ test Eclipse plugins and features for unit tests.
|_ features
|_ plugins
|_ i18n Internationalization plugins and features.
|_ features
|_ plugins
```
## Support
You can ask for help on our [Forum](http://www.talend.com/services/global-technical-support).
## Contributing
We welcome contributions of all kinds from anyone.
Using the bug tracker [Talend bugtracker](http://jira.talendforge.org/) is the best channel for bug reports, feature requests and submitting pull requests.
Feel free to share your Talend components on [Talend Exchange](http://www.talendforge.org/exchange).
## License
Copyright (c) 2006-2014 Talend
Licensed under the LPGLv3 License

View File

@@ -1,6 +0,0 @@
Metadata=\u30E1\u30BF\u30C7\u30FC\u30BF
TalendDataCollector=\u30E6\u30FC\u30B6\u30FC\u30C7\u30FC\u30BF\u30B3\u30EC\u30AF\u30BF\u30FC
TalendDataCollectorPreview=\u30D7\u30EC\u30D3\u30E5\u30FC
TalendDataCollectorUploading=\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9
prefs=Talend
specificSetting=\u8A73\u7D30\u8A2D\u5B9A

View File

@@ -1,4 +0,0 @@
Metadata=\u5143\u6570\u636E
TalendDataCollector=\u4F7F\u7528\u6570\u636E\u91C7\u96C6\u5668
TalendDataCollectorPreview=\u9884\u89C8
TalendDataCollectorUploading=\u4E0A\u4F20

View File

@@ -1,6 +0,0 @@
source.. = src/main/java/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin_en.properties,\
plugin_fr.properties

View File

@@ -1 +0,0 @@
preferencespage.main=\u30E9\u30A4\u30D6\u30E9\u30EA

View File

@@ -1,61 +0,0 @@
ModulesInstaller_text=\u6B21\u306E\u5916\u90E8\u30E2\u30B8\u30E5\u30FC\u30EB\u304C\u5FC5\u8981\u3067\u3059
ModulesNeededProvider.importModule=\u30E6\u30FC\u30B6\u30FC\u7D44\u8FBC\u307F\u30E2\u30B8\u30E5\u30FC\u30EB
ModulesNeededProvider.Module.Exception=\u30E2\u30B8\u30E5\u30FC\u30EB {0} \u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
ModulesViewComposite.hint.notInstalled=\u672A\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB
CheckModulesAction.CheckRefrshBtn.Text=\u30EA\u30D5\u30EC\u30C3\u30B7\u30E5
ExternalModulesInstallDialog_AvailableOnTalendForge=\u30A2\u30AF\u30B7\u30E7\u30F3
ExternalModulesInstallDialog_ColumnJarName=JAR\u30D5\u30A1\u30A4\u30EB
ExternalModulesInstallDialog_ColumnLicense=\u30E9\u30A4\u30BB\u30F3\u30B9\u30BF\u30A4\u30D7
ExternalModulesInstallDialog_ColumnModuleName=\u30E2\u30B8\u30E5\u30FC\u30EB\u540D
ExternalModulesInstallDialog_ColumnRequired=\u8981
ExternalModulesInstallDialog_ColumnRequiredBy=\u5FC5\u8981\u3068\u306A\u308B\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8
ExternalModulesInstallDialog_ColumnUrl=\u8A73\u7D30\u60C5\u5831
ExternalModulesInstallDialog_Download=\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u3068\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB
ExternalModulesInstallDialog_DownloadFailed=\u6B21\u306E\u30E2\u30B8\u30E5\u30FC\u30EB\u306E\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u304C\u5931\u6557\u3057\u307E\u3057\u305F\uFF1A
ExternalModulesInstallDialog_DownloadSuccess=\u30E2\u30B8\u30E5\u30FC\u30EB\u306E\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u304C\u6210\u529F\u3057\u307E\u3057\u305F\uFF01
ExternalModulesInstallDialog_InstallAll=\u5168\u3066\u306E\u30E2\u30B8\u30E5\u30FC\u30EB\u3092\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u53CA\u3073\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB
ExternalModulesInstallDialog_MoreInfor=<a>\u5916\u90E8\u30E2\u30B8\u30E5\u30FC\u30EB\u306E\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u306B\u3064\u3044\u3066</a>
ExternalModulesInstallDialog_NoExternalModules=\u4F7F\u7528\u53EF\u80FD\u306A\u30E2\u30B8\u30E5\u30FC\u30EB\u304C\u3042\u308A\u307E\u305B\u3093
ExternalModulesInstallDialog_Download_Ok={0} \u306E\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u304C\u6210\u529F\u3057\u307E\u3057\u305F\uFF01
ExternalModulesInstallDialog_Download_Fialed=\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u304C\u5931\u6557\u3057\u307E\u3057\u305F\uFF01 {0}
ExternalModulesInstallDialog_Title_Missing_jars_for_plugin=3rd\u30D1\u30FC\u30C6\u30A3\u30E9\u30A4\u30D6\u30E9\u30EA\u304C\u3042\u308A\u307E\u305B\u3093
ExternalModulesInstallDialog_description_jars_to_be_installed_in=Studio\u306F\u3001\u5E7E\u3064\u304B\u306E\u5916\u90E8\u30E9\u30A4\u30D6\u30E9\u30EA\uFF08\u30E2\u30B8\u30E5\u30FC\u30EB\uFF09\u3092\u5FC5\u8981\u3068\u3057\u307E\u3059\u3002\u4EE5\u4E0B\u306EJAR\u30D5\u30A1\u30A4\u30EB\u3092\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u3057\u3066\u4E0B\u3055\u3044\u3002
ExternalModulesInstallDialog_NoAvailabeModulesMessages=JAR\u30D5\u30A1\u30A4\u30EB {0} \u304C\u4F7F\u7528\u51FA\u6765\u307E\u305B\u3093
ExternalModulesInstallDialog_NoAvailabeModulesTitle=\u4F7F\u7528\u51FA\u6765\u306A\u3044\u30E2\u30B8\u30E5\u30FC\u30EB
ComponentExternalModulesDialog.doNotShow=\u8868\u793A\u3057\u306A\u3044
ExternalModulesInstallDialog.MessageDialog.Infor=\u60C5\u5831
ExternalModulesInstallDialog.openInBrowser=\u30D6\u30E9\u30A6\u30B6\u3092\u958B\u304F
ExternalModulesInstallDialog.downloading1=\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9...
ExternalModulesInstallDialog.downloading2=\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9
ModuleLicenseDialog.license=\u30E9\u30A4\u30BB\u30F3\u30B9
ModuleLicenseDialog.license.accept=\u540C\u610F
RemoteModulesHelper.job.title=\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u53CA\u3073\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB
RemoteModulesHelper.job.task=\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u4E2D...
RemoteModulesHelper.readJsonFromUrl.error=\u30B5\u30FC\u30D0\u30FC\u306B\u63A5\u7D9A\u51FA\u6765\u307E\u305B\u3093\u3002
RemoteModulesHelper.offlineMessages=\u30AA\u30D5\u30E9\u30A4\u30F3\u3067\u3059\u3002\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u306B\u63A5\u7D9A\u3057\u3066\u4E0B\u3055\u3044\u3002
ModulesViewComposite.hint.installed=\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u6E08
ModulesViewComposite.hint.unknown=\u4E0D\u660E
ModulesViewComposite.Status.TitleText=\u30B9\u30C6\u30FC\u30BF\u30B9
ModulesViewComposite.Component.TitleText=\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8
ModulesViewComposite.Module.TitleText=\u30E2\u30B8\u30E5\u30FC\u30EB
ModulesViewComposite.Required.TitleText=\u8AAC\u660E
ModulesViewComposite.Required.Title=\u5FC5\u9808
InstallPerlModulesAction.InstallBtn.Text=\u30E2\u30B8\u30E5\u30FC\u30EB\u306E\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB
JavaLibrariesService.synchronization=Java\u30E9\u30A4\u30D6\u30E9\u30EA\u306E\u540C\u671F\u304C\u7D42\u4E86\u3057\u307E\u3057\u305F
ImportExternalJarAction.title=\u5916\u90E8JAR\u30D5\u30A1\u30A4\u30EB\u3092\u30A4\u30F3\u30DD\u30FC\u30C8
Module.view.download.external.modules.action.description=\u5916\u90E8\u30E2\u30B8\u30E5\u30FC\u30EB\u3092\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9
download.external.dialog.title=\u4EE5\u4E0B\u306E\u30E2\u30B8\u30E5\u30FC\u30EB\u304C\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u53CA\u3073\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u3057\u3066\u4E0B\u3055\u3044\u3002
download.external.dialog.desciption=\u30E2\u30B8\u30E5\u30FC\u30EB\u306F\u81EA\u52D5\u7684\u306B\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\uFF06\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u3055\u308C\u307E\u3059\u3002
AcceptModuleLicensesWizardDialog.button.acceptAll=\u5168\u3066\u540C\u610F
AcceptModuleLicensesWizardDialog.cancelConfirmation.title=\u78BA\u8A8D
AcceptModuleLicensesWizardDialog.cancelConfirmation.msg=\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u3092\u30AD\u30E3\u30F3\u30BB\u30EB\u3057\u307E\u3059\u304B\uFF1F
AcceptModuleLicensesWizardPage.title=\u30E9\u30A4\u30BB\u30F3\u30B9\u6761\u9805\u306E\u78BA\u8A8D
AcceptModuleLicensesWizardPage.desc=\u30EA\u30B9\u30C8\u3055\u308C\u305F\u30E9\u30A4\u30BB\u30F3\u30B9\u30F3\u30B9\u306F\u627F\u8A8D\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002JAR\u30D5\u30A1\u30A4\u30EB\u306E\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u306B\u306F\u3001\u30E9\u30A4\u30BB\u30F3\u30B9\u3078\u306E\u540C\u610F\u304C\u5FC5\u8981\u3068\u306A\u308A\u307E\u3059\u3002
AcceptModuleLicensesWizardPage.licensesList.label=\u30E9\u30A4\u30BB\u30F3\u30B9\uFF1A
AcceptModuleLicensesWizardPage.licenseContent.button.accept=\u9078\u629E\u3055\u308C\u305F\u30E9\u30A4\u30BB\u30F3\u30B9\u306B\u540C\u610F\u3057\u307E\u3059
AcceptModuleLicensesWizardPage.licenseContent.button.decline=\u9078\u629E\u3055\u308C\u305F\u30E9\u30A4\u30BB\u30F3\u30B9\u306B\u540C\u610F\u3057\u307E\u305B\u3093
AcceptModuleLicensesWizardPage.licenseContent.label=\u30E9\u30A4\u30BB\u30F3\u30B9\u30C6\u30AD\u30B9\u30C8\uFF1A
AcceptModuleLicensesWizardPage.licenseContent.defaultDesc=\u30E2\u30B8\u30E5\u30FC\u30EB\u306E\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u524D\u306B\u30E9\u30A4\u30BB\u30F3\u30B9\u6761\u9805\u306E\u78BA\u8A8D\u3068\u540C\u610F\u304C\u5FC5\u8981\u3067\u3059
AcceptModuleLicensesWizardPage.retrieveLicenses=\u30E9\u30A4\u30BB\u30F3\u30B9\u3092\u53D6\u5F97...
AcceptModuleLicensesWizardPage.rejectLicensesConfirmation.title=\u78BA\u8A8D
AcceptModuleLicensesWizardPage.rejectLicensesConfirmation.msg=\u4EE5\u4E0B\u306E\u30E9\u30A4\u30BB\u30F3\u30B9\uFF1A{0}\u3078\u306E\u540C\u610F\u3092\u62D2\u5426\u3057\u307E\u3059\u304B\uFF1F

View File

@@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.talend.repository.items.importexport.nl</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@@ -1,6 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Nl
Bundle-SymbolicName: org.talend.repository.items.importexport.nl
Bundle-Version: 1.0.0.qualifier
Fragment-Host: org.talend.repository.items.importexport

View File

@@ -1,16 +0,0 @@
AbstractImportHandler_cannotImportMessage=from the project {0} use a more recent version of studio so cannot import it.
AbstractImportHandler_persistenceException=A newer version of {0} already exist.
AbstractImportHandler_unsupportItem=Can not import the item, Please ensure the items are valid in current product.
AbstractImportHandler_itemLocked=The item is locked.
AbstractImportHandler_nameUsed=This item already exists. Check the Recycle bin and empty it if needed.
AbstractImportHandler_importing=Importing {0}
AbstractImportHandler_projectNotFound=Cannot find the associated project file in the path you provided.
ImportExportHandlersManager_populatingItemsMessage=Populate items to import
ImportExportHandlersManager_importingItemsMessage=Importing items...
ImportExportHandlersManager_importingItemsError=Import errors
ImportExportHandlersManager_deletingItemsMessage=Delete items...
ImportBasicHandler_ErrorCreateEmfResource=Load EMF Resource failed.
ImportBasicHandler_MissingItemFile=missing item file.
ImportBasicHandler_NotHrefCurrentItemFile=original item file has some errors, it has been recovered from file name, please recheck.
ImportBasicHandler_MissingItemError={0};Missing '{1}' file!;{2}
ImportBasicHandler_LoadEMFResourceError={0};Load EMF Resource failed;{1}

View File

@@ -1,7 +0,0 @@
AbstractImportHandler_persistenceException=Une version plus récente de {0} existe déjà.
AbstractImportHandler_itemLocked=L'élément est verrouillé.
AbstractImportHandler_importing=Import de {0}
AbstractImportHandler_projectNotFound=Impossible de trouver le fichier du projet associé à l'emplacement fourni.
ImportExportHandlersManager_populatingItemsMessage=Peupler les éléments à importer
ImportExportHandlersManager_importingItemsMessage=Import des éléments...
ImportExportHandlersManager_importingItemsError=Erreurs lors de l'import

View File

@@ -1,8 +0,0 @@
AbstractImportHandler_cannotImportMessage={0} \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u3092\u30A4\u30F3\u30DD\u30FC\u30C8\u3067\u304D\u307E\u305B\u3093\u3002\u30A4\u30F3\u30DD\u30FC\u30C8\u3059\u308B\u306B\u306F\u3001\u3088\u308A\u65B0\u3057\u3044\u30D0\u30FC\u30B8\u30E7\u30F3\u306E Studio \u304C\u5FC5\u8981\u3067\u3059\u3002
AbstractImportHandler_persistenceException={0} \u306E\u65B0\u3057\u3044\u30D0\u30FC\u30B8\u30E7\u30F3\u304C\u5B58\u5728\u3057\u3066\u3044\u307E\u3059\u3002
AbstractImportHandler_unsupportItem=\u30A2\u30A4\u30C6\u30E0\u3092\u30A4\u30F3\u30DD\u30FC\u30C8\u3067\u304D\u307E\u305B\u3093\u3002\u73FE\u5728\u4F7F\u7528\u3057\u3066\u3044\u308B\u88FD\u54C1\u306B\u9069\u3057\u305F\u30A2\u30A4\u30C6\u30E0\u3067\u3042\u308B\u3053\u3068\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002
AbstractImportHandler_itemLocked=\u30A2\u30A4\u30C6\u30E0\u304C\u30ED\u30C3\u30AF\u3055\u308C\u3066\u3044\u307E\u3059\u3002
AbstractImportHandler_importing=\u30A4\u30F3\u30DD\u30FC\u30C8 {0}
AbstractImportHandler_projectNotFound=\u6307\u5B9A\u3055\u308C\u305F\u30D1\u30B9\u306B\u306F\u3001\u95A2\u9023\u3059\u308B\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u304C\u5B58\u5728\u3057\u307E\u305B\u3093\u3002
ImportExportHandlersManager_importingItemsMessage=\u9805\u76EE\u3092\u30A4\u30F3\u30DD\u30FC\u30C8\u4E2D...
ImportExportHandlersManager_importingItemsError=\u30A4\u30F3\u30DD\u30FC\u30C8\u30A8\u30E9\u30FC

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="output" path="class"/>
</classpath>

View File

@@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.talend.repository.items.importexport.ui.nl</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@@ -1,6 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Nl Fragment
Bundle-SymbolicName: org.talend.repository.items.importexport.ui.nl
Bundle-Version: 1.0.0.qualifier
Fragment-Host: org.talend.repository.items.importexport.ui

View File

@@ -1,4 +0,0 @@
source.. = src/main/java
output.. = class/
bin.includes = META-INF/,\
.

View File

@@ -1,2 +0,0 @@
ImportItemsAction_title=Import Items
ExportItemsAction_title=Export Items

View File

@@ -1 +0,0 @@
ExportItemsAction_title=Exporter des éléments

View File

@@ -1,2 +0,0 @@
ImportItemsAction_title=\u9805\u76EE\u306E\u30A4\u30F3\u30DD\u30FC\u30C8
ExportItemsAction_title=\u9805\u76EE\u306E\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8

View File

@@ -1,31 +0,0 @@
ImportItemsWizardPage_importDescription=Import items from a directory or an archive file.
ImportItemsWizardPage_browseText=Browse...
ImportItemsWizardPage_deselectAllButtonText=Deselect All
ImportItemsWizardPage_fromExchangeText=From Exchange
ImportItemsWizardPage_fromExchangeToolTipText=Browse from Talend Exchange
ImportItemsWizardPage_messagesText=Errors and Warnings
ImportItemsWizardPage_overwriteItemsText=Overwrite existing items.
ImportItemsWizardPage_refreshButtonText=Refresh
ImportItemsWizardPage_selectArchiveText=Select archive file:
ImportItemsWizardPage_selectButtonText=Select All
ImportItemsWizardPage_selectDirectoryText=Select root directory:
ImportItemsWizardPage_selectDirectoryDialogTitle=Select root directory of the projects to import
ImportItemsWizardPage_selectArchiveDialogTitle=Select archive containing the projects to import
ImportItemsWizardPage_expandAllButtonText=Expand All
ImportItemsWizardPage_collapseAllButtonText=Collapse All
ImportItemsWizardPage_fromExchangeWarningTitle=Warining
ImportItemsWizardPage_fromExchangeWarningMessage=Do not support importing from Exchange system.
ImportItemsWizardPage_noValidItemsInPathMessage=There is no valid items to import, and make sure the selected path contain valid items.
ImportItemsWizardPage_searchingMessage=Searching for projects
ImportItemsWizardPage_errorTitle=Error
ImportItemsWizardPage_couldNotRead=Source file could not be read.
ImportItemsWizardPage_sameIdProblemMessage=The 2 following items have the same ID, please unselect one of them: \n [{0}] [{1}]
ImportItemsWizardPage_TarImport_badFormat=Source file is not a valid tar file.
ImportItemsWizardPage_ZipImport_badFormat=Source file is not a valid Zip file.
ImportItemsAction_title=Import items
ImportItemsWizardPage_noSelectedItemsMessages=There is no item selected. Please select some items to do import.
ShowErrorsDuringImportItemsDialog_title=Errors during the import items
ShowErrorsDuringImportItemsDialog_exportLogButton_title=Export Log
ShowErrorsDuringImportItemsDialog_exportLogEntry=Export Log Entry
ShowErrorsDuringImportItemsDialog_confirmOverwrite_message=File " {0}" exists. Would you like to overwrite it?
ImportItemsWizardPage_ErrorsMessage=The item '{0}' with different version {1} exists. Check the Recycle bin and empty it if needed.

View File

@@ -1,20 +0,0 @@
ImportItemsWizardPage_importDescription=Importer les éléments depuis un répertoire ou un fichier archive.
ImportItemsWizardPage_browseText=Parcourir...
ImportItemsWizardPage_deselectAllButtonText=Désélectionner tout
ImportItemsWizardPage_messagesText=Erreurs et avertissements
ImportItemsWizardPage_overwriteItemsText=Ecraser les éléments existants.
ImportItemsWizardPage_selectArchiveText=Sélectionnez un fichier archive
ImportItemsWizardPage_selectButtonText=Sélectionner tout
ImportItemsWizardPage_selectDirectoryText=Sélectionnez le répertoire racine :
ImportItemsWizardPage_selectDirectoryDialogTitle=Sélectionnez le répertoire racine des projets à importer.
ImportItemsWizardPage_selectArchiveDialogTitle=Sélectionnez l'archive contenant les projets à importer
ImportItemsWizardPage_expandAllButtonText=Développer tout
ImportItemsWizardPage_collapseAllButtonText=Réduire tout
ImportItemsWizardPage_noValidItemsInPathMessage=Aucun élément valide à importer, vérifiez que le chemin sélectionné contient des éléments valides.
ImportItemsWizardPage_searchingMessage=Recherche des projets
ImportItemsWizardPage_couldNotRead=Impossible de lire le fichier source.
ImportItemsWizardPage_sameIdProblemMessage=Les deux éléments suivants ont le même ID, désélectionnez l'un des deux : \n [{0}] [{1}]
ImportItemsWizardPage_TarImport_badFormat=Le fichier source n'est pas un fichier tar valide.
ImportItemsWizardPage_ZipImport_badFormat=Le fichier source n'est pas un fichier Zip valide.
ImportItemsAction_title=Importer des éléments
ImportItemsWizardPage_noSelectedItemsMessages=Aucune article a été selectionnée.

View File

@@ -1,16 +0,0 @@
ImportItemsWizardPage_importDescription=\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u53C8\u306FZIP\u30D5\u30A1\u30A4\u30EB\u304B\u3089\u30A2\u30A4\u30C6\u30E0\u3092\u30A4\u30F3\u30DD\u30FC\u30C8
ImportItemsWizardPage_browseText=\u53C2\u7167...
ImportItemsWizardPage_deselectAllButtonText=\u5168\u3066\u306E\u9078\u629E\u3092\u89E3\u9664
ImportItemsWizardPage_fromExchangeToolTipText=Talend Exchange\u3092\u53C2\u7167
ImportItemsWizardPage_messagesText=\u30A8\u30E9\u30FC\u53C8\u306F\u8B66\u544A
ImportItemsWizardPage_overwriteItemsText=\u65E2\u5B58\u306E\u9805\u76EE\u3092\u4E0A\u66F8\u304D
ImportItemsWizardPage_refreshButtonText=\u66F4\u65B0
ImportItemsWizardPage_selectButtonText=\u5168\u3066\u9078\u629E
ImportItemsWizardPage_expandAllButtonText=\u5168\u3066\u958B\u304F
ImportItemsWizardPage_collapseAllButtonText=\u5168\u3066\u7573\u3080
ImportItemsWizardPage_fromExchangeWarningTitle=\u8B66\u544A
ImportItemsWizardPage_errorTitle=\u30A8\u30E9\u30FC
ImportItemsWizardPage_couldNotRead=\u30BD\u30FC\u30B9\u30D5\u30A1\u30A4\u30EB\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093
ImportItemsWizardPage_ZipImport_badFormat=\u9078\u629E\u3055\u308C\u305F\u30D5\u30A1\u30A4\u30EB\u306F\u6B63\u3057\u3044ZIP\u30D5\u30A1\u30A4\u30EB\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
ImportItemsAction_title=\u9805\u76EE\u306E\u30A4\u30F3\u30DD\u30FC\u30C8
ImportItemsWizardPage_noSelectedItemsMessages=\u30A2\u30A4\u30C6\u30E0\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u30A4\u30F3\u30DD\u30FC\u30C8\u3059\u308B\u30A2\u30A4\u30C6\u30E0\u3092\u9078\u629E\u3057\u3066\u4E0B\u3055\u3044\u3002

View File

@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.talend.updates-feature</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.pde.FeatureBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.FeatureNature</nature>
</natures>
</projectDescription>

View File

@@ -1,34 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="org.talend.updates_feature"
label="Updates-feature"
version="1.0.0.qualifier"
provider-name=".Talend SA.">
<copyright url="http://www.talend.com/about-us">
[Enter Copyright Description here.]
</copyright>
<requires>
<import plugin="org.eclipse.core.runtime"/>
<import plugin="org.eclipse.ui"/>
<import plugin="org.apache.log4j"/>
<import plugin="org.eclipse.jface"/>
<import plugin="org.eclipse.jface.databinding"/>
<import plugin="org.eclipse.core.databinding"/>
<import plugin="org.eclipse.core.databinding.beans"/>
<import plugin="org.eclipse.core.databinding.observable"/>
<import plugin="org.eclipse.core.databinding.property"/>
<import plugin="org.talend.core.runtime"/>
<import plugin="org.talend.librariesmanager"/>
<import plugin="org.talend.librariesmanager.ui"/>
</requires>
<plugin
id="org.talend.updates.runtime"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature>

View File

@@ -1 +0,0 @@
bin.includes = feature.xml

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

View File

@@ -1,12 +0,0 @@
source.. = src/
output.. = bin/
source.dist/org.talend.commons.runtime.jar = src/
output.dist/org.talend.commons.runtime.jar = bin/
bin.includes = META-INF/,\
.,\
fakejdbc_driver.jar,\
modes/,\
talend.properties,\
dist/
jars.compile.order = .,\
dist/org.talend.commons.runtime.jar

View File

@@ -1,485 +0,0 @@
<?xml version="1.0"?>
<!--
<!DOCTYPE MODE SYSTEM "xmode.dtd">
-->
<MODE>
<PROPS>
<PROPERTY NAME="commentStart" VALUE="/*" />
<PROPERTY NAME="commentEnd" VALUE="*/" />
<PROPERTY NAME="lineComment" VALUE="--" />
</PROPS>
<RULES IGNORE_CASE="TRUE" HIGHLIGHT_DIGITS="TRUE">
<!-- whitespace: (space and tab) -->
<WHITESPACE>
</WHITESPACE>
<WHITESPACE>
</WHITESPACE>
<SPAN TYPE="COMMENT1">
<BEGIN>/*</BEGIN>
<END>*/</END>
</SPAN>
<SPAN TYPE="LITERAL1">
<BEGIN>"</BEGIN>
<END>"</END>
</SPAN>
<SPAN TYPE="LITERAL1">
<BEGIN>'</BEGIN>
<END>'</END>
</SPAN>
<SPAN TYPE="LITERAL1" NO_LINE_BREAK="TRUE">
<BEGIN>[</BEGIN>
<END>]</END>
</SPAN>
<MARK_PREVIOUS TYPE="FUNCTION" EXCLUDE_MATCH="TRUE">(
</MARK_PREVIOUS>
<EOL_SPAN TYPE="COMMENT1">--</EOL_SPAN>
<SEQ TYPE="OPERATOR">+</SEQ>
<SEQ TYPE="OPERATOR">-</SEQ>
<SEQ TYPE="OPERATOR">/</SEQ>
<SEQ TYPE="OPERATOR">*</SEQ>
<SEQ TYPE="OPERATOR">=</SEQ>
<SEQ TYPE="OPERATOR">&gt;</SEQ>
<SEQ TYPE="OPERATOR">&lt;</SEQ>
<SEQ TYPE="OPERATOR">%</SEQ>
<SEQ TYPE="OPERATOR">&amp;</SEQ>
<SEQ TYPE="OPERATOR">|</SEQ>
<SEQ TYPE="OPERATOR">^</SEQ>
<SEQ TYPE="OPERATOR">~</SEQ>
<SEQ TYPE="OPERATOR">!=</SEQ>
<SEQ TYPE="OPERATOR">!&gt;</SEQ>
<SEQ TYPE="OPERATOR">!&lt;</SEQ>
<SEQ TYPE="OPERATOR">::</SEQ>
<MARK_PREVIOUS TYPE="LABEL" AT_LINE_START="TRUE">:
</MARK_PREVIOUS>
<SEQ TYPE="NULL">:</SEQ>
<SEQ TYPE="NULL">.</SEQ>
<SEQ TYPE="NULL">,</SEQ>
<SEQ TYPE="NULL">;</SEQ>
<SEQ TYPE="NULL">)</SEQ>
<SEQ TYPE="NULL">(</SEQ>
<MARK_FOLLOWING TYPE="LITERAL2">@</MARK_FOLLOWING>
<KEYWORDS IGNORE_CASE="TRUE">
<!-- reserved words -->
<KEYWORD1>ABSOLUTE</KEYWORD1>
<KEYWORD1>ADD</KEYWORD1>
<KEYWORD1>ALTER</KEYWORD1>
<KEYWORD1>ANSI_NULLS</KEYWORD1>
<KEYWORD1>AS</KEYWORD1>
<KEYWORD1>ASC</KEYWORD1>
<KEYWORD1>AUTHORIZATION</KEYWORD1>
<KEYWORD1>BACKUP</KEYWORD1>
<KEYWORD1>BEGIN</KEYWORD1>
<KEYWORD1>BREAK</KEYWORD1>
<KEYWORD1>BROWSE</KEYWORD1>
<KEYWORD1>BULK</KEYWORD1>
<KEYWORD1>BY</KEYWORD1>
<KEYWORD1>CASCADE</KEYWORD1>
<KEYWORD1>CHECK</KEYWORD1>
<KEYWORD1>CHECKPOINT</KEYWORD1>
<KEYWORD1>CLOSE</KEYWORD1>
<KEYWORD1>CLUSTERED</KEYWORD1>
<KEYWORD1>COLUMN</KEYWORD1>
<KEYWORD1>COMMIT</KEYWORD1>
<KEYWORD1>COMMITTED</KEYWORD1>
<KEYWORD1>COMPUTE</KEYWORD1>
<KEYWORD1>CONFIRM</KEYWORD1>
<KEYWORD1>CONSTRAINT</KEYWORD1>
<KEYWORD1>CONTAINS</KEYWORD1>
<KEYWORD1>CONTAINSTABLE</KEYWORD1>
<KEYWORD1>CONTINUE</KEYWORD1>
<KEYWORD1>CONTROLROW</KEYWORD1>
<KEYWORD1>CREATE</KEYWORD1>
<KEYWORD1>CURRENT</KEYWORD1>
<KEYWORD1>CURRENT_DATE</KEYWORD1>
<KEYWORD1>CURRENT_TIME</KEYWORD1>
<KEYWORD1>CURSOR</KEYWORD1>
<KEYWORD1>DATABASE</KEYWORD1>
<KEYWORD1>DBCC</KEYWORD1>
<KEYWORD1>DEALLOCATE</KEYWORD1>
<KEYWORD1>DECLARE</KEYWORD1>
<KEYWORD1>DEFAULT</KEYWORD1>
<KEYWORD1>DELETE</KEYWORD1>
<KEYWORD1>DENY</KEYWORD1>
<KEYWORD1>DESC</KEYWORD1>
<KEYWORD1>DISK</KEYWORD1>
<KEYWORD1>DISTINCT</KEYWORD1>
<KEYWORD1>DISTRIBUTED</KEYWORD1>
<KEYWORD1>DOUBLE</KEYWORD1>
<KEYWORD1>DROP</KEYWORD1>
<KEYWORD1>DUMMY</KEYWORD1>
<KEYWORD1>DUMP</KEYWORD1>
<KEYWORD1>DYNAMIC</KEYWORD1>
<KEYWORD1>ELSE</KEYWORD1>
<KEYWORD1>END</KEYWORD1>
<KEYWORD1>ERRLVL</KEYWORD1>
<KEYWORD1>ERROREXIT</KEYWORD1>
<KEYWORD1>ESCAPE</KEYWORD1>
<KEYWORD1>EXCEPT</KEYWORD1>
<KEYWORD1>EXEC</KEYWORD1>
<KEYWORD1>EXECUTE</KEYWORD1>
<KEYWORD1>EXIT</KEYWORD1>
<KEYWORD1>FAST_FORWARD</KEYWORD1>
<KEYWORD1>FETCH</KEYWORD1>
<KEYWORD1>FILE</KEYWORD1>
<KEYWORD1>FILLFACTOR</KEYWORD1>
<KEYWORD1>FIRST</KEYWORD1>
<KEYWORD1>FLOPPY</KEYWORD1>
<KEYWORD1>FOR</KEYWORD1>
<KEYWORD1>FOREACH</KEYWORD1>
<KEYWORD1>FOREIGN</KEYWORD1>
<KEYWORD1>FORWARD_ONLY</KEYWORD1>
<KEYWORD1>FREETEXT</KEYWORD1>
<KEYWORD1>FREETEXTTABLE</KEYWORD1>
<KEYWORD1>FROM</KEYWORD1>
<KEYWORD1>FULL</KEYWORD1>
<KEYWORD1>FUNCTION</KEYWORD1>
<KEYWORD1>GLOBAL</KEYWORD1>
<KEYWORD1>GOTO</KEYWORD1>
<KEYWORD1>GRANT</KEYWORD1>
<KEYWORD1>GROUP</KEYWORD1>
<KEYWORD1>HAVING</KEYWORD1>
<KEYWORD1>HOLDLOCK</KEYWORD1>
<KEYWORD1>ID</KEYWORD1>
<KEYWORD1>IDENTITYCOL</KEYWORD1>
<KEYWORD1>IDENTITY_INSERT</KEYWORD1>
<KEYWORD1>IF</KEYWORD1>
<KEYWORD1>INDEX</KEYWORD1>
<KEYWORD1>INNER</KEYWORD1>
<KEYWORD1>INSENSITIVE</KEYWORD1>
<KEYWORD1>INSERT</KEYWORD1>
<KEYWORD1>INTO</KEYWORD1>
<KEYWORD1>IS</KEYWORD1>
<KEYWORD1>ISOLATION</KEYWORD1>
<KEYWORD1>KEY</KEYWORD1>
<KEYWORD1>KEYSET</KEYWORD1>
<KEYWORD1>KILL</KEYWORD1>
<KEYWORD1>LAST</KEYWORD1>
<KEYWORD1>LEVEL</KEYWORD1>
<KEYWORD1>LIMIT</KEYWORD1>
<KEYWORD1>LINENO</KEYWORD1>
<KEYWORD1>LOAD</KEYWORD1>
<KEYWORD1>LOCAL</KEYWORD1>
<KEYWORD1>MATCH</KEYWORD1>
<KEYWORD1>MAX</KEYWORD1>
<KEYWORD1>MERGE</KEYWORD1>
<KEYWORD1>MIN</KEYWORD1>
<KEYWORD1>MIRROREXIT</KEYWORD1>
<KEYWORD1>NATIONAL</KEYWORD1>
<KEYWORD1>NEXT</KEYWORD1>
<KEYWORD1>NOCHECK</KEYWORD1>
<KEYWORD1>NONCLUSTERED</KEYWORD1>
<KEYWORD1>OF</KEYWORD1>
<KEYWORD1>OFF</KEYWORD1>
<KEYWORD1>OFFSETS</KEYWORD1>
<KEYWORD1>ON</KEYWORD1>
<KEYWORD1>ONCE</KEYWORD1>
<KEYWORD1>ONLY</KEYWORD1>
<KEYWORD1>OPEN</KEYWORD1>
<KEYWORD1>OPENDATASOURCE</KEYWORD1>
<KEYWORD1>OPENQUERY</KEYWORD1>
<KEYWORD1>OPENROWSET</KEYWORD1>
<KEYWORD1>OPTIMISTIC</KEYWORD1>
<KEYWORD1>OPTIONAL</KEYWORD1>
<KEYWORD1>OPTION</KEYWORD1>
<KEYWORD1>ORDER</KEYWORD1>
<KEYWORD1>OUTPUT</KEYWORD1>
<KEYWORD1>OVER</KEYWORD1>
<KEYWORD1>PERCENT</KEYWORD1>
<KEYWORD1>PERM</KEYWORD1>
<KEYWORD1>PERMANENT</KEYWORD1>
<KEYWORD1>PIPE</KEYWORD1>
<KEYWORD1>PLAN</KEYWORD1>
<KEYWORD1>PRECISION</KEYWORD1>
<KEYWORD1>PREPARE</KEYWORD1>
<KEYWORD1>PRIMARY</KEYWORD1>
<KEYWORD1>PRINT</KEYWORD1>
<KEYWORD1>PRIOR</KEYWORD1>
<KEYWORD1>PRIVILEGES</KEYWORD1>
<KEYWORD1>PROC</KEYWORD1>
<KEYWORD1>PROCEDURE</KEYWORD1>
<KEYWORD1>PROCESSEXIT</KEYWORD1>
<KEYWORD1>PUBLIC</KEYWORD1>
<KEYWORD1>QUOTED_IDENTIFIER</KEYWORD1>
<KEYWORD1>RAISERROR</KEYWORD1>
<KEYWORD1>READ</KEYWORD1>
<KEYWORD1>READTEXT</KEYWORD1>
<KEYWORD1>READ_ONLY</KEYWORD1>
<KEYWORD1>RECONFIGURE</KEYWORD1>
<KEYWORD1>REFERENCES</KEYWORD1>
<KEYWORD1>RELATIVE</KEYWORD1>
<KEYWORD1>REMOVE</KEYWORD1>
<KEYWORD1>REPEATABLE</KEYWORD1>
<KEYWORD1>REPLICATION</KEYWORD1>
<KEYWORD1>RESTORE</KEYWORD1>
<KEYWORD1>RESTRICT</KEYWORD1>
<KEYWORD1>RETURN</KEYWORD1>
<KEYWORD1>RETURNS</KEYWORD1>
<KEYWORD1>REVOKE</KEYWORD1>
<KEYWORD1>ROLLBACK</KEYWORD1>
<KEYWORD1>ROWGUIDCOL</KEYWORD1>
<KEYWORD1>RULE</KEYWORD1>
<KEYWORD1>SAVE</KEYWORD1>
<KEYWORD1>SCHEMA</KEYWORD1>
<KEYWORD1>SCROLL</KEYWORD1>
<KEYWORD1>SCROLL_LOCKS</KEYWORD1>
<KEYWORD1>SELECT</KEYWORD1>
<KEYWORD1>SERIALIZABLE</KEYWORD1>
<KEYWORD1>SET</KEYWORD1>
<KEYWORD1>SETUSER</KEYWORD1>
<KEYWORD1>SHUTDOWN</KEYWORD1>
<KEYWORD1>SKIP</KEYWORD1>
<KEYWORD1>START</KEYWORD1>
<KEYWORD1>STATIC</KEYWORD1>
<KEYWORD1>STATISTICS</KEYWORD1>
<KEYWORD1>TABLE</KEYWORD1>
<KEYWORD1>TAPE</KEYWORD1>
<KEYWORD1>TEMP</KEYWORD1>
<KEYWORD1>TEMPORARY</KEYWORD1>
<KEYWORD1>TEXTIMAGE_ON</KEYWORD1>
<KEYWORD1>THEN</KEYWORD1>
<KEYWORD1>TO</KEYWORD1>
<KEYWORD1>TOP</KEYWORD1>
<KEYWORD1>TRAN</KEYWORD1>
<KEYWORD1>TRANSACTION</KEYWORD1>
<KEYWORD1>TRIGGER</KEYWORD1>
<KEYWORD1>TRUNCATE</KEYWORD1>
<KEYWORD1>TSEQUAL</KEYWORD1>
<KEYWORD1>UNCOMMITTED</KEYWORD1>
<KEYWORD1>UNION</KEYWORD1>
<KEYWORD1>UNIQUE</KEYWORD1>
<KEYWORD1>UPDATE</KEYWORD1>
<KEYWORD1>UPDATETEXT</KEYWORD1>
<KEYWORD1>USE</KEYWORD1>
<KEYWORD1>VALUES</KEYWORD1>
<KEYWORD1>VARYING</KEYWORD1>
<KEYWORD1>VIEW</KEYWORD1>
<KEYWORD1>WAITFOR</KEYWORD1>
<KEYWORD1>WHEN</KEYWORD1>
<KEYWORD1>WHERE</KEYWORD1>
<KEYWORD1>WHILE</KEYWORD1>
<KEYWORD1>WITH</KEYWORD1>
<KEYWORD1>WORK</KEYWORD1>
<KEYWORD1>WRITETEXT</KEYWORD1>
<!-- data types -->
<KEYWORD1>binary</KEYWORD1>
<KEYWORD1>bit</KEYWORD1>
<KEYWORD1>char</KEYWORD1>
<KEYWORD1>character</KEYWORD1>
<KEYWORD1>datetime</KEYWORD1>
<KEYWORD1>decimal</KEYWORD1>
<KEYWORD1>float</KEYWORD1>
<KEYWORD1>image</KEYWORD1>
<KEYWORD1>int</KEYWORD1>
<KEYWORD1>integer</KEYWORD1>
<KEYWORD1>money</KEYWORD1>
<KEYWORD1>name</KEYWORD1>
<KEYWORD1>numeric</KEYWORD1>
<KEYWORD1>nchar</KEYWORD1>
<KEYWORD1>nvarchar</KEYWORD1>
<KEYWORD1>ntext</KEYWORD1>
<KEYWORD1>real</KEYWORD1>
<KEYWORD1>smalldatetime</KEYWORD1>
<KEYWORD1>smallint</KEYWORD1>
<KEYWORD1>smallmoney</KEYWORD1>
<KEYWORD1>text</KEYWORD1>
<KEYWORD1>timestamp</KEYWORD1>
<KEYWORD1>tinyint</KEYWORD1>
<KEYWORD1>uniqueidentifier</KEYWORD1>
<KEYWORD1>varbinary</KEYWORD1>
<KEYWORD1>varchar</KEYWORD1>
<!-- system functions -->
<KEYWORD2>@@CONNECTIONS</KEYWORD2>
<KEYWORD2>@@CPU_BUSY</KEYWORD2>
<KEYWORD2>@@CURSOR_ROWS</KEYWORD2>
<KEYWORD2>@@DATEFIRST</KEYWORD2>
<KEYWORD2>@@DBTS</KEYWORD2>
<KEYWORD2>@@ERROR</KEYWORD2>
<KEYWORD2>@@FETCH_STATUS</KEYWORD2>
<KEYWORD2>@@IDENTITY</KEYWORD2>
<KEYWORD2>@@IDLE</KEYWORD2>
<KEYWORD2>@@IO_BUSY</KEYWORD2>
<KEYWORD2>@@LANGID</KEYWORD2>
<KEYWORD2>@@LANGUAGE</KEYWORD2>
<KEYWORD2>@@LOCK_TIMEOUT</KEYWORD2>
<KEYWORD2>@@MAX_CONNECTIONS</KEYWORD2>
<KEYWORD2>@@MAX_PRECISION</KEYWORD2>
<KEYWORD2>@@NESTLEVEL</KEYWORD2>
<KEYWORD2>@@OPTIONS</KEYWORD2>
<KEYWORD2>@@PACKET_ERRORS</KEYWORD2>
<KEYWORD2>@@PACK_RECEIVED</KEYWORD2>
<KEYWORD2>@@PACK_SENT</KEYWORD2>
<KEYWORD2>@@PROCID</KEYWORD2>
<KEYWORD2>@@REMSERVER</KEYWORD2>
<KEYWORD2>@@ROWCOUNT</KEYWORD2>
<KEYWORD2>@@SERVERNAME</KEYWORD2>
<KEYWORD2>@@SERVICENAME</KEYWORD2>
<KEYWORD2>@@SPID</KEYWORD2>
<KEYWORD2>@@TEXTSIZE</KEYWORD2>
<KEYWORD2>@@TIMETICKS</KEYWORD2>
<KEYWORD2>@@TOTAL_ERRORS</KEYWORD2>
<KEYWORD2>@@TOTAL_READ</KEYWORD2>
<KEYWORD2>@@TOTAL_WRITE</KEYWORD2>
<KEYWORD2>@@TRANCOUNT</KEYWORD2>
<KEYWORD2>@@VERSION</KEYWORD2>
<KEYWORD2>ABS</KEYWORD2>
<KEYWORD2>ACOS</KEYWORD2>
<KEYWORD2>APP_NAME</KEYWORD2>
<KEYWORD2>ASCII</KEYWORD2>
<KEYWORD2>ASIN</KEYWORD2>
<KEYWORD2>ATAN</KEYWORD2>
<KEYWORD2>ATN2</KEYWORD2>
<KEYWORD2>AVG</KEYWORD2>
<KEYWORD2>BINARY_CHECKSUM</KEYWORD2>
<KEYWORD2>CASE</KEYWORD2>
<KEYWORD2>CAST</KEYWORD2>
<KEYWORD2>CEILING</KEYWORD2>
<KEYWORD2>CHARINDEX</KEYWORD2>
<KEYWORD2>CHECKSUM</KEYWORD2>
<KEYWORD2>CHECKSUM_AGG</KEYWORD2>
<KEYWORD2>COALESCE</KEYWORD2>
<KEYWORD2>COLLATIONPROPERTY</KEYWORD2>
<KEYWORD2>COLUMNPROPERTY</KEYWORD2>
<KEYWORD2>COL_LENGTH</KEYWORD2>
<KEYWORD2>COL_NAME</KEYWORD2>
<KEYWORD2>CONVERT</KEYWORD2>
<KEYWORD2>COS</KEYWORD2>
<KEYWORD2>COT</KEYWORD2>
<KEYWORD2>COUNT</KEYWORD2>
<KEYWORD2>COUNT_BIG</KEYWORD2>
<KEYWORD2>CURRENT_DATE</KEYWORD2>
<KEYWORD2>CURRENT_TIME</KEYWORD2>
<KEYWORD2>CURRENT_TIMESTAMP</KEYWORD2>
<KEYWORD2>CURRENT_USER</KEYWORD2>
<KEYWORD2>CURSOR_STATUS</KEYWORD2>
<KEYWORD2>DATABASEPROPERTY</KEYWORD2>
<KEYWORD2>DATALENGTH</KEYWORD2>
<KEYWORD2>DATEADD</KEYWORD2>
<KEYWORD2>DATEDIFF</KEYWORD2>
<KEYWORD2>DATENAME</KEYWORD2>
<KEYWORD2>DATEPART</KEYWORD2>
<KEYWORD2>DAY</KEYWORD2>
<KEYWORD2>DB_ID</KEYWORD2>
<KEYWORD2>DB_NAME</KEYWORD2>
<KEYWORD2>DEGREES</KEYWORD2>
<KEYWORD2>DIFFERENCE</KEYWORD2>
<KEYWORD2>EXP</KEYWORD2>
<KEYWORD2>FILEGROUPPROPERTY</KEYWORD2>
<KEYWORD2>FILEGROUP_ID</KEYWORD2>
<KEYWORD2>FILEGROUP_NAME</KEYWORD2>
<KEYWORD2>FILEPROPERTY</KEYWORD2>
<KEYWORD2>FILE_ID</KEYWORD2>
<KEYWORD2>FILE_NAME</KEYWORD2>
<KEYWORD2>FLOOR</KEYWORD2>
<KEYWORD2>FORMATMESSAGE</KEYWORD2>
<KEYWORD2>FULLTEXTCATALOGPROPERTY</KEYWORD2>
<KEYWORD2>FULLTEXTSERVICEPROPERTY</KEYWORD2>
<KEYWORD2>GETANSINULL</KEYWORD2>
<KEYWORD2>GETDATE</KEYWORD2>
<KEYWORD2>GETUTCDATE</KEYWORD2>
<KEYWORD2>GROUPING</KEYWORD2>
<KEYWORD2>HOST_ID</KEYWORD2>
<KEYWORD2>HOST_NAME</KEYWORD2>
<KEYWORD2>IDENTITY</KEYWORD2>
<KEYWORD2>IDENTITY_INSERT</KEYWORD2>
<KEYWORD2>IDENT_CURRENT</KEYWORD2>
<KEYWORD2>IDENT_INCR</KEYWORD2>
<KEYWORD2>IDENT_SEED</KEYWORD2>
<KEYWORD2>INDEXPROPERTY</KEYWORD2>
<KEYWORD2>INDEX_COL</KEYWORD2>
<KEYWORD2>ISDATE</KEYWORD2>
<KEYWORD2>ISNULL</KEYWORD2>
<KEYWORD2>ISNUMERIC</KEYWORD2>
<KEYWORD2>IS_MEMBER</KEYWORD2>
<KEYWORD2>IS_SRVROLEMEMBER</KEYWORD2>
<KEYWORD2>LEFT</KEYWORD2>
<KEYWORD2>LEN</KEYWORD2>
<KEYWORD2>LOG10</KEYWORD2>
<KEYWORD2>LOG</KEYWORD2>
<KEYWORD2>LOWER</KEYWORD2>
<KEYWORD2>LTRIM</KEYWORD2>
<KEYWORD2>MONTH</KEYWORD2>
<KEYWORD2>NEWID</KEYWORD2>
<KEYWORD2>NULLIF</KEYWORD2>
<KEYWORD2>OBJECTPROPERTY</KEYWORD2>
<KEYWORD2>OBJECT_ID</KEYWORD2>
<KEYWORD2>OBJECT_NAME</KEYWORD2>
<KEYWORD2>PARSENAME</KEYWORD2>
<KEYWORD2>PATINDEX</KEYWORD2>
<KEYWORD2>PERMISSIONS</KEYWORD2>
<KEYWORD2>PI</KEYWORD2>
<KEYWORD2>POWER</KEYWORD2>
<KEYWORD2>QUOTENAME</KEYWORD2>
<KEYWORD2>RADIANS</KEYWORD2>
<KEYWORD2>RAND</KEYWORD2>
<KEYWORD2>REPLACE</KEYWORD2>
<KEYWORD2>REPLICATE</KEYWORD2>
<KEYWORD2>REVERSE</KEYWORD2>
<KEYWORD2>RIGHT</KEYWORD2>
<KEYWORD2>ROUND</KEYWORD2>
<KEYWORD2>ROWCOUNT_BIG</KEYWORD2>
<KEYWORD2>RTRIM</KEYWORD2>
<KEYWORD2>SCOPE_IDENTITY</KEYWORD2>
<KEYWORD2>SERVERPROPERTY</KEYWORD2>
<KEYWORD2>SESSIONPROPERTY</KEYWORD2>
<KEYWORD2>SESSION_USER</KEYWORD2>
<KEYWORD2>SIGN</KEYWORD2>
<KEYWORD2>SIN</KEYWORD2>
<KEYWORD2>SOUNDEX</KEYWORD2>
<KEYWORD2>SPACE</KEYWORD2>
<KEYWORD2>SQRT</KEYWORD2>
<KEYWORD2>SQUARE</KEYWORD2>
<KEYWORD2>STATS_DATE</KEYWORD2>
<KEYWORD2>STDEV</KEYWORD2>
<KEYWORD2>STDEVP</KEYWORD2>
<KEYWORD2>STR</KEYWORD2>
<KEYWORD2>STUFF</KEYWORD2>
<KEYWORD2>SUBSTRING</KEYWORD2>
<KEYWORD2>SUM</KEYWORD2>
<KEYWORD2>SUSER_ID</KEYWORD2>
<KEYWORD2>SUSER_NAME</KEYWORD2>
<KEYWORD2>SUSER_SID</KEYWORD2>
<KEYWORD2>SUSER_SNAME</KEYWORD2>
<KEYWORD2>SYSTEM_USER</KEYWORD2>
<KEYWORD2>TAN</KEYWORD2>
<KEYWORD2>TEXTPTR</KEYWORD2>
<KEYWORD2>TEXTVALID</KEYWORD2>
<KEYWORD2>TIMESTAMP</KEYWORD2>
<KEYWORD2>TYPEPROPERTY</KEYWORD2>
<KEYWORD2>UNICODE</KEYWORD2>
<KEYWORD2>UPPER</KEYWORD2>
<KEYWORD2>USER</KEYWORD2>
<KEYWORD2>USER_ID</KEYWORD2>
<KEYWORD2>USER_NAME</KEYWORD2>
<KEYWORD2>VAR</KEYWORD2>
<KEYWORD2>VARP</KEYWORD2>
<KEYWORD2>YEAR</KEYWORD2>
<!-- operators -->
<KEYWORD1>ALL</KEYWORD1>
<KEYWORD1>AND</KEYWORD1>
<KEYWORD1>ANY</KEYWORD1>
<KEYWORD1>BETWEEN</KEYWORD1>
<KEYWORD1>CROSS</KEYWORD1>
<KEYWORD1>EXISTS</KEYWORD1>
<KEYWORD1>IN</KEYWORD1>
<KEYWORD1>INTERSECT</KEYWORD1>
<KEYWORD1>JOIN</KEYWORD1>
<KEYWORD1>LIKE</KEYWORD1>
<KEYWORD1>NOT</KEYWORD1>
<KEYWORD1>NULL</KEYWORD1>
<KEYWORD1>OR</KEYWORD1>
<KEYWORD1>OUTER</KEYWORD1>
<KEYWORD1>SOME</KEYWORD1>
</KEYWORDS>
</RULES>
</MODE>

View File

@@ -1,35 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.commons.exception;
/**
* created by Talend on Aug 7, 2014 Detailled comment
*
*/
public class OperationCancelException extends PersistenceException {
private static final long serialVersionUID = 3556433676899745391L;
public OperationCancelException(String message, Throwable cause) {
super(message, cause);
}
public OperationCancelException(String message) {
super(message);
}
public OperationCancelException(Throwable cause) {
super(cause);
}
}

View File

@@ -1,141 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.commons.utils.database;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.talend.fakejdbc.FakeDatabaseMetaData;
/**
* created by zshen on Apr 15, 2013 Detailled comment
*
*/
public class PackageFakeDatabaseMetadata extends FakeDatabaseMetaData {
protected Connection connection;
protected DatabaseMetaData metaData;
/**
* DOC xqliu SybaseDatabaseMetaData constructor comment.
*/
public PackageFakeDatabaseMetadata(Connection connection) throws SQLException {
this.connection = connection;
this.metaData = connection.getMetaData();
}
@Override
public Connection getConnection() {
return this.connection;
}
@Override
public ResultSet getCatalogs() throws SQLException {
return this.metaData.getCatalogs();
}
@Override
public ResultSet getColumnPrivileges(String catalog, String schema, String table, String columnNamePattern)
throws SQLException {
return this.metaData.getColumnPrivileges(catalog, schema, table, columnNamePattern);
}
@Override
public ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern)
throws SQLException {
return this.metaData.getColumns(catalog, schemaPattern, tableNamePattern, columnNamePattern);
}
@Override
public int getDatabaseMajorVersion() throws SQLException {
return this.metaData.getDatabaseMajorVersion();
}
@Override
public int getDatabaseMinorVersion() throws SQLException {
return this.metaData.getDatabaseMinorVersion();
}
@Override
public String getDatabaseProductName() throws SQLException {
return this.metaData.getDatabaseProductName();
}
@Override
public String getDatabaseProductVersion() throws SQLException {
return this.metaData.getDatabaseProductVersion();
}
@Override
public int getDefaultTransactionIsolation() throws SQLException {
return this.metaData.getDefaultTransactionIsolation();
}
@Override
public int getDriverMajorVersion() {
return this.metaData.getDriverMajorVersion();
}
@Override
public int getDriverMinorVersion() {
return this.metaData.getDriverMinorVersion();
}
@Override
public String getDriverName() throws SQLException {
return this.metaData.getDriverName();
}
@Override
public String getDriverVersion() throws SQLException {
return this.metaData.getDriverVersion();
}
@Override
public ResultSet getPrimaryKeys(String catalog, String schema, String table) throws SQLException {
return this.metaData.getPrimaryKeys(catalog, schema, table);
}
@Override
public ResultSet getSchemas() throws SQLException {
return this.metaData.getSchemas();
}
@Override
public ResultSet getTablePrivileges(String catalog, String schemaPattern, String tableNamePattern) throws SQLException {
return this.metaData.getTablePrivileges(catalog, schemaPattern, tableNamePattern);
}
@Override
public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) throws SQLException {
return this.metaData.getTables(catalog, schemaPattern, tableNamePattern, types);
}
@Override
public ResultSet getTableTypes() throws SQLException {
return this.metaData.getTableTypes();
}
@Override
public ResultSet getTypeInfo() throws SQLException {
return this.metaData.getTypeInfo();
}
@Override
public <T> T unwrap(Class<T> iface) throws SQLException {
return this.metaData.unwrap(iface);
}
}

View File

@@ -1,56 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.commons.utils.threading;
/**
* created by wchen on 2014-6-6 Detailled comment
*
*/
public abstract class AbsRetrieveColumnRunnable implements Runnable {
volatile boolean isCanceled = false;
private Object columnObject;
/**
* Getter for columnObject.
*
* @return the columnObject
*/
public Object getColumnObject() {
return this.columnObject;
}
/**
* Sets the columnObject.
*
* @param columnObject the columnObject to set
*/
public void setColumnObject(Object columnObject) {
this.columnObject = columnObject;
}
public void setCanceled(boolean cancel) {
this.isCanceled = cancel;
}
/**
* Getter for isCanceled.
*
* @return the isCanceled
*/
public boolean isCanceled() {
return this.isCanceled;
}
}

View File

@@ -1,99 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.commons.utils.threading;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.TimeUnit;
/**
* created by wchen on 2014-6-6 Detailled comment
*
*/
public class CustomMapThreadPoolExecutor extends TalendCustomThreadPoolExecutor {
// This map is used to store the tableItems that are selected or unselected by the user.
// see afterExecute() and beforeExecute(). If an item is in the map, it means that the item's
// related thread is running.
Map<Object, AbsRetrieveColumnRunnable> map = Collections.synchronizedMap(new HashMap<Object, AbsRetrieveColumnRunnable>());
public CustomMapThreadPoolExecutor(int queueCapacity) {
super(queueCapacity);
}
public CustomMapThreadPoolExecutor(int queueCapacity, RejectedExecutionHandler handler) {
super(queueCapacity, handler);
}
public CustomMapThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit,
BlockingQueue<Runnable> workQueue, RejectedExecutionHandler handler) {
super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, handler);
}
/*
* (non-Javadoc)
*
* @see java.util.concurrent.ThreadPoolExecutor#afterExecute(java.lang.Runnable, java.lang.Throwable)
*/
@Override
protected void afterExecute(Runnable r, Throwable t) {
AbsRetrieveColumnRunnable runnable = (AbsRetrieveColumnRunnable) r;
map.remove(runnable.getColumnObject());
}
/*
* (non-Javadoc)
*
* @see java.util.concurrent.ThreadPoolExecutor#beforeExecute(java.lang.Thread, java.lang.Runnable)
*/
@Override
protected void beforeExecute(Thread t, Runnable r) {
AbsRetrieveColumnRunnable runnable = (AbsRetrieveColumnRunnable) r;
map.put(runnable.getColumnObject(), runnable);
}
/**
* If an item is in the List runningThreads, it means that the item's related thread is running.
*
* @param item
* @return
*/
public boolean isThreadRunning(Object item) {
return map.containsKey(item);
}
/**
* Find the RetrieveColumnRunnable from map and waiting queue. Map stores running runnables
*
* @param key
* @return
*/
public synchronized AbsRetrieveColumnRunnable getRunnable(Object key) {
// Get the runnable from map first, else then find it in the waiting queue.
AbsRetrieveColumnRunnable runnable = map.get(key);
if (runnable != null) {
return runnable;
}
for (Object element2 : getQueue()) {
AbsRetrieveColumnRunnable element = (AbsRetrieveColumnRunnable) element2;
if (element.getColumnObject() == key) {
return element;
}
}
return null;
}
}

View File

@@ -1 +0,0 @@
talend.version=5.6.2

View File

@@ -1,35 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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.html;
/**
* constant from org.eclipse.ui.internal.intro.impl.model.url.IntroURL;
*/
public class IntroURL {
public static final String RUN_ACTION = "runAction"; //$NON-NLS-1$
public static final String KEY_PLUGIN_ID = "pluginId"; //$NON-NLS-1$
public static final String KEY_CLASS = "class"; //$NON-NLS-1$
public static final String KEY_STANDBY = "standby"; //$NON-NLS-1$
public static final String KEY_DECODE = "decode"; //$NON-NLS-1$
public static final String VALUE_TRUE = "true"; //$NON-NLS-1$
public static final String INTRO_PROTOCOL = "http"; //$NON-NLS-1$
public static final String INTRO_HOST_ID = "org.eclipse.ui.intro"; //$NON-NLS-1$
}

View File

@@ -1,121 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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.composites;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.talend.commons.ui.runtime.image.EImage;
import org.talend.commons.ui.runtime.image.ImageProvider;
import org.talend.commons.ui.utils.image.ColorUtils;
/**
* DOC ggu class global comment. Detailled comment
*/
public class MessagesComposite extends Composite {
protected static final int H_SPACE_WIDTH = 3;
protected static final int V_SPACE_WIDTH = 5;
protected static final String BLANK = ""; //$NON-NLS-1$
protected Label messageImage, messageLabel;
protected boolean hidden = true;
protected Color backgroundColor, foregroundColor;
public MessagesComposite(Composite parent, int style) {
super(parent, style);
setLayout(new GridLayout(3, false));
messageImage = new Label(this, SWT.NONE);
// FormData imageData = new FormData();
// imageData.left = new FormAttachment(0, H_SPACE_WIDTH);
// imageData.top = new FormAttachment(0, V_SPACE_WIDTH);
// messageImage.setLayoutData(imageData);
messageLabel = new Label(this, SWT.NONE);
// FormData labelData = new FormData();
// labelData.left = new FormAttachment(messageImage, H_SPACE_WIDTH);
// labelData.top = new FormAttachment(0, V_SPACE_WIDTH);
// messageLabel.setLayoutData(labelData);
messageLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
/**
*
* DOC ggu Comment method "updateTopMessages".
*
* @param messages
* @param status is one of IStatus.INFO, IStatus.WARNING, IStatus.ERROR
*/
public void updateTopMessages(String messages, int status) {
hidden = true;
if (messageLabel != null && !messageLabel.isDisposed()) {
if (messages != null && !messages.isEmpty()) {
messageLabel.setText(messages);
messageLabel.setToolTipText(messages);
hidden = false;
} else { // clean the message and hide top message area.
messageLabel.setText(BLANK);
messageLabel.setToolTipText(BLANK);
}
}
backgroundColor = null;
foregroundColor = null;
Image image = null;
if (!hidden) {
switch (status) {
case IStatus.INFO:
image = ImageProvider.getImage(EImage.INFORMATION_ICON);
break;
case IStatus.WARNING:
image = ImageProvider.getImage(EImage.WARNING_ICON);
backgroundColor = ColorUtils.getCacheColor(new RGB(255, 175, 10));
// foregroundColor=
break;
case IStatus.ERROR:
image = ImageProvider.getImage(EImage.ERROR_ICON);
backgroundColor = ColorUtils.getCacheColor(new RGB(238, 64, 0));
// foregroundColor=
break;
default:
}
}
setBackground(backgroundColor);
if (messageImage != null && !messageImage.isDisposed()) {
messageImage.setImage(image);
messageImage.setBackground(backgroundColor);
}
if (messageLabel != null && !messageLabel.isDisposed()) {
messageLabel.setBackground(backgroundColor);
messageLabel.setForeground(foregroundColor);
}
}
}

View File

@@ -1,96 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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.composites;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
/**
* DOC ggu class global comment. Detailled comment
*/
public class MessagesWithActionComposite extends MessagesComposite {
private Button actionBtn;
public MessagesWithActionComposite(Composite parent, int style) {
super(parent, style);
actionBtn = new Button(this, SWT.PUSH);
actionBtn.setLayoutData(new GridData());
// default
// updateActionButton(null, ImageProvider.getImage(EImage.THREE_DOTS_ICON));
// use text always
updateActionButton("...", null); //$NON-NLS-1$
}
@Override
public void updateTopMessages(String messages, int status) {
super.updateTopMessages(messages, status);
if (actionBtn != null && !actionBtn.isDisposed()) {
actionBtn.setBackground(backgroundColor);
}
setActionButtonVisible(!hidden);
}
public void setActionButtonVisible(boolean show) {
if (actionBtn != null && !actionBtn.isDisposed()) {
actionBtn.setVisible(show);
GridData layoutData = (GridData) actionBtn.getLayoutData();
if (layoutData == null) {
layoutData = new GridData();
}
layoutData.exclude = !show;
actionBtn.setLayoutData(layoutData);
actionBtn.getParent().layout();
// if (show) {
// FormData btnData = new FormData();
// btnData.right = new FormAttachment(100, -H_SPACE_WIDTH);
// btnData.top = new FormAttachment(0, V_SPACE_WIDTH);
// actionBtn.setLayoutData(btnData);
// }
}
}
public void updateActionButton(String title, Image image) {
if (actionBtn != null && !actionBtn.isDisposed()) {
if (title != null) {
actionBtn.setText(title);
} else {
actionBtn.setText(BLANK);
}
/*
* Don't set the image, there is a different effect between win and linux.
*
* in win, if set a non-null image first. then try to set a null image, there is a unknown image to be set
* still. more strange.
*/
// actionBtn.setImage(image);
}
}
public void addActionListener(SelectionListener listener) {
if (actionBtn != null && !actionBtn.isDisposed()) {
actionBtn.addSelectionListener(listener);
}
}
public void removeActionListener(SelectionListener listener) {
if (actionBtn != null && !actionBtn.isDisposed()) {
actionBtn.removeSelectionListener(listener);
}
}
}

View File

@@ -1,195 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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.dialogs;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IProgressMonitorWithBlocking;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.ProgressMonitorWrapper;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.widgets.Display;
import org.talend.commons.exception.ExceptionHandler;
/**
* Used to run an event loop whenever progress monitor methods are invoked.
* <p>
* This is needed since editor save operations are done in the UI thread. Although save operations should be written to
* do the work in the non-UI thread, this was not done for 1.0, so this was added to keep the UI live (including
* allowing the cancel button to work).
*/
public class EventLoopProgressMonitor extends ProgressMonitorWrapper implements IProgressMonitorWithBlocking {
/**
* Threshold for how often the event loop is spun, in ms.
*/
private static int T_THRESH = 100;
/**
* Maximum amount of time to spend processing events, in ms.
*/
private static int T_MAX = 50;
/**
* Last time the event loop was spun.
*/
private long lastTime = System.currentTimeMillis();
/**
* The task name is the name of the current task in the event loop.
*/
private String taskName;
/**
* Constructs a new instance of the receiver and forwards to monitor.
*
* @param monitor
*/
public EventLoopProgressMonitor(IProgressMonitor monitor) {
super(monitor);
}
/**
* @see IProgressMonitor#beginTask
*/
public void beginTask(String name, int totalWork) {
super.beginTask(name, totalWork);
taskName = name;
runEventLoop();
}
/*
* (non-Javadoc)
*
* @see org.eclipse.core.runtime.IProgressMonitorWithBlocking#clearBlocked()
*/
public void clearBlocked() {
Dialog.getBlockedHandler().clearBlocked();
}
/**
* @see IProgressMonitor#done
*/
public void done() {
super.done();
taskName = null;
runEventLoop();
}
/**
* @see IProgressMonitor#internalWorked
*/
public void internalWorked(double work) {
super.internalWorked(work);
runEventLoop();
}
/**
* @see IProgressMonitor#isCanceled
*/
public boolean isCanceled() {
runEventLoop();
return super.isCanceled();
}
/**
* Runs an event loop.
*/
private void runEventLoop() {
// Only run the event loop so often, as it is expensive on some platforms
// (namely Motif).
long t = System.currentTimeMillis();
if (t - lastTime < T_THRESH) {
return;
}
lastTime = t;
// Run the event loop.
Display disp = Display.getDefault();
if (disp == null) {
return;
}
for (;;) {
try {
if (!disp.readAndDispatch()) {
break;
}
} catch (Throwable e) {// Handle the exception the same way as the workbench
ExceptionHandler.process(e);
break;
}
// Only run the event loop for so long.
// Otherwise, this would never return if some other thread was
// constantly generating events.
if (System.currentTimeMillis() - t > T_MAX) {
break;
}
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.core.runtime.IProgressMonitorWithBlocking#setBlocked(org.eclipse.core.runtime.IStatus)
*/
public void setBlocked(IStatus reason) {
Dialog.getBlockedHandler().showBlocked(this, reason, taskName);
}
/**
* @see IProgressMonitor#setCanceled
*/
public void setCanceled(boolean b) {
super.setCanceled(b);
taskName = null;
runEventLoop();
}
/**
* @see IProgressMonitor#setTaskName
*/
public void setTaskName(String name) {
super.setTaskName(name);
taskName = name;
runEventLoop();
}
/**
* @see IProgressMonitor#subTask
*/
public void subTask(String name) {
// Be prepared in case the first task was null
if (taskName == null) {
taskName = name;
}
super.subTask(name);
runEventLoop();
}
/**
* @see IProgressMonitor#worked
*/
public void worked(int work) {
super.worked(work);
runEventLoop();
}
/**
* Return the name of the current task.
*
* @return Returns the taskName.
*/
protected String getTaskName() {
return taskName;
}
}

View File

@@ -1,86 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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.tableviewer.celleditor;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.viewers.ComboBoxCellEditor;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
/**
* created by ggu on Jul 28, 2014 Detailled comment
*
*/
public class EditableComboBoxCellEditor extends ComboBoxCellEditor {
private CCombo comboList;
public EditableComboBoxCellEditor(Composite parent, String[] items) {
super(parent, items);
}
@Override
protected Control createControl(Composite parent) {
Control control = super.createControl(parent);
if (control instanceof CCombo) {
comboList = ((CCombo) control);
comboList.setEditable(true);
}
return control;
}
@Override
protected Object doGetValue() {
Object curValue = super.doGetValue();
if (curValue instanceof Integer) {
Integer index = (Integer) curValue;
if (index == -1) { // new value, so -1
curValue = comboList.getText();
} else { // in the list, try to find out.
String[] items = this.getItems();
if (items.length > index) {
curValue = items[index];
}
}
}
return curValue;
}
@Override
protected void doSetValue(Object newvalue) {
// only deal with the String value.
Assert.isTrue(comboList != null && (newvalue instanceof String));
String value = newvalue.toString();
int index = findValueIndex(getItems(), value);
super.doSetValue(index); // make sure update the selection, even -1
if (index < 0) { // not found
comboList.setText(value);
}
}
private int findValueIndex(String[] items, String fValue) {
for (int i = 0; i < items.length; i++) {
if (items[i].equals(fValue)) {
return i;
}
}
return -1;
}
@Override
public void dispose() {
super.dispose();
comboList = null;
}
}

View File

@@ -1,78 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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.utils.workbench.preferences;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.apache.commons.lang.ArrayUtils;
import org.eclipse.jface.preference.IPreferenceNode;
import org.eclipse.jface.preference.PreferenceManager;
import org.eclipse.ui.PlatformUI;
/**
* created by ggu on Sep 25, 2014 Detailled comment
*
*/
public class PreferencesHelper {
public static boolean removePage(String prefId) {
return removePages(new String[] { prefId });
}
/**
*
* Use the BFS(Breadth First Search) to remove the preferences ids.
*/
public static boolean removePages(String[] prefIds) {
if (prefIds == null || prefIds.length == 0) {
return false;
}
PreferenceManager preferenceManager = PlatformUI.getWorkbench().getPreferenceManager();
List<String> removedIds = new ArrayList<String>();
IPreferenceNode[] rootSubNodes = preferenceManager.getRootSubNodes();
for (IPreferenceNode node : rootSubNodes) {
String id = node.getId();
if (ArrayUtils.contains(prefIds, id)) {
preferenceManager.remove(node);
removedIds.add(id);
}
}
// do for children
for (IPreferenceNode node : rootSubNodes) {
removePages(node, prefIds, removedIds);
}
//
List<String> doList = new ArrayList<String>(Arrays.asList(prefIds));
doList.removeAll(removedIds);
return doList.isEmpty(); // have done for all, so empty.
}
private static void removePages(IPreferenceNode parentNode, String[] prefIds, List<String> removedIds) {
for (IPreferenceNode node : parentNode.getSubNodes()) {
String id = node.getId();
if (ArrayUtils.contains(prefIds, id)) {
parentNode.remove(node);
removedIds.add(id);
}
}
// do for children
for (IPreferenceNode node : parentNode.getSubNodes()) {
removePages(node, prefIds, removedIds);
}
}
}

View File

@@ -1,10 +0,0 @@
source.. = src/main/java/
output.. = bin/
source.dist/org.talend.core.repository.jar = src/main/java/
output.dist/org.talend.core.repository.jar = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
dist/
jars.compile.order = .,\
dist/org.talend.core.repository.jar

View File

@@ -1,102 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.talend.core.repository" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
<meta.schema plugin="org.talend.core.repository" id="repository_context" name="repository_context"/>
</appinfo>
<documentation>
[Enter description of this extension point.]
</documentation>
</annotation>
<element name="extension">
<annotation>
<appinfo>
<meta.element />
</appinfo>
</annotation>
<complexType>
<sequence>
<element ref="RepositoryContext" minOccurs="1" maxOccurs="unbounded"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="RepositoryContext">
<complexType>
<attribute name="class" type="string" use="required">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute kind="java" basedOn=":org.talend.repository.ui.utils.IRepositoryContextHandler"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appinfo>
<meta.section type="since"/>
</appinfo>
<documentation>
[Enter the first release in which this extension point appears.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="examples"/>
</appinfo>
<documentation>
[Enter extension point usage example here.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="apiinfo"/>
</appinfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="implementation"/>
</appinfo>
<documentation>
[Enter information about supplied implementation of this extension point.]
</documentation>
</annotation>
</schema>

View File

@@ -1,212 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.core.repository.model;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.apache.commons.collections.map.MultiKeyMap;
import org.eclipse.emf.common.util.EList;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.exception.PersistenceException;
import org.talend.core.model.general.Project;
import org.talend.core.model.process.IElementParameter;
import org.talend.core.model.process.INode;
import org.talend.core.model.process.IProcess2;
import org.talend.core.model.properties.Item;
import org.talend.core.model.properties.ProcessItem;
import org.talend.core.model.properties.Property;
import org.talend.core.model.relationship.Relation;
import org.talend.core.model.relationship.RelationshipItemBuilder;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.model.repository.IRepositoryViewObject;
import org.talend.core.repository.ICheckDeleteItemReference;
import org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType;
import org.talend.designer.core.model.utils.emf.talendfile.NodeType;
import org.talend.repository.ProjectManager;
import org.talend.repository.model.ERepositoryStatus;
import org.talend.repository.model.IProxyRepositoryFactory;
import org.talend.repository.model.ItemReferenceBean;
import org.talend.repository.ui.actions.DeleteActionCache;
/**
*
* DOC hcyi class global comment. Detailled comment
*/
public class CheckJobDeleteReference extends AbstractCheckDeleteItemReference implements ICheckDeleteItemReference {
private static final String PROCESS_TYPE_PROCESS = "PROCESS_TYPE_PROCESS"; //$NON-NLS-1$
private static final String USE_DYNAMIC_JOB = "USE_DYNAMIC_JOB"; //$NON-NLS-1$
// almost move from the method checkRepositoryNodeFromProcess of DeleteAction class.
@Override
public Set<ItemReferenceBean> checkItemReferenceBeans(IProxyRepositoryFactory factory, DeleteActionCache deleteActionCache,
IRepositoryViewObject object) {
Item nodeItem = object.getProperty().getItem();
boolean needCheckJobIfUsedInProcess = false;
if (nodeItem instanceof ProcessItem) {
needCheckJobIfUsedInProcess = true;
}
Set<ItemReferenceBean> list = new HashSet<ItemReferenceBean>();
if (needCheckJobIfUsedInProcess) {
Property property = object.getProperty();
if (property != null) {
String label = property.getLabel();
String version = property.getVersion();
ERepositoryObjectType type = object.getRepositoryObjectType();
boolean isItemDeleted = factory.getStatus(object) == ERepositoryStatus.DELETED;
Item item = property.getItem();
if (!(item instanceof ProcessItem)) {
return list;
}
List<Relation> relations = RelationshipItemBuilder.getInstance().getItemsHaveRelationWith(property.getId());
if (relations.isEmpty()) {
return list;
}
Set<Project> refParentProjects = new HashSet<Project>();
try {
refParentProjects.add(ProjectManager.getInstance().getCurrentProject());
refParentProjects.addAll(ProjectManager.getInstance().getReferencedProjects());
for (Project refP : refParentProjects) {
List<IRepositoryViewObject> processes = factory.getAll(refP, ERepositoryObjectType.PROCESS, true);
deleteActionCache.setProcessList(processes);
for (IRepositoryViewObject process : deleteActionCache.getProcessList()) {
Property property2 = process.getProperty();
if (isOpenedItem(property2, deleteActionCache.getOpenProcessMap())) {
// will be checked in the opened item list.
continue;
}
Relation current = new Relation();
current.setId(property2.getId());
current.setType(RelationshipItemBuilder.JOB_RELATION);
current.setVersion(property2.getVersion());
if (!relations.contains(current)) {
continue;
}
boolean isDelete = factory.getStatus(process) == ERepositoryStatus.DELETED;
Item item2 = property2.getItem();
if (item == item2) {
continue;
}
String path = item2.getState().getPath();
boolean found = false;
ItemReferenceBean bean = new ItemReferenceBean();
bean.setItemName(label);
bean.setItemVersion(version);
bean.setItemType(type);
bean.setItemDeleted(isItemDeleted);
bean.setReferenceItemName(property2.getLabel());
bean.setReferenceItemVersion(property2.getVersion());
bean.setReferenceItemType(process.getRepositoryObjectType());
bean.setReferenceItemPath(path);
bean.setReferenceProjectName(refP.getLabel());
bean.setReferenceItemDeleted(isDelete);
for (ItemReferenceBean b : list) {
if (b.equals(bean)) {
found = true;
b.addNodeNum();
break;
}
}
if (!found) {
list.add(bean);
}
}
}
for (IProcess2 openedProcess : deleteActionCache.getOpenedProcessList()) {
for (INode node : openedProcess.getGraphicalNodes()) {
boolean equals = false;
IElementParameter processTypeParam = node.getElementParameter(PROCESS_TYPE_PROCESS);
if (processTypeParam != null) {
IElementParameter isUseDynamicJob = node.getElementParameter(USE_DYNAMIC_JOB); //$NON-NLS-1$
if (isUseDynamicJob != null && (Boolean) isUseDynamicJob.getValue()) {
String[] jobsID = ((String) processTypeParam.getValue()).split(";"); //$NON-NLS-1$
for (String jobID : jobsID) {
if (property.getId().equals(jobID)) {
equals = true;
break;
}
}
} else if (property.getId().equals(processTypeParam.getValue())) {
equals = true;
}
}
boolean isDelete = factory.getStatus(openedProcess) == ERepositoryStatus.DELETED;
Property property2 = openedProcess.getProperty();
Item item2 = property2.getItem();
String path = item2.getState().getPath();
if (equals) {
boolean found = false;
ItemReferenceBean bean = new ItemReferenceBean();
bean.setItemName(label);
bean.setItemVersion(version);
bean.setItemType(type);
bean.setItemDeleted(isItemDeleted);
bean.setReferenceItemName(property2.getLabel());
bean.setReferenceItemVersion(property2.getVersion());
bean.setReferenceItemType(ERepositoryObjectType.getItemType(item2));
bean.setReferenceItemPath(path);
bean.setReferenceProjectName(ProjectManager.getInstance().getProject(property2).getLabel());
bean.setReferenceItemDeleted(isDelete);
for (ItemReferenceBean b : list) {
if (b.equals(bean)) {
found = true;
b.addNodeNum();
break;
}
}
if (!found) {
list.add(bean);
}
}
}
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
}
}
/*
* If the reference job or joblet is in the recycle bin but the joblet is not then no need to check; If both the
* joblet and the reference job or joblet are all in the recycle bin and they are all in the delete list then no
* need to check them; If both the joblet and the reference job or joblet are all not in the recycle bin and
* they are all in the delete list then no need to check them too.
*/
Iterator<ItemReferenceBean> it = list.iterator();
while (it.hasNext()) {
ItemReferenceBean bean = it.next();
if ((!bean.isItemDeleted() && bean.isReferenceItemDeleted())
|| (bean.isItemDeleted() && bean.isReferenceItemDeleted() && isItemInDeleteList(bean, true))
|| (!bean.isItemDeleted() && !bean.isReferenceItemDeleted() && isItemInDeleteList(bean, true))) {
it.remove();
}
}
return list;
}
private boolean isOpenedItem(Property property, MultiKeyMap openProcessMap) {
if (property == null) {
return false;
}
return (openProcessMap.get(property.getId(), property.getLabel(), property.getVersion()) != null);
}
}

View File

@@ -1,106 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2015 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.core.repository.model.dnd;
import java.util.Iterator;
import java.util.List;
import org.talend.core.model.components.IComponent;
import org.talend.core.model.properties.Item;
import org.talend.core.model.properties.SalesforceSchemaConnectionItem;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.repository.DefaultRepositoryComponentDndFilter;
import org.talend.repository.model.RepositoryNode;
/**
* created by cmeng on Apr 21, 2015 Detailled comment
*
*/
public class SalesforceComponentDndFilter extends DefaultRepositoryComponentDndFilter {
public static final String COMPONENT_T_SALSEFORCE_CONNECTION = "tSalesforceConnection"; //$NON-NLS-1$
public static final String COMPONENT_T_SALSEFORCE_WAVE_BULK_EXEC = "tSalesforceWaveBulkExec"; //$NON-NLS-1$
public static final String COMPONENT_T_SALSEFORCE_WAVE_OUTPUT_BULK_EXEC = "tSalesforceWaveOutputBulkExec"; //$NON-NLS-1$
public static final String COMPONENT_T_SALSEFORCE_INPUT = "tSalesforceInput"; //$NON-NLS-1$
public static final String COMPONENT_T_SALSEFORCE_OUTPUT = "tSalesforceOutput"; //$NON-NLS-1$
@Override
public boolean except(Item item, ERepositoryObjectType type, RepositoryNode seletetedNode, IComponent component,
String repositoryType) {
if (!(item instanceof SalesforceSchemaConnectionItem)) {
return false;
}
if (ERepositoryObjectType.METADATA_SALESFORCE_SCHEMA == type) {
String componentName = component.getName();
if (COMPONENT_T_SALSEFORCE_INPUT.equals(componentName) || COMPONENT_T_SALSEFORCE_OUTPUT.equals(componentName)) {
return true;
}
} else if (ERepositoryObjectType.METADATA_SALESFORCE_MODULE == type || ERepositoryObjectType.METADATA_CON_TABLE == type
|| ERepositoryObjectType.METADATA_CON_COLUMN == type) {
String componentName = component.getName();
if (COMPONENT_T_SALSEFORCE_CONNECTION.equals(componentName)
|| COMPONENT_T_SALSEFORCE_WAVE_BULK_EXEC.equals(componentName)
|| COMPONENT_T_SALSEFORCE_WAVE_OUTPUT_BULK_EXEC.equals(componentName)) {
return true;
}
}
return false;
}
@Override
public boolean valid(Item item, ERepositoryObjectType type, RepositoryNode seletetedNode, IComponent component,
String repositoryType) {
if (!(item instanceof SalesforceSchemaConnectionItem)) {
return false;
}
if (ERepositoryObjectType.METADATA_SALESFORCE_SCHEMA == type) {
String componentName = component.getName();
if (COMPONENT_T_SALSEFORCE_CONNECTION.equals(componentName)
|| COMPONENT_T_SALSEFORCE_WAVE_BULK_EXEC.equals(componentName)
|| COMPONENT_T_SALSEFORCE_WAVE_OUTPUT_BULK_EXEC.equals(componentName)) {
return true;
}
} else if (ERepositoryObjectType.METADATA_SALESFORCE_MODULE == type || ERepositoryObjectType.METADATA_CON_TABLE == type
|| ERepositoryObjectType.METADATA_CON_COLUMN == type) {
String componentName = component.getName();
if (COMPONENT_T_SALSEFORCE_INPUT.equals(componentName) || COMPONENT_T_SALSEFORCE_OUTPUT.equals(componentName)) {
return true;
}
}
return false;
}
@Override
public List<IComponent> sort(List<IComponent> components, Item item, ERepositoryObjectType type, RepositoryNode seletetedNode) {
if (item instanceof SalesforceSchemaConnectionItem) {
if (ERepositoryObjectType.METADATA_SALESFORCE_SCHEMA == type && components != null) {
Iterator<IComponent> iter = components.iterator();
while (iter.hasNext()) {
IComponent component = iter.next();
if (COMPONENT_T_SALSEFORCE_CONNECTION.equals(component.getName())) {
iter.remove();
components.add(0, component);
return components;
}
}
}
}
return components;
}
}

View File

@@ -1,149 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.repository.editor;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang.ArrayUtils;
import org.eclipse.core.runtime.Platform;
import org.eclipse.ui.IStartup;
import org.talend.commons.CommonsPlugin;
import org.talend.commons.exception.CommonExceptionHandler;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.exception.PersistenceException;
import org.talend.commons.utils.system.EclipseCommandLine;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.model.repository.IRepositoryViewObject;
import org.talend.core.runtime.CoreRuntimePlugin;
import org.talend.repository.model.IProxyRepositoryFactory;
/**
* created by ggu on Sep 15, 2014 Detailled comment
*
*/
public abstract class AbstractShowJobStartup implements IStartup {
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IStartup#earlyStartup()
*/
@Override
public void earlyStartup() {
// only work for studio.
if (CommonsPlugin.isHeadless()) {
return;
}
String[] showJobNames = getShowJobNames();
if (showJobNames != null && showJobNames.length > 0) { // existed
ERepositoryObjectType[] showJobTypes = getShowJobTypes();
if (showJobTypes != null) {
IProxyRepositoryFactory proxyRepositoryFactory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
for (ERepositoryObjectType type : showJobTypes) {
if (!enableForType(type)) {
continue;
}
try {
List<IRepositoryViewObject> all = proxyRepositoryFactory.getAll(type);
for (IRepositoryViewObject viewObject : all) {
if (validJob(viewObject, showJobNames)) {
processJob(viewObject);
}
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
}
}
}
}
protected String[] getShowJobNames() {
if (ArrayUtils.contains(Platform.getApplicationArgs(), EclipseCommandLine.TALEND_SHOW_JOB_COMMAND)) {
String jobsStr = getAppArgValue(EclipseCommandLine.TALEND_SHOW_JOB_COMMAND, ""); //$NON-NLS-1$
if (jobsStr != null && jobsStr.length() > 0) { // existed
String[] jobNames = getArgSplitValues(jobsStr);
return jobNames;
}
}
return new String[0];
}
protected ERepositoryObjectType[] getShowJobTypes() {
List<ERepositoryObjectType> typesList = new ArrayList<ERepositoryObjectType>();
// if not set the --showJobType <type>, the type will be PROCESS by default.
String jobTypesStr = getAppArgValue(EclipseCommandLine.TALEND_SHOW_JOB_TYPE_COMMAND,
ERepositoryObjectType.PROCESS.getType());
if (jobTypesStr != null && jobTypesStr.length() > 0) { // existed
String[] jobTypes = getArgSplitValues(jobTypesStr);
for (String type : jobTypes) {
ERepositoryObjectType repoType = ERepositoryObjectType.valueOf(type);
if (repoType != null) {
typesList.add(repoType);
} else {
CommonExceptionHandler.warn("It's not valid type: " + type); //$NON-NLS-1$
}
}
}
return typesList.toArray(new ERepositoryObjectType[0]);
}
private String getAppArgValue(String arg, String defaultValue) {
String value = defaultValue;
int index = ArrayUtils.indexOf(Platform.getApplicationArgs(), arg);
if (index > -1) { // found
if (index + 1 < Platform.getApplicationArgs().length) {
value = Platform.getApplicationArgs()[index + 1];
}
}
return value;
}
private String[] getArgSplitValues(String value) {
return value.split("[,;]"); //$NON-NLS-1$
}
/**
* Enable to filter the type for each implmentation
*/
protected boolean enableForType(ERepositoryObjectType type) {
return true; // by default, enable for all
}
/**
* Enable to check the case sensitive for name.
*
*/
protected boolean validJob(IRepositoryViewObject viewObject, String[] showJobNames) {
if (viewObject != null) {
String label = viewObject.getLabel();
for (String name : showJobNames) {
if (label.equals(name) || !isCaseSensitiveForName() && label.equalsIgnoreCase(name)) {
return true;
}
}
}
return false;
}
protected boolean isCaseSensitiveForName() {
return true;
}
/**
*
* will process the object as you want.
*/
protected abstract void processJob(IRepositoryViewObject viewObject);
}

View File

@@ -1,46 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.repository.ui.views;
import org.eclipse.core.resources.IWorkspaceRunnable;
/**
* DOC hqzhang class global comment. Detailled comment
*/
public abstract class RunnableWithReturnValue implements IWorkspaceRunnable {
public RunnableWithReturnValue(String taskName) {
this.taskName = taskName;
}
private String taskName;
private Object returnValue;
public Object getReturnValue() {
return this.returnValue;
}
protected void setReturnValue(Object returnValue) {
this.returnValue = returnValue;
}
protected String getTaskName() {
return this.taskName;
}
protected void setTaskName(String taskName) {
this.taskName = taskName;
}
}

View File

@@ -1,10 +0,0 @@
package org.talend.repository.utils;
import org.talend.core.PluginChecker;
public class Log4jUtil {
public static boolean isEnable() {
return PluginChecker.isTIS();
}
}

View File

@@ -1,120 +0,0 @@
<?xml version="1.0"?>
<mapping>
<dbms product="IMPALA" id="impala_id" label="Mapping Impala" default="true">
<dbTypes>
<dbType type="SMALLINT" ignoreLen="true" ignorePre="true"/>
<dbType type="FLOAT" ignoreLen="true" ignorePre="true"/>
<dbType type="DOUBLE" ignoreLen="true" ignorePre="true"/>
<dbType type="BIGINT" ignoreLen="true" ignorePre="true"/>
<dbType type="INT" ignoreLen="true" ignorePre="true"/>
<dbType type="TINYINT" ignoreLen="true" ignorePre="true"/>
<dbType type="STRING" ignoreLen="true" ignorePre="true"/>
<dbType type="BOOLEAN" ignoreLen="true" ignorePre="true"/>
<dbType type="STRUCT" ignoreLen="true" ignorePre="true"/>
<dbType type="MAP" ignoreLen="true" ignorePre="true"/>
<dbType type="ARRAY" ignoreLen="true" ignorePre="true"/>
<dbType type="TIMESTAMP" ignoreLen="true" ignorePre="true"/>
</dbTypes>
<language name="java">
<talendToDbTypes><!-- Adviced mappings -->
<talendType type="id_List"/>
<talendType type="id_Boolean">
<dbType type="BOOLEAN"/>
</talendType>
<talendType type="id_Byte">
<dbType type="TINYINT" default="true"/>
<dbType type="BIGINT"/>
<dbType type="INT"/>
<dbType type="SMALLINT"/>
</talendType>
<talendType type="id_byte[]"/>
<talendType type="id_Character">
<dbType type="STRING"/>
</talendType>
<talendType type="id_Date">
<dbType type="TIMESTAMP" default="true"/>
</talendType>
<talendType type="id_BigDecimal">
<dbType type="BIGINT" default="true"/>
<dbType type="FLOAT"/>
<dbType type="DOUBLE"/>
</talendType>
<talendType type="id_Double">
<dbType type="DOUBLE" default="true" />
<dbType type="FLOAT"/>
</talendType>
<talendType type="id_Float">
<dbType type="FLOAT" default="true" />
<dbType type="DOUBLE"/>
</talendType>
<talendType type="id_Integer">
<dbType type="INT" default="true" />
<dbType type="BIGINT" />
</talendType>
<talendType type="id_Long">
<dbType type="BIGINT" default="true" />
</talendType>
<talendType type="id_Object">
<dbType type="STRUCT" default="true" />
<dbType type="MAP" />
<dbType type="ARRAY" />
</talendType>
<talendType type="id_Short">
<dbType type="SMALLINT" default="true" />
<dbType type="INT" />
</talendType>
<talendType type="id_String">
<dbType type="STRING"/>
</talendType>
</talendToDbTypes>
<dbToTalendTypes><!-- Adviced mappings -->
<dbType type="STRING">
<talendType type="id_String" default="true"/>
</dbType>
<dbType type="BOOLEAN">
<talendType type="id_Boolean" default="true"/>
</dbType>
<dbType type="DOUBLE">
<talendType type="id_Double" default="true"/>
<talendType type="id_BigDecimal"/>
<talendType type="id_Float"/>
</dbType>
<dbType type="BIGINT">
<talendType type="id_BigDecimal" default="true"/>
<talendType type="id_Byte"/>
<talendType type="id_Integer"/>
<talendType type="id_Long"/>
</dbType>
<dbType type="INT">
<talendType type="id_Integer" default="true"/>
<talendType type="id_Short"/>
</dbType>
<dbType type="SMALLINT">
<talendType type="id_Short" default="true"/>
<talendType type="id_Byte"/>
</dbType>
<dbType type="TINYINT">
<talendType type="id_Byte" default="true"/>
</dbType>
<dbType type="FLOAT">
<talendType type="id_Float" default="true"/>
<talendType type="id_Double"/>
<talendType type="id_BigDecimal"/>
</dbType>
<dbType type="STRUCT">
<talendType type="id_Object" default="true"/>
</dbType>
<dbType type="MAP">
<talendType type="id_Object" default="true"/>
</dbType>
<dbType type="ARRAY">
<talendType type="id_Object" default="true"/>
</dbType>
<dbType type="TIMESTAMP">
<talendType type="id_Date" default="true"/>
</dbType>
</dbToTalendTypes>
</language>
</dbms>
</mapping>

View File

@@ -1,87 +0,0 @@
<?xml version="1.0"?>
<!-- Similar as db system, but this mapping file is use for SAP -->
<mapping>
<dbms product="SAP" id="sap_id" label="Mapping SAP" default="true">
<dbTypes>
<dbType type="BIG_DECIMAL" ignorePre="true" />
<dbType type="BIG_INTEGER" ignorePre="true" />
<dbType type="BYTE" defaultLength="1" ignorePre="true" />
<dbType type="DATE" ignorePre="true" />
<dbType type="DOUBLE" ignorePre="true" ignoreLen="true"/>
<dbType type="INTEGER" ignorePre="true" ignoreLen="true"/>
<dbType type="RAW" ignorePre="true" />
<dbType type="SHORT" ignorePre="true" ignoreLen="true"/>
<dbType type="STRING" ignorePre="true" />
<dbType type="TIME" ignoreLen="true" ignorePre="true" />
</dbTypes>
<language name="java">
<talendToDbTypes><!-- Adviced mappings -->
<talendType type="id_List"/>
<talendType type="id_Boolean"/>
<talendType type="id_Byte">
<dbType type="BYTE"/>
</talendType>
<talendType type="id_byte[]">
<dbType type="RAW"/>
</talendType>
<talendType type="id_Character"/>
<talendType type="id_Date">
<dbType type="DATE" default="true"/>
<dbType type="TIME"/>
</talendType>
<talendType type="id_BigDecimal">
<dbType type="BIG_DECIMAL"/>
</talendType>
<talendType type="id_Double">
<dbType type="DOUBLE"/>
</talendType>
<talendType type="id_Float"/>
<talendType type="id_Integer">
<dbType type="INTEGER"/>
</talendType>
<talendType type="id_Long"/>
<talendType type="id_Object">
<dbType type="BIG_INTEGER"/>
</talendType>
<talendType type="id_Short">
<dbType type="SHORT"/>
</talendType>
<talendType type="id_String">
<dbType type="STRING"/>
</talendType>
</talendToDbTypes>
<dbToTalendTypes>
<dbType type="BIG_DECIMAL" >
<talendType type="id_BigDecimal" default="true" />
</dbType>
<dbType type="BIG_INTEGER" >
<talendType type="id_Object" default="true"/>
</dbType>
<dbType type="BYTE">
<talendType type="id_Byte" default="true" />
</dbType>
<dbType type="DATE">
<talendType type="id_Date" default="true" />
</dbType>
<dbType type="DOUBLE">
<talendType type="id_Double" default="true"/>
</dbType>
<dbType type="INTEGER">
<talendType type="id_Integer" default="true" />
</dbType>
<dbType type="RAW">
<talendType type="id_byte[]" default="true" />
</dbType>
<dbType type="SHORT">
<talendType type="id_Short" default="true" />
</dbType>
<dbType type="STRING">
<talendType type="id_String" default="true" />
</dbType>
<dbType type="TIME">
<talendType type="id_Date" default="true" />
</dbType>
</dbToTalendTypes>
</language>
</dbms>
</mapping>

View File

@@ -1,163 +0,0 @@
{"HADOOP": {
"HORTONWORKS": {
"NAMENODE_URI": "hdfs://localhost:8020",
"JOBTRACKER": "localhost:50300",
"RESOURCE_MANAGER": "localhost:8050",
"NAMENODE_PRINCIPAL": "nn/_HOST@EXAMPLE.COM",
"JOBTRACKER_PRINCIPAL" : "mapred/_HOST@EXAMPLE.COM",
"RESOURCE_MANAGER_PRINCIPAL" : "yarn/_HOST@EXAMPLE.COM",
"JOBHISTORY_PRINCIPAL" : "mapred/_HOST@EXAMPLE.COM",
"HIVE": {
"EMBEDDED": {
"PORT": 9083
},
"STANDALONE": {
"PORT": 10000
},
"DATABASE": "default",
"HIVE_PRINCIPAL": "hive/_HOST@EXAMPLE.COM"
},
"HBASE": {
"PORT": 2181
}
},
"CLOUDERA": {
"NAMENODE_URI": "hdfs://localhost:8020",
"JOBTRACKER": "localhost:8021",
"RESOURCE_MANAGER": "localhost:8032",
"NAMENODE_PRINCIPAL": "hdfs/_HOST@EXAMPLE.COM",
"JOBTRACKER_PRINCIPAL" : "mapred/_HOST@EXAMPLE.COM",
"RESOURCE_MANAGER_PRINCIPAL" : "yarn/_HOST@EXAMPLE.COM",
"JOBHISTORY_PRINCIPAL" : "mapred/_HOST@EXAMPLE.COM",
"HIVE": {
"EMBEDDED": {
"PORT": 9083
},
"STANDALONE": {
"PORT": 10000
},
"DATABASE": "default",
"HIVE_PRINCIPAL": "hive/_HOST@EXAMPLE.COM"
},
"HBASE": {
"PORT": 2181
}
},
"MAPR": {
"NAMENODE_URI": "maprfs:///localhost:7222",
"JOBTRACKER": "localhost:9001",
"RESOURCE_MANAGER": "localhost:8032",
"HIVE": {
"EMBEDDED": {
"PORT": 9083
},
"STANDALONE": {
"PORT": 10000
},
"DATABASE": "default",
"HIVE_PRINCIPAL": "hive/_HOST@EXAMPLE.COM"
},
"HBASE": {
"PORT": 5181
}
},
"APACHE": {
"NAMENODE_URI": "hdfs://localhost:9000",
"JOBTRACKER": "localhost:9001",
"NAMENODE_PRINCIPAL": "nn/_HOST@EXAMPLE.COM",
"JOBTRACKER_PRINCIPAL" : "mapred/_HOST@EXAMPLE.COM",
"RESOURCE_MANAGER_PRINCIPAL" : "yarn/_HOST@EXAMPLE.COM",
"HIVE": {
"EMBEDDED": {
"PORT": 9083
},
"STANDALONE": {
"PORT": 10000
},
"DATABASE": "default",
"HIVE_PRINCIPAL": "hive/_HOST@EXAMPLE.COM"
},
"HBASE": {
"PORT": 2181
}
},
"AMAZON_EMR": {
"APACHE_2_4_0_EMR": {
"NAMENODE_URI": "hdfs://localhost:9000",
"RESOURCE_MANAGER": "localhost:9022",
"HBASE": {
"PORT": 2181
}
},
"APACHE_1_0_3_EMR": {
"NAMENODE_URI": "hdfs://localhost:9000",
"JOBTRACKER": "localhost:9001",
"HBASE": {
"PORT": 2181
}
},
"MapR_EMR": {
"NAMENODE_URI": "maprfs:///localhost:7222",
"JOBTRACKER": "localhost:9001",
"HBASE": {
"PORT": 5181
}
},
"NAMENODE_PRINCIPAL": "nn/_HOST@EXAMPLE.COM",
"JOBTRACKER_PRINCIPAL" : "mapred/_HOST@EXAMPLE.COM",
"RESOURCE_MANAGER_PRINCIPAL" : "yarn/_HOST@EXAMPLE.COM",
"HIVE": {
"EMBEDDED": {
"PORT": 9083
},
"STANDALONE": {
"PORT": 10004
},
"DATABASE": "default",
"HIVE_PRINCIPAL": "hive/_HOST@EXAMPLE.COM"
}
},
"PIVOTAL_HD": {
"NAMENODE_URI": "hdfs://localhost:8020",
"JOBTRACKER": "localhost:8032",
"RESOURCE_MANAGER": "localhost:8032",
"NAMENODE_PRINCIPAL": "nn/_HOST@EXAMPLE.COM",
"JOBTRACKER_PRINCIPAL" : "mapred/_HOST@EXAMPLE.COM",
"RESOURCE_MANAGER_PRINCIPAL" : "yarn/_HOST@EXAMPLE.COM",
"JOBHISTORY_PRINCIPAL" : "mapred/_HOST@EXAMPLE.COM",
"HIVE": {
"EMBEDDED": {
"PORT": 9083
},
"STANDALONE": {
"PORT": 10000
},
"DATABASE": "default",
"HIVE_PRINCIPAL": "hive/_HOST@EXAMPLE.COM"
},
"HBASE": {
"PORT": 2181
}
},
"CUSTOM": {
"NAMENODE_URI": "hdfs://localhost:8020",
"JOBTRACKER": "localhost:50300",
"RESOURCE_MANAGER": "localhost:8050",
"NAMENODE_PRINCIPAL": "nn/_HOST@EXAMPLE.COM",
"JOBTRACKER_PRINCIPAL" : "mapred/_HOST@EXAMPLE.COM",
"RESOURCE_MANAGER_PRINCIPAL" : "yarn/_HOST@EXAMPLE.COM",
"HIVE": {
"EMBEDDED": {
"PORT": 9083
},
"STANDALONE": {
"PORT": 10000
},
"DATABASE": "default",
"HIVE_PRINCIPAL": "hive/_HOST@EXAMPLE.COM"
},
"HBASE": {
"PORT": 2181
}
}
}}

View File

@@ -1,214 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.talend.core.runtime" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
<meta.schema plugin="org.talend.core.runtime" id="librariesNeeded" name="librariesNeeded"/>
</appinfo>
<documentation>
[Enter description of this extension point.]
</documentation>
</annotation>
<element name="extension">
<annotation>
<appinfo>
<meta.element />
</appinfo>
</annotation>
<complexType>
<sequence minOccurs="0" maxOccurs="unbounded">
<element ref="libraryNeeded"/>
<element ref="libraryNeededGroup"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="libraryNeeded">
<annotation>
<appinfo>
<meta.element labelAttribute="name"/>
</appinfo>
</annotation>
<complexType>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="bundleID" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="required" type="boolean">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="context" type="string" use="required">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
<attribute name="message" type="string">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
<attribute name="language" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="uripath" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="libraryNeededGroup">
<complexType>
<sequence minOccurs="0" maxOccurs="unbounded">
<element ref="library" minOccurs="0" maxOccurs="unbounded"/>
<element ref="group" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="id" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="description" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="library">
<complexType>
<attribute name="id" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="group">
<complexType>
<attribute name="id" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appinfo>
<meta.section type="since"/>
</appinfo>
<documentation>
[Enter the first release in which this extension point appears.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="examples"/>
</appinfo>
<documentation>
[Enter extension point usage example here.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="apiinfo"/>
</appinfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="implementation"/>
</appinfo>
<documentation>
[Enter information about supplied implementation of this extension point.]
</documentation>
</annotation>
</schema>

View File

@@ -1,85 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.talend.core.runtime" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
<meta.schema plugin="org.talend.core.runtime" id="migrationTaskTypeExtension" name="Migration task type extension"/>
</appinfo>
<documentation>
This extension is used to extend a set of existing migration task to other type of nodes that the ones they where created for.
These type should of course derive from the original type targeted by the Migration task.
For instance an OEM wishing to create a new type of job extends the existing JobItem using another Repository Object type ID.
In ordre for the existing migration tasks create for JobItems to apply to it&apos;s new type of job you can used this extension point.
</documentation>
</annotation>
<element name="extension">
<annotation>
<appinfo>
<meta.element />
</appinfo>
</annotation>
<complexType>
<sequence minOccurs="1" maxOccurs="unbounded">
<element ref="TypeExtension"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="TypeExtension">
<complexType>
<attribute name="extended_type" type="string" use="required">
<annotation>
<documentation>
The existing Object Repository Node type to extend.
</documentation>
</annotation>
</attribute>
<attribute name="type" type="string" use="required">
<annotation>
<documentation>
The new Object Repository Type to attach to migration task used to migrate the extended_type
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appinfo>
<meta.section type="since"/>
</appinfo>
<documentation>
5.6.
</documentation>
</annotation>
</schema>

View File

@@ -1,168 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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.classloader;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.ILibraryManagerService;
/**
* DOC ycbai class global comment. Detailled comment
*/
public class DynamicClassLoader extends URLClassLoader {
private final static String PATH_SEPARATOR = "/"; //$NON-NLS-1$
private String libStorePath;
/**
* DOC ycbai DynamicClassLoader constructor comment.
*/
public DynamicClassLoader() {
this(new URL[0]);
}
public DynamicClassLoader(URL[] urls) {
super(urls);
}
public DynamicClassLoader(ClassLoader parent) {
this(new URL[0], parent);
}
public DynamicClassLoader(URL[] urls, ClassLoader parent) {
super(urls, parent);
}
public void addLibrary(String lib) {
if (lib != null) {
File libFile = new File(lib);
try {
addURL(libFile.toURI().toURL());
} catch (MalformedURLException e) {
ExceptionHandler.process(e);
}
}
}
public void addLibraries(List<String> libs) {
if (libs != null && libs.size() > 0) {
for (String lib : libs) {
addLibrary(lib);
}
}
}
/**
* DOC ycbai Comment method "getLibraries".
*
* <p>
* Get libraries which this classloader contains.
* </p>
*
* @return
*/
public Set<String> getLibraries() {
Set<String> set = new HashSet<String>();
URL[] urLs = getURLs();
if (urLs != null) {
for (URL url : urLs) {
try {
File file = new File(url.toURI());
set.add(file.getName());
} catch (URISyntaxException e) {
// dont care...
}
}
}
return set;
}
/**
* DOC ycbai Comment method "getLibStorePath".
*
* <p>
* Get folder path which stores libraries of classloader.
* </p>
*
* @return
*/
public String getLibStorePath() {
return this.libStorePath;
}
public void setLibStorePath(String libStorePath) {
this.libStorePath = libStorePath;
}
public static DynamicClassLoader createNewOneBaseLoader(DynamicClassLoader baseLoader, String[] addedJars,
String[] excludedJars) throws MalformedURLException {
if (baseLoader == null) {
baseLoader = new DynamicClassLoader();
}
if (addedJars == null) {
addedJars = new String[0];
}
if (excludedJars == null) {
excludedJars = new String[0];
}
URL[] baseURLs = baseLoader.getURLs();
String libPath = baseLoader.getLibStorePath();
if (libPath == null) {
libPath = ClassLoaderFactory.getLibPath();
}
List<URL> urlList = new ArrayList<URL>(Arrays.asList(baseURLs));
updateLoaderURLs(urlList, libPath, addedJars, true);
updateLoaderURLs(urlList, libPath, excludedJars, false);
DynamicClassLoader loader = new DynamicClassLoader(urlList.toArray(new URL[0]));
loader.setLibStorePath(libPath);
return loader;
}
private static void updateLoaderURLs(List<URL> urlList, String libPath, String[] jars, boolean added)
throws MalformedURLException {
for (String jarName : jars) {
if (added) {
ILibraryManagerService librairesService = (ILibraryManagerService) GlobalServiceRegister.getDefault().getService(
ILibraryManagerService.class);
librairesService.retrieve(jarName, libPath, true, new NullProgressMonitor());
}
String jarPath = libPath + PATH_SEPARATOR + jarName;
File jarFile = new File(jarPath);
URL jarUrl = jarFile.toURI().toURL();
if (jarFile.exists()) {
if (added && !urlList.contains(jarUrl)) {
urlList.add(jarUrl);
}
if (!added && urlList.contains(jarUrl)) {
urlList.remove(jarUrl);
}
}
}
}
}

View File

@@ -1,104 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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.database.conn.version;
import java.util.ArrayList;
import java.util.List;
public enum EImpalaDistribution4Versions {
CLOUDERA_CDH5_4(EImpalaDistributions.CLOUDERA, "Cloudera CDH5.4", EDatabaseVersion4Drivers.IMPALA_CDH5_4.getVersionValue()),
CLOUDERA_CDH5_1(EImpalaDistributions.CLOUDERA, "Cloudera CDH5.1", EDatabaseVersion4Drivers.IMPALA_CDH5.getVersionValue()),
CUSTOM(EImpalaDistributions.CUSTOM, "", "");
private EImpalaDistributions distribution;
private String versionDisplayName;
private String versionValue;
EImpalaDistribution4Versions(EImpalaDistributions distribution, String versionDisplayName, String versionValue) {
this.distribution = distribution;
this.versionDisplayName = versionDisplayName;
this.versionValue = versionValue;
}
public static List<EImpalaDistribution4Versions> indexOfByDistribution(String distribution) {
List<EImpalaDistribution4Versions> distribution4Versions = new ArrayList<EImpalaDistribution4Versions>();
if (distribution != null) {
for (EImpalaDistribution4Versions d4v : EImpalaDistribution4Versions.values()) {
if (d4v.getDistribution().getName().equals(distribution)
|| d4v.getDistribution().getDisplayName().equals(distribution)) {
distribution4Versions.add(d4v);
}
}
}
return distribution4Versions;
}
public static EImpalaDistribution4Versions indexOfByVersionDisplay(String displayName) {
return indexOf(displayName, true);
}
public static EImpalaDistribution4Versions indexOfByVersion(String value) {
return indexOf(value, false);
}
private static EImpalaDistribution4Versions indexOf(String name, boolean display) {
if (name != null) {
for (EImpalaDistribution4Versions version : EImpalaDistribution4Versions.values()) {
if (display) {
if (name.equalsIgnoreCase(version.getVersionDisplayName())) {
return version;
}
} else {
if (name.equalsIgnoreCase(version.getVersionValue())) {
return version;
}
}
}
}
return null;
}
public static List<String> getHadoopDistributionVersions(String distribution) {
return getHadoopDistributionVersions(distribution, true);
}
public static List<String> getHadoopDistributionVersions(String distribution, boolean display) {
List<String> result = new ArrayList<String>();
List<EImpalaDistribution4Versions> d4vList = EImpalaDistribution4Versions.indexOfByDistribution(distribution);
for (EImpalaDistribution4Versions d4v : d4vList) {
if (display) {
result.add(d4v.getVersionDisplayName());
} else {
result.add(d4v.getVersionValue());
}
}
return result;
}
public EImpalaDistributions getDistribution() {
return this.distribution;
}
public String getVersionDisplayName() {
return this.versionDisplayName;
}
public String getVersionValue() {
return this.versionValue;
}
}

View File

@@ -1,76 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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.database.conn.version;
import java.util.ArrayList;
import java.util.List;
public enum EImpalaDistributions {
CLOUDERA("Cloudera"),
CUSTOM("Custom - Unsupported");
private String displayName;
EImpalaDistributions(String displayName) {
this.displayName = displayName;
}
public String getName() {
return name();
}
public String getDisplayName() {
return this.displayName;
}
public static List<String> getAllDistributionDisplayNames() {
return getAllDistributionNames(true);
}
public static List<String> getAllDistributionNames(boolean display) {
List<String> names = new ArrayList<String>();
EImpalaDistributions[] values = values();
for (EImpalaDistributions distribution : values) {
if (display) {
names.add(distribution.getDisplayName());
} else {
names.add(distribution.getName());
}
}
return names;
}
public static EImpalaDistributions getDistributionByDisplayName(String name) {
return getDistributionByName(name, true);
}
public static EImpalaDistributions getDistributionByName(String name, boolean display) {
if (name != null) {
for (EImpalaDistributions distribution : values()) {
if (display) {
if (name.equalsIgnoreCase(distribution.getDisplayName())) {
return distribution;
}
} else {
if (name.equalsIgnoreCase(distribution.getName())) {
return distribution;
}
}
}
}
return null;
}
}

View File

@@ -1,207 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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.database.hbase.conn.version;
import java.util.ArrayList;
import java.util.List;
import org.talend.core.hadoop.version.EHadoopVersion4Drivers;
/**
* DOC ycbai class global comment. Detailled comment
*/
public enum EHBaseDistribution4Versions {
HDP_2_2(EHBaseDistributions.HORTONWORKS, EHadoopVersion4Drivers.HDP_2_2.getVersionDisplay(), EHadoopVersion4Drivers.HDP_2_2
.getVersionValue()),
HDP_2_1(EHBaseDistributions.HORTONWORKS, EHadoopVersion4Drivers.HDP_2_1.getVersionDisplay(), EHadoopVersion4Drivers.HDP_2_1
.getVersionValue()),
HDP_2_0(EHBaseDistributions.HORTONWORKS, EHadoopVersion4Drivers.HDP_2_0.getVersionDisplay(), EHadoopVersion4Drivers.HDP_2_0
.getVersionValue()),
HDP_1_3(EHBaseDistributions.HORTONWORKS, EHadoopVersion4Drivers.HDP_1_3.getVersionDisplay(), EHadoopVersion4Drivers.HDP_1_3
.getVersionValue()),
HDP_1_2(EHBaseDistributions.HORTONWORKS, EHadoopVersion4Drivers.HDP_1_2.getVersionDisplay(), EHadoopVersion4Drivers.HDP_1_2
.getVersionValue()),
HDP_1_0(EHBaseDistributions.HORTONWORKS, EHadoopVersion4Drivers.HDP_1_0.getVersionDisplay(), EHadoopVersion4Drivers.HDP_1_0
.getVersionValue()),
APACHE_0_20_203(
EHBaseDistributions.APACHE,
EHadoopVersion4Drivers.APACHE_0_20_203.getVersionDisplay(),
EHadoopVersion4Drivers.APACHE_0_20_203.getVersionValue()),
APACHE_2_4_0_EMR(
EHBaseDistributions.AMAZON_EMR,
EHadoopVersion4Drivers.APACHE_2_4_0_EMR.getVersionDisplay(),
EHadoopVersion4Drivers.APACHE_2_4_0_EMR.getVersionValue()),
APACHE_1_0_3_EMR(
EHBaseDistributions.AMAZON_EMR,
EHadoopVersion4Drivers.APACHE_1_0_3_EMR.getVersionDisplay(),
EHadoopVersion4Drivers.APACHE_1_0_3_EMR.getVersionValue()),
APACHE_1_0_0(
EHBaseDistributions.APACHE,
EHadoopVersion4Drivers.APACHE_1_0_0.getVersionDisplay(),
EHadoopVersion4Drivers.APACHE_1_0_0.getVersionValue()),
CLOUDERA_CDH5_4(
EHBaseDistributions.CLOUDERA,
EHadoopVersion4Drivers.CLOUDERA_CDH5_4.getVersionDisplay(),
EHadoopVersion4Drivers.CLOUDERA_CDH5_4.getVersionValue()),
CLOUDERA_CDH5_1(
EHBaseDistributions.CLOUDERA,
EHadoopVersion4Drivers.CLOUDERA_CDH5_1.getVersionDisplay(),
EHadoopVersion4Drivers.CLOUDERA_CDH5_1.getVersionValue()),
CLOUDERA_CDH5_1_MR1(
EHBaseDistributions.CLOUDERA,
EHadoopVersion4Drivers.CLOUDERA_CDH5_1_MR1.getVersionDisplay(),
EHadoopVersion4Drivers.CLOUDERA_CDH5_1_MR1.getVersionValue()),
CLOUDERA_CDH5(
EHBaseDistributions.CLOUDERA,
EHadoopVersion4Drivers.CLOUDERA_CDH5.getVersionDisplay(),
EHadoopVersion4Drivers.CLOUDERA_CDH5.getVersionValue()),
CLOUDERA_CDH4_YARN(
EHBaseDistributions.CLOUDERA,
EHadoopVersion4Drivers.CLOUDERA_CDH4_YARN.getVersionDisplay(),
EHadoopVersion4Drivers.CLOUDERA_CDH4_YARN.getVersionValue()),
CLOUDERA_CDH4(
EHBaseDistributions.CLOUDERA,
EHadoopVersion4Drivers.CLOUDERA_CDH4.getVersionDisplay(),
EHadoopVersion4Drivers.CLOUDERA_CDH4.getVersionValue()),
CLOUDERA_CDH3(
EHBaseDistributions.CLOUDERA,
EHadoopVersion4Drivers.CLOUDERA_CDH3.getVersionDisplay(),
EHadoopVersion4Drivers.CLOUDERA_CDH3.getVersionValue()),
MAPR_4_0_1(EHBaseDistributions.MAPR, EHadoopVersion4Drivers.MAPR401.getVersionDisplay(), EHadoopVersion4Drivers.MAPR401
.getVersionValue()),
MAPR_3_1_0(EHBaseDistributions.MAPR, EHadoopVersion4Drivers.MAPR310.getVersionDisplay(), EHadoopVersion4Drivers.MAPR310
.getVersionValue()),
MAPR_3_0_1(EHBaseDistributions.MAPR, EHadoopVersion4Drivers.MAPR301.getVersionDisplay(), EHadoopVersion4Drivers.MAPR301
.getVersionValue()),
MAPR_2_1_3(EHBaseDistributions.MAPR, EHadoopVersion4Drivers.MAPR213.getVersionDisplay(), EHadoopVersion4Drivers.MAPR213
.getVersionValue()),
MAPR_2_1_2(EHBaseDistributions.MAPR, EHadoopVersion4Drivers.MAPR212.getVersionDisplay(), EHadoopVersion4Drivers.MAPR212
.getVersionValue()),
MAPR(EHBaseDistributions.MAPR, EHadoopVersion4Drivers.MAPR2.getVersionDisplay(), EHadoopVersion4Drivers.MAPR2
.getVersionValue()),
PIVOTAL_HD_2_0(
EHBaseDistributions.PIVOTAL_HD,
EHadoopVersion4Drivers.PIVOTAL_HD_2_0.getVersionDisplay(),
EHadoopVersion4Drivers.PIVOTAL_HD_2_0.getVersionValue()),
PIVOTAL_HD_1_0_1(
EHBaseDistributions.PIVOTAL_HD,
EHadoopVersion4Drivers.PIVOTAL_HD_1_0_1.getVersionDisplay(),
EHadoopVersion4Drivers.PIVOTAL_HD_1_0_1.getVersionValue()),
CUSTOM(EHBaseDistributions.CUSTOM, EHadoopVersion4Drivers.CUSTOM.getVersionDisplay(), EHadoopVersion4Drivers.CUSTOM
.getVersionValue());
private EHBaseDistributions distribution;
private String versionDisplayName;
private String versionValue;
EHBaseDistribution4Versions(EHBaseDistributions distribution, String versionDisplayName, String versionValue) {
this.distribution = distribution;
this.versionDisplayName = versionDisplayName;
this.versionValue = versionValue;
}
public static List<EHBaseDistribution4Versions> indexOfByDistribution(String distribution) {
List<EHBaseDistribution4Versions> distribution4Versions = new ArrayList<EHBaseDistribution4Versions>();
if (distribution != null) {
for (EHBaseDistribution4Versions d4v : EHBaseDistribution4Versions.values()) {
if (d4v.getDistribution().getName().equals(distribution)
|| d4v.getDistribution().getDisplayName().equals(distribution)) {
distribution4Versions.add(d4v);
}
}
}
return distribution4Versions;
}
public static EHBaseDistribution4Versions indexOfByVersionDisplay(String displayName) {
return indexOf(displayName, true);
}
public static EHBaseDistribution4Versions indexOfByVersion(String value) {
return indexOf(value, false);
}
private static EHBaseDistribution4Versions indexOf(String name, boolean display) {
if (name != null) {
for (EHBaseDistribution4Versions version : EHBaseDistribution4Versions.values()) {
if (display) {
if (name.equalsIgnoreCase(version.getVersionDisplayName())) {
return version;
}
} else {
if (name.equalsIgnoreCase(version.getVersionValue())) {
return version;
}
}
}
}
return null;
}
public static List<String> getHadoopDistributionVersions(String distribution) {
return getHadoopDistributionVersions(distribution, true);
}
public static List<String> getHadoopDistributionVersions(String distribution, boolean display) {
List<String> result = new ArrayList<String>();
List<EHBaseDistribution4Versions> d4vList = EHBaseDistribution4Versions.indexOfByDistribution(distribution);
for (EHBaseDistribution4Versions d4v : d4vList) {
if (display) {
result.add(d4v.getVersionDisplayName());
} else {
result.add(d4v.getVersionValue());
}
}
return result;
}
public EHBaseDistributions getDistribution() {
return this.distribution;
}
public String getVersionDisplayName() {
return this.versionDisplayName;
}
public String getVersionValue() {
return this.versionValue;
}
}

View File

@@ -1,37 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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.exception;
import java.sql.SQLException;
/**
* created by ycbai on 2014年11月17日 Detailled comment
*
*/
public class WarningSQLException extends SQLException {
private static final long serialVersionUID = 6001838275838161372L;
public WarningSQLException(String reason) {
super(reason);
}
public WarningSQLException(String reason, Throwable cause) {
super(reason, cause);
}
public WarningSQLException(Throwable cause) {
super(cause);
}
}

View File

@@ -1,45 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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.hadoop;
/**
* created by ycbai on Jul 31, 2014 Detailled comment
*
*/
public enum EHadoopCategory {
HADOOP_CLUSTER,
HDFS,
MAP_REDUCE,
YARN,
HCATALOG,
HIVE,
HBASE,
OOZIE,
CUSTOM
;
public String getName() {
return this.name();
}
}

View File

@@ -1,54 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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.hadoop;
/**
* created by ycbai on 2014-5-28 Detailled comment
*
*/
public enum EHadoopConfigurationJars {
HDFS(new String[0], new String[] { "hadoop-conf-kerberos.jar" }), //$NON-NLS-1$
MAP_REDUCE(new String[0], new String[] { "hadoop-conf-kerberos.jar" }), //$NON-NLS-1$
HCATALOG(new String[] { "hadoop-conf.jar" }, new String[] { "hadoop-conf-kerberos.jar" }), //$NON-NLS-1$ //$NON-NLS-2$
HIVE(new String[] { "hadoop-conf.jar" }, new String[] { "hadoop-conf-kerberos.jar" }), //$NON-NLS-1$ //$NON-NLS-2$
HBASE(new String[] { "hadoop-conf.jar" }, new String[] { "hadoop-conf-kerberos.jar" }), //$NON-NLS-1$ //$NON-NLS-2$
;
private String[] disableSecurityJars;
private String[] enableSecurityJars;
EHadoopConfigurationJars(String[] disableSecurityJars, String[] enableSecurityJars) {
this.disableSecurityJars = disableSecurityJars;
this.enableSecurityJars = enableSecurityJars;
}
public String getName() {
return name();
}
public String[] getDisableSecurityJars() {
return this.disableSecurityJars;
}
public String[] getEnableSecurityJars() {
return this.enableSecurityJars;
}
}

View File

@@ -1,197 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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.hadoop;
import java.net.MalformedURLException;
import java.util.Set;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.core.classloader.ClassLoaderFactory;
import org.talend.core.classloader.DynamicClassLoader;
/**
*
* created by ycbai on Aug 11, 2014 Detailled comment
*
* <p>
* TODO: Need to improve it and replace {@link HadoopClassLoaderFactory} with it after.
* </p>
*
*/
public class HadoopClassLoaderFactory2 {
public static ClassLoader getHDFSClassLoader(String distribution, String version, boolean useKrb) {
return getClassLoader(EHadoopCategory.HDFS, distribution, version, useKrb);
}
public static ClassLoader getMRClassLoader(String distribution, String version, boolean useKrb) {
return getClassLoader(EHadoopCategory.MAP_REDUCE, distribution, version, useKrb);
}
public static ClassLoader getHiveEmbeddedClassLoader(String distribution, String version, boolean useKrb) {
return getClassLoader(EHadoopCategory.HIVE, distribution, version, useKrb, IHadoopArgs.HIVE_ARG_EMBEDDED);
}
public static ClassLoader getHiveStandaloneClassLoader(String distribution, String version, boolean useKrb) {
return getClassLoader(EHadoopCategory.HIVE, distribution, version, useKrb, IHadoopArgs.HIVE_ARG_STANDALONE);
}
public static ClassLoader getHBaseClassLoader(String distribution, String version, boolean useKrb) {
return getClassLoader(EHadoopCategory.HBASE, distribution, version, useKrb);
}
public static ClassLoader getHadoopCustomClassLoader(String uid, Object customJars) {
return HadoopClassLoaderFactory2.builder().withTypePrefix(EHadoopCategory.CUSTOM.getName()).withUid(uid)
.build(customJars, true);
}
/**
* DOC ycbai Comment method "builder".
*
* <p>
* Build the classloader with some options.
* <p>
*
* @return
*/
public static HadoopClassLoaderFactory2.Builder builder() {
return new HadoopClassLoaderFactory2.Builder();
}
/**
*
* created by ycbai on Aug 11, 2014 Detailled comment
*
*/
public static class Builder {
private static final String INDEX_SEP = ":"; //$NON-NLS-1$
private StringBuffer indexBuffer = new StringBuffer();
public Builder withTypePrefix(String typePrefix) {
withArg(typePrefix);
return this;
}
public Builder withDistribution(String distribution) {
withArg(distribution);
return this;
}
public Builder withVersion(String version) {
withArg(version);
return this;
}
public Builder withUid(String uid) {
withArg(uid);
return this;
}
public Builder withArg(String arg) {
indexBuffer.append(INDEX_SEP).append(arg);
return this;
}
public ClassLoader build() {
return build(null, true);
}
public ClassLoader build(boolean showDownloadIfNotExist) {
return build(null, showDownloadIfNotExist);
}
public ClassLoader build(Object extraArg, boolean showDownloadIfNotExist) {
if (indexBuffer.length() > 0) { // Remove the first colon.
indexBuffer.deleteCharAt(0);
}
return getClassLoader(indexBuffer.toString(), extraArg, showDownloadIfNotExist);
}
}
public static ClassLoader getClassLoader(EHadoopCategory category, String distribution, String version, boolean useKrb,
String... extraArgs) {
Builder builder = HadoopClassLoaderFactory2.builder().withTypePrefix(category.getName()).withDistribution(distribution)
.withVersion(version);
if (extraArgs != null && extraArgs.length > 0) {
for (String arg : extraArgs) {
builder.withArg(arg);
}
}
ClassLoader classLoader = builder.build();
if (classLoader instanceof DynamicClassLoader && useKrb) {
classLoader = createSecurityLoader(category, (DynamicClassLoader) classLoader);
}
return classLoader;
}
private static ClassLoader getClassLoader(String index, Object extraJars, boolean showDownloadIfNotExist) {
ClassLoader loader = null;
if (index.startsWith(EHadoopCategory.CUSTOM.getName())) {
loader = getCustomClassLoader(index, extraJars, showDownloadIfNotExist);
} else {
loader = ClassLoaderFactory.getClassLoader(index, showDownloadIfNotExist);
}
if (loader == null) {
loader = HadoopClassLoaderFactory2.class.getClassLoader();
}
return loader;
}
@SuppressWarnings("unchecked")
private static ClassLoader getCustomClassLoader(String index, Object customJars, boolean showDownloadIfNotExist) {
if (customJars instanceof Set) {
return ClassLoaderFactory.getCustomClassLoader(index, (Set<String>) customJars);
}
return ClassLoaderFactory.getCustomClassLoader(index, String.valueOf(customJars));
}
private static DynamicClassLoader createSecurityLoader(EHadoopCategory category, DynamicClassLoader loader) {
String[] securityJars;
switch (category) {
case HDFS:
securityJars = EHadoopConfigurationJars.HDFS.getEnableSecurityJars();
break;
case MAP_REDUCE:
securityJars = EHadoopConfigurationJars.MAP_REDUCE.getEnableSecurityJars();
break;
case HCATALOG:
securityJars = EHadoopConfigurationJars.HCATALOG.getEnableSecurityJars();
break;
case HIVE:
securityJars = EHadoopConfigurationJars.HIVE.getEnableSecurityJars();
break;
case HBASE:
securityJars = EHadoopConfigurationJars.HBASE.getEnableSecurityJars();
break;
default:
securityJars = new String[0];
break;
}
DynamicClassLoader securityClassLoader = null;
try {
securityClassLoader = DynamicClassLoader.createNewOneBaseLoader(loader, securityJars, null);
} catch (MalformedURLException e) {
ExceptionHandler.process(e);
}
return securityClassLoader;
}
}

View File

@@ -1,25 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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.hadoop;
/**
* created by ycbai on Aug 15, 2014 Detailled comment
*
*/
public interface IHadoopArgs {
public static final String HIVE_ARG_EMBEDDED = "EMBEDDED"; //$NON-NLS-1$
public static final String HIVE_ARG_STANDALONE = "STANDALONE"; //$NON-NLS-1$
}

View File

@@ -1,47 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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.hadoop.conf;
/**
* created by ycbai on Jul 31, 2014 Detailled comment
*
*/
public enum EHadoopProperties {
NAMENODE_URI,
JOBTRACKER,
RESOURCE_MANAGER,
NAMENODE_PRINCIPAL,
JOBTRACKER_PRINCIPAL,
RESOURCE_MANAGER_PRINCIPAL,
JOBHISTORY_PRINCIPAL,
HIVE_PRINCIPAL,
DATABASE,
PORT,
;
public String getName() {
return this.name();
}
}

View File

@@ -1,42 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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.hadoop.conf;
import org.talend.core.runtime.conf.DefaultConfsManager;
/**
* created by ycbai on Jul 31, 2014 Detailled comment
*
*/
public class HadoopDefaultConfsManager extends DefaultConfsManager {
private final static String CONF_FILE_PATH = "resources/hadoop/hadoop_default_confs.json"; //$NON-NLS-1$
private final static String ROOT_ELEMENT = "HADOOP"; //$NON-NLS-1$
private static HadoopDefaultConfsManager manager = new HadoopDefaultConfsManager(CONF_FILE_PATH);
private HadoopDefaultConfsManager(String confFilePath) {
super(CONF_FILE_PATH);
}
public static synchronized final HadoopDefaultConfsManager getInstance() {
return manager;
}
@Override
protected String getRootElement() {
return ROOT_ELEMENT;
}
}

View File

@@ -1,158 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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.hadoop.repository;
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.talend.commons.exception.ExceptionHandler;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.hadoop.IHadoopClusterService;
import org.talend.core.model.metadata.builder.connection.Connection;
import org.talend.core.utils.TalendQuoteUtils;
import org.talend.utils.json.JSONArray;
import org.talend.utils.json.JSONException;
import org.talend.utils.json.JSONObject;
/**
* created by ycbai on 2013-10-24 Detailled comment
*
*/
public class HadoopRepositoryUtil {
/**
* DOC ycbai Comment method "getHadoopPropertiesJsonStr".
*
* <p>
* Get the json string type of hadoop properties from list type.
* </p>
*
* @param properties
* @return
* @throws JSONException
*/
public static String getHadoopPropertiesJsonStr(List<Map<String, Object>> properties) {
JSONArray jsonArr = null;
try {
jsonArr = new JSONArray();
if (properties != null && properties.size() > 0) {
for (Map<String, Object> map : properties) {
JSONObject object = new JSONObject();
Iterator<String> it = map.keySet().iterator();
while (it.hasNext()) {
String key = it.next();
object.put(key, map.get(key));
}
jsonArr.put(object);
}
}
} catch (JSONException e) {
ExceptionHandler.process(e);
}
return jsonArr.toString();
}
public static List<Map<String, Object>> getHadoopPropertiesList(String propertiesJsonStr) {
return getHadoopPropertiesList(propertiesJsonStr, false);
}
/**
* DOC ycbai Comment method "getHadoopPropertiesList".
*
* <p>
* Get the list type of hadoop properties from json string.
* </p>
*
* @param propertiesJsonStr
* @param includeQuotes
* @return
* @throws JSONException
*/
public static List<Map<String, Object>> getHadoopPropertiesList(String propertiesJsonStr, boolean includeQuotes) {
List<Map<String, Object>> properties = new ArrayList<Map<String, Object>>();
try {
if (StringUtils.isNotEmpty(propertiesJsonStr)) {
JSONArray jsonArr = new JSONArray(propertiesJsonStr);
for (int i = 0; i < jsonArr.length(); i++) {
HashMap<String, Object> map = new HashMap<String, Object>();
JSONObject object = jsonArr.getJSONObject(i);
Iterator<String> it = object.keys();
while (it.hasNext()) {
String key = it.next();
String value = String.valueOf(object.get(key));
if (includeQuotes) {
value = TalendQuoteUtils.addQuotesIfNotExist(value);
} else {
value = TalendQuoteUtils.removeQuotesIfExist(value);
}
map.put(key, value);
}
properties.add(map);
}
}
} catch (JSONException e) {
ExceptionHandler.process(e);
}
return properties;
}
/**
* DOC ycbai Comment method "getHadoopPropertiesFullList".
*
* <p>
* Get the full list type of hadoop properties (with the parent properties of the hadoop cluster it belongs) from
* json string.
* </p>
*
* @param connection
* @param propertiesJsonStr
* @param includeQuotes
* @return
*/
public static List<Map<String, Object>> getHadoopPropertiesFullList(Connection connection, String propertiesJsonStr,
boolean includeQuotes) {
IHadoopClusterService hadoopClusterService = null;
if (GlobalServiceRegister.getDefault().isServiceRegistered(IHadoopClusterService.class)) {
hadoopClusterService = (IHadoopClusterService) GlobalServiceRegister.getDefault().getService(
IHadoopClusterService.class);
}
List<Map<String, Object>> parentProperties = null;
if (hadoopClusterService != null) {
parentProperties = getHadoopPropertiesList(hadoopClusterService.getHadoopClusterProperties(connection), true);
}
List<Map<String, Object>> properties = getHadoopPropertiesList(propertiesJsonStr, true);
Map<String, Map<String, Object>> propertiesMap = new HashMap<String, Map<String, Object>>();
for (Map<String, Object> proMap : properties) {
String property = String.valueOf(proMap.get("PROPERTY")); //$NON-NLS-1$
propertiesMap.put(property, proMap);
}
if (parentProperties != null) {
for (Map<String, Object> parentProMap : parentProperties) {
String property = String.valueOf(parentProMap.get("PROPERTY")); //$NON-NLS-1$
if (!propertiesMap.containsKey(property)) {
propertiesMap.put(property, parentProMap);
properties.add(parentProMap);
}
}
}
return properties;
}
}

View File

@@ -1,22 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.core.model.metadata;
/**
* created by ldong on Jan 13, 2015 Detailled comment
*
*/
public interface IDatabaseConstant {
public static final String REDSHIFT = "DATABASE:REDSHIFT";
}

View File

@@ -1,22 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.core.model.metadata;
/**
* created by wchen on Sep 19, 2014 Detailled comment
*
*/
public enum MetadataSchemaType {
INPUT,
OUTPUT;
}

View File

@@ -1,368 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.core.model.metadata.connection.hive;
import org.talend.core.hadoop.version.EHadoopDistributions;
import org.talend.core.hadoop.version.EHadoopVersion4Drivers;
/**
* This class provides the info for Hive. There are 3 levels as follows:
*
* <pre>
* <li> 0 -- stands for "Distribution"
* <li> 1 -- stands for "Distro version"
* <li> 2 -- stands for "Hive mode"
* </pre>
*
* The <code>key</code> of this enum is matched to the config file of component.
*
* @author Marvin Wang
* @version 1.0 jdk1.6
* @date Aug 9, 2012
*/
public enum HiveConnVersionInfo {
HORTONWORKS(0, EHadoopDistributions.HORTONWORKS.getName(), EHadoopDistributions.HORTONWORKS.getDisplayName(), true),
APACHE(0, EHadoopDistributions.APACHE.getName(), EHadoopDistributions.APACHE.getDisplayName(), false),
CLOUDERA(0, EHadoopDistributions.CLOUDERA.getName(), EHadoopDistributions.CLOUDERA.getDisplayName(), false),
MAPR(0, EHadoopDistributions.MAPR.getName(), EHadoopDistributions.MAPR.getDisplayName(), false),
AMAZON_EMR(0, EHadoopDistributions.AMAZON_EMR.getName(), EHadoopDistributions.AMAZON_EMR.getDisplayName(), false),
PIVOTAL_HD(0, EHadoopDistributions.PIVOTAL_HD.getName(), EHadoopDistributions.PIVOTAL_HD.getDisplayName(), false),
DISTRO_CUSTOM(0, EHadoopDistributions.CUSTOM.getName(), EHadoopDistributions.CUSTOM.getDisplayName(), false),
HDP_2_2(
1,
EHadoopVersion4Drivers.HDP_2_2.getVersionValue(),
EHadoopVersion4Drivers.HDP_2_2.getVersionDisplay(),
true,
false,
true,
true,
HiveConnVersionInfo.HORTONWORKS),
HDP_2_1(
1,
EHadoopVersion4Drivers.HDP_2_1.getVersionValue(),
EHadoopVersion4Drivers.HDP_2_1.getVersionDisplay(),
true,
false,
true,
true,
HiveConnVersionInfo.HORTONWORKS),
HDP_2_0(
1,
EHadoopVersion4Drivers.HDP_2_0.getVersionValue(),
EHadoopVersion4Drivers.HDP_2_0.getVersionDisplay(),
true,
false,
true,
true,
HiveConnVersionInfo.HORTONWORKS),
HDP_1_3(
1,
EHadoopVersion4Drivers.HDP_1_3.getVersionValue(),
EHadoopVersion4Drivers.HDP_1_3.getVersionDisplay(),
true,
true,
HiveConnVersionInfo.HORTONWORKS),
HDP_1_2(
1,
EHadoopVersion4Drivers.HDP_1_2.getVersionValue(),
EHadoopVersion4Drivers.HDP_1_2.getVersionDisplay(),
true,
true,
HiveConnVersionInfo.HORTONWORKS),
HDP_1_0(
1,
EHadoopVersion4Drivers.HDP_1_0.getVersionValue(),
EHadoopVersion4Drivers.HDP_1_0.getVersionDisplay(),
true,
HiveConnVersionInfo.HORTONWORKS),
APACHE_1_0_0(1, EHadoopVersion4Drivers.APACHE_1_0_0.getVersionValue(), EHadoopVersion4Drivers.APACHE_1_0_0
.getVersionDisplay(), false, HiveConnVersionInfo.APACHE),
APACHE_0_20_203(1, EHadoopVersion4Drivers.APACHE_0_20_203.getVersionValue(), EHadoopVersion4Drivers.APACHE_0_20_203
.getVersionDisplay(), false, HiveConnVersionInfo.APACHE),
Cloudera_CDH5_4(1, EHadoopVersion4Drivers.CLOUDERA_CDH5_4.getVersionValue(), EHadoopVersion4Drivers.CLOUDERA_CDH5_4
.getVersionDisplay(), true, false, true, true, HiveConnVersionInfo.CLOUDERA),
Cloudera_CDH5_1(1, EHadoopVersion4Drivers.CLOUDERA_CDH5_1.getVersionValue(), EHadoopVersion4Drivers.CLOUDERA_CDH5_1
.getVersionDisplay(), true, false, true, true, HiveConnVersionInfo.CLOUDERA),
Cloudera_CDH5_1_MR1(
1,
EHadoopVersion4Drivers.CLOUDERA_CDH5_1_MR1.getVersionValue(),
EHadoopVersion4Drivers.CLOUDERA_CDH5_1_MR1.getVersionDisplay(),
true,
false,
true,
true,
HiveConnVersionInfo.CLOUDERA),
Cloudera_CDH5(1, EHadoopVersion4Drivers.CLOUDERA_CDH5.getVersionValue(), EHadoopVersion4Drivers.CLOUDERA_CDH5
.getVersionDisplay(), true, false, true, true, HiveConnVersionInfo.CLOUDERA),
Cloudera_CDH4_YARN(1, EHadoopVersion4Drivers.CLOUDERA_CDH4_YARN.getVersionValue(), EHadoopVersion4Drivers.CLOUDERA_CDH4_YARN
.getVersionDisplay(), true, false, true, false, HiveConnVersionInfo.CLOUDERA),
Cloudera_CDH4(1, EHadoopVersion4Drivers.CLOUDERA_CDH4.getVersionValue(), EHadoopVersion4Drivers.CLOUDERA_CDH4
.getVersionDisplay(), true, true, HiveConnVersionInfo.CLOUDERA),
Cloudera_CDH3(1, EHadoopVersion4Drivers.CLOUDERA_CDH3.getVersionValue(), EHadoopVersion4Drivers.CLOUDERA_CDH3
.getVersionDisplay(), false, HiveConnVersionInfo.CLOUDERA),
MAPR4_0_1(
1,
EHadoopVersion4Drivers.MAPR401.getVersionValue(),
EHadoopVersion4Drivers.MAPR401.getVersionDisplay(),
true,
false,
HiveConnVersionInfo.MAPR),
MAPR3_1_0(
1,
EHadoopVersion4Drivers.MAPR310.getVersionValue(),
EHadoopVersion4Drivers.MAPR310.getVersionDisplay(),
true,
false,
HiveConnVersionInfo.MAPR),
MAPR3_0_1(
1,
EHadoopVersion4Drivers.MAPR301.getVersionValue(),
EHadoopVersion4Drivers.MAPR301.getVersionDisplay(),
true,
false,
HiveConnVersionInfo.MAPR),
MAPR2_1_3(
1,
EHadoopVersion4Drivers.MAPR213.getVersionValue(),
EHadoopVersion4Drivers.MAPR213.getVersionDisplay(),
true,
false,
HiveConnVersionInfo.MAPR),
MAPR2_1_2(
1,
EHadoopVersion4Drivers.MAPR212.getVersionValue(),
EHadoopVersion4Drivers.MAPR212.getVersionDisplay(),
false,
HiveConnVersionInfo.MAPR),
MAPR2(
1,
EHadoopVersion4Drivers.MAPR2.getVersionValue(),
EHadoopVersion4Drivers.MAPR2.getVersionDisplay(),
false,
HiveConnVersionInfo.MAPR),
MAPR1(
1,
EHadoopVersion4Drivers.MAPR1.getVersionValue(),
EHadoopVersion4Drivers.MAPR1.getVersionDisplay(),
false,
HiveConnVersionInfo.MAPR),
APACHE_2_4_0_EMR(
1,
EHadoopVersion4Drivers.APACHE_2_4_0_EMR.getVersionValue(),
"Apache 2.4.0 (Hive 0.11.0)", true, HiveConnVersionInfo.AMAZON_EMR), //$NON-NLS-1$
APACHE_1_0_3_EMR(
1,
EHadoopVersion4Drivers.APACHE_1_0_3_EMR.getVersionValue(),
"Apache 1.0.3 (Hive 0.8.1)", false, HiveConnVersionInfo.AMAZON_EMR), //$NON-NLS-1$
MapR_EMR(
1,
EHadoopVersion4Drivers.MAPR_EMR.getVersionValue(),
EHadoopVersion4Drivers.MAPR_EMR.getVersionDisplay(),
false,
HiveConnVersionInfo.AMAZON_EMR),
PIVOTAL_HD_2_0(1, EHadoopVersion4Drivers.PIVOTAL_HD_2_0.getVersionValue(), EHadoopVersion4Drivers.PIVOTAL_HD_2_0
.getVersionDisplay(), true, false, true, true, HiveConnVersionInfo.PIVOTAL_HD),
PIVOTAL_HD_1_0_1(1, EHadoopVersion4Drivers.PIVOTAL_HD_1_0_1.getVersionValue(), EHadoopVersion4Drivers.PIVOTAL_HD_1_0_1
.getVersionDisplay(), false, false, true, false, HiveConnVersionInfo.PIVOTAL_HD),
DISTRO_VERSION_CUSTOM(1, "DISTRO_VERSION_CUSTOM", "Customized Version", true, true, HiveConnVersionInfo.DISTRO_CUSTOM), //$NON-NLS-1$//$NON-NLS-2$
MODE_EMBEDDED(2, "EMBEDDED",//$NON-NLS-1$
"Embedded",//$NON-NLS-1$
false,
HiveConnVersionInfo.HDP_1_0,
HiveConnVersionInfo.HDP_1_2,
HiveConnVersionInfo.HDP_1_3,
HiveConnVersionInfo.HDP_2_0,
HiveConnVersionInfo.HDP_2_1,
HiveConnVersionInfo.HDP_2_2,
HiveConnVersionInfo.APACHE_1_0_0,
HiveConnVersionInfo.Cloudera_CDH4,
HiveConnVersionInfo.Cloudera_CDH4_YARN,
HiveConnVersionInfo.Cloudera_CDH5,
HiveConnVersionInfo.Cloudera_CDH5_1,
HiveConnVersionInfo.Cloudera_CDH5_1_MR1,
HiveConnVersionInfo.Cloudera_CDH5_4,
HiveConnVersionInfo.MAPR2,
HiveConnVersionInfo.MAPR2_1_2,
HiveConnVersionInfo.MAPR2_1_3,
HiveConnVersionInfo.MAPR3_0_1,
HiveConnVersionInfo.MAPR3_1_0,
HiveConnVersionInfo.MAPR4_0_1,
HiveConnVersionInfo.APACHE_1_0_3_EMR,
HiveConnVersionInfo.APACHE_2_4_0_EMR,
HiveConnVersionInfo.PIVOTAL_HD_1_0_1,
HiveConnVersionInfo.PIVOTAL_HD_2_0,
HiveConnVersionInfo.DISTRO_VERSION_CUSTOM),
MODE_STANDALONE(2, "STANDALONE",//$NON-NLS-1$
"Standalone",//$NON-NLS-1$
false,
HiveConnVersionInfo.HDP_1_2,
HiveConnVersionInfo.HDP_1_3,
HiveConnVersionInfo.HDP_2_0,
HiveConnVersionInfo.HDP_2_1,
HiveConnVersionInfo.HDP_2_2,
HiveConnVersionInfo.APACHE_0_20_203,
HiveConnVersionInfo.APACHE_1_0_0,
HiveConnVersionInfo.Cloudera_CDH3,
HiveConnVersionInfo.Cloudera_CDH4,
HiveConnVersionInfo.Cloudera_CDH4_YARN,
HiveConnVersionInfo.Cloudera_CDH5,
HiveConnVersionInfo.Cloudera_CDH5_1,
HiveConnVersionInfo.Cloudera_CDH5_1_MR1,
HiveConnVersionInfo.Cloudera_CDH5_4,
HiveConnVersionInfo.MAPR1,
HiveConnVersionInfo.MAPR2,
HiveConnVersionInfo.MAPR2_1_2,
HiveConnVersionInfo.MAPR2_1_3,
HiveConnVersionInfo.MAPR3_0_1,
HiveConnVersionInfo.MAPR3_1_0,
HiveConnVersionInfo.MAPR4_0_1,
HiveConnVersionInfo.MapR_EMR,
HiveConnVersionInfo.APACHE_1_0_3_EMR,
HiveConnVersionInfo.APACHE_2_4_0_EMR,
HiveConnVersionInfo.PIVOTAL_HD_1_0_1,
HiveConnVersionInfo.PIVOTAL_HD_2_0,
HiveConnVersionInfo.DISTRO_VERSION_CUSTOM);
private int level;
private String key;// The key is mapped to item name of component in t*_java.xml file.
private String displayName;// That is mapped to the property of component in t*_messages.properties file.
private HiveConnVersionInfo[] follows;// That stores all are followed by the current object.
private boolean isSupportHive2; // Till now only MapR2, CDH4, and HDP1.2 support hive server2.
private boolean isSupportMR1;
private boolean isSupportYARN;
private boolean supportSecurity;
private static HiveConnVersionInfo[] hiveVersions = new HiveConnVersionInfo[] { HiveConnVersionInfo.Cloudera_CDH5,
HiveConnVersionInfo.Cloudera_CDH5_1, HiveConnVersionInfo.Cloudera_CDH5_1_MR1, HiveConnVersionInfo.Cloudera_CDH5_4,
HiveConnVersionInfo.HDP_2_2, HiveConnVersionInfo.HDP_2_1, HiveConnVersionInfo.HDP_2_0,
HiveConnVersionInfo.PIVOTAL_HD_2_0, HiveConnVersionInfo.APACHE_2_4_0_EMR };
private HiveConnVersionInfo(int level, String key, String displayName, boolean supportSecurity,
HiveConnVersionInfo... follows) {
this(level, key, displayName, false, supportSecurity, follows);
}
private HiveConnVersionInfo(int level, String key, String displayName, boolean isSupportHive2, boolean supportSecurity,
HiveConnVersionInfo... follows) {
this(level, key, displayName, isSupportHive2, true, false, supportSecurity, follows);
}
private HiveConnVersionInfo(int level, String key, String displayName, boolean isSupportHive2, boolean isSupportMR1,
boolean isSupportYARN, boolean supportSecurity, HiveConnVersionInfo... follows) {
this.level = level;
this.key = key;
this.displayName = displayName;
this.isSupportHive2 = isSupportHive2;
this.isSupportMR1 = isSupportMR1;
this.isSupportYARN = isSupportYARN;
this.follows = follows;
this.supportSecurity = supportSecurity;
}
public int getLevel() {
return this.level;
}
public String getKey() {
return this.key;
}
public String getDisplayName() {
return this.displayName;
}
public HiveConnVersionInfo[] getFollows() {
return this.follows;
}
/**
* Getter for isSupportHive2.
*
* @return the isSupportHive2
*/
public boolean isSupportHive2() {
return this.isSupportHive2;
}
public boolean isSupportMR1() {
return this.isSupportMR1;
}
public boolean isSupportYARN() {
return this.isSupportYARN;
}
public boolean isSupportSecurity() {
return this.supportSecurity;
}
public static HiveConnVersionInfo[] getHiveVersionsNotSupportOnWindows() {
return hiveVersions;
}
public static HiveConnVersionInfo getVersionByKey(String key) {
HiveConnVersionInfo[] values = values();
for (HiveConnVersionInfo version : values) {
if (version.getLevel() == 1 && version.getKey().equals(key)) {
return version;
}
}
return null;
}
}

View File

@@ -1,79 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.core.model.relationship;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType;
/**
* DOC ggu class global comment. Detailled comment
*/
public abstract class AbstractJobParameterInRepositoryRelationshipHandler extends AbstractJobParameterRelationshipHandler {
public static final String IN_REPOSITORY = "REPOSITORY"; //$NON-NLS-1$
/*
* (non-Javadoc)
*
* @see org.talend.core.model.relationship.AbstractParameterRelationshipHandler#collect(java.util.Map,
* java.util.Map)
*/
@Override
protected Set<Relation> collect(Map<String, ElementParameterType> parametersMap, Map<?, ?> options) {
Set<Relation> relationSet = new HashSet<Relation>();
for (ElementParameterType paramType : parametersMap.values()) {
if (paramType.getName().endsWith(":" + getRepositoryTypeName())) { //$NON-NLS-1$
String name = paramType.getName().split(":")[0]; //$NON-NLS-1$
ElementParameterType repositoryTypeParam = parametersMap.get(name + ":" //$NON-NLS-1$
+ getRepositoryTypeName());
if (repositoryTypeParam != null && IN_REPOSITORY.equals(repositoryTypeParam.getValue())) {
ElementParameterType repositoryTypeValueParam = parametersMap.get(name + ":" //$NON-NLS-1$
+ getRepositoryTypeValueName());
if (repositoryTypeValueParam != null) {
String repositoryIdOrValue = repositoryTypeValueParam.getValue();
if (StringUtils.isNotEmpty(repositoryIdOrValue)) {
Relation addedRelation = new Relation();
addedRelation.setId(repositoryIdOrValue);
addedRelation.setType(getRepositoryRelationType());
addedRelation.setVersion(RelationshipItemBuilder.LATEST_VERSION);
relationSet.add(addedRelation);
}
}
}
}
}
return relationSet;
}
/**
* Something like PROPERTY_TYPE
*/
protected abstract String getRepositoryTypeName();
/**
* Something like REPOSITORY_PROPERTY_TYPE
*/
protected abstract String getRepositoryTypeValueName();
/**
* get the type of relation type
*/
protected abstract String getRepositoryRelationType();
}

View File

@@ -1,57 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.core.model.update;
import java.util.HashMap;
import java.util.Map;
/**
* created by ldong on Feb 6, 2015 Detailled comment
*
*/
public class ConnectionColumnUpdateManager {
private static ConnectionColumnUpdateManager columnManager = null;
private Map<String, String> columnRenameMap = new HashMap<String, String>();
private ConnectionColumnUpdateManager() {
}
public synchronized static ConnectionColumnUpdateManager getInstance() {
if (columnManager == null) {
columnManager = new ConnectionColumnUpdateManager();
}
return columnManager;
}
public Map<String, String> getColumnRenameMap() {
return this.columnRenameMap;
}
public void addNewName(String newName, String oldName) {
String name = columnRenameMap.get(oldName);
if (name != null) {
columnRenameMap.remove(oldName);
columnRenameMap.put(newName, name);
} else {
columnRenameMap.put(newName, oldName);
}
}
public void setColumnRenameMap(Map<String, String> columnRenameMap) {
this.columnRenameMap = columnRenameMap;
}
}

View File

@@ -1,907 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.core.model.utils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.regex.Matcher;
import org.apache.commons.lang.StringUtils;
import org.apache.oro.text.regex.MalformedPatternException;
import org.apache.oro.text.regex.Pattern;
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.apache.oro.text.regex.Perl5Substitution;
import org.apache.oro.text.regex.Substitution;
import org.apache.oro.text.regex.Util;
import org.eclipse.emf.common.util.EList;
import org.eclipse.swt.graphics.Point;
import org.talend.commons.utils.PasswordEncryptUtil;
import org.talend.core.model.context.UpdateContextVariablesHelper;
import org.talend.core.model.general.Project;
import org.talend.core.model.process.EParameterFieldType;
import org.talend.core.model.process.IContextParameter;
import org.talend.core.model.process.IElementParameter;
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.ElementParameterType;
import org.talend.designer.core.model.utils.emf.talendfile.ElementValueType;
import org.talend.repository.ProjectManager;
import org.talend.utils.security.CryptoHelper;
/**
* cli class global comment. Detailled comment
*/
public final class ParameterValueUtil {
public static final String EMPTY = ""; //$NON-NLS-1$
private ParameterValueUtil() {
}
@SuppressWarnings("unchecked")
public static void renameValues(final IElementParameter param, final String oldName, final String newName) {
if (param == null || oldName == null || newName == null) {
return;
}
// boolean flag = true;
// if (param.getFieldType() == EParameterFieldType.MEMO_SQL) {
// flag = false;
// }
if (param.getValue() instanceof String) { // for TEXT / MEMO etc..
String value = (String) param.getValue();
if (value.contains(oldName)) {
// param.setValue(value.replaceAll(oldName, newName));
// String newValue = renameValues(value, oldName, newName, flag);
String newValue = splitQueryData(oldName, newName, value);
if (!value.equals(newValue)) {
param.setValue(newValue);
}
}
} else if (param.getValue() instanceof List) { // for TABLE
List<Map<String, Object>> tableValues = (List<Map<String, Object>>) param.getValue();
for (Map<String, Object> line : tableValues) {
for (String key : line.keySet()) {
Object cellValue = line.get(key);
if (cellValue instanceof String) { // cell is text so
// rename data if
// needed
String value = (String) cellValue;
if (value.contains(oldName)) {
// line.put(key, value.replaceAll(oldName,
// newName));
// String newValue = renameValues(value, oldName, newName, flag);
String newValue = splitQueryData(oldName, newName, value);
if (!value.equals(newValue)) {
line.put(key, newValue);
}
}
}
}
}
}
}
public static String renameValues(final String value, final String oldName, final String newName, boolean flag) {
if (value == null || oldName == null || newName == null) {
return value; // keep original value
}
PatternCompiler compiler = new Perl5Compiler();
Perl5Matcher matcher = new Perl5Matcher();
matcher.setMultiline(true);
Perl5Substitution substitution = new Perl5Substitution(newName + "$2", Perl5Substitution.INTERPOLATE_ALL); //$NON-NLS-1$
Pattern pattern;
try {
pattern = compiler.compile(getQuotePattern(oldName));
} catch (MalformedPatternException e) {
return value; // keep original value
}
if (matcher.contains(value, pattern)) {
// replace
String returnValue = EMPTY;
if (value.contains(TalendQuoteUtils.getQuoteChar()) && !flag) {
// returnValue = splitQueryData(matcher, pattern, substitution, value, Util.SUBSTITUTE_ALL);
returnValue = splitQueryData(oldName, newName, value);
} else {
returnValue = Util.substitute(matcher, pattern, substitution, value, Util.SUBSTITUTE_ALL);
}
return returnValue;
}
return value; // keep original value
}
// function before TDI-29092 modify,this function seems only rename variables in context,I put this funciton back
// incase any problem with the new function and we can refer the old one to check the problem.
public static String splitQueryData(PatternMatcher matcher, Pattern pattern, Substitution sub, String value, int numSubs) {
String[] split = value.split("\"");
int i = 0;
String replace = EMPTY;
for (String s : split) {
if (i % 2 == 0) {
replace = s;
if (i != 0) {
if (matcher.contains(value, pattern)) {
replace = split[i].toString();
split[i] = Util.substitute(matcher, pattern, sub, replace, numSubs);
}
}
}
i++;
}
String returnValue = EMPTY;
for (int t = 1; t < split.length; t++) {
if (t % 2 == 0) {
returnValue += split[t];
} else {
returnValue += "\"" + split[t] + "\"";
}
}
return returnValue;
}
// for bug 12594 split "; for bug 29092(it has JUnits)
public static String splitQueryData(String oldName, String newName, String value) {
// example:"drop table "+context.oracle_schema+".\"TDI_26803\""
// >>>>>>>>_*_(const)__ _____*_(varible)_______ __*_(const)___
/**
* <b>NOTE</b>: This [inputString] variable only used to debug, should not use it in product
*/
inputString = value;
final int length = value.length();
// quotaStrings which stores the start and end point for all const strings in the value
LinkedHashMap<Integer, Integer> quotaStrings = new LinkedHashMap<Integer, Integer>();
// List<Point> functionNameAreas = new ArrayList<Point>();
List<FunctionInfo> functions = new ArrayList<FunctionInfo>();
// comment String set
Set<String> commentStringSet = new HashSet<String>();
// get and store all start and end point of const strings
int start = -1;
int end = -2;
char ch;
boolean isInConstString = false;
boolean isInCommentString = false;
Character commentType = null;
for (int i = 0; i < length; i++) {
ch = value.charAt(i);
if (isInCommentString == false && ch == '\"') {
// in case of cases :
// case 1 : [ "select * from " + context.table + " where value = \"context.table\"" ]
// case 2 : [ "select * from " + context.table + " where value = \"\\" + context.table +
// "\\context.table\"" ]
if (isEscapeSequence(value, i)) {
continue;
}
isInConstString = !isInConstString;
// [0 <= start] >> in case the first const String position compute error
// if (0 <= start && end < start) {
// end = i;
// quotaStrings.put(start, end);
// } else {
// start = i;
// }
if (isInConstString) {
start = i;
} else {
end = i;
quotaStrings.put(start, end);
}
} else if (isInConstString == false) {
if (isInCommentString) {
if (commentType != null && commentType.equals('/') && (ch == '\r' || ch == '\n')) {
isInCommentString = false;
commentType = null;
end = i;
} else if (commentType != null && commentType.equals('*') && ch == '/' && value.charAt(i - 1) == '*') {
isInCommentString = false;
commentType = null;
end = i;
}
if (isInCommentString == false) {
quotaStrings.put(start, end);
commentStringSet.add(start + ":" + end); //$NON-NLS-1$
}
} else {
if ((ch == '/' || ch == '*') && 0 < i && (i - 1) != end && value.charAt(i - 1) == '/') {
isInCommentString = true;
commentType = ch;
start = i - 1;
}
}
}
}
{
// in case the value has not complete quota
// exapmle > "select a,context.b from " + context.b + "where value = context.b
// **but** maybe more impossible truth is that
// they write this(context.b) just want to use it as a varible...
// so maybe should not set the string behind the quota as a const by default..
// ---*--- the following code is set the string behind the quota as a const
// if (0 <= start && end < start) {
// end = length - 1;
// quotaStrings.put(start, end);
// }
}
// find the varible string, do replace, then concat them
StringBuffer strBuffer = new StringBuffer();
String subString = null;
int vStart = 0;
int vEnd = 0;
int methodMaxIndex = -1;
vStart = 0;
vEnd = 0;
start = 0;
end = 0;
for (Entry<Integer, Integer> entry : quotaStrings.entrySet()) {
start = entry.getKey();
end = entry.getValue() + 1;
vEnd = start;
if (vStart < vEnd) {
subString = value.substring(vStart, vEnd);
calcMethodArea(subString, value, vStart, functions);
}
vStart = end;
}
vStart = 0;
vEnd = 0;
start = 0;
end = 0;
for (Entry<Integer, Integer> entry : quotaStrings.entrySet()) {
start = entry.getKey();
end = entry.getValue() + 1;
vEnd = start;
if (vEnd <= vStart) {
// const string follow with const string, will be happen like this:
// [String a = "string"/* it's a string*/;]
// get the const string
subString = value.substring(start, end);
if (!commentStringSet.contains(start + ":" + (end - 1)) && start < methodMaxIndex) { //$NON-NLS-1$
subString = subString.replaceAll(oldName, newName);
}
} else {
// get the varible string, do replace, then append it
subString = value.substring(vStart, vEnd);
// calcMaxIndex = calcMethodArea(subString, value, vStart, functions, methodMaxIndex);
if (methodMaxIndex < start) {
methodMaxIndex = FunctionInfo.getMaxIndexForCurrentParentFunction(start, functions);
}
String replacedString = doVaribleReplace(oldName, newName, value, functions, vStart, vEnd);
strBuffer.append(replacedString);
// get the const string
// deal with: context.getProperty("test") + "test"
subString = value.substring(start, end);
if (!commentStringSet.contains(start + ":" + (end - 1)) && start < methodMaxIndex) { //$NON-NLS-1$
FunctionInfo function = FunctionInfo.getParentFunctionFromList(start, end, functions);
Point funcNameArea = function.getNameArea();
String functionName = value.substring(funcNameArea.x, funcNameArea.y);
if (functionName.matches("^globalMap\\..+")) { //$NON-NLS-1$
subString = subString.replaceAll(oldName, newName);
} else {
if (subString.equals("\"" + oldName + "\"")) { //$NON-NLS-1$ //$NON-NLS-2$
subString = "\"" + newName + "\""; //$NON-NLS-1$ //$NON-NLS-2$
}
}
}
}
// append the const string
strBuffer.append(subString);
// update the varible string start point
vStart = end;
}
// in case the last string of the value is a varible string
// then get it, and do replace, finally append it.
if (vStart < length) {
vEnd = length;
String replacedString = doVaribleReplace(oldName, newName, value, functions, vStart, vEnd);
strBuffer.append(replacedString);
}
return strBuffer.toString();
}
/**
* <b>NOTE</b>: This variable only used to debug, should not use it in product
*/
private static String inputString = ""; //$NON-NLS-1$
private static class FunctionInfo {
private Point nameArea;
private Point paramArea;
private List<FunctionInfo> subFunctions = new ArrayList<FunctionInfo>();
public FunctionInfo(Point _nameArea) {
nameArea = _nameArea;
}
public Point getNameArea() {
return this.nameArea;
}
public void setParamArea(Point paramArea) {
this.paramArea = paramArea;
}
public Point getParamArea() {
return this.paramArea;
}
public int getFuncAreaMinIndex() {
return nameArea.x;
}
public int getFuncAreaMaxIndex() {
return paramArea.y;
}
public FunctionInfo getParentFunction(int x, int y) {
FunctionInfo parentFunction = null;
for (FunctionInfo funcInfo : subFunctions) {
int paramX = funcInfo.paramArea.x;
int paramY = funcInfo.paramArea.y;
if (paramX <= x && y <= paramY) {
if (!funcInfo.subFunctions.isEmpty()) {
FunctionInfo retFuncInfo = funcInfo.getParentFunction(x, y);
if (retFuncInfo != null) {
return retFuncInfo;
}
}
return funcInfo;
}
}
int paramX = this.paramArea.x;
int paramY = this.paramArea.y;
if (paramX <= x && y <= paramY) {
parentFunction = this;
}
return parentFunction;
}
public void addSubFunction(FunctionInfo subFunc) {
this.subFunctions.add(subFunc);
}
public List<FunctionInfo> getSubFunctions() {
return this.subFunctions;
}
public static void addFunctionToList(FunctionInfo funcInfo, List<FunctionInfo> functionList) {
if (functionList != null) {
for (FunctionInfo iFuncInfo : functionList) {
FunctionInfo parentFuncInfo = iFuncInfo.getParentFunction(funcInfo.getFuncAreaMinIndex(),
funcInfo.getFuncAreaMaxIndex());
if (parentFuncInfo != null) {
parentFuncInfo.addSubFunction(funcInfo);
return;
}
}
// if can not found, add it to the functionList dirrectly
functionList.add(funcInfo);
}
}
public static FunctionInfo getParentFunctionFromList(int x, int y, List<FunctionInfo> functionList) {
if (functionList != null) {
for (FunctionInfo funcInfo : functionList) {
FunctionInfo parentFunction = funcInfo.getParentFunction(x, y);
if (parentFunction != null) {
return parentFunction;
}
}
}
return null;
}
public static int getMaxIndexForCurrentParentFunction(int index, List<FunctionInfo> functionList) {
int maxIndex = -1;
if (functionList != null) {
for (FunctionInfo funcInfo : functionList) {
Point paramArea = funcInfo.getParamArea();
if (paramArea.x <= index && index <= paramArea.y) {
return paramArea.y;
}
}
}
return maxIndex;
}
public static List<FunctionInfo> getFunctionsInSpecifiedAreaFromList(int x, int y, List<FunctionInfo> functionList) {
List<FunctionInfo> findedList = new ArrayList<FunctionInfo>();
for (FunctionInfo funcInfo : functionList) {
Point nameArea = funcInfo.getNameArea();
if (y < nameArea.y) {
break;
}
if (x <= nameArea.x && nameArea.y <= y) {
findedList.add(funcInfo);
List<FunctionInfo> subFuncs = funcInfo.getSubFunctions();
if (subFuncs != null && !subFuncs.isEmpty()) {
List<FunctionInfo> findedListInSubFuncs = getFunctionsInSpecifiedAreaFromList(x, y, subFuncs);
if (findedListInSubFuncs != null && !findedListInSubFuncs.isEmpty()) {
findedList.addAll(findedListInSubFuncs);
}
}
}
}
return findedList;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
if (getFuncAreaMaxIndex() < getFuncAreaMinIndex()) {
return "not available"; //$NON-NLS-1$
}
return inputString.substring(getFuncAreaMinIndex(), getFuncAreaMaxIndex() + 1);
}
}
/**
* DOC cmeng Comment method "doVaribleReplace".
*
* @param oldName
* @param newName
* @param value
* @param functionNameAreas
* @param vStart
* @param vEnd
*/
private static String doVaribleReplace(String oldName, String newName, String value, List<FunctionInfo> functions,
int vStart, int vEnd) {
if (value.trim().isEmpty()) {
return value;
}
StringBuffer replacedString = new StringBuffer();
int replaceableStart = vStart;
int replaceableEnd = vEnd;
List<FunctionInfo> replaceableFunctions = FunctionInfo.getFunctionsInSpecifiedAreaFromList(vStart, vEnd, functions);
for (FunctionInfo funcInfo : replaceableFunctions) {
Point functionNameArea = funcInfo.getNameArea();
if (vEnd <= functionNameArea.x) {
break;
}
if (functionNameArea.y <= vStart) {
continue;
}
if (replaceableStart < functionNameArea.x) {
replaceableEnd = functionNameArea.x;
String replaceableString = value.substring(replaceableStart, replaceableEnd);
replacedString.append(doReplace(oldName, newName, replaceableString));
replacedString.append(doReplace(oldName, newName, value.substring(functionNameArea.x, functionNameArea.y)));
} else {
replacedString.append(doReplace(oldName, newName, value.substring(functionNameArea.x, functionNameArea.y)));
}
replaceableStart = functionNameArea.y;
}
if (replaceableStart < vEnd) {
String replaceableString = value.substring(replaceableStart, vEnd);
replacedString.append(doReplace(oldName, newName, replaceableString));
}
return replacedString.toString();
}
private static String doReplace(String oldName, String newName, String value) {
if (value.trim().isEmpty()) {
return value;
}
String vOldName = oldName.replaceAll("\\.", "\\\\."); //$NON-NLS-1$ //$NON-NLS-2$
// ((\b\w+\s*\.\s*)+schema(\s*\.\s*\w+)*)|((\b\w+\s*\.\s*)*schema(\s*\.\s*\w+)+)
String regex = "((\\b\\w+\\s*\\.\\s*)+" + vOldName + "\\b)|(\\b" + vOldName + "\\s*\\()"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
// obtain all varibles
String[] split = value.split(regex);
Map<String, String> replacedStrings = new HashMap<String, String>();
StringBuffer returnValue = new StringBuffer();
// replace the variables & store both value of old and new
for (String s : split) {
if (s.contains(oldName)) {
replacedStrings.put(s, s.replaceAll("\\b" + oldName + "\\b", newName)); //$NON-NLS-1$ //$NON-NLS-2$
} else {
replacedStrings.put(s, s);
}
}
if (split.length == 1 && split[0].length() == value.length()) {
returnValue.append(replacedStrings.get(split[0]));
}
// obtain consts & concat the consts with the variables
java.util.regex.Pattern pattern = java.util.regex.Pattern.compile(regex);
Matcher matcher = pattern.matcher(value);
if (matcher.find()) {
int x = matcher.start();
int y = matcher.end();
int curPos = 0;
int valueLength = value.length();
String oldFill = null;
String newFill = null;
String subRegEx = "^" + vOldName + "(\\s*\\.\\s*\\w+)+"; //$NON-NLS-1$ //$NON-NLS-2$
java.util.regex.Pattern subPattern = java.util.regex.Pattern.compile(subRegEx);
while (true) {
if (curPos == valueLength) {
break;
}
if (curPos < x) {
oldFill = value.substring(curPos, x);
if ((newFill = replacedStrings.get(oldFill)) != null) {
returnValue.append(newFill);
} else {
returnValue.append(oldFill);
}
curPos = x;
continue;
}
String matchedString = matcher.group();
Matcher subMatcher = subPattern.matcher(matchedString);
if (subMatcher.find()) {
returnValue.append(matchedString.replaceFirst(vOldName, newName));
} else {
returnValue.append(matchedString);
}
curPos = y;
if (!matcher.find()) {
x = valueLength;
} else {
x = matcher.start();
y = matcher.end();
}
}
}
return returnValue.toString();
}
/**
* DOC cmeng Comment method "isEscapeSequence".
*
* @param value
* @param i
* @return
*/
private static boolean isEscapeSequence(String value, int i) {
boolean isEscapeSequence = false;
for (int index = i; 0 < index; index--) {
if (value.charAt(index - 1) == '\\') {
isEscapeSequence = !isEscapeSequence;
} else {
break;
}
}
return isEscapeSequence;
}
private static int calcMethodArea(String varibleString, String wholeString, int beginIndex, List<FunctionInfo> functions) {
// globalMap.get(...)
// String regex = "\\b\\S*\\s*\\.\\s*\\S*\\s*\\(\\z"; //$NON-NLS-1$
// maybe get(...) also is target
String regex = "\\b[\\w\\.]*?\\s*\\("; //$NON-NLS-1$
java.util.regex.Pattern pattern = java.util.regex.Pattern.compile(regex);
Matcher matcher = pattern.matcher(varibleString);
int i = 0;
int currentMaxIndex = i;
while (matcher.find()) {
boolean isInQuota = false;
boolean isInComment = false;
Character commentType = null;
int parenthesisNum = 0;
int lastCommentEndIndex = -1;
int matchedStart = matcher.start();
int matchedEnd = matcher.end();
Point functionNameArea = new Point(beginIndex + matchedStart, beginIndex + matchedEnd);
FunctionInfo funcInfo = new FunctionInfo(functionNameArea);
Point functionParamArea = new Point(-1, -1);
funcInfo.setParamArea(functionParamArea);
i = beginIndex + matchedEnd;
functionParamArea.x = i;
for (; i < wholeString.length(); i++) {
char ch = wholeString.charAt(i);
if (isInComment == false && ch == '\"' && !isEscapeSequence(wholeString, i)) {
isInQuota = !isInQuota;
continue;
} else if (isInQuota) {
continue;
} else if (isInQuota == false) {
if (isInComment) {
if (commentType != null && commentType.equals('/') && (ch == '\r' || ch == '\n')) {
isInComment = false;
commentType = null;
lastCommentEndIndex = i;
} else if (commentType != null && commentType.equals('*') && ch == '/'
&& wholeString.charAt(i - 1) == '*') {
isInComment = false;
commentType = null;
lastCommentEndIndex = i;
}
continue;
} else {
if ((ch == '/' || ch == '*') && 0 < i && (i - 1) != lastCommentEndIndex
&& wholeString.charAt(i - 1) == '/') {
isInComment = true;
commentType = ch;
continue;
}
}
}
if (ch == '(') {
parenthesisNum++;
} else if (ch == ')') {
parenthesisNum--;
}
if (parenthesisNum < 0) {
break;
}
}
functionParamArea.y = i;
FunctionInfo.addFunctionToList(funcInfo, functions);
if (currentMaxIndex < i) {
currentMaxIndex = i;
}
}
return currentMaxIndex;
}
public static boolean isUseData(final IElementParameter param, final String name) {
if (param == null || name == null) {
return false;
}
if (param.getValue() instanceof String) { // for TEXT / MEMO etc..
String value = (String) param.getValue();
if (ParameterValueUtil.valueContains(value, name)) {
return true;
}
} else if (param.getValue() instanceof List) { // for TABLE
List<Map<String, Object>> tableValues = (List<Map<String, Object>>) param.getValue();
for (Map<String, Object> line : tableValues) {
for (String key : line.keySet()) {
Object cellValue = line.get(key);
if (cellValue instanceof String) { // cell is text so
// test data
if (ParameterValueUtil.valueContains((String) cellValue, name)) {
return true;
}
}
}
}
}
return false;
}
@SuppressWarnings("unchecked")
public static boolean isUseData(final ElementParameterType param, final String name) {
if (param == null || name == null) {
return false;
}
if (param.getField().equals(EParameterFieldType.TABLE.getName())) { // for TABLE
EList elementValue = param.getElementValue();
if (elementValue != null) {
for (ElementValueType valueType : (List<ElementValueType>) elementValue) {
if (valueType.getValue() != null) { // cell is text so
// test data
if (ParameterValueUtil.valueContains(valueType.getValue(), name)) {
return true;
}
}
}
}
} else {
String value = param.getValue();
if (value != null && ParameterValueUtil.valueContains(value, name)) {
return true;
}
}
return false;
}
public static boolean valueContains(String value, String toTest) {
if (value.contains(toTest)) {
Perl5Matcher matcher = new Perl5Matcher();
Perl5Compiler compiler = new Perl5Compiler();
Pattern pattern;
try {
pattern = compiler.compile(getQuotePattern(toTest));
if (matcher.contains(value, pattern)) {
return true;
}
} catch (MalformedPatternException e) {
throw new RuntimeException(e);
}
}
return false;
}
private static String getQuotePattern(String toTest) {
final String prefix = "\\b("; //$NON-NLS-1$
String suffix = ")\\b"; //$NON-NLS-1$
if (!ContextParameterUtils.isContainContextParam(toTest)) { // context parameter renamed
suffix = ")(\\b|\\_)"; //$NON-NLS-1$
}
return prefix + UpdateContextVariablesHelper.replaceSpecialChar(toTest) + suffix;
}
public static String getValue4Doc(ContextParameterType contextParam) {
if (contextParam != null) {
String docValue = contextParam.getValue();
if (docValue != null) {
if (isHidePassword() && PasswordEncryptUtil.isPasswordType(contextParam.getType())) {
// use the raw value to display.
docValue = PasswordEncryptUtil.getPasswordDisplay(contextParam.getRawValue());
}
return docValue;
}
}
return EMPTY;
}
public static String getValue4Doc(IContextParameter contextParam) {
if (contextParam != null) {
String docValue = contextParam.getValue();
if (docValue != null) {
if (PasswordEncryptUtil.isPasswordType(contextParam.getType())) {
if (isHidePassword()) { // if hide will display the *
docValue = PasswordEncryptUtil.getPasswordDisplay(docValue.toString());
} else { // the value has been raw, so need encrypt it like the ContextParameterType.
String encryptValue = getEncryptValue(contextParam);
if (encryptValue != null) {
docValue = encryptValue;
}
}
}
return docValue;
}
}
return EMPTY;
}
public static String getEncryptValue(IContextParameter contextParam) {
if (contextParam != null) {
String docValue = contextParam.getValue();
if (docValue != null) {
String encryptValue = CryptoHelper.getDefault().encrypt(docValue);
if (encryptValue != null) {
return encryptValue;
}
}
}
return null;
}
public static Object getValue4Doc(IElementParameter param) {
if (param != null) {
Object docValue = param.getValue();
if (docValue != null) {
if ((param.getRepositoryValue() != null && param.getRepositoryValue().toUpperCase().contains("PASSWORD") //$NON-NLS-1$
|| EParameterFieldType.PASSWORD.equals(param.getFieldType()))//
&& !ContextParameterUtils.containContextVariables((String) docValue)) {
if (isHidePassword()) { // if hide will display the *
docValue = PasswordEncryptUtil.getPasswordDisplay(docValue.toString());
} else { // the value has been raw, so need encrypt it like the ElementParameterType.
String encryptValue = getEncryptValue(param);
if (encryptValue != null) {
docValue = encryptValue;
}
}
}
return docValue;
}
}
return EMPTY;
}
public static String getEncryptValue(IElementParameter param) {
if (param != null) {
Object docValue = param.getValue();
if (docValue != null && docValue instanceof String) {
String encryptValue = CryptoHelper.getDefault().encrypt(docValue.toString());
if (encryptValue != null) {
return encryptValue;
}
}
}
return null;
}
public static String getValue4Doc(ElementParameterType param) {
if (param != null) {
String docValue = param.getValue();
if (docValue != null) {
if (EParameterFieldType.PASSWORD.getName().equals(param.getField()) && isHidePassword()
&& !ContextParameterUtils.containContextVariables(docValue)) {
// the value has been raw, so just get dispaly value.
docValue = PasswordEncryptUtil.getPasswordDisplay(param.getRawValue());
}
return docValue;
}
}
return EMPTY;
}
public static boolean isHidePassword() {
Project currentProject = ProjectManager.getInstance().getCurrentProject();
if (currentProject != null) {
return currentProject.getEmfProject().isHidePassword();
}
return false;
}
/**
* add \ before \ and " in the string.
*
* @param str
* @return
*/
public static String handleSpecialCharacters(String str) {
// handle backlash first, then handle double quotation mark
String result = replaceAll(str, "\\", "\\\\"); //$NON-NLS-1$ //$NON-NLS-2$
result = replaceAll(result, "\"", "\\\""); //$NON-NLS-1$ //$NON-NLS-2$
return result;
}
private static String replaceAll(String str, String regex, String replacement) {
List<String> list = new ArrayList<String>();
splitString(str, list, regex);
return StringUtils.join(list.toArray(new String[list.size()]), replacement);
}
private static void splitString(String str, List<String> list, String regex) {
int indexOf = str.indexOf(regex);
if (indexOf > -1) {
list.add(str.substring(0, indexOf));
splitString(str.substring(indexOf + 1, str.length()), list, regex);
} else {
list.add(str);
}
}
}

View File

@@ -1,22 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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.prefs;
/**
* constant from org.eclipse.ui.internal.ide.IDEInternalPreferences;
*/
public class IDEInternalPreferences {
// (boolean) Prompt for exit confirmation when last window closed.
public static final String EXIT_PROMPT_ON_CLOSE_LAST_WINDOW = "EXIT_PROMPT_ON_CLOSE_LAST_WINDOW"; //$NON-NLS-1$
}

View File

@@ -1,24 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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.prefs;
/**
* constant from org.eclipse.ui.internal.ide.IDEWorkbenchPlugin
*/
public class IDEWorkbenchPlugin {
/**
* The IDE workbench plugin ID.
*/
public static final String IDE_WORKBENCH = "org.eclipse.ui.ide"; //$NON-NLS-1$
}

View File

@@ -1,21 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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.prefs;
/**
* Constants from org.eclipse.ui.internal.intro.impl.html.IIntroHTMLConstants;
*/
public class IIntroHTMLConstants {
public static final String ATTRIBUTE_ID = "id"; //$NON-NLS-1$
}

View File

@@ -1,120 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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.conf;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import org.apache.commons.lang.ArrayUtils;
import org.apache.log4j.Logger;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import org.osgi.framework.Bundle;
import org.osgi.framework.FrameworkUtil;
/**
* created by ycbai on Jul 31, 2014 Detailled comment
*
* <p>
* This class is used to resolve the default configuration file to get the default value. The configuration file must be
* the json format. You can use {@link #getDefaultConfValue(String... args)} method to get the default value. Subclasses
* should give their special configuration file to make it work.
* </p>
*
*/
public abstract class DefaultConfsManager {
private Logger logger = Logger.getLogger(getClass());
private String confFilePath;
private Object confObj;
protected DefaultConfsManager(String confFilePath) {
this.confFilePath = confFilePath;
}
/**
* DOC ycbai Comment method "getDefaultConfValue".
*
* @param args are the arguments which used to find the default config value.
* @return the default configuration value.
*/
public String getDefaultConfValue(String... args) {
Object val = getValue(args);
if (val == null) {
return null;
}
return String.valueOf(val);
}
private Object getValue(String... args) {
Object value = null;
if (args == null) {
return null;
}
try {
if (confObj == null) {
initConfObj();
}
value = getValue(confObj, args);
} catch (Exception e) {
logger.warn("Fail to get the default value from \"" + confFilePath + "\". Please check it.", e); //$NON-NLS-1$ //$NON-NLS-2$
}
return value;
}
private static Object getValue(Object object, String... args) {
if (args.length > 0) {
String arg = args[0];
Object obj = ((JSONObject) object).get(arg);
String[] newArgs = (String[]) ArrayUtils.remove(args, 0);
return getValue(obj, newArgs);
} else {
return object;
}
}
private void initConfObj() throws IOException, ParseException {
Bundle b = FrameworkUtil.getBundle(getClass());
URL url = FileLocator.toFileURL(FileLocator.find(b, new Path(confFilePath), null));
if (url != null) {
FileInputStream in = null;
BufferedReader reader = null;
try {
in = new FileInputStream(url.getPath());
reader = new BufferedReader(new InputStreamReader(in));
JSONParser parser = new JSONParser();
Object fileObj = parser.parse(reader);
confObj = ((JSONObject) fileObj).get(getRootElement());
} finally {
if (in != null) {
in.close();
}
if (reader != null) {
reader.close();
}
}
}
}
protected abstract String getRootElement();
}

View File

@@ -1,41 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2010 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.core.service;
import java.util.List;
import org.eclipse.ui.IEditorPart;
import org.talend.core.IService;
import org.talend.core.model.general.Project;
import org.talend.core.model.properties.Item;
import org.talend.core.model.repository.IRepositoryViewObject;
import org.talend.repository.model.IRepositoryNode;
import org.talend.repository.model.nodes.IProjectRepositoryNode;
/**
* DOC zwzhao class global comment. Detailled comment
*/
public interface IStormProcessService extends IService {
boolean needStormProcess();
IRepositoryNode getRootNode(IProjectRepositoryNode projectNode);
public boolean collectStandardProcessNode(List<String> filteredContents, Object node);
public boolean isStormItem(Item item);
public boolean isStormEditor(IEditorPart editorPart);
public List<IRepositoryViewObject> getStormProcesses(Project project);
}

View File

@@ -1,37 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.core.service;
import org.eclipse.core.resources.IResource;
import org.eclipse.swt.dnd.DropTargetEvent;
import org.talend.core.IService;
import org.talend.core.model.properties.Item;
import org.talend.core.model.repository.ERepositoryObjectType;
/**
* created by wchen on 2013-8-16 Detailled comment
*
*/
public interface ITransformService extends IService {
public boolean isTransformItem(Item item);
public boolean isTransformType(ERepositoryObjectType type);
public boolean isTransformResource(IResource resource);
public boolean isSampleFileResource(IResource resource);
public boolean performDrop(DropTargetEvent event, IResource targetNode, int operation, Object data);
}

View File

@@ -1,31 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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;
import java.util.Map;
import org.talend.core.IProviderService;
import org.talend.core.model.process.INode;
import org.talend.core.model.repository.ERepositoryObjectType;
/**
* DOC wanghong class global comment. Detailled comment
*/
public interface IJSONProviderService extends IProviderService {
public boolean isJSONNode(final INode node);
public boolean isRepositorySchemaLine(INode node, Map<String, Object> lineValue);
public ERepositoryObjectType getJSONRepositoryType();
}

View File

@@ -1,55 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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.branding;
import java.net.URL;
import org.talend.core.runtime.i18n.Messages;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
/**
* DOC ggu class global comment. Detailled comment
*/
public abstract class AbstractCommonBrandingService implements IBrandingService {
@Override
public String getStartingBrowserId() {
// default is StartingBrowser implement in org.talend.rcp
return "org.talend.rcp.intro.starting.StartingBrowser"; //$NON-NLS-1$
}
@Override
public URL getStartingHtmlURL() {
// for example, if set the startingPage html in the service bundle in "content/startingPage.html"
// return FrameworkUtil.getBundle(this.getClass()).getEntry("content/startingPage.html");
return null;
}
@Override
public void createStartingContent(String id, Element parent) {
Document dom = parent.getOwnerDocument();
if (StartingConstants.PRODUCT_NAME.equals(id)) {
parent.appendChild(dom.createTextNode(getProductName()));
} else if (StartingConstants.OPTION_NAME.equals(id)) {
parent.appendChild(dom.createTextNode(getOptionName()));
}
}
@Override
public String getRoutineLicenseHeader(String version) {
String contents = Messages.getString("AbstractBrandingService.routines_license_header_content2014", //$NON-NLS-1$
this.getFullProductName(), version);
return contents;
}
}

View File

@@ -1,48 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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.utils;
import java.io.File;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.IPath;
import org.talend.commons.bridge.ReponsitoryContextBridge;
import org.talend.repository.model.RepositoryConstants;
/**
* created by msjian on 2014-1-2 Detailled comment
*
*/
public final class WorkspaceUtils {
public static File ifolderToFile(IFolder ifolder) {
IPath location = ifolder.getLocation() == null ? ReponsitoryContextBridge.getRootProject().getLocation()
.append(ifolder.getFullPath()) : ifolder.getLocation();
return location.toFile();
}
/**
* check the file name whether it contains special characters.
*
* @param fileName
* @return boolean: OK means not contains
*/
public static boolean checkNameIsOK(String fileName) {
for (String str : RepositoryConstants.ITEM_FORBIDDEN_IN_LABEL) {
if (org.apache.commons.lang.StringUtils.contains(fileName, str)) {
return false;
}
}
return true;
}
}

View File

@@ -1,21 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.designer.codegen;
import org.talend.core.model.process.IProcess;
public interface ICamelCodeGeneratorService extends ICodeGeneratorService {
boolean validProcess(IProcess process);
}

View File

@@ -1,24 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2010 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.designer.codegen;
import org.talend.core.model.process.IProcess;
/**
* DOC zwzhao class global comment. Detailled comment
*/
public interface IStormCodeGeneratorService extends ICodeGeneratorService {
boolean validProcess(IProcess process);
}

View File

@@ -1,33 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2015 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.designer.core;
import org.talend.commons.exception.PersistenceException;
import org.talend.core.IService;
import org.talend.core.model.properties.Item;
import org.talend.core.model.properties.ProcessItem;
import org.talend.core.model.repository.IRepositoryEditorInput;
/**
* ESB service for UI part; ICamelDesignerCoreService should also be usable for commandline, should not add UI related
* codes.
*/
public interface ICamelDesignerCoreUIService extends IService {
public boolean isInstanceofCamelRoutes(Item item);
public IRepositoryEditorInput getRouteEditorInput(ProcessItem processItem, boolean load, Boolean lastVersion)
throws PersistenceException;
public String getRouteEditorId(ProcessItem processItem);
}

View File

@@ -1,124 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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.migration;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.runtime.IConfigurationElement;
import org.osgi.framework.FrameworkUtil;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.model.update.extension.UpdateManagerProviderReader;
import org.talend.core.utils.RegistryReader;
/**
* Parses the Eclipse extension point registry to construct a Migration Task extension map using the
* org.talend.migration.task.type.extension extension point
*
*/
public class MigrationTaskExtensionEPReader extends RegistryReader {
/**
*
*/
private static final String TYPE_ATTRIBUTE = "type"; //$NON-NLS-1$
/**
*
*/
private static final String EXTENDED_TYPE_ATTRIBUTE = "extended_type"; //$NON-NLS-1$
private static final String MIGRATION_TASK_TYPE_EXTENSION_EXTENTION_POINT = "org.talend.migration.task.type.extension"; //$NON-NLS-1$
private static final String TYPE_EXTENTION_ELEMENT_NAME = "TypeExtension"; //$NON-NLS-1$
private Map<ERepositoryObjectType, List<ERepositoryObjectType>> migrationTaskExtensionsMap = new HashMap<ERepositoryObjectType, List<ERepositoryObjectType>>();
/**
* DOC sgandon MigrationTaskExtensionEPReader constructor comment.
*
* @param aPluginId
* @param anExtensionPoint
*/
public MigrationTaskExtensionEPReader() {
super(FrameworkUtil.getBundle(UpdateManagerProviderReader.class).getSymbolicName(),
MIGRATION_TASK_TYPE_EXTENSION_EXTENTION_POINT);
readRegistry();
}
/*
* (non-Javadoc)
*
* @see org.talend.core.utils.RegistryReader#readElement(org.eclipse.core.runtime.IConfigurationElement)
*/
@Override
protected boolean readElement(final IConfigurationElement element) {
if (TYPE_EXTENTION_ELEMENT_NAME.equals(element.getName())) {
String extendedTypeStr = element.getAttribute(EXTENDED_TYPE_ATTRIBUTE);
String typeStr = element.getAttribute(TYPE_ATTRIBUTE);
ERepositoryObjectType extendedType = ERepositoryObjectType.getType(extendedTypeStr);
ERepositoryObjectType type = ERepositoryObjectType.getType(typeStr);
if (extendedType == null) {
logError(element, "Could not find the EReositoryObjectType associated to the attribute extended_type : " //$NON-NLS-1$
+ extendedTypeStr);
return true;
}
if (type == null) {
logError(element, "Could not find the EReositoryObjectType associated to the attribute type : " + typeStr); //$NON-NLS-1$
return true;
}
List<ERepositoryObjectType> extensionList = migrationTaskExtensionsMap.get(extendedType);
if (extensionList == null) {// no existing list so create one
extensionList = new ArrayList<ERepositoryObjectType>();
extensionList.add(type);
migrationTaskExtensionsMap.put(extendedType, extensionList);
} else {// extensions already exists
extensionList.add(type);
}
return true;
}// else return false
return false;
}
/**
* return the Map of all extensiion of all type.
*
* @return
*/
public Map<ERepositoryObjectType, List<ERepositoryObjectType>> getMigrationTaskExtensions() {
return migrationTaskExtensionsMap;
}
/**
*
*
* @return the unique set of ERepositoryObjectType that extends an existing collection of ERepositoryObjectType for
* the migration task, may be emty but never null.
*/
public Set<ERepositoryObjectType> getObjectTypeExtensions(Collection<ERepositoryObjectType> extendedObjects) {
HashSet<ERepositoryObjectType> extensions = new HashSet<ERepositoryObjectType>();
for (ERepositoryObjectType extendedObj : extendedObjects) {
List<ERepositoryObjectType> listOfExtensions = migrationTaskExtensionsMap.get(extendedObj);
if (listOfExtensions != null) {
extensions.addAll(listOfExtensions);
}
}
return extensions;
}
}

View File

@@ -1,286 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.repository.ui.dialog;
import java.lang.reflect.InvocationTargetException;
import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.swt.widgets.Shell;
import org.talend.core.runtime.i18n.Messages;
/**
* created by cmeng on Nov 21, 2014 Detailled comment
*
*/
public abstract class AProgressMonitorDialogWithCancel<T> extends ProgressMonitorDialog {
public static final int ENDLESS_WAIT_TIME = -1;
public static final int DEFAULT_WAIT_TIME = 60;
private ARunnableWithProgressCancel<T> runnableWithCancel;
private boolean isUserCancelled = false;
/**
* DOC cmeng ProgressMonitorDialogWithCancel constructor comment.
*
* @param parent
*/
public AProgressMonitorDialogWithCancel(Shell parent) {
super(parent);
}
abstract protected T runWithCancel(IProgressMonitor monitor) throws Throwable;
@Override
@Deprecated
public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException,
InterruptedException {
throw new InvocationTargetException(new Throwable("Can not use this method, you should use another run method")); //$NON-NLS-1$
}
public void run() throws InvocationTargetException, InterruptedException {
run(null, null, true, DEFAULT_WAIT_TIME);
}
public void run(String executeMessage, String waitingFinishMessage, boolean needWaitingProgressJob)
throws InvocationTargetException, InterruptedException {
run(executeMessage, waitingFinishMessage, needWaitingProgressJob, DEFAULT_WAIT_TIME);
}
public void run(String executeMessage, String waitingFinishMessage, boolean needWaitingProgressJob, int timeout)
throws InvocationTargetException, InterruptedException {
runnableWithCancel = new ARunnableWithProgressCancel<T>() {
@Override
protected T runnableWithCancel(IProgressMonitor monitor) throws Throwable {
return runWithCancel(monitor);
}
};
if (executeMessage != null) {
runnableWithCancel.setExecuteMessage(executeMessage);
}
if (waitingFinishMessage != null) {
runnableWithCancel.setWaitingFinishMessage(waitingFinishMessage);
}
runnableWithCancel.setNeedWaitingProgressJob(needWaitingProgressJob);
runnableWithCancel.setTimeout(timeout);
super.run(true, true, runnableWithCancel);
}
@Override
protected void cancelPressed() {
isUserCancelled = true;
if (runnableWithCancel != null) {
runnableWithCancel.kill();
}
super.cancelPressed();
}
public boolean isUserCanncelled() {
return isUserCancelled;
}
public T getExecuteResult() {
if (runnableWithCancel != null) {
return runnableWithCancel.getExecuteResult();
} else {
return null;
}
}
public Throwable getExecuteException() {
if (runnableWithCancel != null) {
return runnableWithCancel.getExecuteException();
} else {
return null;
}
}
private static abstract class ARunnableWithProgressCancel<T> implements IRunnableWithProgress {
protected FutureTask<T> futureTask;
protected Thread executeThread;
protected ThreadGroup threadGroup;
protected T executeResult;
protected Throwable executeException;
protected String executeMessage = Messages.getString("ProgressMonitorDialogWithCancel.executeMessage.default"); //$NON-NLS-1$
protected String waitingFinishMessage = Messages
.getString("ProgressMonitorDialogWithCancel.waitingFinishMessage.default"); //$NON-NLS-1$
protected int timeout = 30;
volatile boolean kill = false;
boolean needWaitingProgressJob = true;
public ARunnableWithProgressCancel() {
}
abstract protected T runnableWithCancel(IProgressMonitor monitor) throws Throwable;
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
public final void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
futureTask = new FutureTask<T>(new Callable<T>() {
@Override
public T call() throws Exception {
T result = null;
try {
result = runnableWithCancel(monitor);
} catch (Throwable e) {
executeException = e;
}
return result;
}
});
int iTimeout;
boolean canGain = true;
if (ENDLESS_WAIT_TIME == timeout || timeout <= 0) {
iTimeout = 1;
canGain = false;
monitor.beginTask(executeMessage, IProgressMonitor.UNKNOWN);
} else {
iTimeout = timeout * 2;
monitor.beginTask(executeMessage, iTimeout);
}
threadGroup = new ThreadGroup("ARunnableWithProgressCancel"); //$NON-NLS-1$
executeThread = new Thread(threadGroup, futureTask);
executeThread.start();
for (int i = 0; i < iTimeout; i = canGain ? i + 1 : i) {
try {
if (kill) {
break;
}
monitor.worked(1);
executeResult = futureTask.get(500, TimeUnit.MILLISECONDS);
break;
} catch (TimeoutException timeoutException) {
continue;
} catch (Throwable e) {
executeException = e;
break;
}
}
if (!kill && executeException == null && executeResult == null) {
executeException = new TimeoutException(Messages.getString("ProgressMonitorDialogWithCancel.executeTimeout")); //$NON-NLS-1$
kill();
}
monitor.done();
}
/**
* DOC cmeng Comment method "addJob".
*
* @throws InterruptedException
*/
private void addJob() {
if (!needWaitingProgressJob) {
return;
}
StackTraceElement stElement = null;
StackTraceElement stackTraceElements[] = executeThread.getStackTrace();
if (stackTraceElements != null && 0 < stackTraceElements.length) {
stElement = stackTraceElements[0];
}
String currentMethod;
String title = ""; //$NON-NLS-1$
if (stElement != null) {
currentMethod = stElement.getClassName() + "." + stElement.getMethodName(); //$NON-NLS-1$
title = waitingFinishMessage
+ Messages
.getString(
"ProgressMonitorDialogWithCancel.CheckingConnectionJob.waitingFinish", new Object[] { currentMethod }); //$NON-NLS-1$
} else {
title = waitingFinishMessage
+ Messages.getString("ProgressMonitorDialogWithCancel.CheckingConnectionJob.emptyWaitingfinish"); //$NON-NLS-1$
}
CheckingConnectionJob<T> checkingConnectionJob = new CheckingConnectionJob<T>(title, futureTask);
checkingConnectionJob.setUser(false);
checkingConnectionJob.setPriority(Job.DECORATE);
checkingConnectionJob.schedule();
}
public void setNeedWaitingProgressJob(boolean need) {
needWaitingProgressJob = need;
}
public void setExecuteMessage(String exeMsg) {
executeMessage = exeMsg;
}
public void setWaitingFinishMessage(String waitingMsg) {
waitingFinishMessage = waitingMsg;
}
public T getExecuteResult() {
return executeResult;
}
public Throwable getExecuteException() {
return executeException;
}
public void setTimeout(int _timeout) {
timeout = _timeout;
}
public void kill() {
threadGroup.interrupt();
kill = true;
addJob();
}
}
private static class CheckingConnectionJob<T> extends Job {
protected FutureTask<T> futureTask;
public CheckingConnectionJob(String name, FutureTask<T> _futureTask) {
super(name);
this.futureTask = _futureTask;
}
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
futureTask.get();
} catch (Throwable e) {
// nothing need to do since all will be done in ARunnableWithProgressCancel
}
return Status.OK_STATUS;
}
}
}

View File

@@ -1,248 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.core.model.components;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.gef.palette.PaletteContainer;
import org.eclipse.gef.palette.PaletteDrawer;
import org.eclipse.gef.palette.PaletteEntry;
import org.eclipse.gef.palette.PaletteRoot;
import org.talend.commons.ui.gmf.util.DisplayUtils;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.service.IDesignerCoreUIService;
import org.talend.core.ui.CoreUIPlugin;
import org.talend.designer.core.IPaletteFilter;
import org.talend.repository.model.ComponentsFactoryProvider;
/**
* DOC smallet class global comment. Detailled comment <br/>
*
* TODO SML/NRO Move into org.talend.core ?
*
* $Id: talend.epf 1 2006-09-29 17:06:40 +0000 (ven., 29 sept. 2006) nrousseau $
*
*/
public class ComponentPaletteUtilities {
private static final String FAMILY_HIER_SEPARATOR = "/"; //$NON-NLS-1$
private static final String FAMILY_SPEARATOR = "--FAMILY--"; //$NON-NLS-1$
private static PaletteRoot paletteRoot;
private static List<PaletteEntry> extraPaletteEntry;
private static boolean skipUpdatePalette;
private static boolean faState = false;
// public static int histate = 0;
private static boolean jobletFlag = false;
public static int histate = 0;
public static PaletteRoot getPaletteRoot() {
if (paletteRoot == null) {
paletteRoot = CoreUIPlugin.getDefault().getDesignerCoreUIService().createEmptyPalette();
}
return paletteRoot;
}
private static void setExtraEntryVisible(boolean visible) {
jobletFlag = visible;
if (extraPaletteEntry != null) {
for (PaletteEntry entry : extraPaletteEntry) {
entry.setVisible(visible);
}
}
}
public static void setSkipUpdatePalette(boolean skipUpdatePalette) {
ComponentPaletteUtilities.skipUpdatePalette = skipUpdatePalette;
}
public static void updatePalette() {
if (jobletFlag == true) {
setExtraEntryVisible(true);
}
if (skipUpdatePalette) {
return;
}
DisplayUtils.getDisplay().syncExec(new Runnable() {
@Override
public void run() {
IComponentsFactory components = ComponentsFactoryProvider.getInstance();
final IDesignerCoreUIService designerCoreUIService = CoreUIPlugin.getDefault().getDesignerCoreUIService();
if (paletteRoot != null) {
List oldRoots = new ArrayList(paletteRoot.getChildren());
for (Iterator it = oldRoots.iterator(); it.hasNext();) {
Object obj = it.next();
if (obj instanceof TalendPaletteGroup) {
continue;
}
it.remove();
}
paletteRoot.setChildren(oldRoots);
paletteRoot = designerCoreUIService.createPalette(components, paletteRoot);
} else {
paletteRoot = designerCoreUIService.createPalette(components);
}
if (extraPaletteEntry == null || extraPaletteEntry.size() == 0) {
extraPaletteEntry = designerCoreUIService.createJobletEtnry();
}
}
});
}
public static void updatePalette(final boolean isFavorite) {
// if (jobletFlag == true) {
// setExtraEntryVisible(true);
// }
faState = isFavorite;
if (skipUpdatePalette) {
return;
}
DisplayUtils.getDisplay().syncExec(new Runnable() {
@Override
public void run() {
IComponentsFactory components = ComponentsFactoryProvider.getInstance();
final IDesignerCoreUIService designerCoreUIService = CoreUIPlugin.getDefault().getDesignerCoreUIService();
if (paletteRoot != null) {
List oldRoots = new ArrayList(paletteRoot.getChildren());
for (Iterator it = oldRoots.iterator(); it.hasNext();) {
Object obj = it.next();
if (obj instanceof TalendPaletteGroup) {
continue;
}
it.remove();
}
paletteRoot.setChildren(oldRoots);
paletteRoot = designerCoreUIService.createPalette(components, paletteRoot, isFavorite);
} else {
paletteRoot = designerCoreUIService.createPalette(components, isFavorite);
}
if (extraPaletteEntry == null || extraPaletteEntry.size() == 0) {
extraPaletteEntry = designerCoreUIService.createJobletEtnry();
}
}
});
}
/**
* yzhang Comment method "filterPalette".
*
* @param filer
*/
public static void filterPalette(String filer) {
CoreUIPlugin.getDefault().getDesignerCoreUIService().setPaletteFilter(filer);
if (faState) {
updatePalette(true);
} else {
updatePalette(false);
}
markEmptyDrawer(paletteRoot);
emptyEntry.clear();
recordEmptyDrawer(paletteRoot);
removeEmptyDrawer();
}
private static List<PaletteEntry> emptyEntry = new ArrayList<PaletteEntry>();
/**
* yzhang Comment method "removeEmptyDrawer".
*/
private static void removeEmptyDrawer() {
for (PaletteEntry entry : emptyEntry) {
PaletteContainer container = entry.getParent();
if (container != null) {
container.remove(entry);
}
}
}
/**
* yzhang Comment method "recordEmptyDrawer".
*
* @param entry
*/
private static void recordEmptyDrawer(PaletteEntry entry) {
if (entry instanceof PaletteRoot) {
List<PaletteEntry> entries = ((PaletteRoot) entry).getChildren();
for (PaletteEntry paletteEntry : entries) {
if (paletteEntry instanceof PaletteDrawer) {
recordEmptyDrawer(paletteEntry);
}
}
} else if (entry instanceof PaletteDrawer) {
PaletteDrawer drawer = (PaletteDrawer) entry;
if (drawer instanceof IPaletteFilter && ((IPaletteFilter) entry).isFiltered()) {
emptyEntry.add(entry);
} else {
List children = drawer.getChildren();
for (Object obj : children) {
recordEmptyDrawer((PaletteEntry) obj);
}
}
}
}
/**
* yzhang Comment method "filterEmptyDrawer".
*
* @param entry
*/
private static void markEmptyDrawer(PaletteEntry entry) {
if (entry instanceof PaletteRoot) {
List<PaletteEntry> entries = ((PaletteRoot) entry).getChildren();
for (PaletteEntry paletteEntry : entries) {
if (paletteEntry instanceof PaletteDrawer) {
markEmptyDrawer(paletteEntry);
}
}
} else if (entry instanceof PaletteDrawer) {
PaletteDrawer drawer = (PaletteDrawer) entry;
for (Object obj : drawer.getChildren()) {
markEmptyDrawer((PaletteEntry) obj);
}
return;
}
PaletteEntry parentEntry = entry.getParent();
if (parentEntry instanceof IPaletteFilter) {
((IPaletteFilter) parentEntry).setFiltered(false);
}
}
/**
* DOC guanglong.du Comment method "updateFromRepositoryType".
*
* @param itemType
*/
public static void updateFromRepositoryType(ERepositoryObjectType itemType) {
updatePalette(faState);
setExtraEntryVisible(itemType.equals(ERepositoryObjectType.JOBLET));
}
}

View File

@@ -1,241 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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.componentsettings;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.eclipse.emf.common.util.EList;
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.context.Context;
import org.talend.core.context.RepositoryContext;
import org.talend.core.model.components.ComponentCategory;
import org.talend.core.model.components.EComponentType;
import org.talend.core.model.components.IComponent;
import org.talend.core.model.general.Project;
import org.talend.core.model.properties.ComponentSetting;
import org.talend.core.runtime.CoreRuntimePlugin;
import org.talend.repository.model.ComponentsFactoryProvider;
import org.talend.repository.model.IProxyRepositoryFactory;
import org.talend.repository.model.IRepositoryService;
/**
* created by nrousseau on Aug 8, 2014 Detailled comment
*
*/
public class ComponentsSettingsHelper {
/**
* This gives all the components and the families where they're hidden. Components are stored like:
* componentMap.get("tMsgBox").add("hiddenFamily"); paletteTypeMap.put("DI",componentMap);
*
* Components not in this list are visible.
*/
private static Map<String, Map<String, Set<String>>> hiddenComponents;
private static Map<String, Set<String>> displayedFamilies;
private static void initializeHiddenComponents() {
RepositoryContext repositoryContext = (RepositoryContext) CoreRuntimePlugin.getInstance().getContext()
.getProperty(Context.REPOSITORY_CONTEXT_KEY);
if (repositoryContext == null) {
return;
}
Project project = repositoryContext.getProject();
if (project == null) {
return;
}
org.talend.core.model.properties.Project emfProject = project.getEmfProject();
if (emfProject == null) {
return;
}
hiddenComponents = new HashMap<String, Map<String, Set<String>>>();
EList list = emfProject.getComponentsSettings();
for (IComponent component : ComponentsFactoryProvider.getInstance().getComponents()) {
if (component.isTechnical() || component.getComponentType() == EComponentType.JOBLET) {
continue;
}
if (!hiddenComponents.containsKey(component.getPaletteType())) {
hiddenComponents.put(component.getPaletteType(), new HashMap<String, Set<String>>());
}
if (!component.isVisibleInComponentDefinition()) {
hiddenComponents.get(component.getPaletteType()).put(component.getName(), new HashSet<String>());
for (String family : component.getOriginalFamilyName().split(ComponentsFactoryProvider.FAMILY_SEPARATOR_REGEX)) {
hiddenComponents.get(component.getPaletteType()).get(component.getName()).add(family);
}
}
}
for (Object oSetting : list) {
ComponentSetting setting = (ComponentSetting) oSetting;
String paletteType;
String componentName;
if (setting.getName().contains("|")) {
String[] splitted = setting.getName().split(ComponentsFactoryProvider.FAMILY_SEPARATOR_REGEX);
paletteType = splitted[0];
componentName = splitted[1];
} else {
// only for old version of the component settings
// to simplify since the hidden from palette got problem before, we just consider DI only
paletteType = ComponentCategory.CATEGORY_4_DI.getName();
componentName = setting.getName();
}
if (!hiddenComponents.containsKey(paletteType)) {
hiddenComponents.put(paletteType, new HashMap<String, Set<String>>());
}
if (setting.isHidden()) {
if (!hiddenComponents.get(paletteType).containsKey(componentName)) {
hiddenComponents.get(paletteType).put(componentName, new HashSet<String>());
}
for (String family : setting.getFamily().split(ComponentsFactoryProvider.FAMILY_SEPARATOR_REGEX)) {
hiddenComponents.get(paletteType).get(componentName).add(family);
}
} else {
if (hiddenComponents.get(paletteType).containsKey(componentName)) {
for (String family : setting.getFamily().split(ComponentsFactoryProvider.FAMILY_SEPARATOR_REGEX)) {
hiddenComponents.get(paletteType).get(componentName).remove(family);
}
if (hiddenComponents.get(paletteType).get(componentName).isEmpty()) {
hiddenComponents.get(paletteType).remove(componentName);
}
}
}
}
displayedFamilies = new HashMap<String, Set<String>>();
for (IComponent component : ComponentsFactoryProvider.getInstance().getComponents()) {
if (component.isTechnical() || component.getComponentType() == EComponentType.JOBLET) {
continue;
}
if (!displayedFamilies.containsKey(component.getPaletteType())) {
displayedFamilies.put(component.getPaletteType(), new HashSet<String>());
}
for (String family : component.getOriginalFamilyName().split(ComponentsFactoryProvider.FAMILY_SEPARATOR_REGEX)) {
if (isComponentVisible(component, null)) {
displayedFamilies.get(component.getPaletteType()).add(family);
}
}
}
}
/**
* Migrate component settings for projects before 5.6.0.<br>
* <br>
* Goal is to have only in this list hidden components set manually, and hidden components by default in the
* product, set as visible by the user.<br>
* <br>
* <b>ComponentSettings will be stored with:</b><br>
* Name = PaletteType | component name<br>
* Family = list of families hidden, separated by |.<br>
*/
public static void migrateComponentSettings() {
}
public static Set<String> getDisplayedFamilies(String paletteType) {
if (hiddenComponents == null) {
initializeHiddenComponents();
}
return displayedFamilies.get(paletteType);
}
/**
* Check if the component is visible in the current family. Note that a component can be visible in one family but
* not in another one.
*
* @param component
* @param family
* @return
*/
public static boolean isComponentVisible(IComponent component, String family) {
if (hiddenComponents == null) {
initializeHiddenComponents();
}
if (hiddenComponents.containsKey(component.getPaletteType())) {
if (hiddenComponents.get(component.getPaletteType()).containsKey(component.getName())) {
if (hiddenComponents.get(component.getPaletteType()).get(component.getName()).contains(family)) {
// not visible if in the hidden component list;
return false;
}
}
}
return true;
}
/**
* Check if the component is visible in the current family. Note that a component can be visible in one family but
* not in another one.
*
* @param component
* @param family
* @return
*/
public static boolean isComponentVisible(String paletteType, String componentName, String family) {
if (hiddenComponents == null) {
initializeHiddenComponents();
}
if (hiddenComponents.containsKey(paletteType)) {
if (hiddenComponents.get(paletteType).containsKey(componentName)) {
if (hiddenComponents.get(paletteType).get(componentName).contains(family)) {
// not visible if in the hidden component list;
return false;
}
}
}
return true;
}
public static void resetHiddenComponents() {
hiddenComponents = null;
displayedFamilies = null;
}
public static void resetToDefaultHiddenComponents() {
RepositoryContext repositoryContext = (RepositoryContext) CoreRuntimePlugin.getInstance().getContext()
.getProperty(Context.REPOSITORY_CONTEXT_KEY);
if (repositoryContext == null) {
return;
}
Project project = repositoryContext.getProject();
if (project == null) {
return;
}
org.talend.core.model.properties.Project emfProject = project.getEmfProject();
if (emfProject == null) {
return;
}
hiddenComponents = new HashMap<String, Map<String, Set<String>>>();
EList list = emfProject.getComponentsSettings();
if (!list.isEmpty()) {
list.clear();
IRepositoryService service = (IRepositoryService) GlobalServiceRegister.getDefault().getService(
IRepositoryService.class);
IProxyRepositoryFactory prf = service.getProxyRepositoryFactory();
try {
prf.saveProject(project);
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
hiddenComponents = null;
displayedFamilies = null;
}
}

View File

@@ -1,160 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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.context;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.swt.SWT;
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.Composite;
import org.eclipse.swt.widgets.Control;
import org.talend.commons.ui.swt.composites.MessagesComposite;
import org.talend.commons.ui.swt.composites.MessagesWithActionComposite;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.ILibraryManagerUIService;
import org.talend.core.ui.i18n.Messages;
/**
* created by ldong on Aug 18, 2014 Detailled comment
*
*/
public class ContextMissSettingComposite extends Composite {
private boolean isVisibleTopMessages;
private MessagesWithActionComposite messagesComp;
public static final String REQUIRE_BUNDLE_NAME = "org.talend.libraries.nattable";
private ILibraryManagerUIService libUiService;
/**
* DOC ldong ContextMissSettingComposite constructor comment.
*
* @param parent
* @param style
*/
public ContextMissSettingComposite(Composite parent, int style) {
super(parent, style);
initialize(this);
}
private List<String> missModulesNeeded = new ArrayList<String>();
private void initialize(Composite parent) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(ILibraryManagerUIService.class)) {
libUiService = (ILibraryManagerUIService) GlobalServiceRegister.getDefault().getService(
ILibraryManagerUIService.class);
}
checkVisibleTopMessages();
if (isVisibleTopMessages()) {
disposeChildren();
parent.setLayout(new GridLayout(3, false));
messagesComp = createMessagesComposite(parent);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
messagesComp.setLayoutData(gridData);
GridLayout layout2 = (GridLayout) messagesComp.getLayout();
layout2.marginHeight = 0;
layout2.marginTop = 0;
layout2.marginBottom = 0;
layout2.marginRight = 0;
afterCreateMessagesComposite(messagesComp);
}
}
private MessagesWithActionComposite createMessagesComposite(Composite parent) {
return new MessagesWithActionComposite(parent, SWT.TOP);
}
private void checkVisibleTopMessages() {
missModulesNeeded.clear();
boolean allInstalled = true;
List<String> updatedModules = new ArrayList<String>();
if (libUiService != null) {
allInstalled = libUiService.isModuleInstalledForBundle(REQUIRE_BUNDLE_NAME);
if (!allInstalled) {
updatedModules = libUiService.getNeedInstallModuleForBundle(REQUIRE_BUNDLE_NAME);
}
}
missModulesNeeded.addAll(updatedModules);
setVisibleTopMessage(!allInstalled);
}
public void afterCreateMessagesComposite(MessagesComposite messComposite) {
messComposite.updateTopMessages(Messages.getString("ContextMissSettingComposite.missingModuleMessages"), IStatus.WARNING);
if (messComposite instanceof MessagesWithActionComposite) {
MessagesWithActionComposite messWithActionComposite = (MessagesWithActionComposite) messComposite;
messWithActionComposite.updateActionButton(Messages.getString("ContextMissSettingComposite.installName") //$NON-NLS-1$
+ "...", null);//$NON-NLS-1$
messWithActionComposite.addActionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (!missModulesNeeded.isEmpty()) {
if (libUiService != null) {
for (String jarName : missModulesNeeded) {
libUiService.installModules(new String[] { jarName });
}
// after install the jar,need to refresh again the parent composite
refreshContextView();
}
}
}
});
}
}
private void refreshContextView() {
((ContextNebulaGridComposite) this.getParent()).refresh();
}
protected void disposeChildren() {
if (messagesComp != null && !messagesComp.isDisposed()) {
// Empty the composite before use (kinda refresh) :
Control[] ct = messagesComp.getChildren();
for (int i = 0; i < ct.length; i++) {
if (ct[i] != null) {
if (ct[i].getForeground() != null && !ct[i].getForeground().isDisposed()) {
ct[i].getForeground().dispose();
}
if (ct[i].getBackground() != null && !ct[i].getBackground().isDisposed()) {
ct[i].getBackground().dispose();
}
}
ct[i].dispose();
}
}
}
public void setVisibleTopMessage(boolean visible) {
this.isVisibleTopMessages = visible;
if (messagesComp != null && !messagesComp.isDisposed() && !isVisibleTopMessages) {
messagesComp.dispose();
}
}
public boolean isVisibleTopMessages() {
return this.isVisibleTopMessages;
}
}

View File

@@ -1,747 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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.context;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PlatformUI;
import org.talend.commons.ui.runtime.image.ECoreImage;
import org.talend.commons.ui.runtime.image.EImage;
import org.talend.commons.ui.runtime.image.ImageProvider;
import org.talend.commons.utils.threading.ExecutionLimiter;
import org.talend.core.language.ECodeLanguage;
import org.talend.core.language.LanguageManager;
import org.talend.core.model.context.ContextUtils;
import org.talend.core.model.context.JobContextManager;
import org.talend.core.model.context.JobContextParameter;
import org.talend.core.model.metadata.MetadataTalendType;
import org.talend.core.model.metadata.types.ContextParameterJavaTypeManager;
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.properties.Item;
import org.talend.core.prefs.ITalendCorePrefConstants;
import org.talend.core.ui.context.ContextTreeTable.ContextTreeNode;
import org.talend.core.ui.context.model.ContextTabChildModel;
import org.talend.core.ui.context.model.table.ContextTableTabChildModel;
import org.talend.core.ui.context.model.table.ContextTableTabParentModel;
import org.talend.core.ui.context.nattableTree.ContextNatTableUtils;
import org.talend.core.ui.i18n.Messages;
import org.talend.core.utils.TalendQuoteUtils;
/**
* created by ldong on Jul 8, 2014 Detailled comment
*
*/
public class ContextNebulaGridComposite extends AbstractContextTabEditComposite {
public static final int CONTEXT_COLUMN_WIDTH = 200;
public static final String NEW_PARAM_NAME = "new"; //$NON-NLS-1$
private TreeViewer viewer;
private IContextModelManager modelManager = null;
private ConfigureContextAction configContext;
private Combo contextsCombo;
private Button contextConfigButton;
private ContextManagerHelper helper;
private List<Button> buttonList;
private Button addButton;
private Button removeButton;
private Button moveUpButton;
private Button moveDownButton;
private Button selectContextVariablesButton;
private Composite contextTableComp;
private Composite availableLabelComp;
private Composite messageComp;
private Composite contextsSelectComp;
private Composite buttonsComp;
private ContextTreeTable treeTable;
/**
* Constructor.
*
* @param parent
* @param style
*/
public ContextNebulaGridComposite(Composite parent, IContextModelManager manager) {
super(parent, SWT.NONE);
modelManager = manager;
buttonList = new ArrayList<Button>();
this.helper = new ContextManagerHelper(manager.getContextManager());
this.setBackground(parent.getBackground());
this.setLayout(GridLayoutFactory.swtDefaults().spacing(0, 0).create());
initializeUI();
}
@Override
public IContextModelManager getContextModelManager() {
return this.modelManager;
}
public IContextManager getContextManager() {
return modelManager.getContextManager();
}
/**
* zwang Comment method "initializeUI".
*
* @param viewer
*/
private void initializeUI() {
if (getContextManager() == null) {
createContextNotAvailableGroup(this);
} else {
if (!ContextNatTableUtils.checkIsInstallExternalJar()) {
createMessageGroup(this);
} else {
createNatTableGroup(this);
createNatTable();
createButtonsGroup(this);
addListener(SWT.Resize, resizeListener);
}
}
}
private void createContextNotAvailableGroup(Composite parentComposite) {
availableLabelComp = new Composite(parentComposite, SWT.NULL);
availableLabelComp.setLayout(new GridLayout());
availableLabelComp.setLayoutData(new GridData(GridData.FILL_BOTH));
Label contextUnAvailableLabel = new Label(availableLabelComp, SWT.NULL);
contextUnAvailableLabel.setText(Messages.getString("ContextNebulaComposite.ContextsUnAvailable")); //$NON-NLS-1$
availableLabelComp.getParent().layout();
availableLabelComp.layout();
}
private void createMessageGroup(Composite parentComposite) {
messageComp = new ContextMissSettingComposite(parentComposite, SWT.NULL);
messageComp.setLayout(new GridLayout(3, false));
messageComp.setLayoutData(new GridData(GridData.FILL_BOTH));
messageComp.getParent().layout();
messageComp.layout();
}
private void createNatTableGroup(Composite parentComposite) {
contextTableComp = new Composite(parentComposite, SWT.NULL);
GridLayout dataTableLayout = new GridLayout(2, Boolean.FALSE);
contextTableComp.setLayout(dataTableLayout);
GridData gridData = new GridData(GridData.FILL_BOTH);
contextTableComp.setLayoutData(gridData);
treeTable = new ContextTreeTable(modelManager);
}
private void createNatTable() {
ContextTreeTable.TControl tControl = treeTable.createTable(contextTableComp);
GridDataFactory.fillDefaults().grab(true, true).applyTo(tControl.getControl());
configContext = new ConfigureContextAction(modelManager, this.getShell());
contextConfigButton = new Button(contextTableComp, SWT.NULL);
GridData addContextGridData = new GridData();
addContextGridData.verticalAlignment = SWT.TOP;
contextConfigButton.setLayoutData(addContextGridData);
contextConfigButton.setImage(ImageProvider.getImage(EImage.ADD_ICON));
contextConfigButton.setToolTipText(configContext.getText());
contextConfigButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
configContext.run();
}
});
}
private void createButtonsGroup(Composite parentComposite) {
buttonsComp = new Composite(parentComposite, SWT.NULL);
buttonsComp.setLayout(GridLayoutFactory.swtDefaults().spacing(0, 0).margins(0, 0).numColumns(7).create());
GridDataFactory.swtDefaults().align(SWT.FILL, SWT.DOWN).grab(true, false).applyTo(buttonsComp);
buttonList.clear();
addButton = createAddPushButton(buttonsComp);
buttonList.add(addButton);
removeButton = createRemovePushButton(buttonsComp);
buttonList.add(removeButton);
boolean isRepositoryContext = (modelManager instanceof ContextComposite)
&& ((ContextComposite) modelManager).isRepositoryContext();
if (!isRepositoryContext) {// for bug 7393
moveUpButton = createMoveUpPushButton(buttonsComp);
buttonList.add(moveUpButton);
moveDownButton = createMoveDownPushButton(buttonsComp);
buttonList.add(moveDownButton);
}
if ((modelManager instanceof ContextComposite) && !((ContextComposite) modelManager).isRepositoryContext()) {
selectContextVariablesButton = createSelectContextVariablesPushButton(buttonsComp);
buttonList.add(selectContextVariablesButton);
}
// move the context group from the top to the bottom
Composite layoutComposite = new Composite(buttonsComp, SWT.NULL);
layoutComposite.setLayout(GridLayoutFactory.swtDefaults().spacing(0, 0).numColumns(1).create());
GridDataFactory.swtDefaults().align(SWT.CENTER, SWT.DOWN).grab(true, false).applyTo(layoutComposite);
createContextsGroup(layoutComposite);
}
private void createContextsGroup(Composite parentComposite) {
contextsSelectComp = new Composite(parentComposite, SWT.NULL);
contextsSelectComp.setLayout(GridLayoutFactory.swtDefaults().spacing(10, 0).margins(0, 0).numColumns(2).create());
GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.DOWN).grab(true, false).applyTo(contextsSelectComp);
GridLayout layout2 = (GridLayout) contextsSelectComp.getLayout();
layout2.marginHeight = 0;
layout2.marginTop = 0;
layout2.marginBottom = 0;
Label contextSeletLabel = new Label(contextsSelectComp, SWT.NULL);
contextSeletLabel.setText(Messages.getString("ContextNebulaComposite.ContextGroupLabel")); //$NON-NLS-1$
contextsCombo = new Combo(contextsSelectComp, SWT.READ_ONLY);
contextsCombo.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
Object obj = e.getSource();
String selectContext = ((Combo) obj).getText();
IContext defaultContext = modelManager.getContextManager().getDefaultContext();
if (selectContext.equals(defaultContext.getName())) {
} else {
IContext newSelContext = null;
for (IContext enviroContext : modelManager.getContextManager().getListContext()) {
if (selectContext.equals(enviroContext.getName())) {
newSelContext = enviroContext;
}
}
modelManager.onContextChangeDefault(modelManager.getContextManager(), newSelContext);
refresh();
}
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
});
}
private Button createAddPushButton(final Composite parent) {
Button addPushButton = new Button(parent, SWT.PUSH);
addPushButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
IContextParameter parameter = (IContextParameter) createNewEntry();
if (parameter != null) {
// set the source to built-in
parameter.setSource(IContextParameter.BUILT_IN);
modelManager.onContextAddParameter(getContextManager(), parameter);
// see feature 4661: Add an option to propagate when add or remove a variable in a repository
// context to jobs/joblets.
if (ContextUtils.isPropagateContextVariable() && getContextManager() != null) {
IContextManager manager = getContextManager();
if (manager != null && manager instanceof JobContextManager) {
JobContextManager jobManger = (JobContextManager) manager;
// set updated flag.
jobManger.setModified(true);
jobManger.addNewParameters(parameter.getName());
}
}
}
}
});
Image image = ImageProvider.getImage(EImage.ADD_ICON);
addPushButton.setImage(image);
return addPushButton;
}
private Button createRemovePushButton(final Composite parent) {
Button removePushButton = new Button(parent, SWT.PUSH);
removePushButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
IStructuredSelection sel = treeTable.getSelection();
if (treeTable.getSelection() != null) {
Object[] obj = new Object[sel.toList().size()];
int i = 0;
for (Object node : sel.toList().toArray()) {
if (node instanceof ContextTreeNode) {
obj[i++] = ((ContextTreeNode) node).getTreeData();
}
}
for (Object object : obj) { // multi delete
if (object == null) {
return;
}
if (object instanceof ContextTableTabParentModel) {
ContextTableTabParentModel parentModel = (ContextTableTabParentModel) object;
removeParentModelInGroupBySource(parentModel);
} else if (object instanceof ContextTableTabChildModel) {
ContextTableTabChildModel childModel = (ContextTableTabChildModel) object;
removeChildModelInGroupBySource(childModel);
}
}
modelManager.refresh();
setButtonEnableState();
if (!treeTable.getSelection().isEmpty()) {
treeTable.clearSelection();
}
}
}
});
Image image = ImageProvider.getImage(EImage.DELETE_ICON);
removePushButton.setImage(image);
return removePushButton;
}
private Button createMoveUpPushButton(final Composite parent) {
Button moveUpPushButton = new Button(parent, SWT.PUSH);
Image image = ImageProvider.getImage(EImage.UP_ICON);
moveUpPushButton.setImage(image);
moveUpPushButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
IStructuredSelection sel = treeTable.getSelection();
if (ContextManagerHelper.changeContextOrder(sel, modelManager, true)) {
setButtonEnableState();
}
}
});
return moveUpPushButton;
}
private Button createMoveDownPushButton(final Composite parent) {
Button moveDownPushButton = new Button(parent, SWT.PUSH);
Image image = ImageProvider.getImage(EImage.DOWN_ICON);
moveDownPushButton.setImage(image);
moveDownPushButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
IStructuredSelection sel = treeTable.getSelection();
if (ContextManagerHelper.changeContextOrder(sel, modelManager, false)) {
setButtonEnableState();
}
}
});
return moveDownPushButton;
}
private Button createSelectContextVariablesPushButton(final Composite parent) {
Button selectContextVariablesPushButton = new Button(parent, SWT.PUSH);
Image image = ImageProvider.getImage(ECoreImage.CONTEXT_ICON);
selectContextVariablesPushButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
SelectRepositoryContextDialog dialog = new SelectRepositoryContextDialog(getContextModelManager(), parent
.getShell(), helper);
if (dialog.open() == Dialog.OK) {
// ADD msjian TDQ-9629: if the current perspective is dataprofiling, change all to builtin context
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
if (activePage != null) {
if ("org.talend.dataprofiler.DataProfilingPerspective".equals(activePage.getPerspective().getId())) { //$NON-NLS-1$
IContextManager contextManager = getContextModelManager().getContextManager();
if (contextManager instanceof JobContextManager) {
JobContextManager jobContextManager = (JobContextManager) contextManager;
jobContextManager.setModified(true);
}
List<IContext> listContext = contextManager.getListContext();
if (listContext != null) {
for (IContext context : listContext) {
List<IContextParameter> contextParameterList = context.getContextParameterList();
if (contextParameterList != null) {
for (IContextParameter contextParameter : contextParameterList) {
contextParameter.setSource(IContextParameter.BUILT_IN);
}
}
}
}
contextManager.fireContextsChangedEvent();
}
}
// TDQ-9629~
refresh();
}
}
});
selectContextVariablesPushButton.setImage(image);
return selectContextVariablesPushButton;
}
private void setButtonEnableState() {
boolean enableState = !modelManager.isReadOnly();
if (this.addButton != null) {
this.addButton.setEnabled(enableState);
}
if (this.removeButton != null) {
this.removeButton.setEnabled(enableState);
}
if (this.moveUpButton != null) {
this.moveUpButton.setEnabled(enableState);
}
if (this.moveDownButton != null) {
this.moveDownButton.setEnabled(enableState);
}
if (this.selectContextVariablesButton != null) {
this.selectContextVariablesButton.setEnabled(enableState);
}
if (contextConfigButton != null) {
this.contextConfigButton.setEnabled(enableState);
}
if (contextsCombo != null) {
this.contextsCombo.setEnabled(enableState);
}
}
public Object createNewEntry() {
List<IContextParameter> listParams = getContextManager().getDefaultContext().getContextParameterList();
Integer numParam = new Integer(1);
boolean paramNameFound;
String paramName = null;
do { // look for a new name
paramNameFound = true;
paramName = NEW_PARAM_NAME + numParam;
for (int i = 0; i < listParams.size(); i++) {
if (paramName.equals(listParams.get(i).getName())) {
paramNameFound = false;
}
}
if (!paramNameFound) {
numParam++;
}
} while (!paramNameFound);
JobContextParameter contextParam = new JobContextParameter();
contextParam.setName(paramName);
ECodeLanguage curLanguage = LanguageManager.getCurrentLanguage();
if (curLanguage == ECodeLanguage.JAVA) {
contextParam.setType(ContextParameterJavaTypeManager.getDefaultJavaType().getId());
} else {
contextParam.setType(MetadataTalendType.getDefaultTalendType());
}
contextParam.setPrompt(paramName + "?"); //$NON-NLS-1$
String defaultValue;
if (curLanguage == ECodeLanguage.JAVA) {
defaultValue = ContextParameterJavaTypeManager.getDefaultValueFromJavaIdType(ContextParameterJavaTypeManager
.getDefaultJavaType().getId(), false);
} else {
defaultValue = TalendQuoteUtils.addQuotes(""); //$NON-NLS-1$
}
contextParam.setValue(defaultValue);
contextParam.setComment(""); //$NON-NLS-1$
contextParam.setSource(""); //$NON-NLS-1$
return contextParam;
}
private void removeChildModelInGroupBySource(ContextTableTabChildModel child) {
IContextParameter contextPara = child.getContextParameter();
String sourceId = contextPara.getSource();
String contextName = contextPara.getName();
modelManager.onContextRemoveParameter(getContextManager(), contextName, sourceId);
}
private void removeParentModelInGroupBySource(ContextTableTabParentModel parentModel) {
Set<String> paraNames = new HashSet<String>();
String sourceId = parentModel.getSourceId();
if (IContextParameter.BUILT_IN.equals(sourceId)) {
String paraName = parentModel.getContextParameter().getName();
paraNames.add(paraName);
} else {
List<ContextTabChildModel> children = parentModel.getChildren();
if (children != null && children.size() > 0) {
for (ContextTabChildModel child : children) {
IContextParameter contextPara = child.getContextParameter();
String paraName = contextPara.getName();
paraNames.add(paraName);
}
}
}
modelManager.onContextRemoveParameter(getContextManager(), paraNames, sourceId);
}
@Override
public boolean isGroupBySource() {
boolean isRepositoryContext = false;
if (modelManager != null) {
isRepositoryContext = (modelManager instanceof ContextComposite)
&& ((ContextComposite) modelManager).isRepositoryContext();
}
boolean value = getPreferenceStore().getBoolean(ITalendCorePrefConstants.CONTEXT_GROUP_BY_SOURCE);
return value && !isRepositoryContext;
}
@Override
public void setEnabled(boolean enabled) {
if (configContext != null) {
configContext.setEnabled(enabled);
}
if (contextTableComp != null && !contextTableComp.isDisposed()) {
contextTableComp.setEnabled(enabled);
}
if (messageComp != null) {
this.getParent().setEnabled(true);
}
}
@Override
public TreeViewer getViewer() {
return this.viewer;
}
/**
* need force refresh here after install the external jar
*/
private void reInitializeUI() {
disposeInstallMessageComp();
disposeUnAvailableContextComp();
if (contextTableComp == null || (contextTableComp != null && contextTableComp.isDisposed())) {
initializeUI();
contextTableComp.getParent().layout();
contextTableComp.layout();
}
}
@Override
public void refresh() {
if (getContextManager() == null) {
disposeInstallMessageComp();
disposeNatTableComp();
if (availableLabelComp == null || (availableLabelComp != null && availableLabelComp.isDisposed())) {
createContextNotAvailableGroup(this);
}
} else {
if (!ContextNatTableUtils.checkIsInstallExternalJar()) {
disposeUnAvailableContextComp();
if (messageComp == null || (messageComp != null && messageComp.isDisposed())) {
createMessageGroup(this);
}
} else {
reInitializeUI();
initializeContextCombo();
checkContextGroupSource();
// dispose the data table composite
disposeDataTable();
// create the data table composite
createNatTable();
contextTableComp.getParent().layout();
contextTableComp.layout();
treeTable.refresh();
setButtonEnableState();
}
}
}
private void initializeContextCombo() {
IContextManager contextManager = getContextManager();
if (contextsCombo.getItems().length > 0) {
contextsCombo.removeAll();
}
if (contextManager != null) {
List<IContext> contexts = contextManager.getListContext();
for (IContext context : contexts) {
if (!Arrays.asList(contextsCombo.getItems()).contains(context.getName())) {
contextsCombo.add(context.getName());
}
}
for (int i = 0; i < contextsCombo.getItemCount(); i++) {
IContext defaultContext = contextManager.getDefaultContext();
if (defaultContext.getName().equals(contextsCombo.getItem(i))) {
contextsCombo.select(i);
break;
}
}
}
int visibleItemCount = contextsCombo.getItemCount();
if (visibleItemCount > 20) {
visibleItemCount = 20;
}
contextsCombo.setVisibleItemCount(visibleItemCount);
}
private void checkContextGroupSource() {
IContextManager contextManager = getContextManager();
if (helper == null) {
return;
}
if (contextManager != null) {
helper.initHelper(contextManager);
Map<String, Item> items = new HashMap<String, Item>();
boolean needRefresh = false;
for (IContextParameter param : contextManager.getDefaultContext().getContextParameterList()) {
if (!param.isBuiltIn()) {
String source = param.getSource();
Item sourceItem = items.get(source);
if (sourceItem == null) {
sourceItem = ContextUtils.getRepositoryContextItemById(source);
}
if (sourceItem == null) { // source not found
needRefresh = true;
param.setSource(IContextParameter.BUILT_IN);
propagateType(contextManager, param);
} else {
items.put(source, sourceItem);
}
}
}
if (needRefresh) {
setModifiedFlag(contextManager);
modelManager.refresh();
}
}
}
private void setModifiedFlag(IContextManager contextManager) {
if (contextManager != null && contextManager instanceof JobContextManager) {
JobContextManager manager = (JobContextManager) contextManager;
manager.setModified(true);
}
}
private void propagateType(IContextManager contextManager, IContextParameter param) {
for (IContext context : contextManager.getListContext()) {
IContextParameter paramToModify = context.getContextParameter(param.getName());
paramToModify.setType(param.getType());
paramToModify.setComment(param.getComment());
paramToModify.setSource(param.getSource());
}
}
private void disposeDataTable() {
if (contextTableComp != null && !contextTableComp.isDisposed()) {
for (Control control : contextTableComp.getChildren()) {
control.dispose();
}
}
}
private void disposeUnAvailableContextComp() {
if (availableLabelComp != null && !availableLabelComp.isDisposed()) {
availableLabelComp.dispose();
}
}
private void disposeInstallMessageComp() {
if (messageComp != null && !messageComp.isDisposed()) {
messageComp.dispose();
}
}
private void disposeNatTableComp() {
if (contextsSelectComp != null && !contextsSelectComp.isDisposed()) {
contextsSelectComp.dispose();
}
if (contextTableComp != null && !contextTableComp.isDisposed()) {
contextTableComp.dispose();
}
if (buttonsComp != null && !buttonsComp.isDisposed()) {
buttonsComp.dispose();
}
}
private final Listener resizeListener = new Listener() {
@Override
public void handleEvent(Event event) {
resizeLimiter.resetTimer();
resizeLimiter.startIfExecutable(true, null);
}
};
private final ExecutionLimiter resizeLimiter = new ExecutionLimiter(250, true) {
@Override
public void execute(final boolean isFinalExecution, Object data) {
if (!isDisposed()) {
getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
if (!isDisposed() && !getParent().isDisposed()) {
refresh();
}
}
});
}
}
};
}

View File

@@ -1,756 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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.context;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.window.DefaultToolTip;
import org.eclipse.nebula.widgets.nattable.NatTable;
import org.eclipse.nebula.widgets.nattable.config.ConfigRegistry;
import org.eclipse.nebula.widgets.nattable.config.DefaultComparator;
import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.DetailGlazedListsEventLayer;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsDataProvider;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsSortModel;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.tree.GlazedListTreeData;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.tree.GlazedListTreeRowModel;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultRowHeaderDataProvider;
import org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer;
import org.eclipse.nebula.widgets.nattable.grid.layer.CornerLayer;
import org.eclipse.nebula.widgets.nattable.grid.layer.DefaultColumnHeaderDataLayer;
import org.eclipse.nebula.widgets.nattable.grid.layer.DefaultRowHeaderDataLayer;
import org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer;
import org.eclipse.nebula.widgets.nattable.grid.layer.RowHeaderLayer;
import org.eclipse.nebula.widgets.nattable.group.ColumnGroupExpandCollapseLayer;
import org.eclipse.nebula.widgets.nattable.group.ColumnGroupHeaderLayer;
import org.eclipse.nebula.widgets.nattable.group.ColumnGroupModel;
import org.eclipse.nebula.widgets.nattable.group.ColumnGroupModel.ColumnGroup;
import org.eclipse.nebula.widgets.nattable.group.ColumnGroupReorderLayer;
import org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer;
import org.eclipse.nebula.widgets.nattable.hideshow.RowHideShowLayer;
import org.eclipse.nebula.widgets.nattable.hideshow.command.ColumnHideCommand;
import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
import org.eclipse.nebula.widgets.nattable.layer.cell.ColumnOverrideLabelAccumulator;
import org.eclipse.nebula.widgets.nattable.layer.config.DefaultColumnHeaderStyleConfiguration;
import org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter;
import org.eclipse.nebula.widgets.nattable.painter.layer.NatGridLayerPainter;
import org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer;
import org.eclipse.nebula.widgets.nattable.selection.RowSelectionProvider;
import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer;
import org.eclipse.nebula.widgets.nattable.selection.config.DefaultSelectionStyleConfiguration;
import org.eclipse.nebula.widgets.nattable.sort.ISortModel;
import org.eclipse.nebula.widgets.nattable.sort.SortConfigAttributes;
import org.eclipse.nebula.widgets.nattable.sort.SortHeaderLayer;
import org.eclipse.nebula.widgets.nattable.tree.SortableTreeComparator;
import org.eclipse.nebula.widgets.nattable.tree.TreeLayer;
import org.eclipse.nebula.widgets.nattable.tree.config.DefaultTreeLayerConfiguration;
import org.eclipse.nebula.widgets.nattable.util.GUIHelper;
import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.talend.commons.exception.PersistenceException;
import org.talend.core.GlobalServiceRegister;
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.ERepositoryObjectType;
import org.talend.core.model.repository.IRepositoryViewObject;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.core.service.IMetadataManagmentUiService;
import org.talend.core.ui.context.model.ContextTabChildModel;
import org.talend.core.ui.context.model.table.ContextTableConstants;
import org.talend.core.ui.context.model.table.ContextTableTabParentModel;
import org.talend.core.ui.context.nattableTree.ContextAutoResizeTextPainter;
import org.talend.core.ui.context.nattableTree.ContextColumnGroupConfiguration;
import org.talend.core.ui.context.nattableTree.ContextColumnHeaderDecorator;
import org.talend.core.ui.context.nattableTree.ContextNatTableBackGroudPainter;
import org.talend.core.ui.context.nattableTree.ContextNatTableConfiguration;
import org.talend.core.ui.context.nattableTree.ContextNatTableStyleConfiguration;
import org.talend.core.ui.context.nattableTree.ContextNatTableUtils;
import org.talend.core.ui.context.nattableTree.ContextParaModeChangeMenuConfiguration;
import org.talend.core.ui.context.nattableTree.ContextRowDataListFixture;
import org.talend.core.ui.context.nattableTree.ExtendedContextColumnPropertyAccessor;
import org.talend.core.ui.i18n.Messages;
import org.talend.repository.ProjectManager;
import org.talend.repository.model.IRepositoryNode.ENodeType;
import org.talend.repository.model.RepositoryNode;
import ca.odell.glazedlists.EventList;
import ca.odell.glazedlists.GlazedLists;
import ca.odell.glazedlists.SortedList;
import ca.odell.glazedlists.TreeList;
/**
* created by ldong on Jul 10, 2014 Detailled comment
*
*/
public class ContextTreeTable {
private NatTable natTable;
private Map<String, ContextTreeNode> treeNodes = new HashMap<String, ContextTreeNode>();
private IStructuredSelection currentNatTabSel;
private final static String TREE_CONTEXT_ROOT = "";
private final static String TREE_DEFAULT_NODE = "node";
// by default sort by the model id
private final static String TREE_CONTEXT_ID = "orderId";
private IContextModelManager manager;
private final static int fixedCheckBoxWidth = 30;
private final static int fixedTypeWidth = 90;
public ContextTreeTable(IContextModelManager manager) {
this.manager = manager;
}
public TControl createTable(Composite parentContainer) {
TControl retObj = createTableControl(parentContainer);
retObj.setControl(retObj.getControl());
return retObj;
}
public IStructuredSelection getSelection() {
return currentNatTabSel;
}
public void clearSelection() {
currentNatTabSel = null;
}
public List<IContext> getContexts(IContextManager contextManger) {
List<IContext> contexts = new ArrayList<IContext>();
if (contextManger != null) {
contexts = contextManger.getListContext();
}
return contexts;
}
public void refresh() {
if (natTable == null) {
return;
}
natTable.refresh();
}
/**
* create the context NatTable
*
* @param parent
* @return
*/
private TControl createTableControl(Composite parent) {
ConfigRegistry configRegistry = new ConfigRegistry();
ColumnGroupModel columnGroupModel = new ColumnGroupModel();
configRegistry.registerConfigAttribute(SortConfigAttributes.SORT_COMPARATOR, new DefaultComparator());
String[] propertyNames = ContextRowDataListFixture.getPropertyNames(manager);
int comWidth = parent.getParent().getClientArea().width;
// the data source for the context
if (propertyNames.length > 0) {
treeNodes.clear();
constructContextTreeNodes();
EventList<ContextTreeNode> eventList = GlazedLists.eventList(treeNodes.values());
SortedList<ContextTreeNode> sortedList = new SortedList<ContextTreeNode>(eventList, null);
// init Column header layer
IColumnPropertyAccessor<ContextTreeNode> columnPropertyAccessor = new ExtendedContextColumnPropertyAccessor<ContextTreeNode>(
propertyNames, columnGroupModel);
IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(propertyNames);
DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
// init context tree model layer for the body layer
ISortModel sortModel = new GlazedListsSortModel(sortedList, columnPropertyAccessor, configRegistry,
columnHeaderDataLayer);
final TreeList<ContextTreeNode> treeList = new TreeList(sortedList, new ContextTreeFormat(sortModel),
new ContextExpansionModel());
GlazedListTreeData<ContextTreeNode> treeData = new ContextTreeData(treeList);
final GlazedListsDataProvider<ContextTreeNode> bodyDataProvider = new GlazedListsDataProvider(treeList,
columnPropertyAccessor);
// the main dataLayer
DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
DetailGlazedListsEventLayer<ContextTreeNode> glazedListsEventLayer = new DetailGlazedListsEventLayer<ContextTreeNode>(
bodyDataLayer, treeList);
// set up Body layer
ColumnReorderLayer columnReorderLayer = new ColumnReorderLayer(glazedListsEventLayer);
ColumnGroupReorderLayer columnGroupReorderLayer = new ColumnGroupReorderLayer(columnReorderLayer, columnGroupModel);
ColumnHideShowLayer columnHideShowLayer = new ColumnHideShowLayer(columnGroupReorderLayer);
// context columns hide or show for the column group
ColumnGroupExpandCollapseLayer columnGroupExpandCollapseLayer = new ColumnGroupExpandCollapseLayer(
columnHideShowLayer, columnGroupModel);
RowHideShowLayer rowHideShowLayer = new RowHideShowLayer(columnGroupExpandCollapseLayer);
final TreeLayer treeLayer = new TreeLayer(rowHideShowLayer, new GlazedListTreeRowModel<ContextTreeNode>(treeData),
false);
SelectionLayer selectionLayer = new SelectionLayer(treeLayer);
addCustomSelectionBehaviour(selectionLayer);
ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
// set up Cloumn group layer
ColumnHeaderLayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer, viewportLayer, selectionLayer);
ColumnGroupHeaderLayer columnGroupHeaderLayer = new ColumnGroupHeaderLayer(columnHeaderLayer, selectionLayer,
columnGroupModel);
addContextColumnGroupsBehaviour(columnGroupHeaderLayer,
ContextRowDataListFixture.getContexts(manager.getContextManager()));
columnGroupHeaderLayer.addConfiguration(new ContextColumnGroupConfiguration(columnGroupModel));
// Register labels
SortHeaderLayer<ContextTreeNode> sortHeaderLayer = new SortHeaderLayer<ContextTreeNode>(columnGroupHeaderLayer,
sortModel, false);
// set up Row header layer
DefaultRowHeaderDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(bodyDataProvider);
DefaultRowHeaderDataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
RowHeaderLayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer, viewportLayer, selectionLayer);
// set up Corner layer
DefaultCornerDataProvider cornerDataProvider = new DefaultCornerDataProvider(columnHeaderDataProvider,
rowHeaderDataProvider);
DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
CornerLayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer, sortHeaderLayer);
// set up the final Grid layer
final GridLayer gridLayer = new GridLayer(viewportLayer, sortHeaderLayer, rowHeaderLayer, cornerLayer);
// config the column edit configuration
ColumnOverrideLabelAccumulator labelAccumulator = new ColumnOverrideLabelAccumulator(bodyDataLayer);
bodyDataLayer.setConfigLabelAccumulator(labelAccumulator);
registerColumnLabels(labelAccumulator, ContextRowDataListFixture.getContexts(manager.getContextManager()));
ISelectionProvider selectionProvider = new RowSelectionProvider<ContextTreeNode>(selectionLayer, bodyDataProvider,
false);
natTable = new NatTable(parent, NatTable.DEFAULT_STYLE_OPTIONS | SWT.BORDER, gridLayer, false);
natTable.setConfigRegistry(configRegistry);
addCustomStylingBehaviour(parent.getFont(), bodyDataProvider, columnGroupModel, manager);
addCustomContextMenuBehavior(manager, bodyDataProvider, selectionProvider);
natTable.addConfiguration(new DefaultTreeLayerConfiguration(treeLayer));
addCustomColumnHeaderStyleBehaviour();
List<Integer> hideColumnsPos = addCustomHideColumnsBehaviour(manager, columnGroupModel, bodyDataLayer);
List<Integer> checkColumnPos = getAllCheckPosBehaviour(manager, columnGroupModel);
int dataColumnsWidth = bodyDataLayer.getWidth();
int maxWidth = (comWidth > dataColumnsWidth) ? comWidth : dataColumnsWidth;
// for caculate the suitable column size for when maxmum or minmum the context tab
addCustomColumnsResizeBehaviour(bodyDataLayer, hideColumnsPos, checkColumnPos, cornerLayer.getWidth(), maxWidth);
NatGridLayerPainter layerPainter = new NatGridLayerPainter(natTable);
natTable.setLayerPainter(layerPainter);
attachCheckColumnTip(natTable);
natTable.configure();
GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);
// add selection listener for the context NatTable
addNatTableListener(bodyDataProvider, selectionProvider);
GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);
TControl retObj = new TControl();
retObj.setControl(natTable);
return retObj;
}
return null;
}
private void attachCheckColumnTip(NatTable nt) {
DefaultToolTip toolTip = new ContextNatTableToolTip(nt);
toolTip.setBackgroundColor(natTable.getDisplay().getSystemColor(7));
toolTip.setPopupDelay(500);
toolTip.activate();
toolTip.setShift(new Point(10, 10));
}
private void constructContextTreeNodes() {
List<IContext> contextList = getContexts(manager.getContextManager());
List<IContextParameter> contextDatas = ContextTemplateComposite.computeContextTemplate(contextList);
List<ContextTableTabParentModel> listofData = ContextNatTableUtils.constructContextDatas(contextDatas);
contructContextTrees(listofData);
}
private void contructContextTrees(List<ContextTableTabParentModel> listOfData) {
for (ContextTableTabParentModel contextModel : listOfData) {
if (contextModel.hasChildren()) {
createContextTreeNode(contextModel.getOrder(), manager, contextModel, TREE_CONTEXT_ROOT,
contextModel.getSourceName());
List<ContextTabChildModel> childModels = contextModel.getChildren();
for (ContextTabChildModel childModel : childModels) {
createContextTreeNode(contextModel.getOrder(), manager, childModel, contextModel.getSourceName(), childModel
.getContextParameter().getName());
}
} else {
createContextTreeNode(contextModel.getOrder(), manager, contextModel, TREE_CONTEXT_ROOT, contextModel
.getContextParameter().getName());
}
}
}
private void createContextTreeNode(int orderId, IContextModelManager modelManager, Object data, String parent,
String currentNodeName) {
ContextTreeNode datum = new ContextTreeNode(orderId, modelManager, data, treeNodes.get(parent), currentNodeName);
treeNodes.put(currentNodeName, datum);
}
private void addNatTableListener(final GlazedListsDataProvider<ContextTreeNode> bodyDataProvider,
ISelectionProvider selectionProvider) {
this.natTable.addMouseListener(new MouseListener() {
@Override
public void mouseDoubleClick(MouseEvent e) {
int rowPos = natTable.getRowPositionByY(e.y);
if (rowPos == 0 || rowPos == -1) {
// in case click the column header or the empty space
return;
}
int rowIndex = natTable.getRowIndexByPosition(rowPos);
ContextTreeNode treeNode = bodyDataProvider.getRowObject(rowIndex);
if (treeNode != null && (treeNode.getChildren().size() != 0 || treeNode.getParent() != null)) {
String repositoryContextName = (treeNode.getChildren().size() != 0) ? treeNode.getName() : treeNode
.getParent().getName();
List<IRepositoryViewObject> contextObjs;
try {
contextObjs = ProxyRepositoryFactory.getInstance().getAll(
ProjectManager.getInstance().getCurrentProject(), ERepositoryObjectType.CONTEXT);
for (IRepositoryViewObject contextObj : contextObjs) {
if (contextObj.getProperty().getLabel().equals(repositoryContextName)) {
RepositoryNode relateNode = new RepositoryNode(contextObj, null, ENodeType.REPOSITORY_ELEMENT);
contextObj.setRepositoryNode(relateNode);
if (GlobalServiceRegister.getDefault().isServiceRegistered(IMetadataManagmentUiService.class)) {
IMetadataManagmentUiService mmUIService = (IMetadataManagmentUiService) GlobalServiceRegister
.getDefault().getService(IMetadataManagmentUiService.class);
mmUIService.openRepositoryContextWizard(relateNode);
}
}
}
} catch (PersistenceException e1) {
e1.printStackTrace();
}
}
}
@Override
public void mouseDown(MouseEvent e) {
}
@Override
public void mouseUp(MouseEvent e) {
}
});
selectionProvider.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
currentNatTabSel = (IStructuredSelection) event.getSelection();
}
});
}
private List<Integer> getAllCheckPosBehaviour(IContextModelManager manager, ColumnGroupModel contextGroupModel) {
List<Integer> checkPos = new ArrayList<Integer>();
if (manager.getContextManager() != null) {
List<IContext> contexts = manager.getContextManager().getListContext();
for (IContext envContext : contexts) {
ColumnGroup group = contextGroupModel.getColumnGroupByName(envContext.getName());
int checkIndex = group.getMembers().get(1);
checkPos.add(checkIndex);
}
}
return checkPos;
}
private void addCustomColumnsResizeBehaviour(DataLayer dataLayer, List<Integer> hideColumnsPos,
List<Integer> checkColumnsPos, int cornerWidth, int maxWidth) {
dataLayer.setColumnsResizableByDefault(true);
int dataColumnsCount = dataLayer.getPreferredColumnCount();
if (dataColumnsCount == 2) {
int averageWidth = maxWidth / dataColumnsCount;
for (int i = 0; i < dataColumnsCount; i++) {
dataLayer.setColumnWidthByPosition(i, averageWidth);
}
} else {
int typeColumnPos = dataLayer.getColumnPositionByIndex(1);
int leftWidth = maxWidth - fixedTypeWidth - fixedCheckBoxWidth * checkColumnsPos.size() - cornerWidth * 2;
int currentColumnsCount = dataColumnsCount - hideColumnsPos.size() - checkColumnsPos.size() - 1;
int averageWidth = leftWidth / currentColumnsCount;
for (int i = 0; i < dataLayer.getColumnCount(); i++) {
boolean findHide = false;
boolean findCheck = false;
boolean findType = false;
if (typeColumnPos == i) {
findType = true;
dataLayer.setColumnWidthByPosition(i, fixedTypeWidth);
}
for (int hidePos : hideColumnsPos) {
if (hidePos == i) {
findHide = true;
dataLayer.setColumnWidthByPosition(i, 0);
}
}
for (int checkPos : checkColumnsPos) {
if (checkPos == i) {
findCheck = true;
dataLayer.setColumnWidthByPosition(i, fixedCheckBoxWidth);
}
}
if (!findHide && !findCheck && !findType) {
dataLayer.setColumnWidthByPosition(i, averageWidth);
}
}
}
}
private List<Integer> addCustomHideColumnsBehaviour(IContextModelManager modelManager, ColumnGroupModel contextGroupModel,
DataLayer dataLayer) {
List<Integer> hidePos = new ArrayList<Integer>();
if (modelManager.getContextManager() != null) {
List<IContext> contexts = modelManager.getContextManager().getListContext();
for (IContext envContext : contexts) {
boolean needHidePrompt = true;
ColumnGroup group = contextGroupModel.getColumnGroupByName(envContext.getName());
// get every context's prompt to see if need to hide or not,decide by the check of prompt
int promptIndex = group.getMembers().get(2);
List<IContextParameter> list = envContext.getContextParameterList();
if (list != null && list.size() > 0) {
for (IContextParameter contextPara : list) {
if (contextPara.isPromptNeeded()) {
needHidePrompt = false;
break;
}
}
}
if (needHidePrompt) {
int hidePosition = dataLayer.getColumnPositionByIndex(promptIndex);
hidePos.add(hidePosition);
natTable.doCommand(new ColumnHideCommand(dataLayer, hidePosition));
}
}
}
return hidePos;
}
private void addCustomSelectionBehaviour(SelectionLayer layer) {
// need control the selection style when select the rows.
DefaultSelectionStyleConfiguration selectStyleConfig = new DefaultSelectionStyleConfiguration();
selectStyleConfig.selectedHeaderBgColor = GUIHelper.COLOR_WIDGET_BACKGROUND;
selectStyleConfig.selectedHeaderFgColor = GUIHelper.COLOR_BLACK;
selectStyleConfig.selectedHeaderFont = GUIHelper.DEFAULT_FONT;
layer.addConfiguration(selectStyleConfig);
}
private void addCustomColumnHeaderStyleBehaviour() {
DefaultColumnHeaderStyleConfiguration columnStyle = new DefaultColumnHeaderStyleConfiguration();
columnStyle.cellPainter = new ContextColumnHeaderDecorator(new TextPainter());
natTable.addConfiguration(columnStyle);
}
private void addCustomStylingBehaviour(Font contextFont, final GlazedListsDataProvider<ContextTreeNode> bodyDataProvider,
ColumnGroupModel groupModel, IContextModelManager modelManager) {
ContextNatTableStyleConfiguration natTableConfiguration = new ContextNatTableStyleConfiguration(contextFont);
natTableConfiguration.cellPainter = new ContextNatTableBackGroudPainter(new ContextAutoResizeTextPainter(false, false,
true), bodyDataProvider);
natTable.addConfiguration(natTableConfiguration);
natTable.addConfiguration(new ContextNatTableConfiguration(bodyDataProvider, groupModel,
modelManager.getContextManager(), modelManager));
}
private void addCustomContextMenuBehavior(final IContextModelManager modelManager,
final GlazedListsDataProvider<ContextTreeNode> bodyDataProvider, final ISelectionProvider selection) {
natTable.addConfiguration(new ContextParaModeChangeMenuConfiguration(natTable, bodyDataProvider, selection));
}
private void addContextColumnGroupsBehaviour(ColumnGroupHeaderLayer columnHeaderLayer, List<IContext> contexts) {
// 0=Name,1=Type,2=Comment.
int i = 2;
for (IContext context : contexts) {
String evnContext = context.getName();
columnHeaderLayer.addColumnsIndexesToGroup(evnContext, new int[] { ++i, ++i, ++i });
}
}
private void registerColumnLabels(ColumnOverrideLabelAccumulator columnLabelAccumulator, List<IContext> contexts) {
columnLabelAccumulator.registerColumnOverrides(0, new String[] { ContextTableConstants.COLUMN_NAME_PROPERTY });
columnLabelAccumulator.registerColumnOverrides(1, new String[] { ContextTableConstants.COLUMN_TYPE_PROPERTY });
columnLabelAccumulator.registerColumnOverrides(2, new String[] { ContextTableConstants.COLUMN_COMMENT_PROPERTY });
// the columns after "type" will caculated by the contexts
// 0=Name,1=Type,2=Comment.
int j = 3;
for (int i = 0; i < contexts.size(); i++) {
columnLabelAccumulator.registerColumnOverrides(j++, new String[] { ContextTableConstants.COLUMN_CONTEXT_VALUE });
columnLabelAccumulator.registerColumnOverrides(j++, new String[] { ContextTableConstants.COLUMN_CHECK_PROPERTY });
columnLabelAccumulator.registerColumnOverrides(j++, new String[] { ContextTableConstants.COLUMN_PROMPT_PROPERTY });
}
}
private static class ContextTreeFormat implements TreeList.Format<ContextTreeNode> {
private final ISortModel sortModel;
public ContextTreeFormat(ISortModel sortModel) {
this.sortModel = sortModel;
}
@Override
public boolean allowsChildren(ContextTreeNode element) {
return true;
}
@Override
public Comparator<ContextTreeNode> getComparator(int depth) {
return new SortableTreeComparator<ContextTreeNode>(GlazedLists.beanPropertyComparator(ContextTreeNode.class,
TREE_CONTEXT_ID), sortModel);
}
/*
* (non-Javadoc)
*
* @see ca.odell.glazedlists.TreeList.Format#getPath(java.util.List, java.lang.Object)
*/
@Override
public void getPath(List<ContextTreeNode> path, ContextTreeNode element) {
path.add(element);
ContextTreeTable.ContextTreeNode parent = element.getParent();
while (parent != null) {
path.add(parent);
parent = parent.getParent();
}
Collections.reverse(path);
}
}
private static class ContextTreeData extends GlazedListTreeData<ContextTreeNode> {
public ContextTreeData(TreeList<ContextTreeNode> treeList) {
super(treeList);
}
@Override
public String formatDataForDepth(int depth, ContextTreeNode object) {
return object.getName();
}
}
private static class ContextExpansionModel implements TreeList.ExpansionModel<ContextTreeNode> {
@Override
public boolean isExpanded(ContextTreeNode element, List<ContextTreeNode> path) {
return true;
}
@Override
public void setExpanded(ContextTreeNode element, List<ContextTreeNode> path, boolean expanded) {
}
}
/**
* A control and it's width.
*/
public class TControl {
Control control;
Integer width;
/**
* Getter for control.
*
* @return the control
*/
public Control getControl() {
return this.control;
}
/**
* Sets the control.
*
* @param control the control to set
*/
public void setControl(Control control) {
this.control = control;
}
/**
* Getter for width.
*
* @return the width
*/
public Integer getWidth() {
return this.width;
}
/**
* Sets the width.
*
* @param width the width to set
*/
public void setWidth(Integer width) {
this.width = width;
}
}
public class ContextTreeNode implements Comparable<ContextTreeNode> {
private IContextModelManager modelManager;
private Object treeData;
private final ContextTreeNode parent;
private final List<ContextTreeNode> children = new ArrayList<ContextTreeNode>();
private final String name;
private final int orderId;
public ContextTreeNode(int orderId, IContextModelManager modelManager, Object data, ContextTreeNode parent, String name) {
this.orderId = orderId;
this.modelManager = modelManager;
this.treeData = data;
this.parent = parent;
if (parent != null) {
parent.addChild(this);
}
this.name = name;
}
public ContextTreeNode getParent() {
return parent;
}
public IContextModelManager getManager() {
return modelManager;
}
public Object getTreeData() {
return treeData;
}
public void addChild(ContextTreeNode child) {
children.add(child);
}
public List<ContextTreeNode> getChildren() {
return children;
}
public ContextTreeNode getSelf() {
return this;
}
public String getName() {
return name;
}
public int getOrderId() {
return this.orderId;
}
/**
* Comparison is based on name only
*/
@Override
public int compareTo(ContextTreeNode o) {
if (this.orderId > o.orderId) {
return 1;
} else if (this.orderId < o.orderId) {
return -1;
} else {
return 0;
}
}
}
private class ContextNatTableToolTip extends DefaultToolTip {
private NatTable nt;
public ContextNatTableToolTip(NatTable natTable) {
super(natTable, 2, false);
this.nt = natTable;
}
@Override
protected Object getToolTipArea(Event event) {
int col = this.nt.getColumnPositionByX(event.x);
int row = this.nt.getRowPositionByY(event.y);
Object cellValue = this.nt.getDataValueByPosition(col, row);
if (cellValue instanceof Boolean) {
return new Point(col, row);
}
return null;
}
@Override
protected String getText(Event event) {
return Messages.getString("ContextTreeTable.PromptToolTips"); //$NON-NLS-1$
}
@Override
protected Composite createToolTipContentArea(Event event, Composite parent) {
return super.createToolTipContentArea(event, parent);
}
}
}

View File

@@ -1,120 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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.context;
import org.eclipse.nebula.widgets.nattable.sort.SortDirectionEnum;
/**
* created by Talend on Jul 9, 2014 Detailled comment
*
*/
public class SortState {
private SortDirectionEnum sortDirection = SortDirectionEnum.NONE;
private int selectedColumnIndex = -1;
private String selectedColumnName = null;
// because the grp_size is String type, so need special operation before sorting
private int grpSizeIndex = -1;
// if the current column is the first time to click, should reset the sort direction
// if the clicked column=current selected column, only need to get next direction
private boolean isColumnChanged = Boolean.FALSE;
private boolean isSortEnable = Boolean.FALSE;
public void reset() {
sortDirection = SortDirectionEnum.NONE;
selectedColumnIndex = -1;
isColumnChanged = Boolean.FALSE;
grpSizeIndex = -1;
isSortEnable = Boolean.FALSE;
selectedColumnName = null;
}
public String getSelectedColumnName() {
return this.selectedColumnName;
}
public void setSelectedColumnName(String selectedColumnName) {
this.selectedColumnName = selectedColumnName;
}
public SortDirectionEnum getNextSortDirection() {
if (isColumnChanged) {
// get the first direction when column changed
sortDirection = SortDirectionEnum.ASC;
} else {
sortDirection = sortDirection.getNextSortDirection();
}
// only when get direction, means that current is sort enabled.
isSortEnable = Boolean.TRUE;
return this.sortDirection;
}
public SortDirectionEnum getCurrentSortDirection() {
return this.sortDirection;
}
public int getSelectedColumnIndex() {
return this.selectedColumnIndex;
}
public void setSelectedColumnIndex(int clickedColumnIndex) {
// if the selected column changed, set isColumnChanged= true
if (clickedColumnIndex != selectedColumnIndex) {
isColumnChanged = Boolean.TRUE;
} else {
isColumnChanged = Boolean.FALSE;
}
this.selectedColumnIndex = clickedColumnIndex;
// every column header click will set the column index
isSortEnable = Boolean.FALSE;
}
public void setGrpSizeIndex(int grpSizeIndex) {
this.grpSizeIndex = grpSizeIndex;
}
public int getGrpSizeIndex() {
return this.grpSizeIndex;
}
public boolean isGroupSizeColumn() {
return grpSizeIndex == selectedColumnIndex;
}
public boolean isSortActive() {
return this.isSortEnable;
}
/**
* check if the given column is the current selected column
*
* @param currentColumnName
* @return
*/
public boolean isSelectedColumn(String columnName) {
if (this.selectedColumnName != null) {
return this.selectedColumnName.equalsIgnoreCase(columnName);
}
return false;
}
public void resetSelectedColumn() {
this.selectedColumnIndex = -1;
this.selectedColumnName = null;
}
}

View File

@@ -1,111 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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.context.cmd;
import java.util.List;
import org.eclipse.gef.commands.Command;
import org.talend.core.model.context.JobContextManager;
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.properties.Item;
/**
* created by ldong on Sep 12, 2014 Detailled comment
*
*/
public class AddContextGroupRelationCommand extends Command {
private IContextParameter param;
private IContextManager contextManager;
private Item sourceItem;
private IContextParameter originaParam;
public AddContextGroupRelationCommand(IContextManager contextManager, IContextParameter param, Item sourceItem) {
super();
this.contextManager = contextManager;
this.param = param;
this.sourceItem = sourceItem;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.commands.Command#execute()
*/
@Override
public void execute() {
boolean isChange = false;
String sourceId = sourceItem.getProperty().getId();
originaParam = param;
if (contextManager != null) {
List<IContext> contexts = contextManager.getListContext();
for (IContext envContext : contexts) {
List<IContextParameter> list = envContext.getContextParameterList();
if (list != null && list.size() > 0) {
for (IContextParameter contextPara : list) {
String tempContextParaName = contextPara.getName();
if (tempContextParaName.equals(param.getName())) {
contextPara.setSource(sourceId);
isChange = true;
}
}
}
}
}
if (isChange) {
updateRelation();
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.commands.Command#undo()
*/
@Override
public void undo() {
String sourceId = originaParam.getSource();
if (contextManager != null) {
List<IContext> contexts = contextManager.getListContext();
for (IContext envContext : contexts) {
List<IContextParameter> list = envContext.getContextParameterList();
if (list != null && list.size() > 0) {
for (IContextParameter contextPara : list) {
String tempContextParaName = contextPara.getName();
if (tempContextParaName.equals(originaParam.getName())) {
contextPara.setSource(sourceId);
}
}
}
}
}
}
private void updateRelation() {
if (param != null) {
if (contextManager != null && contextManager instanceof JobContextManager) {
JobContextManager jobContextManager = (JobContextManager) contextManager;
if (jobContextManager.isOriginalParameter(param.getName())) {
jobContextManager.setModified(true);
contextManager.fireContextsChangedEvent();
}
}
}
}
}

View File

@@ -1,229 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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.context.cmd;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.emf.common.util.EList;
import org.eclipse.gef.commands.Command;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Display;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.exception.PersistenceException;
import org.talend.core.model.context.JobContextManager;
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.properties.ContextItem;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.core.ui.context.ContextManagerHelper;
import org.talend.core.ui.i18n.Messages;
import org.talend.designer.core.model.utils.emf.talendfile.ContextParameterType;
import org.talend.designer.core.model.utils.emf.talendfile.ContextType;
import org.talend.designer.core.model.utils.emf.talendfile.TalendFileFactory;
import org.talend.designer.core.ui.editor.cmd.ContextRemoveParameterCommand;
/**
* created by ldong on Sep 12, 2014 Detailled comment
*
*/
public class ContextBuiltinToRepositoryCommand extends Command {
private List<IContextParameter> params = new ArrayList<IContextParameter>();
private IContextManager contextManager;
private ContextItem item;
private ContextManagerHelper helper;
/**
* DOC ldong ContextBuiltinToRepositoryCommand constructor comment.
*
* @param params
* @param contextManager
* @param item
*/
public ContextBuiltinToRepositoryCommand(List<IContextParameter> params, IContextManager contextManager, ContextItem item) {
super();
this.params = params;
this.contextManager = contextManager;
this.item = item;
this.helper = new ContextManagerHelper(contextManager);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.commands.Command#execute()
*/
@Override
public void execute() {
IContext jobDefaultContext = contextManager.getDefaultContext(); // get default context from job
List<IContext> jobContextlist = contextManager.getListContext(); // get all context from job
List<String> jobContextNames = getJobContextGroupNames(jobContextlist);
if (item == null) {
return;
}
EList contextList = item.getContext();
boolean conflictflag = false;
JobContextManager itemManager = new JobContextManager();
itemManager.loadFromEmf(contextList, item.getDefaultContext());
// this loop is used to get all context groups
for (int i = 0, n = contextList.size(); i < n; i++) {
ContextType type = (ContextType) contextList.get(i);
if (type == null) {
return;
}
EList contextParameters = type.getContextParameter(); // parameters from current contextType
List<IContextParameter> allParameters = getAllExistContextParameters(contextParameters, params);
// find one same context group,this group will get the
// values from the same group of designer
if (jobContextNames.contains(type.getName())) {
int index = jobContextNames.indexOf(type.getName());
IContext currentContext = jobContextlist.get(index);
for (IContextParameter param : params) {
IContextParameter selectedParam = currentContext.getContextParameter(param.getName());
if (!allParameters.contains(param)) {
ContextParameterType parameter = TalendFileFactory.eINSTANCE.createContextParameterType();
copyContextParameter(item, contextParameters, parameter, selectedParam);
} else {
for (int k = 0; k < contextParameters.size(); k++) {
ContextParameterType parameter = (ContextParameterType) contextParameters.get(k);
if (parameter.getName().equals(param.getName())) {
conflictflag = true;
break;
}
}
if (conflictflag) {
// now if add the build-in param into repository context group,if already exist same
// one,just update the relation
addRelationForContextParameter(item, contextParameters, selectedParam);
}
}
}
// this group will get the vaules from default group of designer
} else if (!jobContextNames.contains(type.getName()) && type.getName() != null) {
for (IContextParameter param : params) {
IContextParameter selectedParam = jobDefaultContext.getContextParameter(param.getName());
if (!allParameters.contains(param)) {
ContextParameterType parameter = TalendFileFactory.eINSTANCE.createContextParameterType();
copyContextParameter(item, contextParameters, parameter, selectedParam);
} else {
for (int k = 0; k < contextParameters.size(); k++) {
ContextParameterType parameter = (ContextParameterType) contextParameters.get(k);
if (parameter.getName().equals(param.getName())) {
conflictflag = true;
break;
}
}
if (conflictflag) {
addRelationForContextParameter(item, contextParameters, selectedParam);
}
}
}
}
}
try {
ProxyRepositoryFactory.getInstance().save(item, false);
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
}
private List<IContextParameter> getAllExistContextParameters(EList contextParameters, List<IContextParameter> params) {
List<IContextParameter> allParameters = new ArrayList<IContextParameter>();
for (int i = 0; i < contextParameters.size(); i++) {
ContextParameterType parameter = (ContextParameterType) contextParameters.get(i);
for (IContextParameter param : params) {
if (parameter.getName().equals(param.getName())) {
allParameters.add(param);
}
}
}
return allParameters;
}
/**
* DOC xye Comment method "copyContextParameter".
*
* @param context
* @param item
* @param contextParameters
* @param parameter
* @param param
*/
@SuppressWarnings("unchecked")
private void copyContextParameter(ContextItem item, EList contextParameters, ContextParameterType parameter,
IContextParameter selectedParam) {
parameter.setName(selectedParam.getName());
parameter.setComment(selectedParam.getComment());
parameter.setPrompt(selectedParam.getPrompt());
parameter.setPromptNeeded(selectedParam.isPromptNeeded());
parameter.setType(selectedParam.getType());
parameter.setValue(selectedParam.getValue());
contextParameters.add(parameter);
selectedParam.setSource(item.getProperty().getId());
}
/**
* DOC ldong Comment method "addRelationForContextParameter".
*
* @param contextItem
* @param parameterList
* @param existParam
*/
@SuppressWarnings("unchecked")
private void addRelationForContextParameter(ContextItem contextItem, EList parameterList, IContextParameter existParam) {
Iterator contextParamItor = parameterList.iterator();
while (contextParamItor.hasNext()) {
ContextParameterType defaultContextParamType = (ContextParameterType) contextParamItor.next();
if (defaultContextParamType.getName().equals(existParam.getName())) {
// existed.then create the relation and remove from job context parameters and update from the emf new
// one
boolean isContinue = MessageDialog.openConfirm(Display.getCurrent().getActiveShell(),
Messages.getString("ContextTreeTable.AddToRepository_label"), //$NON-NLS-1$
Messages.getString("ContextBuiltinToRepositoryCommand.addRelation")); //$NON-NLS-1$
if (isContinue) {
new AddContextGroupRelationCommand(contextManager, existParam, contextItem).execute();
new ContextRemoveParameterCommand(contextManager, defaultContextParamType.getName(), existParam.getSource())
.execute();
helper.addContextParameterType(defaultContextParamType);
}
}
}
}
/**
* DOC hyWang Comment method "getJobContextGroupNames".
*/
private List<String> getJobContextGroupNames(List<IContext> jobContextlist) {
List<String> jobContextNames = new ArrayList<String>();
// parameters from designer of default context
for (int k = 0; k < jobContextlist.size(); k++) {
jobContextNames.add(k, jobContextlist.get(k).getName());
}
return jobContextNames;
}
}

View File

@@ -1,56 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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.context.model.table;
/**
* ldong class global comment. Detailled comment
*/
public class ConectionAdaptContextVariableModel {
private String name; // keep the connection parameter's name
private String value;// keep the context variable name
private String customValue; // keep the new context variable name which user defined
public ConectionAdaptContextVariableModel(String name, String value, String customValue) {
this.name = name;
this.value = value;
this.customValue = customValue;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getCustomValue() {
return customValue;
}
public void setCustomValue(String customValue) {
this.customValue = customValue;
}
}

View File

@@ -1,297 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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.context.model.table;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.swt.widgets.TreeItem;
import org.talend.core.language.ECodeLanguage;
import org.talend.core.language.LanguageManager;
import org.talend.core.model.metadata.types.ContextParameterJavaTypeManager;
import org.talend.core.model.metadata.types.JavaType;
import org.talend.core.model.metadata.types.JavaTypesManager;
import org.talend.core.model.process.IContext;
import org.talend.core.model.process.IContextParameter;
import org.talend.core.ui.context.ContextManagerHelper;
import org.talend.core.ui.context.ContextTableValuesComposite;
import org.talend.core.ui.context.model.AbstractContextCellModifier;
import org.talend.core.ui.context.model.template.ContextConstant;
/**
* cli class global comment. Detailled comment
*/
public class ContextTableCellModifier extends AbstractContextCellModifier {
public ContextTableCellModifier(ContextTableValuesComposite parentModel, boolean reposFlag) {
super(parentModel, reposFlag);
}
@Override
protected ContextTableValuesComposite getParentMode() {
return (ContextTableValuesComposite) super.getParentMode();
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.viewers.ICellModifier#canModify(java.lang.Object, java.lang.String)
*/
@Override
public boolean canModify(Object element, String property) {
if (getModelManager().isReadOnly()) {
return false;
}
if (element instanceof ContextTableTabParentModel) {
ContextTableTabParentModel contextTableTabParentModel = (ContextTableTabParentModel) element;
IContextParameter contextPara = contextTableTabParentModel.getContextParameter();
if (contextPara != null) {
String sourceId = contextPara.getSource();
if (IContextParameter.BUILT_IN.equals(sourceId)) {
if (!ContextTableConstants.COLUMN_NAME_PROPERTY.equals(property)) {
return true;
}
}
}
}
return false;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.viewers.ICellModifier#getValue(java.lang.Object, java.lang.String)
*/
@Override
public Object getValue(Object element, String property) {
if (element instanceof ContextTableTabParentModel) {
ContextTableTabParentModel contextTableTabParentModel = (ContextTableTabParentModel) element;
IContextParameter contextPara = contextTableTabParentModel.getContextParameter();
List<IContext> contextList = getParentMode().getContexts();
if (property.equals(ContextTableConstants.COLUMN_TYPE_PROPERTY)) {
String s = ContextManagerHelper.convertFormat(contextPara.getType());
for (int i = 0; i < ContextParameterJavaTypeManager.getJavaTypesLabels().length; i++) {
if (s.equals(ContextParameterJavaTypeManager.getJavaTypesLabels()[i])) {
return i;
}
}
return -1;
} else {
if (contextList != null && contextList.size() > 0) {
for (IContext context : contextList) {
String contextName = context.getName();
if (property.equals(contextName)) {
String tempSourceId = contextPara.getSource();
String tempName = contextPara.getName();
IContextParameter tempContextPara = context.getContextParameter(tempSourceId, tempName);
return tempContextPara.getValue();
}
}
}
}
}
return null;
}
private int getValueIndex(String value) {
String typeLabel = value;
JavaType javaType = ContextParameterJavaTypeManager.getJavaTypeFromId(value);
if (javaType != null) {
typeLabel = javaType.getLabel();
}
String[] TypeValues = ContextParameterJavaTypeManager.getPerlTypesLabels();
for (int i = 0; i < TypeValues.length; i++) {
if (TypeValues[i].equals(typeLabel)) {
return i;
}
}
return -1;
}
/**
* zwang Comment method "getRealParameter".
*
* @param property
* @param templatePara
* @return
*/
public IContextParameter getRealParameter(String property, Object element) {
IContextParameter para = null;
IContext context = null;
if (!(property.equals(ContextTableConstants.COLUMN_NAME_PROPERTY))) {
context = getContextManager().getContext(property);
}
if (context == null) {
return null;
}
if (parentMode.isGroupBySource()) {
if (element instanceof ContextTableTabParentModel) {
if (IContextParameter.BUILT_IN.equals(((ContextTableTabParentModel) element).getSourceId())) {
IContextParameter builtContextParameter = ((ContextTableTabParentModel) element).getContextParameter();
if (builtContextParameter != null) {
para = context.getContextParameter(builtContextParameter.getName());
}
}
} else if (element instanceof ContextTableTabChildModel) {
ContextTableTabChildModel child = (ContextTableTabChildModel) element;
String sourceId = child.getContextParameter().getSource();
para = context.getContextParameter(sourceId, ((ContextTableTabChildModel) element).getContextParameter()
.getName());
}
} else {
if (element instanceof ContextTableTabParentModel) {
ContextTableTabParentModel contextTableTabParentModel = (ContextTableTabParentModel) element;
IContextParameter contextPara = contextTableTabParentModel.getContextParameter();
if (contextPara != null) {
String sourceId = contextPara.getSource();
String sourceName = contextPara.getName();
para = context.getContextParameter(sourceId, sourceName);
}
} else if (element instanceof ContextTableTabChildModel) {
ContextTableTabChildModel child = (ContextTableTabChildModel) element;
para = context.getContextParameter(child.getContextParameter().getName());
}
}
return para;
}
private String getRealType(String type) {
final ECodeLanguage codeLanguage = LanguageManager.getCurrentLanguage();
if (codeLanguage == ECodeLanguage.JAVA) {
StringBuffer sb = new StringBuffer("id_"); //$NON-NLS-1$
JavaType javaType = JavaTypesManager.getJavaTypeFromLabel(type);
if (type.indexOf(ContextConstant.DOWNWARDS_STRING) != -1) {
return javaType.getId();
} else {
if (javaType != null) {
return javaType.getId();
} else {
return sb.append(type.trim()).toString();
}
}
} else {
return type;
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.viewers.ICellModifier#modify(java.lang.Object, java.lang.String, java.lang.Object)
*/
@Override
public void modify(Object element, final String property, final Object value) {
TreeItem item = (TreeItem) element;
final Object object = item.getData();
if (object instanceof ContextTableTabParentModel) {
List<IContext> contextList = getParentMode().getContexts();
if (property.equals(ContextTableConstants.COLUMN_TYPE_PROPERTY)) {
int index = -1;
ContextTableTabParentModel parent = (ContextTableTabParentModel) object;
IContextParameter contextPara = parent.getContextParameter();
String originalName = contextPara.getName();
String s = ContextManagerHelper.convertFormat(contextPara.getType());
for (int i = 0; i < ContextParameterJavaTypeManager.getJavaTypesLabels().length; i++) {
if (s.equals(ContextParameterJavaTypeManager.getJavaTypesLabels()[i])) {
index = i;
}
}
if (index == ((Integer) value)) {
return;
}
String newType = getRealType(ContextParameterJavaTypeManager.getJavaTypesLabels()[(Integer) value]);
contextPara.setType(newType);
String name = contextPara.getName();
for (IContext context : contextList) { // getContextManager().getListContext()
for (IContextParameter contextParameter : context.getContextParameterList()) {
if (name.equals(contextParameter.getName())) {
contextParameter.setType(newType);
}
}
}
List<Object> updateObjs = new ArrayList<Object>();
updateObjs.add(object);
lookupSameNameNode(contextPara.getSource(), originalName, item, updateObjs);
updateRelatedNode(updateObjs.toArray(), contextPara);
} else {
// add all nodes that need to update.
List<Object> list = new ArrayList<Object>();
list.add(object);
IContextParameter para = null;
for (int i = 0; i < (contextList.size() + 2); i++) {
if (property.equals(getParentMode().getColumnProperties()[i])) {
para = getRealParameter(getParentMode().getColumnProperties()[i], object);
getParentMode().getValueChecker().checkErrors(item, i, para);
}
}
if (para == null) {
return;
}
String originalName = para.getName();
String sourceId = null;
if (element instanceof ContextTableTabChildModel) {
ContextTableTabChildModel child = (ContextTableTabChildModel) element;
sourceId = child.getContextParameter().getSource();
}
for (IContext context : contextList) {
if (property.equals(context.getName())) {
if (para.getValue().equals(value)) {
return;
}
para.setValue((String) value);
}
}
// set updated flag.
List<Object> updateObjs = new ArrayList<Object>();
updateObjs.add(object);
lookupSameNameNode(para.getSource(), originalName, item, updateObjs);
updateRelatedNode(updateObjs.toArray(), para);
}
}
}
/**
* To look up all nodes that have the same variable name from input model.
*
* @param nodeName
* @return
*/
private Object[] lookupSameNameNode(String sourceId, String nodeName, TreeItem item, List<Object> updateObjs) {
TreeItem[] items = item.getParent().getItems();
if (items != null && items.length > 0) {
for (TreeItem tempItem : items) {
Object obj = tempItem.getData();
if (obj instanceof ContextTableTabChildModel) {
ContextTableTabChildModel child = (ContextTableTabChildModel) obj;
String tempSourceId = child.getContextParameter().getSource();
String name = child.getName();
if (!sourceId.equals(tempSourceId) && name.equals(name)) {
updateObjs.add(obj);
}
}
}
}
return updateObjs.toArray();
}
}

View File

@@ -1,33 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2015 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.context.model.table;
/**
* cli class global comment. Detailled comment
*/
public class ContextTableConstants {
public static final String COLUMN_NAME_PROPERTY = "Name"; //$NON-NLS-1$
public static final String COLUMN_TYPE_PROPERTY = "Type"; //$NON-NLS-1$
public static final String COLUMN_COMMENT_PROPERTY = "Comment"; //$NON-NLS-1$
public static final String COLUMN_CHECK_PROPERTY = ""; //$NON-NLS-1$
public static final String COLUMN_PROMPT_PROPERTY = "Prompt"; //$NON-NLS-1$
public static final String COLUMN_CONTEXT_VALUE = "Value"; //$NON-NLS-1$
public static final int DEFAULT_COLUMN_COUNT = 8;
}

View File

@@ -1,59 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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.context.nattableTree;
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
import org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter;
import org.eclipse.nebula.widgets.nattable.style.CellStyleAttributes;
import org.eclipse.nebula.widgets.nattable.style.IStyle;
import org.eclipse.nebula.widgets.nattable.util.GUIHelper;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Rectangle;
/**
* created by ldong on Jul 17, 2014 Detailled comment
*
*/
public class ContextAutoResizeTextPainter extends TextPainter {
private boolean changeBackgroundColor = false;
public ContextAutoResizeTextPainter(boolean wrapText, boolean paintBg, boolean calculate) {
super(wrapText, paintBg, calculate);
}
@Override
public void paintCell(ILayerCell cell, GC gc, Rectangle rectangle, IConfigRegistry configRegistry) {
super.paintCell(cell, gc, rectangle, configRegistry);
}
@Override
public void setupGCFromConfig(GC gc, IStyle cellStyle) {
super.setupGCFromConfig(gc, cellStyle);
if (cellStyle.getAttributeValue(CellStyleAttributes.FOREGROUND_COLOR).equals(GUIHelper.COLOR_RED)) {
gc.setForeground(GUIHelper.COLOR_BLACK);
} else if (changeBackgroundColor) {
gc.setForeground(GUIHelper.COLOR_GRAY);
}
}
public void setChangeBackgroundColor(boolean isChange) {
changeBackgroundColor = isChange;
}
@Override
protected boolean performRowResize(int contentHeight, Rectangle rectangle) {
return (contentHeight != rectangle.height) && (this.calculateByTextHeight);
}
}

View File

@@ -1,49 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2014 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.context.nattableTree;
import org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter;
import org.eclipse.nebula.widgets.nattable.painter.cell.decorator.CellPainterDecorator;
import org.eclipse.nebula.widgets.nattable.ui.util.CellEdgeEnum;
/**
* created by ldong on Jul 31, 2014 Detailled comment
*
*/
class ContextCellPainterDecorator extends CellPainterDecorator {
private ContextAutoResizeTextPainter baseCellPainter;
private ICellPainter decoratorCellPainter;
private boolean isChange;
/**
* DOC Talend ContextCellPainterDecorator constructor comment.
*
* @param baseCellPainter
* @param cellEdge
* @param decoratorCellPainter
*/
public ContextCellPainterDecorator(ContextAutoResizeTextPainter baseCellPainter, CellEdgeEnum cellEdge,
ICellPainter decoratorCellPainter) {
super(baseCellPainter, cellEdge, decoratorCellPainter);
this.baseCellPainter = baseCellPainter;
this.decoratorCellPainter = decoratorCellPainter;
}
public void setChangeBackgroundColor(boolean isChange) {
this.isChange = isChange;
baseCellPainter.setChangeBackgroundColor(isChange);
}
}

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