Compare commits
66 Commits
release/7.
...
release/7.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
950c128f61 | ||
|
|
4dc7e4e82f | ||
|
|
4c819add92 | ||
|
|
9c0f5e966d | ||
|
|
da5b7979fd | ||
|
|
8d3832fdfb | ||
|
|
cd8ff90b5b | ||
|
|
d98e5ea43c | ||
|
|
13b57c8823 | ||
|
|
0436bc8dd2 | ||
|
|
091de02e75 | ||
|
|
eb84dfe75d | ||
|
|
a7dd89cc3a | ||
|
|
211abcac09 | ||
|
|
089f43ccd4 | ||
|
|
d008463ef1 | ||
|
|
d7ed643621 | ||
|
|
0972593afd | ||
|
|
c50c5c2e46 | ||
|
|
0b7b156f22 | ||
|
|
30aa2d25a6 | ||
|
|
6a813e2a73 | ||
|
|
4b7a59b497 | ||
|
|
d5490d2663 | ||
|
|
fbfc3735ad | ||
|
|
76fbd6fd32 | ||
|
|
43ef7fa5e0 | ||
|
|
be28a0d122 | ||
|
|
e44522bb69 | ||
|
|
67f04b7db3 | ||
|
|
2502688e64 | ||
|
|
6175aca630 | ||
|
|
55f7531d68 | ||
|
|
d6c888e235 | ||
|
|
7db18b198f | ||
|
|
039ed90481 | ||
|
|
eea9c85609 | ||
|
|
ca9d09e04e | ||
|
|
b5dadab5a5 | ||
|
|
2add3ffc0e | ||
|
|
38b02ee746 | ||
|
|
d8daf75329 | ||
|
|
555a722ade | ||
|
|
8a003e1a21 | ||
|
|
ce75b33a11 | ||
|
|
72fe8689bd | ||
|
|
f71f9c03ed | ||
|
|
7063b514ff | ||
|
|
ee60d35aba | ||
|
|
93db6863a8 | ||
|
|
680031d91f | ||
|
|
e779dfec2d | ||
|
|
e16c7e1af3 | ||
|
|
55aa8236ba | ||
|
|
e381b2f237 | ||
|
|
44b7aee6d0 | ||
|
|
499759ad39 | ||
|
|
cf830accc0 | ||
|
|
ae4cc4cdfd | ||
|
|
909a8e4fb7 | ||
|
|
59d71296ce | ||
|
|
b80b862bcd | ||
|
|
ed2b236467 | ||
|
|
152a06856f | ||
|
|
258be81901 | ||
|
|
8c0bdc29bf |
@@ -20,7 +20,7 @@
|
||||
<import plugin="org.apache.servicemix.bundles.avro" version="0.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.junit" version="4.13.2" match="greaterOrEqual"/>
|
||||
<import plugin="org.slf4j.api" version="0.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.apache.commons.configuration" version="2.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.apache.commons.commons-configuration2" version="2.8.0" match="greaterOrEqual"/>
|
||||
</requires>
|
||||
<plugin id="org.talend.daikon" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
|
||||
<plugin id="org.talend.daikon.exception" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<version>2.12.0</version>
|
||||
<version>2.12.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.reload4j</groupId>
|
||||
|
||||
@@ -12,16 +12,28 @@
|
||||
// ============================================================================
|
||||
package org.talend.commons.utils.workbench.extensions;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.core.runtime.IConfigurationElement;
|
||||
import org.eclipse.core.runtime.IExtension;
|
||||
import org.eclipse.core.runtime.IExtensionPoint;
|
||||
import org.eclipse.core.runtime.IExtensionRegistry;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.preferences.ConfigurationScope;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.exception.IllegalPluginConfigurationException;
|
||||
import org.talend.commons.i18n.internal.Messages;
|
||||
import org.talend.utils.json.JSONException;
|
||||
import org.talend.utils.json.JSONObject;
|
||||
|
||||
/**
|
||||
* Utilities class uses to get implementation of extension points defined by plug-ins. <br/>
|
||||
@@ -36,6 +48,10 @@ public abstract class ExtensionImplementationProvider<I> {
|
||||
|
||||
private String plugInId;
|
||||
|
||||
public final static String FILE_FEATURES_INDEX = "extra_feature.index";
|
||||
|
||||
public final static String DROP_BUNDLE_INFO = "drop.bundle.info";
|
||||
|
||||
/**
|
||||
* Default Constructor. Must not be used.
|
||||
*/
|
||||
@@ -166,9 +182,17 @@ public abstract class ExtensionImplementationProvider<I> {
|
||||
}
|
||||
|
||||
IExtension[] extensions = pt.getExtensions();
|
||||
|
||||
Map<String, String> dropBundles = null;
|
||||
try {
|
||||
dropBundles = getDropBundleInfo();
|
||||
} catch (IOException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
for (IExtension extension : extensions) {
|
||||
|
||||
if (dropBundles != null && dropBundles.containsKey(extension.getNamespaceIdentifier())
|
||||
&& StringUtils.isEmpty(dropBundles.get(extension.getNamespaceIdentifier()))) {
|
||||
continue;
|
||||
}
|
||||
if (plugInId == null || extension.getNamespaceIdentifier().equals(plugInId)) {
|
||||
String configurationElementName = extensionPointLimiter.getConfigurationElementName();
|
||||
if (configurationElementName != null) {
|
||||
@@ -196,6 +220,32 @@ public abstract class ExtensionImplementationProvider<I> {
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
/**********************************************************
|
||||
* Copied from org.talend.commons.configurator
|
||||
**********************************************************/
|
||||
public Map<String, String> getDropBundleInfo() throws IOException {
|
||||
File indexFile = new File(ConfigurationScope.INSTANCE.getLocation().toFile(), FILE_FEATURES_INDEX);
|
||||
if (!indexFile.exists()) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
Map<String, String> dropInfoMap = new HashMap<>();
|
||||
try {
|
||||
String jsonStr = new String(Files.readAllBytes(indexFile.toPath()));
|
||||
if (!jsonStr.isEmpty()) {
|
||||
JSONObject obj = new JSONObject(jsonStr);
|
||||
JSONObject dropInfo = obj.getJSONObject(DROP_BUNDLE_INFO);
|
||||
Iterator<String> iterator = dropInfo.keys();
|
||||
while (iterator.hasNext()) {
|
||||
String key = iterator.next();
|
||||
dropInfoMap.put(key, dropInfo.getString(key));
|
||||
}
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
return dropInfoMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC amaumont Comment method "createAndAddImplementation".
|
||||
*
|
||||
|
||||
@@ -16,7 +16,6 @@ import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyChangeSupport;
|
||||
import java.io.File;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Dictionary;
|
||||
@@ -89,7 +88,6 @@ import org.talend.core.hadoop.BigDataBasicUtil;
|
||||
import org.talend.core.model.general.ILibrariesService;
|
||||
import org.talend.core.model.general.ModuleNeeded;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.metadata.MetadataTalendType;
|
||||
import org.talend.core.model.metadata.builder.connection.AbstractMetadataObject;
|
||||
import org.talend.core.model.metadata.builder.connection.MetadataTable;
|
||||
import org.talend.core.model.migration.IMigrationToolService;
|
||||
@@ -2241,14 +2239,6 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
TimeMeasurePerformance.step("logOnProject", "Sync components libraries"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
try {
|
||||
// for new added mapping file, sync to project mapping folder
|
||||
MetadataTalendType.syncNewMappingFileToProject();
|
||||
} catch (SystemException e) {
|
||||
// ignore
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
|
||||
CodesJarResourceCache.initCodesJarCache();
|
||||
|
||||
currentMonitor = subMonitor.newChild(1, SubMonitor.SUPPRESS_NONE);
|
||||
@@ -2349,17 +2339,6 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
TimeMeasurePerformance.step("logOnProject", "sync log4j"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
|
||||
try {
|
||||
URL url = MetadataTalendType.getProjectForderURLOfMappingsFile();
|
||||
if (url != null) {
|
||||
// set the project mappings url
|
||||
System.setProperty("talend.mappings.url", url.toString()); // $NON-NLS-1$
|
||||
}
|
||||
} catch (SystemException e) {
|
||||
// ignore
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
|
||||
if (runProcessService != null && !isCommandLineLocalRefProject) {
|
||||
runProcessService.initializeRootPoms(monitor);
|
||||
|
||||
|
||||
@@ -0,0 +1,238 @@
|
||||
{
|
||||
"mapping_AS400.xml": {
|
||||
"28fe6b6c94e4e486d431873ba556c1c18ae09140": "7007071c9cf718d34da7d61208ceea7f05de94d0",
|
||||
"3d4845af057220e02773029683a0fd99dee489e5": "a9861e98b581dfdafa7839238710bd930989960a",
|
||||
"458d597928478f43c94098dfe47d9bb8d07e89e2": "d4655e28a5da3e6a2cc03a1305cc1c2970d8e9b8",
|
||||
"76a4aa354d986ed5682797337817a8ddbb80ae89": "d568bf814d7b27fc7c63cbd07ea6b4a3b0ad3ff8"
|
||||
},
|
||||
"mapping_Access.xml": {
|
||||
"55d314ed9708263bfcec193abb57a1e25806626e": "7007071c9cf718d34da7d61208ceea7f05de94d0",
|
||||
"718db25f8e86d6b61284a4ffdc1fd19faffb98a9": "d4655e28a5da3e6a2cc03a1305cc1c2970d8e9b8"
|
||||
},
|
||||
"mapping_AmazonAurora.xml": {
|
||||
"a93c809bdf8e5df8095580e3f23b29658e044302": "ebc9394c2728a3f3850fcbafac4156ef15aab37f",
|
||||
"ba16c203a8a993e13ebab0da5cccb7a5e1c01e56": "7007071c9cf718d34da7d61208ceea7f05de94d0"
|
||||
},
|
||||
"mapping_BigQuery.xml": {
|
||||
"db723e5b4a38bbc8316593be33ab9d74f57776e6": "e1770847f656589810753c19d420228326462f34",
|
||||
"e12df204d9f5081971d03c64b43de2456557e02e": "7007071c9cf718d34da7d61208ceea7f05de94d0",
|
||||
"e9c02d3e9bc3a3649fd33803353e61db6fcd2ea8": "01749151dcc171ebb6457ba872ee352d58a1dfd4"
|
||||
},
|
||||
"mapping_Cassandra.xml": {
|
||||
"20ed188f8824c14852304920cf82ca7119eb1be0": "ab7b23e6c94946ca2358cc0cfd82c4d77a4c5839",
|
||||
"692353c474569bafd44854b7f7343929beddee83": "7007071c9cf718d34da7d61208ceea7f05de94d0",
|
||||
"e42bdadd0009e7595773edcc1652f181a8fdf151": "76ed27054255165c23d8c0c8db081a41a50430c9",
|
||||
"ff005c2bfc47789e5715e949f98bd6d72c934b54": "ebe76b0edd0eda3488527b95f2a6d925d091a408"
|
||||
},
|
||||
"mapping_Cassandra22_datastax.xml": {
|
||||
"2ddd561eac2a04a7b08949c0764c5e76f80c89f5": "b0378fb45ae238b884417db468872341e156f138",
|
||||
"33b483680a44a8229b09698df3803f5834987f18": "7007071c9cf718d34da7d61208ceea7f05de94d0"
|
||||
},
|
||||
"mapping_Cassandra40.xml": {
|
||||
"e92b373950021eb425db9e3eba8391f98ce7e4a8": "7007071c9cf718d34da7d61208ceea7f05de94d0"
|
||||
},
|
||||
"mapping_Cassandra_datastax.xml": {
|
||||
"3cb6b5cf167fb5ba82b3ebdc602f22ecdacdafb5": "56fad9370b27d03a9636d8368350274480fc2bce",
|
||||
"ca09b169eee6e6dcfa81f976bd98ef4aae81cdf2": "7007071c9cf718d34da7d61208ceea7f05de94d0",
|
||||
"e1620c54d6793c6d1885e3e2fcdf242c0e3a4059": "df28e2b92f57ba0486215f334edb649a58788712"
|
||||
},
|
||||
"mapping_Databricks_Delta_Lake.xml": {
|
||||
"d48793d7173ea7d07090f5e683045c3f60cc12c8": "21f5ac777158fc55288af7337737aa675e20bdf3",
|
||||
"dcbe4533fe16fee70f24702edddec78b81e26463": "7007071c9cf718d34da7d61208ceea7f05de94d0"
|
||||
},
|
||||
"mapping_Exasol.xml": {
|
||||
"21ff2b1a69b7242fa48a1218b0d5f8a6b0ba607e": "a0d36282ff5d6825b206ab6f794d13e048ac2192",
|
||||
"3768b1e7a941e66f8a70ad7e1a65aa7d2b598daa": "7ef9ede0f988f10489c1f5ffe16ea24d2d14ecdd",
|
||||
"6babf3080a3baa05bcd8a2815d2f31a0b15e1550": "02a98e53d3b6457272768ce0ae5c82992b403465",
|
||||
"7de8a81bc2eb7c4da639af148c2c67b5c6de4bc0": "7007071c9cf718d34da7d61208ceea7f05de94d0",
|
||||
"a728306274b817e8afa0101d3b7621398addc2f3": "b5b116b3758f58e7500058e1805bf93bf5a2f0c1",
|
||||
"dc2eba14e50ce7c413fb7696355e67d26fe5fb9b": "57bacf1f97951fcf6f650f1afdec35b5ea22638c",
|
||||
"f670268dfd5a8f80fbdbe6fe4ad668cb6c8f25d6": "ead0fb11f124cf05ad0f7fde21cdedbb3cf2160b"
|
||||
},
|
||||
"mapping_Firebird.xml": {
|
||||
"51a041d0b43678433f6303aebac5f92bfdb7b8a6": "7007071c9cf718d34da7d61208ceea7f05de94d0",
|
||||
"d504ece6ca9e10e23f5e0f05660e5f49e7d999ff": "d4655e28a5da3e6a2cc03a1305cc1c2970d8e9b8"
|
||||
},
|
||||
"mapping_Greenplum.xml": {
|
||||
"16418522006e4505c7fb7d44c4d06928de20eaf8": "ec04f46618ef0586081fd3b17ad7b85239958194",
|
||||
"4f3e1b53baca729eef796979e97592c8724a2d91": "caf54e3d2b6c6d685cdcf2a243c28c408a9cd652",
|
||||
"525a7ca1a48599a840b1feca641ef6a413d7384b": "7007071c9cf718d34da7d61208ceea7f05de94d0",
|
||||
"c4ed635e67d7d82c24008677f313e17df98f5d08": "d4655e28a5da3e6a2cc03a1305cc1c2970d8e9b8"
|
||||
},
|
||||
"mapping_H2.xml": {
|
||||
"4e3ed630d3133326a0cf4728865b3efa4cbecc63": "d4655e28a5da3e6a2cc03a1305cc1c2970d8e9b8",
|
||||
"84b0b863c0532f93bffc0ab54d98a449f331e319": "7007071c9cf718d34da7d61208ceea7f05de94d0",
|
||||
"cb093084dc1dc3f999707a1b9d1474f87bbf6d17": "341b1220b6bc6bf59eef81e97c694d06134bd8a2"
|
||||
},
|
||||
"mapping_HSQLDB.xml": {
|
||||
"0a37e2aec423d0c401aff092e4fda9e01c5dd4ff": "d4655e28a5da3e6a2cc03a1305cc1c2970d8e9b8",
|
||||
"73af8e3e8646ea58f4cfe60fe4905e90340b3e12": "890a391388725c112ffbbd2dd8b8d267305df4a7",
|
||||
"98819a80cd8994a02579ea1d9b0992a0b68a5403": "7007071c9cf718d34da7d61208ceea7f05de94d0"
|
||||
},
|
||||
"mapping_Hive.xml": {
|
||||
"0265c6f16ab2c9eea7da660e4e1c8a3ec7bc0ab3": "37ef13c438cda4cd1c3e091d99a00036b328e57f",
|
||||
"1f5811f41b2836cd7baeb23daef91d2ea313f2c6": "3646a1bcd980a3209501a5c846338823f55d74b2",
|
||||
"21a44cd9d32a5478a4de61a86b398a9ef80401ac": "7007071c9cf718d34da7d61208ceea7f05de94d0",
|
||||
"5444fa9a484704d774259430623e0db1495a867f": "ef872732cde37c6c7684dc773641be0b78f5c57c",
|
||||
"e7f128915578dd29538a7debeb5f47528b5a6e59": "86ba7c19d9300a02dbcb0801852e728acd261132"
|
||||
},
|
||||
"mapping_IBMDB2.xml": {
|
||||
"dc42cf143f3a0f10ad8c280f16ef44ae1f907123": "d4655e28a5da3e6a2cc03a1305cc1c2970d8e9b8",
|
||||
"f8aea23cc5b48ebb3cdd229be3f66b28890ff4f8": "7007071c9cf718d34da7d61208ceea7f05de94d0"
|
||||
},
|
||||
"mapping_Impala.xml": {
|
||||
"55ed99aa28c989bd5777f41b7c87ed4eb9f245a8": "7007071c9cf718d34da7d61208ceea7f05de94d0"
|
||||
},
|
||||
"mapping_Informix.xml": {
|
||||
"40da9213cf85b1712f38474dea4f2ec3447dfe3c": "7007071c9cf718d34da7d61208ceea7f05de94d0",
|
||||
"938e41f3719c29248d4f58c303464bbfb50e343a": "d4655e28a5da3e6a2cc03a1305cc1c2970d8e9b8"
|
||||
},
|
||||
"mapping_Ingres.xml": {
|
||||
"811e8bf4e7bc2e6b9c3fcb5f074601a873f15e1d": "15afc1b074c8a6e4aee39c1d5a3347555dbe36a0",
|
||||
"95873faa81ee3de2eea02efab5c127e6188df796": "d4655e28a5da3e6a2cc03a1305cc1c2970d8e9b8",
|
||||
"9c5682f564e861e1db3b5184fd40e718e0912a4a": "d51edc7e08871897572c9b1f1cd2d2d2df347dfb"
|
||||
},
|
||||
"mapping_Interbase.xml": {
|
||||
"4d37474d07991154aa0148e7a030c4725d45ef0d": "d4655e28a5da3e6a2cc03a1305cc1c2970d8e9b8",
|
||||
"71e8386c3e21f726550234c52d3ca50dcfa655de": "d51edc7e08871897572c9b1f1cd2d2d2df347dfb"
|
||||
},
|
||||
"mapping_JavaDB.xml": {
|
||||
"652fd7f2f11fc27903d333e1699cc419804caa66": "7007071c9cf718d34da7d61208ceea7f05de94d0",
|
||||
"66dbe13a0043798498f37b6e5495bc3aaa8fb90b": "d4655e28a5da3e6a2cc03a1305cc1c2970d8e9b8"
|
||||
},
|
||||
"mapping_MSSQL.xml": {
|
||||
"305eeb294ae8bb07bee7d1e182e431e2e7f6273d": "d7761630e63b399f89eaaeb9e19e775bf1579dde",
|
||||
"b93c0825ffd799d89608239385d7e4b60de96209": "7007071c9cf718d34da7d61208ceea7f05de94d0"
|
||||
},
|
||||
"mapping_MaxDB.xml": {
|
||||
"586fc7ac94a9abec8a76a587dc6aa0fae0079bf3": "7007071c9cf718d34da7d61208ceea7f05de94d0"
|
||||
},
|
||||
"mapping_MicrosoftCrm.xml": {
|
||||
"e1c5e77e19adea1406e5bb511a1c6adb8b610bfe": "7007071c9cf718d34da7d61208ceea7f05de94d0"
|
||||
},
|
||||
"mapping_MicrosoftCrm_odata.xml": {
|
||||
"1166b9ce6ce163d11a57046db5ee2dc9d5e496df": "e86fd3fd5c3b4ba9ff613155fba014a80c40cf01",
|
||||
"3f25ced1039b99d1c07b23e3d27cac1562e52a6f": "c1190dfa35e839496745516dbcfeb8a309fa49d0",
|
||||
"750541f00f3c5da6007623f3514add6dc3417a5f": "54331fa4ec501557eb9c32d434c332cf3d121349",
|
||||
"9612a2611bd29461dd46fc70f0e2841892f3f096": "7007071c9cf718d34da7d61208ceea7f05de94d0"
|
||||
},
|
||||
"mapping_MsOdbc.xml": {
|
||||
"01561cb7b5630a4a6aed576215ccdb3991d2db52": "d4655e28a5da3e6a2cc03a1305cc1c2970d8e9b8",
|
||||
"a9c94a6255061e8100b15590da35196464b77d46": "7007071c9cf718d34da7d61208ceea7f05de94d0"
|
||||
},
|
||||
"mapping_Mysql.xml": {
|
||||
"128d7d66eb994a032128949fcbe0c953c158beaa": "956802047d6623ba61e2da68aba2db8f38bca48a",
|
||||
"522654fad6fa3d008ef386fc9360ae51df910729": "d4655e28a5da3e6a2cc03a1305cc1c2970d8e9b8",
|
||||
"5dfc7b71e1f6a9fad6ebf47a1d748893c85bbe5e": "341b1220b6bc6bf59eef81e97c694d06134bd8a2",
|
||||
"894b0d1d2c23c98f2e14920013b82524334dd255": "74b3640e2923d4c60c92042ff03d15b4ac4e9341",
|
||||
"8cb3d2b06d8a2b12e8673e6e9519f85ec08b35ec": "f22d442cbde13623a1b96c15ea2df8dd1a7d755e",
|
||||
"a94341e5bd6c4ba0eef57f9d6d3cc6c0006c785b": "ebc9394c2728a3f3850fcbafac4156ef15aab37f",
|
||||
"d7e74c8e9f8a47ab258472ec43236d2933c70838": "7007071c9cf718d34da7d61208ceea7f05de94d0",
|
||||
"edc9d1453c8f9ac8548822ff2f90a4defcd02094": "fd4d974c755ced1969b27126844b3f462bca1a52"
|
||||
},
|
||||
"mapping_Netezza.xml": {
|
||||
"0c769aa277190990fb33a918cc57189b9ba6306f": "c8ca64da55ceb677fd97169f6a924ec80f01b2fc",
|
||||
"0f5e9677f936a5414ce6593229aa47ea5b757276": "3074a57eee1407a413e460ed27e31d48d21d609b",
|
||||
"b3e25e55f8281cb616b3f549e6a2e5a83d4ad62a": "7007071c9cf718d34da7d61208ceea7f05de94d0"
|
||||
},
|
||||
"mapping_Oracle.xml": {
|
||||
"0407cea7e87144cb601bc9a3f039121feca79b65": "cb6b87dabdc71be0f1db4bdca694bcb61b679c05",
|
||||
"064d2a5940379346638412dd7f4cb7dbcc30e672": "7007071c9cf718d34da7d61208ceea7f05de94d0",
|
||||
"26a2295f6401de6e17feb61b261f7fbdfc4d609d": "e7604a488f339028a3cf14ae4031b0fb3fd50bcc",
|
||||
"9b0306aacec772d9d82be49ab702254ce1e08bea": "912702dc8ea921a34ea0522235db65f8655bf8e9",
|
||||
"df2537b329d0b09828c281e62208daf379f7b60a": "544faa63bbe63dd070a94c84139c705ac6432314"
|
||||
},
|
||||
"mapping_ParAccel.xml": {
|
||||
"1ba71027d3a60773c7c008143c2146e4db2ef112": "d4655e28a5da3e6a2cc03a1305cc1c2970d8e9b8",
|
||||
"5085a1e922f77895a2f7c85e2347acfe03034493": "d51edc7e08871897572c9b1f1cd2d2d2df347dfb"
|
||||
},
|
||||
"mapping_Postgres.xml": {
|
||||
"ce8b7f58644b8f7814a5522d172b4192ff89bd4f": "7007071c9cf718d34da7d61208ceea7f05de94d0",
|
||||
"e1c1f04f95222bcadda336d6a4f0ea07c6ebb08e": "d4655e28a5da3e6a2cc03a1305cc1c2970d8e9b8"
|
||||
},
|
||||
"mapping_PostgresPlus.xml": {
|
||||
"69b7d7f722538a322fb0bf867177d1ce5a0d7ad6": "7007071c9cf718d34da7d61208ceea7f05de94d0",
|
||||
"f576a7bb0327eeff1fd63a9a09106ae33f3ec90e": "d4655e28a5da3e6a2cc03a1305cc1c2970d8e9b8"
|
||||
},
|
||||
"mapping_Redshift.xml": {
|
||||
"0cc6e153fe35041a009cb222e0276e35ddbc92f1": "2023289b9965fc14b959463ba5050be6aead361a",
|
||||
"3b941be88a5f13bd8fd905fb1fa5f2a241e89ed9": "915a307b629c7a75bcbedc86267db1e8995b77f3",
|
||||
"85ba89fdadfca4a2d755856a75e904f6015926a9": "de08533f6561319fc2914181a2705ccd75e29c40",
|
||||
"8f3eda24c1f413b17b2b8c48695dbd786fa29b6b": "93112768d7eea6df44d92a3efbd4f1dfa20e06b6",
|
||||
"ab86d7fda94e0b368f739f73994ce2a2147be12d": "0fd3f58b7aa78aaae6fb40d042780bec64da75e6",
|
||||
"ad0eecc7e9f25c3b904cc11b062a8185456478ee": "7007071c9cf718d34da7d61208ceea7f05de94d0"
|
||||
},
|
||||
"mapping_Redshift_new.xml": {
|
||||
"43085952e178e2c570ab7d2a262278dd2896dd96": "699efe42a33aab3ca0bbaa7a1abee23368e61606"
|
||||
},
|
||||
"mapping_SAPHana.xml": {
|
||||
"1a07a8174468a5a1d55378dd0e21d7c1f9e531bc": "48ea42be6b348a3c993760e7f2c94c58ac08fdae",
|
||||
"331ae8a035e6b1f2cd722be6411df4ae4a95bb33": "7007071c9cf718d34da7d61208ceea7f05de94d0"
|
||||
},
|
||||
"mapping_SQLite.xml": {
|
||||
"0a97b6e8acf8bd16aa34a3c01707f1e2a9eeff1f": "7007071c9cf718d34da7d61208ceea7f05de94d0",
|
||||
"b7b7b7c690efacc208316c911571a8513b5ea713": "d4655e28a5da3e6a2cc03a1305cc1c2970d8e9b8"
|
||||
},
|
||||
"mapping_SingleStore.xml": {
|
||||
"9da7d92af5e9b0697436f74fffd190e8af061567": "7007071c9cf718d34da7d61208ceea7f05de94d0"
|
||||
},
|
||||
"mapping_Snowflake.xml": {
|
||||
"d459c6be3786f9358615eaf692a1c7920b4c6e74": "7007071c9cf718d34da7d61208ceea7f05de94d0"
|
||||
},
|
||||
"mapping_Sybase.xml": {
|
||||
"081038547cac8342cf5cadf8bfd02fe4d2929323": "1ff9877dce90e2ef39b267ea60de534796035a95",
|
||||
"09a0f4dc71ff9a844e1162600409317e92e1ff18": "28534ffb4ae599adec53853776856e82c23c815a",
|
||||
"4ee2c12f372953e77404481a962b3aca14abadb0": "f02b1b6902098b2da90cde6b22a9a49ec328970a",
|
||||
"5752dcfa409e903af77587f151d580c68c9e4ac7": "3db0fa1fbed8ae378d52aa8c36b6fed55d184e5b",
|
||||
"6f4e7913b4b31e8fb4e097690c8b903a58842283": "d4655e28a5da3e6a2cc03a1305cc1c2970d8e9b8",
|
||||
"7676e2d94473564322ce37cad92b7f8b09751b1b": "1cc6237de63892e097c77637ac8457cf8fefbf6f",
|
||||
"8bbad7895713f3a399ddb195c40353e18d3e83b9": "984ca27e4ee0177793b2111797700390424cb746",
|
||||
"bbc091c50a7bd8a8fe630d99a9c2e3f2f878ac88": "67a9b521c9d698b3411fb49410ac61a15f4bc7db",
|
||||
"d841719dcf79a12d0189301e40c0e9e973a45c4f": "7007071c9cf718d34da7d61208ceea7f05de94d0",
|
||||
"e103a9671d9bcf360fd2e61ee97f4547d0d52241": "e19031add3dc54bf9d0e731f3a05738af48ebb6d",
|
||||
"e1c42d74cc0dc3681b5bd45a901a3bedeb53ec68": "75df15acaa5c8d1dcd4a8e855e0df969fdea25d5",
|
||||
"e30d1f01e88bdaf926855e00d1aef3a37a7eb6e4": "c91dd79086a42dce5417de77bb7ce61c0bd6cbbf",
|
||||
"ee5d7f5f9510f63c340f87862327b869bf4cb743": "607764748cdbff669d2ccfcbaafdaa0d83598f32"
|
||||
},
|
||||
"mapping_Teradata.xml": {
|
||||
"10ed107c1d66b38d51739ffdd0820db676c42cef": "45dbf10541f6dd32283038bcc5b04b10e305770a",
|
||||
"55e6a511c2cb39aca11de302a3850eb2d1f6e3a5": "fc652f1cc70f6caa05d5c65e57115f86653f7841",
|
||||
"ac9ffae887ab4d20d4eca0eddc83163e99507ec8": "7007071c9cf718d34da7d61208ceea7f05de94d0",
|
||||
"f9b0367424f721cd8029d3540c9a82f39d74a6b4": "c002b50a69b8a0193780e7c0d1788bbd9a5145c3"
|
||||
},
|
||||
"mapping_VectorWise.xml": {
|
||||
"06f86121a9492b3104047691b19718a5d9d49be9": "d51edc7e08871897572c9b1f1cd2d2d2df347dfb",
|
||||
"edf255202bcfad77ff6f3fac11714891934225c4": "d4655e28a5da3e6a2cc03a1305cc1c2970d8e9b8"
|
||||
},
|
||||
"mapping_Vertica.xml": {
|
||||
"28153eaab1c47b8718ca3c49553ec40b047d2878": "d4655e28a5da3e6a2cc03a1305cc1c2970d8e9b8",
|
||||
"2ee78d7679d4201ad29adba4cc0a48084f161e25": "eecc481d671d330bfb46406ab2533830c668bf22",
|
||||
"819be4680c04a7f77c51fc65ebd1d964a714aa78": "7007071c9cf718d34da7d61208ceea7f05de94d0",
|
||||
"9218d5e7b682513ddf1b891f5f0467ab9938fec3": "341b1220b6bc6bf59eef81e97c694d06134bd8a2",
|
||||
"d9745a57d9f1b6c638ebd57cd5281be020e0614c": "e8f788c5c260f9b82eaaa88d0402423d86a5680d",
|
||||
"dec55a19094d1bcc20f12a8888b27460e83c2e67": "3b582b21fc5ac7ccfb05321c7923591433ced716"
|
||||
},
|
||||
"mapping_XSD.xml": {
|
||||
"1ef837521e274c5b93f5f228955204285b3dd28a": "7007071c9cf718d34da7d61208ceea7f05de94d0",
|
||||
"9c454252343dfe1400d356cbf41bf88e842b4e1e": "c615b3a622e2f6ba8577e812e71977d9f1b1930d"
|
||||
},
|
||||
"mapping_dynamodb.xml": {
|
||||
"891099e88d8074570dc029f9b7d8b04bbc241383": "7007071c9cf718d34da7d61208ceea7f05de94d0"
|
||||
},
|
||||
"mapping_ebcdic.xml": {
|
||||
"b47b25edc9e40d312b548270dbb3f978475be4e7": "7007071c9cf718d34da7d61208ceea7f05de94d0"
|
||||
},
|
||||
"mapping_sap.xml": {
|
||||
"0339bc60ae47e3796c343eee7e2fb1cb1869cefa": "ee49a27e5c3ba3217ab497b1cd4467c088e59f5e",
|
||||
"1f41a55f6f7f1d6d2118e766daf7e3dbfd77551d": "7007071c9cf718d34da7d61208ceea7f05de94d0",
|
||||
"64c23be0c363ab703528677c999e4ef707d54497": "27908d5685066221f02cd3890a5319838215eb8b",
|
||||
"83688cf3134e60d9f5a08b316643a41246717e92": "740c431e0b623cc7d41166588961028ad3efab80",
|
||||
"9df72b6a1f1a72d9be1a4a7fd428873ad9b75bff": "94804b5e96a71d63a294eb9bcfbbb5290824009f",
|
||||
"a300fcd290aa65c254c44d683d30a9fa6ae14a2f": "45e5d88e9c49cb87b47413468073c571f60c0117",
|
||||
"b74c01dff88a52afca5f8c84fbe41d71a34eb6b5": "32832fe0edfbd10d50ed85528481e5c9ca2ec8e0",
|
||||
"c814f616005e1637ec107dd8c0f269bd69661d2e": "7d07608dceb06f7364b5bb8babc0f6e921fc443a"
|
||||
},
|
||||
"mapping_sas.xml": {
|
||||
"4aeb0deb41f61dbe69e85e780fb1e985c9f3d758": "fd44bfb0ee3fc8288465507b937c53619f43c0ec"
|
||||
}
|
||||
}
|
||||
@@ -116,6 +116,7 @@ public interface ICoreService extends IService {
|
||||
|
||||
public String validateValueForDBType(String columnName);
|
||||
|
||||
@Deprecated
|
||||
public void synchronizeMapptingXML(ITalendProcessJavaProject talendJavaProject);
|
||||
|
||||
public IPreferenceStore getPreferenceStore();
|
||||
@@ -124,6 +125,14 @@ public interface ICoreService extends IService {
|
||||
|
||||
public IMetadataTable convert(MetadataTable originalTable);
|
||||
|
||||
@Deprecated
|
||||
public void syncMappingsFileFromSystemToProject();
|
||||
|
||||
public static ICoreService get() {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreService.class)) {
|
||||
return GlobalServiceRegister.getDefault().getService(ICoreService.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -154,6 +155,8 @@ public interface ILibraryManagerService extends IService {
|
||||
public boolean contains(String jarName);
|
||||
|
||||
public void clearCache();
|
||||
|
||||
public void deployLibsFromCustomComponents(File componentFolder, List<ModuleNeeded> modulesNeeded);
|
||||
|
||||
@Deprecated
|
||||
public Set<String> list(boolean withComponent, IProgressMonitor... monitorWrap);
|
||||
|
||||
@@ -380,5 +380,6 @@ public class ConnParameterKeys {
|
||||
|
||||
public static final String CONN_PARA_KEY_KNOX_DIRECTORY="CONN_PARA_KEY_KNOX_DIRECTORY";
|
||||
|
||||
public static final String CONN_PARA_KEY_KNOX_TIMEOUT="CONN_PARA_KEY_KNOX_TIMEOUT";
|
||||
|
||||
}
|
||||
|
||||
@@ -25,8 +25,8 @@ import org.talend.core.database.conn.DatabaseConnConstants;
|
||||
public enum EDatabaseVersion4Drivers {
|
||||
// access
|
||||
ACCESS_JDBC(new DbVersion4Drivers(EDatabaseTypeName.ACCESS, new String[] {
|
||||
"jackcess-2.1.0.jar", "ucanaccess-2.0.9.5.jar", "commons-lang-2.6.jar", "commons-logging-1.1.1.jar", "hsqldb.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"jackcess-encrypt-2.1.0.jar", "bcprov-jdk15on-1.51.jar", "talend-ucanaccess-utils-1.0.0.jar" })),
|
||||
"jackcess-2.1.12.jar", "ucanaccess-2.0.9.5.jar", "commons-lang-2.6.jar", "commons-logging-1.1.3.jar", "hsqldb.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"jackcess-encrypt-2.1.4.jar", "bcprov-jdk15on-1.69.jar", "talend-ucanaccess-utils-1.0.0.jar" })),
|
||||
ACCESS_2003(new DbVersion4Drivers(EDatabaseTypeName.ACCESS, "Access 2003", "Access_2003")), //$NON-NLS-1$ //$NON-NLS-2$
|
||||
ACCESS_2007(new DbVersion4Drivers(EDatabaseTypeName.ACCESS, "Access 2007", "Access_2007")), //$NON-NLS-1$ //$NON-NLS-2$
|
||||
// oracle
|
||||
@@ -87,8 +87,8 @@ public enum EDatabaseVersion4Drivers {
|
||||
MSSQL_PROP(new DbVersion4Drivers(EDatabaseTypeName.MSSQL,
|
||||
"Microsoft", "MSSQL_PROP", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
new String[] { "mssql-jdbc.jar", "slf4j-api-1.7.25.jar", "slf4j-log4j12-1.7.25.jar", "adal4j-1.6.7.jar", //$NON-NLS-1$
|
||||
"commons-lang3-3.10.jar", "commons-codec-1.14.jar", "gson-2.8.6.jar", "oauth2-oidc-sdk-9.7.jar",
|
||||
"json-smart-2.4.7.jar", "nimbus-jose-jwt-8.11.jar", "javax.mail-1.6.2.jar", "reload4j-1.2.19.jar",
|
||||
"commons-lang3-3.10.jar", "commons-codec-1.14.jar", "gson-2.8.9.jar", "oauth2-oidc-sdk-9.7.jar",
|
||||
"json-smart-2.4.7.jar", "nimbus-jose-jwt-9.22.jar", "javax.mail-1.6.2.jar", "reload4j-1.2.19.jar",
|
||||
"accessors-smart-2.4.7.jar", "asm-9.1.jar", "content-type-2.1.jar" })),
|
||||
|
||||
VERTICA_9(new DbVersion4Drivers(EDatabaseTypeName.VERTICA, "VERTICA 9.X", "VERTICA_9_0", "vertica-jdbc-9.3.1-0.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
@@ -107,12 +107,12 @@ public enum EDatabaseVersion4Drivers {
|
||||
GREENPLUM_PSQL(new DbVersion4Drivers(EDatabaseTypeName.GREENPLUM,"PostgreSQL", "POSTGRESQL", "postgresql-8.4-703.jdbc4.jar")), //$NON-NLS-1$
|
||||
GREENPLUM(new DbVersion4Drivers(EDatabaseTypeName.GREENPLUM,"Greenplum", "GREENPLUM", "greenplum-5.1.4.000275.jar")), //$NON-NLS-1$
|
||||
// PSQL_V10(new DbVersion4Drivers(EDatabaseTypeName.PSQL, "v10", "V10", "postgresql-42.2.5.jar")),
|
||||
PSQL_V9_X(new DbVersion4Drivers(EDatabaseTypeName.PSQL, "v9 and later", "V9_X", "postgresql-42.2.25.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
PSQL_V9_X(new DbVersion4Drivers(EDatabaseTypeName.PSQL, "v9 and later", "V9_X", "postgresql-42.2.26.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
PSQL_PRIOR_TO_V9(new DbVersion4Drivers(EDatabaseTypeName.PSQL, "Prior to v9", "PRIOR_TO_V9", "postgresql-8.4-703.jdbc4.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
|
||||
PLUSPSQL_PRIOR_TO_V9(new DbVersion4Drivers(EDatabaseTypeName.PLUSPSQL,
|
||||
"Prior to v9", "PRIOR_TO_V9", "postgresql-8.4-703.jdbc4.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
PLUSPSQL_V9_X(new DbVersion4Drivers(EDatabaseTypeName.PLUSPSQL, "v9 and later", "V9_X", "postgresql-42.2.25.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
PLUSPSQL_V9_X(new DbVersion4Drivers(EDatabaseTypeName.PLUSPSQL, "v9 and later", "V9_X", "postgresql-42.2.26.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
IBMDB2(new DbVersion4Drivers(EDatabaseTypeName.IBMDB2, new String[] { "db2jcc4.jar", "db2jcc_license_cu.jar", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"db2jcc_license_cisuz.jar" })), //$NON-NLS-1$
|
||||
IBMDB2ZOS(new DbVersion4Drivers(EDatabaseTypeName.IBMDB2ZOS, new String[] { "db2jcc4.jar", "db2jcc_license_cu.jar", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
@@ -171,8 +171,10 @@ public enum EDatabaseVersion4Drivers {
|
||||
REDSHIFT(new DbVersion4Drivers(EDatabaseTypeName.REDSHIFT, "redshift", "REDSHIFT", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
new String[]{ "redshift-jdbc42-no-awssdk-1.2.55.1083.jar", "antlr4-runtime-4.8-1.jar" })), //$NON-NLS-1$ //$NON-NLS-2$
|
||||
REDSHIFT_SSO(new DbVersion4Drivers(EDatabaseTypeName.REDSHIFT_SSO, "redshift sso", "REDSHIFT_SSO", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
new String[] { "redshift-jdbc42-no-awssdk-1.2.55.1083.jar", "antlr4-runtime-4.8-1.jar", "aws-java-sdk-1.11.848.jar", "jackson-core-2.10.1.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
"jackson-databind-2.10.1.jar", "jackson-annotations-2.10.1.jar", "httpcore-4.4.11.jar", "httpclient-4.5.9.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$//$NON-NLS-4$
|
||||
new String[] { "redshift-jdbc42-no-awssdk-1.2.55.1083.jar", "antlr4-runtime-4.8-1.jar", "aws-java-sdk-1.11.848.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"jackson-core-2.13.4.jar", //$NON-NLS-1$
|
||||
"jackson-databind-2.13.4.2.jar", "jackson-annotations-2.13.4.jar", "httpcore-4.4.11.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"httpclient-4.5.9.jar", //$NON-NLS-1$
|
||||
"joda-time-2.8.1.jar", "commons-logging-1.2.jar", "commons-codec-1.11.jar" })), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
|
||||
AMAZON_AURORA(new DbVersion4Drivers(EDatabaseTypeName.AMAZON_AURORA, "mysql-connector-java-5.1.49.jar")); //$NON-NLS-1$
|
||||
|
||||
@@ -38,7 +38,10 @@ public class HadoopClassLoaderFactory2 {
|
||||
public static ClassLoader getHDFSClassLoader(String relatedClusterId, String distribution, String version, boolean useKrb) {
|
||||
return getClassLoader(relatedClusterId, EHadoopCategory.HDFS, distribution, version, useKrb);
|
||||
}
|
||||
|
||||
public static ClassLoader getHDFSKnoxClassLoader(String relatedClusterId, String distribution, String version, boolean useKrb) {
|
||||
return HadoopClassLoaderFactory2.getClassLoader(relatedClusterId, EHadoopCategory.HDFS, distribution, version, useKrb,
|
||||
IHadoopArgs.HDFS_ARG_KNOX);
|
||||
}
|
||||
public static ClassLoader getMRClassLoader(String relatedClusterId, String distribution, String version, boolean useKrb) {
|
||||
return getClassLoader(relatedClusterId, EHadoopCategory.MAP_REDUCE, distribution, version, useKrb);
|
||||
}
|
||||
|
||||
@@ -22,4 +22,6 @@ public interface IHadoopArgs {
|
||||
|
||||
public static final String HIVE_ARG_STANDALONE = "STANDALONE"; //$NON-NLS-1$
|
||||
|
||||
public static final String HDFS_ARG_KNOX = "USE_KNOX"; //$NON-NLS-1$
|
||||
|
||||
}
|
||||
|
||||
@@ -194,6 +194,10 @@ public interface IMetadataConnection extends IMetadata {
|
||||
public String getContextName();
|
||||
|
||||
public void setContextName(String contextName);
|
||||
|
||||
public boolean isSupportNLS();
|
||||
|
||||
public void setSupportNLS(boolean newSupportNLS);
|
||||
|
||||
/**
|
||||
* Returns the value that you stored in the data collection by the key. Normally, it is like this key-value. For
|
||||
|
||||
@@ -16,6 +16,7 @@ import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Files;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@@ -24,18 +25,20 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.ProjectScope;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
@@ -46,9 +49,9 @@ import org.eclipse.core.runtime.Platform;
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.exception.SystemException;
|
||||
import org.talend.commons.runtime.xml.XmlUtil;
|
||||
import org.talend.commons.utils.io.FilesUtils;
|
||||
import org.talend.commons.utils.workbench.resources.ResourceUtils;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.ICoreService;
|
||||
import org.talend.core.database.EDatabaseTypeName;
|
||||
import org.talend.core.language.ECodeLanguage;
|
||||
import org.talend.core.language.LanguageManager;
|
||||
@@ -59,6 +62,8 @@ import org.talend.core.runtime.CoreRuntimePlugin;
|
||||
import org.talend.core.runtime.i18n.Messages;
|
||||
import org.talend.core.utils.TalendQuoteUtils;
|
||||
import org.talend.repository.ProjectManager;
|
||||
import org.talend.repository.model.RepositoryConstants;
|
||||
import org.talend.utils.json.JSONObject;
|
||||
import org.talend.utils.xml.XmlUtils;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
@@ -75,14 +80,13 @@ import org.xml.sax.SAXException;
|
||||
*/
|
||||
public final class MetadataTalendType {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public static final String INTERNAL_MAPPINGS_FOLDER = "mappings"; //$NON-NLS-1$
|
||||
|
||||
public static final String PROJECT_MAPPING_FOLDER = ".settings/mappings"; //$NON-NLS-1$
|
||||
|
||||
public static final String UPDATED_MAPPING_FILES = "updated.mapping.files"; //$NON-NLS-1$
|
||||
public static final String FILE_MAPPING_REVISION = "mapping_revision.json"; //$NON-NLS-1$
|
||||
|
||||
public static final String MAPPING_FILE_PATTERN = "^mapping_.*\\.xml$"; //$NON-NLS-1$
|
||||
|
||||
private static ECodeLanguage codeLanguage;
|
||||
|
||||
@@ -459,13 +463,14 @@ public final class MetadataTalendType {
|
||||
return list;
|
||||
}
|
||||
|
||||
public static URL getSystemForderURLOfMappingsFile() throws SystemException {
|
||||
public static URL getSystemFolderURLOfMappingsFile() throws SystemException {
|
||||
String dirPath = "/" + INTERNAL_MAPPINGS_FOLDER; //$NON-NLS-1$
|
||||
URL url = null;
|
||||
Path filePath = new Path(dirPath);
|
||||
Bundle b = Platform.getBundle(CoreRuntimePlugin.PLUGIN_ID);
|
||||
if (b != null) {
|
||||
try {
|
||||
// Enumeration<URL> entries = b.findEntries(dirPath, "mapping_*.xml", false);
|
||||
url = FileLocator.toFileURL(FileLocator.find(b, filePath, null));
|
||||
} catch (IOException e) {
|
||||
throw new SystemException(e);
|
||||
@@ -474,46 +479,169 @@ public final class MetadataTalendType {
|
||||
return url;
|
||||
}
|
||||
|
||||
public static URL getProjectForderURLOfMappingsFile() throws SystemException {
|
||||
public static URL getProjectFolderURLOfMappingsFile() throws SystemException {
|
||||
try {
|
||||
String dirPath = "/" + INTERNAL_MAPPINGS_FOLDER; //$NON-NLS-1$
|
||||
IProject project = ResourceUtils.getProject(ProjectManager.getInstance().getCurrentProject());
|
||||
IPath settingPath = new ProjectScope(project).getLocation();
|
||||
IPath mappingPath = settingPath.append(dirPath);
|
||||
File mappingFolder = mappingPath.toFile();
|
||||
if (!mappingFolder.exists() || mappingFolder.listFiles().length < 1) {
|
||||
ICoreService service = null;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreService.class)) {
|
||||
service = GlobalServiceRegister.getDefault().getService(ICoreService.class);
|
||||
service.syncMappingsFileFromSystemToProject();
|
||||
}
|
||||
}
|
||||
return mappingFolder.toURL();
|
||||
File mappingFolder = settingPath.append(dirPath).toFile();
|
||||
return mappingFolder.toURI().toURL();
|
||||
} catch (Exception e) {
|
||||
throw new SystemException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static String getSha1OfFile(File file) {
|
||||
String sha1 = null;
|
||||
FileInputStream fileInputStream = null;
|
||||
public static URL getProjectTempMappingFolder() {
|
||||
try {
|
||||
fileInputStream = new FileInputStream(file);
|
||||
sha1 = DigestUtils.shaHex(fileInputStream);
|
||||
IProject project = ResourceUtils.getProject(ProjectManager.getInstance().getCurrentProject());
|
||||
File folder = ResourceUtils
|
||||
.getFolder(project, RepositoryConstants.TEMP_DIRECTORY + "/" + INTERNAL_MAPPINGS_FOLDER, false).getLocation()
|
||||
.toFile();
|
||||
syncMappingFiles(folder, false);
|
||||
return folder.toURI().toURL();
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
} finally {
|
||||
if (fileInputStream != null) {
|
||||
try {
|
||||
fileInputStream.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace(); // Just print the exception for debug.
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void syncMappingFiles(File target, boolean rename) {
|
||||
if (!target.exists()) {
|
||||
target.mkdir();
|
||||
}
|
||||
File[] arr = target.listFiles(f -> f.getName().matches(MAPPING_FILE_PATTERN));
|
||||
if (arr == null) {
|
||||
arr = new File[0];
|
||||
}
|
||||
try {
|
||||
Map<String, File> targetFileMap = Stream.of(arr).collect(Collectors.toMap(File::getName, Function.identity()));
|
||||
Map<String, File> workingFileMap = getWorkingMappingFiles().stream()
|
||||
.collect(Collectors.toMap(f -> getTargetName(f, rename), Function.identity(), (f1, f2) -> f1));
|
||||
|
||||
targetFileMap.entrySet().stream().filter(entry -> !workingFileMap.containsKey(entry.getKey()))
|
||||
.forEach(entry -> entry.getValue().delete());
|
||||
|
||||
for (Entry<String, File> entry : workingFileMap.entrySet()) {
|
||||
String targetName = entry.getKey();
|
||||
File workingMappingFile = entry.getValue();
|
||||
boolean needUpdate = false;
|
||||
File targetMappingFile = targetFileMap.get(targetName);
|
||||
if (targetMappingFile == null) {
|
||||
targetMappingFile = new File(target, targetName);
|
||||
needUpdate = true;
|
||||
} else if (!getSha1OfFile(workingMappingFile).equals(getSha1OfFile(targetMappingFile))) {
|
||||
needUpdate = true;
|
||||
}
|
||||
if (needUpdate) {
|
||||
if (targetMappingFile.exists()) {
|
||||
targetMappingFile.delete();
|
||||
}
|
||||
FilesUtils.copyFile(workingMappingFile, targetMappingFile);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return sha1;
|
||||
}
|
||||
|
||||
public static String getTargetName(File file, boolean rename) {
|
||||
String targetName = file.getName();
|
||||
if (!rename) {
|
||||
return targetName;
|
||||
}
|
||||
try {
|
||||
DocumentBuilderFactory documentBuilderFactory = XmlUtils.getSecureDocumentBuilderFactory();
|
||||
DocumentBuilder analyser = documentBuilderFactory.newDocumentBuilder();
|
||||
Document document = analyser.parse(file);
|
||||
NodeList dbmsNodes = document.getElementsByTagName("dbms"); //$NON-NLS-1$
|
||||
String dbmsIdValue = "";
|
||||
for (int iDbms = 0; iDbms < dbmsNodes.getLength(); iDbms++) {
|
||||
Node dbmsNode = dbmsNodes.item(iDbms);
|
||||
NamedNodeMap dbmsAttributes = dbmsNode.getAttributes();
|
||||
dbmsIdValue = dbmsAttributes.getNamedItem("id").getNodeValue(); //$NON-NLS-1$
|
||||
|
||||
}
|
||||
if (dbmsIdValue != null && !"".equals(dbmsIdValue)) {
|
||||
final String[] fileNameSplit = targetName.split("_");
|
||||
String idA = "_id";
|
||||
String idB = "id_";
|
||||
final int indexA = dbmsIdValue.indexOf(idA);
|
||||
final int indexB = dbmsIdValue.indexOf(idB);
|
||||
String secondeName = "";
|
||||
if (indexA > 0) {
|
||||
secondeName = dbmsIdValue.substring(0, dbmsIdValue.length() - idA.length());
|
||||
} else if (indexB == 0) {
|
||||
secondeName = dbmsIdValue.substring(idB.length(), dbmsIdValue.length());
|
||||
} else if (indexA == -1 && indexB == -1) {
|
||||
secondeName = dbmsIdValue;
|
||||
}
|
||||
if (secondeName != null && !"".equals(secondeName)) {
|
||||
targetName = fileNameSplit[0] + "_" + secondeName.toLowerCase() + XmlUtil.FILE_XML_SUFFIX;
|
||||
}
|
||||
|
||||
}
|
||||
} catch (ParserConfigurationException e) {
|
||||
ExceptionHandler.process(e);
|
||||
} catch (SAXException e) {
|
||||
ExceptionHandler.process(e);
|
||||
} catch (IOException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return targetName;
|
||||
}
|
||||
|
||||
public static JSONObject getRevisionObject() {
|
||||
try {
|
||||
File revisonFile = new File(MetadataTalendType.getSystemFolderURLOfMappingsFile().getFile(),
|
||||
MetadataTalendType.FILE_MAPPING_REVISION);
|
||||
String jsonStr = new String(Files.readAllBytes(revisonFile.toPath()));
|
||||
return new JSONObject(jsonStr);
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return new JSONObject();
|
||||
}
|
||||
|
||||
public static boolean restoreMappingFiles() throws Exception {
|
||||
List<File> toDelete = new ArrayList<>();
|
||||
JSONObject revision = getRevisionObject();
|
||||
File projectMappingFolder = new File(getProjectFolderURLOfMappingsFile().getFile());
|
||||
if (projectMappingFolder.exists()) {
|
||||
File[] projectMappingFiles = projectMappingFolder.listFiles(f -> f.getName().matches(MAPPING_FILE_PATTERN));
|
||||
if (projectMappingFiles != null) {
|
||||
for (File file : projectMappingFiles) {
|
||||
if (revision.has(file.getName())) {
|
||||
String sha1 = MetadataTalendType.getSha1OfFile(file);
|
||||
if (revision.getJSONObject(file.getName()).has(sha1)) {
|
||||
toDelete.add(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File xsd = new File(projectMappingFolder, "mapping_validate.xsd"); //$NON-NLS-1$
|
||||
if (xsd.exists()) {
|
||||
xsd.delete();
|
||||
}
|
||||
}
|
||||
toDelete.forEach(File::delete);
|
||||
return !toDelete.isEmpty();
|
||||
}
|
||||
|
||||
public static String getSha1OfFile(File file) {
|
||||
try {
|
||||
String text = new String(Files.readAllBytes(file.toPath()));
|
||||
return getSha1OfText(text);
|
||||
} catch (IOException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getSha1OfText(String text) {
|
||||
text = text.replace("\r\n", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
return DigestUtils.sha1Hex(text);
|
||||
}
|
||||
|
||||
public static void copyFile(File in, IFile out) throws CoreException, IOException {
|
||||
FileInputStream fis = new FileInputStream(in);
|
||||
if (out.exists()) {
|
||||
@@ -524,49 +652,6 @@ public final class MetadataTalendType {
|
||||
fis.close();
|
||||
}
|
||||
|
||||
public static void syncNewMappingFileToProject() throws SystemException {
|
||||
try {
|
||||
File sysMappingFiles = new File(MetadataTalendType.getSystemForderURLOfMappingsFile().getPath());
|
||||
IFolder projectMappingFolder = ResourceUtils.getProject(ProjectManager.getInstance().getCurrentProject())
|
||||
.getFolder(MetadataTalendType.PROJECT_MAPPING_FOLDER);
|
||||
File projectMappingFiles = new File(projectMappingFolder.getLocationURI());
|
||||
if (!sysMappingFiles.exists() || !projectMappingFiles.exists()) {
|
||||
return;
|
||||
}
|
||||
for (File sysMapping : sysMappingFiles.listFiles()) {
|
||||
IFile projectMapping = projectMappingFolder.getFile(sysMapping.getName());
|
||||
if (projectMapping.exists() && StringUtils.equals(sysMapping.getName(), "mapping_Greenplum.xml")) {
|
||||
|
||||
String sha1OfFile = DigestUtils.shaHex(projectMapping.getContents());
|
||||
String shalOfOldSystem = "8431f19215dacb3caa126778ae695954552cce2a";
|
||||
if (StringUtils.equals(sha1OfFile, shalOfOldSystem)) {
|
||||
copyFile(sysMapping, projectMapping);
|
||||
}
|
||||
}
|
||||
if (!projectMapping.exists()) {
|
||||
FileInputStream fis = null;
|
||||
try {
|
||||
fis = new FileInputStream(sysMapping);
|
||||
projectMapping.create(fis, true, null);
|
||||
} catch (CoreException coreExc) {
|
||||
throw new SystemException(coreExc);
|
||||
} finally {
|
||||
if (fis != null) {
|
||||
try {
|
||||
fis.close();
|
||||
} catch (IOException ioExc) {
|
||||
throw new SystemException(ioExc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new SystemException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Load db types and mapping with the current activated language (Java, Perl, ...).
|
||||
@@ -574,20 +659,38 @@ public final class MetadataTalendType {
|
||||
* @throws SystemException
|
||||
*/
|
||||
public static void loadCommonMappings() throws SystemException {
|
||||
URL url = getProjectForderURLOfMappingsFile();
|
||||
File dir = new File(url.getPath());
|
||||
metadataMappingFiles = new ArrayList<File>();
|
||||
dbmsSet.clear();
|
||||
if (dir.isDirectory()) {
|
||||
File[] files = dir.listFiles();
|
||||
for (File file : files) {
|
||||
if (file.getName().matches("^mapping_.*\\.xml$")) { //$NON-NLS-1$
|
||||
loadMapping(file);
|
||||
metadataMappingFiles.add(file);
|
||||
}
|
||||
}
|
||||
for (File file : getWorkingMappingFiles()) {
|
||||
loadMapping(file);
|
||||
metadataMappingFiles.add(file);
|
||||
}
|
||||
}
|
||||
|
||||
public static List<File> getWorkingMappingFiles() throws SystemException {
|
||||
File projectMappingFolder = new File(getProjectFolderURLOfMappingsFile().getFile());
|
||||
File[] projectMappingFiles = projectMappingFolder.listFiles(f -> f.getName().matches(MAPPING_FILE_PATTERN));
|
||||
File systemMappingFolder = new File(getSystemFolderURLOfMappingsFile().getFile());
|
||||
File[] systemMappingFiles = systemMappingFolder.listFiles(f -> f.getName().matches(MAPPING_FILE_PATTERN));
|
||||
if (projectMappingFiles == null || projectMappingFiles.length == 0) {
|
||||
return Arrays.asList(systemMappingFiles);
|
||||
}
|
||||
List<File> workingMappingFiles = new ArrayList<>();
|
||||
Map<String, File> projectMappingFilesMap = Stream.of(projectMappingFiles)
|
||||
.collect(Collectors.toMap(File::getName, Function.identity()));
|
||||
workingMappingFiles.addAll(projectMappingFilesMap.values());
|
||||
Stream.of(systemMappingFiles).filter(f -> !projectMappingFilesMap.containsKey(f.getName()))
|
||||
.forEach(f -> workingMappingFiles.add(f));
|
||||
return workingMappingFiles;
|
||||
}
|
||||
|
||||
public static String getSha1OfSystemMappingFile(String fileName) {
|
||||
try {
|
||||
return getSha1OfFile(new File(getSystemFolderURLOfMappingsFile().getFile(), fileName));
|
||||
} catch (SystemException e) {
|
||||
ExceptionHandler.process(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void loadMapping(File file) throws SystemException {
|
||||
|
||||
@@ -254,6 +254,7 @@ public final class ConvertionHelper {
|
||||
result.setContentModel(connection.isContextMode());
|
||||
result.setContextId(sourceConnection.getContextId());
|
||||
result.setContextName(sourceConnection.getContextName());
|
||||
result.setSupportNLS(sourceConnection.isSupportNLS());
|
||||
// handle oracle database connnection of general_jdbc.
|
||||
result.setSchema(getMeataConnectionSchema(result));
|
||||
convertOtherParameters(result, connection);
|
||||
|
||||
@@ -113,6 +113,7 @@ public class MetadataConnection implements IMetadataConnection {
|
||||
|
||||
private String contextName;
|
||||
|
||||
private boolean supportNLS = false;
|
||||
// ~
|
||||
|
||||
private String comment;
|
||||
@@ -729,6 +730,14 @@ public class MetadataConnection implements IMetadataConnection {
|
||||
public void setContextName(String contextName) {
|
||||
this.contextName = contextName;
|
||||
}
|
||||
|
||||
public boolean isSupportNLS() {
|
||||
return supportNLS;
|
||||
}
|
||||
|
||||
public void setSupportNLS(boolean supportNLS) {
|
||||
this.supportNLS = supportNLS;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
|
||||
@@ -1225,6 +1225,11 @@ public class RepositoryToComponentProperty {
|
||||
return value2;
|
||||
|
||||
}
|
||||
|
||||
if(value.equals("SUPPORT_NLS")) {
|
||||
return connection.isSupportNLS();
|
||||
}
|
||||
|
||||
if (value.equals("CDC_TYPE_MODE")) { //$NON-NLS-1$
|
||||
return new Boolean(CDCTypeMode.LOG_MODE.getName().equals(connection.getCdcTypeMode()));
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.eclipse.ui.preferences.ScopedPreferenceStore;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.utils.PasswordEncryptUtil;
|
||||
import org.talend.commons.utils.generation.CodeGenerationUtils;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.language.ECodeLanguage;
|
||||
import org.talend.core.language.LanguageManager;
|
||||
import org.talend.core.model.metadata.types.JavaType;
|
||||
@@ -37,6 +38,7 @@ import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.model.utils.JavaResourcesHelper;
|
||||
import org.talend.core.model.utils.SQLPatternUtils;
|
||||
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||
import org.talend.core.service.IDesignerXMLMapperService;
|
||||
import org.talend.core.utils.TalendQuoteUtils;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ContextType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType;
|
||||
@@ -293,8 +295,7 @@ public final class ElementParameterParser {
|
||||
|
||||
List<IElementParameter> params = (List<IElementParameter>) element.getElementParametersWithChildrens();
|
||||
if (params != null && !params.isEmpty()) {
|
||||
for (int i = 0; i < params.size(); i++) {
|
||||
IElementParameter param = params.get(i);
|
||||
for (IElementParameter param : params) {
|
||||
if (text.indexOf(param.getVariableName()) != -1
|
||||
|| (param.getVariableName() != null && param.getVariableName().contains(text))) {
|
||||
if (param.getFieldType() == EParameterFieldType.TABLE) {
|
||||
@@ -422,8 +423,8 @@ public final class ElementParameterParser {
|
||||
}
|
||||
IElementParameter param;
|
||||
|
||||
for (int i = 0; i < element.getElementParameters().size(); i++) {
|
||||
param = element.getElementParameters().get(i);
|
||||
for (IElementParameter element2 : element.getElementParameters()) {
|
||||
param = element2;
|
||||
if (text.indexOf(param.getVariableName()) != -1) {
|
||||
if (param.getFieldType() == EParameterFieldType.TABLE) {
|
||||
return createTableValuesXML((List<Map<String, Object>>) param.getValue(), param);
|
||||
@@ -483,7 +484,21 @@ public final class ElementParameterParser {
|
||||
if (element instanceof INode) {
|
||||
INode node = (INode) element;
|
||||
if (node.getExternalNode() != null) {
|
||||
return EcoreUtil.copy(node.getExternalNode().getExternalEmfData());
|
||||
Object obj = null;
|
||||
if (node.isVirtualGenerateNode()) {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerXMLMapperService.class)) {
|
||||
final IDesignerXMLMapperService service = GlobalServiceRegister.getDefault()
|
||||
.getService(IDesignerXMLMapperService.class);
|
||||
if (service != null) {
|
||||
obj = service.rebuildXmlMapData(node.getExternalNode());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (obj != null) {
|
||||
return obj;
|
||||
} else {
|
||||
return EcoreUtil.copy(node.getExternalNode().getExternalEmfData());
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -496,8 +511,8 @@ public final class ElementParameterParser {
|
||||
}
|
||||
IElementParameter param;
|
||||
newText = text;
|
||||
for (int i = 0; i < element.getElementParameters().size(); i++) {
|
||||
param = element.getElementParameters().get(i);
|
||||
for (IElementParameter element2 : element.getElementParameters()) {
|
||||
param = element2;
|
||||
if (newText.contains(param.getVariableName())) {
|
||||
String value = getDisplayValue(param);
|
||||
newText = newText.replace(param.getVariableName(), value);
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.talend.core.runtime.projectsetting.ProjectPreferenceManager;
|
||||
import org.talend.core.service.IRemoteService;
|
||||
import org.talend.repository.model.IProxyRepositoryFactory;
|
||||
import org.talend.repository.model.RepositoryConstants;
|
||||
import org.talend.utils.security.StudioEncryption;
|
||||
|
||||
/**
|
||||
* created by wchen on 2015年6月16日 Detailled comment
|
||||
@@ -255,7 +256,7 @@ public class TalendLibsServerManager {
|
||||
if (enableProxyFlag) {
|
||||
serverBean.setServer(prefManager.getValue(TalendLibsServerManager.NEXUS_PROXY_URL));
|
||||
serverBean.setUserName(prefManager.getValue(TalendLibsServerManager.NEXUS_PROXY_USERNAME));
|
||||
serverBean.setPassword(prefManager.getValue(TalendLibsServerManager.NEXUS_PROXY_PASSWORD));
|
||||
serverBean.setPassword(StudioEncryption.getStudioEncryption(StudioEncryption.EncryptionKeyName.SYSTEM).decrypt(prefManager.getValue(TalendLibsServerManager.NEXUS_PROXY_PASSWORD)));
|
||||
serverBean.setRepositoryId(prefManager.getValue(TalendLibsServerManager.NEXUS_PROXY_REPOSITORY_ID));
|
||||
serverBean.setType(prefManager.getValue(TalendLibsServerManager.NEXUS_PROXY_TYPE));
|
||||
}
|
||||
|
||||
@@ -30,4 +30,6 @@ public interface IDesignerXMLMapperService extends IService {
|
||||
*/
|
||||
public boolean isVirtualComponent(final INode node);
|
||||
|
||||
public Object rebuildXmlMapData(final INode node);
|
||||
|
||||
}
|
||||
|
||||
@@ -94,7 +94,11 @@ public interface IDetectCVEService extends IService {
|
||||
if (art == null) {
|
||||
return null;
|
||||
}
|
||||
return String.format("%s:%s:%s", art.getGroupId(), art.getArtifactId(), art.getVersion());
|
||||
String gavc = String.format("%s:%s:%s", art.getGroupId(), art.getArtifactId(), art.getVersion());
|
||||
if (!StringUtils.isEmpty(art.getClassifier())) {
|
||||
gavc += ":" + art.getClassifier();
|
||||
}
|
||||
return gavc;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -112,6 +116,8 @@ public interface IDetectCVEService extends IService {
|
||||
private String a;
|
||||
|
||||
private String v;
|
||||
|
||||
private String c;
|
||||
|
||||
/**
|
||||
* @return the g
|
||||
@@ -155,8 +161,28 @@ public interface IDetectCVEService extends IService {
|
||||
this.v = v;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the c
|
||||
*/
|
||||
public String getC() {
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param c the c to set
|
||||
*/
|
||||
public void setC(String c) {
|
||||
this.c = c;
|
||||
}
|
||||
|
||||
public String getGAVString() {
|
||||
return String.format("%s:%s:%s", g, a, v);
|
||||
String gav = String.format("%s:%s:%s", g, a, v);
|
||||
if (!StringUtils.isEmpty(c)) {
|
||||
gav += ":" + c;
|
||||
}
|
||||
return gav;
|
||||
}
|
||||
|
||||
public String getGA() {
|
||||
@@ -168,13 +194,16 @@ public interface IDetectCVEService extends IService {
|
||||
return null;
|
||||
}
|
||||
String[] gavs = gav.split(":");
|
||||
if (gavs.length != 3) {
|
||||
if (gavs.length < 3) {
|
||||
return null;
|
||||
}
|
||||
GAV ret = new GAV();
|
||||
ret.setG(gavs[0]);
|
||||
ret.setA(gavs[1]);
|
||||
ret.setV(gavs[2]);
|
||||
if (gavs.length > 3) {
|
||||
ret.setC(gavs[3]);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -184,19 +213,7 @@ public interface IDetectCVEService extends IService {
|
||||
}
|
||||
|
||||
String gav = mavenUri2GAV(mavenURI);
|
||||
if (StringUtils.isEmpty(gav)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String[] gavs = gav.split(":");
|
||||
if (gavs.length != 3) {
|
||||
return null;
|
||||
}
|
||||
GAV ret = new GAV();
|
||||
ret.setG(gavs[0]);
|
||||
ret.setA(gavs[1]);
|
||||
ret.setV(gavs[2]);
|
||||
return ret;
|
||||
return parseFromGAV(gav);
|
||||
}
|
||||
|
||||
public GAV clone() throws CloneNotSupportedException {
|
||||
@@ -224,6 +241,12 @@ public interface IDetectCVEService extends IService {
|
||||
sb.append(v);
|
||||
sb.append(",");
|
||||
}
|
||||
|
||||
if (!StringUtils.isEmpty(c)) {
|
||||
sb.append("c:");
|
||||
sb.append(c);
|
||||
sb.append(",");
|
||||
}
|
||||
|
||||
if (sb.lastIndexOf(",") > 0) {
|
||||
sb.deleteCharAt(sb.length() - 1);
|
||||
@@ -245,6 +268,9 @@ public interface IDetectCVEService extends IService {
|
||||
if (!StringUtils.isEmpty(v)) {
|
||||
hash += hash * 31 + v.hashCode();
|
||||
}
|
||||
if (!StringUtils.isEmpty(c)) {
|
||||
hash += hash * 31 + c.hashCode();
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
@@ -267,8 +293,12 @@ public interface IDetectCVEService extends IService {
|
||||
if (!StringUtils.equals(a, gav.getA())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!StringUtils.equals(v, gav.getV())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return StringUtils.equals(v, gav.getV());
|
||||
return StringUtils.equals(c, gav.getC());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +78,7 @@ public class RoutinesFunctionProposal implements IContentProposal {
|
||||
message += Messages.getString("RoutinesFunctionProposal.CreatedBy");
|
||||
message += Messages.getString("RoutinesFunctionProposal.ReturnType");
|
||||
message += Messages.getString("RoutinesFunctionProposal.VariableName");
|
||||
message = message.replaceAll("\n", System.getProperty("line.separator", "\n")); // for display on Windows platform
|
||||
|
||||
MessageFormat format = new MessageFormat(message);
|
||||
Object[] args = new Object[] { function.getDescription(),
|
||||
|
||||
@@ -12,20 +12,10 @@
|
||||
// ============================================================================
|
||||
package org.talend.core;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
@@ -40,15 +30,12 @@ import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.exception.LoginException;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.commons.exception.SystemException;
|
||||
import org.talend.commons.runtime.xml.XmlUtil;
|
||||
import org.talend.commons.ui.runtime.image.OverlayImageProvider;
|
||||
import org.talend.commons.utils.generation.JavaUtils;
|
||||
import org.talend.commons.utils.workbench.resources.ResourceUtils;
|
||||
import org.talend.core.model.general.LibraryInfo;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.metadata.ColumnNameChanged;
|
||||
import org.talend.core.model.metadata.IMetadataTable;
|
||||
import org.talend.core.model.metadata.MetadataTalendType;
|
||||
import org.talend.core.model.metadata.MetadataToolHelper;
|
||||
import org.talend.core.model.metadata.QueryUtil;
|
||||
import org.talend.core.model.metadata.builder.ConvertionHelper;
|
||||
@@ -74,16 +61,9 @@ import org.talend.designer.codegen.ITalendSynchronizer;
|
||||
import org.talend.designer.core.IDesignerCoreService;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.NodeType;
|
||||
import org.talend.designer.runprocess.IRunProcessService;
|
||||
import org.talend.designer.runprocess.ProcessorUtilities;
|
||||
import org.talend.repository.ProjectManager;
|
||||
import org.talend.repository.RepositoryWorkUnit;
|
||||
import org.talend.repository.model.RepositoryConstants;
|
||||
import org.talend.utils.xml.XmlUtils;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* DOC Administrator class global comment. Detailled comment
|
||||
@@ -354,121 +334,15 @@ public class CoreService implements ICoreService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void synchronizeMapptingXML(ITalendProcessJavaProject talendJavaProject) {
|
||||
try {
|
||||
if (talendJavaProject == null) {
|
||||
return;
|
||||
}
|
||||
URL url = MetadataTalendType.getProjectForderURLOfMappingsFile();
|
||||
if (url != null) {
|
||||
// set the project mappings url
|
||||
System.setProperty(ProcessorUtilities.PROP_MAPPINGS_URL, url.toString()); //$NON-NLS-1$
|
||||
IFolder xmlMappingFolder = talendJavaProject.getResourceSubFolder(null, JavaUtils.JAVA_XML_MAPPING);
|
||||
|
||||
File mappingSource = new File(url.getPath());
|
||||
FilenameFilter filter = new FilenameFilter() {
|
||||
|
||||
@Override
|
||||
public boolean accept(File dir, String name) {
|
||||
if (XmlUtil.isXMLFile(name)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
for (File file : mappingSource.listFiles(filter)) {
|
||||
String targetName = getTargetName(file);
|
||||
IFile targetFile = xmlMappingFolder.getFile(targetName);
|
||||
copyFile(file, targetFile);
|
||||
}
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
ExceptionHandler.process(e);
|
||||
} catch (IOException e) {
|
||||
ExceptionHandler.process(e);
|
||||
} catch (SystemException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
//
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void syncMappingsFileFromSystemToProject() {
|
||||
RepositoryWorkUnit workUnit = new RepositoryWorkUnit("Sync mapping files from system to project") { //$NON-NLS-1$
|
||||
|
||||
@Override
|
||||
protected void run() throws LoginException, PersistenceException {
|
||||
try {
|
||||
File sysMappingfolder = new File(MetadataTalendType.getSystemForderURLOfMappingsFile().getPath());
|
||||
IFolder projectMappingFolder = ResourceUtils.getProject(ProjectManager.getInstance().getCurrentProject())
|
||||
.getFolder(MetadataTalendType.PROJECT_MAPPING_FOLDER);
|
||||
if (!projectMappingFolder.exists()) {
|
||||
projectMappingFolder.create(true, true, null);
|
||||
}
|
||||
for (File in : sysMappingfolder.listFiles()) {
|
||||
IFile out = projectMappingFolder.getFile(in.getName());
|
||||
copyFile(in, out);
|
||||
}
|
||||
} catch (SystemException | CoreException | IOException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
workUnit.setAvoidUnloadResources(true);
|
||||
ProxyRepositoryFactory.getInstance().executeRepositoryWorkUnit(workUnit);
|
||||
}
|
||||
|
||||
public String getTargetName(File file) {
|
||||
String targetName = file.getName();
|
||||
try {
|
||||
DocumentBuilderFactory documentBuilderFactory = XmlUtils.getSecureDocumentBuilderFactory();
|
||||
DocumentBuilder analyser = documentBuilderFactory.newDocumentBuilder();
|
||||
Document document = analyser.parse(file);
|
||||
NodeList dbmsNodes = document.getElementsByTagName("dbms"); //$NON-NLS-1$
|
||||
String dbmsIdValue = "";
|
||||
for (int iDbms = 0; iDbms < dbmsNodes.getLength(); iDbms++) {
|
||||
Node dbmsNode = dbmsNodes.item(iDbms);
|
||||
NamedNodeMap dbmsAttributes = dbmsNode.getAttributes();
|
||||
dbmsIdValue = dbmsAttributes.getNamedItem("id").getNodeValue(); //$NON-NLS-1$
|
||||
|
||||
}
|
||||
if (dbmsIdValue != null && !"".equals(dbmsIdValue)) {
|
||||
final String[] fileNameSplit = targetName.split("_");
|
||||
String idA = "_id";
|
||||
String idB = "id_";
|
||||
final int indexA = dbmsIdValue.indexOf(idA);
|
||||
final int indexB = dbmsIdValue.indexOf(idB);
|
||||
String secondeName = "";
|
||||
if (indexA > 0) {
|
||||
secondeName = dbmsIdValue.substring(0, dbmsIdValue.length() - idA.length());
|
||||
} else if (indexB == 0) {
|
||||
secondeName = dbmsIdValue.substring(idB.length(), dbmsIdValue.length());
|
||||
} else if (indexA == -1 && indexB == -1) {
|
||||
secondeName = dbmsIdValue;
|
||||
}
|
||||
if (secondeName != null && !"".equals(secondeName)) {
|
||||
targetName = fileNameSplit[0] + "_" + secondeName.toLowerCase() + XmlUtil.FILE_XML_SUFFIX;
|
||||
}
|
||||
|
||||
}
|
||||
} catch (ParserConfigurationException e) {
|
||||
ExceptionHandler.process(e);
|
||||
} catch (SAXException e) {
|
||||
ExceptionHandler.process(e);
|
||||
} catch (IOException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return targetName;
|
||||
}
|
||||
|
||||
public void copyFile(File in, IFile out) throws CoreException, IOException {
|
||||
FileInputStream fis = new FileInputStream(in);
|
||||
if (out.exists()) {
|
||||
out.setContents(fis, true, false, null);
|
||||
} else {
|
||||
out.create(fis, true, null);
|
||||
}
|
||||
fis.close();
|
||||
//
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -71,7 +71,6 @@ import org.talend.commons.utils.generation.JavaUtils;
|
||||
import org.talend.commons.utils.time.TimeMeasure;
|
||||
import org.talend.core.CorePlugin;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.ICoreService;
|
||||
import org.talend.core.ITDQItemService;
|
||||
import org.talend.core.PluginChecker;
|
||||
import org.talend.core.context.Context;
|
||||
@@ -115,13 +114,11 @@ import org.talend.core.model.routines.CodesJarInfo;
|
||||
import org.talend.core.model.routines.RoutinesUtil;
|
||||
import org.talend.core.model.utils.JavaResourcesHelper;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||
import org.talend.core.runtime.maven.MavenConstants;
|
||||
import org.talend.core.runtime.process.ITalendProcessJavaProject;
|
||||
import org.talend.core.runtime.process.LastGenerationInfo;
|
||||
import org.talend.core.runtime.process.TalendProcessArgumentConstant;
|
||||
import org.talend.core.runtime.process.TalendProcessOptionConstants;
|
||||
import org.talend.core.runtime.projectsetting.ProjectPreferenceManager;
|
||||
import org.talend.core.runtime.repository.build.BuildExportManager;
|
||||
import org.talend.core.runtime.services.IDesignerMavenService;
|
||||
import org.talend.core.service.IResourcesDependenciesService;
|
||||
@@ -152,8 +149,6 @@ public class ProcessorUtilities {
|
||||
|
||||
private static Logger log = Logger.getLogger(ProcessorUtilities.class);
|
||||
|
||||
public static final String PROP_MAPPINGS_URL = "talend.mappings.url"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* For generating code in CI without param -pl
|
||||
*/
|
||||
@@ -293,6 +288,7 @@ public class ProcessorUtilities {
|
||||
exportAsOSGI = false;
|
||||
exportTimeStamp = null;
|
||||
exportJobAsMicroService = false;
|
||||
needExportItemsForDQ = false;
|
||||
}
|
||||
|
||||
public static String getInterpreter() {
|
||||
@@ -706,6 +702,8 @@ public class ProcessorUtilities {
|
||||
|
||||
processor.setArguments(argumentsMap);
|
||||
|
||||
handelDQComponents(selectedProcessItem, currentProcess);
|
||||
|
||||
// generate the code of the father after the childrens
|
||||
// so the code won't have any error during the check, and it will help to check
|
||||
// if the generation is really needed.
|
||||
@@ -721,7 +719,7 @@ public class ProcessorUtilities {
|
||||
*/
|
||||
generateBuildInfo(jobInfo, progressMonitor, isMainJob, currentProcess, currentJobName, processor, option);
|
||||
|
||||
handelDQComponents(selectedProcessItem, currentProcess);
|
||||
checkNeedExportItemsForDQ(currentProcess);
|
||||
|
||||
copyDependenciedResources(currentProcess, progressMonitor);
|
||||
|
||||
@@ -744,30 +742,10 @@ public class ProcessorUtilities {
|
||||
boolean hasDynamicMetadata = hasMetadataDynamic(currentProcess, jobInfo);
|
||||
LastGenerationInfo.getInstance().setUseDynamic(jobInfo.getJobId(), jobInfo.getJobVersion(), hasDynamicMetadata);
|
||||
if (hasDynamicMetadata) {
|
||||
try {
|
||||
URL url = MetadataTalendType.getProjectForderURLOfMappingsFile();
|
||||
if (url != null) {
|
||||
// set the project mappings url
|
||||
System.setProperty(ProcessorUtilities.PROP_MAPPINGS_URL, url.toString()); // $NON-NLS-1$
|
||||
|
||||
IFolder xmlMappingFolder = jobInfo.getProcessor().getTalendJavaProject().getResourceSubFolder(null,
|
||||
JavaUtils.JAVA_XML_MAPPING);
|
||||
ProjectPreferenceManager manager = CoreRuntimePlugin.getInstance().getProjectPreferenceManager();
|
||||
boolean updated = manager.getBoolean(MetadataTalendType.UPDATED_MAPPING_FILES);
|
||||
if ((xmlMappingFolder.members().length == 0 || updated)
|
||||
&& GlobalServiceRegister.getDefault().isServiceRegistered(ICoreService.class)) {
|
||||
ICoreService coreService =
|
||||
GlobalServiceRegister.getDefault().getService(ICoreService.class);
|
||||
coreService.synchronizeMapptingXML(jobInfo.getProcessor().getTalendJavaProject());
|
||||
// reset
|
||||
if (updated) {
|
||||
manager.setValue(MetadataTalendType.UPDATED_MAPPING_FILES, false);
|
||||
manager.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
ITalendProcessJavaProject talendJavaProject = jobInfo.getProcessor().getTalendJavaProject();
|
||||
if (talendJavaProject != null) {
|
||||
IFolder xmlMappingFolder = talendJavaProject.getResourceSubFolder(null, JavaUtils.JAVA_XML_MAPPING);
|
||||
MetadataTalendType.syncMappingFiles(xmlMappingFolder.getLocation().toFile(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1251,6 +1229,8 @@ public class ProcessorUtilities {
|
||||
|
||||
processor.setArguments(argumentsMap);
|
||||
|
||||
handelDQComponents(selectedProcessItem, currentProcess);
|
||||
|
||||
generateContextInfo(jobInfo, selectedContextName, statistics, trace, needContext, progressMonitor,
|
||||
currentProcess, currentJobName, processor, isMainJob, codeGenerationNeeded);
|
||||
|
||||
@@ -1266,7 +1246,7 @@ public class ProcessorUtilities {
|
||||
generateBuildInfo(jobInfo, progressMonitor, isMainJob, currentProcess, currentJobName, processor, option);
|
||||
TimeMeasure.step(idTimer, "generateBuildInfo");
|
||||
|
||||
handelDQComponents(selectedProcessItem, currentProcess);
|
||||
checkNeedExportItemsForDQ(currentProcess);
|
||||
|
||||
copyDependenciedResources(currentProcess, progressMonitor);
|
||||
|
||||
@@ -1355,10 +1335,34 @@ public class ProcessorUtilities {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Specail operation for DQ components:
|
||||
* - For tdqReportRun, set 'needExportItemsForDQ'to true so as the item folder can be exported
|
||||
* - For tRuleSurvivorship, copy the current item's drools file from 'workspace/metadata/survivorship' to '.Java/src/resources'
|
||||
* if the job includes tdqReportRun, set 'needExportItemsForDQ'to true so as the item folder can be exported
|
||||
*
|
||||
* @param processItem
|
||||
* @param currentProcess
|
||||
*/
|
||||
private static void checkNeedExportItemsForDQ(IProcess currentProcess) {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITDQItemService.class)) {
|
||||
ITDQItemService tdqItemService =
|
||||
GlobalServiceRegister.getDefault().getService(ITDQItemService.class);
|
||||
// TDQ-19637 if it includes 'tDqReportRun',must export item folder
|
||||
if (tdqItemService != null && !needExportItemsForDQ) {
|
||||
for (INode node : currentProcess.getGeneratingNodes()) {
|
||||
String componentName = node.getComponent().getName();
|
||||
if ("tDqReportRun".equals(componentName)) {
|
||||
needExportItemsForDQ = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Specail operation for DQ components:
|
||||
* - For tRuleSurvivorship, copy the current item's drools file from 'workspace/metadata/survivorship' to
|
||||
* '.Java/src/resources'
|
||||
*
|
||||
* @param processItem
|
||||
*/
|
||||
private static void handelDQComponents(ProcessItem processItem,IProcess currentProcess) {
|
||||
@@ -1373,17 +1377,7 @@ public class ProcessorUtilities {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
// TDQ-19637 if it includes 'tDqReportRun',must export item folder
|
||||
if (!needExportItemsForDQ) {
|
||||
for (INode node : currentProcess.getGeneratingNodes()) {
|
||||
String componentName = node.getComponent().getName();
|
||||
if ("tDqReportRun".equals(componentName)) {
|
||||
needExportItemsForDQ = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* 1.TDQ-12474 copy the "metadata/survivorship/rulePackage" to ".Java/src/main/resources/". so that it will be
|
||||
/* 1.TDQ-12474 copy the "metadata/survivorship/rulePackage" to ".Java/src/main/resources/". so that it will be
|
||||
used by maven command 'include-survivorship-rules' to export.
|
||||
2.TDQ-14308 current drools file in 'src/resourcesmetadata/survivorship/' should be included to job jar.
|
||||
*/
|
||||
|
||||
@@ -46,6 +46,8 @@ import org.talend.designer.maven.aether.util.TalendAetherProxySelector;
|
||||
*/
|
||||
public class RepositorySystemFactory {
|
||||
|
||||
private static Boolean ignoreArtifactDescriptorRepositories;
|
||||
|
||||
private static Map<LocalRepository, DefaultRepositorySystemSession> sessions = new HashMap<LocalRepository, DefaultRepositorySystemSession>();
|
||||
|
||||
private static DefaultRepositorySystemSession newRepositorySystemSession(String localRepositoryPath)
|
||||
@@ -61,6 +63,8 @@ public class RepositorySystemFactory {
|
||||
repositorySystemSession.setTransferListener(new ChainedTransferListener());
|
||||
repositorySystemSession.setRepositoryListener(new ChainedRepositoryListener());
|
||||
repositorySystemSession.setProxySelector(new TalendAetherProxySelector());
|
||||
repositorySystemSession.setIgnoreArtifactDescriptorRepositories(
|
||||
RepositorySystemFactory.isIgnoreArtifactDescriptorRepositories());
|
||||
sessions.put(localRepo, repositorySystemSession);
|
||||
}
|
||||
|
||||
@@ -157,4 +161,13 @@ public class RepositorySystemFactory {
|
||||
doDeploy(content, pomFile, localRepository, repositoryId, repositoryUrl, userName, password, groupId, artifactId,
|
||||
classifier, extension, version);
|
||||
}
|
||||
|
||||
public static boolean isIgnoreArtifactDescriptorRepositories() {
|
||||
if (ignoreArtifactDescriptorRepositories == null) {
|
||||
ignoreArtifactDescriptorRepositories = Boolean.valueOf(
|
||||
System.getProperty("talend.studio.aether.ignoreArtifactDescriptorRepositories", Boolean.TRUE.toString()));
|
||||
}
|
||||
return ignoreArtifactDescriptorRepositories;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ import org.eclipse.m2e.core.MavenPlugin;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.designer.maven.aether.DummyDynamicMonitor;
|
||||
import org.talend.designer.maven.aether.IDynamicMonitor;
|
||||
import org.talend.designer.maven.aether.RepositorySystemFactory;
|
||||
import org.talend.designer.maven.aether.node.DependencyNode;
|
||||
import org.talend.designer.maven.aether.node.ExclusionNode;
|
||||
import org.talend.designer.maven.aether.selector.DynamicDependencySelector;
|
||||
@@ -513,6 +514,7 @@ public class DynamicDistributionAetherUtils {
|
||||
LocalRepository localRepo = new LocalRepository(repositoryPath);
|
||||
session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, localRepo));
|
||||
session.setProxySelector(new TalendAetherProxySelector());
|
||||
session.setIgnoreArtifactDescriptorRepositories(RepositorySystemFactory.isIgnoreArtifactDescriptorRepositories());
|
||||
|
||||
updateDependencySelector(session, monitor);
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@ import org.codehaus.plexus.PlexusContainerException;
|
||||
import org.eclipse.aether.DefaultRepositorySystemSession;
|
||||
import org.eclipse.aether.RepositorySystem;
|
||||
import org.eclipse.aether.RepositorySystemSession;
|
||||
import org.eclipse.aether.artifact.Artifact;
|
||||
import org.eclipse.aether.artifact.DefaultArtifact;
|
||||
import org.eclipse.aether.connector.basic.BasicRepositoryConnectorFactory;
|
||||
import org.eclipse.aether.impl.DefaultServiceLocator;
|
||||
@@ -57,6 +56,7 @@ import org.talend.core.nexus.ArtifactRepositoryBean;
|
||||
import org.talend.core.nexus.NexusConstants;
|
||||
import org.talend.core.nexus.TalendLibsServerManager;
|
||||
import org.talend.core.runtime.maven.MavenArtifact;
|
||||
import org.talend.designer.maven.aether.RepositorySystemFactory;
|
||||
|
||||
public class MavenLibraryResolverProvider {
|
||||
|
||||
@@ -283,8 +283,9 @@ public class MavenLibraryResolverProvider {
|
||||
LocalRepository localRepo = new LocalRepository( /* "target/local-repo" */target);
|
||||
session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, localRepo));
|
||||
session.setProxySelector(new TalendAetherProxySelector());
|
||||
session.setIgnoreArtifactDescriptorRepositories(RepositorySystemFactory.isIgnoreArtifactDescriptorRepositories());
|
||||
|
||||
return session;
|
||||
return session;
|
||||
}
|
||||
|
||||
private String getLocalMVNRepository() {
|
||||
|
||||
@@ -23,6 +23,10 @@
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-compat</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.beanshell</groupId>
|
||||
<artifactId>bsh</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
@@ -97,7 +97,18 @@
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-core</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.maven.shared</groupId>
|
||||
<artifactId>maven-shared-utils</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.shared</groupId>
|
||||
<artifactId>maven-shared-utils</artifactId>
|
||||
<version>3.3.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jsoup</groupId>
|
||||
<artifactId>jsoup</artifactId>
|
||||
|
||||
@@ -14,6 +14,17 @@
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-core</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.maven.shared</groupId>
|
||||
<artifactId>maven-shared-utils</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.shared</groupId>
|
||||
<artifactId>maven-shared-utils</artifactId>
|
||||
<version>3.3.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.tycho</groupId>
|
||||
|
||||
@@ -34,6 +34,17 @@
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-core</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.maven.shared</groupId>
|
||||
<artifactId>maven-shared-utils</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.shared</groupId>
|
||||
<artifactId>maven-shared-utils</artifactId>
|
||||
<version>3.3.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
@@ -127,6 +138,16 @@
|
||||
<artifactId>commons-compress</artifactId>
|
||||
<version>1.21</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache-extras.beanshell</groupId>
|
||||
<artifactId>bsh</artifactId>
|
||||
<version>2.0b6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.marshalling</groupId>
|
||||
<artifactId>jboss-marshalling</artifactId>
|
||||
<version>2.0.12.Final</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
@@ -151,6 +151,12 @@
|
||||
<groupId>org.talend.components</groupId>
|
||||
<artifactId>components-marklogic-runtime</artifactId>
|
||||
<version>${components.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-text</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.talend.components</groupId>
|
||||
@@ -210,6 +216,11 @@
|
||||
<artifactId>commons-beanutils</artifactId>
|
||||
<version>1.9.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-text</artifactId>
|
||||
<version>1.10.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<module>zip/pom.xml</module>
|
||||
</modules>
|
||||
<properties>
|
||||
<m2.fasterxml.jackson.version>2.13.2</m2.fasterxml.jackson.version>
|
||||
<m2.fasterxml.jackson.version>2.13.4</m2.fasterxml.jackson.version>
|
||||
<jackson-codehaus.version>1.9.16-TALEND</jackson-codehaus.version>
|
||||
</properties>
|
||||
</project>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<artifactId>studio-tacokit-dependencies</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<properties>
|
||||
<tacokit.components.version>1.27.10</tacokit.components.version>
|
||||
<tacokit.components.version>1.27.20</tacokit.components.version>
|
||||
</properties>
|
||||
<repositories>
|
||||
<repository>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<properties>
|
||||
<tcomp.version>1.38.6</tcomp.version>
|
||||
<tcomp.version>1.38.8</tcomp.version>
|
||||
<slf4j.version>1.7.32</slf4j.version>
|
||||
<log4j2.version>2.17.1</log4j2.version>
|
||||
<reload4j.version>1.2.19</reload4j.version>
|
||||
|
||||
@@ -20,7 +20,11 @@
|
||||
<phase>generate-sources</phase>
|
||||
<configuration>
|
||||
<tasks>
|
||||
<zip destfile="${basedir}/../repository/maven_repository.zip" basedir="${basedir}/../tmp/" />
|
||||
<zip destfile="${basedir}/../repository/maven_repository.zip" basedir="${basedir}/../tmp/" >
|
||||
<fileset dir="${basedir}/../tmp/">
|
||||
<exclude name="repository/dom4j/dom4j/1.6.1/**" />
|
||||
</fileset>
|
||||
</zip>
|
||||
<delete dir="${basedir}/../tmp/" />
|
||||
</tasks>
|
||||
</configuration>
|
||||
|
||||
@@ -10,10 +10,11 @@ ProjectPomProjectSettingPage_ConfirmMessage=Will apply and update for project PO
|
||||
ProjectPomProjectSettingPage_FilterPomLabel=Filter to use to generate poms:
|
||||
ProjectPomProjectSettingPage_FilterErrorMessage=Invalid filter: {0}
|
||||
ProjectPomProjectSettingPage.syncAllPomsButtonText=Force full re-synchronize poms
|
||||
ProjectPomProjectSettingPage.syncBuildTypesButtonText=Force full re-synchronize build types
|
||||
AbstractPersistentProjectSettingPage.syncAllPoms=Do you want to update all poms? \n This operation might take long time depends on your project size.
|
||||
MavenProjectSettingPage.filterExampleMessage=Filter examples:\nlabel=myJob \t\t\t\t=> Generate only the job named "myJob"\n!(label=myJob) \t\t\t\t=> Generate any job except the one named "myJob"\n(path=folder1/folder2) \t\t\t=> Generate any job in the folder "folder1/folder2"\n(path=folder1/folder2)or(label=myJob)\t=> Generate any job in the folder "folder1/folder2" or named "myJob"\n(label=myJob)and(version=0.2) \t=> Generate only the job named "myJob" with version 0.2\n!((label=myJob)and(version=0.1)) \t=> Generate every jobs except the "myJob" version 0.1
|
||||
MavenProjectSettingPage.refModuleText=Set reference project modules in profile
|
||||
MavenProjectSettingPage.excludeDeletedItems=Exclude deleted items
|
||||
MavenProjectSettingPage.syncAllPomsWarning=Click the Force full re-synchronize poms button to apply the new settings.
|
||||
MavenProjectSettingPage.skipFolders=Skip folders
|
||||
BuildProjectSettingPage.allowRecursiveJobs=Allow recursive jobs (Not recommended)
|
||||
BuildProjectSettingPage.allowRecursiveJobs=Allow recursive jobs (Not recommended)
|
||||
|
||||
@@ -34,6 +34,7 @@ import org.talend.core.runtime.projectsetting.AbstractProjectSettingPage;
|
||||
import org.talend.core.runtime.services.IFilterService;
|
||||
import org.talend.designer.maven.DesignerMavenPlugin;
|
||||
import org.talend.designer.maven.tools.AggregatorPomsHelper;
|
||||
import org.talend.designer.maven.tools.BuildTypeManager;
|
||||
import org.talend.designer.maven.ui.i18n.Messages;
|
||||
|
||||
/**
|
||||
@@ -169,7 +170,25 @@ public class MavenProjectSettingPage extends AbstractProjectSettingPage {
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
if (isSyncBuildTypeAllowed()) {
|
||||
Button syncBuildTypes = new Button(parent, SWT.NONE);
|
||||
syncBuildTypes.setText(Messages.getString("ProjectPomProjectSettingPage.syncBuildTypesButtonText")); //$NON-NLS-1$
|
||||
|
||||
syncBuildTypes.addSelectionListener(new SelectionAdapter() {
|
||||
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
try {
|
||||
new BuildTypeManager().syncBuildTypes(getCurrentPage());
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void addSyncWarning() {
|
||||
setMessage(Messages.getString("MavenProjectSettingPage.syncAllPomsWarning"), IMessage.WARNING); //$NON-NLS-1$
|
||||
@@ -203,4 +222,12 @@ public class MavenProjectSettingPage extends AbstractProjectSettingPage {
|
||||
return displayVersion;
|
||||
}
|
||||
|
||||
private static boolean isSyncBuildTypeAllowed() {
|
||||
return Boolean.getBoolean("talend.builtype.syncallowed");
|
||||
}
|
||||
|
||||
private MavenProjectSettingPage getCurrentPage() {
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,8 @@ Require-Bundle: org.eclipse.core.runtime,
|
||||
org.talend.common.ui.runtime,
|
||||
org.talend.core.runtime,
|
||||
org.eclipse.jface,
|
||||
org.talend.core.repository
|
||||
org.talend.core.repository,
|
||||
org.talend.core
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: org.talend.designer.maven,
|
||||
org.talend.designer.maven.launch,
|
||||
|
||||
@@ -125,6 +125,11 @@
|
||||
<artifactId>plexus-io</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.shared</groupId>
|
||||
<artifactId>maven-shared-utils</artifactId>
|
||||
<version>3.3.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-core</artifactId>
|
||||
@@ -184,6 +189,11 @@
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
<version>3.0.24</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.shared</groupId>
|
||||
<artifactId>maven-shared-utils</artifactId>
|
||||
<version>3.3.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-core</artifactId>
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.designer.maven.migration.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.ui.ITestContainerCoreService;
|
||||
|
||||
/**
|
||||
* DOC jding class global comment. Detailled comment
|
||||
*/
|
||||
public class ItemReportRecorder {
|
||||
|
||||
protected Item item;
|
||||
|
||||
protected String detailMessage;
|
||||
|
||||
public String getItemType() {
|
||||
String type = "";
|
||||
ERepositoryObjectType itemType = ERepositoryObjectType.getItemType(item);
|
||||
if (itemType != null) {
|
||||
if (ERepositoryObjectType.getAllTypesOfTestContainer().contains(itemType)) {
|
||||
Item parentJobItem = getTestCaseParentJobItem(item);
|
||||
if (parentJobItem != null) {
|
||||
ERepositoryObjectType parentJobType = ERepositoryObjectType.getItemType(parentJobItem);
|
||||
if (parentJobType != null) {
|
||||
String parentTypePath = getCompleteObjectTypePath(parentJobType);
|
||||
if (StringUtils.isNotBlank(parentTypePath)) {
|
||||
type = parentTypePath + "/";
|
||||
}
|
||||
}
|
||||
}
|
||||
type += itemType;
|
||||
} else {
|
||||
type = getCompleteObjectTypePath(itemType);
|
||||
}
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
public String getItemPath() {
|
||||
String path = "";
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
ERepositoryObjectType itemType = ERepositoryObjectType.getItemType(item);
|
||||
|
||||
if (ERepositoryObjectType.getAllTypesOfTestContainer().contains(itemType)) {
|
||||
StringBuffer testcaseBuffer = new StringBuffer();
|
||||
Item parentJobItem = getTestCaseParentJobItem(item);
|
||||
if (parentJobItem != null) {
|
||||
if (parentJobItem.getState() != null && StringUtils.isNotBlank(parentJobItem.getState().getPath())) {
|
||||
testcaseBuffer.append(parentJobItem.getState().getPath()).append("/");
|
||||
}
|
||||
testcaseBuffer.append(parentJobItem.getProperty() != null ? parentJobItem.getProperty().getLabel() : "");
|
||||
if (StringUtils.isNotBlank(testcaseBuffer.toString())) {
|
||||
buffer.append(testcaseBuffer.toString()).append("/");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (item.getState() != null && StringUtils.isNotBlank(item.getState().getPath())) {
|
||||
buffer.append(item.getState().getPath()).append("/");
|
||||
}
|
||||
}
|
||||
|
||||
Property property = item.getProperty();
|
||||
if (property != null) {
|
||||
buffer.append(property.getLabel() + "_" + property.getVersion());
|
||||
}
|
||||
path = buffer.toString();
|
||||
return path;
|
||||
}
|
||||
|
||||
private Item getTestCaseParentJobItem(Item testcaseItem) {
|
||||
Item parentJobItem = null;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerCoreService.class)) {
|
||||
ITestContainerCoreService testcaseService = GlobalServiceRegister.getDefault()
|
||||
.getService(ITestContainerCoreService.class);
|
||||
if (testcaseService != null) {
|
||||
try {
|
||||
parentJobItem = testcaseService.getParentJobItem(item);
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return parentJobItem;
|
||||
}
|
||||
|
||||
private String getCompleteObjectTypePath(ERepositoryObjectType itemType) {
|
||||
ERepositoryObjectType rootItemType = itemType;
|
||||
if (ERepositoryObjectType.JDBC != null && ERepositoryObjectType.JDBC.equals(rootItemType)) {
|
||||
rootItemType = ERepositoryObjectType.METADATA_CONNECTIONS;
|
||||
}
|
||||
List<String> typeLabels = new ArrayList<String>();
|
||||
findOutCompleteTypePath(rootItemType, typeLabels);
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
if (!typeLabels.isEmpty()) {
|
||||
for (int i = 0; i < typeLabels.size(); i++) {
|
||||
if (i != 0) {
|
||||
buffer.append("/");
|
||||
}
|
||||
buffer.append(typeLabels.get(i));
|
||||
}
|
||||
}
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
private void findOutCompleteTypePath(ERepositoryObjectType type, List<String> typeLabels) {
|
||||
ERepositoryObjectType parentType = ERepositoryObjectType.findParentType(type);
|
||||
if (parentType != null) {
|
||||
findOutCompleteTypePath(parentType, typeLabels);
|
||||
}
|
||||
typeLabels.add(type.getLabel());
|
||||
}
|
||||
|
||||
public Item getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
public void setItem(Item item) {
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
public String getDetailMessage() {
|
||||
return detailMessage;
|
||||
}
|
||||
|
||||
public void setDetailMessage(String detailMessage) {
|
||||
this.detailMessage = detailMessage;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.designer.maven.migration.common;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.talend.core.utils.TalendQuoteUtils;
|
||||
|
||||
/**
|
||||
* DOC jding class global comment. Detailled comment
|
||||
*/
|
||||
public class ItemsReportUtil {
|
||||
|
||||
|
||||
public static boolean generateReportFile(File reportFile, String header, List<String> records) throws Exception {
|
||||
boolean generateDone = false;
|
||||
BufferedWriter printWriter = null;
|
||||
try {
|
||||
File parentFolder = new Path(reportFile.getAbsolutePath()).removeLastSegments(1).toFile();
|
||||
// File parentFolder = new File(parentPath);
|
||||
if (!parentFolder.exists()) {
|
||||
parentFolder.mkdirs();
|
||||
}
|
||||
if (!reportFile.exists()) {
|
||||
reportFile.createNewFile();
|
||||
}
|
||||
FileOutputStream fos = new FileOutputStream(reportFile);
|
||||
fos.write(new byte[] { (byte) 0xEF, (byte) 0xBB, (byte) 0xBF });
|
||||
OutputStreamWriter outputWriter = new OutputStreamWriter(fos, "UTF-8");
|
||||
printWriter = new BufferedWriter(outputWriter);
|
||||
printWriter.write(header);
|
||||
printWriter.newLine();
|
||||
for (String recordStr : records) {
|
||||
printWriter.write(recordStr);
|
||||
printWriter.newLine();
|
||||
}
|
||||
printWriter.flush();
|
||||
generateDone = true;
|
||||
} finally {
|
||||
if (printWriter != null) {
|
||||
printWriter.close();
|
||||
}
|
||||
}
|
||||
return generateDone;
|
||||
}
|
||||
|
||||
public static String handleColumnQuotes(String text) {
|
||||
String quoteMark = TalendQuoteUtils.QUOTATION_MARK;
|
||||
text = StringUtils.isBlank(text) ? "" : text;
|
||||
if (text.contains(quoteMark)) {
|
||||
// replace to double quote surround
|
||||
text = text.replace(quoteMark, quoteMark + quoteMark);
|
||||
}
|
||||
return quoteMark + text + quoteMark;
|
||||
}
|
||||
|
||||
public static String getCurrentTimeString() {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
String time = dateFormat.format(new Date());
|
||||
return time;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.designer.maven.migration.common;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.preferences.ConfigurationScope;
|
||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
||||
import org.eclipse.core.runtime.preferences.IScopeContext;
|
||||
import org.osgi.service.prefs.BackingStoreException;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.core.PluginChecker;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.migration.IProjectMigrationTask;
|
||||
|
||||
/**
|
||||
* DOC jding class global comment. Detailled comment
|
||||
*/
|
||||
public class MigrationReportHelper {
|
||||
|
||||
private static final String COMMA = ",";
|
||||
|
||||
private static final String PLUGIN_ID = "org.talend.designer.maven";
|
||||
|
||||
private static final String DO_NOT_SHOW_PREF_KEY = "talend.migrationReportDialog.doNotShowAgain";
|
||||
|
||||
private static final String MIGRATION_REPORT_HEAD = "Task name,Task description,Item type,Path to migrated item,Migration details";
|
||||
|
||||
private static final MigrationReportHelper instance = new MigrationReportHelper();
|
||||
|
||||
public static MigrationReportHelper getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
private String reportGeneratedPath = "";
|
||||
|
||||
private Set<String> taskItemRecords = new HashSet<String>();
|
||||
|
||||
private List<MigrationReportRecorder> migrationReportRecorders = new ArrayList<MigrationReportRecorder>();
|
||||
|
||||
public void generateMigrationReport(String projectTecName) {
|
||||
if (migrationReportRecorders == null || migrationReportRecorders.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!PluginChecker.isTIS()) {
|
||||
clearRecorders();
|
||||
return;
|
||||
}
|
||||
|
||||
File exportFolder = null;
|
||||
File reportFile = null;
|
||||
try {
|
||||
String currentTime = getCurrentTime();
|
||||
String filePath = getReportExportFolder(currentTime) + "/" + getReportFileName(currentTime, projectTecName);
|
||||
reportGeneratedPath = filePath;
|
||||
reportFile = new File(filePath);
|
||||
List<String> recordLines = new ArrayList<String>();
|
||||
for (MigrationReportRecorder record : migrationReportRecorders) {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append(ItemsReportUtil.handleColumnQuotes(record.getTaskClassName())).append(COMMA);
|
||||
buffer.append(ItemsReportUtil.handleColumnQuotes(record.getTaskDescription())).append(COMMA);
|
||||
buffer.append(ItemsReportUtil.handleColumnQuotes(record.getItemType())).append(COMMA);
|
||||
buffer.append(ItemsReportUtil.handleColumnQuotes(record.getItemPath())).append(COMMA);
|
||||
buffer.append(ItemsReportUtil.handleColumnQuotes(record.getDetailMessage()));
|
||||
recordLines.add(buffer.toString());
|
||||
}
|
||||
ItemsReportUtil.generateReportFile(reportFile, MIGRATION_REPORT_HEAD, recordLines);
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
if (reportFile != null && reportFile.exists()) {
|
||||
reportFile.delete();
|
||||
}
|
||||
if (exportFolder != null && exportFolder.exists()) {
|
||||
exportFolder.delete();
|
||||
}
|
||||
} finally {
|
||||
migrationReportRecorders.clear();
|
||||
taskItemRecords.clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean isRequireDefaultRecord(IProjectMigrationTask task, Item item) {
|
||||
boolean require = true;
|
||||
if (task.getOrder() != null) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(task.getOrder());
|
||||
int year = calendar.get(Calendar.YEAR);
|
||||
if (year <= 2016) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (item.getProperty() != null) {
|
||||
Property property = item.getProperty();
|
||||
String key = task.getId() + "_" + property.getId() + "_" + property.getVersion();
|
||||
if (taskItemRecords.contains(key)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return require;
|
||||
}
|
||||
|
||||
private String getCurrentTime() {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
String time = dateFormat.format(new Date());
|
||||
return time;
|
||||
}
|
||||
|
||||
private String getReportExportFolder(String time) {
|
||||
String folderName = "migrationReport" + "_" + time;
|
||||
String path = ResourcesPlugin.getWorkspace().getRoot().getLocation().toString() + "/report/" + folderName;
|
||||
return path;
|
||||
}
|
||||
|
||||
private String getReportFileName(String time, String projectTecName) {
|
||||
String fileName = time + "_" + projectTecName + "_" + "Migration" + "_" + "Report.csv";
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public static void storeDoNotShowAgainPref(boolean selected) {
|
||||
IScopeContext scopeContext = ConfigurationScope.INSTANCE;
|
||||
IEclipsePreferences pref = scopeContext.getNode(PLUGIN_ID);
|
||||
pref.putBoolean(DO_NOT_SHOW_PREF_KEY, selected);
|
||||
try {
|
||||
pref.flush();
|
||||
} catch (BackingStoreException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isReportDialogDisable() {
|
||||
IScopeContext scopeContext = ConfigurationScope.INSTANCE;
|
||||
IEclipsePreferences pref = scopeContext.getNode(PLUGIN_ID);
|
||||
return pref.getBoolean(DO_NOT_SHOW_PREF_KEY, false);
|
||||
}
|
||||
|
||||
public void addRecorder(MigrationReportRecorder recorder) {
|
||||
if (recorder != null) {
|
||||
migrationReportRecorders.add(recorder);
|
||||
if (recorder.getItem() != null && recorder.getItem().getProperty() != null) {
|
||||
Property property = recorder.getItem().getProperty();
|
||||
taskItemRecords.add(recorder.getTask().getId() + "_" + property.getId() + "_" + property.getVersion());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void clearRecorders() {
|
||||
reportGeneratedPath = "";
|
||||
migrationReportRecorders.clear();
|
||||
taskItemRecords.clear();
|
||||
}
|
||||
|
||||
public String getReportGeneratedPath() {
|
||||
return reportGeneratedPath;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.designer.maven.migration.common;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.talend.core.model.components.ComponentUtilities;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.utils.TalendQuoteUtils;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.NodeType;
|
||||
import org.talend.migration.IProjectMigrationTask;
|
||||
|
||||
/**
|
||||
* DOC jding class global comment. Detailled comment
|
||||
*/
|
||||
public class MigrationReportRecorder extends ItemReportRecorder {
|
||||
|
||||
private IProjectMigrationTask task;
|
||||
|
||||
private MigrationOperationType operationType;
|
||||
|
||||
private NodeType node;
|
||||
|
||||
private String paramName;
|
||||
|
||||
private String oldValue;
|
||||
|
||||
private String newValue;
|
||||
|
||||
public enum MigrationOperationType {
|
||||
ADD,
|
||||
MODIFY,
|
||||
DELETE
|
||||
}
|
||||
|
||||
public MigrationReportRecorder(IProjectMigrationTask task, Item item) {
|
||||
super();
|
||||
this.task = task;
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
public MigrationReportRecorder(IProjectMigrationTask task, MigrationOperationType operationType, Item item, NodeType node,
|
||||
String paramName, String oldValue, String newValue) {
|
||||
super();
|
||||
this.task = task;
|
||||
this.operationType = operationType;
|
||||
this.item = item;
|
||||
this.node = node;
|
||||
this.paramName = paramName;
|
||||
this.oldValue = oldValue;
|
||||
this.newValue = newValue;
|
||||
}
|
||||
|
||||
public MigrationReportRecorder(IProjectMigrationTask task, Item item, String detailMessage) {
|
||||
super();
|
||||
this.task = task;
|
||||
this.item = item;
|
||||
this.detailMessage = detailMessage;
|
||||
}
|
||||
|
||||
public String getTaskClassName() {
|
||||
return task.getClass().getSimpleName();
|
||||
}
|
||||
|
||||
public String getTaskDescription() {
|
||||
String description = "";
|
||||
if (StringUtils.isNotBlank(task.getDescription())) {
|
||||
description = task.getDescription();
|
||||
}
|
||||
return description;
|
||||
}
|
||||
|
||||
public String getDetailMessage() {
|
||||
String details = detailMessage;
|
||||
if (StringUtils.isNotBlank(detailMessage)) {
|
||||
return details;
|
||||
}
|
||||
|
||||
if (operationType == null || StringUtils.isBlank(paramName)) {
|
||||
details = getTaskClassName() + " task is applied";
|
||||
return details;
|
||||
}
|
||||
|
||||
StringBuffer detailBuffer = new StringBuffer();
|
||||
if (node != null) {
|
||||
// migration for node, e.g. tRESTClient component "tRESTClient_2":
|
||||
detailBuffer.append(node.getComponentName()).append(" component ");
|
||||
ElementParameterType uniqueName = ComponentUtilities.getNodeProperty(node, "UNIQUE_NAME");
|
||||
detailBuffer.append(TalendQuoteUtils.addQuotes(uniqueName.getValue())).append(":");
|
||||
} else {
|
||||
// migration for item, e.g. context item "testContext":
|
||||
detailBuffer.append(getItemType() + " item ")
|
||||
.append(TalendQuoteUtils.addQuotes(item.getProperty().getLabel())).append(":");
|
||||
}
|
||||
|
||||
detailBuffer.append(paramName).append(" was ");
|
||||
switch (operationType) {
|
||||
case ADD:
|
||||
detailBuffer.append("added");
|
||||
if (StringUtils.isNotBlank(newValue)) {
|
||||
detailBuffer.append(" with ").append(newValue);
|
||||
}
|
||||
break;
|
||||
case MODIFY:
|
||||
detailBuffer.append("changed");
|
||||
if (StringUtils.isNotBlank(oldValue)) {
|
||||
detailBuffer.append(" from ").append(oldValue);
|
||||
}
|
||||
if (StringUtils.isNotBlank(newValue)) {
|
||||
detailBuffer.append(" to ").append(newValue);
|
||||
}
|
||||
break;
|
||||
case DELETE:
|
||||
detailBuffer.append("deleted");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
details = detailBuffer.toString();
|
||||
|
||||
return details;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for task.
|
||||
*
|
||||
* @return the task
|
||||
*/
|
||||
public IProjectMigrationTask getTask() {
|
||||
return task;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the task.
|
||||
*
|
||||
* @param task the task to set
|
||||
*/
|
||||
public void setTask(IProjectMigrationTask task) {
|
||||
this.task = task;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the operationType.
|
||||
*
|
||||
* @param operationType the operationType to set
|
||||
*/
|
||||
public void setOperationType(MigrationOperationType operationType) {
|
||||
this.operationType = operationType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the node.
|
||||
*
|
||||
* @param node the node to set
|
||||
*/
|
||||
public void setNode(NodeType node) {
|
||||
this.node = node;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the paramName.
|
||||
*
|
||||
* @param paramName the paramName to set
|
||||
*/
|
||||
public void setParamName(String paramName) {
|
||||
this.paramName = paramName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the oldValue.
|
||||
*
|
||||
* @param oldValue the oldValue to set
|
||||
*/
|
||||
public void setOldValue(String oldValue) {
|
||||
this.oldValue = oldValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the newValue.
|
||||
*
|
||||
* @param newValue the newValue to set
|
||||
*/
|
||||
public void setNewValue(String newValue) {
|
||||
this.newValue = newValue;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package org.talend.designer.maven.migration.tasks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.commons.runtime.model.emf.EmfHelper;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.model.components.filters.IComponentFilter;
|
||||
import org.talend.core.model.migration.AbstractItemMigrationTask;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.JobletProcessItem;
|
||||
import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.repository.utils.ConvertJobsUtil;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.NodeType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ProcessType;
|
||||
import org.talend.designer.maven.migration.common.MigrationReportHelper;
|
||||
import org.talend.designer.maven.migration.common.MigrationReportRecorder;
|
||||
import org.talend.repository.model.IProxyRepositoryFactory;
|
||||
import org.talend.repository.model.IRepositoryService;
|
||||
|
||||
public abstract class AbstractCorrectBuildItemMigrationTask extends AbstractItemMigrationTask implements ICorrectBuildTypeMigrationTask {
|
||||
|
||||
protected static final String BUILD_TYPE_PROPERTY = "BUILD_TYPE";
|
||||
protected static final String BUILD_TYPE_STANDALONE = "STANDALONE";
|
||||
protected static final String BUILD_TYPE_OSGI = "OSGI";
|
||||
protected static final String BUILD_TYPE_ROUTE = "ROUTE";
|
||||
protected static final String BUILD_TYPE_ROUTE_MICROSERVICE = "ROUTE_MICROSERVICE";
|
||||
protected static final String REST_MS = "REST_MS";
|
||||
|
||||
|
||||
protected static Map<String, String> migratedJobs = new HashMap<String, String>();
|
||||
|
||||
protected static void clearMigratedJobs () {
|
||||
migratedJobs.clear();
|
||||
}
|
||||
|
||||
protected static void skipMigrationForJob (String jobName, String migrationTask) {
|
||||
migratedJobs.put(jobName, migrationTask);
|
||||
}
|
||||
|
||||
protected static void storeMigratedJob (String jobName, String migrationTask) {
|
||||
migratedJobs.put(jobName, migrationTask);
|
||||
}
|
||||
|
||||
protected static boolean isJobMigrated (String jobName) {
|
||||
return migratedJobs.containsKey(jobName);
|
||||
}
|
||||
|
||||
protected static String getStoredJobMigraionTask (String jobName) {
|
||||
return migratedJobs.get(jobName);
|
||||
}
|
||||
|
||||
public void generateReportRecord(MigrationReportRecorder recorder) {
|
||||
MigrationReportHelper.getInstance().addRecorder(recorder);
|
||||
}
|
||||
|
||||
public static List<NodeType> searchComponent(ProcessType processType, IComponentFilter filter) {
|
||||
List<NodeType> list = new ArrayList<NodeType>();
|
||||
if (filter == null || processType == null) {
|
||||
return list;
|
||||
}
|
||||
|
||||
for (Object o : processType.getNode()) {
|
||||
if (filter.accept((NodeType) o)) {
|
||||
list.add((NodeType) o);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public void save(Item item) throws PersistenceException {
|
||||
IRepositoryService service = (IRepositoryService) GlobalServiceRegister.getDefault()
|
||||
.getService(IRepositoryService.class);
|
||||
IProxyRepositoryFactory factory = service.getProxyRepositoryFactory();
|
||||
factory.save(item, true);
|
||||
}
|
||||
|
||||
public ProcessType getProcessType(Item item) {
|
||||
ProcessType processType = null;
|
||||
if (item instanceof ProcessItem) {
|
||||
processType = ((ProcessItem) item).getProcess();
|
||||
}
|
||||
if (item instanceof JobletProcessItem) {
|
||||
processType = ((JobletProcessItem) item).getJobletProcess();
|
||||
}
|
||||
if (processType != null) {
|
||||
EmfHelper.visitChilds(processType);
|
||||
ERepositoryObjectType itemType = ERepositoryObjectType.getItemType(item);
|
||||
if (itemType == ERepositoryObjectType.TEST_CONTAINER
|
||||
&& !ConvertJobsUtil.JobType.STANDARD.getDisplayName().equalsIgnoreCase(processType.getJobType())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
return processType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find element parameter with a given parameter name
|
||||
*
|
||||
* @param paramName
|
||||
* @param elementParameterTypes
|
||||
* @return
|
||||
*/
|
||||
public static final ElementParameterType findElementParameterByName(String paramName, NodeType node) {
|
||||
for (Object obj : node.getElementParameter()) {
|
||||
ElementParameterType cpType = (ElementParameterType) obj;
|
||||
if (paramName.equals(cpType.getName())) {
|
||||
return cpType;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
abstract public void clear ();
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.talend.designer.maven.migration.tasks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
|
||||
public abstract class AbstractDataServiceJobMigrationTask extends AbstractCorrectBuildItemMigrationTask {
|
||||
|
||||
@Override
|
||||
public List<ERepositoryObjectType> getTypes() {
|
||||
List<ERepositoryObjectType> toReturn = new ArrayList<ERepositoryObjectType>();
|
||||
toReturn.add(ERepositoryObjectType.PROCESS);
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.talend.designer.maven.migration.tasks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
|
||||
public abstract class AbstractRouteMigrationTask extends AbstractCorrectBuildItemMigrationTask {
|
||||
|
||||
@Override
|
||||
public List<ERepositoryObjectType> getTypes() {
|
||||
List<ERepositoryObjectType> toReturn = new ArrayList<ERepositoryObjectType>();
|
||||
toReturn.add(ERepositoryObjectType.PROCESS_ROUTE);
|
||||
toReturn.add(ERepositoryObjectType.PROCESS_ROUTE_MICROSERVICE);
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,268 @@
|
||||
package org.talend.designer.maven.migration.tasks;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.List;
|
||||
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.core.model.components.filters.IComponentFilter;
|
||||
import org.talend.core.model.components.filters.NameComponentFilter;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.NodeType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ProcessType;
|
||||
import org.talend.designer.maven.migration.common.MigrationReportRecorder;
|
||||
import org.talend.designer.runprocess.ItemCacheManager;
|
||||
import org.talend.repository.ProjectManager;
|
||||
|
||||
/*
|
||||
* If Job does not contain any of the following components: "tRouteInput", "tRESTClient", "tESBConsumer"
|
||||
* then BUILD_TYPE must be STANDALONE
|
||||
* Else (job contains one of "tRouteInput", "tRESTClient" or "tESBConsumer")
|
||||
* If no BUILD_TYPE is set then default BUILD_TYPE must be STANDALONE
|
||||
* Manage child jobs for jobs ( parent, target BUILD_TYPE = STANDALONE )
|
||||
* If BUILD_TYPE is STANDALONE
|
||||
* Manage child jobs for jobs ( parent, target BUILD_TYPE = STANDALONE )
|
||||
* If BUILD_TYPE is ROUTE > EXCEPTION: need warning message! BUILD_TYPE was wrongly set to ROUTE from a previous migration task and has to be manually updated (all subjobs have to be checked manually). Value should be either STANDALONE (in most cases) or OSGI.
|
||||
*/
|
||||
|
||||
public class CorrectBuildTypeForDIJobMigrationTask extends AbstractDataServiceJobMigrationTask {
|
||||
|
||||
private static final String[] ESB_COMPONENTS = { "tRouteInput", "tRESTClient", "tESBConsumer" };
|
||||
|
||||
private static final String T_RUB_JOB_COMPONENT = "tRunJob";
|
||||
|
||||
boolean failure = false;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.migration.IMigrationTask#getOrder()
|
||||
*/
|
||||
@Override
|
||||
public Date getOrder() {
|
||||
GregorianCalendar gc = new GregorianCalendar(2021, 7, 25, 12, 0, 0);
|
||||
return gc.getTime();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public ExecutionResult execute(Item item) {
|
||||
|
||||
final ProcessType processType = getProcessType(item);
|
||||
String jobName = item.getProperty().getLabel();
|
||||
|
||||
/*
|
||||
* Migrating remaining jobs only (which was not migrated previously)
|
||||
*/
|
||||
if (isJobMigrated(jobName)) {
|
||||
return ExecutionResult.NOTHING_TO_DO;
|
||||
}
|
||||
|
||||
|
||||
Object originalBuildType = item.getProperty().getAdditionalProperties().get(BUILD_TYPE_PROPERTY);
|
||||
|
||||
/*
|
||||
* If BUILD_TYPE is ROUTE > EXCEPTION: need warning message! BUILD_TYPE was
|
||||
* wrongly set to ROUTE from a previous migration task and has to be manually
|
||||
* updated (all subjobs have to be checked manually). Value should be either
|
||||
* STANDALONE (in most cases) or OSGI.
|
||||
*/
|
||||
|
||||
if (originalBuildType != null && BUILD_TYPE_ROUTE.equalsIgnoreCase((String) originalBuildType)) {
|
||||
ExceptionHandler.process(new RuntimeException("Job [" + jobName + "] has incorrect BUILD_TYPE ["
|
||||
+ BUILD_TYPE_ROUTE
|
||||
+ "] which has to be manually updated (all subjobs have to be checked manually). Value should be either STANDALONE (in most cases) or OSGI"));
|
||||
return ExecutionResult.FAILURE;
|
||||
}
|
||||
|
||||
for (String name : ESB_COMPONENTS) {
|
||||
|
||||
boolean modified = false;
|
||||
|
||||
IComponentFilter filter = new NameComponentFilter(name);
|
||||
|
||||
List<NodeType> c = searchComponent(processType, filter);
|
||||
|
||||
if (!c.isEmpty()) {
|
||||
|
||||
/*
|
||||
* job contains one of "tRouteInput", "tRESTClient" or "tESBConsumer") If no
|
||||
* BUILD_TYPE is set then default BUILD_TYPE must be STANDALONE
|
||||
*/
|
||||
|
||||
if (null == originalBuildType) {
|
||||
item.getProperty().getAdditionalProperties().put(BUILD_TYPE_PROPERTY, BUILD_TYPE_STANDALONE);
|
||||
try {
|
||||
save(item);
|
||||
modified |= true;
|
||||
generateReportRecord(
|
||||
new MigrationReportRecorder(this, MigrationReportRecorder.MigrationOperationType.MODIFY,
|
||||
item, null, "Build Type", null, BUILD_TYPE_STANDALONE));
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
return ExecutionResult.FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Manage child jobs for jobs ( parent, target BUILD_TYPE = STANDALONE )
|
||||
*/
|
||||
String currentParentJobBuildType = (String) item.getProperty().getAdditionalProperties()
|
||||
.get(BUILD_TYPE_PROPERTY);
|
||||
|
||||
if (BUILD_TYPE_STANDALONE.equalsIgnoreCase(currentParentJobBuildType)) {
|
||||
updateBuildTypeForSubJobs(item, currentParentJobBuildType);
|
||||
}
|
||||
|
||||
if (failure) {
|
||||
return ExecutionResult.FAILURE;
|
||||
}
|
||||
|
||||
if (modified) {
|
||||
return ExecutionResult.SUCCESS_NO_ALERT;
|
||||
}
|
||||
|
||||
return ExecutionResult.NOTHING_TO_DO;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If Job does not contain any of the following components: "tRouteInput",
|
||||
* "tRESTClient", "tESBConsumer" then BUILD_TYPE must be STANDALONE
|
||||
* Manage child jobs for jobs ( parent, target BUILD_TYPE = STANDALONE )
|
||||
*/
|
||||
|
||||
if (null == originalBuildType || !BUILD_TYPE_STANDALONE.equalsIgnoreCase(originalBuildType.toString())) {
|
||||
item.getProperty().getAdditionalProperties().put(BUILD_TYPE_PROPERTY, BUILD_TYPE_STANDALONE);
|
||||
boolean modified = false;
|
||||
try {
|
||||
save(item);
|
||||
modified |= true;
|
||||
generateReportRecord(new MigrationReportRecorder(this,
|
||||
MigrationReportRecorder.MigrationOperationType.MODIFY, item, null, "Build Type",
|
||||
(null == originalBuildType) ? null : originalBuildType.toString(), BUILD_TYPE_STANDALONE));
|
||||
updateBuildTypeForSubJobs(item, BUILD_TYPE_STANDALONE);
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
return ExecutionResult.FAILURE;
|
||||
}
|
||||
|
||||
if (failure) {
|
||||
return ExecutionResult.FAILURE;
|
||||
}
|
||||
|
||||
if (modified) {
|
||||
return ExecutionResult.SUCCESS_NO_ALERT;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If Job does not contain any of the following components: "tRouteInput",
|
||||
* "tRESTClient", "tESBConsumer" and BUILD_TYPE is STANDALONE
|
||||
* Manage child jobs for jobs ( parent, target BUILD_TYPE = STANDALONE )
|
||||
*/
|
||||
if (BUILD_TYPE_STANDALONE.equalsIgnoreCase(originalBuildType.toString())) {
|
||||
updateBuildTypeForSubJobs(item, BUILD_TYPE_STANDALONE);
|
||||
if (failure) {
|
||||
return ExecutionResult.FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
return ExecutionResult.NOTHING_TO_DO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Synchronize build types for DI jobs";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
clearMigratedJobs();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void updateBuildTypeForSubJobs(Item parentJobItem, String parentJobBuiltType) {
|
||||
IComponentFilter filter = new NameComponentFilter(T_RUB_JOB_COMPONENT);
|
||||
|
||||
ProcessType processType = getProcessType(parentJobItem);
|
||||
|
||||
List<NodeType> c = searchComponent(processType, filter);
|
||||
|
||||
if (!c.isEmpty()) {
|
||||
|
||||
for (NodeType tRunJobComponent : c) {
|
||||
String processID = findElementParameterByName("SELECTED_JOB_NAME:PROCESS_TYPE_PROCESS",
|
||||
tRunJobComponent) == null ? null
|
||||
: findElementParameterByName("SELECTED_JOB_NAME:PROCESS_TYPE_PROCESS", tRunJobComponent)
|
||||
.getValue();
|
||||
if (processID == null) {
|
||||
processID = findElementParameterByName("PROCESS:PROCESS_TYPE_PROCESS",
|
||||
tRunJobComponent) == null ? null
|
||||
: findElementParameterByName("PROCESS:PROCESS_TYPE_PROCESS", tRunJobComponent)
|
||||
.getValue();
|
||||
}
|
||||
|
||||
String processVersion = findElementParameterByName("SELECTED_JOB_NAME:PROCESS_TYPE_VERSION",
|
||||
tRunJobComponent) == null ? null
|
||||
: findElementParameterByName("SELECTED_JOB_NAME:PROCESS_TYPE_VERSION", tRunJobComponent)
|
||||
.getValue();
|
||||
|
||||
if (processVersion == null) {
|
||||
processVersion = findElementParameterByName("PROCESS:PROCESS_TYPE_VERSION",
|
||||
tRunJobComponent) == null ? null
|
||||
: findElementParameterByName("PROCESS:PROCESS_TYPE_VERSION", tRunJobComponent)
|
||||
.getValue();
|
||||
}
|
||||
|
||||
if (processID != null && processVersion != null) {
|
||||
ProcessItem childItem = ItemCacheManager.getProcessItem(processID, processVersion);
|
||||
Project childItemProject = ProjectManager.getInstance().getCurrentProject();
|
||||
|
||||
if (childItem == null) {
|
||||
for (Project refProject : ProjectManager.getInstance().getAllReferencedProjects()) {
|
||||
childItem = ItemCacheManager.getRefProcessItem(getProject(), processID);
|
||||
if (childItem != null) {
|
||||
childItemProject = refProject;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (childItem != null) {
|
||||
|
||||
Object currentChildBuildType = childItem.getProperty().getAdditionalProperties()
|
||||
.get(BUILD_TYPE_PROPERTY);
|
||||
|
||||
// String jobID = childItem.getProperty().getLabel();
|
||||
|
||||
String currentChildBuildTypeStr = (null == currentChildBuildType) ? null
|
||||
: (String) currentChildBuildType;
|
||||
|
||||
if (BUILD_TYPE_STANDALONE.equalsIgnoreCase(parentJobBuiltType)
|
||||
&& !BUILD_TYPE_STANDALONE.equalsIgnoreCase(currentChildBuildTypeStr)) {
|
||||
|
||||
childItem.getProperty().getAdditionalProperties().put(BUILD_TYPE_PROPERTY,
|
||||
BUILD_TYPE_STANDALONE);
|
||||
|
||||
try {
|
||||
save(childItem);
|
||||
generateReportRecord(new MigrationReportRecorder(this,
|
||||
MigrationReportRecorder.MigrationOperationType.MODIFY, childItem, null,
|
||||
"Build Type", currentChildBuildTypeStr, BUILD_TYPE_STANDALONE));
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
failure = true;
|
||||
}
|
||||
}
|
||||
|
||||
updateBuildTypeForSubJobs(childItem, parentJobBuiltType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package org.talend.designer.maven.migration.tasks;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.List;
|
||||
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.core.model.components.filters.IComponentFilter;
|
||||
import org.talend.core.model.components.filters.NameComponentFilter;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.NodeType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ProcessType;
|
||||
import org.talend.designer.maven.migration.common.MigrationReportRecorder;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* Data service REST (process) = Job with "tRESTRequest"
|
||||
* If no BUILD_TYPE is set then default BUILD_TYPE must be OSGI
|
||||
* If Job does not contain any of the following components: "tRouteInput", "tRESTClient", "tESBConsumer" then BUILD_TYPE must be STANDALONE
|
||||
*/
|
||||
|
||||
public class CorrectBuildTypeForDsRestMigrationTask extends AbstractDataServiceJobMigrationTask {
|
||||
|
||||
private static final String T_REST_REQUEST = "tRESTRequest";
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.migration.IMigrationTask#getOrder()
|
||||
*/
|
||||
@Override
|
||||
public Date getOrder() {
|
||||
GregorianCalendar gc = new GregorianCalendar(2021, 7, 25, 12, 0, 0);
|
||||
return gc.getTime();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.talend.core.model.migration.AbstractDataserviceMigrationTask#execute(org
|
||||
* .talend.core.model.properties.Item)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public ExecutionResult execute(Item item) {
|
||||
final ProcessType processType = getProcessType(item);
|
||||
|
||||
boolean modified = false;
|
||||
|
||||
/*
|
||||
* If no BUILD_TYPE is set then default BUILD_TYPE must be OSGI
|
||||
*/
|
||||
|
||||
IComponentFilter filter = new NameComponentFilter(T_REST_REQUEST);
|
||||
|
||||
List<NodeType> c = searchComponent(processType, filter);
|
||||
|
||||
if (!c.isEmpty()) {
|
||||
Object buildType = item.getProperty().getAdditionalProperties().get(BUILD_TYPE_PROPERTY);
|
||||
if (null == buildType) {
|
||||
item.getProperty().getAdditionalProperties().put(BUILD_TYPE_PROPERTY, BUILD_TYPE_OSGI);
|
||||
try {
|
||||
save(item);
|
||||
modified |= true;
|
||||
generateReportRecord(
|
||||
new MigrationReportRecorder(this, MigrationReportRecorder.MigrationOperationType.MODIFY,
|
||||
item, null, "Build Type", null, BUILD_TYPE_OSGI));
|
||||
storeMigratedJob(item.getProperty().getLabel(), this.getClass().getName());
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
return ExecutionResult.FAILURE;
|
||||
}
|
||||
return ExecutionResult.SUCCESS_NO_ALERT;
|
||||
} else if (BUILD_TYPE_OSGI.equalsIgnoreCase((String)buildType)){
|
||||
// current job has correct build type
|
||||
// skip this job during next migrations
|
||||
skipMigrationForJob(item.getProperty().getLabel(), this.getClass().getName());
|
||||
} else if (REST_MS.equalsIgnoreCase((String)buildType)){
|
||||
// current job has correct build type
|
||||
// skip this job during next migrations
|
||||
skipMigrationForJob(item.getProperty().getLabel(), this.getClass().getName());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (modified) {
|
||||
return ExecutionResult.SUCCESS_NO_ALERT;
|
||||
} else {
|
||||
return ExecutionResult.NOTHING_TO_DO;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Synchronize build types for DS Rest jobs";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear () {
|
||||
clearMigratedJobs();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,255 @@
|
||||
package org.talend.designer.maven.migration.tasks;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.core.model.components.filters.IComponentFilter;
|
||||
import org.talend.core.model.components.filters.NameComponentFilter;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
import org.talend.core.runtime.process.TalendProcessArgumentConstant;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.NodeType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ProcessType;
|
||||
import org.talend.designer.maven.migration.common.MigrationReportRecorder;
|
||||
import org.talend.designer.runprocess.ItemCacheManager;
|
||||
import org.talend.repository.ProjectManager;
|
||||
|
||||
/*
|
||||
* Routes
|
||||
* If no BUILD_TYPE is set then Default BUILD_TYPE must be ROUTE
|
||||
* - Manage child jobs for routes ( parent, target BUILD_TYPE = OSGI )
|
||||
* Else if BUILD_TYPE is ROUTE
|
||||
* - Manage child jobs for routes ( parent, target BUILD_TYPE = OSGI )
|
||||
* Else if BUILD_TYPE is ROUTE_MICROSERVICE
|
||||
* -Manage child jobs for jobs ( parent, target BUILD_TYPE = STANDALONE )
|
||||
*/
|
||||
|
||||
public class CorrectBuildTypeForRoutesMigrationTask extends AbstractRouteMigrationTask {
|
||||
|
||||
private static final String C_TALEND_JOB = "cTalendJob";
|
||||
|
||||
protected Map<String, String> migratedChildJobs = new HashMap<String, String>();
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.migration.IMigrationTask#getOrder()
|
||||
*/
|
||||
@Override
|
||||
public Date getOrder() {
|
||||
GregorianCalendar gc = new GregorianCalendar(2021, 7, 25, 12, 0, 0);
|
||||
return gc.getTime();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public ExecutionResult execute(Item item) {
|
||||
|
||||
final ProcessType processType = getProcessType(item);
|
||||
|
||||
boolean modified = false;
|
||||
boolean migrationFailure = false;
|
||||
/*
|
||||
* If no BUILD_TYPE is set then default BUILD_TYPE must be ROUTE
|
||||
*/
|
||||
|
||||
Object buildType = item.getProperty().getAdditionalProperties().get(BUILD_TYPE_PROPERTY);
|
||||
if (null == buildType) {
|
||||
item.getProperty().getAdditionalProperties().put(BUILD_TYPE_PROPERTY, BUILD_TYPE_ROUTE);
|
||||
try {
|
||||
save(item);
|
||||
modified |= true;
|
||||
generateReportRecord(
|
||||
new MigrationReportRecorder(this, MigrationReportRecorder.MigrationOperationType.MODIFY, item,
|
||||
null, "Build Type", "null", BUILD_TYPE_OSGI));
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
return ExecutionResult.FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If no BUILD_TYPE is set then Default BUILD_TYPE must be ROUTE - Manage child
|
||||
* jobs for routes ( parent, target BUILD_TYPE = OSGI ) Else if BUILD_TYPE is
|
||||
* ROUTE - Manage child jobs for routes ( parent, target BUILD_TYPE = OSGI )
|
||||
* Else if BUILD_TYPE is ROUTE_MICROSERVICE -Manage child jobs for jobs (
|
||||
* parent, target BUILD_TYPE = STANDALONE )
|
||||
*/
|
||||
|
||||
String currentRouteBuildType = (String) item.getProperty().getAdditionalProperties().get(BUILD_TYPE_PROPERTY);
|
||||
|
||||
String currentRouteID = item.getProperty().getLabel();
|
||||
|
||||
IComponentFilter filter = new NameComponentFilter(C_TALEND_JOB);
|
||||
|
||||
List<NodeType> c = searchComponent(processType, filter);
|
||||
|
||||
if (!c.isEmpty()) {
|
||||
|
||||
for (NodeType cTalendJobComponent : c) {
|
||||
|
||||
String processID = findElementParameterByName("SELECTED_JOB_NAME:PROCESS_TYPE_PROCESS",
|
||||
cTalendJobComponent) == null ? null
|
||||
: findElementParameterByName("SELECTED_JOB_NAME:PROCESS_TYPE_PROCESS",
|
||||
cTalendJobComponent).getValue();
|
||||
String processVersion = findElementParameterByName("SELECTED_JOB_NAME:PROCESS_TYPE_VERSION",
|
||||
cTalendJobComponent) == null ? null
|
||||
: findElementParameterByName("SELECTED_JOB_NAME:PROCESS_TYPE_VERSION",
|
||||
cTalendJobComponent).getValue();
|
||||
|
||||
if (processID != null && processVersion != null) {
|
||||
ProcessItem childItem = ItemCacheManager.getProcessItem(processID, processVersion);
|
||||
Project childItemProject = ProjectManager.getInstance().getCurrentProject();
|
||||
|
||||
if (childItem == null) {
|
||||
for (Project refProject : ProjectManager.getInstance().getAllReferencedProjects()) {
|
||||
childItem = ItemCacheManager.getRefProcessItem(getProject(), processID);
|
||||
if (childItem != null) {
|
||||
childItemProject = refProject;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (childItem != null) {
|
||||
|
||||
Object currentChildBuildType = childItem.getProperty().getAdditionalProperties()
|
||||
.get(BUILD_TYPE_PROPERTY);
|
||||
|
||||
String jobID = childItem.getProperty().getLabel();
|
||||
|
||||
String currentChildBuildTypeStr = (null == currentChildBuildType) ? null
|
||||
: (String) currentChildBuildType;
|
||||
|
||||
if (BUILD_TYPE_ROUTE.equalsIgnoreCase(currentRouteBuildType)
|
||||
&& BUILD_TYPE_OSGI.equalsIgnoreCase(currentChildBuildTypeStr)) {
|
||||
storeMigratedModel(jobID, currentRouteID);
|
||||
}
|
||||
|
||||
if (BUILD_TYPE_ROUTE.equalsIgnoreCase(currentRouteBuildType)
|
||||
&& !BUILD_TYPE_OSGI.equalsIgnoreCase(currentChildBuildTypeStr)) {
|
||||
|
||||
try {
|
||||
if (isModelMigrated(jobID)) {
|
||||
ExceptionHandler.process(new RuntimeException(
|
||||
"Child Job is called by 2 or more different Routes which have different build types. Build type for child Job ["
|
||||
+ jobID + "] was previously updated to [" + currentChildBuildTypeStr
|
||||
+ "] to be compatible with parent Route ["
|
||||
+ getStoredMigratedModelParentRoute(jobID)
|
||||
+ "] which is not compatible with current parent Route ["
|
||||
+ currentRouteID + "] with build type [" + currentRouteBuildType
|
||||
+ "]. "));
|
||||
migrationFailure = true;
|
||||
continue;
|
||||
} else {
|
||||
|
||||
childItem.getProperty().getAdditionalProperties()
|
||||
.put(TalendProcessArgumentConstant.ARG_BUILD_TYPE, BUILD_TYPE_OSGI);
|
||||
|
||||
generateReportRecord(new MigrationReportRecorder(this,
|
||||
MigrationReportRecorder.MigrationOperationType.MODIFY, childItem, null,
|
||||
"Build Type", currentChildBuildTypeStr, BUILD_TYPE_OSGI));
|
||||
|
||||
|
||||
ProxyRepositoryFactory.getInstance().save(childItemProject, childItem, true);
|
||||
}
|
||||
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
return ExecutionResult.FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (BUILD_TYPE_ROUTE_MICROSERVICE.equalsIgnoreCase(currentRouteBuildType)
|
||||
&& !BUILD_TYPE_STANDALONE.equalsIgnoreCase(currentChildBuildTypeStr)) {
|
||||
|
||||
try {
|
||||
|
||||
if (isModelMigrated(jobID)) {
|
||||
ExceptionHandler.process(new RuntimeException(
|
||||
"Child Job is called by 2 or more different Routes which have different build types. Build type for child Job ["
|
||||
+ jobID + "] was previously updated to [" + currentChildBuildTypeStr
|
||||
+ "] to be compatible with parent Route ["
|
||||
+ getStoredMigratedModelParentRoute(jobID)
|
||||
+ "] which is not compatible with current parent Route ["
|
||||
+ currentRouteID + "] with build type [" + currentRouteBuildType
|
||||
+ "]. "));
|
||||
migrationFailure = true;
|
||||
continue;
|
||||
} else {
|
||||
|
||||
childItem.getProperty().getAdditionalProperties()
|
||||
.put(TalendProcessArgumentConstant.ARG_BUILD_TYPE, BUILD_TYPE_STANDALONE);
|
||||
|
||||
generateReportRecord(new MigrationReportRecorder(this,
|
||||
MigrationReportRecorder.MigrationOperationType.MODIFY, childItem, null,
|
||||
"Build Type", currentChildBuildTypeStr, BUILD_TYPE_STANDALONE));
|
||||
|
||||
ProxyRepositoryFactory.getInstance().save(childItemProject, childItem, true);
|
||||
}
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
return ExecutionResult.FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!isModelMigrated(jobID)) {
|
||||
storeMigratedModel(jobID, currentRouteID);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (migrationFailure) {
|
||||
return ExecutionResult.FAILURE;
|
||||
}
|
||||
|
||||
if (modified) {
|
||||
return ExecutionResult.SUCCESS_NO_ALERT;
|
||||
}
|
||||
|
||||
return ExecutionResult.NOTHING_TO_DO;
|
||||
|
||||
}
|
||||
|
||||
protected void clearMigratedChildJobs() {
|
||||
migratedChildJobs.clear();
|
||||
}
|
||||
|
||||
protected void storeMigratedModel(String jobName, String parentRouteName) {
|
||||
migratedChildJobs.put(jobName, parentRouteName);
|
||||
}
|
||||
|
||||
protected boolean isModelMigrated(String jobName) {
|
||||
return migratedChildJobs.containsKey(jobName);
|
||||
}
|
||||
|
||||
protected String getStoredMigratedModelParentRoute(String jobName) {
|
||||
return migratedChildJobs.get(jobName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Synchronize build types for Routes (incuding child jobs)";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
clearMigratedChildJobs();
|
||||
clearMigratedJobs();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package org.talend.designer.maven.migration.tasks;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.List;
|
||||
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.core.model.components.filters.IComponentFilter;
|
||||
import org.talend.core.model.components.filters.NameComponentFilter;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.NodeType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ProcessType;
|
||||
import org.talend.designer.maven.migration.common.MigrationReportRecorder;
|
||||
|
||||
/*
|
||||
* Data service SOAP = Job with "tESBProviderRequest"
|
||||
* Set BUILD_TYPE as OSGI
|
||||
* Manage child jobs for jobs ( parent job, target BUILD_TYPE = OSGI )
|
||||
*/
|
||||
|
||||
public class CorrectBuildTypeForSOAPServiceJobMigrationTask extends AbstractDataServiceJobMigrationTask {
|
||||
|
||||
private static final String T_ESB_PROVIDER_REQUEST = "tESBProviderRequest";
|
||||
private static final String BUILD_TYPE_PROPERTY = "BUILD_TYPE";
|
||||
|
||||
private static final String BUILD_TYPE_OSGI = "OSGI";
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.migration.IMigrationTask#getOrder()
|
||||
*/
|
||||
@Override
|
||||
public Date getOrder() {
|
||||
GregorianCalendar gc = new GregorianCalendar(2021, 7, 25, 12, 0, 0);
|
||||
return gc.getTime();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.talend.core.model.migration.AbstractDataserviceMigrationTask#execute(org
|
||||
* .talend.core.model.properties.Item)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public ExecutionResult execute(Item item) {
|
||||
final ProcessType processType = getProcessType(item);
|
||||
|
||||
boolean modified = false;
|
||||
|
||||
/*
|
||||
* If no BUILD_TYPE is set then default BUILD_TYPE must be OSGI
|
||||
*/
|
||||
|
||||
IComponentFilter filter = new NameComponentFilter(T_ESB_PROVIDER_REQUEST);
|
||||
|
||||
List<NodeType> c = searchComponent(processType, filter);
|
||||
|
||||
if (!c.isEmpty()) {
|
||||
Object originalBuildType = item.getProperty().getAdditionalProperties().get(BUILD_TYPE_PROPERTY);
|
||||
|
||||
if (null == originalBuildType || !BUILD_TYPE_OSGI.equalsIgnoreCase(originalBuildType.toString())) {
|
||||
item.getProperty().getAdditionalProperties().put(BUILD_TYPE_PROPERTY, BUILD_TYPE_OSGI);
|
||||
try {
|
||||
save(item);
|
||||
modified |= true;
|
||||
generateReportRecord(new MigrationReportRecorder(this,
|
||||
MigrationReportRecorder.MigrationOperationType.MODIFY, item, null, "Build Type",
|
||||
(null == originalBuildType) ? null : originalBuildType.toString(), BUILD_TYPE_OSGI));
|
||||
storeMigratedJob(item.getProperty().getLabel(), this.getClass().getName());
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
return ExecutionResult.FAILURE;
|
||||
}
|
||||
return ExecutionResult.SUCCESS_NO_ALERT;
|
||||
} else if (BUILD_TYPE_OSGI.equalsIgnoreCase((String)originalBuildType)){
|
||||
// current job has correct build type
|
||||
// skip this job during next migrations
|
||||
skipMigrationForJob(item.getProperty().getLabel(), this.getClass().getName());
|
||||
}
|
||||
}
|
||||
|
||||
if (modified) {
|
||||
return ExecutionResult.SUCCESS_NO_ALERT;
|
||||
}
|
||||
|
||||
return ExecutionResult.NOTHING_TO_DO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Synchronize build types for SOAP service Jobs";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear () {
|
||||
clearMigratedJobs();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package org.talend.designer.maven.migration.tasks;
|
||||
|
||||
import org.talend.migration.IProjectMigrationTask;
|
||||
|
||||
public interface ICorrectBuildTypeMigrationTask extends IProjectMigrationTask {
|
||||
public void clear ();
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package org.talend.designer.maven.tools;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import org.eclipse.core.resources.IWorkspace;
|
||||
import org.eclipse.core.resources.IWorkspaceRunnable;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.SubMonitor;
|
||||
import org.eclipse.core.runtime.jobs.ISchedulingRule;
|
||||
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
|
||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
import org.talend.designer.maven.migration.common.MigrationReportHelper;
|
||||
import org.talend.designer.maven.migration.tasks.CorrectBuildTypeForDIJobMigrationTask;
|
||||
import org.talend.designer.maven.migration.tasks.CorrectBuildTypeForDsRestMigrationTask;
|
||||
import org.talend.designer.maven.migration.tasks.CorrectBuildTypeForRoutesMigrationTask;
|
||||
import org.talend.designer.maven.migration.tasks.CorrectBuildTypeForSOAPServiceJobMigrationTask;
|
||||
import org.talend.designer.maven.migration.tasks.ICorrectBuildTypeMigrationTask;
|
||||
import org.talend.migration.IMigrationTask;
|
||||
import org.talend.migration.IProjectMigrationTask;
|
||||
import org.talend.repository.ProjectManager;
|
||||
import org.talend.repository.RepositoryWorkUnit;
|
||||
|
||||
public class BuildTypeManager {
|
||||
|
||||
private ICorrectBuildTypeMigrationTask[] syncBuildTypeMigrationTasks = {
|
||||
new CorrectBuildTypeForRoutesMigrationTask(), new CorrectBuildTypeForSOAPServiceJobMigrationTask(),
|
||||
new CorrectBuildTypeForDsRestMigrationTask(), new CorrectBuildTypeForDIJobMigrationTask() };
|
||||
|
||||
|
||||
private boolean hasErrors = false;
|
||||
|
||||
public void syncBuildTypes(FieldEditorPreferencePage page) throws Exception {
|
||||
|
||||
IRunnableWithProgress runnableWithProgress = new IRunnableWithProgress() {
|
||||
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
||||
|
||||
RepositoryWorkUnit<Object> workUnit = new RepositoryWorkUnit<Object>("Synchronize all build types") { //$NON-NLS-1$
|
||||
|
||||
@Override
|
||||
protected void run() {
|
||||
final IWorkspaceRunnable op = new IWorkspaceRunnable() {
|
||||
|
||||
@Override
|
||||
public void run(final IProgressMonitor monitor) throws CoreException {
|
||||
try {
|
||||
syncAllBuildTypesWithProgress(monitor, page);
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
IWorkspace workspace = ResourcesPlugin.getWorkspace();
|
||||
try {
|
||||
ISchedulingRule schedulingRule = workspace.getRoot();
|
||||
workspace.run(op, schedulingRule, IWorkspace.AVOID_UPDATE, monitor);
|
||||
} catch (CoreException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
workUnit.setAvoidUnloadResources(true);
|
||||
ProxyRepositoryFactory.getInstance().executeRepositoryWorkUnit(workUnit);
|
||||
}
|
||||
};
|
||||
|
||||
hasErrors = false;
|
||||
|
||||
new ProgressMonitorDialog(Display.getDefault().getActiveShell()).run(true, true, runnableWithProgress);
|
||||
|
||||
if (hasErrors) {
|
||||
page.setErrorMessage("Build types synchronization finished with errors. Check workspace logs for details.");
|
||||
} else {
|
||||
page.setErrorMessage(null);
|
||||
}
|
||||
}
|
||||
|
||||
public void syncAllBuildTypesWithProgress(IProgressMonitor monitor, FieldEditorPreferencePage page)
|
||||
throws Exception {
|
||||
|
||||
Project project = ProjectManager.getInstance().getCurrentProject();
|
||||
|
||||
SubMonitor subMonitor = SubMonitor.convert(monitor, syncBuildTypeMigrationTasks.length);
|
||||
|
||||
for (ICorrectBuildTypeMigrationTask task : syncBuildTypeMigrationTasks) {
|
||||
task.clear();
|
||||
|
||||
}
|
||||
|
||||
|
||||
for (ICorrectBuildTypeMigrationTask task : syncBuildTypeMigrationTasks) {
|
||||
subMonitor.beginTask(task.getDescription(), syncBuildTypeMigrationTasks.length);
|
||||
IMigrationTask.ExecutionResult result = task.execute(project);
|
||||
if (IMigrationTask.ExecutionResult.FAILURE.equals(result)) {
|
||||
hasErrors = true;
|
||||
}
|
||||
subMonitor.worked(1);
|
||||
|
||||
}
|
||||
|
||||
subMonitor.beginTask("Generate migration report", syncBuildTypeMigrationTasks.length);
|
||||
MigrationReportHelper.getInstance().generateMigrationReport(project.getTechnicalLabel());
|
||||
|
||||
monitor.done();
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry exported="true" kind="lib" path="lib/commons-text-1.10.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/commons-pool2-2.4.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/commons-validator-1.5.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/commons-math3-3.3.jar"/>
|
||||
@@ -8,6 +9,5 @@
|
||||
<classpathentry exported="true" kind="lib" path="lib/commons-digester-2.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/commons-cli-2.0-SNAPSHOT.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/commons-codec-1.15.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/commons-text-1.1.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
||||
@@ -10,7 +10,7 @@ Bundle-ClassPath: .,
|
||||
lib/commons-math3-3.3.jar,
|
||||
lib/commons-validator-1.5.1.jar,
|
||||
lib/commons-pool2-2.4.2.jar,
|
||||
lib/commons-text-1.1.jar
|
||||
lib/commons-text-1.10.0.jar
|
||||
Export-Package: org.apache.commons.cli2,
|
||||
org.apache.commons.cli2.builder,
|
||||
org.apache.commons.cli2.commandline,
|
||||
|
||||
@@ -7,4 +7,4 @@ bin.includes = META-INF/,\
|
||||
lib/commons-math3-3.3.jar,\
|
||||
lib/commons-validator-1.5.1.jar,\
|
||||
lib/commons-pool2-2.4.2.jar,\
|
||||
lib/commons-text-1.1.jar
|
||||
lib/commons-text-1.10.0.jar
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -62,6 +62,11 @@
|
||||
<artifactId>commons-collections</artifactId>
|
||||
<version>3.2.2</version>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-text</artifactId>
|
||||
<version>1.10.0</version>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
|
||||
@@ -6,23 +6,23 @@
|
||||
<classpathentry exported="true" kind="lib" path="lib/wsdl4j-1.6.3.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/istack-commons-runtime-3.0.12.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jaxb-runtime-2.3.4.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/woodstox-core-6.2.6.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-core-3.4.7.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-bindings-soap-3.4.7.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-bindings-xml-3.4.7.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-databinding-jaxb-3.4.7.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-features-clustering-3.4.7.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-frontend-jaxrs-3.4.7.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-frontend-jaxws-3.4.7.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-frontend-simple-3.4.7.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-rs-client-3.4.7.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-security-3.4.7.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-security-saml-3.4.7.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-transports-http-3.4.7.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-ws-addr-3.4.7.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-wsdl-3.4.7.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-ws-policy-3.4.7.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-ws-security-3.4.7.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/woodstox-core-6.4.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-core-3.5.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-bindings-soap-3.5.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-bindings-xml-3.5.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-databinding-jaxb-3.5.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-features-clustering-3.5.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-frontend-jaxrs-3.5.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-frontend-jaxws-3.5.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-frontend-simple-3.5.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-rs-client-3.5.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-security-3.5.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-security-saml-3.5.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-transports-http-3.5.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-ws-addr-3.5.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-wsdl-3.5.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-ws-policy-3.5.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-ws-security-3.5.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jakarta.activation-1.2.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jakarta.activation-api-1.2.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jakarta.annotation-api-1.3.5.jar"/>
|
||||
|
||||
@@ -5,22 +5,22 @@ Bundle-SymbolicName: org.talend.libraries.apache.cxf;singleton:=true
|
||||
Bundle-Version: 7.3.1.qualifier
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-ClassPath: .,
|
||||
lib/cxf-core-3.4.7.jar,
|
||||
lib/cxf-rt-bindings-soap-3.4.7.jar,
|
||||
lib/cxf-rt-bindings-xml-3.4.7.jar,
|
||||
lib/cxf-rt-databinding-jaxb-3.4.7.jar,
|
||||
lib/cxf-rt-features-clustering-3.4.7.jar,
|
||||
lib/cxf-rt-frontend-jaxrs-3.4.7.jar,
|
||||
lib/cxf-rt-frontend-jaxws-3.4.7.jar,
|
||||
lib/cxf-rt-frontend-simple-3.4.7.jar,
|
||||
lib/cxf-rt-rs-client-3.4.7.jar,
|
||||
lib/cxf-rt-security-3.4.7.jar,
|
||||
lib/cxf-rt-security-saml-3.4.7.jar,
|
||||
lib/cxf-rt-transports-http-3.4.7.jar,
|
||||
lib/cxf-rt-ws-addr-3.4.7.jar,
|
||||
lib/cxf-rt-wsdl-3.4.7.jar,
|
||||
lib/cxf-rt-ws-security-3.4.7.jar,
|
||||
lib/cxf-rt-ws-policy-3.4.7.jar,
|
||||
lib/cxf-core-3.5.5.jar,
|
||||
lib/cxf-rt-bindings-soap-3.5.5.jar,
|
||||
lib/cxf-rt-bindings-xml-3.5.5.jar,
|
||||
lib/cxf-rt-databinding-jaxb-3.5.5.jar,
|
||||
lib/cxf-rt-features-clustering-3.5.5.jar,
|
||||
lib/cxf-rt-frontend-jaxrs-3.5.5.jar,
|
||||
lib/cxf-rt-frontend-jaxws-3.5.5.jar,
|
||||
lib/cxf-rt-frontend-simple-3.5.5.jar,
|
||||
lib/cxf-rt-rs-client-3.5.5.jar,
|
||||
lib/cxf-rt-security-3.5.5.jar,
|
||||
lib/cxf-rt-security-saml-3.5.5.jar,
|
||||
lib/cxf-rt-transports-http-3.5.5.jar,
|
||||
lib/cxf-rt-ws-addr-3.5.5.jar,
|
||||
lib/cxf-rt-wsdl-3.5.5.jar,
|
||||
lib/cxf-rt-ws-security-3.5.5.jar,
|
||||
lib/cxf-rt-ws-policy-3.5.5.jar,
|
||||
lib/istack-commons-runtime-3.0.12.jar,
|
||||
lib/jakarta.activation-1.2.2.jar,
|
||||
lib/jakarta.activation-api-1.2.2.jar,
|
||||
@@ -35,7 +35,7 @@ Bundle-ClassPath: .,
|
||||
lib/stax2-api-4.2.1.jar,
|
||||
lib/txw2-2.3.4.jar,
|
||||
lib/xmlschema-core-2.2.5.jar,
|
||||
lib/woodstox-core-6.2.6.jar,
|
||||
lib/woodstox-core-6.4.0.jar,
|
||||
lib/wsdl4j-1.6.3.jar
|
||||
Export-Package: javax.jws,
|
||||
javax.ws.rs,
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
||||
<properties>
|
||||
<cxf.version>3.4.7</cxf.version>
|
||||
<cxf.version>3.5.5</cxf.version>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
@@ -170,7 +170,7 @@
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.woodstox</groupId>
|
||||
<artifactId>woodstox-core</artifactId>
|
||||
<version>6.2.6</version>
|
||||
<version>6.4.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.ws.xmlschema</groupId>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry exported="true" kind="lib" path="lib/lucene-core-3.0.3.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/lucene-core-8.11.2.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="output" path="class"/>
|
||||
|
||||
@@ -4,22 +4,38 @@ Bundle-Name: Lucene plug-in
|
||||
Bundle-SymbolicName: org.talend.libraries.apache.lucene
|
||||
Bundle-Version: 7.3.1.qualifier
|
||||
Bundle-Vendor: .Talend SA.
|
||||
Bundle-ClassPath: lib/lucene-core-3.0.3.jar,
|
||||
Bundle-ClassPath: lib/lucene-core-8.11.2.jar,
|
||||
.
|
||||
Export-Package: org.apache.lucene,
|
||||
org.apache.lucene.analysis,
|
||||
org.apache.lucene.analysis.standard,
|
||||
org.apache.lucene.analysis.tokenattributes,
|
||||
org.apache.lucene.codecs,
|
||||
org.apache.lucene.codecs.blocktree,
|
||||
org.apache.lucene.codecs.compressing,
|
||||
org.apache.lucene.codecs.lucene50,
|
||||
org.apache.lucene.codecs.lucene60,
|
||||
org.apache.lucene.codecs.lucene80,
|
||||
org.apache.lucene.codecs.lucene84,
|
||||
org.apache.lucene.codecs.lucene86,
|
||||
org.apache.lucene.codecs.lucene87,
|
||||
org.apache.lucene.codecs.perfield,
|
||||
org.apache.lucene.document,
|
||||
org.apache.lucene.geo,
|
||||
org.apache.lucene.index,
|
||||
org.apache.lucene.messages,
|
||||
org.apache.lucene.queryParser,
|
||||
org.apache.lucene.search,
|
||||
org.apache.lucene.search.function,
|
||||
org.apache.lucene.search.payloads,
|
||||
org.apache.lucene.search.comparators,
|
||||
org.apache.lucene.search.similarities,
|
||||
org.apache.lucene.search.spans,
|
||||
org.apache.lucene.store,
|
||||
org.apache.lucene.util,
|
||||
org.apache.lucene.util.cache
|
||||
org.apache.lucene.util.automaton,
|
||||
org.apache.lucene.util.bkd,
|
||||
org.apache.lucene.util.compress,
|
||||
org.apache.lucene.util.fst,
|
||||
org.apache.lucene.util.graph,
|
||||
org.apache.lucene.util.hppc,
|
||||
org.apache.lucene.util.mutable,
|
||||
org.apache.lucene.util.packed
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Eclipse-BundleShape: dir
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
output.. = class/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
lib/lucene-core-2.9.3.jar,\
|
||||
lib/lucene-core-3.0.3.jar
|
||||
lib/lucene-core-8.11.2.jar
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -9,4 +9,36 @@
|
||||
</parent>
|
||||
<artifactId>org.talend.libraries.apache.lucene</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
||||
<properties>
|
||||
<lucene.version>8.11.2</lucene.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-core</artifactId>
|
||||
<version>${lucene.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-dependencies</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.basedir}/lib</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry exported="true" kind="lib" path="lib/lucene-analyzers-common-8.3.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/lucene-core-8.3.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/lucene-queries-8.3.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/lucene-queryparser-8.3.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/lucene-analyzers-common-8.11.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/lucene-backward-codecs-8.11.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/lucene-core-8.11.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/lucene-queries-8.11.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/lucene-queryparser-8.11.2.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
|
||||
@@ -5,10 +5,11 @@ Bundle-SymbolicName: org.talend.libraries.apache.lucene8
|
||||
Bundle-Version: 7.3.1.qualifier
|
||||
Bundle-Vendor: .Talend SA.
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-ClassPath: lib/lucene-analyzers-common-8.3.1.jar,
|
||||
lib/lucene-core-8.3.1.jar,
|
||||
lib/lucene-queries-8.3.1.jar,
|
||||
lib/lucene-queryparser-8.3.1.jar
|
||||
Bundle-ClassPath: lib/lucene-analyzers-common-8.11.2.jar,
|
||||
lib/lucene-backward-codecs-8.11.2.jar,
|
||||
lib/lucene-core-8.11.2.jar,
|
||||
lib/lucene-queries-8.11.2.jar,
|
||||
lib/lucene-queryparser-8.11.2.jar
|
||||
Export-Package: org.apache.lucene,
|
||||
org.apache.lucene.analysis,
|
||||
org.apache.lucene.analysis.ar,
|
||||
@@ -78,6 +79,8 @@ Export-Package: org.apache.lucene,
|
||||
org.apache.lucene.codecs.lucene60,
|
||||
org.apache.lucene.codecs.lucene70,
|
||||
org.apache.lucene.codecs.lucene80,
|
||||
org.apache.lucene.codecs.lucene84,
|
||||
org.apache.lucene.codecs.lucene86,
|
||||
org.apache.lucene.codecs.perfield,
|
||||
org.apache.lucene.collation,
|
||||
org.apache.lucene.collation.tokenattributes,
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
lib/lucene-analyzers-common-8.3.1.jar,\
|
||||
lib/lucene-core-8.3.1.jar,\
|
||||
lib/lucene-queries-8.3.1.jar,\
|
||||
lib/lucene-queryparser-8.3.1.jar
|
||||
lib/lucene-analyzers-common-8.11.2.jar,\
|
||||
lib/lucene-backward-codecs-8.11.2.jar,\
|
||||
lib/lucene-core-8.11.2.jar,\
|
||||
lib/lucene-queries-8.11.2.jar,\
|
||||
lib/lucene-queryparser-8.11.2.jar
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -9,4 +9,57 @@
|
||||
</parent>
|
||||
<artifactId>org.talend.libraries.apache.lucene8</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
||||
<properties>
|
||||
<lucene.version>8.11.2</lucene.version>
|
||||
</properties>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-analyzers-common</artifactId>
|
||||
<version>${lucene.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-backward-codecs</artifactId>
|
||||
<version>${lucene.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-core</artifactId>
|
||||
<version>${lucene.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-queries</artifactId>
|
||||
<version>${lucene.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-queryparser</artifactId>
|
||||
<version>${lucene.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-dependencies</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.basedir}/lib</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<!-- same as xercesImpl.jar-->
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<version>2.12.0</version>
|
||||
<version>2.12.2</version>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>org.apache.ws.xmlschema</groupId>
|
||||
|
||||
Binary file not shown.
@@ -6,9 +6,42 @@ COPYRIGHTS AND LICENSES
|
||||
|
||||
ORIGINAL LICENSE (a.k.a. "hypersonic_lic.txt")
|
||||
|
||||
For content, code, and products originally developed by Thomas Mueller and the Hypersonic SQL Group:
|
||||
For work developed by the HSQL Development Group:
|
||||
|
||||
Copyright (c) 1995-2000 by the Hypersonic SQL Group.
|
||||
Copyright (c) 2001-2022, The HSQL Development Group
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the HSQL Development Group nor the names of its
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG,
|
||||
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
|
||||
For work originally developed by the Hypersonic SQL Group:
|
||||
|
||||
Copyright (c) 1995-2000, The Hypersonic SQL Group.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -37,12 +70,12 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
This software consists of voluntary contributions made by many individuals on behalf of the
|
||||
Hypersonic SQL Group.
|
||||
This software consists of voluntary contributions made by many individuals
|
||||
on behalf of the Hypersonic SQL Group.
|
||||
|
||||
For work added by the HSQL Development Group (a.k.a. hsqldb_lic.txt):
|
||||
|
||||
Copyright (c) 2001-2005, The HSQL Development Group
|
||||
Copyright (c) 2001-2022, The HSQL Development Group
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
29
main/plugins/org.talend.libraries.jdbc.hsql/pom.xml
Normal file → Executable file
29
main/plugins/org.talend.libraries.jdbc.hsql/pom.xml
Normal file → Executable file
@@ -9,4 +9,33 @@
|
||||
</parent>
|
||||
<artifactId>org.talend.libraries.jdbc.hsql</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>org.hsqldb</groupId>
|
||||
<artifactId>hsqldb</artifactId>
|
||||
<version>2.7.1</version>
|
||||
<classifier>jdk8</classifier>
|
||||
<outputDirectory>${project.basedir}/lib</outputDirectory>
|
||||
<destFileName>hsqldb.jar</destFileName>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry exported="true" kind="lib" path="lib/advancedPersistentLookupLib-1.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/advancedPersistentLookupLib-1.4.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
|
||||
@@ -3,8 +3,8 @@ Bundle-ManifestVersion: 2
|
||||
Bundle-Name: org.talend.libraries.persist.lookup
|
||||
Bundle-SymbolicName: org.talend.libraries.persist.lookup
|
||||
Bundle-Version: 7.3.1.qualifier
|
||||
Bundle-ClassPath: lib/advancedPersistentLookupLib-1.2.jar,
|
||||
.
|
||||
Bundle-ClassPath: .,
|
||||
lib/advancedPersistentLookupLib-1.4.jar
|
||||
Export-Package: org.talend.commons.utils.data.map,
|
||||
org.talend.commons.utils.time,
|
||||
org.talend.core.model.process,
|
||||
|
||||
@@ -2,4 +2,6 @@ source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
lib/advancedPersistentLookupLib-1.4.jar,\
|
||||
lib/advancedPersistentLookupLib-1.3.jar,\
|
||||
lib/advancedPersistentLookupLib-1.2.jar
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<jardesc>
|
||||
<jar path="D:/studio_code/tcommon-studio-se/main/plugins/org.talend.libraries.persist.lookup/lib/advancedPersistentLookupLib-1.2.jar"/>
|
||||
<jar path="D:/studio_code/tcommon-studio-se/main/plugins/org.talend.libraries.persist.lookup/lib/advancedPersistentLookupLib-1.4.jar"/>
|
||||
<options buildIfNeeded="true" compress="true" descriptionLocation="/org.talend.libraries.persist.lookup/export_advancedPersistentLookupLib.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="true" saveDescription="false" storeRefactorings="false" useSourceFolders="false"/>
|
||||
<storedRefactorings deprecationInfo="true" structuralOnly="false"/>
|
||||
<selectedProjects/>
|
||||
|
||||
Binary file not shown.
@@ -2,6 +2,7 @@
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry kind="src" path="resources/java"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jboss-marshalling-2.0.12.Final.jar"/>
|
||||
<classpathentry kind="lib" path="lib/crypto-utils.jar"/>
|
||||
<classpathentry kind="lib" path="lib/slf4j-api-1.7.25.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
|
||||
@@ -28,7 +28,8 @@ Eclipse-LazyStart: true
|
||||
Bundle-ClassPath: .,
|
||||
lib/crypto-utils.jar,
|
||||
lib/slf4j-api-1.7.25.jar
|
||||
Export-Package: org.talend.librariesmanager.emf.librariesindex,
|
||||
Export-Package: org.jboss.marshalling,
|
||||
org.talend.librariesmanager.emf.librariesindex,
|
||||
org.talend.librariesmanager.librarydata,
|
||||
org.talend.librariesmanager.maven,
|
||||
org.talend.librariesmanager.model,
|
||||
@@ -40,3 +41,5 @@ Export-Package: org.talend.librariesmanager.emf.librariesindex,
|
||||
Import-Package: org.eclipse.emf.ecore.xmi.impl,
|
||||
org.talend.osgi.hook.notification
|
||||
Eclipse-BundleShape: dir
|
||||
Bundle-ClassPath: lib/jboss-marshalling-2.0.12.Final.jar,
|
||||
.
|
||||
|
||||
@@ -69,6 +69,12 @@
|
||||
name="crypto-utils-0.31.12.jar">
|
||||
</library>
|
||||
</systemRoutine>
|
||||
<systemRoutine
|
||||
name="IPersistableLookupRow">
|
||||
<library
|
||||
name="mvn:org.jboss.marshalling/jboss-marshalling/2.0.12.Final">
|
||||
</library>
|
||||
</systemRoutine>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.talend.core.runtime.artifact_handler">
|
||||
|
||||
@@ -51,6 +51,11 @@
|
||||
<version>1.7.25</version>
|
||||
<overWrite>true</overWrite>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>org.jboss.marshalling</groupId>
|
||||
<artifactId>jboss-marshalling</artifactId>
|
||||
<version>2.0.12.Final</version>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
||||
@@ -467,13 +467,13 @@ public class TalendDate {
|
||||
*
|
||||
* {Category} TalendDate
|
||||
*
|
||||
* {param} String("") string : date represent in string
|
||||
* {param} String("2008/11/24 12:15:25") string : date represent in string
|
||||
*
|
||||
* {param} String("yyyy-MM-dd") pattern : date pattern
|
||||
* {param} String("yyyy/MM/dd HH:mm:ss") pattern : date pattern
|
||||
*
|
||||
* {param} int(addValue) nb : the added value
|
||||
* {param} int(5) nb : the added value
|
||||
*
|
||||
* {param} date("MM") dateType : the part to add
|
||||
* {param} String("dd") dateType : the part to add
|
||||
*
|
||||
* {examples}
|
||||
*
|
||||
@@ -1216,8 +1216,19 @@ public class TalendDate {
|
||||
}
|
||||
|
||||
/**
|
||||
* format date to mssql 2008 type datetimeoffset ISO 8601 string with local time zone format string : yyyy-MM-dd
|
||||
* HH:mm:ss.SSSXXX(JDK7 support it)
|
||||
* Format date to mssql 2008 type datetimeoffset ISO 8601 string with local time zone format string : yyyy-MM-dd
|
||||
* HH:mm:ss.SSSXXX (JDK7 support it)
|
||||
*
|
||||
* @param date the time value to be formatted into a time string.
|
||||
* @return the formatted time string.
|
||||
*
|
||||
* {talendTypes} String
|
||||
*
|
||||
* {Category} TalendDate
|
||||
*
|
||||
* {param} date(new Date()) date : the time value to be formatted into a time string
|
||||
*
|
||||
* {example} formatDatetimeoffset(new Date()) #
|
||||
*/
|
||||
public static String formatDatetimeoffset(Date date) {
|
||||
String dateString = formatDate("yyyy-MM-dd HH:mm:ss.SSSZ", date);// keep the max precision in java
|
||||
@@ -1346,14 +1357,28 @@ public class TalendDate {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Convert a formatted string to date
|
||||
*
|
||||
* @param string Must be a string datatype. Passes the values that you want to convert.
|
||||
* @param format Enter a valid TO_DATE format string. The format string must match the parts of the string argument
|
||||
* default formate is "MM/DD/yyyy HH:mm:ss.sss" if not specified.
|
||||
* default format is "MM/DD/yyyy HH:mm:ss.sss" if not specified.
|
||||
*
|
||||
* @return Date
|
||||
* @throws ParseException
|
||||
* {example} TO_DATE("1464576463231", "J") #Mon May 30 10:47:43 CST 2016
|
||||
* {example} TO_DATE("2015-11-21 13:23:45","yyyy-MM-dd HH:mm:ss") #Sat Nov 21 13:23:45 CST 2015
|
||||
*
|
||||
* {talendTypes} Date
|
||||
*
|
||||
* {Category} TalendDate
|
||||
*
|
||||
* {param} String("2015-11-21 13:23:45") string : string Must be a string datatype. Passes the values that you want
|
||||
* to convert.
|
||||
*
|
||||
* {param} String("yyyy-MM-dd HH:mm:ss") format : Enter a valid TO_DATE format string. The format string must match
|
||||
* the parts of the string argument default format is "MM/DD/yyyy HH:mm:ss.sss" if not specified.
|
||||
*
|
||||
*
|
||||
* {example} TO_DATE("1464576463231", "J") #Mon May 30 10:47:43 CST 2016 {example} TO_DATE("2015-11-21
|
||||
* 13:23:45","yyyy-MM-dd HH:mm:ss") #Sat Nov 21 13:23:45 CST 2015
|
||||
*
|
||||
*/
|
||||
public static Date TO_DATE(String string, String format) throws ParseException {
|
||||
@@ -1374,6 +1399,24 @@ public class TalendDate {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a formatted string to date with default format as ""MM/DD/yyyy HH:mm:ss.sss"
|
||||
*
|
||||
* @param string Must be a string datatype. Passes the values that you want to convert.
|
||||
* @return Date
|
||||
* @throws ParseException
|
||||
*
|
||||
* {talendTypes} Date
|
||||
*
|
||||
* {Category} TalendDate
|
||||
*
|
||||
* {param} String("11/21/2015 13:23:45.111") string : string Must be a string datatype. Passes the values that you
|
||||
* want to convert.
|
||||
*
|
||||
* {example} TO_DATE("11/21/2015 13:23:45.111") #Sat Nov 21 13:23:45.111 CST 2015
|
||||
*
|
||||
*/
|
||||
|
||||
public static Date TO_DATE(String string) throws ParseException {
|
||||
return TO_DATE(string, null);
|
||||
}
|
||||
@@ -1410,13 +1453,25 @@ public class TalendDate {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param date Passes the values you want to change
|
||||
* Add values to the specified portion of the date
|
||||
*
|
||||
* @param date Passes the values you want to change
|
||||
* @param format A format string specifying the portion of the date value you want to change.For example, 'mm'.
|
||||
* @param amount An integer value specifying the amount of years, months, days, hours,
|
||||
* and so on by which you want to change the date value.
|
||||
* @return Date NULL if a null value is passed as an argument to the function.
|
||||
* @param amount An integer value specifying the amount of years, months, days, hours, and so on by which you want
|
||||
* to change the date value.
|
||||
* @return Date NULL if a null value is passed as an argument to the function.
|
||||
* @throws ParseException
|
||||
*
|
||||
* {talendTypes} Date
|
||||
*
|
||||
* {Category} TalendDate
|
||||
*
|
||||
* {param} Date(new Date()) date :
|
||||
*
|
||||
* {param} String("HH") format :
|
||||
*
|
||||
* {param} int(2) amount :
|
||||
*
|
||||
* {example} ADD_TO_DATE(new Date(1464576463231l), "HH",2) #Mon May 30 12:47:43 CST 2016
|
||||
*/
|
||||
public static Date ADD_TO_DATE(Date date, String format, int amount) throws ParseException{
|
||||
@@ -1485,10 +1540,21 @@ public class TalendDate {
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a Date to a formatted character string.
|
||||
*
|
||||
* @param date Date/Time datatype. Passes the date values you want to convert to character strings.
|
||||
* @param format Enter a valid TO_CHAR format string. The format string defines the format of the return value,
|
||||
* @return String. NULL if a value passed to the function is NULL.
|
||||
* @param date the date value you want to convert to character strings.
|
||||
* @param format the format of the return value,
|
||||
* @return String. NULL if a value passed to the function is NULL.
|
||||
*
|
||||
* {talendTypes} String
|
||||
*
|
||||
* {Category} TalendDate
|
||||
*
|
||||
* {param} Date(new Date()) date : the date value you want to convert to character strings.
|
||||
*
|
||||
* {param} String("MM/DD/YYYY HH24:MI:SS") format : the format of the return value,
|
||||
*
|
||||
* {example} TO_CHAR(new Date(),"MM/DD/YYYY HH24:MI:SS") #
|
||||
*/
|
||||
|
||||
public static String TO_CHAR(Date date, String format) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
@@ -14,7 +14,6 @@ package routines.system;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.dom4j.Element;
|
||||
@@ -110,26 +109,31 @@ public class GetJarsToRegister {
|
||||
private String addLibsPath(String line, java.util.Map<String, String> crcMap) {
|
||||
for (java.util.Map.Entry<String, String> entry : crcMap.entrySet()) {
|
||||
line = adaptLibPaths(line, entry);
|
||||
if (new java.io.File(line).exists()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return line;
|
||||
}
|
||||
|
||||
private String adaptLibPaths(String line, java.util.Map.Entry<String, String> entry) {
|
||||
line = line.replace("\\", "/");
|
||||
String jarName = entry.getValue();
|
||||
String crc = entry.getKey();
|
||||
String libStringFinder = "../lib/" + jarName;
|
||||
String libStringFinder2 = "./" + jarName; // for the job jar itself.
|
||||
String replacement = "../../../cache/lib/" + crc + "/" + jarName;
|
||||
|
||||
if (line.contains(libStringFinder)) {
|
||||
line = line.replace(libStringFinder, "../../../cache/lib/" + crc + "/" + jarName);
|
||||
line = line.replace(libStringFinder, replacement);
|
||||
} else if (line.toLowerCase().contains(libStringFinder2)) {
|
||||
line = line.toLowerCase().replace(libStringFinder2, "../../../cache/lib/" + crc + "/" + jarName);
|
||||
} else if (line.toLowerCase().equals(jarName)) {
|
||||
line = "../../../cache/lib/" + crc + "/" + jarName;
|
||||
line = line.toLowerCase().replace(libStringFinder2, replacement);
|
||||
} else if (line.equalsIgnoreCase(jarName)) {
|
||||
line = replacement;
|
||||
} else if (line.contains(":$ROOT_PATH/" + jarName + ":")) {
|
||||
line = line.replace(":$ROOT_PATH/" + jarName + ":", ":$ROOT_PATH/../../../cache/lib/" + crc + "/" + jarName + ":");
|
||||
line = line.replace(":$ROOT_PATH/" + jarName + ":", ":$ROOT_PATH/" + replacement + ":");
|
||||
} else if (line.contains(";" + jarName + ";")) {
|
||||
line = line.replace(";" + jarName + ";", ";../../../cache/lib/" + crc + "/" + jarName + ";");
|
||||
line = line.replace(";" + jarName + ";", ";" + replacement + ";");
|
||||
}
|
||||
return line;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,9 @@ import java.io.DataOutputStream;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
|
||||
import org.jboss.marshalling.Marshaller;
|
||||
import org.jboss.marshalling.Unmarshaller;
|
||||
|
||||
public interface IPersistableLookupRow<R> {
|
||||
|
||||
public void writeKeysData(ObjectOutputStream out);
|
||||
@@ -19,4 +22,25 @@ public interface IPersistableLookupRow<R> {
|
||||
|
||||
public void copyKeysDataTo(R other);
|
||||
|
||||
default public void writeKeysData(Marshaller marshaller){
|
||||
//sub-class need to override this method
|
||||
throw new UnsupportedOperationException("Method need to be override");
|
||||
}
|
||||
|
||||
default public void readKeysData(Unmarshaller in){
|
||||
throw new UnsupportedOperationException("Method need to be override");
|
||||
}
|
||||
|
||||
default public void writeValuesData(DataOutputStream dataOut, Marshaller objectOut){
|
||||
throw new UnsupportedOperationException("Method need to be override");
|
||||
}
|
||||
|
||||
default public void readValuesData(DataInputStream dataIn, Unmarshaller objectIn){
|
||||
throw new UnsupportedOperationException("Method need to be override");
|
||||
}
|
||||
|
||||
default public boolean supportMarshaller(){
|
||||
//Override this method to return true after implement the Jboss methods above
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,28 @@ package routines.system;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
|
||||
import org.jboss.marshalling.Marshaller;
|
||||
import org.jboss.marshalling.Unmarshaller;
|
||||
|
||||
public interface IPersistableRow<R> {
|
||||
|
||||
public void writeData(ObjectOutputStream out);
|
||||
|
||||
public void readData(ObjectInputStream in);
|
||||
|
||||
|
||||
default public void writeData(Marshaller marshaller){
|
||||
//sub-class need to override this method
|
||||
throw new UnsupportedOperationException("Method need to be override");
|
||||
}
|
||||
|
||||
default public void readData(Unmarshaller in){
|
||||
throw new UnsupportedOperationException("Method need to be override");
|
||||
}
|
||||
|
||||
default public boolean supportJboss(){
|
||||
//Override this method to return true after implement the Jboss methods above
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -243,10 +243,39 @@ public class JSONObject {
|
||||
*
|
||||
* @param bean An object that has getter methods that should be used to make a JSONObject.
|
||||
*/
|
||||
@Deprecated
|
||||
public JSONObject(Object bean) {
|
||||
this();
|
||||
populateMap(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a JSONObject from an Object using bean getters. It reflects on all of the public methods of the object.
|
||||
* For each of the methods with no parameters and a name starting with <code>"get"</code> or <code>"is"</code>
|
||||
* followed by an uppercase letter, the method is invoked, and a key and the value returned from the getter method
|
||||
* are put into the new JSONObject.
|
||||
*
|
||||
* The key is formed by removing the <code>"get"</code> or <code>"is"</code> prefix. If the second remaining
|
||||
* character is not upper case, then the first character is converted to lower case.
|
||||
*
|
||||
* For example, if an object has a method named <code>"getName"</code>, and if the result of calling
|
||||
* <code>object.getName()</code> is <code>"Larry Fine"</code>, then the JSONObject will contain
|
||||
* <code>"name": "Larry Fine"</code>.
|
||||
*
|
||||
* @param bean An object that has getter methods that should be used to make a JSONObject.
|
||||
* @param expectedClass Bean must be the instance of this class, for safe to avoid evil script inject
|
||||
*/
|
||||
public JSONObject(Object bean, Class<?> expectedClass) {
|
||||
this();
|
||||
|
||||
Class<?> clazz = bean.getClass();
|
||||
if((clazz == expectedClass) || (expectedClass!=null && expectedClass.isAssignableFrom(clazz))) {
|
||||
populateMap(bean);
|
||||
return;
|
||||
}
|
||||
|
||||
throw new JSONException("expectedClass doesn't match the bean or is null");
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a JSONObject from an Object, using reflection to find the public members. The resulting JSONObject's
|
||||
|
||||
@@ -105,7 +105,7 @@ public class ResumeUtil {
|
||||
csvWriter.write("stackTrace");// stackTrace
|
||||
csvWriter.write("dynamicData");// dynamicData
|
||||
csvWriter.endRecord();
|
||||
csvWriter.flush();
|
||||
csvWriter.flush(true);
|
||||
}
|
||||
// shared
|
||||
sharedWriterMap.put(this.root_pid, this.csvWriter);
|
||||
@@ -171,7 +171,7 @@ public class ResumeUtil {
|
||||
csvWriter.write(item.stackTrace);// stackTrace
|
||||
csvWriter.write(item.dynamicData);// dynamicData--->it is the 17th field. @see:feature:11296
|
||||
csvWriter.endRecord();
|
||||
csvWriter.flush();
|
||||
csvWriter.flush(false);
|
||||
fileLock.release();
|
||||
}
|
||||
// for test the order
|
||||
@@ -194,6 +194,16 @@ public class ResumeUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public void flush() {
|
||||
if (csvWriter == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
synchronized (csvWriter) {
|
||||
csvWriter.flush(true);
|
||||
}
|
||||
}
|
||||
|
||||
// Util: invoke target check point
|
||||
@Deprecated
|
||||
public static void invokeTargetCheckPoint(String resuming_checkpoint_path, Object jobObject,
|
||||
@@ -353,13 +363,12 @@ public class ResumeUtil {
|
||||
String str = out.toString();
|
||||
return str;
|
||||
}
|
||||
|
||||
// to support encrypt the password in the resume
|
||||
public static String convertToJsonText(Object context, List<String> parametersToEncrypt) {
|
||||
|
||||
public static String convertToJsonText(Object context, Class<?> expectedClass, List<String> parametersToEncrypt) {
|
||||
String jsonText = "";
|
||||
try {
|
||||
JSONObject firstNode = new JSONObject();
|
||||
JSONObject secondNode = new JSONObject(context);
|
||||
JSONObject secondNode = new JSONObject(context, expectedClass);
|
||||
if (parametersToEncrypt != null) {
|
||||
for (String parameterToEncrypt : parametersToEncrypt) {
|
||||
if (secondNode.isNull(parameterToEncrypt)) {
|
||||
@@ -379,9 +388,15 @@ public class ResumeUtil {
|
||||
return jsonText;
|
||||
}
|
||||
|
||||
// to support encrypt the password in the resume
|
||||
@Deprecated
|
||||
public static String convertToJsonText(Object context, List<String> parametersToEncrypt) {
|
||||
return convertToJsonText(context, context == null ? null : context.getClass(), parametersToEncrypt);
|
||||
}
|
||||
|
||||
// Util: convert the context variable to json style text.
|
||||
// feature:11296
|
||||
// @Deprecated
|
||||
@Deprecated
|
||||
public static String convertToJsonText(Object context) {
|
||||
return convertToJsonText(context, null);
|
||||
}
|
||||
@@ -459,6 +474,8 @@ public class ResumeUtil {
|
||||
USER_DEF_LOG,
|
||||
JOB_ENDED;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* this class is reference with CsvWriter.
|
||||
@@ -503,7 +520,14 @@ public class ResumeUtil {
|
||||
|
||||
private String lineSeparator = System.getProperty("line.separator");
|
||||
|
||||
private int capibility = 2<<14; //32k
|
||||
private final int capibility = 2 << 22; //8M
|
||||
|
||||
private final int FLUSH_FACTOR = 6 *1024 *1024; //6M
|
||||
|
||||
private final int SUBSTRING_SIZE = 2 << 20; //2M
|
||||
|
||||
|
||||
|
||||
|
||||
public SimpleCsvWriter(FileChannel channel) {
|
||||
this.channel = channel;
|
||||
@@ -533,11 +557,19 @@ public class ResumeUtil {
|
||||
content = replace(content, "" + TextQualifier, "" + TextQualifier + TextQualifier);
|
||||
}
|
||||
|
||||
if (content.length() > SUBSTRING_SIZE) { //2M
|
||||
int index = 0;
|
||||
for (; content.length() - index > SUBSTRING_SIZE; index += SUBSTRING_SIZE) {
|
||||
flush(true);
|
||||
final String substring = content.substring(index, index + SUBSTRING_SIZE);
|
||||
buf.put(substring.getBytes());
|
||||
}
|
||||
content = content.substring(index);
|
||||
}
|
||||
|
||||
byte[] contentByte = content.getBytes();
|
||||
if(contentByte.length > capibility - 1024) {
|
||||
flush();
|
||||
capibility = contentByte.length * 2;
|
||||
buf = ByteBuffer.allocate(capibility);
|
||||
if(contentByte.length > capibility - buf.position()) {
|
||||
flush(true);
|
||||
}
|
||||
|
||||
buf.put(contentByte);
|
||||
@@ -562,18 +594,20 @@ public class ResumeUtil {
|
||||
/**
|
||||
* flush
|
||||
*/
|
||||
public void flush() {
|
||||
try {
|
||||
((Buffer) buf).flip();
|
||||
channel.position(channel.size());
|
||||
while(buf.hasRemaining()) {
|
||||
channel.write(buf);
|
||||
public void flush(boolean force) {
|
||||
if(force || buf.position() > FLUSH_FACTOR) {
|
||||
try {
|
||||
((Buffer) buf).flip();
|
||||
channel.position(channel.size());
|
||||
while(buf.hasRemaining()) {
|
||||
channel.write(buf);
|
||||
}
|
||||
channel.force(true);
|
||||
((Buffer) buf).clear();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
channel.force(true);
|
||||
((Buffer) buf).clear();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -373,6 +373,10 @@ public class LocalLibraryManager implements ILibraryManagerService, IChangedLibr
|
||||
.process(new Exception(getClass().getSimpleName() + " resolve " + module.getModuleName() + " failed !"));
|
||||
}
|
||||
try {
|
||||
// try maven uri first
|
||||
if (jarFile == null) {
|
||||
jarFile = getJarFile(module.getMavenUri());
|
||||
}
|
||||
// try the jar name if can't get jar with uri.
|
||||
if (jarFile == null) {
|
||||
jarFile = getJarFile(jarNeeded);
|
||||
@@ -384,7 +388,10 @@ public class LocalLibraryManager implements ILibraryManagerService, IChangedLibr
|
||||
ILibraryManagerUIService libUiService = GlobalServiceRegister.getDefault()
|
||||
.getService(ILibraryManagerUIService.class);
|
||||
|
||||
libUiService.installModules(new String[] { jarNeeded });
|
||||
// libUiService.installModules(new String[] { jarNeeded });
|
||||
List<ModuleNeeded> moduleList = new ArrayList<ModuleNeeded>();
|
||||
moduleList.add(module);
|
||||
libUiService.installModules(moduleList);
|
||||
}
|
||||
jarFile = retrieveJarFromLocal(module);
|
||||
if (jarFile == null) {
|
||||
@@ -1312,11 +1319,81 @@ public class LocalLibraryManager implements ILibraryManagerService, IChangedLibr
|
||||
saveMavenIndex(mavenURIMap, monitorWrap);
|
||||
savePlatfromURLIndex(platformURLMap, monitorWrap);
|
||||
|
||||
if (service != null) {
|
||||
deployLibsFromCustomComponents(service, platformURLMap);
|
||||
}
|
||||
return mavenURIMap;
|
||||
}
|
||||
|
||||
public void deployLibsFromCustomComponents(File componentFolder, List<ModuleNeeded> modulesNeeded) {
|
||||
if (modulesNeeded == null || modulesNeeded.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Map<File, Set<MavenArtifact>> needToDeploy = new HashMap<File, Set<MavenArtifact>>();
|
||||
modulesNeeded.forEach(module -> {
|
||||
if (module != null) {
|
||||
boolean needDeploy = false;
|
||||
String mvnUri = module.getMavenUri();
|
||||
String jarPathFromMaven = getJarPathFromMaven(StringUtils.isNotBlank(mvnUri) ? mvnUri : module.getModuleName());
|
||||
if (StringUtils.isBlank(jarPathFromMaven)) {
|
||||
needDeploy = true;
|
||||
} else {
|
||||
File jarFromMaven = new File(jarPathFromMaven);
|
||||
if (!jarFromMaven.exists()) {
|
||||
needDeploy = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (needDeploy) {
|
||||
File deployFile = getDeployJarFileByModule(componentFolder, module);
|
||||
if (deployFile != null) {
|
||||
|
||||
install(deployFile, mvnUri, false, true, null);
|
||||
|
||||
if (needToDeploy.get(deployFile) == null) {
|
||||
needToDeploy.put(deployFile, new HashSet<MavenArtifact>());
|
||||
}
|
||||
if (StringUtils.isNotBlank(mvnUri)) {
|
||||
MavenArtifact mavenArtifact = MavenUrlHelper.parseMvnUrl(mvnUri);
|
||||
needToDeploy.get(deployFile).add(mavenArtifact);
|
||||
} else {
|
||||
Map<String, String> sourceAndMavenUri = new HashMap<>();
|
||||
guessMavenRUIFromIndex(deployFile, true, sourceAndMavenUri);
|
||||
Set<MavenArtifact> MavenArtifactSet = new HashSet<MavenArtifact>();
|
||||
sourceAndMavenUri.keySet().forEach(mavenUri -> {
|
||||
if (StringUtils.isNotBlank(mvnUri)) {
|
||||
MavenArtifactSet.add(MavenUrlHelper.parseMvnUrl(mavenUri));
|
||||
}
|
||||
});
|
||||
needToDeploy.get(deployFile).addAll(MavenArtifactSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (!needToDeploy.isEmpty()) {
|
||||
ShareComponentsLibsJob shareJob = new ShareComponentsLibsJob(
|
||||
Messages.getString("LocalLibraryManager.shareLibsForCustomponents"), needToDeploy, deployer);
|
||||
shareJob.schedule();
|
||||
}
|
||||
}
|
||||
|
||||
private File getDeployJarFileByModule(File componentFolder, ModuleNeeded module) {
|
||||
String mvnUri = module.getMavenUri();
|
||||
if (StringUtils.isNotBlank(mvnUri)) {
|
||||
MavenArtifact mavenArtifact = MavenUrlHelper.parseMvnUrl(mvnUri);
|
||||
String fileName = mavenArtifact.getFileName();
|
||||
File jarFile = new File(componentFolder, fileName);
|
||||
if (jarFile.exists()) {
|
||||
return jarFile;
|
||||
}
|
||||
|
||||
}
|
||||
// try module name
|
||||
File jarFile = new File(componentFolder, module.getModuleName());
|
||||
if (jarFile.exists()) {
|
||||
return jarFile;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -1347,7 +1424,7 @@ public class LocalLibraryManager implements ILibraryManagerService, IChangedLibr
|
||||
if (path.equals(moduleLocation)) {
|
||||
continue;
|
||||
} else {
|
||||
if (CommonsPlugin.isDebugMode()) {
|
||||
if (CommonsPlugin.isDebugMode() && !CommonsPlugin.isHeadless()) {
|
||||
CommonExceptionHandler
|
||||
.warn(name + " is duplicated, locations:" + path + " and:" + moduleLocation);
|
||||
}
|
||||
@@ -1375,86 +1452,6 @@ public class LocalLibraryManager implements ILibraryManagerService, IChangedLibr
|
||||
return false;
|
||||
}
|
||||
|
||||
private void deployLibsFromCustomComponents(IComponentsService service, Map<String, String> platformURLMap) {
|
||||
boolean deployToRemote = true;
|
||||
if (!LibrariesManagerUtils.shareLibsAtStartup()) {
|
||||
log.info("Skip deploying libs from custom components");
|
||||
deployToRemote = false;
|
||||
}
|
||||
|
||||
Map<File, Set<MavenArtifact>> needToDeploy = new HashMap<File, Set<MavenArtifact>>();
|
||||
List<ComponentProviderInfo> componentsFolders = service.getComponentsFactory().getComponentsProvidersInfo();
|
||||
for (ComponentProviderInfo providerInfo : componentsFolders) {
|
||||
String id = providerInfo.getId();
|
||||
try {
|
||||
File file = new File(providerInfo.getLocation());
|
||||
if (isExtComponentProvider(id)) {
|
||||
if (file.isDirectory()) {
|
||||
List<File> jarFiles = FilesUtils.getJarFilesFromFolder(file, null);
|
||||
if (jarFiles.size() > 0) {
|
||||
for (File jarFile : jarFiles) {
|
||||
String name = jarFile.getName();
|
||||
if (!canDeployFromCustomComponentFolder(name) || platformURLMap.get(name) != null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
collectLibModules(jarFile, needToDeploy);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!canDeployFromCustomComponentFolder(file.getName()) || platformURLMap.get(file.getName()) != null) {
|
||||
continue;
|
||||
}
|
||||
collectLibModules(file, needToDeploy);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// first install them locally
|
||||
needToDeploy.forEach((k, v) -> {
|
||||
try {
|
||||
// install as release version if can't find mvn url from index
|
||||
install(k, null, false, true);
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
});
|
||||
|
||||
if (!deployToRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
ShareComponentsLibsJob shareJob = new ShareComponentsLibsJob(
|
||||
Messages.getString("LocalLibraryManager.shareLibsForCustomponents"), needToDeploy, deployer);
|
||||
shareJob.schedule();
|
||||
}
|
||||
|
||||
private void collectLibModules(File jarFile, Map<File, Set<MavenArtifact>> needToDeploy) {
|
||||
Map<String,String> mavenUris = new HashMap<String,String>();
|
||||
guessMavenRUIFromIndex(jarFile, true, mavenUris);
|
||||
|
||||
Set<MavenArtifact> artifacts = new HashSet<MavenArtifact>();
|
||||
for(String uri: mavenUris.keySet()) {
|
||||
MavenArtifact art = MavenUrlHelper.parseMvnUrl(uri);
|
||||
if(art!=null) {
|
||||
artifacts.add(art);
|
||||
}
|
||||
}
|
||||
|
||||
needToDeploy.put(jarFile, artifacts);
|
||||
}
|
||||
|
||||
private boolean canDeployFromCustomComponentFolder(String fileName) {
|
||||
if (isSystemCacheFile(fileName) || isComponentDefinitionFileType(fileName)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void warnDuplicated(List<ModuleNeeded> modules, Set<String> duplicates, String type) {
|
||||
for (String lib : duplicates) {
|
||||
Set<String> components = new HashSet<>();
|
||||
|
||||
@@ -510,10 +510,12 @@ InegerCellEditorListener.NumeralMessage=Input value invalid
|
||||
MetadataTalendTypeEditor.button.edit=E&dit
|
||||
MetadataTalendTypeEditor.button.export=E&xport Mapping
|
||||
MetadataTalendTypeEditor.button.import=I&mport Mapping
|
||||
MetadataTalendTypeEditor.button.restore=R&estore
|
||||
MetadataTalendTypeEditor.column1.Name=Metadata Mapping File
|
||||
MetadataTalendTypeEditor.editMappingDialog.title=Edit Mapping File
|
||||
MetadataTalendTypeEditor.error.message=Error Message
|
||||
MetadataTalendTypeEditor.fileIsImported=This file is already imported.
|
||||
MetadataTalendTypeEditor.fileOverwrite=This file already exists. Do you want to overwrite it?
|
||||
MetadataTalendTypeEditor.fileIsInvalid=The imported metadata file is not valid.
|
||||
MetadataTalendTypeEditor.fileNameStartRule=File name must start with 'mapping_'.
|
||||
ContextModeSelectPage.contextModes=Create a new context or reuse the existing one
|
||||
|
||||
@@ -12,16 +12,23 @@
|
||||
// ============================================================================
|
||||
package org.talend.metadata.managment.ui.editor;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Files;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.FileLocator;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
@@ -33,6 +40,7 @@ import org.eclipse.jface.dialogs.IDialogConstants;
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.jface.preference.FieldEditor;
|
||||
import org.eclipse.jface.resource.JFaceResources;
|
||||
import org.eclipse.jface.text.Document;
|
||||
import org.eclipse.jface.text.IDocument;
|
||||
import org.eclipse.jface.viewers.ArrayContentProvider;
|
||||
import org.eclipse.jface.viewers.DoubleClickEvent;
|
||||
@@ -61,19 +69,16 @@ import org.eclipse.swt.widgets.Table;
|
||||
import org.eclipse.swt.widgets.TableColumn;
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.exception.LoginException;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.commons.exception.SystemException;
|
||||
import org.talend.commons.utils.io.FilesUtils;
|
||||
import org.talend.commons.utils.workbench.resources.ResourceUtils;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.ICoreService;
|
||||
import org.talend.core.model.metadata.Dbms;
|
||||
import org.talend.core.model.metadata.MetadataTalendType;
|
||||
import org.talend.core.model.utils.ResourceModelHelper;
|
||||
import org.talend.core.model.utils.XSDValidater;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||
import org.talend.core.runtime.projectsetting.ProjectPreferenceManager;
|
||||
import org.talend.metadata.managment.ui.MetadataManagmentUiPlugin;
|
||||
import org.talend.metadata.managment.ui.dialog.MappingFileCheckViewerDialog;
|
||||
import org.talend.metadata.managment.ui.i18n.Messages;
|
||||
@@ -131,6 +136,16 @@ public class MetadataTalendTypeEditor extends FieldEditor {
|
||||
|
||||
IDocument fileContent;
|
||||
|
||||
FileType type;
|
||||
|
||||
boolean isDeleted;
|
||||
|
||||
}
|
||||
|
||||
enum FileType {
|
||||
USER_DEFINED,
|
||||
SYSTEM_DEFAULT,
|
||||
USER_EXTERNAL,
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -141,7 +156,7 @@ public class MetadataTalendTypeEditor extends FieldEditor {
|
||||
*/
|
||||
class TmpFilesManager {
|
||||
|
||||
// store the editing tempertory files
|
||||
// store the editing temporary files
|
||||
private List<FileInfo> tmpFiles = new ArrayList<FileInfo>();
|
||||
|
||||
TmpFilesManager() {
|
||||
@@ -149,13 +164,30 @@ public class MetadataTalendTypeEditor extends FieldEditor {
|
||||
}
|
||||
|
||||
private void init() {
|
||||
List<File> files = MetadataTalendType.getMetadataMappingFiles();
|
||||
tmpFiles.clear();
|
||||
for (File file : files) {
|
||||
FileInfo info = new FileInfo();
|
||||
info.file = file;
|
||||
info.fileName = file.getName();
|
||||
this.addFile(info);
|
||||
try {
|
||||
tmpFiles.clear();
|
||||
java.nio.file.Path systemMappingPath = new File(MetadataTalendType.getSystemFolderURLOfMappingsFile().getFile())
|
||||
.toPath();
|
||||
Map<String, File> systemFileMap = Stream
|
||||
.of(systemMappingPath.toFile()
|
||||
.listFiles(f -> f.getName().matches(MetadataTalendType.MAPPING_FILE_PATTERN)))
|
||||
.collect(Collectors.toMap(File::getName, Function.identity()));
|
||||
List<File> files = MetadataTalendType.getMetadataMappingFiles();
|
||||
for (File file : files) {
|
||||
FileInfo info = new FileInfo();
|
||||
info.file = file;
|
||||
info.fileName = file.getName();
|
||||
if (file.toPath().startsWith(systemMappingPath)) {
|
||||
info.type = FileType.SYSTEM_DEFAULT;
|
||||
} else if (systemFileMap.containsKey(file.getName())) {
|
||||
info.type = FileType.USER_DEFINED;
|
||||
} else {
|
||||
info.type = FileType.USER_EXTERNAL;
|
||||
}
|
||||
this.addFile(info);
|
||||
}
|
||||
} catch (SystemException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,8 +195,9 @@ public class MetadataTalendTypeEditor extends FieldEditor {
|
||||
tmpFiles.add(file);
|
||||
}
|
||||
|
||||
List<FileInfo> getTempFiles() {
|
||||
return tmpFiles;
|
||||
List<FileInfo> getTempFiles(boolean includeDeleted) {
|
||||
return tmpFiles.stream().filter(f -> includeDeleted || !f.isDeleted || FileType.SYSTEM_DEFAULT == f.type)
|
||||
.sorted((f1, f2) -> f1.fileName.compareTo(f2.fileName)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
boolean contains(String fileName) {
|
||||
@@ -176,15 +209,6 @@ public class MetadataTalendTypeEditor extends FieldEditor {
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean contains(File file) {
|
||||
for (FileInfo info : tmpFiles) {
|
||||
if (info.file.equals(file)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void remove(FileInfo file) {
|
||||
tmpFiles.remove(file);
|
||||
}
|
||||
@@ -297,8 +321,29 @@ public class MetadataTalendTypeEditor extends FieldEditor {
|
||||
sourceViewerDialog.setDocument(fileSelected.file);
|
||||
}
|
||||
if (sourceViewerDialog.open() == IDialogConstants.OK_ID) {
|
||||
System.out.println(sourceViewerDialog.getDocument().get());
|
||||
fileSelected.fileContent = sourceViewerDialog.getDocument();
|
||||
System.out.println(sourceViewerDialog.getResult());
|
||||
try {
|
||||
File systemFile = new File(MetadataTalendType.getSystemFolderURLOfMappingsFile().getFile(),
|
||||
fileSelected.fileName);
|
||||
if (systemFile.exists()) {
|
||||
String currentSha1 = MetadataTalendType.getSha1OfText(sourceViewerDialog.getDocument().get());
|
||||
String systemSha1 = MetadataTalendType.getSha1OfFile(systemFile);
|
||||
if (currentSha1 != null && currentSha1.equals(systemSha1)) {
|
||||
fileSelected.type = FileType.SYSTEM_DEFAULT;
|
||||
fileSelected.file = systemFile;
|
||||
setControlEnable(removeButton, false);
|
||||
} else {
|
||||
fileSelected.type = FileType.USER_DEFINED;
|
||||
fileSelected.file = new File(MetadataTalendType.getProjectFolderURLOfMappingsFile().getFile(),
|
||||
fileSelected.fileName);
|
||||
setControlEnable(removeButton, true);
|
||||
}
|
||||
}
|
||||
fileSelected.fileContent = sourceViewerDialog.getDocument();
|
||||
fileSelected.isDeleted = false;
|
||||
} catch (SystemException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -382,7 +427,16 @@ public class MetadataTalendTypeEditor extends FieldEditor {
|
||||
*/
|
||||
protected void removeItem() {
|
||||
FileInfo info = getSelection();
|
||||
tmpFileManager.remove(info);
|
||||
info.isDeleted = true;
|
||||
if (FileType.USER_DEFINED == info.type) {
|
||||
try {
|
||||
info.type = FileType.SYSTEM_DEFAULT;
|
||||
info.file = new File(MetadataTalendType.getSystemFolderURLOfMappingsFile().getFile(), info.fileName);
|
||||
info.fileContent = null;
|
||||
} catch (SystemException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
refreshViewer();
|
||||
}
|
||||
|
||||
@@ -413,16 +467,21 @@ public class MetadataTalendTypeEditor extends FieldEditor {
|
||||
}
|
||||
|
||||
private void exportItem() {
|
||||
File existing = getSelection().file;
|
||||
FileInfo selectedFileInfo = getSelection();
|
||||
FileDialog dia = new FileDialog(getShell(), SWT.SAVE);
|
||||
dia.setFileName(existing.getName());
|
||||
dia.setFileName(selectedFileInfo.fileName);
|
||||
dia.setFilterExtensions(new String[] { "*.xml" }); //$NON-NLS-1$
|
||||
String destination = dia.open();
|
||||
if (destination == null) {
|
||||
return;
|
||||
}
|
||||
File destinationFile = new File(destination);
|
||||
try {
|
||||
FilesUtils.copyFile(existing, new File(destination));
|
||||
if (selectedFileInfo.fileContent != null) {
|
||||
Files.write(destinationFile.toPath(), selectedFileInfo.fileContent.get().getBytes());
|
||||
} else {
|
||||
FilesUtils.copyFile(selectedFileInfo.file, destinationFile);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
@@ -472,17 +531,39 @@ public class MetadataTalendTypeEditor extends FieldEditor {
|
||||
private void importItem() {
|
||||
setPresentsDefaultValue(false);
|
||||
File input = getNewInputObject();
|
||||
|
||||
if (input != null) {
|
||||
FileInfo fileInfo = new FileInfo();
|
||||
fileInfo.file = input;
|
||||
fileInfo.fileName = input.getName();
|
||||
tmpFileManager.addFile(fileInfo);
|
||||
Optional<FileInfo> optional = tmpFileManager.getTempFiles(true).stream()
|
||||
.filter(f -> f.fileName.equals(input.getName())).findAny();
|
||||
if (optional.isPresent()) {
|
||||
FileInfo tmpFileInfo = optional.get();
|
||||
try {
|
||||
String content = new String(Files.readAllBytes(input.toPath()));
|
||||
if (FileType.SYSTEM_DEFAULT == tmpFileInfo.type) {
|
||||
String systemSha1 = MetadataTalendType.getSha1OfSystemMappingFile(tmpFileInfo.fileName);
|
||||
String inputSha1 = MetadataTalendType.getSha1OfText(content);
|
||||
if (inputSha1.equals(systemSha1)) {
|
||||
return;
|
||||
}
|
||||
tmpFileInfo.type = FileType.USER_DEFINED;
|
||||
}
|
||||
tmpFileInfo.fileContent = new Document(content);
|
||||
tmpFileInfo.isDeleted = false;
|
||||
} catch (IOException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
} else {
|
||||
FileInfo fileInfo = new FileInfo();
|
||||
fileInfo.file = input;
|
||||
fileInfo.fileName = input.getName();
|
||||
fileInfo.type = FileType.USER_EXTERNAL;
|
||||
tmpFileManager.addFile(fileInfo);
|
||||
}
|
||||
refreshViewer();
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshViewer() {
|
||||
viewer.setInput(tmpFileManager.getTempFiles(false));
|
||||
viewer.refresh();
|
||||
selectionChanged();
|
||||
}
|
||||
@@ -497,11 +578,11 @@ public class MetadataTalendTypeEditor extends FieldEditor {
|
||||
}
|
||||
File xmlFile = new File(fileName);
|
||||
if (tmpFileManager.contains(xmlFile.getName())) {
|
||||
MessageDialog
|
||||
.openWarning(
|
||||
boolean confirm = MessageDialog.openConfirm(
|
||||
shell,
|
||||
Messages.getString("MetadataTalendTypeEditor.error.message"), Messages.getString("MetadataTalendTypeEditor.fileIsImported")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
return null;
|
||||
Messages.getString("MetadataTalendTypeEditor.confirmTitle"), //$NON-NLS-1$
|
||||
Messages.getString("MetadataTalendTypeEditor.fileOverwrite")); //$NON-NLS-1$
|
||||
return confirm ? xmlFile : null;
|
||||
}
|
||||
|
||||
if (!xmlFile.getName().startsWith("mapping_")) { //$NON-NLS-1$
|
||||
@@ -536,13 +617,21 @@ public class MetadataTalendTypeEditor extends FieldEditor {
|
||||
boolean selected = !viewer.getSelection().isEmpty();
|
||||
setControlEnable(exportButton, selected);
|
||||
setControlEnable(editButton, selected);
|
||||
setControlEnable(removeButton, selected);
|
||||
|
||||
boolean removeEnable = selected;
|
||||
StructuredSelection select = (StructuredSelection) viewer.getSelection();
|
||||
|
||||
if (select != null) {
|
||||
FileInfo info = (FileInfo) select.getFirstElement();
|
||||
if (info != null) {
|
||||
String buttonText = null;
|
||||
if (FileType.USER_DEFINED == info.type || FileType.SYSTEM_DEFAULT == info.type) {
|
||||
buttonText = Messages.getString("MetadataTalendTypeEditor.button.restore"); //$NON-NLS-1$
|
||||
} else if (FileType.USER_EXTERNAL == info.type) {
|
||||
buttonText = JFaceResources.getString("ListEditor.remove"); //$NON-NLS-1$
|
||||
}
|
||||
removeButton.setText(buttonText);
|
||||
removeEnable = FileType.SYSTEM_DEFAULT != info.type;
|
||||
String id = null;
|
||||
String infoName = info.fileName;
|
||||
for (Dbms allDbm : allDbms) {
|
||||
@@ -553,6 +642,7 @@ public class MetadataTalendTypeEditor extends FieldEditor {
|
||||
setSelectId(id);
|
||||
}
|
||||
}
|
||||
setControlEnable(removeButton, removeEnable);
|
||||
}
|
||||
|
||||
protected void setControlEnable(Control control, boolean enable) {
|
||||
@@ -569,13 +659,31 @@ public class MetadataTalendTypeEditor extends FieldEditor {
|
||||
Messages.getString("MetadataTalendTypeEditor.confirmTitle"), //$NON-NLS-1$
|
||||
Messages.getString("MetadataTalendTypeEditor.confirmMessage")); //$NON-NLS-1$
|
||||
if (confirm) {
|
||||
ICoreService coreService = null;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreService.class)) {
|
||||
coreService = GlobalServiceRegister.getDefault().getService(ICoreService.class);
|
||||
coreService.syncMappingsFileFromSystemToProject();
|
||||
tmpFileManager.reload();
|
||||
}
|
||||
RepositoryWorkUnit workUnit = new RepositoryWorkUnit("Restore mapping files") { //$NON-NLS-1$
|
||||
|
||||
@Override
|
||||
protected void run() throws LoginException, PersistenceException {
|
||||
try {
|
||||
File[] projectMappingFiles = new File(MetadataTalendType.getProjectFolderURLOfMappingsFile().getFile())
|
||||
.listFiles();
|
||||
if (projectMappingFiles != null) {
|
||||
Set<String> systemFileNames = Stream
|
||||
.of(new File(MetadataTalendType.getSystemFolderURLOfMappingsFile().getFile())
|
||||
.listFiles(f -> f.getName().matches(MetadataTalendType.MAPPING_FILE_PATTERN)))
|
||||
.map(File::getName).collect(Collectors.toSet());
|
||||
Stream.of(projectMappingFiles).filter(f -> systemFileNames.contains(f.getName()))
|
||||
.forEach(File::delete);
|
||||
}
|
||||
} catch (SystemException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
workUnit.setAvoidUnloadResources(true);
|
||||
ProxyRepositoryFactory.getInstance().executeRepositoryWorkUnit(workUnit);
|
||||
tmpFileManager.reload();
|
||||
super.load();
|
||||
viewer.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -586,7 +694,7 @@ public class MetadataTalendTypeEditor extends FieldEditor {
|
||||
*/
|
||||
@Override
|
||||
protected void doLoad() {
|
||||
viewer.setInput(tmpFileManager.getTempFiles());
|
||||
viewer.setInput(tmpFileManager.getTempFiles(false));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -595,7 +703,7 @@ public class MetadataTalendTypeEditor extends FieldEditor {
|
||||
* DOC YeXiaowei Comment method "forceLoad".
|
||||
*/
|
||||
public void forceLoad() {
|
||||
viewer.setInput(tmpFileManager.getTempFiles());
|
||||
viewer.setInput(tmpFileManager.getTempFiles(false));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -635,98 +743,44 @@ public class MetadataTalendTypeEditor extends FieldEditor {
|
||||
}
|
||||
|
||||
boolean needReload = false;
|
||||
|
||||
List<FileInfo> tempFiles = tmpFileManager.getTempFiles();
|
||||
List<File> realFiles = MetadataTalendType.getMetadataMappingFiles();
|
||||
|
||||
// delete the removed files
|
||||
for (File file : realFiles) {
|
||||
if (!tmpFileManager.contains(file.getName())) {
|
||||
IFile iFile = mappingFolder.getFile(file.getName());
|
||||
List<FileInfo> tmpFiles = tmpFileManager.getTempFiles(true);
|
||||
for (FileInfo info : tmpFiles) {
|
||||
IFile file = mappingFolder.getFile(info.fileName);
|
||||
if (FileType.SYSTEM_DEFAULT == info.type || info.isDeleted) {
|
||||
try {
|
||||
iFile.delete(true, null);
|
||||
needReload = true;
|
||||
if (file.exists()) {
|
||||
file.delete(true, null);
|
||||
needReload = true;
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// add the new files;
|
||||
for (FileInfo newFile : tempFiles) {
|
||||
if (!realFiles.contains(newFile.file)) {
|
||||
if (FileType.USER_DEFINED == info.type || FileType.USER_EXTERNAL == info.type) {
|
||||
try {
|
||||
importFileIntoTalend(newFile.file);
|
||||
byte[] newContent = info.fileContent == null ? Files.readAllBytes(info.file.toPath())
|
||||
: info.fileContent.get().getBytes();
|
||||
InputStream inputStream = new ByteArrayInputStream(newContent);
|
||||
if (file.exists()) {
|
||||
file.setContents(inputStream, true, false, null);
|
||||
} else {
|
||||
if (!mappingFolder.exists()) {
|
||||
ResourceUtils.createFolder(mappingFolder);
|
||||
}
|
||||
file.create(inputStream, true, null);
|
||||
}
|
||||
needReload = true;
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// for editing files
|
||||
for (FileInfo tempFile : tempFiles) {
|
||||
for (File realFile : realFiles) {
|
||||
if (realFile.equals(tempFile.file)) {
|
||||
if (tempFile.fileContent != null) {
|
||||
try {
|
||||
updateFileContent(realFile, tempFile.fileContent.get());
|
||||
needReload = true;
|
||||
break;
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
mappingFolder.refreshLocal(IResource.DEPTH_ONE, null);
|
||||
} catch (CoreException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
if (needReload) {
|
||||
tmpFileManager.reload();
|
||||
ProjectPreferenceManager manager = CoreRuntimePlugin.getInstance().getProjectPreferenceManager();
|
||||
manager.setValue(MetadataTalendType.UPDATED_MAPPING_FILES, true);
|
||||
manager.save();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* bqian Comment method "updateFileContent".
|
||||
*
|
||||
* @param realFile
|
||||
* @param string
|
||||
*/
|
||||
private void updateFileContent(File realFile, String string) throws Exception {
|
||||
FileWriter fw = null;
|
||||
try {
|
||||
fw = new FileWriter(realFile);
|
||||
fw.write(string);
|
||||
fw.flush();
|
||||
} finally {
|
||||
fw.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Import the selected file into talend.
|
||||
*
|
||||
* @param xmlFile
|
||||
* @throws SystemException
|
||||
*/
|
||||
private File importFileIntoTalend(File xmlFile) throws IOException, SystemException {
|
||||
String fileName = xmlFile.getName();
|
||||
|
||||
URL url = MetadataTalendType.getProjectForderURLOfMappingsFile();
|
||||
File targetFile = new File(url.getPath(), fileName);
|
||||
|
||||
FilesUtils.copyFile(xmlFile, targetFile);
|
||||
return targetFile;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc) Method declared on FieldEditor.
|
||||
*/
|
||||
|
||||
@@ -893,6 +893,7 @@ public final class DBConnectionContextUtils {
|
||||
managerConnection.setValue(0, dbType, urlConnection, server, username, password, sidOrDatabase, port, filePath,
|
||||
datasource, schemaOracle, additionParam, driverClassName, driverJarPath, dbVersionString);
|
||||
managerConnection.setDbRootPath(dbRootPath);
|
||||
managerConnection.setSupportNLS(dbConn.isSupportNLS());
|
||||
|
||||
return urlConnection;
|
||||
}
|
||||
@@ -1058,6 +1059,12 @@ public final class DBConnectionContextUtils {
|
||||
cloneConn.setSQLMode(true);
|
||||
}
|
||||
|
||||
if(dbConn.isSetSupportNLS()) {
|
||||
cloneConn.setSupportNLS(dbConn.isSupportNLS());
|
||||
} else {
|
||||
cloneConn.setSupportNLS(false);
|
||||
}
|
||||
|
||||
// cloneConn.setProperties(dbConn.getProperties());
|
||||
// cloneConn.setCdcConns(dbConn.getCdcConns());
|
||||
// cloneConn.setQueries(dbConn.getQueries());
|
||||
|
||||
@@ -166,7 +166,8 @@ public class ExtendedNodeConnectionContextUtils {
|
||||
KnoxUrl,
|
||||
KnoxUsername,
|
||||
KnoxPassword,
|
||||
KnoxDirectory
|
||||
KnoxDirectory,
|
||||
KnoxTimeout
|
||||
}
|
||||
|
||||
static List<IContextParameter> getContextVariables(final String prefixName, Connection conn, Set<IConnParamName> paramSet) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user