Compare commits
131 Commits
bhe/bugfix
...
vdrokov_fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
56f19902d0 | ||
|
|
75176b6f45 | ||
|
|
11ecc1cbfd | ||
|
|
53efef8de0 | ||
|
|
db2eb01c38 | ||
|
|
f9af16ba90 | ||
|
|
23f2926741 | ||
|
|
48653aa380 | ||
|
|
d80fefc234 | ||
|
|
a0b395cd3a | ||
|
|
98bcc66479 | ||
|
|
a716257dd0 | ||
|
|
b164f8c447 | ||
|
|
dd352b4a8f | ||
|
|
08ac05c23e | ||
|
|
90a37f8418 | ||
|
|
137c543bfd | ||
|
|
42e94c6508 | ||
|
|
ff9c4c021a | ||
|
|
291f56e505 | ||
|
|
c67b2f479e | ||
|
|
45d373f447 | ||
|
|
edff6eeeb8 | ||
|
|
acd1555a2b | ||
|
|
97a77ec401 | ||
|
|
a5f6364467 | ||
|
|
db39d84224 | ||
|
|
d153fe9fa0 | ||
|
|
939e974d1c | ||
|
|
722a0b1341 | ||
|
|
7b391d516f | ||
|
|
b5478c3f2f | ||
|
|
0726cb38fd | ||
|
|
687ab637be | ||
|
|
4cb1deb115 | ||
|
|
c594011902 | ||
|
|
c6d7da2121 | ||
|
|
90951dced8 | ||
|
|
c22eba9ead | ||
|
|
e466c31b88 | ||
|
|
6a601fadd2 | ||
|
|
28a216d0af | ||
|
|
5622490ca4 | ||
|
|
283fa4ac93 | ||
|
|
b55a302e9f | ||
|
|
887d1249dc | ||
|
|
caa73983c8 | ||
|
|
7a502a7dc1 | ||
|
|
c395d11c00 | ||
|
|
1fc99eaa02 | ||
|
|
77a076cea1 | ||
|
|
94914d676b | ||
|
|
1faf28843b | ||
|
|
f62e85356c | ||
|
|
81a6422c0b | ||
|
|
941c36921b | ||
|
|
e01cecfb68 | ||
|
|
9d3fb2213b | ||
|
|
aa4ccadbaf | ||
|
|
1c7f2a311c | ||
|
|
0b7cba2a9d | ||
|
|
f8dd9f0c1a | ||
|
|
9c12a2e19e | ||
|
|
a2132cb833 | ||
|
|
ed4655f2aa | ||
|
|
910e3fb601 | ||
|
|
bda6b0a1a7 | ||
|
|
4ad4d3e5b2 | ||
|
|
8031d9adb3 | ||
|
|
74232f3dc3 | ||
|
|
b2e5ab5630 | ||
|
|
f1b9ed2e86 | ||
|
|
de48a67805 | ||
|
|
55723c1a48 | ||
|
|
7bb5692418 | ||
|
|
4010656564 | ||
|
|
966becc5e5 | ||
|
|
8bd1fd724f | ||
|
|
92d31aa477 | ||
|
|
b4f77effd8 | ||
|
|
3086f9be45 | ||
|
|
8dc5f853fd | ||
|
|
dfae595cbe | ||
|
|
b3271f70e0 | ||
|
|
486650da91 | ||
|
|
2885482d6f | ||
|
|
e35338ca0a | ||
|
|
76452e3799 | ||
|
|
4b0c75070d | ||
|
|
1ac63975c1 | ||
|
|
dffa6d97c9 | ||
|
|
eee0169c90 | ||
|
|
124ec1357d | ||
|
|
3e2f12848c | ||
|
|
22e607210d | ||
|
|
5780ce2693 | ||
|
|
04c0e2f42c | ||
|
|
3b6ffd8f49 | ||
|
|
61d8e73084 | ||
|
|
fffdd9a78e | ||
|
|
9186869001 | ||
|
|
c3f8ae1d53 | ||
|
|
294e8a23f5 | ||
|
|
637a2423a0 | ||
|
|
6ad0a9ac92 | ||
|
|
161e5d97a7 | ||
|
|
e6a9513d45 | ||
|
|
74174c14c6 | ||
|
|
2ec51860a5 | ||
|
|
bc3e338910 | ||
|
|
a823899d39 | ||
|
|
436af2427e | ||
|
|
d7252412ed | ||
|
|
af38e2a0b6 | ||
|
|
c3d3fcf665 | ||
|
|
987c6667ac | ||
|
|
f0401b97d1 | ||
|
|
26992f7cf9 | ||
|
|
169ab1c4cc | ||
|
|
f04049abc0 | ||
|
|
7e6f2dee19 | ||
|
|
2dd7ce6fac | ||
|
|
be373dd141 | ||
|
|
43876863e6 | ||
|
|
4ac2a830a9 | ||
|
|
3d6d3e77e3 | ||
|
|
71b4ccc531 | ||
|
|
48289a3c72 | ||
|
|
9a219873f1 | ||
|
|
d013d08bdc | ||
|
|
761dcc7902 |
@@ -29,7 +29,7 @@
|
||||
<import plugin="org.eclipse.jdt.launching" version="0.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.eclipse.jdt.ui" version="0.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.hamcrest.core" version="0.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.junit" version="0.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.junit" version="4.13.2" match="greaterOrEqual"/>
|
||||
</requires>
|
||||
<plugin id="org.eclipse.jdt.launching.macosx" os="macosx" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
|
||||
<plugin id="org.eclipse.jdt.launching.ui.macosx" os="macosx" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
<license url="http://www.example.com/license">[Enter License Description here.]</license>
|
||||
<plugin id="org.talend.libraries.jdbc.access" download-size="0" install-size="0" version="0.0.0"/>
|
||||
<plugin id="org.talend.libraries.jdbc.as400" download-size="0" install-size="0" version="0.0.0"/>
|
||||
<plugin id="org.talend.libraries.jdbc.derby" download-size="0" install-size="0" version="0.0.0"/>
|
||||
<plugin id="org.talend.libraries.jdbc.exasol" download-size="0" install-size="0" version="0.0.0"/>
|
||||
<plugin id="org.talend.libraries.jdbc.h2" download-size="0" install-size="0" version="0.0.0"/>
|
||||
<plugin id="org.talend.libraries.jdbc.hsql" download-size="0" install-size="0" version="0.0.0"/>
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
<import plugin="com.thoughtworks.paranamer" version="0.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="jackson-core-asl" version="0.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="jackson-mapper-asl" version="0.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.apache.commons.codec" version="0.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.apache.commons.codec" version="1.14.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.apache.commons.compress" version="1.10.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.apache.commons.lang" version="0.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.apache.commons.lang3" version="0.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.apache.log4j" version="0.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.apache.servicemix.bundles.avro" version="0.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.junit" version="0.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.junit" version="4.13.2" match="greaterOrEqual"/>
|
||||
<import plugin="org.slf4j.api" version="0.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.apache.commons.configuration" version="2.0.0" match="greaterOrEqual"/>
|
||||
</requires>
|
||||
|
||||
BIN
main/plugins/org.talend.common.ui.runtime/icons1/routinesjar.png
Normal file
BIN
main/plugins/org.talend.common.ui.runtime/icons1/routinesjar.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 768 B |
BIN
main/plugins/org.talend.common.ui.runtime/icons1/share.png
Normal file
BIN
main/plugins/org.talend.common.ui.runtime/icons1/share.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
@@ -77,6 +77,7 @@ public enum ECoreImage implements IImage {
|
||||
ROUTES_ICON("/icons1/routes_icon.png"), //$NON-NLS-1$
|
||||
ROUTINE_ICON("/icons1/routine.png"), //$NON-NLS-1$
|
||||
ROUTINE_EDITOR_ICON("/icons1/routine_editor.png"), //$NON-NLS-1$
|
||||
ROUTINESJAR_ICON("/icons1/routinesjar.png"), //$NON-NLS-1$
|
||||
JOB_SCRIPTS_ICON("/icons1/job_scripts.png"), //$NON-NLS-1$
|
||||
JOB_SCRIPTS_TOOLBAR_ICON("/icons1/job_script_toolbar.png"), //$NON-NLS-1$
|
||||
FTP_ICON("/icons1/ftp.png"), //$NON-NLS-1$
|
||||
@@ -166,6 +167,7 @@ public enum ECoreImage implements IImage {
|
||||
RECYCLE_BIN_OVERLAY("/icons1/recycle_bin_overlay.gif"), //$NON-NLS-1$
|
||||
DELETED_OVERLAY("/icons1/deleted_overlay.gif"), //$NON-NLS-1$
|
||||
IMPORT_JAR("/icons1/importjar.gif"), //$NON-NLS-1$
|
||||
SHARE_LIBS("/icons1/share.png"), //$NON-NLS-1$
|
||||
REFERENCED_ICON("/icons1/referenced.png"), //$NON-NLS-1$
|
||||
|
||||
CDC_ADDED_OVERLAY("/icons1/cdc_added_overlay.png"), //$NON-NLS-1$
|
||||
|
||||
@@ -16,6 +16,8 @@ import org.eclipse.core.internal.runtime.InternalPlatform;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* DOC root class global comment. Detailled comment <br/>
|
||||
@@ -52,5 +54,9 @@ public class WindowSystem {
|
||||
public static boolean isOSX() {
|
||||
return Platform.WS_CARBON.equals(ws) || Platform.WS_COCOA.equals(ws);
|
||||
}
|
||||
|
||||
public static boolean isBigSurOrLater () {
|
||||
return isOSX() && ("10.16".compareTo(System.getProperty("os.version","0")) <= 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<version>2.11.0</version>
|
||||
<version>2.12.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
|
||||
@@ -148,7 +148,7 @@ public class SAPHanaDataBaseMetadata extends FakeDatabaseMetaData {
|
||||
}
|
||||
|
||||
// For Calculation View
|
||||
if (ArrayUtils.contains(neededTypes, NEEDED_TYPES[3])) {
|
||||
if (ArrayUtils.contains(neededTypes, NEEDED_TYPES[3]) && "_SYS_BIC".equalsIgnoreCase(schemaPattern)) { //$NON-NLS-1$
|
||||
// check if the type is contained is in the types needed.
|
||||
String sqlcv = "SELECT OBJECT_NAME,PACKAGE_ID FROM _SYS_REPO.ACTIVE_OBJECT WHERE OBJECT_SUFFIX = 'calculationview'"; //$NON-NLS-1$
|
||||
if (tableNamePattern != null && !tableNamePattern.equals("%")) { //$NON-NLS-1$
|
||||
@@ -171,7 +171,7 @@ public class SAPHanaDataBaseMetadata extends FakeDatabaseMetaData {
|
||||
packageId = packageId.trim();
|
||||
}
|
||||
String name = packageId + "/" + objectName; //$NON-NLS-1$
|
||||
String[] r = new String[] { "", "_SYS_BIC", name, NEEDED_TYPES[3], "", packageId }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
String[] r = new String[] { "", schemaPattern, name, NEEDED_TYPES[3], "", packageId }; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
listcv.add(r);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
@@ -355,4 +355,16 @@ public class SAPHanaDataBaseMetadata extends FakeDatabaseMetaData {
|
||||
tableResultSet.setData(list);
|
||||
return tableResultSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDatabaseProductName() throws SQLException {
|
||||
return this.connection.getMetaData().getDatabaseProductName();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDatabaseProductVersion() throws SQLException {
|
||||
return this.connection.getMetaData().getDatabaseProductVersion();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,13 +13,13 @@
|
||||
package org.talend.commons.utils.time;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.Properties;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -82,7 +82,7 @@ public class PerformanceStatisticUtil {
|
||||
public static void recordStartupEpapsedTime(double elapsedTimeInSeconds) {
|
||||
File file = getRecordingFile();
|
||||
|
||||
Properties props = read(file, true);
|
||||
Properties props = PropertiesFileUtil.read(file, true);
|
||||
String propCount = props.getProperty(StatisticKeys.STARTUP_COUNT.get(), "0");
|
||||
String propMax = props.getProperty(StatisticKeys.STARTUP_MAX.get(), "0");
|
||||
String propAverage = props.getProperty(StatisticKeys.STARTUP_AVERAGE.get(), "0");
|
||||
@@ -99,7 +99,7 @@ public class PerformanceStatisticUtil {
|
||||
props.setProperty(StatisticKeys.STARTUP_MAX.get(), "" + iPropMax);
|
||||
props.setProperty(StatisticKeys.STARTUP_AVERAGE.get(), "" + iPropAverage);
|
||||
|
||||
store(file, props);
|
||||
PropertiesFileUtil.store(file, props);
|
||||
}
|
||||
|
||||
public static File getRecordingFile() {
|
||||
@@ -108,75 +108,41 @@ public class PerformanceStatisticUtil {
|
||||
}
|
||||
|
||||
String configurationLocation = Platform.getConfigurationLocation().getURL().getPath();
|
||||
File file = new File(configurationLocation + "/" + recordingFileName);
|
||||
File file = new File(configurationLocation + "/data_collector/" + recordingFileName);
|
||||
File oldFile = new File(configurationLocation + "/" + recordingFileName);
|
||||
if(oldFile.exists()) {
|
||||
if(!file.exists()) {
|
||||
if(!file.getParentFile().exists()) {
|
||||
file.getParentFile().mkdirs();
|
||||
}
|
||||
try {
|
||||
Files.move(Paths.get(oldFile.toURI()), Paths.get(file.toURI()), StandardCopyOption.ATOMIC_MOVE);
|
||||
} catch (IOException e) {
|
||||
CommonExceptionHandler.log(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
Files.deleteIfExists(Paths.get(oldFile.toURI()));
|
||||
} catch (IOException e) {
|
||||
CommonExceptionHandler.log(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
public static void setRecordingFile(File _recordingFile) {
|
||||
recordingFile = _recordingFile;
|
||||
}
|
||||
|
||||
public static synchronized Properties read(File recordFile, boolean createIfNotExist) {
|
||||
Properties props = new Properties();
|
||||
if (recordFile != null && exist(recordFile, createIfNotExist)) {
|
||||
FileInputStream inStream = null;
|
||||
try {
|
||||
inStream = new FileInputStream(recordFile);
|
||||
props.load(inStream);
|
||||
} catch (Exception e) {
|
||||
CommonExceptionHandler.log(e.getMessage());
|
||||
} finally {
|
||||
if (inStream != null) {
|
||||
try {
|
||||
inStream.close();
|
||||
} catch (IOException e) {//
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void reset() {
|
||||
File _recordingFile = getRecordingFile();
|
||||
try {
|
||||
Files.deleteIfExists(Paths.get(_recordingFile.toURI()));
|
||||
} catch (IOException e) {
|
||||
CommonExceptionHandler.log(e.getMessage());
|
||||
}
|
||||
|
||||
return props;
|
||||
}
|
||||
|
||||
public static synchronized void store(File recordFile, Properties props) {
|
||||
if (props == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (recordFile != null && exist(recordFile, true)) {
|
||||
FileOutputStream outputStream = null;
|
||||
try {
|
||||
outputStream = new FileOutputStream(recordFile);
|
||||
props.store(outputStream, "");
|
||||
} catch (IOException e) {
|
||||
CommonExceptionHandler.log(e.getMessage());
|
||||
} finally {
|
||||
if (outputStream != null) {
|
||||
try {
|
||||
outputStream.close();
|
||||
} catch (IOException e) {
|
||||
//
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean exist(File recordFile, boolean createIfNotExist) {
|
||||
boolean exists = recordFile.exists();
|
||||
if (!exists && createIfNotExist) {
|
||||
try {
|
||||
exists = recordFile.createNewFile();
|
||||
if (!exists) {
|
||||
throw new FileNotFoundException(recordFile.getName());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
CommonExceptionHandler.log(e.getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return exists;
|
||||
}
|
||||
|
||||
private static Lock lock = new ReentrantLock();
|
||||
@@ -210,7 +176,7 @@ public class PerformanceStatisticUtil {
|
||||
|
||||
private static void _measureIO() {
|
||||
File file = getRecordingFile();
|
||||
Properties props = read(file, true);
|
||||
Properties props = PropertiesFileUtil.read(file, true);
|
||||
|
||||
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
||||
File workspace = root.getLocation().makeAbsolute().toFile();
|
||||
@@ -221,7 +187,7 @@ public class PerformanceStatisticUtil {
|
||||
measureWrite(props, testFile);
|
||||
measureRead(props, testFile);
|
||||
|
||||
store(file, props);
|
||||
PropertiesFileUtil.store(file, props);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.commons.utils.time;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
|
||||
public class PropertiesCollectorUtil {
|
||||
|
||||
private static final String ROOT_NODE = "additional_packages_records"; // additional packages
|
||||
|
||||
private static final String PREF_ADDITIONAL_PACKAGES = "AdditionalPackages"; // preference node
|
||||
|
||||
private static final String ADDITONAL_PACKAGE_FILE = "additionalPackages";
|
||||
|
||||
|
||||
public static String getAdditionalPackageRecording() {
|
||||
File file = getRecordFile(ADDITONAL_PACKAGE_FILE);
|
||||
|
||||
Properties props = PropertiesFileUtil.read(file, true);
|
||||
String records = props.getProperty(ROOT_NODE, "");
|
||||
|
||||
return records;
|
||||
}
|
||||
|
||||
public static void storeAdditionalPackageRecording(String records) {
|
||||
File file = getRecordFile(ADDITONAL_PACKAGE_FILE);
|
||||
Properties props = PropertiesFileUtil.read(file, false);
|
||||
props.setProperty(ROOT_NODE, records);
|
||||
PropertiesFileUtil.store(file, props);
|
||||
}
|
||||
|
||||
private static File getRecordFile(String fileName) {
|
||||
String configurationLocation = Platform.getConfigurationLocation().getURL().getPath();
|
||||
File file = new File(configurationLocation + "/data_collector/" + fileName);
|
||||
return file;
|
||||
}
|
||||
|
||||
public static String getAdditionalPackagePreferenceNode() {
|
||||
return PREF_ADDITIONAL_PACKAGES;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.commons.utils.time;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.talend.commons.exception.CommonExceptionHandler;
|
||||
|
||||
/**
|
||||
* DOC sbliu class global comment. Detailled comment
|
||||
*/
|
||||
public class PropertiesFileUtil {
|
||||
public static synchronized Properties read(File recordFile, boolean createIfNotExist) {
|
||||
Properties props = new Properties();
|
||||
if (recordFile != null && exist(recordFile, createIfNotExist)) {
|
||||
FileInputStream inStream = null;
|
||||
try {
|
||||
inStream = new FileInputStream(recordFile);
|
||||
props.load(inStream);
|
||||
} catch (Exception e) {
|
||||
CommonExceptionHandler.log(e.getMessage());
|
||||
} finally {
|
||||
if (inStream != null) {
|
||||
try {
|
||||
inStream.close();
|
||||
} catch (IOException e) {//
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return props;
|
||||
}
|
||||
|
||||
public static synchronized void store(File recordFile, Properties props) {
|
||||
if (props == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (recordFile != null && exist(recordFile, true)) {
|
||||
FileOutputStream outputStream = null;
|
||||
try {
|
||||
outputStream = new FileOutputStream(recordFile);
|
||||
props.store(outputStream, "");
|
||||
} catch (IOException e) {
|
||||
CommonExceptionHandler.log(e.getMessage());
|
||||
} finally {
|
||||
if (outputStream != null) {
|
||||
try {
|
||||
outputStream.close();
|
||||
} catch (IOException e) {
|
||||
//
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean exist(File recordFile, boolean createIfNotExist) {
|
||||
boolean exists = recordFile.exists();
|
||||
if (!exists && createIfNotExist) {
|
||||
try {
|
||||
if(!recordFile.getParentFile().exists()) {
|
||||
recordFile.getParentFile().mkdirs();
|
||||
}
|
||||
exists = recordFile.createNewFile();
|
||||
if (!exists) {
|
||||
throw new FileNotFoundException(recordFile.getName());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
CommonExceptionHandler.log(e.getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return exists;
|
||||
}
|
||||
}
|
||||
@@ -240,7 +240,11 @@ public class BackgroundRefresher implements IBackgroundRefresher {
|
||||
|
||||
gc.dispose();
|
||||
|
||||
drawableComposite.getBgDrawableComposite().setBackgroundImage(newImage);
|
||||
if (WindowSystem.isBigSurOrLater()) {
|
||||
drawableComposite.refreshBgDrawableCompsite(newImage);
|
||||
} else {
|
||||
drawableComposite.getBgDrawableComposite().setBackgroundImage(newImage);
|
||||
}
|
||||
|
||||
clearImage(oldImage);
|
||||
oldImage = newImage;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
package org.talend.commons.ui.swt.drawing.background;
|
||||
|
||||
import org.eclipse.swt.graphics.GC;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
|
||||
@@ -28,6 +29,8 @@ public interface IBgDrawableComposite {
|
||||
|
||||
public Composite getBgDrawableComposite();
|
||||
|
||||
public void refreshBgDrawableCompsite(Image image);
|
||||
|
||||
public void setOffset(Point offsetPoint);
|
||||
|
||||
public Point getOffset();
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
import org.talend.commons.ui.runtime.ws.WindowSystem;
|
||||
|
||||
/**
|
||||
* Create a Label and a Text.
|
||||
@@ -153,7 +154,14 @@ public class LabelledText {
|
||||
});
|
||||
GridDataFactory.swtDefaults().applyTo(label);
|
||||
|
||||
text = new Text(composite, styleField);
|
||||
// For Big Sur, to avoid the password autofill dialog.
|
||||
if (WindowSystem.isBigSurOrLater() && ((styleField & SWT.PASSWORD) != 0)) {
|
||||
styleField ^= SWT.PASSWORD;
|
||||
text = new Text(composite, styleField);
|
||||
text.setEchoChar('*');
|
||||
} else {
|
||||
text = new Text(composite, styleField);
|
||||
}
|
||||
text.selectAll(); // enable fast erase use
|
||||
int gridDataStyle = SWT.NONE;
|
||||
if (isFill) {
|
||||
|
||||
@@ -12,7 +12,12 @@
|
||||
// ============================================================================
|
||||
package org.talend.commons.ui.swt.linking;
|
||||
|
||||
import org.eclipse.swt.events.DisposeEvent;
|
||||
import org.eclipse.swt.events.DisposeListener;
|
||||
import org.eclipse.swt.events.PaintEvent;
|
||||
import org.eclipse.swt.events.PaintListener;
|
||||
import org.eclipse.swt.graphics.GC;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.talend.commons.ui.swt.drawing.background.IBgDrawableComposite;
|
||||
@@ -28,6 +33,8 @@ public abstract class BgDrawableComposite implements IBgDrawableComposite {
|
||||
private Composite commonParent;
|
||||
|
||||
private Point offsetPoint = new Point(0, 0);
|
||||
|
||||
private Image backgroundImage;
|
||||
|
||||
/**
|
||||
* DOC amaumont DrawableBackground constructor comment.
|
||||
@@ -36,9 +43,36 @@ public abstract class BgDrawableComposite implements IBgDrawableComposite {
|
||||
*/
|
||||
public BgDrawableComposite(Composite commonParent) {
|
||||
this.commonParent = commonParent;
|
||||
this.commonParent.addPaintListener(new PaintListener() {
|
||||
|
||||
@Override
|
||||
public void paintControl(PaintEvent arg0) {
|
||||
if (backgroundImage != null) {
|
||||
arg0.gc.drawImage(backgroundImage, 0, 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
this.commonParent.addDisposeListener(new DisposeListener() {
|
||||
|
||||
@Override
|
||||
public void widgetDisposed(DisposeEvent arg0) {
|
||||
if (backgroundImage != null && !backgroundImage.isDisposed()) {
|
||||
backgroundImage.dispose();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public void refreshBgDrawableCompsite(Image image) {
|
||||
if (backgroundImage != null) {
|
||||
backgroundImage.dispose();
|
||||
}
|
||||
backgroundImage = image;
|
||||
this.commonParent.redraw();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.commons.ui.swt.drawing.background.IDrawableComposite#drawBackground(org.eclipse.swt.graphics.GC)
|
||||
|
||||
@@ -15,6 +15,7 @@ package org.talend.commons.ui.swt.linking;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@@ -77,6 +78,8 @@ public class TreeToTablesLinker<D1, D2> extends BgDrawableComposite implements I
|
||||
|
||||
private List<LinkableTable> linkableTableList;
|
||||
|
||||
private HashMap<Table, Point> tableToCommonPointMap = new HashMap<Table, Point>();
|
||||
|
||||
/**
|
||||
* DOC amaumont TreeToTableLinker constructor comment.
|
||||
*
|
||||
@@ -258,8 +261,34 @@ public class TreeToTablesLinker<D1, D2> extends BgDrawableComposite implements I
|
||||
|
||||
Point offset = getOffset();
|
||||
|
||||
gc.drawLine(pointStartStraight.x + offset.x, pointStartStraight.y + offset.y, pointEndStraight.x + offset.x,
|
||||
pointEndStraight.y + offset.y);
|
||||
if (WindowSystem.isBigSurOrLater()) {
|
||||
if (yStraight < tree.getBounds().y + treeItemHeight) {
|
||||
yStraight = tree.getBounds().y + treeItemHeight;
|
||||
}
|
||||
if (yStraight > tree.getBounds().height + tree.getBounds().y + treeItemHeight) {
|
||||
yStraight = tree.getBounds().height + tree.getBounds().y + treeItemHeight;
|
||||
}
|
||||
pointEndStraight = new Point(treeToCommonPoint.x + tree.getClientArea().width, yStraight);
|
||||
if (tableToCommonPointMap.get(table) == null) {
|
||||
tableToCommonPointMap.put(table, display.map(table, getBgDrawableComposite(), new Point(0, 0)));
|
||||
}
|
||||
// scroll issue for table
|
||||
if (tableToCommonPoint.y != tableToCommonPointMap.get(table).y) {
|
||||
pointEndCentralCurve.y = tableToCommonPoint.y + tableItemBounds.y
|
||||
+ table.getItemHeight() / 2;
|
||||
}
|
||||
if (pointEndCentralCurve.y < tableToCommonPointMap.get(table).y) {
|
||||
pointEndCentralCurve.y = tableToCommonPointMap.get(table).y;
|
||||
}
|
||||
if (pointEndCentralCurve.y > tableToCommonPointMap.get(table).y + tableBounds.height - table.getBorderWidth()
|
||||
- table.getHeaderHeight()) {
|
||||
pointEndCentralCurve.y = tableToCommonPointMap.get(table).y + tableBounds.height - table.getBorderWidth()
|
||||
- table.getHeaderHeight();
|
||||
}
|
||||
} else {
|
||||
gc.drawLine(pointStartStraight.x + offset.x, pointStartStraight.y + offset.y, pointEndStraight.x + offset.x,
|
||||
pointEndStraight.y + offset.y);
|
||||
}
|
||||
|
||||
pointEndStraight.x += offset.x;
|
||||
pointEndStraight.y += offset.y;
|
||||
|
||||
@@ -109,4 +109,8 @@ public interface FileConstants {
|
||||
|
||||
String SPRING_FOLDER_NAME = "META-INF/spring"; //$NON-NLS-1$
|
||||
|
||||
String TALEND_FOLDER_NAME = "TALEND-INF"; //$NON-NLS-1$
|
||||
|
||||
String MAVEN_FOLDER_NAME = "MAVEN-INF";
|
||||
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.relationship.AbstractJobItemRelationshipHandler;
|
||||
import org.talend.core.model.relationship.Relation;
|
||||
import org.talend.core.model.relationship.RelationshipItemBuilder;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ProcessType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.RoutinesParameterType;
|
||||
|
||||
@@ -47,14 +48,24 @@ public class JobRoutinesItemRelationshipHandler extends AbstractJobItemRelations
|
||||
Map<String, String> currentSystemRoutinesMap = RelationshipItemBuilder.getInstance().getCurrentSystemRoutinesMap();
|
||||
for (Object o : processType.getParameters().getRoutinesParameter()) {
|
||||
RoutinesParameterType itemInfor = (RoutinesParameterType) o;
|
||||
if (currentSystemRoutinesMap.containsValue(itemInfor.getName())) {
|
||||
if (itemInfor.getName() != null && currentSystemRoutinesMap.containsValue(itemInfor.getName())) {
|
||||
// exclude system routines relation
|
||||
continue;
|
||||
}
|
||||
|
||||
Relation addedRelation = new Relation();
|
||||
addedRelation.setId(itemInfor.getName());
|
||||
addedRelation.setType(RelationshipItemBuilder.ROUTINE_RELATION);
|
||||
if (ERepositoryObjectType.ROUTINESJAR != null
|
||||
&& ERepositoryObjectType.ROUTINESJAR.getType().equals(itemInfor.getType())) {
|
||||
addedRelation.setId(itemInfor.getId());
|
||||
addedRelation.setType(RelationshipItemBuilder.ROUTINES_JAR_RELATION);
|
||||
} else if (ERepositoryObjectType.BEANSJAR != null
|
||||
&& ERepositoryObjectType.BEANSJAR.getType().equals(itemInfor.getType())) {
|
||||
addedRelation.setId(itemInfor.getId());
|
||||
addedRelation.setType(RelationshipItemBuilder.BEANS_JAR_RELATION);
|
||||
} else {
|
||||
addedRelation.setId(itemInfor.getName());
|
||||
addedRelation.setType(RelationshipItemBuilder.ROUTINE_RELATION);
|
||||
}
|
||||
addedRelation.setVersion(RelationshipItemBuilder.LATEST_VERSION);
|
||||
relationSet.add(addedRelation);
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ package org.talend.core.repository.model;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
@@ -186,7 +187,7 @@ public interface IRepositoryFactory {
|
||||
* @throws PersistenceException
|
||||
*/
|
||||
public List<IRepositoryViewObject> getAll(Project project, ERepositoryObjectType type, boolean withDeleted,
|
||||
boolean allVersions) throws PersistenceException;
|
||||
boolean allVersions, IFolder... folders) throws PersistenceException;
|
||||
|
||||
/**
|
||||
* Deletes logically the given object. <code>isDeleted</code> on this object will now returned <code>true</code>.
|
||||
|
||||
@@ -20,6 +20,7 @@ import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
@@ -675,6 +676,9 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
}
|
||||
}
|
||||
|
||||
List<IRepositoryViewObject> codeObjectList = new ArrayList<IRepositoryViewObject>();
|
||||
Map<String, List<RepositoryNode>> labelCodeJarMap = new HashMap<String, List<RepositoryNode>>();
|
||||
|
||||
for (IRepositoryViewObject currentObject : elements) {
|
||||
RepositoryNode parent = getFolder(currentObject.getRepositoryObjectType(), currentObject.getPath(), rootNodes);
|
||||
RepositoryNode parentNode = parent;
|
||||
@@ -682,20 +686,69 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
parentNode = rootNode;
|
||||
}
|
||||
if (currentObject.isDeleted()) {
|
||||
boolean isCodeJarType = false;
|
||||
ERepositoryObjectType repositoryObjectType = currentObject.getRepositoryObjectType();
|
||||
if (ERepositoryObjectType.getAllTypesOfCodes().contains(repositoryObjectType)) {
|
||||
codeObjectList.add(currentObject);
|
||||
continue;
|
||||
} else if (ERepositoryObjectType.getAllTypesOfCodesJar().contains(repositoryObjectType)) {
|
||||
isCodeJarType = true;
|
||||
}
|
||||
|
||||
RepositoryNode repNode = new RepositoryNode(new RepositoryViewObject(currentObject.getProperty()), parentNode,
|
||||
ENodeType.REPOSITORY_ELEMENT);
|
||||
repNode.setProperties(EProperties.CONTENT_TYPE, currentObject.getRepositoryObjectType());
|
||||
repNode.setProperties(EProperties.LABEL, currentObject.getLabel());
|
||||
parentNode.getChildren().add(repNode);
|
||||
repNode.setParent(parentNode);
|
||||
|
||||
if (isCodeJarType) {
|
||||
String label = currentObject.getProperty().getLabel();
|
||||
if (labelCodeJarMap.get(label) == null) {
|
||||
labelCodeJarMap.put(label, new ArrayList<RepositoryNode>());
|
||||
}
|
||||
labelCodeJarMap.get(label).add(repNode);
|
||||
}
|
||||
} else {
|
||||
addDeletedSubItems(currentObject.getProperty().getItem(), parentNode);
|
||||
}
|
||||
}
|
||||
addDeletedCode(rootNode, codeObjectList, labelCodeJarMap);
|
||||
objects.removeAll(elements);
|
||||
addDeletedTestCases(rootNode, objects);
|
||||
}
|
||||
|
||||
private void addDeletedCode(RepositoryNode rootNode, List<IRepositoryViewObject> codeObjectList, Map<String, List<RepositoryNode>> labelCodeJarMap) {
|
||||
List<IRepositoryNode> rootNodes = rootNode.getChildren();
|
||||
for (IRepositoryViewObject codeObject : codeObjectList) {
|
||||
ERepositoryObjectType objectType = codeObject.getRepositoryObjectType();
|
||||
RepositoryNode parent = getFolder(codeObject.getRepositoryObjectType(), codeObject.getPath(), rootNodes);
|
||||
RepositoryNode parentNode = parent;
|
||||
if (parentNode == null) {
|
||||
parentNode = rootNode;
|
||||
}
|
||||
|
||||
Item parentItem = (Item) codeObject.getProperty().getItem().getParent();
|
||||
String folderItemLabel = parentItem.getProperty().getLabel();
|
||||
if (labelCodeJarMap.get(folderItemLabel) != null) {
|
||||
Optional node = labelCodeJarMap.get(folderItemLabel).stream()
|
||||
.filter(n -> ERepositoryObjectType.CodeTypeEnum.isCodeRepositoryObjectTypeMatch(n.getObjectType(),
|
||||
objectType))
|
||||
.findFirst();
|
||||
if (node.isPresent()) {
|
||||
parentNode = (RepositoryNode) node.get();
|
||||
}
|
||||
}
|
||||
|
||||
RepositoryNode repNode = new RepositoryNode(new RepositoryViewObject(codeObject.getProperty()), parentNode,
|
||||
ENodeType.REPOSITORY_ELEMENT);
|
||||
repNode.setProperties(EProperties.CONTENT_TYPE, objectType);
|
||||
repNode.setProperties(EProperties.LABEL, codeObject.getLabel());
|
||||
parentNode.getChildren().add(repNode);
|
||||
repNode.setParent(parentNode);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC nrousseau Comment method "addDeletedElements".
|
||||
*
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.Hashtable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.log4j.Level;
|
||||
import org.apache.log4j.Logger;
|
||||
@@ -106,6 +107,7 @@ import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.model.properties.ProjectReference;
|
||||
import org.talend.core.model.properties.PropertiesPackage;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.properties.RoutineItem;
|
||||
import org.talend.core.model.properties.SpagoBiServer;
|
||||
import org.talend.core.model.properties.Status;
|
||||
import org.talend.core.model.properties.User;
|
||||
@@ -121,6 +123,7 @@ import org.talend.core.model.repository.LockInfo;
|
||||
import org.talend.core.model.repository.RepositoryContentManager;
|
||||
import org.talend.core.model.repository.RepositoryObject;
|
||||
import org.talend.core.model.repository.RepositoryViewObject;
|
||||
import org.talend.core.model.routines.CodesJarInfo;
|
||||
import org.talend.core.repository.CoreRepositoryPlugin;
|
||||
import org.talend.core.repository.constants.Constant;
|
||||
import org.talend.core.repository.constants.FileConstants;
|
||||
@@ -135,8 +138,10 @@ import org.talend.core.runtime.repository.item.ItemProductKeys;
|
||||
import org.talend.core.runtime.services.IGenericWizardService;
|
||||
import org.talend.core.runtime.services.IMavenUIService;
|
||||
import org.talend.core.runtime.util.ItemDateParser;
|
||||
import org.talend.core.runtime.util.SharedStudioUtils;
|
||||
import org.talend.core.service.ICoreUIService;
|
||||
import org.talend.core.service.IUpdateService;
|
||||
import org.talend.core.utils.CodesJarResourceCache;
|
||||
import org.talend.cwm.helper.SubItemHelper;
|
||||
import org.talend.cwm.helper.TableHelper;
|
||||
import org.talend.designer.runprocess.IRunProcessService;
|
||||
@@ -1347,6 +1352,35 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
return this.repositoryFactoryFromProvider.getAll(projectManager.getCurrentProject(), type, withDeleted, allVersions);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IRepositoryViewObject> getAll(Project project, ERepositoryObjectType type, boolean withDeleted,
|
||||
boolean allVersions, IFolder... folders) throws PersistenceException {
|
||||
return this.repositoryFactoryFromProvider.getAll(project, type, withDeleted, allVersions, folders);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IRepositoryViewObject> getAllCodesJars(ERepositoryObjectType type) throws PersistenceException {
|
||||
return getAllCodesJars(projectManager.getCurrentProject(), type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IRepositoryViewObject> getAllCodesJars(Project project, ERepositoryObjectType type) throws PersistenceException {
|
||||
return getAll(project, type).stream().filter(obj -> !(obj.getProperty().getItem() instanceof RoutineItem))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IRepositoryViewObject> getAllInnerCodes(CodesJarInfo info) throws PersistenceException {
|
||||
Project project = ProjectManager.getInstance().getProjectFromProjectTechLabel(info.getProjectTechName());
|
||||
// empty folder won't be commit in git, create if not exist
|
||||
IFolder folder = ResourceUtils.getProject(project).getFolder(ERepositoryObjectType.getFolderName(info.getType()))
|
||||
.getFolder(info.getLabel());
|
||||
if (!folder.exists()) {
|
||||
ResourceUtils.createFolder(folder);
|
||||
}
|
||||
return repositoryFactoryFromProvider.getAll(project, info.getType(), false, false, folder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getFolders(ERepositoryObjectType type) throws PersistenceException {
|
||||
return getFolders(projectManager.getCurrentProject(), type);
|
||||
@@ -1799,9 +1833,12 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
* @throws PersistenceException
|
||||
*/
|
||||
private void emptyTempFolder(Project project) throws PersistenceException {
|
||||
String str = (System.getProperty("eclipse.home.location") + "temp").substring(5);
|
||||
FilesUtils.deleteFolder(new File(str), false);
|
||||
|
||||
try {
|
||||
String str = SharedStudioUtils.getTempFolderPath().toPortableString();
|
||||
FilesUtils.deleteFolder(new File(str), false);
|
||||
}catch (Exception ex) {
|
||||
ExceptionHandler.process(ex);
|
||||
}
|
||||
long start = System.currentTimeMillis();
|
||||
IProject fsProject = ResourceUtils.getProject(project);
|
||||
IFolder folder = ResourceUtils.getFolder(fsProject, RepositoryConstants.TEMP_DIRECTORY, false);
|
||||
@@ -2201,6 +2238,16 @@ 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);
|
||||
currentMonitor.beginTask("Execute before logon migrations tasks", 1); //$NON-NLS-1$
|
||||
ProjectManager.getInstance().getMigrationRecords().clear();
|
||||
@@ -2302,8 +2349,6 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
// set the project mappings url
|
||||
System.setProperty("talend.mappings.url", url.toString()); // $NON-NLS-1$
|
||||
}
|
||||
// for new added mapping file, sync to project mapping folder
|
||||
MetadataTalendType.syncNewMappingFileToProject();
|
||||
} catch (SystemException e) {
|
||||
// ignore
|
||||
ExceptionHandler.process(e);
|
||||
|
||||
@@ -36,7 +36,6 @@ import org.eclipse.swt.widgets.Display;
|
||||
import org.talend.commons.exception.BusinessException;
|
||||
import org.talend.commons.exception.LoginException;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.commons.exception.SystemException;
|
||||
import org.talend.commons.runtime.model.repository.ERepositoryStatus;
|
||||
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
@@ -54,11 +53,16 @@ import org.talend.core.model.properties.SQLPatternItem;
|
||||
import org.talend.core.model.relationship.RelationshipItemBuilder;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.model.routines.CodesJarInfo;
|
||||
import org.talend.core.model.routines.RoutinesUtil;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
import org.talend.core.repository.ui.dialog.PastSelectorDialog;
|
||||
import org.talend.core.repository.utils.RoutineUtils;
|
||||
import org.talend.core.runtime.services.IDesignerMavenService;
|
||||
import org.talend.core.runtime.services.IGenericDBService;
|
||||
import org.talend.core.ui.ICDCProviderService;
|
||||
import org.talend.core.ui.ITestContainerProviderService;
|
||||
import org.talend.core.utils.CodesJarResourceCache;
|
||||
import org.talend.designer.codegen.ICodeGeneratorService;
|
||||
import org.talend.repository.RepositoryWorkUnit;
|
||||
import org.talend.repository.model.IProxyRepositoryFactory;
|
||||
@@ -125,6 +129,44 @@ public class CopyObjectAction {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// disable copy for codejar
|
||||
ERepositoryObjectType sourceObjectType = objectToCopy.getRepositoryObjectType();
|
||||
if (ERepositoryObjectType.getAllTypesOfCodesJar().contains(sourceObjectType)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// disable paste between global code and custom code
|
||||
if (ERepositoryObjectType.getAllTypesOfCodes().contains(sourceObjectType) && targetNode != null) {
|
||||
IRepositoryViewObject targetObject = targetNode.getObject();
|
||||
boolean isInnerCodeSourceNode = RoutinesUtil.isInnerCodes(objectToCopy.getProperty());
|
||||
if (targetObject != null) {
|
||||
if (sourceObjectType.equals(targetObject.getRepositoryObjectType())) {
|
||||
return isInnerCodeSourceNode && RoutinesUtil.isInnerCodes(targetObject.getProperty());
|
||||
}
|
||||
|
||||
if (isInnerCodeSourceNode
|
||||
&& !ERepositoryObjectType.getAllTypesOfCodesJar().contains(targetObject.getRepositoryObjectType())) {
|
||||
return false;
|
||||
}
|
||||
if (!isInnerCodeSourceNode
|
||||
&& ERepositoryObjectType.getAllTypesOfCodesJar().contains(targetObject.getRepositoryObjectType())) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// system folder node
|
||||
if (isInnerCodeSourceNode) {
|
||||
return false;
|
||||
} else {
|
||||
ERepositoryObjectType targetType = ((ERepositoryObjectType) targetNode
|
||||
.getProperties(EProperties.CONTENT_TYPE));
|
||||
if (ERepositoryObjectType.getAllTypesOfCodesJar().contains(targetType)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Cannot copy system routines:
|
||||
if (objectToCopy.getRepositoryObjectType() == ERepositoryObjectType.ROUTINES) {
|
||||
Property property = objectToCopy.getProperty();
|
||||
@@ -193,7 +235,8 @@ public class CopyObjectAction {
|
||||
}
|
||||
|
||||
// for bug 0005454: Copy paste with keyboard in the repository view doesn't work.
|
||||
if (targetNode.getType() == ENodeType.REPOSITORY_ELEMENT) {
|
||||
if (targetNode.getType() == ENodeType.REPOSITORY_ELEMENT
|
||||
&& !ERepositoryObjectType.getAllTypesOfCodesJar().contains(targetNode.getObjectType())) {
|
||||
targetNode = targetNode.getParent();
|
||||
}
|
||||
|
||||
@@ -471,9 +514,23 @@ public class CopyObjectAction {
|
||||
ICodeGeneratorService.class);
|
||||
if (codeGenService != null) {
|
||||
codeGenService.createRoutineSynchronizer().renameRoutineClass(item);
|
||||
boolean isInnerCode = RoutinesUtil.isInnerCodes(item.getProperty());
|
||||
if (isInnerCode) {
|
||||
RoutineUtils.changeInnerCodePackage(item, true);
|
||||
}
|
||||
try {
|
||||
codeGenService.createRoutineSynchronizer().syncRoutine(item, true);
|
||||
} catch (SystemException e) {
|
||||
|
||||
if (isInnerCode) {
|
||||
CodesJarInfo info = CodesJarResourceCache.getCodesJarByInnerCode(item);
|
||||
if (info != null) {
|
||||
IDesignerMavenService designerMavenService = IDesignerMavenService.get();
|
||||
if (designerMavenService != null) {
|
||||
designerMavenService.updateCodeJarMavenProject(info, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +111,8 @@ public class CreateFolderAction extends AContextualAction {
|
||||
|| property.equals(ERepositoryObjectType.JOB_DOC) || property.equals(ERepositoryObjectType.JOBLET_DOC)
|
||||
|| ERepositoryObjectType.SQLPATTERNS.equals(property)
|
||||
|| ERepositoryObjectType.REFERENCED_PROJECTS.equals(property)
|
||||
|| ERepositoryObjectType.SVN_ROOT.equals(property)) {
|
||||
|| ERepositoryObjectType.SVN_ROOT.equals(property) || ERepositoryObjectType.ROUTINESJAR.equals(property)
|
||||
|| property.equals(ERepositoryObjectType.BEANSJAR)) {
|
||||
canWork = false;
|
||||
} else if (property != null
|
||||
&& GlobalServiceRegister.getDefault().isServiceRegistered(ICamelDesignerCoreService.class)) {
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.collections.map.MultiKeyMap;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.resources.IWorkspace;
|
||||
import org.eclipse.core.resources.IWorkspaceRunnable;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
@@ -54,6 +55,7 @@ import org.talend.commons.ui.runtime.exception.MessageBoxExceptionHandler;
|
||||
import org.talend.commons.ui.runtime.image.EImage;
|
||||
import org.talend.commons.ui.runtime.image.ImageProvider;
|
||||
import org.talend.commons.utils.data.container.RootContainer;
|
||||
import org.talend.commons.utils.workbench.resources.ResourceUtils;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.IESBService;
|
||||
import org.talend.core.ITDQRepositoryService;
|
||||
@@ -714,6 +716,7 @@ public class DeleteAction extends AContextualAction {
|
||||
removeConnFromSQLExplorer(repositoryNode);
|
||||
List<IRepositoryViewObject> batchDeleteObjectList = new ArrayList<IRepositoryViewObject>();
|
||||
deleteTestCases(factory, deleteActionCache, repositoryNode, null, batchDeleteObjectList);
|
||||
deleteCodeSubItem(factory, deleteActionCache, repositoryNode, null, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1456,10 +1459,11 @@ public class DeleteAction extends AContextualAction {
|
||||
ITestContainerProviderService testService = (ITestContainerProviderService) GlobalServiceRegister.getDefault()
|
||||
.getService(ITestContainerProviderService.class);
|
||||
if(testService != null){
|
||||
|
||||
testService.deleteDataFiles(objToDelete);
|
||||
}
|
||||
testService.deleteDataFiles(objToDelete);
|
||||
}
|
||||
// delete codejar forever need to delete subitem also
|
||||
deleteCodeSubItem(factory, deleteActionCache, currentJobNode, confirm, false);
|
||||
|
||||
if (!ProjectManager.getInstance().getCurrentProject().isLocal()) {
|
||||
// if remote,batch delete later
|
||||
@@ -1482,14 +1486,47 @@ public class DeleteAction extends AContextualAction {
|
||||
factory.deleteObjectLogical(objToDelete);
|
||||
updateRelatedViews();
|
||||
removeConnFromSQLExplorer(currentJobNode);
|
||||
List<IRepositoryViewObject> deleteObjectList = new ArrayList<IRepositoryViewObject>();
|
||||
deleteTestCases(factory, deleteActionCache, currentJobNode, confirm, null);
|
||||
deleteCodeSubItem(factory, deleteActionCache, currentJobNode, confirm, true);
|
||||
}
|
||||
}
|
||||
|
||||
return needReturn;
|
||||
}
|
||||
|
||||
private void deleteCodeSubItem(IProxyRepositoryFactory factory, DeleteActionCache deleteActionCache,
|
||||
final IRepositoryNode currentJobNode, Boolean confirm, boolean logicalDelete)
|
||||
throws PersistenceException, BusinessException {
|
||||
if (!ERepositoryObjectType.getAllTypesOfCodesJar().contains(currentJobNode.getObjectType())) {
|
||||
return;
|
||||
}
|
||||
if (!currentJobNode.getChildren().isEmpty()) {
|
||||
List<IRepositoryViewObject> deleteObjectList = new ArrayList<IRepositoryViewObject>();
|
||||
for (IRepositoryNode child : currentJobNode.getChildren()) {
|
||||
deleteElements(factory, deleteActionCache, (RepositoryNode) child, confirm, deleteObjectList);
|
||||
}
|
||||
if (deleteObjectList != null && deleteObjectList.size() > 0) {
|
||||
factory.batchDeleteObjectPhysical4Remote(ProjectManager.getInstance().getCurrentProject(), deleteObjectList);
|
||||
}
|
||||
}
|
||||
|
||||
// delete forever to delete codeJar folder
|
||||
if (!logicalDelete) {
|
||||
IFolder folder = ResourceUtils
|
||||
.getFolder(ResourceUtils.getProject(ProjectManager.getInstance().getCurrentProject()),
|
||||
ERepositoryObjectType.getFolderName(currentJobNode.getObjectType()), true)
|
||||
.getFolder(currentJobNode.getObject().getProperty().getLabel());
|
||||
if (folder != null) {
|
||||
try {
|
||||
folder.delete(false, null);
|
||||
} catch (CoreException e) {
|
||||
throw new PersistenceException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void deleteTestCases(IProxyRepositoryFactory factory, DeleteActionCache deleteActionCache,
|
||||
final IRepositoryNode currentJobNode, Boolean confirm, List<IRepositoryViewObject> batchDeleteObjectList)
|
||||
throws PersistenceException, BusinessException {
|
||||
|
||||
@@ -74,6 +74,7 @@ import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.IRepositoryContentHandler;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.model.repository.RepositoryContentManager;
|
||||
import org.talend.core.model.routines.RoutinesUtil;
|
||||
import org.talend.core.repository.i18n.Messages;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
import org.talend.core.repository.ui.dialog.DuplicateDialog;
|
||||
@@ -145,8 +146,14 @@ public class DuplicateAction extends AContextualAction {
|
||||
canWork = false;
|
||||
} else if (((StructuredSelection) selection).toArray().length == 1) {
|
||||
Object obj = ((StructuredSelection) selection).toList().get(0);
|
||||
RepositoryNode sourceNode = (RepositoryNode) obj;
|
||||
// disable duplicate for codejar / innercode now
|
||||
if (ERepositoryObjectType.getAllTypesOfCodesJar().contains(sourceNode.getObjectType())
|
||||
|| sourceNode.getObject() != null && sourceNode.getObject().getProperty() != null
|
||||
&& RoutinesUtil.isInnerCodes(sourceNode.getObject().getProperty())) {
|
||||
canWork = false;
|
||||
}
|
||||
if (canWork) {
|
||||
RepositoryNode sourceNode = (RepositoryNode) obj;
|
||||
if (!CopyObjectAction.getInstance().validateAction(sourceNode, null)) {
|
||||
canWork = false;
|
||||
} else if (node.getProperties(EProperties.CONTENT_TYPE) == ERepositoryObjectType.JOB_DOC
|
||||
|
||||
@@ -16,6 +16,7 @@ import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.resources.IWorkspace;
|
||||
import org.eclipse.core.resources.IWorkspaceRunnable;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
@@ -45,6 +46,7 @@ import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.commons.ui.runtime.exception.MessageBoxExceptionHandler;
|
||||
import org.talend.commons.ui.runtime.image.ECoreImage;
|
||||
import org.talend.commons.ui.runtime.image.ImageProvider;
|
||||
import org.talend.commons.utils.workbench.resources.ResourceUtils;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.ITDQRepositoryService;
|
||||
import org.talend.core.model.properties.ConnectionItem;
|
||||
@@ -343,6 +345,7 @@ public class EmptyRecycleBinAction extends AContextualAction {
|
||||
testService.deleteDataFiles(objToDelete);
|
||||
}
|
||||
}
|
||||
deleteCodeSubItem(factory, currentNode);
|
||||
if (!ProjectManager.getInstance().getCurrentProject().isLocal()) {
|
||||
// if remote, batch delete later
|
||||
batchDeleteObjectList.add(objToDelete);
|
||||
@@ -355,6 +358,36 @@ public class EmptyRecycleBinAction extends AContextualAction {
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteCodeSubItem(IProxyRepositoryFactory factory, final IRepositoryNode currentNode)
|
||||
throws PersistenceException, BusinessException {
|
||||
if (!ERepositoryObjectType.getAllTypesOfCodesJar().contains(currentNode.getObjectType())) {
|
||||
return;
|
||||
}
|
||||
if (!currentNode.getChildren().isEmpty()) {
|
||||
List<IRepositoryViewObject> deleteObjectList = new ArrayList<IRepositoryViewObject>();
|
||||
for (IRepositoryNode child : currentNode.getChildren()) {
|
||||
deleteElements(factory, (RepositoryNode) child, deleteObjectList);
|
||||
}
|
||||
if (deleteObjectList != null && deleteObjectList.size() > 0) {
|
||||
factory.batchDeleteObjectPhysical4Remote(ProjectManager.getInstance().getCurrentProject(), deleteObjectList);
|
||||
}
|
||||
}
|
||||
|
||||
// delete forever to delete codeJar folder
|
||||
IFolder folder = ResourceUtils
|
||||
.getFolder(ResourceUtils.getProject(ProjectManager.getInstance().getCurrentProject()),
|
||||
ERepositoryObjectType.getFolderName(currentNode.getObjectType()), true)
|
||||
.getFolder(currentNode.getObject().getProperty().getLabel());
|
||||
if (folder != null) {
|
||||
try {
|
||||
folder.delete(false, null);
|
||||
} catch (CoreException e) {
|
||||
throw new PersistenceException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected boolean isRelation(IEditorInput editorInput, String repoNodeProjectLabel, String repoNodeId) {
|
||||
IRepoViewLinker[] allRepoViewLinkers = RepoViewLinkerRegistryReader.getInstance().getAllRepoViewLinkers();
|
||||
for (IRepoViewLinker linker : allRepoViewLinkers) {
|
||||
|
||||
@@ -193,7 +193,8 @@ public class RestoreAction extends AContextualAction {
|
||||
node = node.getParent();
|
||||
if ((node.getObject().getProperty().getItem() instanceof FolderItem)) {
|
||||
node.getObject().getProperty().getItem().getState().setDeleted(false);
|
||||
} else if (isTestcase) {
|
||||
} else if (isTestcase
|
||||
|| ERepositoryObjectType.getAllTypesOfCodesJar().contains(node.getObjectType())) {
|
||||
restoreNode(node);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -389,6 +389,14 @@ public class RepositoryLabelProvider extends LabelProvider implements IColorProv
|
||||
case STABLE_SYSTEM_FOLDER:
|
||||
case SYSTEM_FOLDER:
|
||||
ERepositoryObjectType contentType = node.getContentType();
|
||||
if (contentType != null) {
|
||||
// special setting for system codeJar node
|
||||
if (contentType.equals(ERepositoryObjectType.ROUTINESJAR)) {
|
||||
nodeIcon = RepositoryImageProvider.getIcon(ERepositoryObjectType.ROUTINES);
|
||||
} else if (contentType.equals(ERepositoryObjectType.BEANSJAR)) {
|
||||
nodeIcon = RepositoryImageProvider.getIcon(ERepositoryObjectType.BEANS);
|
||||
}
|
||||
}
|
||||
if (nodeIcon == null || EImage.DEFAULT_IMAGE.equals(nodeIcon)) {
|
||||
Image image = getImageFromFramework(contentType);
|
||||
if (image != null) {
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.talend.core.model.properties.ByteArray;
|
||||
import org.talend.core.model.properties.FileItem;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.model.properties.RoutinesJarItem;
|
||||
import org.talend.core.model.repository.AbstractRepositoryContentHandler;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
|
||||
@@ -66,6 +67,13 @@ public abstract class AbstractResourceRepositoryContentHandler extends AbstractR
|
||||
return itemResource;
|
||||
}
|
||||
|
||||
protected Resource save(RoutinesJarItem item) {
|
||||
final Resource itemResource = getXmiResourceManager().getItemResource(item);
|
||||
itemResource.getContents().clear();
|
||||
itemResource.getContents().add(item.getRoutinesJarType());
|
||||
return itemResource;
|
||||
}
|
||||
|
||||
protected Resource saveScreenShots(ProcessItem item) throws PersistenceException {
|
||||
Resource itemResource = getXmiResourceManager().getScreenshotResource(item, true, true);
|
||||
EMap screenshots = item.getProcess().getScreenshots();
|
||||
@@ -76,7 +84,7 @@ public abstract class AbstractResourceRepositoryContentHandler extends AbstractR
|
||||
return itemResource;
|
||||
}
|
||||
|
||||
private XmiResourceManager getXmiResourceManager() {
|
||||
protected XmiResourceManager getXmiResourceManager() {
|
||||
if (null == xmiResourceManager) {
|
||||
xmiResourceManager = new XmiResourceManager();
|
||||
}
|
||||
|
||||
@@ -81,6 +81,12 @@ public class ProjectDataJsonProvider {
|
||||
return strBuilder.toString();
|
||||
}
|
||||
|
||||
public static String getMigrationTaskIndexPath() {
|
||||
StringBuilder strBuilder = new StringBuilder();
|
||||
strBuilder.append(FileConstants.SETTINGS_FOLDER_NAME).append("/").append(FileConstants.MIGRATION_TASK_FILE_NAME); //$NON-NLS-1$
|
||||
return strBuilder.toString();
|
||||
}
|
||||
|
||||
public static void saveProjectData(Project project) throws PersistenceException {
|
||||
saveProjectData(project, CONTENT_ALL);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
// ============================================================================
|
||||
package org.talend.core.repository.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.oro.text.regex.MalformedPatternException;
|
||||
import org.apache.oro.text.regex.Pattern;
|
||||
import org.apache.oro.text.regex.PatternCompiler;
|
||||
@@ -26,37 +30,65 @@ import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.RoutineItem;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
import org.talend.core.runtime.services.IDesignerMavenService;
|
||||
|
||||
/**
|
||||
* DOC nrousseau class global comment. Detailled comment
|
||||
*/
|
||||
public final class RoutineUtils {
|
||||
|
||||
private static final String DEFAULT_PACKAGE_REGEX = "package(\\s)+" + JavaUtils.JAVA_ROUTINES_DIRECTORY //$NON-NLS-1$
|
||||
+ "\\.((\\w)+)(\\s)*;"; //$NON-NLS-1$
|
||||
|
||||
private static final String DEFAULT_PACKAGE_STRING = "package " + JavaUtils.JAVA_ROUTINES_DIRECTORY + ";"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
private static final String INNER_ROUTINES_PACKAGE_REGEX = "package\\s+([^;]+);";
|
||||
|
||||
public static void changeRoutinesPackage(Item item) {
|
||||
List<ERepositoryObjectType> allowedTypes = new ArrayList<ERepositoryObjectType>();
|
||||
allowedTypes.add(ERepositoryObjectType.ROUTINES);
|
||||
doChangeRoutinesPackage(item, DEFAULT_PACKAGE_REGEX, DEFAULT_PACKAGE_STRING, allowedTypes, false, true);
|
||||
}
|
||||
|
||||
public static void changeInnerCodePackage(Item item, boolean avoidSave) {
|
||||
changeInnerCodePackage(item, avoidSave, true);
|
||||
}
|
||||
|
||||
public static void changeInnerCodePackage(Item item, boolean avoidSave, boolean commitMode) {
|
||||
IDesignerMavenService service = IDesignerMavenService.get();
|
||||
if (service != null && item instanceof RoutineItem) {
|
||||
RoutineItem routineItem = (RoutineItem) item;
|
||||
String codesJarPackageByInnerCode = service.getCodesJarPackageByInnerCode(routineItem);
|
||||
if (StringUtils.isNotBlank(codesJarPackageByInnerCode)) {
|
||||
String newPackageString = "package " + StringUtils.replace(codesJarPackageByInnerCode, "/", ".") + ";";
|
||||
if (!routineItem.isBuiltIn()) {
|
||||
String routineContent = new String(routineItem.getContent().getInnerContent());
|
||||
if (routineContent != null && routineContent.contains(newPackageString)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
doChangeRoutinesPackage(item, INNER_ROUTINES_PACKAGE_REGEX, newPackageString,
|
||||
ERepositoryObjectType.getAllTypesOfCodes(), avoidSave, commitMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void doChangeRoutinesPackage(Item item, String packageRegex, String newPackage,
|
||||
List<ERepositoryObjectType> allowedTypes, boolean avoidSave, boolean commitMode) {
|
||||
if (item == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
ERepositoryObjectType itemType = ERepositoryObjectType.getItemType(item);
|
||||
if (ERepositoryObjectType.ROUTINES.equals(itemType) && item instanceof RoutineItem) {
|
||||
if (allowedTypes != null && allowedTypes.contains(itemType) && item instanceof RoutineItem) {
|
||||
RoutineItem rItem = (RoutineItem) item;
|
||||
if (!rItem.isBuiltIn()) {
|
||||
//
|
||||
String routineContent = new String(rItem.getContent().getInnerContent());
|
||||
//
|
||||
// String curProjectName =
|
||||
// currentProject.getTechnicalLabel().toLowerCase();
|
||||
String oldPackage = "package(\\s)+" + JavaUtils.JAVA_ROUTINES_DIRECTORY + "\\.((\\w)+)(\\s)*;"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
// String newPackage = "package " +
|
||||
// JavaUtils.JAVA_ROUTINES_DIRECTORY + "." + curProjectName +
|
||||
// ";";
|
||||
|
||||
String newPackage = "package " + JavaUtils.JAVA_ROUTINES_DIRECTORY + ";"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
try {
|
||||
PatternCompiler compiler = new Perl5Compiler();
|
||||
Perl5Matcher matcher = new Perl5Matcher();
|
||||
matcher.setMultiline(true);
|
||||
Pattern pattern = compiler.compile(oldPackage);
|
||||
Pattern pattern = compiler.compile(packageRegex);
|
||||
|
||||
if (matcher.contains(routineContent, pattern)) {
|
||||
// String group = matcher.getMatch().group(2);
|
||||
@@ -67,7 +99,14 @@ public final class RoutineUtils {
|
||||
rItem.getContent().setInnerContent(routineContent.getBytes());
|
||||
ProxyRepositoryFactory repFactory = ProxyRepositoryFactory.getInstance();
|
||||
|
||||
repFactory.save(rItem);
|
||||
if (!avoidSave) {
|
||||
if (commitMode) {
|
||||
repFactory.save(rItem);
|
||||
} else {
|
||||
// avoid deadlock in git pull event listener
|
||||
new XmiResourceManager().saveResource(rItem.eResource());
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
} catch (MalformedPatternException e) {
|
||||
|
||||
@@ -205,6 +205,27 @@ public class StandaloneConnectionContextUtils {
|
||||
cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_HIVE_ADDITIONAL_JDBC_SETTINGS,
|
||||
getOriginalValue(contextProperties, additionalJDBCSettings));
|
||||
|
||||
String dataprocProjectId = cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HIVE_GOOGLE_PROJECT_ID);
|
||||
cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_HIVE_GOOGLE_PROJECT_ID,
|
||||
getOriginalValue(contextProperties, dataprocProjectId));
|
||||
|
||||
String dataprocClusterId = cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HIVE_GOOGLE_CLUSTER_ID);
|
||||
cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_HIVE_GOOGLE_CLUSTER_ID,
|
||||
getOriginalValue(contextProperties, dataprocClusterId));
|
||||
|
||||
String dataprocRegion = cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HIVE_GOOGLE_REGION);
|
||||
cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_HIVE_GOOGLE_REGION,
|
||||
getOriginalValue(contextProperties, dataprocRegion));
|
||||
|
||||
String dataprocJarsBucket = cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HIVE_GOOGLE_JARS_BUCKET);
|
||||
cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_HIVE_GOOGLE_JARS_BUCKET,
|
||||
getOriginalValue(contextProperties, dataprocJarsBucket));
|
||||
|
||||
String dataprocPathToCredentials = cloneConn.getParameters()
|
||||
.get(ConnParameterKeys.CONN_PARA_KEY_HIVE_AUTHENTICATION_PATH_TO_GOOGLE_CREDENTIALS);
|
||||
cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_HIVE_AUTHENTICATION_PATH_TO_GOOGLE_CREDENTIALS,
|
||||
getOriginalValue(contextProperties, dataprocPathToCredentials));
|
||||
|
||||
String hiveEnableHa = cloneConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HIVE_ENABLE_HA);
|
||||
cloneConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_HIVE_ENABLE_HA,
|
||||
getOriginalValue(contextProperties, hiveEnableHa));
|
||||
|
||||
@@ -70,6 +70,7 @@ import org.talend.core.model.properties.TDQItem;
|
||||
import org.talend.core.model.properties.ValidationRulesConnectionItem;
|
||||
import org.talend.core.model.properties.helper.ByteArrayResource;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.routines.RoutinesUtil;
|
||||
import org.talend.core.repository.constants.FileConstants;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
import org.talend.core.repository.utils.ResourceFilenameHelper.FileName;
|
||||
@@ -209,7 +210,7 @@ public class XmiResourceManager {
|
||||
* @return
|
||||
* @throws PersistenceException
|
||||
*/
|
||||
private IPath getFolderPath(IProject project, ERepositoryObjectType repositoryObjectType, IPath relativePath)
|
||||
private IPath getFolderPath(IProject project, ERepositoryObjectType repositoryObjectType, IPath relativePath, Item item)
|
||||
throws PersistenceException {
|
||||
ERepositoryObjectType type = repositoryObjectType;
|
||||
if (ERepositoryObjectType.TDQ_SYSTEM_INDICATORS.equals(repositoryObjectType)
|
||||
@@ -218,6 +219,10 @@ public class XmiResourceManager {
|
||||
} else if (ERepositoryObjectType.TDQ_PATTERN_REGEX.equals(repositoryObjectType)
|
||||
|| ERepositoryObjectType.TDQ_PATTERN_SQL.equals(repositoryObjectType)) {
|
||||
type = ERepositoryObjectType.TDQ_PATTERN_ELEMENT;
|
||||
} else if (type == ERepositoryObjectType.ROUTINES && RoutinesUtil.isInnerCodes(item.getProperty())) {
|
||||
type = ERepositoryObjectType.ROUTINESJAR;
|
||||
} else if (type == ERepositoryObjectType.BEANS && RoutinesUtil.isInnerCodes(item.getProperty())) {
|
||||
type = ERepositoryObjectType.BEANSJAR;
|
||||
}
|
||||
IFolder folder = project.getFolder(ERepositoryObjectType.getFolderName(type)).getFolder(relativePath);
|
||||
return folder.getFullPath();
|
||||
@@ -704,7 +709,7 @@ public class XmiResourceManager {
|
||||
// MOD mzhao 2010-11-22, suppport TDQ item file extensions.(.ana, .rep, etc)
|
||||
private URI getItemResourceURI(IProject project, ERepositoryObjectType repositoryObjectType, IPath path, Item item)
|
||||
throws PersistenceException {
|
||||
IPath folderPath = getFolderPath(project, repositoryObjectType, path);
|
||||
IPath folderPath = getFolderPath(project, repositoryObjectType, path, item);
|
||||
FileName fileName = ResourceFilenameHelper.create(item.getProperty());
|
||||
IPath resourcePath = null;
|
||||
if (item.getFileExtension() == null) {
|
||||
@@ -720,7 +725,7 @@ public class XmiResourceManager {
|
||||
@Deprecated
|
||||
private URI getItemResourceURI(IProject project, ERepositoryObjectType repositoryObjectType, IPath path, Item item,
|
||||
String fileExtension) throws PersistenceException {
|
||||
IPath folderPath = getFolderPath(project, repositoryObjectType, path);
|
||||
IPath folderPath = getFolderPath(project, repositoryObjectType, path, item);
|
||||
FileName fileName = ResourceFilenameHelper.create(item.getProperty());
|
||||
IPath resourcePath = ResourceFilenameHelper
|
||||
.getExpectedFilePath(fileName, folderPath, fileExtension, item.isNeedVersion());
|
||||
@@ -730,7 +735,7 @@ public class XmiResourceManager {
|
||||
// added by dlin 2011-7-14 to create the uri of file of .screenshot
|
||||
private URI getScreenshotResourceURI(IProject project, ERepositoryObjectType repositoryObjectType, IPath path, Item item,
|
||||
String... fileExtension) throws PersistenceException {
|
||||
IPath folderPath = getFolderPath(project, repositoryObjectType, path);
|
||||
IPath folderPath = getFolderPath(project, repositoryObjectType, path, item);
|
||||
FileName fileName = ResourceFilenameHelper.create(item.getProperty());
|
||||
IPath resourcePath = ResourceFilenameHelper.getExpectedFilePath(fileName, folderPath, FileConstants.SCREENSHOT_EXTENSION,
|
||||
item.isNeedVersion());
|
||||
|
||||
@@ -95,6 +95,7 @@ Export-Package: org.talend.commons.utils.generation,
|
||||
org.talend.repository.documentation.generation,
|
||||
org.talend.repository.model,
|
||||
org.talend.repository.model.nodes,
|
||||
org.talend.repository.token,
|
||||
org.talend.repository.ui.actions,
|
||||
org.talend.repository.ui.dialog,
|
||||
org.talend.repository.ui.login.connections,
|
||||
@@ -122,7 +123,8 @@ Require-Bundle: org.eclipse.jdt.core,
|
||||
org.talend.components.api,
|
||||
org.apache.servicemix.bundles.avro,
|
||||
jackson-core-asl,
|
||||
org.talend.libraries.jackson
|
||||
org.talend.libraries.jackson,
|
||||
org.talend.libraries.apache.common
|
||||
Bundle-Activator: org.talend.core.runtime.CoreRuntimePlugin
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-ClassPath: .,
|
||||
|
||||
@@ -12,17 +12,26 @@
|
||||
<dbType type="BPCHAR" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="BYTEA" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="CHAR" defaultLength="50" ignorePre="true"/>
|
||||
<dbType type="CHARACTER" defaultLength="50" ignorePre="true"/>
|
||||
<dbType type="CID" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="CIDR" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="CIRCLE" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="DATE" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="FLOAT4" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="REAL" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="FLOAT8" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="DOUBLE PRECISION" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="INET" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="INT2" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="SMALLINT" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="INT2VECTOR" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="INT4" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="INT8" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="INTEGER" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="CHARACTER VARYING" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="BOOLEAN" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="BIGINT" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="BIT VARYING" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="INTERVAL" ignorePre="true" />
|
||||
<dbType type="LINE" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="LSEG" ignoreLen="true" ignorePre="true" />
|
||||
@@ -30,6 +39,7 @@
|
||||
<dbType type="MONEY" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="NAME" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="NUMERIC" defaultLength="20" defaultPrecision="10"/>
|
||||
<dbType type="DECIMAL" defaultLength="20" defaultPrecision="10"/>
|
||||
<dbType type="OID" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="OIDVECTOR" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="PATH" ignoreLen="true" ignorePre="true" />
|
||||
@@ -110,16 +120,19 @@
|
||||
<talendToDbTypes><!-- Adviced mappings -->
|
||||
<talendType type="id_List"/>
|
||||
<talendType type="id_Boolean">
|
||||
<dbType type="BOOL" default="true" />
|
||||
<dbType type="BOOL" default="true" />
|
||||
<dbType type="BOOLEAN" />
|
||||
</talendType>
|
||||
<talendType type="id_Byte">
|
||||
</talendType>
|
||||
<talendType type="id_byte[]">
|
||||
<dbType type="BIT" default="true" />
|
||||
<dbType type="VARBIT" />
|
||||
<dbType type="VARBIT" />
|
||||
<dbType type="BIT VARYING" />
|
||||
</talendType>
|
||||
<talendType type="id_Character">
|
||||
<dbType type="CHAR" default="true" />
|
||||
<dbType type="CHARACTER" />
|
||||
<dbType type="BPCHAR" />
|
||||
<dbType type="VARCHAR" />
|
||||
<dbType type="TEXT" />
|
||||
@@ -136,33 +149,47 @@
|
||||
<dbType type="RELTIME" />
|
||||
</talendType>
|
||||
<talendType type="id_BigDecimal">
|
||||
<dbType type="NUMERIC" default="true" />
|
||||
<dbType type="NUMERIC" default="true" />
|
||||
<dbType type="DECIMAL" />
|
||||
<dbType type="FLOAT4" />
|
||||
<dbType type="REAL" />
|
||||
<dbType type="FLOAT8"/>
|
||||
<dbType type="DOUBLE PRECISION"/>
|
||||
</talendType>
|
||||
<talendType type="id_Double">
|
||||
<dbType type="FLOAT4" />
|
||||
<dbType type="REAL" />
|
||||
<dbType type="FLOAT8" default="true" />
|
||||
<dbType type="NUMERIC" />
|
||||
<dbType type="NUMERIC" />
|
||||
<dbType type="DECIMAL" />
|
||||
<dbType type="DOUBLE PRECISION"/>
|
||||
</talendType>
|
||||
<talendType type="id_Float">
|
||||
<dbType type="FLOAT4" default="true" />
|
||||
<dbType type="FLOAT8" />
|
||||
<dbType type="NUMERIC" />
|
||||
<dbType type="REAL" />
|
||||
<dbType type="NUMERIC" />
|
||||
<dbType type="DECIMAL" />
|
||||
<dbType type="DOUBLE PRECISION"/>
|
||||
</talendType>
|
||||
<talendType type="id_Integer">
|
||||
<dbType type="INT2" />
|
||||
<dbType type="SMALLINT" />
|
||||
<dbType type="INT4" default="true" />
|
||||
<dbType type="SERIAL" />
|
||||
<dbType type="INT8" />
|
||||
<dbType type="BIGSERIAL" />
|
||||
<dbType type="BIGINT" />
|
||||
<dbType type="BIGSERIAL" />
|
||||
<dbType type="INTEGER" />
|
||||
</talendType>
|
||||
<talendType type="id_Long">
|
||||
<dbType type="INT2" />
|
||||
<dbType type="INT4" />
|
||||
<dbType type="SERIAL" />
|
||||
<dbType type="INT8" default="true" />
|
||||
<dbType type="BIGSERIAL" />
|
||||
<dbType type="BIGINT" />
|
||||
<dbType type="BIGSERIAL" />
|
||||
<dbType type="SMALLINT" />
|
||||
</talendType>
|
||||
<talendType type="id_Object">
|
||||
<dbType type="_POINT" />
|
||||
@@ -209,18 +236,26 @@
|
||||
<dbType type="_ABSTIME" />
|
||||
<dbType type="_ACLITEM" />
|
||||
<dbType type="_INT8" />
|
||||
<dbType type="BIGINT" />
|
||||
<dbType type="BIT VARYING" />
|
||||
<dbType type="_VARBIT" />
|
||||
<dbType type="_BIT" />
|
||||
<dbType type="_BOOL" />
|
||||
<dbType type="BOOLEAN" />
|
||||
<dbType type="BOX" />
|
||||
<dbType type="_BOX" />
|
||||
<dbType type="_BYTEA" />
|
||||
<dbType type="_VARCHAR" />
|
||||
<dbType type="CHARACTER VARYING" />
|
||||
<dbType type="CHARACTER" />
|
||||
<dbType type="INTEGER" />
|
||||
<dbType type="REAL" />
|
||||
<dbType type="_BPCHAR" />
|
||||
<dbType type="_CID" />
|
||||
<dbType type="_CIDR" />
|
||||
<dbType type="_CIRCLE" />
|
||||
<dbType type="_DATE" />
|
||||
<dbType type="DOUBLE PRECISION"/>
|
||||
<dbType type="_FLOAT8" />
|
||||
<dbType type="_INET" />
|
||||
<dbType type="INT2VECTOR" />
|
||||
@@ -236,6 +271,7 @@
|
||||
<dbType type="NAME" />
|
||||
<dbType type="_NAME" />
|
||||
<dbType type="_NUMERIC" />
|
||||
<dbType type="DECIMAL" />
|
||||
<dbType type="_OID" />
|
||||
<dbType type="OIDVECTOR" />
|
||||
<dbType type="_OIDVECTOR" />
|
||||
@@ -247,26 +283,44 @@
|
||||
<dbType type="INT4" />
|
||||
<dbType type="SERIAL" />
|
||||
<dbType type="INT8" />
|
||||
<dbType type="BIGSERIAL" />
|
||||
<dbType type="BIGINT" />
|
||||
<dbType type="BIGSERIAL" />
|
||||
<dbType type="SMALLINT" />
|
||||
</talendType>
|
||||
<talendType type="id_String">
|
||||
<dbType type="BPCHAR" />
|
||||
<dbType type="VARCHAR" default="true" />
|
||||
<dbType type="CHARACTER VARYING" />
|
||||
<dbType type="TEXT" />
|
||||
</talendType>
|
||||
</talendToDbTypes>
|
||||
<dbToTalendTypes>
|
||||
<dbType type="INT2" >
|
||||
<talendType type="id_Short" default="true" />
|
||||
</dbType>
|
||||
<dbType type="SMALLINT" >
|
||||
<talendType type="id_Short" default="true" />
|
||||
</dbType>
|
||||
<dbType type="INT4" >
|
||||
<talendType type="id_Integer" default="true" />
|
||||
</dbType>
|
||||
</dbType>
|
||||
<dbType type="INTEGER" >
|
||||
<talendType type="id_Integer" default="true" />
|
||||
</dbType>
|
||||
<dbType type="CHARACTER VARYING" >
|
||||
<talendType type="id_String" default="true" />
|
||||
</dbType>
|
||||
<dbType type="BOOLEAN" >
|
||||
<talendType type="id_Boolean" default="true" />
|
||||
</dbType>
|
||||
<dbType type="SERIAL" >
|
||||
<talendType type="id_Integer" default="true" />
|
||||
</dbType>
|
||||
<dbType type="INT8" >
|
||||
<talendType type="id_Long" default="true" />
|
||||
</dbType>
|
||||
<dbType type="BIGINT" >
|
||||
<talendType type="id_Long" default="true" />
|
||||
</dbType>
|
||||
<dbType type="BIGSERIAL" >
|
||||
<talendType type="id_Long" default="true" />
|
||||
@@ -274,14 +328,26 @@
|
||||
<dbType type="FLOAT4" >
|
||||
<talendType type="id_Float" default="true" />
|
||||
<talendType type="id_BigDecimal"/>
|
||||
</dbType>
|
||||
</dbType>
|
||||
<dbType type="REAL" >
|
||||
<talendType type="id_Float" default="true" />
|
||||
<talendType type="id_BigDecimal"/>
|
||||
</dbType>
|
||||
<dbType type="FLOAT8" >
|
||||
<talendType type="id_Double" default="true" />
|
||||
<talendType type="id_BigDecimal"/>
|
||||
</dbType>
|
||||
<dbType type="DOUBLE PRECISION" >
|
||||
<talendType type="id_Double" default="true" />
|
||||
<talendType type="id_BigDecimal"/>
|
||||
</dbType>
|
||||
<dbType type="NUMERIC">
|
||||
<talendType type="id_Double"/>
|
||||
<talendType type="id_BigDecimal" default="true" />
|
||||
</dbType>
|
||||
<dbType type="DECIMAL">
|
||||
<talendType type="id_Double"/>
|
||||
<talendType type="id_BigDecimal" default="true" />
|
||||
</dbType>
|
||||
<dbType type="BOOL" >
|
||||
<talendType type="id_Boolean" default="true" />
|
||||
@@ -291,9 +357,15 @@
|
||||
</dbType>
|
||||
<dbType type="VARBIT" >
|
||||
<talendType type="id_byte[]" default="true" />
|
||||
</dbType>
|
||||
</dbType>
|
||||
<dbType type="BIT VARYING" >
|
||||
<talendType type="id_byte[]" default="true" />
|
||||
</dbType>
|
||||
<dbType type="CHAR" >
|
||||
<talendType type="id_String" default="true" />
|
||||
</dbType>
|
||||
<dbType type="CHARACTER" >
|
||||
<talendType type="id_String" default="true" />
|
||||
</dbType>
|
||||
<dbType type="BPCHAR" >
|
||||
<talendType type="id_String" default="true" />
|
||||
|
||||
@@ -89,6 +89,10 @@ public final class JavaUtils {
|
||||
/** Java Routines Directory. */
|
||||
public static final String JAVA_ROUTINES_DIRECTORY = "routines"; //$NON-NLS-1$
|
||||
|
||||
// TODO check refrerences of JAVA_ROUTINES_DIRECTORY
|
||||
/** Java Routines Jar Directory. */
|
||||
public static final String JAVA_ROUTINESJAR_DIRECTORY = "routinesjar"; //$NON-NLS-1$
|
||||
|
||||
/** Java Pig Directory. */
|
||||
public static final String JAVA_PIG_DIRECTORY = "pig"; //$NON-NLS-1$
|
||||
|
||||
@@ -98,6 +102,9 @@ public final class JavaUtils {
|
||||
/** Java Beans Directory. */
|
||||
public static final String JAVA_BEANS_DIRECTORY = "beans"; //$NON-NLS-1$
|
||||
|
||||
/** Java Beans Jar Directory. */
|
||||
public static final String JAVA_BEANSJAR_DIRECTORY = "beansjar"; //$NON-NLS-1$
|
||||
|
||||
/** Java SQLTemplate Directory. */
|
||||
public static final String JAVA_SQLPATTERNS_DIRECTORY = "sqltemplates"; //$NON-NLS-1$
|
||||
|
||||
|
||||
@@ -94,4 +94,6 @@ public interface IESBService extends IService {
|
||||
* @return
|
||||
*/
|
||||
public IProcessor createOSGIJavaProcessor(IProcess process, Property property, boolean filenameFromLabel);
|
||||
|
||||
public boolean isSOAPServiceProvider(Item item);
|
||||
}
|
||||
|
||||
@@ -126,6 +126,8 @@ public class PluginChecker {
|
||||
|
||||
public static final String BDEE_PLUGIN_ID = "org.talend.designer.bigdata"; //$NON-NLS-1$
|
||||
|
||||
public static final String BD_ROUTINE_PLUGIN_ID = "org.talend.designer.routines.bigdata"; //$NON-NLS-1$
|
||||
|
||||
public static final String DOCKER_PLUGIN_ID = "org.talend.designer.docker"; //$NON-NLS-1$
|
||||
|
||||
public static final String HELP_DI_EE_PLUGIN_ID = "org.talend.help.dataprep"; //$NON-NLS-1$
|
||||
@@ -136,6 +138,10 @@ public class PluginChecker {
|
||||
|
||||
public static final String HELP_PLUGIN_ID = "org.talend.help"; //$NON-NLS-1$
|
||||
|
||||
public static final String APACHE_CXF_PLUGIN_ID = "org.talend.libraries.apache.cxf"; //$NON-NLS-1$
|
||||
|
||||
public static final String SWTBOT_PLUGIN_ID = "org.eclipse.swtbot.eclipse.core"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Check if specific plug-in is loaded.
|
||||
*
|
||||
@@ -364,6 +370,14 @@ public class PluginChecker {
|
||||
return isPluginLoaded(ESBSE_PLUGIN_ID);
|
||||
}
|
||||
|
||||
public static boolean isBigdataRoutineLoaded() {
|
||||
return isPluginLoaded(BD_ROUTINE_PLUGIN_ID);
|
||||
}
|
||||
|
||||
public static boolean isSWTBotLoaded() {
|
||||
return isPluginLoaded(SWTBOT_PLUGIN_ID);
|
||||
}
|
||||
|
||||
public static String getBundlePath(String bundleName) {
|
||||
String bundlePath = ""; //$NON-NLS-1$
|
||||
Bundle refBundle = Platform.getBundle(bundleName);
|
||||
|
||||
@@ -67,8 +67,8 @@ public enum EDatabase4DriverClassName {
|
||||
// if change the order, it might break the audit for PSQL.
|
||||
PSQL(EDatabaseTypeName.PSQL, "org.postgresql.Driver"), //$NON-NLS-1$
|
||||
PLUSPSQL(EDatabaseTypeName.PLUSPSQL, "org.postgresql.Driver"), //$NON-NLS-1$
|
||||
GREENPLUM(EDatabaseTypeName.GREENPLUM, "org.postgresql.Driver"), //$NON-NLS-1$
|
||||
|
||||
GREENPLUM(EDatabaseTypeName.GREENPLUM, "com.pivotal.jdbc.GreenplumDriver"), //$NON-NLS-1$
|
||||
GREENPLUM_PSQL(EDatabaseTypeName.GREENPLUM, "org.postgresql.Driver"), //$NON-NLS-1$
|
||||
SAS(EDatabaseTypeName.SAS, "com.sas.rio.MVADriver"), //$NON-NLS-1$
|
||||
SAPHana(EDatabaseTypeName.SAPHana, "com.sap.db.jdbc.Driver"), //$NON-NLS-1$
|
||||
SQLITE(EDatabaseTypeName.SQLITE, "org.sqlite.JDBC"), //$NON-NLS-1$
|
||||
|
||||
@@ -114,7 +114,10 @@ public enum EDatabaseTypeName {
|
||||
"ParAccel", "ParAccel", Boolean.TRUE, "PARACCEL", "PARACCEL", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
NETEZZA(
|
||||
"Netezza", "Netezza", Boolean.FALSE, "NETEZZA", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
SAS("SAS", "SAS", Boolean.TRUE, "SAS", EDatabaseSchemaOrCatalogMapping.None, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
SAS("SAS", "SAS (Deprecated)", Boolean.TRUE, "SAS", EDatabaseSchemaOrCatalogMapping.None, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
// General JDBC not support schema defalut
|
||||
GENERAL_JDBC(
|
||||
"General JDBC", "General JDBC", Boolean.FALSE, "JDBC", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
|
||||
@@ -22,14 +22,14 @@ import org.talend.core.runtime.hd.hive.HiveMetadataHelper;
|
||||
*/
|
||||
public enum EImpalaDriver {
|
||||
|
||||
HIVE2("HIVE2", "HIVE2", "org.apache.hive.jdbc.HiveDriver"),
|
||||
IMPALA40("IMPALA40", "IMPALA40", "com.cloudera.impala.jdbc4.Driver"),
|
||||
IMPALA41("IMPALA41", "IMPALA41", "com.cloudera.impala.jdbc41.Driver");
|
||||
HIVE2("HIVE2", "HIVE2", "org.apache.hive.jdbc.HiveDriver", "doSupportHive2"),
|
||||
IMPALA("IMPALA", "IMPALA", "com.cloudera.impala.jdbc.Driver", "doSupportImpalaConnector");
|
||||
|
||||
EImpalaDriver(String displayName, String name, String driver) {
|
||||
EImpalaDriver(String displayName, String name, String driver, String supportDriverMethodName) {
|
||||
this.displayName = displayName;
|
||||
this.name = name;
|
||||
this.driver = driver;
|
||||
this.supportDriverMethodName = supportDriverMethodName;
|
||||
}
|
||||
|
||||
private String displayName;
|
||||
@@ -38,6 +38,8 @@ public enum EImpalaDriver {
|
||||
|
||||
private String driver;
|
||||
|
||||
private String supportDriverMethodName;
|
||||
|
||||
public String getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
@@ -50,6 +52,10 @@ public enum EImpalaDriver {
|
||||
return driver;
|
||||
}
|
||||
|
||||
public String getSupportDriverMethodName() {
|
||||
return supportDriverMethodName;
|
||||
}
|
||||
|
||||
public static boolean isSupport(String distribution, String version, boolean byDisplay, String supportMethodName) {
|
||||
return HiveMetadataHelper.doSupportMethod(distribution, version, byDisplay, supportMethodName);
|
||||
}
|
||||
@@ -57,7 +63,7 @@ public enum EImpalaDriver {
|
||||
public static String[] getImpalaDriverDisplay(String distribution, String version, boolean byDisplay) {
|
||||
List<String> list = new ArrayList<>(0);
|
||||
for (EImpalaDriver driver : EImpalaDriver.values()) {
|
||||
if (isSupport(distribution, version, byDisplay, "doSupportImpalaConnector")) {
|
||||
if (isSupport(distribution, version, byDisplay, driver.getSupportDriverMethodName())) {
|
||||
list.add(driver.getDisplayName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,6 +163,18 @@ public class ConnParameterKeys {
|
||||
|
||||
public static final String CONN_PARA_KEY_HIVE_AUTHENTICATION_MAPRTICKET_DURATION = "CONN_PARA_KEY_HIVE_AUTHENTICATION_MAPRTICKET_DURATION";//$NON-NLS-1$
|
||||
|
||||
public static final String CONN_PARA_KEY_HIVE_GOOGLE_PROJECT_ID = "CONN_PARA_KEY_HIVE_GOOGLE_PROJECT_ID";//$NON-NLS-1$
|
||||
|
||||
public static final String CONN_PARA_KEY_HIVE_GOOGLE_CLUSTER_ID = "CONN_PARA_KEY_HIVE_GOOGLE_CLUSTER_ID";//$NON-NLS-1$
|
||||
|
||||
public static final String CONN_PARA_KEY_HIVE_GOOGLE_REGION = "CONN_PARA_KEY_HIVE_GOOGLE_REGION";//$NON-NLS-1$
|
||||
|
||||
public static final String CONN_PARA_KEY_HIVE_GOOGLE_JARS_BUCKET = "CONN_PARA_KEY_HIVE_GOOGLE_JARS_BUCKET";//$NON-NLS-1$
|
||||
|
||||
public static final String CONN_PARA_KEY_HIVE_AUTHENTICATION_DEFINE_PATH_TO_GOOGLE_CREDENTIALS = "CONN_PARA_KEY_HIVE_AUTHENTICATION_DEFINE_PATH_TO_GOOGLE_CREDENTIALS";//$NON-NLS-1$
|
||||
|
||||
public static final String CONN_PARA_KEY_HIVE_AUTHENTICATION_PATH_TO_GOOGLE_CREDENTIALS = "CONN_PARA_KEY_HIVE_AUTHENTICATION_PATH_TO_GOOGLE_CREDENTIALS";//$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* The key is for metastore server.
|
||||
*/
|
||||
|
||||
@@ -114,6 +114,13 @@ public class DatabaseConnStrUtil {
|
||||
&& EDatabaseVersion4Drivers.SYBASEIQ_16_SA.getVersionValue().equals(dbVersion)) {
|
||||
connStr = EDatabaseConnTemplate.SYBASEASE_16_SA;
|
||||
}
|
||||
if (EDatabaseTypeName.GREENPLUM.getDisplayName().equals(dbType)) {
|
||||
if (EDatabaseVersion4Drivers.GREENPLUM.getVersionValue().equals(dbVersion)) {
|
||||
connStr = EDatabaseConnTemplate.GREENPLUM;
|
||||
}else if(EDatabaseVersion4Drivers.GREENPLUM_PSQL.getVersionValue().equals(dbVersion)) {
|
||||
connStr = EDatabaseConnTemplate.GREENPLUM_PSQL;
|
||||
}
|
||||
}
|
||||
EDatabaseVersion4Drivers version = EDatabaseVersion4Drivers.indexOfByVersion(dbVersion);
|
||||
if (connStr != null) {
|
||||
String s = connStr.getUrlTemplate(version);
|
||||
@@ -221,8 +228,10 @@ public class DatabaseConnStrUtil {
|
||||
.get(ConnParameterKeys.IMPALA_AUTHENTICATION_PRINCIPLA));
|
||||
}
|
||||
String url = null;
|
||||
if (template.startsWith(DbConnStrForHive.URL_HIVE_2_TEMPLATE)) {
|
||||
url = getImpalaURLString(false, server, port, sidOrDatabase, impalaPrincipal);
|
||||
String driver = dbConn.getParameters().get(ConnParameterKeys.IMPALA_DRIVER);
|
||||
if (template.startsWith(DbConnStrForHive.URL_HIVE_2_TEMPLATE)
|
||||
|| template.startsWith(DbConnStrForHive.URL_IMPALA_TEMPLATE)) {
|
||||
url = getImpalaURLString(false, server, port, sidOrDatabase, impalaPrincipal, driver);
|
||||
}
|
||||
url = attachAdditionalHiveParameters(url, dbConn, false);
|
||||
return url;
|
||||
@@ -369,9 +378,13 @@ public class DatabaseConnStrUtil {
|
||||
return s;
|
||||
}
|
||||
|
||||
private static String getImpalaURLString(boolean supportContext, String server, String port, String sid, String Principal) {
|
||||
String s = EDatabaseConnTemplate.IMPALA.getUrlTemplate(null);
|
||||
String standardURlString = getImpalaURlString(s, supportContext, server, port, sid);
|
||||
private static String getImpalaURLString(boolean supportContext, String server, String port, String sid, String Principal,
|
||||
String driver) {
|
||||
String template = EDatabaseConnTemplate.IMPALA.getUrlTemplate(null);
|
||||
if (EDatabaseTypeName.IMPALA.getDbType().equals(driver)) {
|
||||
template = EDatabaseConnTemplate.IMPALA_IMPALA_DRIVER.getUrlTemplate(null);
|
||||
}
|
||||
String standardURlString = getImpalaURlString(template, supportContext, server, port, sid);
|
||||
String principalSuffix = "principal="; //$NON-NLS-1$
|
||||
boolean hasPrinc = false;
|
||||
String[] urlArray = standardURlString.split(SEMICOLON);
|
||||
|
||||
@@ -30,6 +30,8 @@ public class DbConnStrForHive extends DbConnStr {
|
||||
|
||||
public static final String URL_HIVE_2_TEMPLATE = "jdbc:hive2://";//$NON-NLS-1$
|
||||
|
||||
public static final String URL_IMPALA_TEMPLATE = "jdbc:impala://";//$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* DOC Marvin DbConnStrForHive constructor comment.
|
||||
*
|
||||
|
||||
@@ -54,6 +54,11 @@ public enum EDatabaseConnTemplate {
|
||||
"5432")), //$NON-NLS-1$
|
||||
|
||||
GREENPLUM(new DbConnStr(EDatabaseTypeName.GREENPLUM, //
|
||||
"jdbc:pivotal:greenplum://<host>:<port>;;DatabaseName=<sid>;<property>", //$NON-NLS-1$
|
||||
"5432")), //$NON-NLS-1$
|
||||
|
||||
|
||||
GREENPLUM_PSQL(new DbConnStr(EDatabaseTypeName.GREENPLUM, //
|
||||
"jdbc:postgresql://<host>:<port>/<sid>?<property>", //$NON-NLS-1$
|
||||
"5432")), //$NON-NLS-1$
|
||||
|
||||
@@ -209,6 +214,9 @@ public enum EDatabaseConnTemplate {
|
||||
IMPALA(new DbConnStr(EDatabaseTypeName.IMPALA, "jdbc:hive2://<host>:<port>/<sid>;auth=noSasl", //$NON-NLS-1$
|
||||
"21050", null, null, "localhost", "default")), //$NON-NLS-1$
|
||||
|
||||
IMPALA_IMPALA_DRIVER(new DbConnStr(EDatabaseTypeName.IMPALA, "jdbc:impala://<host>:<port>/<sid>;auth=noSasl", //$NON-NLS-1$
|
||||
"21050", null, null, "localhost", "default")), //$NON-NLS-1$
|
||||
|
||||
HBASE(new DbConnStr(EDatabaseTypeName.HBASE, "127.0.0.1", //$NON-NLS-1$
|
||||
"2181")), //$NON-NLS-1$
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ public enum EDatabaseVersion4Drivers {
|
||||
HSQLDB_SERVER(new DbVersion4Drivers(EDatabaseTypeName.HSQLDB_SERVER, "hsqldb.jar")), //$NON-NLS-1$
|
||||
HSQLDB_WEBSERVER(new DbVersion4Drivers(EDatabaseTypeName.HSQLDB_WEBSERVER, "hsqldb.jar")), //$NON-NLS-1$
|
||||
|
||||
H2(new DbVersion4Drivers(EDatabaseTypeName.H2, "h2-1.3.160.jar")), //$NON-NLS-1$
|
||||
H2(new DbVersion4Drivers(EDatabaseTypeName.H2, "h2-1.4.198.jar")), //$NON-NLS-1$
|
||||
|
||||
//
|
||||
JAVADB_EMBEDED(new DbVersion4Drivers(EDatabaseTypeName.JAVADB_EMBEDED, "derby.jar")), //$NON-NLS-1$
|
||||
@@ -99,8 +99,8 @@ public enum EDatabaseVersion4Drivers {
|
||||
VERTICA_3(new DbVersion4Drivers(EDatabaseTypeName.VERTICA, "VERTICA 3 (Deprecated)", "VERTICA_3", "vertica_3.0_jdk_5.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
|
||||
// for bug 0017930
|
||||
|
||||
GREENPLUM(new DbVersion4Drivers(EDatabaseTypeName.GREENPLUM, "postgresql-8.4-703.jdbc4.jar")), //$NON-NLS-1$
|
||||
GREENPLUM_PSQL(new DbVersion4Drivers(EDatabaseTypeName.GREENPLUM,"PostgreSQL", "POSTGRESQL", "postgresql-8.4-703.jdbc4.jar")), //$NON-NLS-1$
|
||||
GREENPLUM(new DbVersion4Drivers(EDatabaseTypeName.GREENPLUM,"Greenplum", "GREENPLUM", "greenplum-5.1.4.000275.jar")), //$NON-NLS-1$
|
||||
// PSQL_V10(new DbVersion4Drivers(EDatabaseTypeName.PSQL, "v10", "V10", "postgresql-42.2.5.jar")),
|
||||
PSQL_V9_X(new DbVersion4Drivers(EDatabaseTypeName.PSQL, "v9 and later", "V9_X", "postgresql-42.2.14.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
PSQL_PRIOR_TO_V9(new DbVersion4Drivers(EDatabaseTypeName.PSQL, "Prior to v9", "PRIOR_TO_V9", "postgresql-8.4-703.jdbc4.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
|
||||
@@ -20,6 +20,8 @@ package org.talend.core.hadoop;
|
||||
public class HadoopConstants {
|
||||
|
||||
public static final String SPARK_LOCAL_MODE = "SPARK_LOCAL_MODE";
|
||||
|
||||
public static final String SPARK_LOCAL_VERSION = "SPARK_LOCAL_VERSION";
|
||||
|
||||
public static final String SPARK_MODE = "SPARK_MODE";
|
||||
|
||||
|
||||
@@ -81,6 +81,11 @@ public final class ComponentUtilities {
|
||||
|
||||
public static void setNodeValue(NodeType node, String name, String value) {
|
||||
ElementParameterType property = getNodeProperty(node, name);
|
||||
|
||||
if (property == null) {
|
||||
throw new IllegalArgumentException( "The component node "+node.getComponentName()+" doesn't have the property "+name );
|
||||
}
|
||||
|
||||
property.setValue(value);
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ public class ContextUtils {
|
||||
"static", "void", "class", "finally", "long", "strictfp", "volatile", "const", "float", "native", "super", "while")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$
|
||||
|
||||
private static final Set<String> SECURE_SENSITIVE_CONTEXT_NAMES_EXP = new HashSet<String>(Arrays.asList("resource_flow_temp_folder", "resource_webhook_payload", "resource_file_[\\w]+",
|
||||
"resource_directory_[\\w]+", "connection_[a-zA-Z0-9]+_[\\w]"));
|
||||
"resource_directory_[\\w]+", "connection_[a-zA-Z0-9]+_[\\w]+"));
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -320,7 +320,8 @@ public class JobContextManager implements IContextManager {
|
||||
contextParam = new JobContextParameter();
|
||||
contextParam.setContext(context);
|
||||
contextParam.setName(contextParamType.getName());
|
||||
contextParam.setPrompt(contextParamType.getPrompt());
|
||||
contextParam.setPrompt(
|
||||
contextParamType.getPrompt() == null ? (contextParamType.getName() + "?") : contextParamType.getPrompt());
|
||||
contextParam.setInternalId(contextParamType.getInternalId());
|
||||
originalParamerters.add(contextParam.getName());
|
||||
boolean exists = true;
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.talend.core.model.process.INode;
|
||||
import org.talend.core.model.process.IProcess;
|
||||
import org.talend.core.model.process.Problem;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.routines.CodesJarInfo;
|
||||
import org.talend.designer.codegen.PigTemplate;
|
||||
|
||||
/**
|
||||
@@ -117,6 +118,10 @@ public interface ILibrariesService extends IService {
|
||||
|
||||
Set<ModuleNeeded> getCodesModuleNeededs(ERepositoryObjectType type);
|
||||
|
||||
Set<ModuleNeeded> getAllCodesJarModuleNeededs();
|
||||
|
||||
Set<ModuleNeeded> getCodesJarModuleNeededs(CodesJarInfo info);
|
||||
|
||||
List<ModuleNeeded> getModuleNeeded(String id, boolean isGroup);
|
||||
|
||||
public void deployProjectLibrary(File source) throws IOException;
|
||||
|
||||
@@ -125,6 +125,10 @@ public interface IMetadataColumn {
|
||||
|
||||
public void setCustom(boolean custom);
|
||||
|
||||
public boolean isIgnoreCustomSort();
|
||||
|
||||
public void setIgnoreCustomSort(boolean ignoreCustomSort);
|
||||
|
||||
public void setCustomId(int customId); // only for custom columns to sort them
|
||||
|
||||
public int getCustomId(); // only for custom columns to sort them
|
||||
|
||||
@@ -53,6 +53,8 @@ public class MetadataColumn implements IMetadataColumn, Cloneable {
|
||||
|
||||
private boolean custom = false;
|
||||
|
||||
private boolean ignoreCustomSort = false;
|
||||
|
||||
private boolean readOnly = false;
|
||||
|
||||
private int customId = 0;
|
||||
@@ -574,6 +576,24 @@ public class MetadataColumn implements IMetadataColumn, Cloneable {
|
||||
this.custom = custom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for ignoreCustomSort.
|
||||
*
|
||||
* @return the ignoreCustomSort
|
||||
*/
|
||||
public boolean isIgnoreCustomSort() {
|
||||
return ignoreCustomSort;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the ignoreCustomSort.
|
||||
*
|
||||
* @param ignoreCustomSort the ignoreCustomSort to set
|
||||
*/
|
||||
public void setIgnoreCustomSort(boolean ignoreCustomSort) {
|
||||
this.ignoreCustomSort = ignoreCustomSort;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for readOnly.
|
||||
*
|
||||
|
||||
@@ -360,7 +360,7 @@ public class MetadataTable implements IMetadataTable, Cloneable {
|
||||
|
||||
for (int i = 0; i < listColumns.size(); i++) {
|
||||
IMetadataColumn column = listColumns.get(i);
|
||||
if (column.isCustom()) {
|
||||
if (column.isCustom() && !column.isIgnoreCustomSort()) {
|
||||
customColumns.add(column);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,8 @@ import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
@@ -492,18 +494,55 @@ public final class MetadataTalendType {
|
||||
}
|
||||
}
|
||||
|
||||
private static String getSha1OfFile(File file) {
|
||||
String sha1 = null;
|
||||
FileInputStream fileInputStream = null;
|
||||
try {
|
||||
fileInputStream = new FileInputStream(file);
|
||||
sha1 = DigestUtils.shaHex(fileInputStream);
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
} finally {
|
||||
if (fileInputStream != null) {
|
||||
try {
|
||||
fileInputStream.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace(); // Just print the exception for debug.
|
||||
}
|
||||
}
|
||||
}
|
||||
return sha1;
|
||||
}
|
||||
|
||||
public static void copyFile(File in, IFile out) throws CoreException, IOException {
|
||||
FileInputStream fis = new FileInputStream(in);
|
||||
if (out.exists()) {
|
||||
out.setContents(fis, true, false, null);
|
||||
} else {
|
||||
out.create(fis, true, null);
|
||||
}
|
||||
fis.close();
|
||||
}
|
||||
|
||||
public static void syncNewMappingFileToProject() throws SystemException {
|
||||
try {
|
||||
File sysMappingFiles = new File(MetadataTalendType.getSystemForderURLOfMappingsFile().getPath());
|
||||
IFolder projectMappingFolder = ResourceUtils.getProject(ProjectManager.getInstance().getCurrentProject())
|
||||
.getFolder(MetadataTalendType.PROJECT_MAPPING_FOLDER);
|
||||
File projectMappingFiles = projectMappingFolder.getFullPath().toFile();
|
||||
if (sysMappingFiles.list().length == new File(projectMappingFolder.getLocationURI()).list().length) {
|
||||
File projectMappingFiles = new File(projectMappingFolder.getLocationURI());
|
||||
if (!sysMappingFiles.exists() || !projectMappingFiles.exists()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (File sysMapping : sysMappingFiles.listFiles()) {
|
||||
IFile projectMapping = projectMappingFolder.getFile(sysMapping.getName());
|
||||
if (projectMapping.exists() && StringUtils.equals(sysMapping.getName(), "mapping_Greenplum.xml")) {
|
||||
|
||||
String sha1OfFile = DigestUtils.shaHex(projectMapping.getContents());
|
||||
String shalOfOldSystem = "8431f19215dacb3caa126778ae695954552cce2a";
|
||||
if (StringUtils.equals(sha1OfFile, shalOfOldSystem)) {
|
||||
copyFile(sysMapping, projectMapping);
|
||||
}
|
||||
}
|
||||
if (!projectMapping.exists()) {
|
||||
FileInputStream fis = null;
|
||||
try {
|
||||
|
||||
@@ -25,8 +25,10 @@ import org.apache.avro.SchemaBuilder.FieldAssembler;
|
||||
import org.apache.avro.SchemaBuilder.FieldBuilder;
|
||||
import org.apache.avro.SchemaBuilder.PropBuilder;
|
||||
import org.apache.avro.SchemaBuilder.RecordBuilder;
|
||||
import org.apache.avro.SchemaParseException;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Level;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
@@ -49,6 +51,11 @@ import orgomg.cwm.objectmodel.core.TaggedValue;
|
||||
*/
|
||||
public final class MetadataToolAvroHelper {
|
||||
|
||||
private static Logger LOGGER = Logger.getLogger(MetadataToolAvroHelper.class);
|
||||
|
||||
private static final String COLUMN = "Column";
|
||||
|
||||
private static final String TALEND_DB_COLUMN_NAME = "talend.field.dbColumnName";
|
||||
/**
|
||||
* @return An Avro schema with enriched properties from the incoming metadata table.
|
||||
*/
|
||||
@@ -65,7 +72,7 @@ public final class MetadataToolAvroHelper {
|
||||
dynamicPosition = i;
|
||||
dynColumn = column;
|
||||
} else {
|
||||
fa = convertToAvro(fa, column);
|
||||
fa = convertToAvro(fa, column, i);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
@@ -136,7 +143,7 @@ public final class MetadataToolAvroHelper {
|
||||
* Build a field into a schema using enriched properties from the incoming column.
|
||||
*/
|
||||
private static FieldAssembler<Schema> convertToAvro(FieldAssembler<Schema> fa,
|
||||
org.talend.core.model.metadata.builder.connection.MetadataColumn in) {
|
||||
org.talend.core.model.metadata.builder.connection.MetadataColumn in, int i) {
|
||||
ICoreService coreService = (ICoreService) GlobalServiceRegister.getDefault().getService(ICoreService.class);
|
||||
String label = in.getLabel();
|
||||
if (label != null && coreService != null) {
|
||||
@@ -236,7 +243,27 @@ public final class MetadataToolAvroHelper {
|
||||
}
|
||||
|
||||
type = in.isNullable() ? AvroUtils.wrapAsNullable(type) : type;
|
||||
return defaultValue == null ? fb.type(type).noDefault() : fb.type(type).withDefault(defaultValue);
|
||||
FieldAssembler<Schema> returnResult = null;
|
||||
try {
|
||||
if (defaultValue == null) {
|
||||
returnResult = fb.type(type).noDefault();
|
||||
} else {
|
||||
returnResult = fb.type(type).withDefault(defaultValue);
|
||||
}
|
||||
} catch (SchemaParseException e) {
|
||||
// if validation not pass from avro ,then generate a new name like Column0 to pass the validation, but
|
||||
// actually the display name of schema and the column name is using TALEND_DB_COLUMN_NAME
|
||||
String genColumn = COLUMN + i;
|
||||
FieldBuilder<Schema> fbNew = fa.name(genColumn);
|
||||
copyColumnProperties(fbNew, in);
|
||||
if (defaultValue == null) {
|
||||
returnResult = fbNew.type(type).noDefault();
|
||||
} else {
|
||||
returnResult = fbNew.type(type).withDefault(defaultValue);
|
||||
}
|
||||
LOGGER.info(e.getMessage() + ", use " + genColumn + " instead");
|
||||
}
|
||||
return returnResult;
|
||||
}
|
||||
|
||||
private static Schema getLogicalTypeSchema(org.talend.core.model.metadata.builder.connection.MetadataColumn column) {
|
||||
@@ -451,19 +478,16 @@ public final class MetadataToolAvroHelper {
|
||||
table.setTableType(prop);
|
||||
}
|
||||
|
||||
// Add the columns.
|
||||
List<org.talend.core.model.metadata.builder.connection.MetadataColumn> columns = new ArrayList<>(in.getFields().size());
|
||||
for (Schema.Field f : in.getFields()) {
|
||||
columns.add(convertFromAvro(f, table));
|
||||
table.getColumns().add(convertFromAvro(f, table));
|
||||
}
|
||||
boolean isDynamic = AvroUtils.isIncludeAllFields(in);
|
||||
if (isDynamic) {
|
||||
org.talend.core.model.metadata.builder.connection.MetadataColumn col = convertFromAvroForDynamic(in);
|
||||
// get dynamic position
|
||||
int dynPosition = Integer.valueOf(in.getProp(DiSchemaConstants.TALEND6_DYNAMIC_COLUMN_POSITION));
|
||||
columns.add(dynPosition, col);
|
||||
table.getColumns().add(dynPosition, col);
|
||||
}
|
||||
table.getColumns().addAll(columns);
|
||||
return table;
|
||||
}
|
||||
|
||||
@@ -574,7 +598,12 @@ public final class MetadataToolAvroHelper {
|
||||
|
||||
// Set the defaults values to the name (the only information guaranteed to be available in every field).
|
||||
col.setId(field.name());
|
||||
col.setLabel(field.name());
|
||||
String dbColumnlable = null;
|
||||
if (MetadataToolHelper.isAllowSpecificCharacters() && null != (dbColumnlable = field.getProp(TALEND_DB_COLUMN_NAME))) {
|
||||
col.setLabel(dbColumnlable);
|
||||
} else {
|
||||
col.setLabel(field.name());
|
||||
}
|
||||
col.setName(field.name());
|
||||
Schema nonnullable = AvroUtils.unwrapIfNullable(in);
|
||||
LogicalType logicalType = LogicalTypes.fromSchemaIgnoreInvalid(nonnullable);
|
||||
|
||||
@@ -280,7 +280,7 @@ public final class MetadataToolHelper {
|
||||
return isAllowSpecificCharacters() || Pattern.matches(RepositoryConstants.COLUMN_NAME_PATTERN, name);
|
||||
}
|
||||
|
||||
private static boolean isAllowSpecificCharacters() {
|
||||
public static boolean isAllowSpecificCharacters() {
|
||||
IEclipsePreferences coreUIPluginNode = new InstanceScope().getNode(ITalendCorePrefConstants.CoreUIPlugin_ID);
|
||||
return coreUIPluginNode
|
||||
.getBoolean(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS, false);
|
||||
@@ -614,6 +614,7 @@ public final class MetadataToolHelper {
|
||||
target.getListColumns().remove(targetColumn);
|
||||
newTargetColumn.setCustom(targetColumn.isCustom());
|
||||
newTargetColumn.setCustomId(targetColumn.getCustomId());
|
||||
newTargetColumn.setIgnoreCustomSort(targetColumn.isIgnoreCustomSort());
|
||||
columnsTAdd.add(newTargetColumn);
|
||||
}
|
||||
}
|
||||
@@ -773,6 +774,7 @@ public final class MetadataToolHelper {
|
||||
target.getListColumns().remove(targetColumn);
|
||||
newTargetColumn.setCustom(targetColumn.isCustom());
|
||||
newTargetColumn.setCustomId(targetColumn.getCustomId());
|
||||
newTargetColumn.setIgnoreCustomSort(targetColumn.isIgnoreCustomSort());
|
||||
columnsTAdd.add(newTargetColumn);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1071,7 +1071,10 @@ public class RepositoryToComponentProperty {
|
||||
return dbVersionString;
|
||||
} else if (EDatabaseTypeName.SYBASEASE.getDisplayName().equals(databaseType)) {
|
||||
return dbVersionString;
|
||||
} else {
|
||||
} else if (EDatabaseTypeName.GREENPLUM.getDisplayName().equals(databaseType)) {
|
||||
return dbVersionString;
|
||||
|
||||
}else {
|
||||
String driverValue = EDatabaseVersion4Drivers.getDriversStr(databaseType, dbVersionString);
|
||||
if (EDatabaseConnTemplate.ORACLE_OCI.getDBDisplayName().equals(databaseType)
|
||||
|| EDatabaseConnTemplate.ORACLE_CUSTOM.getDBDisplayName().equals(databaseType)
|
||||
@@ -1769,6 +1772,38 @@ public class RepositoryToComponentProperty {
|
||||
if ("IMPALA_DRIVER".equals(value)) {
|
||||
return connection.getParameters().get(ConnParameterKeys.IMPALA_DRIVER);
|
||||
}
|
||||
|
||||
if (value.equals("GOOGLE_PROJECT_ID")) {
|
||||
String projectId = connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HIVE_GOOGLE_PROJECT_ID);
|
||||
return getAppropriateValue(connection, projectId);
|
||||
}
|
||||
|
||||
if (value.equals("GOOGLE_CLUSTER_ID")) {
|
||||
String clusterId = connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HIVE_GOOGLE_CLUSTER_ID);
|
||||
return getAppropriateValue(connection, clusterId);
|
||||
}
|
||||
|
||||
if (value.equals("GOOGLE_REGION")) {
|
||||
String region = connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HIVE_GOOGLE_REGION);
|
||||
return getAppropriateValue(connection, region);
|
||||
}
|
||||
|
||||
if (value.equals("GOOGLE_JARS_BUCKET")) {
|
||||
String jarsBucket = connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HIVE_GOOGLE_JARS_BUCKET);
|
||||
return getAppropriateValue(connection, jarsBucket);
|
||||
}
|
||||
|
||||
if (value.equals("DEFINE_PATH_TO_GOOGLE_CREDENTIALS")) {
|
||||
String usePathToCredentials = connection.getParameters()
|
||||
.get(ConnParameterKeys.CONN_PARA_KEY_HIVE_AUTHENTICATION_DEFINE_PATH_TO_GOOGLE_CREDENTIALS);
|
||||
return Boolean.parseBoolean(usePathToCredentials);
|
||||
}
|
||||
|
||||
if (value.equals("PATH_TO_GOOGLE_CREDENTIALS")) {
|
||||
String pathToCredentials = connection.getParameters()
|
||||
.get(ConnParameterKeys.CONN_PARA_KEY_HIVE_AUTHENTICATION_PATH_TO_GOOGLE_CREDENTIALS);
|
||||
return getAppropriateValue(connection, pathToCredentials);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ public abstract class AbstractItemMigrationTask extends AbstractMigrationTask im
|
||||
* this returns all type handled by this migration task even the extended type that could benefit from this
|
||||
* migrations
|
||||
* */
|
||||
List<ERepositoryObjectType> getAllTypes() {
|
||||
protected List<ERepositoryObjectType> getAllTypes() {
|
||||
List<ERepositoryObjectType> declaredTypes = getTypes();
|
||||
ArrayList<ERepositoryObjectType> allTypes = new ArrayList<ERepositoryObjectType>(declaredTypes.size());
|
||||
allTypes.addAll(declaredTypes);
|
||||
|
||||
@@ -124,6 +124,7 @@ public enum EParameterFieldType {
|
||||
TACOKIT_BUTTON,
|
||||
TACOKIT_SUGGESTABLE_TABLE,
|
||||
TACOKIT_VALUE_SELECTION,
|
||||
TACOKIT_TABLE,
|
||||
TACOKIT_TEXT_AREA_SELECTION;
|
||||
|
||||
public String getName() {
|
||||
|
||||
@@ -232,4 +232,6 @@ public interface IElementParameter {
|
||||
public boolean isSerialized();
|
||||
|
||||
public void setSerialized(boolean isSerialized);
|
||||
|
||||
public boolean isSelectedFromItemValue();
|
||||
}
|
||||
|
||||
@@ -131,4 +131,6 @@ public interface IProcess extends IElement {
|
||||
public void checkStartNodes();
|
||||
|
||||
public String getComponentsType();
|
||||
|
||||
public INode getNodeByUniqueName(String uniqueName);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.commons.utils.VersionUtils;
|
||||
@@ -53,6 +54,7 @@ import org.talend.core.utils.BitwiseOptionUtils;
|
||||
import org.talend.designer.core.IDesignerCoreService;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ContextParameterType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ContextType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.MetadataType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.NodeType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ProcessType;
|
||||
@@ -60,6 +62,7 @@ import org.talend.designer.core.model.utils.emf.talendfile.RoutinesParameterType
|
||||
import org.talend.designer.runprocess.ItemCacheManager;
|
||||
import org.talend.repository.ProjectManager;
|
||||
import org.talend.repository.model.IProxyRepositoryFactory;
|
||||
import org.apache.commons.text.StringEscapeUtils;
|
||||
|
||||
/**
|
||||
* DOC bqian class global comment. Detailled comment
|
||||
@@ -1003,12 +1006,49 @@ public final class ProcessUtils {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static boolean isChildRouteProcess(IProcess process) {
|
||||
List n = process.getNodesOfType("tRouteInput");
|
||||
if (n!=null && n.size()!=0) {
|
||||
return true;
|
||||
if (process != null) {
|
||||
for (INode node : process.getGraphicalNodes()) {
|
||||
if ((node.getComponent().getName() != null) &&
|
||||
(node.getComponent().getName().compareTo("tRouteInput") == 0)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static String escapeJava(String input) {
|
||||
return StringEscapeUtils.escapeJava(input);
|
||||
}
|
||||
|
||||
public static boolean hasJettyEndpoint(ProcessType process) {
|
||||
|
||||
EList<NodeType> nodesList = process.getNode();
|
||||
|
||||
boolean hasJettyEndpoint = hasJettyEndpoint(nodesList);
|
||||
|
||||
return hasJettyEndpoint;
|
||||
}
|
||||
|
||||
private static boolean hasJettyEndpoint(EList<NodeType> nodesList) {
|
||||
for (NodeType node : nodesList) {
|
||||
if ("cMessagingEndpoint".equals(node.getComponentName())) {
|
||||
for (Object elementParameter : node.getElementParameter()) {
|
||||
ElementParameterType elementParameterType = (ElementParameterType)elementParameter;
|
||||
|
||||
String name = elementParameterType.getName();
|
||||
String value = elementParameterType.getValue();
|
||||
|
||||
if ("URI".equals(name) && (value != null && StringUtils.startsWith(value.trim(), "\"jetty:"))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -51,7 +51,6 @@ import org.talend.designer.core.model.utils.emf.talendfile.NodeType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ProcessType;
|
||||
import org.talend.repository.ProjectManager;
|
||||
import org.talend.repository.model.IProxyRepositoryFactory;
|
||||
import org.talend.repository.model.IRepositoryNode;
|
||||
|
||||
/**
|
||||
* This class store all relationships between jobs/joblets and other items from the repository. Be sure to update the
|
||||
@@ -102,6 +101,10 @@ public class RelationshipItemBuilder {
|
||||
|
||||
public static final String ROUTINE_RELATION = "routine"; //$NON-NLS-1$
|
||||
|
||||
public static final String ROUTINES_JAR_RELATION = "routinesJar"; //$NON-NLS-1$
|
||||
|
||||
public static final String BEANS_JAR_RELATION = "beansJar"; //$NON-NLS-1$
|
||||
|
||||
public static final String MAPPER_RELATION = "mapper"; //$NON-NLS-1$
|
||||
|
||||
public static final String SURVIVOR_RELATION = "survivorshipRuleRelation"; //$NON-NLS-1$
|
||||
|
||||
@@ -61,6 +61,7 @@ import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.properties.RegExFileConnectionItem;
|
||||
import org.talend.core.model.properties.RoutineItem;
|
||||
import org.talend.core.model.properties.RoutinesJarItem;
|
||||
import org.talend.core.model.properties.RulesItem;
|
||||
import org.talend.core.model.properties.SAPConnectionItem;
|
||||
import org.talend.core.model.properties.SQLPatternItem;
|
||||
@@ -443,8 +444,19 @@ public class ERepositoryObjectType extends DynaEnum<ERepositoryObjectType> {
|
||||
|
||||
public final static ERepositoryObjectType ROUTINES = ERepositoryObjectType.valueOf("ROUTINES"); //$NON-NLS-1$
|
||||
|
||||
public final static ERepositoryObjectType ROUTINESJAR = ERepositoryObjectType.valueOf("ROUTINESJAR"); //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* <font color="red">This value may be <b>null</b> in some licenses, <b>should add NPE check</b></font>
|
||||
*/
|
||||
public final static ERepositoryObjectType BEANS = ERepositoryObjectType.valueOf("BEANS"); //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* <font color="red">This value may be <b>null</b> in some licenses, <b>should add NPE check</b></font>
|
||||
*/
|
||||
// TODO need and register it in extension or not?
|
||||
public final static ERepositoryObjectType BEANSJAR = ERepositoryObjectType.valueOf("BEANSJAR"); //$NON-NLS-1$
|
||||
|
||||
public final static ERepositoryObjectType METADATA_HEADER_FOOTER = ERepositoryObjectType.valueOf("METADATA_HEADER_FOOTER"); //$NON-NLS-1$
|
||||
|
||||
public final static ERepositoryObjectType JOB_SCRIPT = ERepositoryObjectType.valueOf("JOB_SCRIPT"); //$NON-NLS-1$
|
||||
@@ -936,7 +948,7 @@ public class ERepositoryObjectType extends DynaEnum<ERepositoryObjectType> {
|
||||
* @return
|
||||
*/
|
||||
public static ERepositoryObjectType getItemType(Item item) {
|
||||
|
||||
// FIXME update all inner codes related callers
|
||||
ERepositoryObjectType repObjType = getTDQRepObjType(item);
|
||||
if (repObjType != null) {
|
||||
return repObjType;
|
||||
@@ -1003,6 +1015,11 @@ public class ERepositoryObjectType extends DynaEnum<ERepositoryObjectType> {
|
||||
// return BEANS;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public Object caseRoutinesJarItem(RoutinesJarItem object) {
|
||||
return ROUTINESJAR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object caseJobScriptItem(JobScriptItem object) {
|
||||
return JOB_SCRIPT;
|
||||
@@ -1505,11 +1522,66 @@ public class ERepositoryObjectType extends DynaEnum<ERepositoryObjectType> {
|
||||
if (ERepositoryObjectType.ROUTINES != null) {
|
||||
allTypes.add(ERepositoryObjectType.ROUTINES);
|
||||
}
|
||||
ERepositoryObjectType beansType = ERepositoryObjectType.valueOf("BEANS"); //$NON-NLS-1$
|
||||
if (beansType != null) {
|
||||
allTypes.add(beansType);
|
||||
if (ERepositoryObjectType.BEANS != null) {
|
||||
allTypes.add(ERepositoryObjectType.BEANS);
|
||||
}
|
||||
return allTypes;
|
||||
}
|
||||
|
||||
public static List<ERepositoryObjectType> getAllTypesOfCodesJar() {
|
||||
List<ERepositoryObjectType> allTypes = new ArrayList<ERepositoryObjectType>();
|
||||
if (ERepositoryObjectType.ROUTINESJAR != null) {
|
||||
allTypes.add(ERepositoryObjectType.ROUTINESJAR);
|
||||
}
|
||||
if (ERepositoryObjectType.BEANSJAR != null) {
|
||||
allTypes.add(ERepositoryObjectType.BEANSJAR);
|
||||
}
|
||||
return allTypes;
|
||||
}
|
||||
|
||||
public enum CodeTypeEnum {
|
||||
Routines("ROUTINESJAR", "ROUTINES"),
|
||||
Beans("BEANSJAR", "BEANS");
|
||||
|
||||
private String codeJarType;
|
||||
|
||||
private String codeType;
|
||||
|
||||
private CodeTypeEnum(String codeJarType, String codeType) {
|
||||
this.codeJarType = codeJarType;
|
||||
this.codeType = codeType;
|
||||
}
|
||||
|
||||
public static boolean isCodeRepositoryObjectTypeMatch(ERepositoryObjectType jarType, ERepositoryObjectType codeType) {
|
||||
if (jarType == null || codeType == null) {
|
||||
return false;
|
||||
}
|
||||
for (CodeTypeEnum cType : CodeTypeEnum.values()) {
|
||||
if (cType.getCodeJarType().equals(jarType.getType())) {
|
||||
return cType.getCodeType().equals(codeType.getType());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for codeJarType.
|
||||
*
|
||||
* @return the codeJarType
|
||||
*/
|
||||
public String getCodeJarType() {
|
||||
return codeJarType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for codeType.
|
||||
*
|
||||
* @return the codeType
|
||||
*/
|
||||
public String getCodeType() {
|
||||
return codeType;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,169 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.model.routines;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.core.runtime.Assert;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.properties.RoutinesJarItem;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.runtime.repository.item.ItemProductKeys;
|
||||
import org.talend.cwm.helper.ResourceHelper;
|
||||
import org.talend.designer.core.model.utils.emf.component.IMPORTType;
|
||||
import org.talend.repository.ProjectManager;
|
||||
import org.talend.repository.model.IProxyRepositoryService;
|
||||
|
||||
/**
|
||||
* Could get most of codesjar's attribute in EMF model but some are lost when model is unloaded. Store those attributes
|
||||
* in this bean.
|
||||
*/
|
||||
|
||||
public class CodesJarInfo {
|
||||
|
||||
private static final String EMPTY_DATE;
|
||||
|
||||
private String projectTechName;
|
||||
|
||||
private String id;
|
||||
|
||||
private String label;
|
||||
|
||||
private String version;
|
||||
|
||||
private ERepositoryObjectType type;
|
||||
|
||||
private List<IMPORTType> imports;
|
||||
|
||||
private String modifiedDate;
|
||||
|
||||
static {
|
||||
Calendar c = Calendar.getInstance();
|
||||
c.setTimeInMillis(0);
|
||||
EMPTY_DATE = ResourceHelper.dateFormat().format(c.getTime());
|
||||
}
|
||||
|
||||
private CodesJarInfo() {
|
||||
imports = new ArrayList<>();
|
||||
}
|
||||
|
||||
public static CodesJarInfo create(Property property) {
|
||||
Assert.isTrue(property.getItem() instanceof RoutinesJarItem);
|
||||
CodesJarInfo info = new CodesJarInfo();
|
||||
info.projectTechName = ProjectManager.getInstance().getProject(property).getTechnicalLabel();
|
||||
info.id = property.getId();
|
||||
info.label = property.getLabel();
|
||||
info.version = property.getVersion();
|
||||
info.type = ERepositoryObjectType.getItemType(property.getItem());
|
||||
if (((RoutinesJarItem) property.getItem()).getRoutinesJarType() != null) {
|
||||
info.imports.addAll(((RoutinesJarItem) property.getItem()).getRoutinesJarType().getImports());
|
||||
}
|
||||
String modifiedDate = (String) property.getAdditionalProperties().get(ItemProductKeys.DATE.getModifiedKey());
|
||||
info.modifiedDate = StringUtils.isNotBlank(modifiedDate) ? modifiedDate : EMPTY_DATE;
|
||||
return info;
|
||||
}
|
||||
|
||||
public Property getProperty() {
|
||||
try {
|
||||
IRepositoryViewObject obj = IProxyRepositoryService.get().getProxyRepositoryFactory().getLastVersion(id);
|
||||
if (obj != null) {
|
||||
return obj.getProperty();
|
||||
}
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getProjectTechName() {
|
||||
return projectTechName;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public ERepositoryObjectType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public List<IMPORTType> getImports() {
|
||||
return imports;
|
||||
}
|
||||
|
||||
public String getModifiedDate() {
|
||||
return modifiedDate;
|
||||
}
|
||||
|
||||
public boolean isInCurrentMainProject() {
|
||||
return projectTechName.equals(ProjectManager.getInstance().getCurrentProject().getTechnicalLabel());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((id == null) ? 0 : id.hashCode());
|
||||
result = prime * result + ((label == null) ? 0 : label.hashCode());
|
||||
result = prime * result + ((type == null) ? 0 : type.hashCode());
|
||||
result = prime * result + ((version == null) ? 0 : version.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
CodesJarInfo other = (CodesJarInfo) obj;
|
||||
if (id == null) {
|
||||
if (other.id != null)
|
||||
return false;
|
||||
} else if (!id.equals(other.id))
|
||||
return false;
|
||||
if (label == null) {
|
||||
if (other.label != null)
|
||||
return false;
|
||||
} else if (!label.equals(other.label))
|
||||
return false;
|
||||
if (type == null) {
|
||||
if (other.type != null)
|
||||
return false;
|
||||
} else if (!type.equals(other.type))
|
||||
return false;
|
||||
if (version == null) {
|
||||
if (other.version != null)
|
||||
return false;
|
||||
} else if (!version.equals(other.version))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,11 +12,9 @@
|
||||
// ============================================================================
|
||||
package org.talend.core.model.routines;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.talend.core.IService;
|
||||
import org.talend.core.model.general.ModuleNeeded;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -26,5 +24,4 @@ public interface IRoutinesService extends IService {
|
||||
|
||||
public Vector getAccents();
|
||||
|
||||
Set<ModuleNeeded> getRunningModules();
|
||||
}
|
||||
|
||||
@@ -120,8 +120,12 @@ public class RoutineLibraryMananger {
|
||||
initialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean needDeploy(URL fileUrl) throws IOException, Exception{
|
||||
return needDeploy(fileUrl, null);
|
||||
}
|
||||
|
||||
public boolean needDeploy(URL fileUrl) throws IOException, Exception {
|
||||
public boolean needDeploy(URL fileUrl, String mvnUrl) throws IOException, Exception {
|
||||
File file = new File(fileUrl.getFile());
|
||||
ILibraryManagerService libManagerService = null;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ILibraryManagerService.class)) {
|
||||
@@ -129,19 +133,21 @@ public class RoutineLibraryMananger {
|
||||
.getService(ILibraryManagerService.class);
|
||||
}
|
||||
if (libManagerService != null) {
|
||||
Map<String, String> sourceAndMavenUri = new HashMap<>();
|
||||
libManagerService.guessMavenRUIFromIndex(file, sourceAndMavenUri);
|
||||
String mavUri = null;
|
||||
boolean isSnapshot = false;
|
||||
for (String key : sourceAndMavenUri.keySet()) {
|
||||
if (sourceAndMavenUri.get(key).equals(file.getPath())) {
|
||||
mavUri = key;
|
||||
break;
|
||||
String mavUri = mvnUrl;
|
||||
if (StringUtils.isBlank(mvnUrl)) {
|
||||
Map<String, String> sourceAndMavenUri = new HashMap<>();
|
||||
libManagerService.guessMavenRUIFromIndex(file, sourceAndMavenUri);
|
||||
for (String key : sourceAndMavenUri.keySet()) {
|
||||
if (sourceAndMavenUri.get(key).equals(file.getPath())) {
|
||||
mavUri = key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (mavUri == null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (mavUri == null) {
|
||||
return true;
|
||||
}
|
||||
boolean isSnapshot = false;
|
||||
final MavenArtifact parseMvnUrl = MavenUrlHelper.parseMvnUrl(mavUri);
|
||||
if (parseMvnUrl != null) {
|
||||
if (parseMvnUrl.getVersion() != null && parseMvnUrl.getVersion().endsWith(MavenConstants.SNAPSHOT)) {
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
package org.talend.core.model.routines;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -20,12 +21,16 @@ import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.commons.exception.SystemException;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.process.JobInfo;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.JobletProcessItem;
|
||||
import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.properties.RoutineItem;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
@@ -204,6 +209,7 @@ public final class RoutinesUtil {
|
||||
}
|
||||
|
||||
private static RoutinesParameterType createItemInforType(RoutineItem routineItem) {
|
||||
// no need to update
|
||||
Property property = routineItem.getProperty();
|
||||
|
||||
RoutinesParameterType itemRecordType = TalendFileFactory.eINSTANCE.createRoutinesParameterType();
|
||||
@@ -353,4 +359,54 @@ public final class RoutinesUtil {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void setInnerCodes(Property property, ERepositoryObjectType type) {
|
||||
if (type == null) {
|
||||
property.getAdditionalProperties().removeKey("JAR_TYPE");
|
||||
} else {
|
||||
property.getAdditionalProperties().put("JAR_TYPE", type.name()); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
public static ERepositoryObjectType getInnerCodeType(Property property) {
|
||||
Object type = property.getAdditionalProperties().get("JAR_TYPE"); //$NON-NLS-1$
|
||||
if (type != null) {
|
||||
return ERepositoryObjectType.getAllTypesOfCodesJar().stream().filter(t -> t.name().equals(type)).findFirst().get();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isInnerCodes(Property property) {
|
||||
Object isInnerCodes = property.getAdditionalProperties().get("JAR_TYPE"); //$NON-NLS-1$
|
||||
return isInnerCodes != null;
|
||||
}
|
||||
|
||||
public static String getCodesJarLabelByInnerCode(Item innerCodeItem) {
|
||||
return new Path(innerCodeItem.getState().getPath()).segment(0);
|
||||
}
|
||||
|
||||
public static List<RoutinesParameterType> getRoutinesParametersFromJobInfo(JobInfo info) {
|
||||
Item item = null;
|
||||
if (info.getJobletProperty() != null) {
|
||||
item = info.getJobletProperty().getItem();
|
||||
} else if (info.getProcessItem() != null) {
|
||||
item = info.getProcessItem();
|
||||
}
|
||||
return getRoutinesParametersFromItem(item);
|
||||
}
|
||||
|
||||
public static List<RoutinesParameterType> getRoutinesParametersFromItem(Item item) {
|
||||
List<RoutinesParameterType> routinesParameters = null;
|
||||
if (item == null) {
|
||||
routinesParameters = Collections.emptyList();
|
||||
}
|
||||
if (item instanceof JobletProcessItem) {
|
||||
routinesParameters = ((JobletProcessItem) item).getJobletProcess().getParameters().getRoutinesParameter();
|
||||
} else if (item instanceof ProcessItem) {
|
||||
routinesParameters = ((ProcessItem) item).getProcess().getParameters().getRoutinesParameter();
|
||||
}
|
||||
return routinesParameters;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -207,6 +207,10 @@ public final class ContextParameterUtils {
|
||||
}
|
||||
|
||||
private static ScriptEngine engine = new ScriptEngineManager().getEngineByName("JavaScript");
|
||||
|
||||
public static ScriptEngine getScriptEngine() {
|
||||
return engine;
|
||||
}
|
||||
|
||||
public static String convertContext2Literal4AnyVar(final String code, final IContext context) {
|
||||
if (code == null) {
|
||||
|
||||
@@ -27,6 +27,9 @@ import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.script.ScriptEngine;
|
||||
import javax.script.ScriptException;
|
||||
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.model.components.ComponentCategory;
|
||||
import org.talend.core.model.components.IComponent;
|
||||
@@ -415,6 +418,52 @@ public class NodeUtil {
|
||||
return conns;
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC
|
||||
* <p>
|
||||
* The method searches for the incoming node connections of type
|
||||
* on a processing path and returns the first ones only
|
||||
* </p>
|
||||
*
|
||||
* @param node
|
||||
* @param type - node type to look for
|
||||
* @return
|
||||
*/
|
||||
public static List<? extends IConnection> getFirstIncomingLineConnectionsOfType(INode node, String type) {
|
||||
if (type == null)
|
||||
return new ArrayList<IConnection>();
|
||||
|
||||
Set<String> uniqueNamesDone = new HashSet<String>();
|
||||
List<? extends IConnection> allIncomingConnections = getFirstIncomingLineConnectionsOfType(node, uniqueNamesDone, type);
|
||||
|
||||
return allIncomingConnections;
|
||||
}
|
||||
|
||||
private static List<? extends IConnection> getFirstIncomingLineConnectionsOfType(INode node, Set<String> uniqueNamesDone, String type) {
|
||||
List<IConnection> conns = new ArrayList<IConnection>();
|
||||
|
||||
List<? extends IConnection> incomingConnections = node.getIncomingConnections();
|
||||
if (incomingConnections != null) {
|
||||
|
||||
for (int i = 0; i < incomingConnections.size(); i++) {
|
||||
|
||||
IConnection connection = incomingConnections.get(i);
|
||||
INode nextNode = connection.getSource();
|
||||
|
||||
if (!uniqueNamesDone.contains(nextNode.getUniqueName())) {
|
||||
uniqueNamesDone.add(nextNode.getUniqueName());
|
||||
|
||||
if (type.equals((String)nextNode.getElementParameter("COMPONENT_NAME").getValue())) {
|
||||
conns.add(connection);
|
||||
} else {
|
||||
conns.addAll(getFirstIncomingLineConnectionsOfType(nextNode, uniqueNamesDone, type)); // follow this way
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return conns;
|
||||
}
|
||||
|
||||
public static INode getFirstMergeNode(INode node) {
|
||||
INode mergeNode = null;
|
||||
for (IConnection connection : node.getOutgoingConnections()) {
|
||||
@@ -1005,6 +1054,15 @@ public class NodeUtil {
|
||||
|
||||
//suppose all memo fields are processed well already, no need to go though this with dangerous
|
||||
if (!isMemo && !org.talend.core.model.utils.ContextParameterUtils.isDynamic(value)) {
|
||||
//https://jira.talendforge.org/browse/TDI-45563
|
||||
//now can't get the var real value for "out1.A" in code generation time, so need to ignore it for runtime value log
|
||||
//here consider the performance, only do it for some special case
|
||||
if(itemFromTable && "VALUE".equals(ep.getName())) {
|
||||
if(!isValidLiteralValue(value)) {
|
||||
return "\"\"";//return empty string as can't get the real runtime value
|
||||
}
|
||||
}
|
||||
|
||||
if(value.length() > 1 && value.startsWith("\"") && value.endsWith("\"")) {
|
||||
if(itemFromTable && "ARGS".equals(ep.getName())) {
|
||||
value = value.substring(1, value.length());
|
||||
@@ -1015,7 +1073,7 @@ public class NodeUtil {
|
||||
return value;
|
||||
}
|
||||
} else {
|
||||
return "\"" + checkStringQuotationMarks(value) + "\"";
|
||||
return "\"" + checkStringQuotationMarks(value) + "\"";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1027,6 +1085,17 @@ public class NodeUtil {
|
||||
return value;
|
||||
}
|
||||
|
||||
private static boolean isValidLiteralValue(String value) {
|
||||
ScriptEngine se = ContextParameterUtils.getScriptEngine();
|
||||
if(se==null) return true;
|
||||
try {
|
||||
se.eval(value);
|
||||
return true;
|
||||
} catch (ScriptException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static String checkStringQuotationMarks(String str) {
|
||||
String result = str;
|
||||
if (result.contains("\"")) {
|
||||
|
||||
@@ -231,7 +231,12 @@ public class TalendLibsServerManager {
|
||||
return canConnect;
|
||||
}
|
||||
|
||||
public ArtifactRepositoryBean getTalentArtifactServer() {
|
||||
public boolean isProxyArtifactRepoConfigured() {
|
||||
ArtifactRepositoryBean serverBean = getProxyArtifactServer();
|
||||
return serverBean == null ? false : true;
|
||||
}
|
||||
|
||||
public ArtifactRepositoryBean getProxyArtifactServer() {
|
||||
ArtifactRepositoryBean serverBean = new ArtifactRepositoryBean();
|
||||
// get from ini file first
|
||||
String url = System.getProperty(NEXUS_PROXY_URL);
|
||||
@@ -255,9 +260,16 @@ public class TalendLibsServerManager {
|
||||
serverBean.setType(prefManager.getValue(TalendLibsServerManager.NEXUS_PROXY_TYPE));
|
||||
}
|
||||
}
|
||||
hasProxySetting = StringUtils.isNotEmpty(serverBean.getServer());
|
||||
// use default
|
||||
if (!hasProxySetting) {
|
||||
if (StringUtils.isNotEmpty(serverBean.getServer())) {
|
||||
return serverBean;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ArtifactRepositoryBean getTalentArtifactServer() {
|
||||
ArtifactRepositoryBean serverBean = getProxyArtifactServer();
|
||||
if (serverBean == null) {
|
||||
serverBean = new ArtifactRepositoryBean();
|
||||
serverBean.setServer(TALEND_LIB_SERVER);
|
||||
serverBean.setUserName(TALEND_LIB_USER);
|
||||
serverBean.setPassword(TALEND_LIB_PASSWORD);
|
||||
|
||||
@@ -114,7 +114,7 @@ public interface ITalendCorePrefConstants {
|
||||
public static final String DATA_COLLECTOR_PREVIEW = "data_collector_preview"; //$NON-NLS-1$
|
||||
|
||||
public static final String DATA_COLLECTOR = "data_collector"; //$NON-NLS-1$
|
||||
|
||||
|
||||
public static final String EXCHANGE_CHECK_TIS_VERSION = "exchange_check_tis_version"; //$NON-NLS-1$
|
||||
|
||||
public static final String EXCHANGE_DOWNLOADED_CHECK_UPDATES = "exchange_downloaded_check_updates"; //$NON-NLS-1$
|
||||
@@ -208,4 +208,8 @@ public interface ITalendCorePrefConstants {
|
||||
|
||||
public static final int ARTIFACT_PROXY_SETTING = 1;
|
||||
|
||||
public static final String NEXUS_SHARE_LIBS = "NEXUS_SHARE_LIBS";
|
||||
|
||||
public static final boolean NEXUS_SHARE_LIBS_DEFAULT = false;
|
||||
|
||||
}
|
||||
|
||||
@@ -30,5 +30,7 @@ public interface IHDistribution {
|
||||
IHDistributionVersion getHDVersion(String v, boolean byDisplay);
|
||||
|
||||
boolean useCustom();
|
||||
|
||||
boolean isSparkLocal();
|
||||
|
||||
}
|
||||
|
||||
@@ -46,6 +46,8 @@ public interface MavenConstants {
|
||||
|
||||
static final String EXCLUDE_DELETED_ITEMS = "EXCLUDE_DELETED_ITEMS";
|
||||
|
||||
static final String SKIP_FOLDERS = "SKIP_FOLDERS";
|
||||
|
||||
/*
|
||||
* for lib
|
||||
*/
|
||||
|
||||
@@ -390,4 +390,34 @@ public class MavenUrlHelper {
|
||||
}
|
||||
return rVersion;
|
||||
}
|
||||
|
||||
public static String getCoordinate(String mavenUri) {
|
||||
if (!isMvnUrl(mavenUri)) {
|
||||
mavenUri = generateMvnUrlForJarName(mavenUri);
|
||||
}
|
||||
MavenArtifact artifact = parseMvnUrl(mavenUri);
|
||||
|
||||
String groupId = artifact.getGroupId();
|
||||
String artifactId = artifact.getArtifactId();
|
||||
String type = artifact.getType();
|
||||
String version = artifact.getVersion();
|
||||
String classifier = artifact.getClassifier();
|
||||
|
||||
String separator = ":"; //$NON-NLS-1$
|
||||
String coordinate = groupId + separator + artifactId;
|
||||
if (StringUtils.isNotBlank(type)) {
|
||||
coordinate += separator + type;
|
||||
}
|
||||
if (StringUtils.isNotBlank(classifier)) {
|
||||
coordinate += separator + classifier;
|
||||
}
|
||||
if (StringUtils.isNotBlank(version)) {
|
||||
if (version.endsWith("-SNAPSHOT")) {
|
||||
version = version.substring(0, version.indexOf("-SNAPSHOT"));
|
||||
}
|
||||
coordinate += separator + version;
|
||||
}
|
||||
return coordinate;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@ public interface ITalendProcessJavaProject {
|
||||
|
||||
IJavaProject getJavaProject();
|
||||
|
||||
boolean exists();
|
||||
|
||||
IProject getProject();
|
||||
|
||||
Property getPropery();
|
||||
|
||||
@@ -28,9 +28,15 @@ public class LastGenerationInfo {
|
||||
|
||||
private HashMap<String, Set<ModuleNeeded>> modulesNeededPerJob;
|
||||
|
||||
private HashMap<String, Set<ModuleNeeded>> modulesNeededWithSubjobPerJob;
|
||||
|
||||
private HashMap<String, Set<String>> routinesNeededPerJob;
|
||||
|
||||
private HashMap<String, Set<ModuleNeeded>> modulesNeededWithSubjobPerJob;
|
||||
private HashMap<String, Set<String>> routinesNeededWithSubjobPerJob;
|
||||
|
||||
private HashMap<String, Set<ModuleNeeded>> codesJarModulesNeededPerJob;
|
||||
|
||||
private HashMap<String, Set<ModuleNeeded>> codesJarModulesNeededWithSubjobPerJob;
|
||||
|
||||
private HashMap<String, Set<ModuleNeeded>> highPriorityModuleNeededPerJob;
|
||||
|
||||
@@ -38,8 +44,6 @@ public class LastGenerationInfo {
|
||||
|
||||
private HashMap<String, Set<ModuleNeeded>> testcaseModuleNeeded;
|
||||
|
||||
private HashMap<String, Set<String>> routinesNeededWithSubjobPerJob;
|
||||
|
||||
private HashMap<String, Set<String>> contextPerJob;
|
||||
|
||||
private HashMap<String, Boolean> useDynamic, useRules;
|
||||
@@ -54,16 +58,18 @@ public class LastGenerationInfo {
|
||||
|
||||
private LastGenerationInfo() {
|
||||
modulesNeededPerJob = new HashMap<String, Set<ModuleNeeded>>();
|
||||
contextPerJob = new HashMap<String, Set<String>>();
|
||||
modulesNeededWithSubjobPerJob = new HashMap<String, Set<ModuleNeeded>>();
|
||||
contextPerJob = new HashMap<>();
|
||||
modulesNeededWithSubjobPerJob = new HashMap<>();
|
||||
highPriorityModuleNeededPerJob = new HashMap<>();
|
||||
highPriorityModuleNeeded = new HashMap<>();
|
||||
testcaseModuleNeeded = new HashMap<>();
|
||||
lastGeneratedjobs = new HashSet<JobInfo>();
|
||||
routinesNeededPerJob = new HashMap<String, Set<String>>();
|
||||
routinesNeededWithSubjobPerJob = new HashMap<String, Set<String>>();
|
||||
useDynamic = new HashMap<String, Boolean>();
|
||||
useRules = new HashMap<String, Boolean>();
|
||||
lastGeneratedjobs = new HashSet<>();
|
||||
routinesNeededPerJob = new HashMap<>();
|
||||
routinesNeededWithSubjobPerJob = new HashMap<>();
|
||||
codesJarModulesNeededPerJob = new HashMap<>();
|
||||
codesJarModulesNeededWithSubjobPerJob = new HashMap<>();
|
||||
useDynamic = new HashMap<>();
|
||||
useRules = new HashMap<>();
|
||||
}
|
||||
|
||||
public static LastGenerationInfo getInstance() {
|
||||
@@ -74,10 +80,11 @@ public class LastGenerationInfo {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the modulesNeededPerJob
|
||||
*/
|
||||
// TODO check callers to see if need to add operations for codejars
|
||||
public Set<ModuleNeeded> getModulesNeededWithSubjobPerJob(String jobId, String jobVersion) {
|
||||
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
if (!modulesNeededWithSubjobPerJob.containsKey(key)) {
|
||||
modulesNeededWithSubjobPerJob.put(key, new HashSet<ModuleNeeded>());
|
||||
@@ -85,6 +92,20 @@ public class LastGenerationInfo {
|
||||
return modulesNeededWithSubjobPerJob.get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the modulesNeededWithSubjobPerJob.
|
||||
*
|
||||
* @param modulesNeededWithSubjobPerJob the modulesNeededWithSubjobPerJob to set
|
||||
*/
|
||||
public void setModulesNeededWithSubjobPerJob(String jobId, String jobVersion, Set<ModuleNeeded> modulesNeeded) {
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
if (modulesNeeded == null) {
|
||||
modulesNeededWithSubjobPerJob.put(key, null);
|
||||
} else {
|
||||
modulesNeededWithSubjobPerJob.put(key, new HashSet<ModuleNeeded>(modulesNeeded));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the modulesNeededPerJob
|
||||
@@ -97,19 +118,6 @@ public class LastGenerationInfo {
|
||||
return modulesNeededPerJob.get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for contextPerJob.
|
||||
*
|
||||
* @return the contextPerJob
|
||||
*/
|
||||
public Set<String> getContextPerJob(String jobId, String jobVersion) {
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
if (!contextPerJob.containsKey(key)) {
|
||||
contextPerJob.put(key, new HashSet<String>());
|
||||
}
|
||||
return contextPerJob.get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the modulesNeededPerJob.
|
||||
*
|
||||
@@ -121,17 +129,16 @@ public class LastGenerationInfo {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the modulesNeededWithSubjobPerJob.
|
||||
* Getter for contextPerJob.
|
||||
*
|
||||
* @param modulesNeededWithSubjobPerJob the modulesNeededWithSubjobPerJob to set
|
||||
* @return the contextPerJob
|
||||
*/
|
||||
public void setModulesNeededWithSubjobPerJob(String jobId, String jobVersion, Set<ModuleNeeded> modulesNeeded) {
|
||||
public Set<String> getContextPerJob(String jobId, String jobVersion) {
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
if (modulesNeeded == null) {
|
||||
modulesNeededWithSubjobPerJob.put(key, null);
|
||||
} else {
|
||||
modulesNeededWithSubjobPerJob.put(key, new HashSet<ModuleNeeded>(modulesNeeded));
|
||||
if (!contextPerJob.containsKey(key)) {
|
||||
contextPerJob.put(key, new HashSet<String>());
|
||||
}
|
||||
return contextPerJob.get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -241,6 +248,64 @@ public class LastGenerationInfo {
|
||||
return routinesNeededPerJob.get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the routinesNeededPerJob.
|
||||
*
|
||||
* @param modulesNeededPerJob the modulesNeededPerJob to set
|
||||
*/
|
||||
public void setRoutinesNeededPerJob(String jobId, String jobVersion, Set<String> modulesNeeded) {
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
routinesNeededPerJob.put(key, new HashSet<String>(modulesNeeded));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the modulesNeededPerJob
|
||||
*/
|
||||
public Set<String> getRoutinesNeededWithSubjobPerJob(String jobId, String jobVersion) {
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
if (!routinesNeededWithSubjobPerJob.containsKey(key)) {
|
||||
routinesNeededWithSubjobPerJob.put(key, new HashSet<String>());
|
||||
}
|
||||
return routinesNeededWithSubjobPerJob.get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the routinesNeededPerJob.
|
||||
*
|
||||
* @param modulesNeededPerJob the modulesNeededPerJob to set
|
||||
*/
|
||||
public void setRoutinesNeededWithSubjobPerJob(String jobId, String jobVersion, Set<String> modulesNeeded) {
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
routinesNeededWithSubjobPerJob.put(key, new HashSet<String>(modulesNeeded));
|
||||
}
|
||||
|
||||
public Set<ModuleNeeded> getCodesJarModulesNeededPerJob(String jobId, String jobVersion) {
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
if (!codesJarModulesNeededPerJob.containsKey(key)) {
|
||||
codesJarModulesNeededPerJob.put(key, new HashSet<>());
|
||||
}
|
||||
return codesJarModulesNeededPerJob.get(key);
|
||||
}
|
||||
|
||||
public void setCodesJarModulesNeededPerJob(String jobId, String jobVersion, Set<ModuleNeeded> modulesNeeded) {
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
codesJarModulesNeededPerJob.put(key, new HashSet<>(modulesNeeded));
|
||||
}
|
||||
|
||||
public Set<ModuleNeeded> getCodesJarModulesNeededWithSubjobPerJob(String jobId, String jobVersion) {
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
if (!codesJarModulesNeededWithSubjobPerJob.containsKey(key)) {
|
||||
codesJarModulesNeededWithSubjobPerJob.put(key, new HashSet<>());
|
||||
}
|
||||
return codesJarModulesNeededWithSubjobPerJob.get(key);
|
||||
}
|
||||
|
||||
public void setCodesJarModulesNeededWithSubjobPerJob(String jobId, String jobVersion, Set<ModuleNeeded> modulesNeeded) {
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
codesJarModulesNeededWithSubjobPerJob.put(key, new HashSet<>(modulesNeeded));
|
||||
}
|
||||
|
||||
public Set<ModuleNeeded> getHighPriorityModuleNeededPerJob(String jobId, String jobVersion) {
|
||||
String key = getProcessKey(jobId, jobVersion);
|
||||
if (!highPriorityModuleNeededPerJob.containsKey(key)) {
|
||||
@@ -295,38 +360,6 @@ public class LastGenerationInfo {
|
||||
return pureJobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the routinesNeededPerJob.
|
||||
*
|
||||
* @param modulesNeededPerJob the modulesNeededPerJob to set
|
||||
*/
|
||||
public void setRoutinesNeededPerJob(String jobId, String jobVersion, Set<String> modulesNeeded) {
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
routinesNeededPerJob.put(key, new HashSet<String>(modulesNeeded));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the modulesNeededPerJob
|
||||
*/
|
||||
public Set<String> getRoutinesNeededWithSubjobPerJob(String jobId, String jobVersion) {
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
if (!routinesNeededWithSubjobPerJob.containsKey(key)) {
|
||||
routinesNeededWithSubjobPerJob.put(key, new HashSet<String>());
|
||||
}
|
||||
return routinesNeededWithSubjobPerJob.get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the routinesNeededPerJob.
|
||||
*
|
||||
* @param modulesNeededPerJob the modulesNeededPerJob to set
|
||||
*/
|
||||
public void setRoutinesNeededWithSubjobPerJob(String jobId, String jobVersion, Set<String> modulesNeeded) {
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
routinesNeededWithSubjobPerJob.put(key, new HashSet<String>(modulesNeeded));
|
||||
}
|
||||
|
||||
public void clearCaches() {
|
||||
clearHighPriorityModuleNeeded();
|
||||
modulesNeededPerJob.clear();
|
||||
|
||||
@@ -51,6 +51,8 @@ public interface TalendProcessArgumentConstant {
|
||||
static final String ARG_NEED_XMLMAPPINGS = "NEED_XMLMAPPINGS";
|
||||
|
||||
static final String ARG_NEED_RULES = "NEED_RULES";
|
||||
|
||||
static final String ARG_NEED_JETTY_SERVER = "NEED_JETTY_SERVER";
|
||||
|
||||
static final String ARG_ENABLE_WATCH = "ENABLE_WATCH";
|
||||
|
||||
|
||||
@@ -74,4 +74,10 @@ public interface TalendProcessOptionConstants {
|
||||
|
||||
public static final int MODULES_EXCLUDE_SHADED = 1 << 5;
|
||||
|
||||
/**
|
||||
* NOTE with this option, still won't get codesjar modules of related joblet TODO check all callers to find a way to
|
||||
* include those
|
||||
*/
|
||||
public static final int MODULES_WITH_CODESJAR = 1 << 6;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.runtime.services;
|
||||
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.IService;
|
||||
import org.talend.core.model.properties.RoutineItem;
|
||||
import org.talend.core.model.routines.CodesJarInfo;
|
||||
|
||||
public interface IDesignerMavenService extends IService {
|
||||
|
||||
String getCodesJarPackageByInnerCode(RoutineItem innerCodeItem);
|
||||
|
||||
String getImportGAVPackageForCodesJar(CodesJarInfo info);
|
||||
|
||||
void updateCodeJarMavenProject(CodesJarInfo info, boolean needReSync) throws Exception;
|
||||
|
||||
public static IDesignerMavenService get() {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerMavenService.class)) {
|
||||
return GlobalServiceRegister.getDefault().getService(IDesignerMavenService.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,7 +13,10 @@
|
||||
package org.talend.core.runtime.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
@@ -25,6 +28,7 @@ import org.talend.core.model.components.IComponentsFactory;
|
||||
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||
import org.talend.core.service.IUpdateService;
|
||||
import org.talend.utils.io.FilesUtils;
|
||||
import org.talend.utils.string.DigestUtil;
|
||||
|
||||
public class SharedStudioUtils {
|
||||
|
||||
@@ -84,6 +88,29 @@ public class SharedStudioUtils {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isNeedCleanOnSharedMode() {
|
||||
if (SharedStudioUtils.isSharedStudioMode()) {
|
||||
boolean isNeedClean = installedPatch();
|
||||
String studioArtifactsFileSha256Hex = getStudioArtifactsFileSha256Hex();
|
||||
if (updateArtifactsFileSha256Hex(studioArtifactsFileSha256Hex)) {
|
||||
isNeedClean = true;
|
||||
}
|
||||
return isNeedClean;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean updateArtifactsFileSha256Hex(String studioArtifactsFileSha256Hex) {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IUpdateService.class)) {
|
||||
IUpdateService updateService = GlobalServiceRegister.getDefault().getService(IUpdateService.class);
|
||||
try {
|
||||
return updateService.updateArtifactsFileSha256Hex(new NullProgressMonitor(), studioArtifactsFileSha256Hex);
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static boolean installedPatch() {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IUpdateService.class)) {
|
||||
IUpdateService updateService = GlobalServiceRegister.getDefault().getService(IUpdateService.class);
|
||||
@@ -108,4 +135,37 @@ public class SharedStudioUtils {
|
||||
File extchangeFolder = new File (componentFolder, path.toOSString());
|
||||
return extchangeFolder;
|
||||
}
|
||||
|
||||
public static IPath getTempFolderPath() {
|
||||
if (SharedStudioUtils.isSharedStudioMode()) {
|
||||
Path wsPath = new Path(Platform.getInstanceLocation().getURL().getPath());
|
||||
return wsPath.append("temp");
|
||||
} else {
|
||||
return new Path(System.getProperty("user.dir")).append("temp");
|
||||
}
|
||||
}
|
||||
|
||||
public static String getStudioArtifactsFileSha256Hex() {
|
||||
File studioArtifactsFile = new File(Platform.getInstallLocation().getURL().getPath(), "artifacts.xml");//$NON-NLS-1$
|
||||
if (studioArtifactsFile.exists()) {
|
||||
InputStream inputStream = null;
|
||||
try {
|
||||
inputStream = new FileInputStream(studioArtifactsFile);
|
||||
return DigestUtil.sha256Hex(inputStream);
|
||||
} catch (FileNotFoundException e) {
|
||||
ExceptionHandler.process(e);
|
||||
} catch (IOException e) {
|
||||
ExceptionHandler.process(e);
|
||||
} finally {
|
||||
if (inputStream != null) {
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (IOException ex) {
|
||||
ExceptionHandler.process(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,4 +47,6 @@ public interface ICoreUIService extends IService {
|
||||
String getPreferenceValue(String key);
|
||||
|
||||
void loadComponentsFromProviders(ERepositoryObjectType type);
|
||||
|
||||
void resetDataCollectorData();
|
||||
}
|
||||
|
||||
@@ -38,4 +38,12 @@ public interface IDQComponentService extends IService {
|
||||
* @param node The node which need to be modified
|
||||
*/
|
||||
void correctlyCustomMatcherParameter(NodeType node);
|
||||
|
||||
/**
|
||||
* Change the attribute of MatchingData and use Integer value instead of double value.
|
||||
*
|
||||
* @param node The node which need to be modified
|
||||
*/
|
||||
void covertConfindWeight2Int(NodeType node);
|
||||
|
||||
}
|
||||
|
||||
@@ -17,9 +17,11 @@ import java.nio.file.Path;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.talend.core.IService;
|
||||
import org.talend.core.model.components.IComponent;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
|
||||
/**
|
||||
* For documentation, see implementation in org.talend.sdk.component.studio-integration plugin
|
||||
@@ -33,4 +35,6 @@ public interface ITaCoKitDependencyService extends IService {
|
||||
Stream<IComponent> getJobComponents(Item item);
|
||||
|
||||
Path findM2Path();
|
||||
|
||||
Image getTaCoKitImageByRepositoryType(ERepositoryObjectType repObjType);
|
||||
}
|
||||
|
||||
@@ -24,5 +24,7 @@ public interface IUpdateService extends IService {
|
||||
public boolean syncSharedStudioLibraryInPatch(IProgressMonitor monitor) throws Exception;
|
||||
|
||||
public String getSharedStudioMissingPatchVersion();
|
||||
|
||||
public boolean updateArtifactsFileSha256Hex(IProgressMonitor monitor, String studioArtifactsFileShaCodeHex);
|
||||
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.IService;
|
||||
import org.talend.core.model.components.IComponent;
|
||||
import org.talend.core.model.general.ModuleNeeded;
|
||||
@@ -135,4 +136,11 @@ public interface ITestContainerProviderService extends IService {
|
||||
|
||||
public List<NodeType> getOriginalNodes(ProcessType process);
|
||||
|
||||
public static ITestContainerProviderService get() {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
|
||||
return GlobalServiceRegister.getDefault().getService(ITestContainerProviderService.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
package org.talend.core.utils;
|
||||
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.properties.RoutineItem;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.model.routines.CodesJarInfo;
|
||||
import org.talend.core.model.routines.RoutinesUtil;
|
||||
import org.talend.designer.runprocess.IRunProcessService;
|
||||
import org.talend.repository.ProjectManager;
|
||||
import org.talend.repository.model.IProxyRepositoryFactory;
|
||||
import org.talend.repository.model.IProxyRepositoryService;
|
||||
|
||||
public class CodesJarResourceCache {
|
||||
|
||||
private static final Set<CodesJarInfo> CACHE = new LinkedHashSet<>();
|
||||
|
||||
private static final Object LOCK = new Object();
|
||||
|
||||
private static boolean isListenerAdded;
|
||||
|
||||
private static PropertyChangeListener listener;
|
||||
|
||||
public static void initCodesJarCache() {
|
||||
synchronized (LOCK) {
|
||||
CACHE.clear();
|
||||
List<Project> allProjects = new ArrayList<>();
|
||||
allProjects.addAll(ProjectManager.getInstance().getAllReferencedProjects(true));
|
||||
allProjects.add(ProjectManager.getInstance().getCurrentProject());
|
||||
IProxyRepositoryFactory factory = IProxyRepositoryService.get().getProxyRepositoryFactory();
|
||||
try {
|
||||
for (Project project : allProjects) {
|
||||
for (ERepositoryObjectType codesJarType : ERepositoryObjectType.getAllTypesOfCodesJar()) {
|
||||
List<IRepositoryViewObject> objects = factory.getAllCodesJars(project, codesJarType);
|
||||
for (IRepositoryViewObject obj : objects) {
|
||||
CACHE.add(CodesJarInfo.create(obj.getProperty()));
|
||||
}
|
||||
}
|
||||
}
|
||||
addCodesJarChangeListener();
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Set<CodesJarInfo> getAllCodesJars() {
|
||||
synchronized (LOCK) {
|
||||
return new LinkedHashSet<>(CACHE);
|
||||
}
|
||||
}
|
||||
|
||||
public static CodesJarInfo getCodesJarById(String id) {
|
||||
synchronized (LOCK) {
|
||||
Optional<CodesJarInfo> optional = CACHE.stream().filter(info -> info.getId().equals(id)).findFirst();
|
||||
if (optional.isPresent()) {
|
||||
return optional.get();
|
||||
}
|
||||
ExceptionHandler.process(new Exception("Codes jar id [" + id + "] is not found!")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static CodesJarInfo getCodesJarByLabel(ERepositoryObjectType type, String projectTechName, String label) {
|
||||
synchronized (LOCK) {
|
||||
Optional<CodesJarInfo> optional = CACHE.stream().filter(info -> info.getType() == type
|
||||
&& info.getLabel().equals(label) && info.getProjectTechName().equals(projectTechName)).findFirst();
|
||||
if (optional.isPresent()) {
|
||||
return optional.get();
|
||||
}
|
||||
ExceptionHandler.process(new Exception("Codes jar [" + label + "] is not found!")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static CodesJarInfo getCodesJarByInnerCode(RoutineItem routineItem) throws PersistenceException {
|
||||
String codesJarName = RoutinesUtil.getCodesJarLabelByInnerCode(routineItem);
|
||||
String projectTechName = ProjectManager.getInstance().getProject(routineItem).getTechnicalLabel();
|
||||
Optional<CodesJarInfo> optional = getAllCodesJars().stream()
|
||||
.filter(info -> info.getLabel().equals(codesJarName) && info.getProjectTechName().equals(projectTechName))
|
||||
.findFirst();
|
||||
if (optional.isPresent()) {
|
||||
return optional.get();
|
||||
}
|
||||
ExceptionHandler.process(new Exception("Codes jar [" + routineItem.getProperty().getLabel() + "] is not found!")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void addToCache(Property newProperty) {
|
||||
synchronized (LOCK) {
|
||||
Iterator<CodesJarInfo> iterator = CACHE.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
CodesJarInfo oldInfo = iterator.next();
|
||||
if (newProperty.getId().equals(oldInfo.getId()) && newProperty.getLabel().equals(oldInfo.getLabel())
|
||||
&& newProperty.getVersion().equals(oldInfo.getVersion())) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
CACHE.add(CodesJarInfo.create(newProperty));
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateCache(String oldId, String oldLabel, String oldVersion, Property newProperty) {
|
||||
synchronized (LOCK) {
|
||||
Iterator<CodesJarInfo> iterator = CACHE.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
CodesJarInfo oldInfo = iterator.next();
|
||||
if ((oldId == null || (oldId != null && oldId.equals(oldInfo.getId()))) && oldLabel.equals(oldInfo.getLabel())
|
||||
&& oldVersion.equals(oldInfo.getVersion())) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
CACHE.add(CodesJarInfo.create(newProperty));
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeCache(Property property) {
|
||||
synchronized (LOCK) {
|
||||
Iterator<CodesJarInfo> iterator = CACHE.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
CodesJarInfo oldInfo = iterator.next();
|
||||
if (oldInfo.getId().equals(property.getId()) && oldInfo.getLabel().equals(property.getLabel())
|
||||
&& oldInfo.getVersion().equals(property.getVersion())) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void addCodesJarChangeListener() {
|
||||
if (!isListenerAdded) {
|
||||
synchronized (LOCK) {
|
||||
if (!isListenerAdded) {
|
||||
if (listener == null) {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
|
||||
IRunProcessService service = GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
|
||||
listener = service.addCodesJarChangeListener();
|
||||
isListenerAdded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,6 +20,7 @@ import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -36,6 +37,7 @@ import org.talend.commons.utils.VersionUtils;
|
||||
import org.talend.commons.utils.encoding.CharsetToolkit;
|
||||
import org.talend.commons.utils.generation.JavaUtils;
|
||||
import org.talend.commons.utils.resource.FileExtensions;
|
||||
import org.talend.commons.utils.workbench.resources.ResourceUtils;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.IService;
|
||||
import org.talend.core.model.general.Project;
|
||||
@@ -46,14 +48,19 @@ import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.properties.RoutineItem;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.model.routines.CodesJarInfo;
|
||||
import org.talend.core.model.routines.RoutinesUtil;
|
||||
import org.talend.core.model.utils.JavaResourcesHelper;
|
||||
import org.talend.core.runtime.process.ITalendProcessJavaProject;
|
||||
import org.talend.core.runtime.repository.item.ItemProductKeys;
|
||||
import org.talend.core.runtime.services.IDesignerMavenService;
|
||||
import org.talend.core.runtime.util.ItemDateParser;
|
||||
import org.talend.core.ui.branding.IBrandingService;
|
||||
import org.talend.core.utils.CodesJarResourceCache;
|
||||
import org.talend.designer.core.ICamelDesignerCoreService;
|
||||
import org.talend.designer.runprocess.IRunProcessService;
|
||||
import org.talend.repository.ProjectManager;
|
||||
import org.talend.repository.model.IProxyRepositoryFactory;
|
||||
import org.talend.repository.model.IRepositoryService;
|
||||
import org.talend.repository.model.RepositoryNodeUtilities;
|
||||
|
||||
@@ -141,6 +148,9 @@ public abstract class AbstractRoutineSynchronizer implements ITalendSynchronizer
|
||||
}
|
||||
|
||||
protected IFile getRoutineFile(RoutineItem routineItem, String projectTechName) throws SystemException {
|
||||
if (RoutinesUtil.isInnerCodes(routineItem.getProperty())) {
|
||||
return getInnerCodeFile(routineItem);
|
||||
}
|
||||
ITalendProcessJavaProject talendProcessJavaProject = getRunProcessService()
|
||||
.getTalendCodeJavaProject(ERepositoryObjectType.getItemType(routineItem), projectTechName);
|
||||
if (talendProcessJavaProject == null) {
|
||||
@@ -150,6 +160,24 @@ public abstract class AbstractRoutineSynchronizer implements ITalendSynchronizer
|
||||
return routineFolder.getFile(routineItem.getProperty().getLabel() + JavaUtils.JAVA_EXTENSION);
|
||||
}
|
||||
|
||||
protected IFile getInnerCodeFile(RoutineItem routineItem) throws SystemException {
|
||||
CodesJarInfo info = CodesJarResourceCache.getCodesJarByInnerCode(routineItem);
|
||||
ITalendProcessJavaProject talendProcessJavaProject = getRunProcessService().getTalendCodesJarJavaProject(info);
|
||||
if (talendProcessJavaProject == null) {
|
||||
return null;
|
||||
}
|
||||
IFolder routineFolder = talendProcessJavaProject.getSrcSubFolder(null, getInnerCodePackage(routineItem));
|
||||
return routineFolder.getFile(routineItem.getProperty().getLabel() + JavaUtils.JAVA_EXTENSION);
|
||||
}
|
||||
|
||||
private String getInnerCodePackage(RoutineItem innerCodeItem) {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerMavenService.class)) {
|
||||
IDesignerMavenService service = GlobalServiceRegister.getDefault().getService(IDesignerMavenService.class);
|
||||
return service.getCodesJarPackageByInnerCode(innerCodeItem);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private IFile getProcessFile(ProcessItem item) throws SystemException {
|
||||
final ITalendProcessJavaProject talendProcessJavaProject = getRunProcessService().getTalendJobJavaProject(item.getProperty());
|
||||
if (talendProcessJavaProject == null) {
|
||||
@@ -173,15 +201,23 @@ public abstract class AbstractRoutineSynchronizer implements ITalendSynchronizer
|
||||
|
||||
@Override
|
||||
public IFile getRoutinesFile(Item item) throws SystemException {
|
||||
// from talend project
|
||||
if (item instanceof RoutineItem) {
|
||||
final RoutineItem routineItem = (RoutineItem) item;
|
||||
final IProject project = ResourcesPlugin.getWorkspace().getRoot()
|
||||
.getProject(ProjectManager.getInstance().getProject(routineItem).getTechnicalLabel());
|
||||
IFolder folder = project
|
||||
.getFolder(ERepositoryObjectType.getFolderName(ERepositoryObjectType.getItemType(routineItem)));
|
||||
ERepositoryObjectType type;
|
||||
ERepositoryObjectType innerCodeType = RoutinesUtil.getInnerCodeType(item.getProperty());
|
||||
if (innerCodeType != null) {
|
||||
type = innerCodeType;
|
||||
} else {
|
||||
type = ERepositoryObjectType.getItemType(routineItem);
|
||||
}
|
||||
IFolder folder = project.getFolder(ERepositoryObjectType.getFolderName(type));
|
||||
IPath ipath = RepositoryNodeUtilities.getPath(routineItem.getProperty().getId());
|
||||
if (ipath == null)
|
||||
if (ipath == null) {
|
||||
return null;
|
||||
}
|
||||
final String folderPath = ipath.toString();
|
||||
if (folderPath != null && !folderPath.trim().isEmpty()) {
|
||||
folder = folder.getFolder(folderPath);
|
||||
@@ -232,14 +268,39 @@ public abstract class AbstractRoutineSynchronizer implements ITalendSynchronizer
|
||||
}
|
||||
}
|
||||
|
||||
protected void syncInnerCodeItems(boolean forceUpdate) throws SystemException {
|
||||
IProxyRepositoryFactory factory = getRepositoryService().getProxyRepositoryFactory();
|
||||
for (CodesJarInfo info : CodesJarResourceCache.getAllCodesJars()) {
|
||||
List<IRepositoryViewObject> innerCodesObjects = factory.getAllInnerCodes(info);
|
||||
for (IRepositoryViewObject codesObj : innerCodesObjects) {
|
||||
RoutineItem codeItem = (RoutineItem) codesObj.getProperty().getItem();
|
||||
syncRoutine(codeItem, info.getProjectTechName(), true, forceUpdate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void doSyncRoutine(RoutineItem routineItem, String projectTechName, boolean copyToTemp) throws SystemException {
|
||||
try {
|
||||
IFile file = getRoutineFile(routineItem, projectTechName);
|
||||
if (file == null) {
|
||||
return;
|
||||
}
|
||||
File itemFile = null;
|
||||
if (routineItem.eResource() == null) {
|
||||
return;
|
||||
if (!RoutinesUtil.isInnerCodes(routineItem.getProperty())) {
|
||||
return;
|
||||
}
|
||||
CodesJarInfo info = CodesJarResourceCache.getCodesJarByInnerCode(routineItem);
|
||||
IFolder innerCodeFolder = ResourceUtils.getFolder(ResourceUtils.getProject(info.getProjectTechName()),
|
||||
ERepositoryObjectType.getFolderName(info.getType()) + "/" + info.getLabel(), true);
|
||||
IFile innerCodeFile = innerCodeFolder
|
||||
.getFile(routineItem.getProperty().getLabel() + "_" + routineItem.getProperty().getVersion() + ".item");
|
||||
if (innerCodeFile.exists()) {
|
||||
itemFile = innerCodeFile.getLocation().toFile();
|
||||
}
|
||||
if (itemFile == null) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
Property property = routineItem.getProperty();
|
||||
Date modifiedDate = ItemDateParser.parseAdditionalDate(property, ItemProductKeys.DATE.getModifiedKey());
|
||||
@@ -252,9 +313,11 @@ public abstract class AbstractRoutineSynchronizer implements ITalendSynchronizer
|
||||
}
|
||||
|
||||
if (copyToTemp) {
|
||||
String uri = routineItem.eResource().getURI().trimFileExtension()
|
||||
.appendFileExtension(FileExtensions.ITEM_EXTENSION).toPlatformString(false);
|
||||
File itemFile = ResourcesPlugin.getWorkspace().getRoot().getLocation().append(uri).toFile();
|
||||
if (itemFile == null) {
|
||||
String uri = routineItem.eResource().getURI().trimFileExtension()
|
||||
.appendFileExtension(FileExtensions.ITEM_EXTENSION).toPlatformString(false);
|
||||
itemFile = ResourcesPlugin.getWorkspace().getRoot().getLocation().append(uri).toFile();
|
||||
}
|
||||
byte[] buf = routineItem.getContent().getInnerContent();
|
||||
String charset = null;
|
||||
if (itemFile.exists()) {
|
||||
@@ -292,8 +355,13 @@ public abstract class AbstractRoutineSynchronizer implements ITalendSynchronizer
|
||||
@Override
|
||||
public void deleteRoutinefile(IRepositoryViewObject objToDelete) {
|
||||
Item item = objToDelete.getProperty().getItem();
|
||||
if (RoutinesUtil.isInnerCodes(item.getProperty())) {
|
||||
deleteInnerCodeFile(item);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
ITalendProcessJavaProject talendProcessJavaProject = getRunProcessService().getTalendCodeJavaProject(ERepositoryObjectType.getItemType(item));
|
||||
ITalendProcessJavaProject talendProcessJavaProject = getRunProcessService()
|
||||
.getTalendCodeJavaProject(ERepositoryObjectType.getItemType(item));
|
||||
if (talendProcessJavaProject == null) {
|
||||
return;
|
||||
}
|
||||
@@ -306,6 +374,15 @@ public abstract class AbstractRoutineSynchronizer implements ITalendSynchronizer
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteInnerCodeFile(Item item) {
|
||||
try {
|
||||
IFile file = getInnerCodeFile((RoutineItem) item);
|
||||
file.delete(true, null);
|
||||
} catch (CoreException | SystemException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isRoutineUptodate(RoutineItem routineItem) {
|
||||
Date refDate = getRefDate(routineItem);
|
||||
if (refDate == null) {
|
||||
|
||||
@@ -53,4 +53,8 @@ public interface ITalendSynchronizer {
|
||||
|
||||
void deleteRoutinefile(IRepositoryViewObject objToDelete);
|
||||
|
||||
void syncAllInnerCodes() throws SystemException;
|
||||
|
||||
void syncAllInnerCodesForLogOn() throws SystemException;
|
||||
|
||||
}
|
||||
|
||||
@@ -43,6 +43,8 @@ public interface ICamelDesignerCoreService extends IService {
|
||||
|
||||
public boolean isInstanceofCamelBeans(Item item);
|
||||
|
||||
boolean isInstanceofCamelBeansJar(Item item);
|
||||
|
||||
/**
|
||||
* Synchronized Route resource
|
||||
*
|
||||
|
||||
@@ -157,7 +157,9 @@ public interface IDesignerCoreService extends IService {
|
||||
|
||||
public void reloadParamFromProjectSettings(ParametersType processType, String paramName);
|
||||
|
||||
public Set<ModuleNeeded> getNeededLibrariesForProcess(IProcess process, boolean withChildrens);
|
||||
public Set<ModuleNeeded> getNeededLibrariesForProcess(IProcess process, int options);
|
||||
|
||||
public Set<ModuleNeeded> getCodesJarNeededLibrariesForProcess(Item item);
|
||||
|
||||
public Set<ModuleNeeded> getNeededModules(INode node, boolean withChildrens);
|
||||
|
||||
|
||||
@@ -299,6 +299,8 @@ public interface IProcessor {
|
||||
String[] getJVMArgs();
|
||||
|
||||
Set<ModuleNeeded> getNeededModules(int options);
|
||||
|
||||
Set<ModuleNeeded> getCodesJarModulesNeededOfJoblets();
|
||||
|
||||
public void updateModulesAfterSetLog4j(Collection<ModuleNeeded> modulesNeeded);
|
||||
|
||||
@@ -306,6 +308,8 @@ public interface IProcessor {
|
||||
|
||||
Set<JobInfo> getBuildFirstChildrenJobs();
|
||||
|
||||
Set<JobInfo> getBuildChildrenJobsAndJoblets();
|
||||
|
||||
/**
|
||||
* used for old build job system. after maven build, can be removed.
|
||||
*/
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
// ============================================================================
|
||||
package org.talend.designer.runprocess;
|
||||
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -37,8 +38,8 @@ import org.talend.core.model.process.IProcess2;
|
||||
import org.talend.core.model.process.JobInfo;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.properties.RoutineItem;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.routines.CodesJarInfo;
|
||||
import org.talend.core.runtime.process.ITalendProcessJavaProject;
|
||||
import org.talend.core.runtime.projectsetting.ProjectPreferenceManager;
|
||||
|
||||
@@ -131,7 +132,7 @@ public interface IRunProcessService extends IService {
|
||||
public void updateLibraries(Set<ModuleNeeded> jobModuleList, IProcess process, Set<ModuleNeeded> alreadyRetrievedModules)
|
||||
throws ProcessorException;
|
||||
|
||||
public void updateLibraries(RoutineItem routineItem);
|
||||
public void updateLibraries(Item routineItem);
|
||||
|
||||
public void refreshView();
|
||||
|
||||
@@ -191,7 +192,7 @@ public interface IRunProcessService extends IService {
|
||||
@Deprecated
|
||||
public void buildJavaProject();
|
||||
|
||||
public void buildCodesJavaProject(IProgressMonitor monitor);
|
||||
public void buildCodesJavaProject(IProgressMonitor monitor, Set<CodesJarInfo> toUpdate);
|
||||
|
||||
/**
|
||||
* @deprecated use {@link IRunProcessService#getTalendJobJavaProject(Property)} instead
|
||||
@@ -201,6 +202,7 @@ public interface IRunProcessService extends IService {
|
||||
|
||||
ProjectPreferenceManager getProjectPreferenceManager();
|
||||
|
||||
@Deprecated
|
||||
Set<String> getLibJarsForBD(IProcess process);
|
||||
|
||||
void updateProjectPomWithTemplate();
|
||||
@@ -215,8 +217,16 @@ public interface IRunProcessService extends IService {
|
||||
|
||||
ITalendProcessJavaProject getTalendCodeJavaProject(ERepositoryObjectType type, String projectTechName);
|
||||
|
||||
ITalendProcessJavaProject getTalendCodesJarJavaProject(CodesJarInfo info);
|
||||
|
||||
ITalendProcessJavaProject getTalendJobJavaProject(Property property);
|
||||
|
||||
ITalendProcessJavaProject getExistingTalendJobProject(Property property);
|
||||
|
||||
ITalendProcessJavaProject getExistingTalendCodesJarProject(CodesJarInfo info);
|
||||
|
||||
PropertyChangeListener addCodesJarChangeListener();
|
||||
|
||||
IFolder getCodeSrcFolder(ERepositoryObjectType type, String projectTechName);
|
||||
|
||||
ITalendProcessJavaProject getTempJavaProject();
|
||||
@@ -255,4 +265,9 @@ public interface IRunProcessService extends IService {
|
||||
return null;
|
||||
}
|
||||
|
||||
void deleteTalendCodesJarProject(CodesJarInfo info, boolean deleteContent);
|
||||
|
||||
void deleteTalendCodesJarProject(ERepositoryObjectType type, String projectTechName, String codesJarName,
|
||||
boolean deleteContent);
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
@@ -94,6 +95,8 @@ public final class ProjectManager {
|
||||
|
||||
private Set<Project> tempProjects;
|
||||
|
||||
private WeakHashMap<IRepositoryViewObject, Boolean> cachedObjects = new WeakHashMap<IRepositoryViewObject, Boolean>();
|
||||
|
||||
private ProjectManager() {
|
||||
beforeLogonRecords = new HashSet<String>();
|
||||
logonRecords = new HashSet<String>();
|
||||
@@ -183,7 +186,7 @@ public final class ProjectManager {
|
||||
Set<String> resolvedProjectLabels, boolean force) {
|
||||
if (p != null) {
|
||||
String parentBranch = ProjectManager.getInstance().getMainProjectBranch(p);
|
||||
if (parentBranch != null || force) {
|
||||
if ((!p.isLocal() || parentBranch != null) || force) {
|
||||
resolvedProjectLabels.add(p.getTechnicalLabel());
|
||||
for (ProjectReference pr : new Project(p).getProjectReferenceList()) {
|
||||
if (ProjectManager.validReferenceProject(p, pr)
|
||||
@@ -424,6 +427,18 @@ public final class ProjectManager {
|
||||
return isInMainProject(getCurrentProject(), object);
|
||||
}
|
||||
|
||||
/**
|
||||
* could get the right comparing result if resource is unloaded
|
||||
*/
|
||||
public boolean isResourceInCurrentMainProject(EObject object) {
|
||||
org.talend.core.model.properties.Project project = getProject(object);
|
||||
Project mainProject = getCurrentProject();
|
||||
if (project != null && mainProject != null) {
|
||||
return project.getTechnicalLabel().equals(mainProject.getEmfProject().getTechnicalLabel());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isInMainProject(Project mainProject, EObject object) {
|
||||
if (object != null) {
|
||||
org.talend.core.model.properties.Project project = getProject(mainProject, object);
|
||||
@@ -451,9 +466,15 @@ public final class ProjectManager {
|
||||
if (object == null) {
|
||||
return true;
|
||||
}
|
||||
if (cachedObjects.containsKey(object)) {
|
||||
return cachedObjects.get(object);
|
||||
}
|
||||
|
||||
org.talend.core.model.properties.Project emfProject = getProject(object.getProperty().getItem());
|
||||
org.talend.core.model.properties.Project curProject = curP.getEmfProject();
|
||||
return emfProject.equals(curProject);
|
||||
boolean ret = emfProject.equals(curProject);
|
||||
cachedObjects.put(object, ret);
|
||||
return ret;
|
||||
|
||||
} else {
|
||||
IProjectRepositoryNode root = node.getRoot();
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
// ============================================================================
|
||||
package org.talend.repository;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.talend.commons.exception.LoginException;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.core.model.general.Project;
|
||||
@@ -45,6 +47,8 @@ public abstract class RepositoryWorkUnit<T> {
|
||||
|
||||
private boolean refreshRepository = true; // added for TDI-27085
|
||||
|
||||
private Set<String> specifiedCommitFiles;
|
||||
|
||||
/**
|
||||
* Usefull for some save only actions, where we're sure everything is up to date.
|
||||
*/
|
||||
@@ -194,6 +198,13 @@ public abstract class RepositoryWorkUnit<T> {
|
||||
this.refreshRepository = refreshRepository;
|
||||
}
|
||||
|
||||
public Set<String> getSpecifiedCommitFiles() {
|
||||
return specifiedCommitFiles;
|
||||
}
|
||||
|
||||
public void setSpecifiedCommitFiles(Set<String> specifiedCommitFiles) {
|
||||
this.specifiedCommitFiles = specifiedCommitFiles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for avoidUpdateLocks.
|
||||
|
||||
@@ -17,6 +17,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.talend.commons.exception.BusinessException;
|
||||
import org.talend.commons.exception.LoginException;
|
||||
@@ -42,6 +43,7 @@ import org.talend.core.model.repository.Folder;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.model.repository.IRepositoryWorkUnitListener;
|
||||
import org.talend.core.model.repository.LockInfo;
|
||||
import org.talend.core.model.routines.CodesJarInfo;
|
||||
import org.talend.repository.RepositoryWorkUnit;
|
||||
|
||||
/**
|
||||
@@ -206,6 +208,8 @@ public interface IProxyRepositoryFactory {
|
||||
*/
|
||||
public abstract void deleteObjectLogical(IRepositoryViewObject objToDelete) throws PersistenceException, BusinessException;
|
||||
|
||||
// TODO need to remove codesjar and related routine node to bin, or just show codesjar node?
|
||||
// if delete inner routine, show node itself only
|
||||
public abstract void deleteObjectLogical(Project project, IRepositoryViewObject objToDelete) throws PersistenceException,
|
||||
BusinessException;
|
||||
|
||||
@@ -213,6 +217,7 @@ public interface IProxyRepositoryFactory {
|
||||
throws PersistenceException, BusinessException;
|
||||
|
||||
public abstract void deleteObjectPhysical(IRepositoryViewObject objToDelete) throws PersistenceException;
|
||||
// TODO if delete codesjar item should delete all related routines
|
||||
|
||||
public abstract void deleteObjectPhysical(IRepositoryViewObject objToDelete, String version) throws PersistenceException;
|
||||
|
||||
@@ -305,6 +310,16 @@ public interface IProxyRepositoryFactory {
|
||||
public abstract List<IRepositoryViewObject> getAll(Project project, ERepositoryObjectType type, boolean withDeleted,
|
||||
boolean allVersions) throws PersistenceException;
|
||||
|
||||
public abstract List<IRepositoryViewObject> getAll(Project project, ERepositoryObjectType type, boolean withDeleted,
|
||||
boolean allVersions, IFolder... folders) throws PersistenceException;
|
||||
|
||||
public abstract List<IRepositoryViewObject> getAllCodesJars(ERepositoryObjectType type) throws PersistenceException;
|
||||
|
||||
public abstract List<IRepositoryViewObject> getAllCodesJars(Project project, ERepositoryObjectType type)
|
||||
throws PersistenceException;
|
||||
|
||||
public abstract List<IRepositoryViewObject> getAllInnerCodes(CodesJarInfo info) throws PersistenceException;
|
||||
|
||||
public abstract List<String> getFolders(ERepositoryObjectType type) throws PersistenceException;
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
// ============================================================================
|
||||
package org.talend.repository.model;
|
||||
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.IService;
|
||||
|
||||
/**
|
||||
@@ -20,4 +21,11 @@ import org.talend.core.IService;
|
||||
public interface IProxyRepositoryService extends IService {
|
||||
|
||||
public IProxyRepositoryFactory getProxyRepositoryFactory();
|
||||
|
||||
public static IProxyRepositoryService get() {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IProxyRepositoryService.class)) {
|
||||
return GlobalServiceRegister.getDefault().getService(IProxyRepositoryService.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.talend.core.IService;
|
||||
import org.talend.core.model.components.IComponentsFactory;
|
||||
import org.talend.core.model.general.ModuleNeeded;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.metadata.builder.connection.DatabaseConnection;
|
||||
import org.talend.core.model.process.IContextManager;
|
||||
@@ -144,4 +145,8 @@ public interface IRepositoryService extends IService {
|
||||
|
||||
public void setShouldCheckRepoViewCommonNavigatorDirty(IRepositoryView repView, boolean shouldFlag);
|
||||
|
||||
boolean isProjectLevelLog4j2();
|
||||
|
||||
List<ModuleNeeded> getLog4j2Modules();
|
||||
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user