Compare commits
156 Commits
release/7.
...
patch/7.2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
83a3cbb69d | ||
|
|
42329dcb8a | ||
|
|
3bbf2d0923 | ||
|
|
2fa2eb4b95 | ||
|
|
9136b543d2 | ||
|
|
f5d8ac6ba1 | ||
|
|
98c41d1398 | ||
|
|
068d7acfa1 | ||
|
|
90b8436fed | ||
|
|
50ae23829b | ||
|
|
2102dda9f2 | ||
|
|
5c3e2d8e2a | ||
|
|
f5f70a9a03 | ||
|
|
3e9b826d7b | ||
|
|
baaa12b968 | ||
|
|
864763a9c7 | ||
|
|
58312f6c41 | ||
|
|
22b0854f0f | ||
|
|
c72882d4f3 | ||
|
|
b1581aac33 | ||
|
|
510795eb64 | ||
|
|
51697c3477 | ||
|
|
df51e4643f | ||
|
|
6672a29377 | ||
|
|
fc613a6a31 | ||
|
|
438d6a43ab | ||
|
|
2117a06cf2 | ||
|
|
e82174e99b | ||
|
|
101e58e159 | ||
|
|
a5d49f0051 | ||
|
|
cdf41fb420 | ||
|
|
cdfb44ced5 | ||
|
|
241f022cd4 | ||
|
|
fdb1739b1b | ||
|
|
c0b4202259 | ||
|
|
bd3cc178de | ||
|
|
984ca27e4e | ||
|
|
0468f1613c | ||
|
|
169610aa09 | ||
|
|
99ebc8c31b | ||
|
|
947f5b1730 | ||
|
|
ca5257f41f | ||
|
|
50bc40a36d | ||
|
|
163a5fed4b | ||
|
|
94ec866da2 | ||
|
|
9e5ebe9bd6 | ||
|
|
254ed5f9c2 | ||
|
|
93fd820240 | ||
|
|
120edfe17c | ||
|
|
1e067fe87d | ||
|
|
17647bf874 | ||
|
|
e6bb7ef649 | ||
|
|
5523cffed8 | ||
|
|
132c4915da | ||
|
|
cb4139acf3 | ||
|
|
a68447afe4 | ||
|
|
c28b686049 | ||
|
|
ab7c0c0833 | ||
|
|
4a1e06e010 | ||
|
|
8ff0e806cf | ||
|
|
3149ac1e6b | ||
|
|
8f513789aa | ||
|
|
b245900000 | ||
|
|
ad2a22dcc4 | ||
|
|
e3f1c84dfd | ||
|
|
3b04a2f690 | ||
|
|
0c82d7a96b | ||
|
|
17110bb1fa | ||
|
|
29b1f3a97c | ||
|
|
6af4cbf201 | ||
|
|
a3c1d73f36 | ||
|
|
41ef59868e | ||
|
|
ac7c8ff40d | ||
|
|
7872cf40d8 | ||
|
|
62997993ee | ||
|
|
b81bba4311 | ||
|
|
6d787c8bb7 | ||
|
|
d3edced303 | ||
|
|
71d4e06163 | ||
|
|
0dc85faca3 | ||
|
|
672ac95f1c | ||
|
|
03fd95bb57 | ||
|
|
38b1a6bbaa | ||
|
|
3efe68118a | ||
|
|
f3c9e7439e | ||
|
|
242760143f | ||
|
|
f98bd78d07 | ||
|
|
03b61215d0 | ||
|
|
c3910a11a0 | ||
|
|
6b73594486 | ||
|
|
f247cbf4de | ||
|
|
68372a9d7a | ||
|
|
19e62edbec | ||
|
|
a8d56d413d | ||
|
|
df0fde5b02 | ||
|
|
5c0ddf4cd4 | ||
|
|
89b3abd6dd | ||
|
|
8131d3bfcf | ||
|
|
4da5125b07 | ||
|
|
f6e7e7ec40 | ||
|
|
b2bff6cce3 | ||
|
|
3a538f3ae4 | ||
|
|
6d283447e5 | ||
|
|
e231bff121 | ||
|
|
85901957ce | ||
|
|
9e13dd710c | ||
|
|
f02e9bd6ae | ||
|
|
095f33bea7 | ||
|
|
7b65d316ad | ||
|
|
0da7d5235d | ||
|
|
66b20dcea5 | ||
|
|
bc6506c9fb | ||
|
|
0b434cfc4a | ||
|
|
b55842aa2d | ||
|
|
23e028407e | ||
|
|
2b54495b25 | ||
|
|
74f5674c72 | ||
|
|
aab1e3f6f8 | ||
|
|
390ecb97e5 | ||
|
|
223fb3e2a1 | ||
|
|
9d3a2d2fcd | ||
|
|
182e7cd116 | ||
|
|
f4d07e67db | ||
|
|
00ead16a04 | ||
|
|
41876ebe40 | ||
|
|
dda3390d0b | ||
|
|
39392b6ba4 | ||
|
|
2309b47ce8 | ||
|
|
09d2997af6 | ||
|
|
530e8793ea | ||
|
|
8aa27eb00c | ||
|
|
17a5b0c28a | ||
|
|
0ef344fd01 | ||
|
|
5a96ad6757 | ||
|
|
53361f8d22 | ||
|
|
2773b281be | ||
|
|
9f8fea79e4 | ||
|
|
3254acbab0 | ||
|
|
c4bbe25249 | ||
|
|
bf7ffb0288 | ||
|
|
72f9b4032c | ||
|
|
4e3bf8631d | ||
|
|
fec8fd0c06 | ||
|
|
0b0e004491 | ||
|
|
235f8b08d1 | ||
|
|
bbf5b5e859 | ||
|
|
70dddca938 | ||
|
|
958e5d7b1b | ||
|
|
ac4d92a777 | ||
|
|
e35804e5ca | ||
|
|
8d64e1e5cf | ||
|
|
6ffe253c1c | ||
|
|
e5b7ab490c | ||
|
|
07efecb906 | ||
|
|
cee139ef8d | ||
|
|
ea00bfcad0 |
@@ -21,6 +21,7 @@ import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
@@ -38,6 +39,8 @@ public class ExceptionMessageDialog extends MessageDialog {
|
||||
|
||||
private String exceptionString = null;
|
||||
|
||||
private int[] diabledButtonIndex = new int[] {};
|
||||
|
||||
public ExceptionMessageDialog(Shell parentShell, String dialogTitle, Image dialogTitleImage, String dialogMessage,
|
||||
int dialogImageType, String[] dialogButtonLabels, int defaultIndex, Throwable ex) {
|
||||
super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex);
|
||||
@@ -147,4 +150,21 @@ public class ExceptionMessageDialog extends MessageDialog {
|
||||
this.exceptionString = exceptionString;
|
||||
}
|
||||
|
||||
public void setDisabledButtons(int[] index) {
|
||||
this.diabledButtonIndex = index;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createButtonsForButtonBar(Composite parent) {
|
||||
super.createButtonsForButtonBar(parent);
|
||||
if (diabledButtonIndex == null) {
|
||||
return;
|
||||
}
|
||||
for (int index : diabledButtonIndex) {
|
||||
Button button = super.getButton(index);
|
||||
button.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,8 @@ Require-Bundle: org.apache.log4j;visibility:=reexport,
|
||||
org.talend.libraries.apache,
|
||||
com.ibm.icu,
|
||||
org.apache.commons.io,
|
||||
org.talend.utils
|
||||
org.talend.utils,
|
||||
org.eclipse.core.net
|
||||
Export-Package: org.talend.commons,
|
||||
org.talend.commons.exception,
|
||||
org.talend.commons.i18n,
|
||||
|
||||
@@ -17,6 +17,7 @@ import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.eclipse.core.net.proxy.IProxyService;
|
||||
import org.eclipse.core.runtime.FileLocator;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.preferences.InstanceScope;
|
||||
@@ -24,6 +25,7 @@ import org.osgi.framework.Bundle;
|
||||
import org.osgi.framework.BundleActivator;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.ServiceReference;
|
||||
import org.osgi.util.tracker.ServiceTracker;
|
||||
import org.talend.commons.exception.ExceptionService;
|
||||
import org.talend.commons.runtime.debug.TalendDebugHandler;
|
||||
import org.talend.commons.utils.system.EclipseCommandLine;
|
||||
@@ -55,6 +57,8 @@ public class CommonsPlugin implements BundleActivator {
|
||||
// TESB-17856: For commandline builds ESB Micorservice bundle
|
||||
private static boolean isESBMicorservice = false;
|
||||
|
||||
private static ServiceTracker proxyTracker;
|
||||
|
||||
public static boolean isWorkbenchCreated() {
|
||||
return isWorkbenchCreated;
|
||||
}
|
||||
@@ -176,4 +180,13 @@ public class CommonsPlugin implements BundleActivator {
|
||||
return FileLocator.toFileURL(entry);
|
||||
}
|
||||
|
||||
public static IProxyService getProxyService() {
|
||||
if (proxyTracker == null) {
|
||||
proxyTracker = new ServiceTracker(Platform.getBundle(PLUGIN_ID).getBundleContext(), IProxyService.class.getName(),
|
||||
null);
|
||||
proxyTracker.open();
|
||||
}
|
||||
return (IProxyService) proxyTracker.getService();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -58,3 +58,6 @@ AS400ResultSet.unknowCloumn=Invalid argument\: unknown column name
|
||||
AS400ResultSet.parameterIndex=Invalid argument\: parameter index
|
||||
AS400ResultSet.outofRange=\ is out of range.
|
||||
ITaCoKitService.exception.multipleInstance=More than one instance found: {0}
|
||||
TalendProxySelector.exception.badUriMap=Bad uri map: {0}
|
||||
TalendProxySelector.exception.proxySelectionError=Error occurs when selecting proxy for {0}
|
||||
|
||||
|
||||
@@ -45,6 +45,8 @@ public class VersionUtils {
|
||||
|
||||
public static final String STUDIO_VERSION_PROP = "studio.version"; //$NON-NLS-1$
|
||||
|
||||
public static final String TALEND_STUDIO_VERSION_PROP = "talend.studio.version"; //$NON-NLS-1$
|
||||
|
||||
public static final String TALEND_VERSION_PROP = "talend.version"; //$NON-NLS-1$
|
||||
|
||||
private static final String COMMONS_PLUGIN_ID = "org.talend.commons.runtime"; //$NON-NLS-1$
|
||||
@@ -97,7 +99,9 @@ public class VersionUtils {
|
||||
|
||||
public static String getInternalVersion() {
|
||||
if (Platform.inDevelopmentMode()) {
|
||||
return getDisplayVersion();
|
||||
String version = getDisplayVersion();
|
||||
updateTalendStudioVersionProp(version);
|
||||
return version;
|
||||
}
|
||||
if (productVersion == null) {
|
||||
synchronized (VersionUtils.class) {
|
||||
@@ -132,10 +136,15 @@ public class VersionUtils {
|
||||
}
|
||||
}
|
||||
}
|
||||
updateTalendStudioVersionProp(productVersion);
|
||||
}
|
||||
return productVersion;
|
||||
}
|
||||
|
||||
private static void updateTalendStudioVersionProp(String version) {
|
||||
System.setProperty(TALEND_STUDIO_VERSION_PROP, version == null ? "" : version);
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC ycbai Comment method "getVersion".
|
||||
*
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2020 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.commons.utils.database;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
||||
/**
|
||||
* created by qiongli on 2013-11-13 Detailled comment
|
||||
*
|
||||
*/
|
||||
public class Sybase16SADatabaseMetaData extends SybaseDatabaseMetaData {
|
||||
|
||||
private static Logger log = Logger.getLogger(Sybase16SADatabaseMetaData.class);
|
||||
|
||||
/**
|
||||
* DOC qiongli SybaseIQDatabaseMetaData constructor comment.
|
||||
*
|
||||
* @param connection
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Sybase16SADatabaseMetaData(Connection connection) throws SQLException {
|
||||
super(connection);
|
||||
}
|
||||
|
||||
public ResultSet getCatalogs(String login, String database) throws SQLException {
|
||||
List<String[]> list = new ArrayList<String[]>();
|
||||
|
||||
List<String> catList = new ArrayList<String>();
|
||||
if (!StringUtils.isEmpty(database)) {
|
||||
catList.add(database);
|
||||
}
|
||||
|
||||
for (String catalogName : catList) {
|
||||
String sql = createSqlByLoginAndCatalog(login, catalogName);
|
||||
ResultSet rs = null;
|
||||
Statement stmt = null;
|
||||
try {
|
||||
stmt = connection.createStatement();
|
||||
rs = stmt.executeQuery(sql);
|
||||
|
||||
while (rs.next()) {
|
||||
int temp = rs.getInt(1);
|
||||
if (temp > 0) {
|
||||
String[] r = new String[] { catalogName };
|
||||
list.add(r);
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
log.error(e);
|
||||
} finally {
|
||||
try {
|
||||
if (rs != null) {
|
||||
rs.close();
|
||||
}
|
||||
if (stmt != null) {
|
||||
stmt.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SybaseResultSet tableResultSet = new SybaseResultSet();
|
||||
tableResultSet.setMetadata(new String[] { "TABLE_CAT" }); //$NON-NLS-1$
|
||||
tableResultSet.setData(list);
|
||||
return tableResultSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern)
|
||||
throws SQLException {
|
||||
return super.getColumns(null, schemaPattern, tableNamePattern, columnNamePattern);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet getPrimaryKeys(String catalog, String schema, String table) throws SQLException {
|
||||
return super.getPrimaryKeys(null, schema, table);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types)
|
||||
throws SQLException {
|
||||
return super.getTables(null, schemaPattern, tableNamePattern, types);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* get a sql query by login name and catalog name.
|
||||
*
|
||||
* @param loginName
|
||||
* @param catalogName
|
||||
* @return
|
||||
*/
|
||||
protected String createSqlByLoginAndCatalog(String loginName, String catalogName) {
|
||||
String sql = "select count(*) from " + catalogName
|
||||
+ ".dbo.sysusers where suid in (select suid from "+catalogName+".dbo.syslogins where name = '" + loginName
|
||||
+ "')";
|
||||
return sql;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2020 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.commons.utils.network;
|
||||
|
||||
public interface ITalendNexusPrefConstants {
|
||||
|
||||
public static final String NEXUS_TIMEOUT = "NEXUS_TIMEOUT"; //$NON-NLS-1$
|
||||
}
|
||||
@@ -26,6 +26,9 @@ import java.util.Enumeration;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
||||
import org.eclipse.core.runtime.preferences.InstanceScope;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.runtime.utils.io.FileCopyUtils;
|
||||
|
||||
/**
|
||||
@@ -44,7 +47,17 @@ public class NetworkUtil {
|
||||
|
||||
private static final String HTTP_NETWORK_URL = "https://talend-update.talend.com";
|
||||
|
||||
private static final int DEFAULT_TIMEOUT = 4000;
|
||||
|
||||
private static final int DEFAULT_NEXUS_TIMEOUT = 20000;// same as preference value
|
||||
|
||||
public static final String ORG_TALEND_DESIGNER_CORE = "org.talend.designer.core"; //$NON-NLS-1$
|
||||
|
||||
public static boolean isNetworkValid() {
|
||||
return isNetworkValid(DEFAULT_TIMEOUT);
|
||||
}
|
||||
|
||||
public static boolean isNetworkValid(Integer timeout) {
|
||||
String disableInternet = System.getProperty(TALEND_DISABLE_INTERNET);
|
||||
if ("true".equals(disableInternet)) { //$NON-NLS-1$
|
||||
return false;
|
||||
@@ -52,8 +65,9 @@ public class NetworkUtil {
|
||||
try {
|
||||
URL url = new URL(HTTP_NETWORK_URL);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setConnectTimeout(4000);
|
||||
conn.setReadTimeout(4000);
|
||||
int conntimeout = timeout != null ? timeout.intValue() : DEFAULT_TIMEOUT;
|
||||
conn.setConnectTimeout(conntimeout);
|
||||
conn.setReadTimeout(conntimeout);
|
||||
|
||||
conn.setRequestMethod("HEAD"); //$NON-NLS-1$
|
||||
String strMessage = conn.getResponseMessage();
|
||||
@@ -69,6 +83,47 @@ public class NetworkUtil {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isNetworkValid(String url, Integer timeout) {
|
||||
if (url == null) {
|
||||
return isNetworkValid(timeout);
|
||||
}
|
||||
return checkValidWithHttp(url, timeout);
|
||||
}
|
||||
|
||||
private static boolean checkValidWithHttp(String urlString, Integer timeout) {
|
||||
HttpURLConnection conn = null;
|
||||
try {
|
||||
URL url = new URL(urlString);
|
||||
conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setDefaultUseCaches(false);
|
||||
conn.setUseCaches(false);
|
||||
int conntimeout = timeout != null ? timeout.intValue() : DEFAULT_TIMEOUT;
|
||||
conn.setConnectTimeout(conntimeout);
|
||||
conn.setReadTimeout(conntimeout);
|
||||
conn.setRequestMethod("HEAD"); //$NON-NLS-1$
|
||||
conn.getResponseMessage();
|
||||
} catch (Exception e) {
|
||||
// if not reachable , will throw exception(time out/unknown host) .So if catched exception, make it a
|
||||
// invalid server
|
||||
return false;
|
||||
} finally {
|
||||
conn.disconnect();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static int getNexusTimeout() {
|
||||
int timeout = DEFAULT_NEXUS_TIMEOUT;
|
||||
try {
|
||||
IEclipsePreferences node = InstanceScope.INSTANCE.getNode(ORG_TALEND_DESIGNER_CORE);
|
||||
timeout = node.getInt(ITalendNexusPrefConstants.NEXUS_TIMEOUT, DEFAULT_NEXUS_TIMEOUT);
|
||||
} catch (Throwable e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
|
||||
return timeout;
|
||||
}
|
||||
|
||||
public static Authenticator getDefaultAuthenticator() {
|
||||
try {
|
||||
@@ -92,6 +147,28 @@ public class NetworkUtil {
|
||||
|
||||
@Override
|
||||
protected PasswordAuthentication getPasswordAuthentication() {
|
||||
String httpProxyHost = System.getProperty("http.proxyHost"); //$NON-NLS-1$
|
||||
String httpProxyPort = System.getProperty("http.proxyPort"); //$NON-NLS-1$
|
||||
String httpsProxyHost = System.getProperty("https.proxyHost"); //$NON-NLS-1$
|
||||
String httpsProxyPort = System.getProperty("https.proxyPort"); //$NON-NLS-1$
|
||||
String requestingHost = getRequestingHost();
|
||||
int requestingPort = getRequestingPort();
|
||||
String proxyHost = null;
|
||||
String proxyPort = null;
|
||||
boolean isHttp = false;
|
||||
if ("http".equalsIgnoreCase(getRequestingScheme())) {
|
||||
isHttp = true;
|
||||
}
|
||||
if (isHttp && StringUtils.isNotBlank(httpProxyHost)) {
|
||||
proxyHost = httpProxyHost;
|
||||
proxyPort = httpProxyPort;
|
||||
} else {
|
||||
proxyHost = httpsProxyHost;
|
||||
proxyPort = httpsProxyPort;
|
||||
}
|
||||
if (!StringUtils.equals(proxyHost, requestingHost) || !StringUtils.equals(proxyPort, "" + requestingPort)) {
|
||||
return null;
|
||||
}
|
||||
String httpProxyUser = System.getProperty("http.proxyUser"); //$NON-NLS-1$
|
||||
String httpProxyPassword = System.getProperty("http.proxyPassword"); //$NON-NLS-1$
|
||||
String httpsProxyUser = System.getProperty("https.proxyUser"); //$NON-NLS-1$
|
||||
@@ -109,7 +186,11 @@ public class NetworkUtil {
|
||||
proxyPassword = httpsProxyPassword.toCharArray();
|
||||
}
|
||||
}
|
||||
return new PasswordAuthentication(proxyUser, proxyPassword);
|
||||
if (StringUtils.isBlank(proxyUser)) {
|
||||
return null;
|
||||
} else {
|
||||
return new PasswordAuthentication(proxyUser, proxyPassword);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -13,37 +13,211 @@
|
||||
package org.talend.commons.utils.network;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.PasswordAuthentication;
|
||||
import java.net.Proxy;
|
||||
import java.net.ProxySelector;
|
||||
import java.net.SocketAddress;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Priority;
|
||||
import org.eclipse.core.internal.net.ProxyManager;
|
||||
import org.eclipse.core.net.proxy.IProxyService;
|
||||
import org.talend.commons.CommonsPlugin;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.i18n.internal.Messages;
|
||||
import org.talend.daikon.sandbox.properties.ClassLoaderIsolatedSystemProperties;
|
||||
|
||||
import sun.net.spi.DefaultProxySelector;
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public class TalendProxySelector extends ProxySelector {
|
||||
|
||||
public static final String PROP_PRINT_LOGS = "talend.studio.proxy.printLogs";
|
||||
|
||||
private static final String ECLIPSE_PROXY_SELECTOR = ".EclipseProxySelector"; //$NON-NLS-1$
|
||||
|
||||
private ProxySelector defaultSelector;
|
||||
private static final String PROP_ALLOW_PROXY_REDIRECT = "talend.studio.proxy.allowProxyRedirect";
|
||||
|
||||
final private List<IProxySelectorProvider> selectorProviders;
|
||||
private static final String PROP_ALLOW_PROXY_REDIRECT_EXCLUDE = "talend.studio.proxy.redirect.whiteList";
|
||||
|
||||
private static final String PROP_EXECUTE_CONNECTION_FAILED = "talend.studio.proxy.executeConnectionFailed";
|
||||
|
||||
private static final String PROP_UPDATE_SYSTEM_PROPERTIES_FOR_JRE = "talend.studio.proxy.jre.updateSystemProperties";
|
||||
|
||||
private static final String PROP_CHECK_PROXY = "talend.studio.proxy.checkProxy";
|
||||
|
||||
private static final String PROP_VALIDATE_URI = "talend.studio.proxy.validateUri";
|
||||
|
||||
private static final String PROP_PROXY_SELECTOR = "talend.studio.proxy.selector";
|
||||
|
||||
private static final String PROP_PROXY_SELECTOR_DEFAULT = "default";
|
||||
|
||||
private static final String PROP_PROXY_SELECTOR_JRE = "jre";
|
||||
|
||||
private static final String PROP_PROXY_HOST_MAP = "talend.studio.proxy.hostMap";
|
||||
|
||||
private static final String PROP_DISABLE_DEFAULT_SELECTOR_PROVIDER = "talend.studio.proxy.disableDefaultSelectorProvider";
|
||||
|
||||
/**
|
||||
* Example: update.talend.com,socket:http,https:http;nexus.talend.com,socket,http;,socket:http
|
||||
*/
|
||||
private static final String PROP_PROXY_MAP_HOST_DEFAULT = "";
|
||||
|
||||
/**
|
||||
* Example: svn.company.com;nexus.company.com
|
||||
*/
|
||||
private static final String PROP_ALLOW_PROXY_REDIRECT_EXCLUDE_DEFAULT = "";
|
||||
|
||||
private static final String KEY_DEFAULT = ":default:";
|
||||
|
||||
private static Field uriHostField;
|
||||
|
||||
private static Method proxyManagerUpdateSystemPropertiesFunc;
|
||||
|
||||
private static boolean checkProxy = Boolean.valueOf(System.getProperty(PROP_CHECK_PROXY, Boolean.TRUE.toString()));
|
||||
|
||||
/**
|
||||
* Note: eclipse default selector may be different between TOS and TIS, TOS may use jre one, TIS may use egit one
|
||||
*/
|
||||
private ProxySelector eclipseDefaultSelector;
|
||||
|
||||
private ProxySelector jreDefaultSelector;
|
||||
|
||||
private EProxySelector eProxySelector;
|
||||
|
||||
final private Map<Object, Collection<IProxySelectorProvider>> selectorProviders;
|
||||
|
||||
private Map<String, Map<String, String>> hostMap;
|
||||
|
||||
private Set<String> redirectWhiteList;
|
||||
|
||||
private volatile static TalendProxySelector instance;
|
||||
|
||||
private static Object instanceLock = new Object();
|
||||
|
||||
private TalendProxySelector(final ProxySelector defaultSelector) {
|
||||
this.defaultSelector = defaultSelector;
|
||||
selectorProviders = new ArrayList<>();
|
||||
private boolean printProxyLog = false;
|
||||
|
||||
private boolean allowProxyRedirect = false;
|
||||
|
||||
private boolean disableDefaultSelectorProvider = false;
|
||||
|
||||
private boolean validateUri = true;
|
||||
|
||||
private boolean executeConnectionFailed = true;
|
||||
|
||||
private boolean updateSystemPropertiesForJre = true;
|
||||
|
||||
private TalendProxySelector(final ProxySelector eclipseDefaultSelector) {
|
||||
this.eclipseDefaultSelector = eclipseDefaultSelector;
|
||||
this.jreDefaultSelector = new DefaultProxySelector();
|
||||
|
||||
selectorProviders = Collections.synchronizedMap(new HashMap<>());
|
||||
allowProxyRedirect = Boolean.valueOf(System.getProperty(PROP_ALLOW_PROXY_REDIRECT, Boolean.FALSE.toString()));
|
||||
disableDefaultSelectorProvider = Boolean
|
||||
.valueOf(System.getProperty(PROP_DISABLE_DEFAULT_SELECTOR_PROVIDER, Boolean.FALSE.toString()));
|
||||
printProxyLog = Boolean.valueOf(System.getProperty(PROP_PRINT_LOGS, Boolean.FALSE.toString()));
|
||||
validateUri = Boolean.valueOf(System.getProperty(PROP_VALIDATE_URI, Boolean.TRUE.toString()));
|
||||
executeConnectionFailed = Boolean.valueOf(System.getProperty(PROP_EXECUTE_CONNECTION_FAILED, Boolean.TRUE.toString()));
|
||||
updateSystemPropertiesForJre = Boolean
|
||||
.valueOf(System.getProperty(PROP_UPDATE_SYSTEM_PROPERTIES_FOR_JRE, Boolean.TRUE.toString()));
|
||||
|
||||
switch (System.getProperty(PROP_PROXY_SELECTOR, PROP_PROXY_SELECTOR_DEFAULT).toLowerCase()) {
|
||||
case PROP_PROXY_SELECTOR_JRE:
|
||||
this.eProxySelector = EProxySelector.jre;
|
||||
break;
|
||||
default:
|
||||
this.eProxySelector = EProxySelector.eclipse_default;
|
||||
break;
|
||||
}
|
||||
|
||||
initHostMap();
|
||||
initRedirectList();
|
||||
}
|
||||
|
||||
private void initHostMap() {
|
||||
try {
|
||||
hostMap = new HashMap<>();
|
||||
String property = System.getProperty(PROP_PROXY_HOST_MAP, PROP_PROXY_MAP_HOST_DEFAULT);
|
||||
if (StringUtils.isEmpty(property)) {
|
||||
return;
|
||||
}
|
||||
String[] splits = property.split(";");
|
||||
for (String split : splits) {
|
||||
try {
|
||||
int index = split.indexOf(',');
|
||||
String uri = split.substring(0, index);
|
||||
String key = StringUtils.strip(uri);
|
||||
if (StringUtils.isBlank(key)) {
|
||||
key = KEY_DEFAULT;
|
||||
}
|
||||
key = key.toLowerCase();
|
||||
Map<String, String> protocolMap = hostMap.get(key);
|
||||
if (protocolMap == null) {
|
||||
protocolMap = new HashMap<>();
|
||||
hostMap.put(key, protocolMap);
|
||||
}
|
||||
int protocolMapIndex = index + 1;
|
||||
String protocolMapStr = split.substring(protocolMapIndex);
|
||||
String[] entry = protocolMapStr.split(",");
|
||||
for (String pMap : entry) {
|
||||
try {
|
||||
String[] mapEntry = pMap.split(":");
|
||||
if (mapEntry.length != 2) {
|
||||
ExceptionHandler.process(
|
||||
new Exception(Messages.getString("TalendProxySelector.exception.badUriMap", pMap)));
|
||||
continue;
|
||||
}
|
||||
protocolMap.put(mapEntry[0].toLowerCase(), mapEntry[1].toLowerCase());
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void initRedirectList() {
|
||||
try {
|
||||
redirectWhiteList = new HashSet<>();
|
||||
String property = System.getProperty(PROP_ALLOW_PROXY_REDIRECT_EXCLUDE, PROP_ALLOW_PROXY_REDIRECT_EXCLUDE_DEFAULT);
|
||||
if (StringUtils.isEmpty(property)) {
|
||||
return;
|
||||
}
|
||||
String[] split = property.split(";");
|
||||
for (String host : split) {
|
||||
host = StringUtils.strip(host);
|
||||
if (StringUtils.isBlank(host)) {
|
||||
host = KEY_DEFAULT;
|
||||
}
|
||||
redirectWhiteList.add(host);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static TalendProxySelector getInstance() {
|
||||
@@ -58,6 +232,18 @@ public class TalendProxySelector extends ProxySelector {
|
||||
synchronized (instanceLock) {
|
||||
if (instance == null) {
|
||||
instance = new TalendProxySelector(proxySelector);
|
||||
try {
|
||||
uriHostField = URI.class.getDeclaredField("host");
|
||||
uriHostField.setAccessible(true);
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
try {
|
||||
proxyManagerUpdateSystemPropertiesFunc = ProxyManager.class.getDeclaredMethod("updateSystemProperties");
|
||||
proxyManagerUpdateSystemPropertiesFunc.setAccessible(true);
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -70,19 +256,216 @@ public class TalendProxySelector extends ProxySelector {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
if (instance.getDefaultProxySelector() == null
|
||||
if (instance.getEclipseDefaultSelector() == null
|
||||
|| (proxySelector != null && proxySelector.getClass().getName().endsWith(ECLIPSE_PROXY_SELECTOR))) {
|
||||
instance.setDefaultProxySelector(proxySelector);
|
||||
instance.setEclipseDefaultSelector(proxySelector);
|
||||
}
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
public static void checkProxy() {
|
||||
if (!checkProxy) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
TalendProxySelector.getInstance();
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Proxy> select(final URI uri) {
|
||||
final Set<Proxy> resultFromProviders = new HashSet<>();
|
||||
List<IProxySelectorProvider> providers = getProxySelectorProviders();
|
||||
if (printProxyLog) {
|
||||
ExceptionHandler.log("TalendProxySelector.select " + uri);
|
||||
}
|
||||
if (uri == null) {
|
||||
return Collections.EMPTY_LIST;
|
||||
}
|
||||
URI validatedUri = validateUri(uri);
|
||||
Set<Proxy> results = new LinkedHashSet<>();
|
||||
|
||||
try {
|
||||
final Set<Proxy> resultFromProviders = getProxysFromProviders(validatedUri);
|
||||
if (resultFromProviders != null && !resultFromProviders.isEmpty()) {
|
||||
results.addAll(resultFromProviders);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
if (printProxyLog) {
|
||||
ExceptionHandler.log("TalendProxySelector.resultFromProviders " + results);
|
||||
}
|
||||
|
||||
ProxySelector defaultProxySelector = getDefaultProxySelector();
|
||||
if (printProxyLog) {
|
||||
ExceptionHandler.log("TalendProxySelector.defaultProxySelector " + defaultProxySelector);
|
||||
}
|
||||
if (defaultProxySelector != null) {
|
||||
/**
|
||||
* don't validate uri here, so that we can know whether it is an issue uri
|
||||
*/
|
||||
URI newUri = getNewUri(validatedUri, false);
|
||||
List<Proxy> defaultProxys = null;
|
||||
if (validateUri && StringUtils.isBlank(newUri.getHost())) {
|
||||
/**
|
||||
* If host is blank, force to use jre proxy selector to avoid the eclipse proxy selector bug
|
||||
*/
|
||||
defaultProxys = getJreProxySelector().select(newUri);
|
||||
} else {
|
||||
defaultProxys = defaultProxySelector.select(newUri);
|
||||
}
|
||||
if (printProxyLog) {
|
||||
ExceptionHandler.log("TalendProxySelector.defaultProxys " + defaultProxys);
|
||||
}
|
||||
try {
|
||||
results.addAll(filterProxys(validatedUri, defaultProxys));
|
||||
} catch (Exception e) {
|
||||
results.addAll(defaultProxys);
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
if (printProxyLog) {
|
||||
String proxys = results.toString();
|
||||
ExceptionHandler.log("Selected proxys for " + uri + ", " + proxys);
|
||||
ExceptionHandler.process(new Exception("Proxy call stacks"), Priority.INFO);
|
||||
}
|
||||
return new LinkedList<Proxy>(results);
|
||||
}
|
||||
|
||||
private URI validateUri(URI uri) {
|
||||
if (!validateUri) {
|
||||
return uri;
|
||||
}
|
||||
|
||||
URI validatedUri = null;
|
||||
try {
|
||||
/**
|
||||
* DON'T use URI.create(), MUST use the conductor which requires authority
|
||||
*/
|
||||
validatedUri = new URI(uri.getScheme(), uri.getAuthority(), uri.getPath(), uri.getQuery(), uri.getFragment());
|
||||
|
||||
/**
|
||||
* Validate the host, if the host is empty, it will cause the eclipse selector to return dirrect
|
||||
*/
|
||||
if (StringUtils.isBlank(validatedUri.getHost())) {
|
||||
String authority = validatedUri.getAuthority();
|
||||
if (StringUtils.isNotBlank(authority)) {
|
||||
// example: https://u:p@www.company.com:8081/path/a?param=b
|
||||
String host = null;
|
||||
int userInfoIndex = authority.indexOf('@');
|
||||
if (0 <= userInfoIndex) {
|
||||
authority = authority.substring(userInfoIndex + 1);
|
||||
}
|
||||
int portIndex = authority.lastIndexOf(':');
|
||||
if (0 <= portIndex) {
|
||||
host = authority.substring(0, portIndex);
|
||||
}
|
||||
try {
|
||||
uriHostField.set(validatedUri, host);
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
if (validatedUri == null) {
|
||||
validatedUri = uri;
|
||||
}
|
||||
}
|
||||
if (printProxyLog) {
|
||||
ExceptionHandler.log("After validate: " + uri + " -> " + validatedUri);
|
||||
}
|
||||
return validatedUri;
|
||||
}
|
||||
|
||||
private List<Proxy> filterProxys(final URI uri, List<Proxy> defaultProxys) {
|
||||
List<Proxy> result = new ArrayList<>();
|
||||
if (defaultProxys != null && !defaultProxys.isEmpty()) {
|
||||
for (Proxy proxy : defaultProxys) {
|
||||
SocketAddress addr = null;
|
||||
Proxy.Type proxyType = null;
|
||||
if (proxy != null) {
|
||||
proxyType = proxy.type();
|
||||
addr = proxy.address();
|
||||
}
|
||||
|
||||
boolean redirect = true;
|
||||
if (!allowProxyRedirect) {
|
||||
String host = uri.getHost();
|
||||
if (host == null) {
|
||||
host = "";
|
||||
}
|
||||
host = StringUtils.strip(host).toLowerCase();
|
||||
if (this.redirectWhiteList.contains(host) || this.redirectWhiteList.contains(KEY_DEFAULT)) {
|
||||
redirect = true;
|
||||
} else if (Proxy.Type.DIRECT == proxyType
|
||||
|| (addr != null && StringUtils.equals(uri.getHost(), ((InetSocketAddress) addr).getHostString()))) {
|
||||
redirect = false;
|
||||
}
|
||||
}
|
||||
if (redirect) {
|
||||
result.add(proxy);
|
||||
} else {
|
||||
result.add(Proxy.NO_PROXY);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private URI getNewUri(URI uri, boolean validateUri) {
|
||||
URI newUri = uri;
|
||||
if (newUri != null) {
|
||||
try {
|
||||
// get host before new URI, because the host may be set manually due to URI issue
|
||||
String host = newUri.getHost();
|
||||
newUri = new URI(newUri.getScheme(), newUri.getAuthority(), newUri.getPath(), newUri.getQuery(),
|
||||
newUri.getFragment());
|
||||
Map<String, String> protocolMap = null;
|
||||
if (StringUtils.isNotBlank(host)) {
|
||||
protocolMap = hostMap.get(host.toLowerCase());
|
||||
}
|
||||
if (protocolMap == null) {
|
||||
protocolMap = hostMap.get(KEY_DEFAULT);
|
||||
}
|
||||
|
||||
if (protocolMap != null) {
|
||||
String schema = newUri.getScheme();
|
||||
if (schema != null) {
|
||||
String lowercasedProtocol = schema.toLowerCase();
|
||||
String preferedProtocol = protocolMap.get(lowercasedProtocol);
|
||||
if (StringUtils.isNotBlank(preferedProtocol)) {
|
||||
/**
|
||||
* Note: MUST use the constructor which requires authority, because some uri may be illegal,
|
||||
* then host info will be stored in authority field instead of host filed
|
||||
*/
|
||||
newUri = new URI(preferedProtocol, newUri.getAuthority(), newUri.getPath(), newUri.getQuery(),
|
||||
newUri.getFragment());
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (URISyntaxException e) {
|
||||
if (printProxyLog) {
|
||||
ExceptionHandler.process(
|
||||
new Exception(Messages.getString("TalendProxySelector.exception.proxySelectionError", uri), e),
|
||||
Priority.WARN);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (validateUri) {
|
||||
newUri = validateUri(newUri);
|
||||
}
|
||||
return newUri;
|
||||
}
|
||||
|
||||
private Set<Proxy> getProxysFromProviders(final URI uri) {
|
||||
final Set<Proxy> resultFromProviders = new LinkedHashSet<>();
|
||||
Collection<IProxySelectorProvider> providers = getCustomProviders(uri);
|
||||
if (providers != null) {
|
||||
providers.stream().forEach(p -> {
|
||||
if (instance == p) {
|
||||
@@ -100,49 +483,126 @@ public class TalendProxySelector extends ProxySelector {
|
||||
}
|
||||
});
|
||||
}
|
||||
List<Proxy> result = new ArrayList<>();
|
||||
return resultFromProviders;
|
||||
}
|
||||
|
||||
if (resultFromProviders != null && !resultFromProviders.isEmpty()) {
|
||||
result.addAll(resultFromProviders);
|
||||
}
|
||||
|
||||
ProxySelector defaultProxySelector = getDefaultProxySelector();
|
||||
if (defaultProxySelector != null) {
|
||||
List<Proxy> defaultProxys = defaultProxySelector.select(uri);
|
||||
if (defaultProxys != null && !defaultProxys.isEmpty()) {
|
||||
result.addAll(defaultProxys);
|
||||
private Collection<IProxySelectorProvider> getCustomProviders(final URI uri) {
|
||||
Collection<IProxySelectorProvider> providers = Collections.EMPTY_LIST;
|
||||
Collection<Object> possibleKeys = getPossibleKeys(uri);
|
||||
for (Object key : possibleKeys) {
|
||||
providers = this.selectorProviders.get(key);
|
||||
if (providers != null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return providers;
|
||||
}
|
||||
|
||||
public PasswordAuthentication getHttpPasswordAuthentication() {
|
||||
String[] schemas = new String[] { "http", "https" };
|
||||
for (String schema : schemas) {
|
||||
String proxyUser = System.getProperty(schema + ".proxyUser");
|
||||
String proxyPassword = System.getProperty(schema + ".proxyPassword");
|
||||
|
||||
if (StringUtils.isNotBlank(proxyUser)) {
|
||||
char[] pwdChars = new char[0];
|
||||
if (proxyPassword != null && !proxyPassword.isEmpty()) {
|
||||
pwdChars = proxyPassword.toCharArray();
|
||||
}
|
||||
return new PasswordAuthentication(proxyUser, pwdChars);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean addProxySelectorProvider(IProxySelectorProvider provider) {
|
||||
List<IProxySelectorProvider> proxySelectorProviders = getProxySelectorProviders();
|
||||
if (!proxySelectorProviders.contains(provider)) {
|
||||
return proxySelectorProviders.add(provider);
|
||||
try {
|
||||
Object key = provider.getKey();
|
||||
Collection<IProxySelectorProvider> collection = this.selectorProviders.get(key);
|
||||
if (collection == null) {
|
||||
synchronized (this.selectorProviders) {
|
||||
collection = this.selectorProviders.get(key);
|
||||
if (collection == null) {
|
||||
collection = Collections.synchronizedList(new LinkedList<>());
|
||||
this.selectorProviders.put(key, collection);
|
||||
}
|
||||
}
|
||||
}
|
||||
collection.add(provider);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean removeProxySelectorProvider(IProxySelectorProvider provider) {
|
||||
return getProxySelectorProviders().remove(provider);
|
||||
}
|
||||
|
||||
private List<IProxySelectorProvider> getProxySelectorProviders() {
|
||||
return selectorProviders;
|
||||
try {
|
||||
Object key = provider.getKey();
|
||||
Collection<IProxySelectorProvider> collection = this.selectorProviders.get(key);
|
||||
if (collection != null) {
|
||||
synchronized (this.selectorProviders) {
|
||||
collection = this.selectorProviders.get(key);
|
||||
if (collection != null) {
|
||||
collection.remove(provider);
|
||||
if (collection.isEmpty()) {
|
||||
this.selectorProviders.remove(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public ProxySelector getDefaultProxySelector() {
|
||||
return defaultSelector;
|
||||
switch (eProxySelector) {
|
||||
case jre:
|
||||
return getJreProxySelector();
|
||||
default:
|
||||
return eclipseDefaultSelector;
|
||||
}
|
||||
}
|
||||
|
||||
public void setDefaultProxySelector(final ProxySelector selector) {
|
||||
defaultSelector = selector;
|
||||
private ProxySelector getJreProxySelector() {
|
||||
try {
|
||||
/**
|
||||
* for tcompv0, daikon may create an isolated system properties for it, so proxies may be ignored in the new
|
||||
* system properties; here we try to call the method to add proxies into the isolated system properties
|
||||
*/
|
||||
if (updateSystemPropertiesForJre && ClassLoaderIsolatedSystemProperties.getInstance()
|
||||
.isIsolated(Thread.currentThread().getContextClassLoader())) {
|
||||
if (printProxyLog) {
|
||||
ExceptionHandler.log("Before update jre proxy system properties for the isolated classloader, http.proxyHost="
|
||||
+ System.getProperty("http.proxyHost"));
|
||||
}
|
||||
IProxyService proxyService = CommonsPlugin.getProxyService();
|
||||
proxyManagerUpdateSystemPropertiesFunc.invoke(proxyService);
|
||||
if (printProxyLog) {
|
||||
ExceptionHandler.log("After updated jre proxy system properties for the isolated classloader, http.proxyHost="
|
||||
+ System.getProperty("http.proxyHost"));
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return this.jreDefaultSelector;
|
||||
}
|
||||
|
||||
public ProxySelector getEclipseDefaultSelector() {
|
||||
return eclipseDefaultSelector;
|
||||
}
|
||||
|
||||
public void setEclipseDefaultSelector(ProxySelector eclipseDefaultSelector) {
|
||||
this.eclipseDefaultSelector = eclipseDefaultSelector;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connectFailed(final URI uri, final SocketAddress sa, final IOException ioe) {
|
||||
List<IProxySelectorProvider> providers = getProxySelectorProviders();
|
||||
Collection<IProxySelectorProvider> providers = getCustomProviders(uri);
|
||||
if (providers != null) {
|
||||
providers.stream().forEach(p -> {
|
||||
if (p.canHandle(uri)) {
|
||||
@@ -151,23 +611,35 @@ public class TalendProxySelector extends ProxySelector {
|
||||
});
|
||||
}
|
||||
|
||||
ProxySelector defaultProxySelector = getDefaultProxySelector();
|
||||
if (defaultProxySelector != null) {
|
||||
defaultProxySelector.connectFailed(uri, sa, ioe);
|
||||
if (executeConnectionFailed) {
|
||||
/**
|
||||
* Just try to make the behavior of jre proxy selector same like eclipse proxy selector
|
||||
*/
|
||||
ProxySelector defaultProxySelector = getDefaultProxySelector();
|
||||
if (defaultProxySelector != null) {
|
||||
defaultProxySelector.connectFailed(uri, sa, ioe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static abstract class AbstractProxySelectorProvider implements IProxySelectorProvider {
|
||||
|
||||
@Override
|
||||
public void connectFailed(final URI uri, final SocketAddress sa, final IOException ioe) {
|
||||
// nothing to do
|
||||
public IProxySelectorProvider createDefaultProxySelectorProvider() {
|
||||
if (disableDefaultSelectorProvider) {
|
||||
return null;
|
||||
}
|
||||
return new DefaultProxySelectorProvider(Thread.currentThread());
|
||||
}
|
||||
|
||||
public IProxySelectorProvider createDefaultProxySelectorProvider(String host) {
|
||||
if (disableDefaultSelectorProvider) {
|
||||
return null;
|
||||
}
|
||||
return new DefaultProxySelectorProvider(host);
|
||||
}
|
||||
|
||||
public static interface IProxySelectorProvider {
|
||||
|
||||
Object getKey();
|
||||
|
||||
boolean canHandle(final URI uri);
|
||||
|
||||
List<Proxy> select(final URI uri);
|
||||
@@ -176,4 +648,120 @@ public class TalendProxySelector extends ProxySelector {
|
||||
|
||||
}
|
||||
|
||||
public static abstract class AbstractProxySelectorProvider implements IProxySelectorProvider {
|
||||
|
||||
private boolean isDebugMode = CommonsPlugin.isDebugMode();
|
||||
|
||||
@Override
|
||||
public Object getKey() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connectFailed(final URI uri, final SocketAddress sa, final IOException ioe) {
|
||||
if (isDebugMode) {
|
||||
ExceptionHandler.process(ioe);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Collection<Object> getPossibleKeys(URI uri) {
|
||||
Collection<Object> possibleKeys = new ArrayList<>();
|
||||
possibleKeys.add(Thread.currentThread());
|
||||
if (uri != null) {
|
||||
String uriHost = uri.getHost();
|
||||
if (StringUtils.isNotBlank(uriHost)) {
|
||||
possibleKeys.add(uriHost);
|
||||
}
|
||||
}
|
||||
return possibleKeys;
|
||||
}
|
||||
|
||||
private enum EProxySelector {
|
||||
eclipse_default,
|
||||
jre
|
||||
}
|
||||
|
||||
private class DefaultProxySelectorProvider extends TalendProxySelector.AbstractProxySelectorProvider {
|
||||
|
||||
private Thread currentThread = null;
|
||||
|
||||
private String host = null;
|
||||
|
||||
public DefaultProxySelectorProvider(Thread thread) {
|
||||
this.currentThread = thread;
|
||||
}
|
||||
|
||||
public DefaultProxySelectorProvider(String host) {
|
||||
this.host = host;
|
||||
if (StringUtils.isNotBlank(this.host)) {
|
||||
this.host = this.host.toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getKey() {
|
||||
if (this.currentThread != null) {
|
||||
return currentThread;
|
||||
}
|
||||
if (this.host != null) {
|
||||
return this.host;
|
||||
}
|
||||
return super.getKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHandle(URI uri) {
|
||||
if (disableDefaultSelectorProvider) {
|
||||
return false;
|
||||
}
|
||||
if (currentThread != null && Thread.currentThread() == currentThread) {
|
||||
return true;
|
||||
}
|
||||
if (host != null) {
|
||||
if (uri == null) {
|
||||
return false;
|
||||
}
|
||||
String uriHost = uri.getHost();
|
||||
if (StringUtils.isNotBlank(uriHost)) {
|
||||
return this.host.equals(uriHost.toLowerCase());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Proxy> select(URI uri) {
|
||||
List<Proxy> result = new ArrayList<>();
|
||||
try {
|
||||
ProxySelector defaultProxySelector = getDefaultProxySelector();
|
||||
if (defaultProxySelector != null) {
|
||||
List<Proxy> defaultProxys = defaultProxySelector.select(uri);
|
||||
if (defaultProxys != null && !defaultProxys.isEmpty()) {
|
||||
for (Proxy proxy : defaultProxys) {
|
||||
SocketAddress addr = null;
|
||||
Proxy.Type proxyType = null;
|
||||
if (proxy != null) {
|
||||
proxyType = proxy.type();
|
||||
addr = proxy.address();
|
||||
}
|
||||
if (Proxy.Type.DIRECT == proxyType || (addr != null
|
||||
&& StringUtils.equals(uri.getHost(), ((InetSocketAddress) addr).getHostString()))) {
|
||||
result.add(Proxy.NO_PROXY);
|
||||
} else {
|
||||
result.add(proxy);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -58,6 +58,8 @@ public class UpdatesHelper {
|
||||
|
||||
public static final String COMPONENT_SUFFIX = "_java.xml";
|
||||
|
||||
public static final String COMPONENT_TEMPLATES = "templates";
|
||||
|
||||
public static final String NEW_COMPONENT_PREFIX = "installer$$";
|
||||
|
||||
public static boolean existArtifacts(File base) {
|
||||
@@ -296,6 +298,9 @@ public class UpdatesHelper {
|
||||
|
||||
public static boolean isOldComponent(File f) {
|
||||
if (f != null && f.exists() && f.isDirectory()) {
|
||||
if (f.getName().equals(COMPONENT_TEMPLATES)) {
|
||||
return true;
|
||||
}
|
||||
File[] listFiles = f.listFiles();
|
||||
if (listFiles != null) {
|
||||
for (File subFile : listFiles) {
|
||||
|
||||
@@ -49,11 +49,17 @@ public class EclipseCommandLine {
|
||||
*/
|
||||
static public final String TALEND_PROJECT_TYPE_COMMAND = "-talendProjectType"; //$NON-NLS-1$
|
||||
|
||||
static public final String TALEND_LICENCE_PATH = "talend.licence.path"; //$NON-NLS-1$
|
||||
|
||||
static public final String ARG_TALEND_LICENCE_PATH = "-" + TALEND_LICENCE_PATH; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* for relaunch of the plugins when relaunching the Studio
|
||||
*/
|
||||
static public final String TALEND_RELOAD_COMMAND = "-talendReload"; //$NON-NLS-1$
|
||||
|
||||
static public final String LOGIN_ONLINE_UPDATE = "--loginOnlineUpdate";
|
||||
|
||||
static public final String ARG_TALEND_BUNDLES_CLEANED = "-talend.studio.bundles.cleaned"; //$NON-NLS-1$
|
||||
|
||||
static public final String PROP_TALEND_BUNDLES_DO_CLEAN = "-talend.studio.bundles.doclean"; //$NON-NLS-1$
|
||||
|
||||
@@ -215,8 +215,12 @@ public class LockerByKey<KP> implements ILockerByKey<KP> {
|
||||
checkKey(key);
|
||||
blockOperationIfRequired();
|
||||
incrementRunningOperations();
|
||||
LockerValue<KP> lockerValue = prepareInternalLock(key);
|
||||
decrementRunningOperations();
|
||||
LockerValue<KP> lockerValue;
|
||||
try {
|
||||
lockerValue = prepareInternalLock(key);
|
||||
} finally {
|
||||
this.decrementRunningOperations();
|
||||
}
|
||||
lockerValue.getLock().lockInterruptibly();
|
||||
traceStackForDebugging(lockerValue);
|
||||
}
|
||||
@@ -239,8 +243,12 @@ public class LockerByKey<KP> implements ILockerByKey<KP> {
|
||||
checkKey(key);
|
||||
blockOperationIfRequired();
|
||||
incrementRunningOperations();
|
||||
LockerValue<KP> lockerValue = prepareInternalLock(key);
|
||||
decrementRunningOperations();
|
||||
LockerValue<KP> lockerValue;
|
||||
try {
|
||||
lockerValue = this.prepareInternalLock(key);
|
||||
} finally {
|
||||
this.decrementRunningOperations();
|
||||
}
|
||||
boolean locked = lockerValue.getLock().tryLock();
|
||||
if (locked) {
|
||||
traceStackForDebugging(lockerValue);
|
||||
@@ -283,8 +291,12 @@ public class LockerByKey<KP> implements ILockerByKey<KP> {
|
||||
checkKey(key);
|
||||
blockOperationIfRequired();
|
||||
incrementRunningOperations();
|
||||
LockerValue<KP> lockerValue = prepareInternalLock(key);
|
||||
decrementRunningOperations();
|
||||
LockerValue<KP> lockerValue;
|
||||
try {
|
||||
lockerValue = this.prepareInternalLock(key);
|
||||
} finally {
|
||||
this.decrementRunningOperations();
|
||||
}
|
||||
interruptIfStopping();
|
||||
boolean locked = lockerValue.getLock().tryLock(timeout, unit);
|
||||
if (locked) {
|
||||
@@ -322,13 +334,17 @@ public class LockerByKey<KP> implements ILockerByKey<KP> {
|
||||
checkKey(key);
|
||||
blockOperationIfRequired();
|
||||
incrementRunningOperations();
|
||||
LockerValue<KP> lockerValue = getLockerValue(key);
|
||||
boolean returnValue = false;
|
||||
if (lockerValue != null) {
|
||||
lockerValue.getLock().unlock();
|
||||
returnValue = true;
|
||||
LockerValue<KP> lockerValue = this.getLockerValue(key);
|
||||
boolean returnValue;
|
||||
try {
|
||||
returnValue = false;
|
||||
if (lockerValue != null) {
|
||||
lockerValue.getLock().unlock();
|
||||
returnValue = true;
|
||||
}
|
||||
} finally {
|
||||
this.decrementRunningOperations();
|
||||
}
|
||||
decrementRunningOperations();
|
||||
cleanAccordingOperations();
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
@@ -339,7 +339,7 @@ public class BackgroundRefresher implements IBackgroundRefresher {
|
||||
}
|
||||
if ((WindowSystem.isGTK() || EnvironmentUtils.isMacOsSytem()) && child instanceof Tree) {
|
||||
returnedPoint.y += ((Tree) child).getHeaderHeight();
|
||||
returnedPoint.y += ((Table) child).getItemHeight();
|
||||
returnedPoint.y += ((Tree) child).getItemHeight();
|
||||
}
|
||||
child = child.getParent();
|
||||
ScrollBar vScrollBar = child.getVerticalBar();
|
||||
|
||||
@@ -104,7 +104,6 @@ public class TableToTreeLinker<D1, D2> extends BgDrawableComposite implements IB
|
||||
this.source = sourceTable;
|
||||
|
||||
dataToTableItemCache = new DataToTableItemCache(sourceTable);
|
||||
|
||||
}
|
||||
|
||||
protected IStyleLink getDefaultStyleLink() {
|
||||
@@ -232,7 +231,7 @@ public class TableToTreeLinker<D1, D2> extends BgDrawableComposite implements IB
|
||||
|
||||
int yStraight = sourceToCommonPoint.y + treeItemHeight / 2 + tableItemBounds.y;
|
||||
pointEndStraight.x = sourceToCommonPoint.x + xStartBezierLink;
|
||||
if (Platform.OS_MACOSX.equals(Platform.getOS())) {
|
||||
if (Platform.OS_MACOSX.equals(Platform.getOS()) || Platform.OS_LINUX.equals(Platform.getOS())) {
|
||||
pointStartStraight.x = sourceToCommonPoint.x + tableItem.getParent().getBounds().width;
|
||||
pointEndStraight.x = pointStartStraight.x;
|
||||
} else {
|
||||
@@ -311,10 +310,10 @@ public class TableToTreeLinker<D1, D2> extends BgDrawableComposite implements IB
|
||||
// Added by Marvin Wang on Nov. 28, 2012 for bug TDI-23378. This is not the best way to fix this issue,
|
||||
// but till now I have not found the root cause.
|
||||
if (Platform.OS_LINUX.equals(Platform.getOS())) {
|
||||
pointEndCentralCurve.y = pointEndCentralCurve.y - tableItem.getBounds().height;
|
||||
pointEndCentralCurve.y = pointEndCentralCurve.y - tableItem.getBounds().height - treeItemHeight / 2;
|
||||
}
|
||||
if (Platform.OS_MACOSX.equals(Platform.getOS())) {
|
||||
pointEndCentralCurve.y = pointEndCentralCurve.y + tableItem.getBounds(0).height;
|
||||
pointEndCentralCurve.y = pointEndCentralCurve.y - tableItem.getBounds().height;
|
||||
}
|
||||
drawableLink.setPoint1(pointEndStraight);
|
||||
drawableLink.setPoint2(pointEndCentralCurve);
|
||||
|
||||
@@ -117,6 +117,7 @@ public class JobAndNodesParametersRelationshipHandler implements IItemRelationsh
|
||||
}
|
||||
}
|
||||
}
|
||||
relationsMap.values().removeIf(value -> value.isEmpty());
|
||||
return relationsMap;
|
||||
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ package org.talend.core.repository.handlers;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.talend.core.model.properties.Item;
|
||||
@@ -43,8 +44,13 @@ public class JobRoutinesItemRelationshipHandler extends AbstractJobItemRelations
|
||||
Set<Relation> relationSet = new HashSet<Relation>();
|
||||
|
||||
if (processType.getParameters() != null && processType.getParameters().getRoutinesParameter() != null) {
|
||||
Map<String, String> currentSystemRoutinesMap = RelationshipItemBuilder.getInstance().getCurrentSystemRoutinesMap();
|
||||
for (Object o : processType.getParameters().getRoutinesParameter()) {
|
||||
RoutinesParameterType itemInfor = (RoutinesParameterType) o;
|
||||
if (currentSystemRoutinesMap.containsValue(itemInfor.getName())) {
|
||||
// exclude system routines relation
|
||||
continue;
|
||||
}
|
||||
|
||||
Relation addedRelation = new Relation();
|
||||
addedRelation.setId(itemInfor.getName());
|
||||
|
||||
@@ -23,4 +23,9 @@ public class SyncLibrariesLoginTask extends AbstractLoginTask implements IRunnab
|
||||
coreService.createStatsLogAndImplicitParamter(ProjectManager.getInstance().getCurrentProject());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRequiredAlways() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1064,6 +1064,9 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
}
|
||||
if (newProject != null && newProject.getEmfProject() != null) {
|
||||
List<FolderItem> folderItems = ProjectManager.getInstance().getFolders(newProject.getEmfProject());
|
||||
if (folderItems != null) {
|
||||
folderItems = new ArrayList<>(folderItems);
|
||||
}
|
||||
for (FolderItem folder : folderItems) {
|
||||
String folderName = folder.getProperty().getLabel();
|
||||
if (("process".equals(folderName) || "joblets".equals(folderName)) && folder.getChildren() != null
|
||||
|
||||
@@ -15,6 +15,7 @@ package org.talend.core.repository.model;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyChangeSupport;
|
||||
import java.io.File;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
@@ -70,6 +71,7 @@ import org.talend.commons.runtime.service.ITaCoKitService;
|
||||
import org.talend.commons.ui.gmf.util.DisplayUtils;
|
||||
import org.talend.commons.ui.runtime.exception.MessageBoxExceptionHandler;
|
||||
import org.talend.commons.utils.data.container.RootContainer;
|
||||
import org.talend.commons.utils.network.TalendProxySelector;
|
||||
import org.talend.commons.utils.time.TimeMeasure;
|
||||
import org.talend.commons.utils.workbench.resources.ResourceUtils;
|
||||
import org.talend.core.AbstractDQModelService;
|
||||
@@ -83,6 +85,7 @@ import org.talend.core.context.Context;
|
||||
import org.talend.core.context.RepositoryContext;
|
||||
import org.talend.core.exception.TalendInternalPersistenceException;
|
||||
import org.talend.core.hadoop.BigDataBasicUtil;
|
||||
import org.talend.core.model.general.ILibrariesService;
|
||||
import org.talend.core.model.general.ModuleNeeded;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.metadata.MetadataTalendType;
|
||||
@@ -107,6 +110,7 @@ import org.talend.core.model.properties.SpagoBiServer;
|
||||
import org.talend.core.model.properties.Status;
|
||||
import org.talend.core.model.properties.User;
|
||||
import org.talend.core.model.properties.impl.FolderItemImpl;
|
||||
import org.talend.core.model.relationship.RelationshipItemBuilder;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.Folder;
|
||||
import org.talend.core.model.repository.IRepositoryContentHandler;
|
||||
@@ -122,6 +126,8 @@ import org.talend.core.repository.constants.Constant;
|
||||
import org.talend.core.repository.constants.FileConstants;
|
||||
import org.talend.core.repository.i18n.Messages;
|
||||
import org.talend.core.repository.recyclebin.RecycleBinManager;
|
||||
import org.talend.core.repository.utils.ProjectDataJsonProvider;
|
||||
import org.talend.core.repository.utils.LoginTaskRegistryReader;
|
||||
import org.talend.core.repository.utils.RepositoryPathProvider;
|
||||
import org.talend.core.repository.utils.XmiResourceManager;
|
||||
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||
@@ -132,6 +138,7 @@ import org.talend.core.service.ICoreUIService;
|
||||
import org.talend.cwm.helper.SubItemHelper;
|
||||
import org.talend.cwm.helper.TableHelper;
|
||||
import org.talend.designer.runprocess.IRunProcessService;
|
||||
import org.talend.login.ILoginTask;
|
||||
import org.talend.repository.ProjectManager;
|
||||
import org.talend.repository.ReferenceProjectProblemManager;
|
||||
import org.talend.repository.ReferenceProjectProvider;
|
||||
@@ -173,6 +180,8 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
|
||||
private boolean isCancelled;
|
||||
|
||||
private static final LoginTaskRegistryReader LOGIN_TASK_REGISTRY_READER = new LoginTaskRegistryReader();
|
||||
|
||||
@Override
|
||||
public synchronized void addPropertyChangeListener(PropertyChangeListener l) {
|
||||
if (l == null) {
|
||||
@@ -222,6 +231,13 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
return null;
|
||||
}
|
||||
|
||||
private ILibrariesService getLibrariesService() {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ILibrariesService.class)) {
|
||||
return GlobalServiceRegister.getDefault().getService(ILibrariesService.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
@@ -2020,6 +2036,11 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
|
||||
TimeMeasure.begin("logOnProject"); //$NON-NLS-1$
|
||||
try {
|
||||
/**
|
||||
* init/check proxy selector, in case default proxy selector is not registed yet
|
||||
*/
|
||||
TalendProxySelector.checkProxy();
|
||||
|
||||
System.getProperties().put("ReadOnlyUser", Boolean.FALSE.toString()); //$NON-NLS-1$
|
||||
|
||||
// remove the auto-build to enhance the build speed and application's use
|
||||
@@ -2039,6 +2060,7 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
SubMonitor subMonitor = SubMonitor.convert(monitor, MAX_TASKS);
|
||||
SubMonitor currentMonitor = subMonitor.newChild(1, SubMonitor.SUPPRESS_NONE);
|
||||
currentMonitor.beginTask(Messages.getString("ProxyRepositoryFactory.logonInProgress"), 1); //$NON-NLS-1$
|
||||
|
||||
project.setReferenceProjectProvider(null);
|
||||
getRepositoryContext().setProject(null);
|
||||
initEmfProjectContent();
|
||||
@@ -2056,6 +2078,12 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
this.repositoryFactoryFromProvider.beforeLogon(project);
|
||||
ProjectManager.getInstance().getBeforeLogonRecords().clear();
|
||||
ProjectManager.getInstance().getUpdatedRemoteHandlerRecords().clear();
|
||||
ILibrariesService librariesService = getLibrariesService();
|
||||
if (librariesService != null) {
|
||||
librariesService.setForceReloadCustomUri();
|
||||
}
|
||||
|
||||
ProjectDataJsonProvider.checkAndRectifyRelationShipSetting(project.getEmfProject());
|
||||
|
||||
// init dynamic distirbution after `beforeLogon`, before loading libraries.
|
||||
initDynamicDistribution(monitor);
|
||||
@@ -2226,6 +2254,11 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
// regenerate relationship index
|
||||
if (project.getEmfProject().getItemsRelations().isEmpty()) {
|
||||
RelationshipItemBuilder.getInstance().buildAndSaveIndex();
|
||||
}
|
||||
|
||||
fullLogonFinished = true;
|
||||
this.repositoryFactoryFromProvider.afterLogon(monitor);
|
||||
} finally {
|
||||
@@ -2405,9 +2438,14 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void executeRepositoryWorkUnit(RepositoryWorkUnit workUnit) {
|
||||
checkProxySettings();
|
||||
this.repositoryFactoryFromProvider.executeRepositoryWorkUnit(workUnit);
|
||||
}
|
||||
|
||||
private void checkProxySettings() {
|
||||
TalendProxySelector.checkProxy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unloadResources(Property property) throws PersistenceException {
|
||||
repositoryFactoryFromProvider.unloadResources(property);
|
||||
@@ -2628,4 +2666,13 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
public RepositoryWorkUnit getWorkUnitInProgress() {
|
||||
return repositoryFactoryFromProvider.getWorkUnitInProgress();
|
||||
}
|
||||
|
||||
public void executeRequiredLoginTasks(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
||||
ILoginTask[] allLoginTasks = LOGIN_TASK_REGISTRY_READER.getAllTaskListInstance();
|
||||
for (ILoginTask task : allLoginTasks) {
|
||||
if (task.isRequiredAlways()) {
|
||||
task.run(monitor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ package org.talend.core.repository.recyclebin;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
@@ -24,6 +25,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
@@ -106,7 +108,8 @@ public class RecycleBinManager {
|
||||
List<IRepositoryViewObject> deletedObjects = new ArrayList<IRepositoryViewObject>();
|
||||
final EList<TalendItem> deletedItems = projectRecyclebins.get(project.getTechnicalLabel()).getDeletedItems();
|
||||
List<TalendItem> notDeletedItems = new ArrayList<TalendItem>();
|
||||
for (TalendItem deletedItem : deletedItems) {
|
||||
List<TalendItem> dup_deletedItems = new ArrayList<>(deletedItems);
|
||||
for (TalendItem deletedItem : dup_deletedItems) {
|
||||
try {
|
||||
final ERepositoryObjectType type = ERepositoryObjectType.getType(deletedItem.getType());
|
||||
// ignore the generated doc in recycle bin
|
||||
@@ -274,7 +277,40 @@ public class RecycleBinManager {
|
||||
resource = createRecycleBinResource(project);
|
||||
}
|
||||
resource.getContents().clear();
|
||||
recycleBin.setLastUpdate(new Date());
|
||||
EList<String> deletedFolders = recycleBin.getDeletedFolders();
|
||||
if (deletedFolders != null) {
|
||||
List<String> folders = new LinkedList<>(deletedFolders);
|
||||
Collections.sort(folders);
|
||||
deletedFolders.clear();
|
||||
deletedFolders.addAll(folders);
|
||||
}
|
||||
EList<TalendItem> deletedItems = recycleBin.getDeletedItems();
|
||||
if (deletedItems != null) {
|
||||
List<TalendItem> items = new LinkedList<>(deletedItems);
|
||||
items.sort((l, r) -> {
|
||||
if (l == null && r == null) {
|
||||
return 0;
|
||||
} else if (l == null) {
|
||||
return -1;
|
||||
} else if (r == null) {
|
||||
return 1;
|
||||
}
|
||||
int result = StringUtils.compare(l.getType(), r.getType());
|
||||
if (result != 0) {
|
||||
return result;
|
||||
}
|
||||
result = StringUtils.compare(l.getPath(), r.getPath());
|
||||
if (result != 0) {
|
||||
return result;
|
||||
}
|
||||
return StringUtils.compare(l.getId(), r.getId());
|
||||
});
|
||||
deletedItems.clear();
|
||||
deletedItems.addAll(items);
|
||||
}
|
||||
|
||||
// set date to null to avoid timezone conflict
|
||||
recycleBin.setLastUpdate(null);
|
||||
resource.getContents().add(recycleBin);
|
||||
EmfHelper.saveResource(resource);
|
||||
lastSavedRecycleBinMap.put(recycleBin, EcoreUtil.copy(recycleBin));
|
||||
|
||||
@@ -35,6 +35,7 @@ import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.commons.utils.workbench.resources.ResourceUtils;
|
||||
import org.talend.core.model.properties.ImplicitContextSettings;
|
||||
@@ -46,6 +47,7 @@ import org.talend.core.model.properties.Project;
|
||||
import org.talend.core.model.properties.StatAndLogsSettings;
|
||||
import org.talend.core.model.properties.Status;
|
||||
import org.talend.core.model.properties.impl.PropertiesFactoryImpl;
|
||||
import org.talend.core.model.relationship.RelationshipItemBuilder;
|
||||
import org.talend.core.repository.constants.FileConstants;
|
||||
import org.talend.core.repository.recyclebin.RecycleBinManager;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType;
|
||||
@@ -81,6 +83,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);
|
||||
}
|
||||
@@ -191,9 +199,10 @@ public class ProjectDataJsonProvider {
|
||||
ProjectDataJsonProvider.loadProjectSettings(project, input);
|
||||
}
|
||||
IPath relationShipPath = settingFolderPath.append(FileConstants.RELATIONSHIP_FILE_NAME);
|
||||
input = inputStreamProvider.getStream(relationShipPath);
|
||||
if (input != null) {
|
||||
ProjectDataJsonProvider.loadRelationShips(project, input);
|
||||
try (InputStream is = inputStreamProvider.getStream(relationShipPath)) {
|
||||
if (is != null) {
|
||||
ProjectDataJsonProvider.loadRelationShips(project, is);
|
||||
}
|
||||
}
|
||||
IPath migrationTaskPath = settingFolderPath.append(FileConstants.MIGRATION_TASK_FILE_NAME);
|
||||
input = inputStreamProvider.getStream(migrationTaskPath);
|
||||
@@ -235,10 +244,11 @@ public class ProjectDataJsonProvider {
|
||||
private static void loadRelationShips(Project project, IPath projectFolderPath) throws PersistenceException {
|
||||
File file = getLoadingConfigurationFile(projectFolderPath, FileConstants.RELATIONSHIP_FILE_NAME);
|
||||
if (file != null && file.exists()) {
|
||||
try {
|
||||
loadRelationShips(project, new FileInputStream(file));
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new PersistenceException(e);
|
||||
try (FileInputStream fis = new FileInputStream(file)) {
|
||||
loadRelationShips(project, fis);
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -257,11 +267,72 @@ public class ProjectDataJsonProvider {
|
||||
project.getItemsRelations().add(json.toEmfObject());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkAndRectifyRelationShipSetting(Project project) throws PersistenceException {
|
||||
File file = getSavingConfigurationFile(project.getTechnicalLabel(), FileConstants.RELATIONSHIP_FILE_NAME);
|
||||
if (file == null || !file.exists()) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<ItemRelationsJson> itemRelationsJsonsList = null;
|
||||
TypeReference<List<ItemRelationsJson>> typeReference = new TypeReference<List<ItemRelationsJson>>() {
|
||||
};
|
||||
FileInputStream input = null;
|
||||
try {
|
||||
input = new FileInputStream(file);
|
||||
itemRelationsJsonsList = new ObjectMapper().readValue(new FileInputStream(file), typeReference);
|
||||
} catch (Exception e) {
|
||||
throw new PersistenceException(e);
|
||||
} finally {
|
||||
closeInputStream(input);
|
||||
}
|
||||
|
||||
if (itemRelationsJsonsList == null || itemRelationsJsonsList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Set<String> idVersionSet = new HashSet<String>();
|
||||
List<ItemRelationsJson> relationJsonList = new ArrayList<ItemRelationsJson>();
|
||||
Map<String, String> currentSystemRoutinesMap = RelationshipItemBuilder.getInstance().getCurrentSystemRoutinesMap();
|
||||
boolean needModify = false;
|
||||
for (ItemRelationsJson relationJson : itemRelationsJsonsList) {
|
||||
ItemRelationJson baseItem = relationJson.getBaseItem();
|
||||
String idversion = baseItem.getId() + ";" + baseItem.getVersion();
|
||||
if (idVersionSet.contains(idversion)) {
|
||||
// in case duplicate
|
||||
needModify = true;
|
||||
continue;
|
||||
}
|
||||
// remove system routines relation
|
||||
int originalSize = relationJson.getRelatedItems().size();
|
||||
relationJson.getRelatedItems()
|
||||
.removeIf(relatedItem -> RelationshipItemBuilder.ROUTINE_RELATION.equals(relatedItem.getType())
|
||||
&& currentSystemRoutinesMap.containsValue(relatedItem.getId()));
|
||||
if (relationJson.getRelatedItems().size() != originalSize) {
|
||||
needModify = true;
|
||||
}
|
||||
if (!relationJson.getRelatedItems().isEmpty()) {
|
||||
relationJsonList.add(relationJson);
|
||||
}
|
||||
idVersionSet.add(idversion);
|
||||
}
|
||||
|
||||
if (needModify) {
|
||||
// re-load to project
|
||||
if (relationJsonList != null && !relationJsonList.isEmpty()) {
|
||||
project.getItemsRelations().clear();
|
||||
for (ItemRelationsJson json : relationJsonList) {
|
||||
project.getItemsRelations().add(json.toEmfObject());
|
||||
}
|
||||
}
|
||||
// re-save relationship setting json file
|
||||
saveRelationShips(project);
|
||||
}
|
||||
}
|
||||
|
||||
private static void loadMigrationTaskSetting(Project project, IPath projectFolderPath) throws PersistenceException {
|
||||
|
||||
@@ -131,4 +131,22 @@ public class ProjectHelper {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* define the different value for the project types the string value in the licence files Matcht the java enum name
|
||||
* this is a copy of org.talend.commons.model.KeyConstants.ProjectType to avoid adding the all library
|
||||
*
|
||||
*/
|
||||
public static enum ProjectType {
|
||||
DI,
|
||||
DQ,
|
||||
MDM;
|
||||
}
|
||||
|
||||
public static int getProjectTypeOrdinal(org.talend.core.model.properties.Project project) {
|
||||
if (project != null && project.getType() != null) {
|
||||
return ProjectType.valueOf(project.getType()).ordinal();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Priority;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
@@ -37,6 +38,7 @@ import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.eclipse.emf.common.util.URI;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.emf.ecore.resource.Resource;
|
||||
@@ -69,6 +71,7 @@ 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.repository.constants.FileConstants;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
import org.talend.core.repository.utils.ResourceFilenameHelper.FileName;
|
||||
import org.talend.core.ui.ITestContainerProviderService;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ProcessType;
|
||||
@@ -647,6 +650,23 @@ public class XmiResourceManager {
|
||||
}
|
||||
|
||||
public void saveResource(Resource resource) throws PersistenceException {
|
||||
try {
|
||||
if (resource != null) {
|
||||
Object objectByType = EcoreUtil.getObjectByType(resource.getContents(), PropertiesPackage.eINSTANCE.getProject());
|
||||
if (objectByType != null) {
|
||||
Project project = (Project) objectByType;
|
||||
EList migrationTasks = project.getMigrationTask();
|
||||
if (migrationTasks != null && 1 < migrationTasks.size()) {
|
||||
org.talend.commons.exception.ExceptionHandler.process(new Exception("Bad saving logic for Project"),
|
||||
Priority.WARN);
|
||||
ProxyRepositoryFactory.getInstance().saveProject(new org.talend.core.model.general.Project(project));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
org.talend.commons.exception.ExceptionHandler.process(e);
|
||||
}
|
||||
EmfHelper.saveResource(resource);
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,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.eclipse.m2e.core
|
||||
Bundle-Activator: org.talend.core.runtime.CoreRuntimePlugin
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-ClassPath: .,
|
||||
|
||||
@@ -9,13 +9,14 @@
|
||||
<dbType type="CHAR" defaultLength="50" ignorePre="true"/>
|
||||
<dbType type="CHARACTER" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="CHARACTER VARYING" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="DATE" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="DATE" ignoreLen="true" ignorePre="true" defaultPattern="dd-MM-yyyy" />
|
||||
<dbType type="DATETIME" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="DECIMAL" defaultLength="20" defaultPrecision="10" />
|
||||
<dbType type="DOUBLE PRECISION" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="UNSIGNED INT" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="FLOAT" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="INT" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="INTEGER" defaultLength="10" ignorePre="false" />
|
||||
<dbType type="NUMERIC" defaultLength="20" defaultPrecision="10"/>
|
||||
<dbType type="REAL" />
|
||||
<dbType type="SMALLINT" ignoreLen="true" ignorePre="true" />
|
||||
@@ -175,6 +176,11 @@
|
||||
<talendType type="id_Short"/>
|
||||
<talendType type="id_Long"/>
|
||||
</dbType>
|
||||
<dbType type="INTEGER">
|
||||
<talendType type="id_Integer" default="true" />
|
||||
<talendType type="id_Short"/>
|
||||
<talendType type="id_Long"/>
|
||||
</dbType>
|
||||
<dbType type="NUMERIC">
|
||||
<talendType type="id_Double"/>
|
||||
<talendType type="id_Float"/>
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
<dbType type="xs:time" ignoreLen="true" ignorePre="true"/>
|
||||
<dbType type="xs:decimal" ignoreLen="true" ignorePre="true"/>
|
||||
<dbType type="xs:QName" ignoreLen="true" ignorePre="true"/>
|
||||
<dbType type="xs:list" ignoreLen="true" ignorePre="true"/>
|
||||
<dbType type="xs:union" ignoreLen="true" ignorePre="true"/>
|
||||
</dbTypes>
|
||||
|
||||
<language name="java">
|
||||
@@ -141,6 +143,12 @@
|
||||
<dbType type="xs:time">
|
||||
<talendType type="id_Date" default="true" />
|
||||
</dbType>
|
||||
<dbType type="xs:list">
|
||||
<talendType type="id_List" default="true" />
|
||||
</dbType>
|
||||
<dbType type="xs:union">
|
||||
<talendType type="id_Object" default="true" />
|
||||
</dbType>
|
||||
</dbToTalendTypes>
|
||||
</language>
|
||||
</dbms>
|
||||
|
||||
@@ -100,6 +100,11 @@
|
||||
<xs:restriction base="xs:short"/>
|
||||
</xs:simpleType>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="defaultPattern">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string"/>
|
||||
</xs:simpleType>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="default" type="xs:boolean"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
@@ -12,11 +12,14 @@
|
||||
// ============================================================================
|
||||
package org.talend.core;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.talend.core.model.process.INode;
|
||||
import org.talend.core.model.process.IProcess;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.utils.IXSDPopulationUtil;
|
||||
@@ -47,6 +50,8 @@ public interface IESBService extends IService {
|
||||
|
||||
public StringBuffer getAllTheJObNames(IRepositoryNode jobList);
|
||||
|
||||
public List<String> getSerivceRelatedJobIds(Item serviceItem);
|
||||
|
||||
public void deleteOldRelation(String jobID);
|
||||
|
||||
// public void setSelectedItem(Item, )
|
||||
@@ -59,6 +64,8 @@ public interface IESBService extends IService {
|
||||
|
||||
public void copyDataServiceRelateJob(Item newItem);
|
||||
|
||||
public boolean isRESTService(ProcessItem processItem);
|
||||
|
||||
public IXSDPopulationUtil getXSDPopulationUtil();
|
||||
|
||||
public boolean isWSDLEditor(IWorkbenchPart part);
|
||||
|
||||
@@ -206,8 +206,12 @@ public interface ILibraryManagerService extends IService {
|
||||
*/
|
||||
public boolean isJarNeedToBeDeployed(File jarFile);
|
||||
|
||||
public boolean isSameFile(File f1, File f2);
|
||||
|
||||
public void checkModuleStatus(ModuleNeeded module);
|
||||
|
||||
public String getJarNameFromMavenuri(String mavenURI);
|
||||
|
||||
public void guessMavenRUIFromIndex(File jarFile, Map<String, String> sourceAndMavenUri);
|
||||
|
||||
}
|
||||
|
||||
@@ -53,6 +53,8 @@ public enum EDatabaseTypeName {
|
||||
"IBM DB2 ZOS", "IBM DB2 ZOS", Boolean.TRUE, "IBM_DB2", "DB2", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
SYBASEASE(
|
||||
"SybaseASE", "Sybase (ASE and IQ)", Boolean.TRUE, "SYBASE", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
SYBASEASE_SA(
|
||||
"SybaseASE", "SQL Anywhere", Boolean.TRUE, "SYBASE", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
|
||||
// this Sybase IQ not used.
|
||||
SYBASEIQ(
|
||||
|
||||
@@ -302,4 +302,11 @@ public class ConnParameterKeys {
|
||||
|
||||
public static final String CONN_PARA_KEY_DATABRICKS_DBFS_DEP_FOLDER="CONN_PARA_KEY_DATABRICKS_DBFS_DEP_FOLDER";
|
||||
|
||||
/**
|
||||
* Override hadoop configuration
|
||||
*/
|
||||
public static final String CONN_PARA_KEY_SET_HADOOP_CONF = "CONN_PARA_KEY_SET_HADOOP_CONF";
|
||||
|
||||
public static final String CONN_PARA_KEY_HADOOP_CONF_SPECIFIC_JAR = "CONN_PARA_KEY_HADOOP_CONF_SPECIFIC_JAR";
|
||||
|
||||
}
|
||||
|
||||
@@ -47,6 +47,8 @@ public class DatabaseConnStrUtil {
|
||||
// for match url has :<port> exist
|
||||
private static final String PATTERN_PORT = "(:\\d{1,5})";
|
||||
|
||||
private static final String DATABASE_STRING = "DATABASE=";
|
||||
|
||||
private static String getStringReplace(final String init, final String before, final String after,
|
||||
final boolean supportContext) {
|
||||
return getStringReplace(init, before, after, supportContext, false);
|
||||
@@ -127,6 +129,13 @@ public class DatabaseConnStrUtil {
|
||||
} else {
|
||||
s = getStringReplace(s, EDatabaseConnVar.PORT.getVariable(), port, supportContext);
|
||||
}
|
||||
if (EDatabaseConnTemplate.TERADATA.equals(connStr)) {
|
||||
if (StringUtils.isNotBlank(sid)) {
|
||||
s = getStringReplace(s, EDatabaseConnVar.SID.getVariable(), DATABASE_STRING + sid, supportContext);
|
||||
} else {
|
||||
s = getStringReplace(s, EDatabaseConnVar.SID.getVariable() + ",", sid, supportContext); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
s = getStringReplace(s, EDatabaseConnVar.SID.getVariable(), sid, supportContext);
|
||||
s = getStringReplace(s, EDatabaseConnVar.SERVICE_NAME.getVariable(), sid, supportContext);
|
||||
s = getStringReplace(s, EDatabaseConnVar.DATASOURCE.getVariable(), datasource, supportContext);
|
||||
@@ -565,7 +574,7 @@ public class DatabaseConnStrUtil {
|
||||
List<ERepositoryObjectType> extraTypes = new ArrayList<>();
|
||||
IGenericDBService dbService = null;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericDBService.class)) {
|
||||
dbService = (IGenericDBService) GlobalServiceRegister.getDefault().getService(IGenericDBService.class);
|
||||
dbService = GlobalServiceRegister.getDefault().getService(IGenericDBService.class);
|
||||
}
|
||||
if (dbService != null) {
|
||||
extraTypes.addAll(dbService.getExtraTypes());
|
||||
|
||||
@@ -166,9 +166,9 @@ public enum EDatabaseVersion4Drivers {
|
||||
REDSHIFT(new DbVersion4Drivers(EDatabaseTypeName.REDSHIFT, "redshift", "REDSHIFT", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"redshift-jdbc42-no-awssdk-1.2.20.1043.jar")), //$NON-NLS-1$
|
||||
REDSHIFT_SSO(new DbVersion4Drivers(EDatabaseTypeName.REDSHIFT_SSO, "redshift sso", "REDSHIFT_SSO", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
new String[] { "redshift-jdbc42-no-awssdk-1.2.20.1043.jar", "aws-java-sdk-1.11.406.jar", "jackson-core-2.9.5.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"jackson-databind-2.9.5.jar", "jackson-annotations-2.9.0.jar", "httpcore-4.4.9.jar", "httpclient-4.5.5.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$//$NON-NLS-4$
|
||||
"joda-time-2.8.1.jar", "commons-logging-1.1.3.jar" })), //$NON-NLS-1$ //$NON-NLS-2$
|
||||
new String[] { "redshift-jdbc42-no-awssdk-1.2.20.1043.jar", "aws-java-sdk-1.11.406.jar", "jackson-core-2.9.9.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"jackson-databind-2.9.9.jar", "jackson-annotations-2.9.0.jar", "httpcore-4.4.9.jar", "httpclient-4.5.5.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$//$NON-NLS-4$
|
||||
"joda-time-2.8.1.jar", "commons-logging-1.1.3.jar", "commons-codec-1.6.jar" })), //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
AMAZON_AURORA(new DbVersion4Drivers(EDatabaseTypeName.AMAZON_AURORA, "mysql-connector-java-5.1.30-bin.jar")); //$NON-NLS-1$
|
||||
|
||||
|
||||
@@ -12,9 +12,13 @@
|
||||
// ============================================================================
|
||||
package org.talend.core.hadoop;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.core.classloader.ClassLoaderFactory;
|
||||
import org.talend.core.classloader.DynamicClassLoader;
|
||||
@@ -67,9 +71,18 @@ public class HadoopClassLoaderFactory2 {
|
||||
return getClassLoader(relatedClusterId, EHadoopCategory.HBASE, distribution, version, useKrb);
|
||||
}
|
||||
|
||||
public static ClassLoader getHadoopCustomClassLoader(String uid, Object customJars) {
|
||||
return HadoopClassLoaderFactory2.builder().withTypePrefix(EHadoopCategory.CUSTOM.getName()).withUid(uid)
|
||||
.build(customJars, true);
|
||||
public static ClassLoader getHadoopCustomClassLoader(String uid, String relatedClusterId, EHadoopCategory category,
|
||||
Object customJars, boolean useKrb) {
|
||||
ClassLoader classLoader = HadoopClassLoaderFactory2.builder().withTypePrefix(EHadoopCategory.CUSTOM.getName())
|
||||
.withUid(uid).build(customJars, true);
|
||||
if (StringUtils.isNotBlank(relatedClusterId) && classLoader instanceof DynamicClassLoader) {
|
||||
try {
|
||||
classLoader = addExtraJars(relatedClusterId, category, (DynamicClassLoader) classLoader, useKrb);
|
||||
} catch (MalformedURLException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
return classLoader;
|
||||
}
|
||||
|
||||
public static ClassLoader getHCatalogClassLoader(String relatedClusterId, String distribution, String version, boolean useKrb) {
|
||||
@@ -198,16 +211,35 @@ public class HadoopClassLoaderFactory2 {
|
||||
String[] addedJars = null;
|
||||
String[] excludedJars = null;
|
||||
String[] securityJars = getSecurityJars(category);
|
||||
String customConfsJarName = hadoopClusterService.getCustomConfsJarName(relatedClusterId);
|
||||
if (customConfsJarName != null) {
|
||||
addedJars = new String[] { customConfsJarName };
|
||||
|
||||
Optional<HadoopConfJarBean> customConfsJar = hadoopClusterService.getCustomConfsJar(relatedClusterId);
|
||||
HadoopConfJarBean confJarBean = customConfsJar.orElse(null);
|
||||
String customConfsJarName = customConfsJar.map(b -> b.getCustomConfJarName()).orElse(null);
|
||||
Consumer<DynamicClassLoader> afterLoaded = null;
|
||||
if (confJarBean != null) {
|
||||
if (confJarBean.isOverrideCustomConf()) {
|
||||
String overrideCustomConfPath = confJarBean.getOriginalOverrideCustomConfPath();
|
||||
if (StringUtils.isBlank(overrideCustomConfPath) || !new File(overrideCustomConfPath).exists()) {
|
||||
ExceptionHandler.process(
|
||||
new Exception("Set Hadoop configuration JAR path is invalid: " + overrideCustomConfPath));
|
||||
} else {
|
||||
afterLoaded = (t) -> t.addLibrary(overrideCustomConfPath);
|
||||
}
|
||||
} else {
|
||||
if (StringUtils.isNotBlank(customConfsJarName)) {
|
||||
addedJars = new String[] { customConfsJarName };
|
||||
}
|
||||
}
|
||||
excludedJars = securityJars;
|
||||
} else if (useKrb) {
|
||||
addedJars = securityJars;
|
||||
excludedJars = new String[] { customConfsJarName };
|
||||
}
|
||||
if (addedJars != null || excludedJars != null) {
|
||||
if (addedJars != null || excludedJars != null || afterLoaded != null) {
|
||||
cll = DynamicClassLoader.createNewOneBaseLoader(loader, addedJars, excludedJars);
|
||||
if (afterLoaded != null) {
|
||||
afterLoaded.accept(cll);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// 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.hadoop;
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public class HadoopConfJarBean {
|
||||
|
||||
private boolean overrideCustomConf;
|
||||
|
||||
private boolean isContextMode;
|
||||
|
||||
/**
|
||||
* value saved in connection, it may be a context
|
||||
*/
|
||||
private String overrideCustomConfPath;
|
||||
|
||||
/**
|
||||
* original value of the path, if connection is in context mode, then this value if the default value of the context
|
||||
*/
|
||||
private String originalOverrideCustomConfPath;
|
||||
|
||||
private String customConfJarName;
|
||||
|
||||
public HadoopConfJarBean(boolean isContextMode, boolean overrideCustomConf, String overrideCustomConfPath,
|
||||
String originalOverrideCustomConfPath, String customConfJarName) {
|
||||
this.isContextMode = isContextMode;
|
||||
this.overrideCustomConf = overrideCustomConf;
|
||||
this.overrideCustomConfPath = overrideCustomConfPath;
|
||||
this.originalOverrideCustomConfPath = originalOverrideCustomConfPath;
|
||||
this.customConfJarName = customConfJarName;
|
||||
}
|
||||
|
||||
public boolean isContextMode() {
|
||||
return isContextMode;
|
||||
}
|
||||
|
||||
public void setContextMode(boolean isContextMode) {
|
||||
this.isContextMode = isContextMode;
|
||||
}
|
||||
|
||||
public boolean isOverrideCustomConf() {
|
||||
return overrideCustomConf;
|
||||
}
|
||||
|
||||
public void setOverrideCustomConf(boolean overrideCustomConf) {
|
||||
this.overrideCustomConf = overrideCustomConf;
|
||||
}
|
||||
|
||||
public String getOriginalOverrideCustomConfPath() {
|
||||
return originalOverrideCustomConfPath;
|
||||
}
|
||||
|
||||
public void setOriginalOverrideCustomConfPath(String originalOverrideCustomConfPath) {
|
||||
this.originalOverrideCustomConfPath = originalOverrideCustomConfPath;
|
||||
}
|
||||
|
||||
public String getOverrideCustomConfPath() {
|
||||
return overrideCustomConfPath;
|
||||
}
|
||||
|
||||
public void setOverrideCustomConfPath(String overrideCustomConfPath) {
|
||||
this.overrideCustomConfPath = overrideCustomConfPath;
|
||||
}
|
||||
|
||||
public String getCustomConfJarName() {
|
||||
return customConfJarName;
|
||||
}
|
||||
|
||||
public void setCustomConfJarName(String customConfJarName) {
|
||||
this.customConfJarName = customConfJarName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "HadoopConfJarBean [overrideCustomConf=" + overrideCustomConf + ", isContextMode=" + isContextMode
|
||||
+ ", overrideCustomConfPath=" + overrideCustomConfPath + ", originalOverrideCustomConfPath="
|
||||
+ originalOverrideCustomConfPath + ", customConfJarName=" + customConfJarName + "]";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,6 +14,7 @@ package org.talend.core.hadoop;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.talend.commons.exception.BusinessException;
|
||||
@@ -232,11 +233,12 @@ public interface IHadoopClusterService extends IService {
|
||||
*/
|
||||
public Item getHadoopClusterItemById(String id);
|
||||
|
||||
public String getCustomConfsJarName(String id);
|
||||
public Optional<HadoopConfJarBean> getCustomConfsJar(String id);
|
||||
|
||||
public String getCustomConfsJarName(String id, boolean createJarIfNotExist, boolean addExtraIds);
|
||||
public Optional<HadoopConfJarBean> getCustomConfsJar(String id, boolean createJarIfNotExist, boolean addExtraIds);
|
||||
|
||||
public String getCustomConfsJarName(ConnectionItem connectionItem, boolean createJarIfNotExist, boolean addExtraIds);
|
||||
public Optional<HadoopConfJarBean> getCustomConfsJar(ConnectionItem connectionItem, boolean createJarIfNotExist,
|
||||
boolean addExtraIds);
|
||||
|
||||
public void useCustomConfsJarIfNeeded(List<ModuleNeeded> modulesNeeded, String clusterId);
|
||||
|
||||
|
||||
@@ -60,6 +60,15 @@ public interface IComponent {
|
||||
|
||||
public String getOriginalName();
|
||||
|
||||
/**
|
||||
* Only for component display (palette,search)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
default public String getDisplayName() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
public String getLongName();
|
||||
|
||||
public String getOriginalFamilyName();
|
||||
|
||||
@@ -23,6 +23,8 @@ public interface IMultipleComponentConnection {
|
||||
|
||||
public String getConnectionType();
|
||||
|
||||
public String getConnectorName();
|
||||
|
||||
public void setConnectionType(String connectionType);
|
||||
|
||||
public String getNameTarget();
|
||||
|
||||
@@ -14,6 +14,8 @@ package org.talend.core.model.components;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.talend.core.model.process.INode;
|
||||
|
||||
/**
|
||||
* DOC nrousseau class global comment. Detailled comment <br/>
|
||||
*
|
||||
@@ -33,4 +35,7 @@ public interface IMultipleComponentItem {
|
||||
public String getComponent();
|
||||
|
||||
public void setComponent(String component);
|
||||
|
||||
public void updateNode(INode newNode, INode oldNode);
|
||||
|
||||
}
|
||||
|
||||
@@ -50,4 +50,6 @@ public interface IMultipleComponentManager {
|
||||
|
||||
public boolean isLookupMode();
|
||||
|
||||
public String getParamSeperator();
|
||||
|
||||
}
|
||||
|
||||
@@ -383,7 +383,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());
|
||||
originalParamerters.add(contextParam.getName());
|
||||
boolean exists = true;
|
||||
try {
|
||||
|
||||
@@ -119,6 +119,8 @@ public interface ILibrariesService extends IService {
|
||||
List<ModuleNeeded> getModuleNeeded(String id, boolean isGroup);
|
||||
|
||||
public void deployProjectLibrary(File source) throws IOException;
|
||||
|
||||
public void setForceReloadCustomUri();
|
||||
|
||||
/**
|
||||
* Listener used to fire that libraries status has been changed (new lib or new check install).
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.talend.core.model.metadata;
|
||||
|
||||
public class DbDefaultDatePattern {
|
||||
private String defaultPattern;
|
||||
private String dbTypeName;
|
||||
|
||||
public DbDefaultDatePattern() {
|
||||
|
||||
}
|
||||
|
||||
public String getDefaultPattern() {
|
||||
return defaultPattern;
|
||||
}
|
||||
|
||||
public void setDefaultPattern(String defaultPattern) {
|
||||
this.defaultPattern = defaultPattern;
|
||||
}
|
||||
|
||||
public String getDbTypeName() {
|
||||
return dbTypeName;
|
||||
}
|
||||
|
||||
public void setDbTypeName(String dbTypeName) {
|
||||
this.dbTypeName = dbTypeName;
|
||||
}
|
||||
}
|
||||
@@ -41,6 +41,8 @@ public class Dbms {
|
||||
private Set<MappingType> talendToDbTypes;
|
||||
|
||||
private List<DbDefaultLengthAndPrecision> defaultLengthPrecision;
|
||||
|
||||
private List<DbDefaultDatePattern> defaultPattern;
|
||||
|
||||
private List<DbIgnoreLengthAndPrecision> ignoreLengthPrecision;
|
||||
|
||||
@@ -62,6 +64,14 @@ public class Dbms {
|
||||
List<DbDefaultLengthAndPrecision> defaultLengthPrecision) {
|
||||
this.defaultLengthPrecision = defaultLengthPrecision;
|
||||
}
|
||||
public List<DbDefaultDatePattern> getDefaultPattern() {
|
||||
return defaultPattern;
|
||||
}
|
||||
|
||||
public void setDefaultPattern(
|
||||
List<DbDefaultDatePattern> defaultLengthPrecision) {
|
||||
this.defaultPattern = defaultLengthPrecision;
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC amaumont Dbms constructor comment.
|
||||
|
||||
@@ -68,6 +68,8 @@ public interface IMetadataTable {
|
||||
public boolean sameMetadataAs(IMetadataTable meta);
|
||||
|
||||
public boolean sameMetadataAs(IMetadataTable other, int options);
|
||||
|
||||
public boolean sameMetadataAs(IMetadataTable other, int options, boolean order);
|
||||
|
||||
public void sortCustomColumns();
|
||||
|
||||
|
||||
@@ -45,6 +45,14 @@ public interface ISAPConstant {
|
||||
|
||||
public static final String CHANGING = "CHANGING";//$NON-NLS-1$
|
||||
|
||||
public static final String PARAMETER_TYPE = "PARAMETER_TYPE";//$NON-NLS-1$
|
||||
|
||||
public static final String PARAMETER_TYPE_IMPORT = "IMPORT";//$NON-NLS-1$
|
||||
|
||||
public static final String PARAMETER_TYPE_CHANGING = "CHANGING";//$NON-NLS-1$
|
||||
|
||||
public static final String PARAMETER_TYPE_TABLES = "TABLES";//$NON-NLS-1$
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -125,10 +125,12 @@ public class MappingFileLoader {
|
||||
// search and load preBeforelen nodes
|
||||
ArrayList<String> dbTypes = new ArrayList<String>();
|
||||
ArrayList<DbDefaultLengthAndPrecision> dbDefault = new ArrayList<DbDefaultLengthAndPrecision>();
|
||||
ArrayList<DbDefaultDatePattern> dbDefaultPattern = new ArrayList<DbDefaultDatePattern>();
|
||||
ArrayList<DbIgnoreLengthAndPrecision> dbIgnore = new ArrayList<DbIgnoreLengthAndPrecision>();
|
||||
ArrayList<DbPreBeforeLength> dbPbeforeLList = new ArrayList<DbPreBeforeLength>();
|
||||
dbms.setDbmsTypes(dbTypes);
|
||||
dbms.setDefaultLengthPrecision(dbDefault);
|
||||
dbms.setDefaultPattern(dbDefaultPattern);
|
||||
dbms.setIgnoreLengthPrecision(dbIgnore);
|
||||
dbms.setPrebeforelength(dbPbeforeLList);
|
||||
List<Node> typeNodes = getChildElementNodes(dbTypesNode);
|
||||
@@ -149,19 +151,25 @@ public class MappingFileLoader {
|
||||
dbTypes.add(typeValue);
|
||||
hAllDbTypes.add(typeValue);
|
||||
DbDefaultLengthAndPrecision dbDefaultLP = new DbDefaultLengthAndPrecision();
|
||||
DbDefaultDatePattern dbDefaultPt = new DbDefaultDatePattern();
|
||||
DbIgnoreLengthAndPrecision dbIgnoreLP = new DbIgnoreLengthAndPrecision();
|
||||
DbPreBeforeLength dbPBeforeL = new DbPreBeforeLength();
|
||||
// default length and precision
|
||||
Node defaultLengthItem = typeNodeAtttributes.getNamedItem("defaultLength"); //$NON-NLS-1$
|
||||
Node defaultPrecision = typeNodeAtttributes.getNamedItem("defaultPrecision"); //$NON-NLS-1$
|
||||
Node defaultPattern = typeNodeAtttributes.getNamedItem("defaultPattern"); //$NON-NLS-1$
|
||||
|
||||
if (defaultLengthItem != null)
|
||||
dbDefaultLP.setDefaultLength(Integer.parseInt(defaultLengthItem.getNodeValue()));
|
||||
if (defaultPrecision != null)
|
||||
dbDefaultLP.setDefaultPrecision(Integer.parseInt(defaultPrecision.getNodeValue()));
|
||||
if (defaultPattern != null)
|
||||
dbDefaultPt.setDefaultPattern(defaultPattern.getNodeValue());
|
||||
|
||||
dbDefaultLP.setDbTypeName(typeValue);
|
||||
dbDefaultPt.setDbTypeName(typeValue);
|
||||
dbDefault.add(dbDefaultLP);
|
||||
dbDefaultPattern.add(dbDefaultPt);
|
||||
|
||||
// ignore Length and Precision
|
||||
Node ignoreLength = typeNodeAtttributes.getNamedItem("ignoreLen"); //$NON-NLS-1$
|
||||
|
||||
@@ -191,6 +191,24 @@ public class MappingTypeRetriever {
|
||||
}// end for
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getDefaultPattern(String dbmsId, String dbType) {
|
||||
Dbms dbms = MetadataTalendType.getDbms(dbmsId);
|
||||
List<DbDefaultDatePattern> defaultPattern = dbms.getDefaultPattern();
|
||||
String pattern = new String(""); //$NON-NLS-1$
|
||||
for (int i = 0; i < defaultPattern.size(); i++) {
|
||||
DbDefaultDatePattern dbPattern = (DbDefaultDatePattern) defaultPattern.get(i);
|
||||
if (dbPattern.getDbTypeName().equalsIgnoreCase(dbType)) {
|
||||
pattern = dbPattern.getDefaultPattern();
|
||||
if (pattern == null) {
|
||||
return "";
|
||||
} else {
|
||||
return pattern;
|
||||
}
|
||||
}// end if
|
||||
}// end for
|
||||
return pattern;
|
||||
}
|
||||
|
||||
private boolean isExtensionPrecisionIgnored(String dbmsId, String dbType) {
|
||||
Map<String, Map<String, List<DBTypeUtil>>> javaTypeMappingFromExtension = JavaTypesManager
|
||||
|
||||
@@ -153,7 +153,7 @@ public class MetadataTable implements IMetadataTable, Cloneable {
|
||||
List<IMetadataColumn> temp = new ArrayList<IMetadataColumn>();
|
||||
temp.addAll(this.listColumns);
|
||||
temp.addAll(this.unusedColumns);
|
||||
if (originalColumns != null) {
|
||||
if (originalColumns != null && isRepository) {
|
||||
Collections.sort(temp, new Comparator<IMetadataColumn>() {
|
||||
|
||||
@Override
|
||||
@@ -243,6 +243,11 @@ public class MetadataTable implements IMetadataTable, Cloneable {
|
||||
*/
|
||||
@Override
|
||||
public boolean sameMetadataAs(IMetadataTable input, int options) {
|
||||
return sameMetadataAs(input, options, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sameMetadataAs(IMetadataTable input, int options, boolean order) {
|
||||
if (this == input) {
|
||||
return true;
|
||||
}
|
||||
@@ -263,7 +268,7 @@ public class MetadataTable implements IMetadataTable, Cloneable {
|
||||
// test if standard columns (no custom, or same input / output)
|
||||
for (int i = 0; i < inputColumnListWithUnselected.size(); i++) {
|
||||
IMetadataColumn otherColumn = inputColumnListWithUnselected.get(i);
|
||||
if (isRepository) {
|
||||
if (isRepository && !order) {
|
||||
boolean exist = false;
|
||||
for (int j = 0; j < thisColumnListWithUnselected.size(); j++) {
|
||||
IMetadataColumn myColumn = thisColumnListWithUnselected.get(j);
|
||||
|
||||
@@ -76,6 +76,8 @@ public final class MetadataTalendType {
|
||||
|
||||
public static final String PROJECT_MAPPING_FOLDER = ".settings/mappings"; //$NON-NLS-1$
|
||||
|
||||
public static final String UPDATED_MAPPING_FILES = "updated.mapping.files"; //$NON-NLS-1$
|
||||
|
||||
private static ECodeLanguage codeLanguage;
|
||||
|
||||
private static final String[] PERL_TYPES = new String[] { PerlTypesManager.BOOLEAN, PerlTypesManager.DATE,
|
||||
@@ -476,7 +478,7 @@ public final class MetadataTalendType {
|
||||
if (!mappingFolder.exists() || mappingFolder.listFiles().length < 1) {
|
||||
ICoreService service = null;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreService.class)) {
|
||||
service = (ICoreService) GlobalServiceRegister.getDefault().getService(ICoreService.class);
|
||||
service = GlobalServiceRegister.getDefault().getService(ICoreService.class);
|
||||
service.syncMappingsFileFromSystemToProject();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -626,6 +626,7 @@ public final class MetadataToolHelper {
|
||||
target.getListColumns().addAll(columnsTAdd);
|
||||
target.sortCustomColumns();
|
||||
target.setLabel(source.getLabel());
|
||||
target.setDbms(source.getDbms());
|
||||
setTargetOriginalColumns(source, target);
|
||||
// List<String> originalColumnsList = null;
|
||||
// if (source.getOriginalColumns() != null) {
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2020 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.model.process;
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public abstract class AbsJobletReplaceNodeHandler extends AbsReplaceNodeHandler implements IJobletReplaceNodeHandler {
|
||||
|
||||
public AbsJobletReplaceNodeHandler(String prefix) {
|
||||
super();
|
||||
this.setPrefix(prefix);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2020 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.model.process;
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public abstract class AbsReplaceNodeHandler implements IReplaceNodeHandler {
|
||||
|
||||
private String prefix;
|
||||
|
||||
@Override
|
||||
public String getPrefix() {
|
||||
return prefix;
|
||||
}
|
||||
|
||||
public void setPrefix(String prefix) {
|
||||
this.prefix = prefix;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -122,6 +122,8 @@ public abstract class AbstractNode implements INode {
|
||||
// for MR, tag this component is the ref(lookup) start node
|
||||
private boolean isRefNode = false;
|
||||
|
||||
private IReplaceNodeHandler replaceNodeHandler;
|
||||
|
||||
public String getComponentName() {
|
||||
return componentName;
|
||||
}
|
||||
@@ -1322,6 +1324,15 @@ public abstract class AbstractNode implements INode {
|
||||
return componentProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IReplaceNodeHandler getReplaceNodeHandler() {
|
||||
return replaceNodeHandler;
|
||||
}
|
||||
|
||||
public void setReplaceNodeHandler(IReplaceNodeHandler replaceNodeHandler) {
|
||||
this.replaceNodeHandler = replaceNodeHandler;
|
||||
}
|
||||
|
||||
public INode getRealGraphicalNode() {
|
||||
return realGraphicalNode;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2020 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.model.process;
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public interface IJobletReplaceNodeHandler extends IReplaceNodeHandler {
|
||||
|
||||
}
|
||||
@@ -312,6 +312,10 @@ public interface INode extends IElement {
|
||||
|
||||
public boolean isSubtreeStart();
|
||||
|
||||
default public IReplaceNodeHandler getReplaceNodeHandler() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setComponentProperties(ComponentProperties props);
|
||||
|
||||
public ComponentProperties getComponentProperties();
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2020 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.model.process;
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public interface IReplaceNodeHandler {
|
||||
|
||||
String getPrefix();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2020 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.model.process;
|
||||
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public class JobletReplaceNodeHandler extends AbsJobletReplaceNodeHandler {
|
||||
|
||||
public JobletReplaceNodeHandler(String prefix) {
|
||||
super(prefix);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
@@ -1072,4 +1074,44 @@ public final class ProcessUtils {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isChildRouteProcess(IProcess process) {
|
||||
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 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.model.properties.PropertiesFactory;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.model.routines.RoutinesUtil;
|
||||
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||
import org.talend.core.runtime.i18n.Messages;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType;
|
||||
@@ -130,6 +131,8 @@ public class RelationshipItemBuilder {
|
||||
|
||||
private Map<Relation, Set<Relation>> referencesItemsRelations;
|
||||
|
||||
private Map<String, String> systemRoutinesMap;
|
||||
|
||||
private boolean loaded = false;
|
||||
|
||||
private boolean loading = false;
|
||||
@@ -219,6 +222,28 @@ public class RelationshipItemBuilder {
|
||||
this.proxyRepositoryFactory = proxyRepositoryFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Current System Routines Map, key: routine id, value: routine name
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Map<String, String> getCurrentSystemRoutinesMap() {
|
||||
if (systemRoutinesMap != null && !systemRoutinesMap.isEmpty()) {
|
||||
return systemRoutinesMap;
|
||||
}
|
||||
|
||||
if (systemRoutinesMap == null) {
|
||||
systemRoutinesMap = new HashMap<String, String>();
|
||||
}
|
||||
List<IRepositoryViewObject> currentSystemRoutines = RoutinesUtil.getCurrentSystemRoutines();
|
||||
for (IRepositoryViewObject object : currentSystemRoutines) {
|
||||
systemRoutinesMap.put(object.getProperty().getId(), object.getProperty().getLabel());
|
||||
}
|
||||
|
||||
return systemRoutinesMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Look for every linked items who use the selected id, no matter the version. Usefull when want to delete an item
|
||||
* since it will delete every versions.
|
||||
@@ -931,18 +956,26 @@ public class RelationshipItemBuilder {
|
||||
|
||||
private void buildIndex(Map<Relation, Set<Relation>> itemRelations, Project project, IProgressMonitor monitor) {
|
||||
modified = true;
|
||||
|
||||
if (!project.getEmfProject().getItemsRelations().isEmpty()) {
|
||||
loadRelations(itemRelations, project);
|
||||
if (loaded) { // check if already loaded successfully
|
||||
return;
|
||||
}
|
||||
}
|
||||
generateIndex(project, getTypes(), true, monitor);
|
||||
if (modified) {
|
||||
autoSaveRelations();
|
||||
}
|
||||
monitor.done();
|
||||
loaded = true;
|
||||
}
|
||||
|
||||
private void generateIndex(Project project, List<ERepositoryObjectType> supportedTypes, boolean fromMigration,
|
||||
IProgressMonitor monitor) {
|
||||
IProxyRepositoryFactory factory = getProxyRepositoryFactory();
|
||||
List<IRepositoryViewObject> list = new ArrayList<IRepositoryViewObject>();
|
||||
try {
|
||||
for (ERepositoryObjectType curTyp : getTypes()) {
|
||||
for (ERepositoryObjectType curTyp : supportedTypes) {
|
||||
if (curTyp != null) {
|
||||
list.addAll(factory.getAll(project, curTyp, true, true));
|
||||
}
|
||||
@@ -956,21 +989,44 @@ public class RelationshipItemBuilder {
|
||||
for (IRepositoryViewObject object : list) {
|
||||
Item item = object.getProperty().getItem();
|
||||
monitor.subTask(Messages.getString("RelationshipItemBuilder.forItem") + item.getProperty().getLabel()); //$NON-NLS-1$
|
||||
addOrUpdateItem(item, true);
|
||||
findRelationItems(item, fromMigration);
|
||||
monitor.worked(1);
|
||||
if (monitor.isCanceled()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
autoSaveRelations();
|
||||
monitor.done();
|
||||
loaded = true;
|
||||
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void buildAndSaveIndex() {
|
||||
log.info("relationship.index generating");
|
||||
currentProjectItemsRelations = new ConcurrentHashMap<Relation, Set<Relation>>();
|
||||
referencesItemsRelations = new ConcurrentHashMap<Relation, Set<Relation>>();
|
||||
generateIndex(this.aimProject, allSupportedTypes(), false, new NullProgressMonitor());
|
||||
try {
|
||||
// sync to project
|
||||
synchronizeItemRelationToProject(this.aimProject);
|
||||
// persist index
|
||||
getProxyRepositoryFactory().saveProject(this.aimProject);
|
||||
log.info("relationship.index generated");
|
||||
} catch (PersistenceException e) {
|
||||
log.error("relationship.index generating error", e);
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
private List<ERepositoryObjectType> allSupportedTypes() {
|
||||
List<ERepositoryObjectType> toReturn = new ArrayList<ERepositoryObjectType>();
|
||||
toReturn.addAll(ERepositoryObjectType.getAllTypesOfProcess());
|
||||
toReturn.addAll(ERepositoryObjectType.getAllTypesOfProcess2());
|
||||
toReturn.addAll(ERepositoryObjectType.getAllTypesOfTestContainer());
|
||||
toReturn.addAll(ERepositoryObjectType.getAllTypesOfCodes());
|
||||
toReturn.addAll(ERepositoryObjectType.getAllTypesOfJoblet());
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
private List<ERepositoryObjectType> getTypes() {
|
||||
List<ERepositoryObjectType> toReturn = new ArrayList<ERepositoryObjectType>();
|
||||
toReturn.add(ERepositoryObjectType.PROCESS);
|
||||
@@ -1092,14 +1148,24 @@ public class RelationshipItemBuilder {
|
||||
}
|
||||
|
||||
public void addOrUpdateItem(Item item, boolean fromMigration) {
|
||||
if (!supportRelation(item)) {
|
||||
return;
|
||||
}
|
||||
if (!loaded) {
|
||||
loadRelations();
|
||||
}
|
||||
boolean relationsModified = findRelationItems(item, fromMigration);
|
||||
if (relationsModified && !modified) {
|
||||
modified = true;
|
||||
}
|
||||
if (!fromMigration && modified) {
|
||||
autoSaveRelations();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean findRelationItems(Item item, boolean fromMigration) {
|
||||
if (!supportRelation(item)) {
|
||||
return false;
|
||||
}
|
||||
if (item == null) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean relationsModified = true;
|
||||
@@ -1143,12 +1209,7 @@ public class RelationshipItemBuilder {
|
||||
currentProjectItemsRelations.get(relation).addAll(oldProjectRelations);
|
||||
}
|
||||
}
|
||||
if (relationsModified && !modified) {
|
||||
modified = true;
|
||||
}
|
||||
if (!fromMigration && modified) {
|
||||
autoSaveRelations();
|
||||
}
|
||||
return relationsModified;
|
||||
}
|
||||
|
||||
public Set<Relation> getItemRelations(Item item) {
|
||||
|
||||
@@ -427,6 +427,11 @@ public class ERepositoryObjectType extends DynaEnum<ERepositoryObjectType> {
|
||||
*/
|
||||
public final static ERepositoryObjectType JOBLET = ERepositoryObjectType.valueOf("JOBLET"); //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* <font color="red">This value may be <b>null</b> in some products, <b>should add NPE check</b></font>
|
||||
*/
|
||||
public final static ERepositoryObjectType SERVICES = ERepositoryObjectType.valueOf("SERVICES"); //$NON-NLS-1$
|
||||
|
||||
public final static ERepositoryObjectType JOBLET_DESIGNS = ERepositoryObjectType.valueOf("JOBLET_DESIGNS"); //$NON-NLS-1$
|
||||
|
||||
public final static ERepositoryObjectType SPARK_JOBLET = ERepositoryObjectType.valueOf("SPARK_JOBLET"); //$NON-NLS-1$
|
||||
@@ -439,6 +444,8 @@ public class ERepositoryObjectType extends DynaEnum<ERepositoryObjectType> {
|
||||
|
||||
public final static ERepositoryObjectType ROUTINES = ERepositoryObjectType.valueOf("ROUTINES"); //$NON-NLS-1$
|
||||
|
||||
public final static ERepositoryObjectType BEANS = ERepositoryObjectType.valueOf("BEANS"); //$NON-NLS-1$
|
||||
|
||||
public final static ERepositoryObjectType METADATA_HEADER_FOOTER = ERepositoryObjectType.valueOf("METADATA_HEADER_FOOTER"); //$NON-NLS-1$
|
||||
|
||||
public final static ERepositoryObjectType JOB_SCRIPT = ERepositoryObjectType.valueOf("JOB_SCRIPT"); //$NON-NLS-1$
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
package org.talend.core.model.routines;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
@@ -31,9 +32,12 @@ import org.osgi.framework.Bundle;
|
||||
import org.talend.commons.utils.resource.FileExtensions;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.ILibraryManagerService;
|
||||
import org.talend.core.ISVNProviderServiceInCoreRuntime;
|
||||
import org.talend.core.PluginChecker;
|
||||
import org.talend.core.model.general.LibraryInfo;
|
||||
import org.talend.core.nexus.ArtifactRepositoryBean;
|
||||
import org.talend.core.nexus.TalendLibsServerManager;
|
||||
import org.talend.core.runtime.maven.MavenArtifact;
|
||||
import org.talend.core.runtime.maven.MavenConstants;
|
||||
import org.talend.core.runtime.maven.MavenUrlHelper;
|
||||
|
||||
/**
|
||||
* wchen class global comment. Detailled comment
|
||||
@@ -96,9 +100,12 @@ public class RoutineLibraryMananger {
|
||||
try {
|
||||
URL fileUrl = FileLocator.toFileURL(entry);
|
||||
if(fileUrl != null){
|
||||
if (!"file".equals(fileUrl.getProtocol())) throw new IllegalArgumentException();
|
||||
URI fileUri = new File(fileUrl.getFile()).toURI();
|
||||
libManagerService.deploy(fileUri);
|
||||
if (!"file".equals(fileUrl.getProtocol())) throw new IllegalArgumentException();
|
||||
File file = new File(fileUrl.getFile());
|
||||
if (needDeploy(fileUrl)) {
|
||||
URI fileUri = file.toURI();
|
||||
libManagerService.deploy(fileUri);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("Cannot deploy: " + bundleName + path);
|
||||
@@ -114,6 +121,56 @@ public class RoutineLibraryMananger {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean needDeploy(URL fileUrl) throws IOException, Exception {
|
||||
File file = new File(fileUrl.getFile());
|
||||
ILibraryManagerService libManagerService = null;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ILibraryManagerService.class)) {
|
||||
libManagerService = (ILibraryManagerService) GlobalServiceRegister.getDefault()
|
||||
.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;
|
||||
}
|
||||
}
|
||||
if (mavUri == null) {
|
||||
return true;
|
||||
}
|
||||
final MavenArtifact parseMvnUrl = MavenUrlHelper.parseMvnUrl(mavUri);
|
||||
if (parseMvnUrl != null) {
|
||||
if (parseMvnUrl.getVersion() != null && parseMvnUrl.getVersion().endsWith(MavenConstants.SNAPSHOT)) {
|
||||
isSnapshot = true;
|
||||
}
|
||||
}
|
||||
TalendLibsServerManager manager = TalendLibsServerManager.getInstance();
|
||||
ArtifactRepositoryBean customNexusServer = manager.getCustomNexusServer();
|
||||
File jarFile = null;
|
||||
try {
|
||||
jarFile = libManagerService.resolveJar(customNexusServer, mavUri);
|
||||
} catch (Exception ex) {
|
||||
// Ignore here
|
||||
}
|
||||
boolean exist = (jarFile != null && jarFile.exists());
|
||||
if (exist) {
|
||||
if (isSnapshot) {
|
||||
boolean isSame = libManagerService.isSameFile(jarFile, file);
|
||||
if (!isSame) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public Map<String, List<LibraryInfo>> getRoutineAndJars() {
|
||||
if (routineAndJars == null) {
|
||||
routineAndJars = new HashMap<String, List<LibraryInfo>>();
|
||||
|
||||
@@ -1785,7 +1785,7 @@ public abstract class RepositoryUpdateManager {
|
||||
IMetadataManagmentService service = (IMetadataManagmentService) GlobalServiceRegister.getDefault()
|
||||
.getService(IMetadataManagmentService.class);
|
||||
IMetadataTable newMetadataTable = service.convertMetadataTable(newTable);
|
||||
update = !oldMetadataTable.sameMetadataAs(newMetadataTable, IMetadataColumn.OPTIONS_NONE);
|
||||
update = !oldMetadataTable.sameMetadataAs(newMetadataTable, IMetadataColumn.OPTIONS_NONE, true);
|
||||
isAddColumn = isAddColumn(newMetadataTable, oldMetadataTable);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.process.IContext;
|
||||
import org.talend.core.model.process.IProcess;
|
||||
import org.talend.core.model.process.IProcess2;
|
||||
import org.talend.core.model.process.JobInfo;
|
||||
import org.talend.core.model.process.ProcessUtils;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.Property;
|
||||
@@ -32,6 +33,7 @@ import org.talend.core.model.relationship.RelationshipItemBuilder;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||
import org.talend.core.runtime.process.ITalendProcessJavaProject;
|
||||
import org.talend.core.runtime.process.TalendProcessArgumentConstant;
|
||||
import org.talend.designer.runprocess.IRunProcessService;
|
||||
import org.talend.repository.ProjectManager;
|
||||
import org.talend.repository.model.RepositoryNode;
|
||||
@@ -88,6 +90,17 @@ public class JavaResourcesHelper {
|
||||
return newJobName;
|
||||
}
|
||||
|
||||
public static String getJobFolderName(String jobName, boolean isBundle, String version) {
|
||||
String newJobName = escapeFileName(jobName).toLowerCase();
|
||||
if (isBundle) {
|
||||
newJobName += "_bundle";
|
||||
}
|
||||
if (version != null) {
|
||||
newJobName += '_' + version.replace('.', '_');
|
||||
}
|
||||
return newJobName;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* get the jar name like maven "artifactId.version"
|
||||
@@ -97,6 +110,39 @@ public class JavaResourcesHelper {
|
||||
return newJobName;
|
||||
}
|
||||
|
||||
public static String getJobJarName(String jobName, String version, Property property) {
|
||||
|
||||
boolean isBundle = false;
|
||||
if (property.getAdditionalProperties() != null && "OSGI".equals(property.getAdditionalProperties().get(TalendProcessArgumentConstant.ARG_BUILD_TYPE))) {
|
||||
isBundle = true;
|
||||
}
|
||||
|
||||
String newJobName = getJobFolderName(jobName, isBundle, version);
|
||||
return newJobName;
|
||||
}
|
||||
|
||||
public static String getJobJarName(JobInfo jobInfo) {
|
||||
String newJobName = null;
|
||||
if (jobInfo.getProcessItem() == null) {
|
||||
newJobName = getJobJarName(jobInfo.getJobName(), jobInfo.getJobVersion());
|
||||
} else {
|
||||
newJobName = getJobJarName(jobInfo.getJobName(), jobInfo.getJobVersion(), jobInfo.getProcessItem().getProperty());
|
||||
}
|
||||
return newJobName;
|
||||
}
|
||||
|
||||
public static String getJobJarName(Property property) {
|
||||
|
||||
String newJobName = getJobJarName(property.getLabel(), property.getVersion(), property);
|
||||
return newJobName;
|
||||
}
|
||||
|
||||
public static String getJobFolderName(JobInfo jobInfo) {
|
||||
|
||||
String newJobName = getJobJarName(jobInfo);
|
||||
return newJobName;
|
||||
}
|
||||
|
||||
public static String escapeFileName(final String fileName) {
|
||||
return fileName != null ? fileName.replace(' ', '_') : ""; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
@@ -77,21 +77,24 @@ public final class ParameterValueUtil {
|
||||
}
|
||||
}
|
||||
} else if (param.getValue() instanceof List) { // for TABLE
|
||||
List<Map<String, Object>> tableValues = (List<Map<String, Object>>) param.getValue();
|
||||
for (Map<String, Object> line : tableValues) {
|
||||
for (String key : line.keySet()) {
|
||||
Object cellValue = line.get(key);
|
||||
if (cellValue instanceof String) { // cell is text so
|
||||
// rename data if
|
||||
// needed
|
||||
String value = (String) cellValue;
|
||||
if (value.contains(oldName)) {
|
||||
// line.put(key, value.replaceAll(oldName,
|
||||
// newName));
|
||||
// String newValue = renameValues(value, oldName, newName, flag);
|
||||
String newValue = splitQueryData(oldName, newName, value);
|
||||
if (!value.equals(newValue)) {
|
||||
line.put(key, newValue);
|
||||
List tableValues = (List) param.getValue();
|
||||
for (Object current : tableValues) {
|
||||
if (current != null && current instanceof Map) {
|
||||
Map<String, Object> line = (Map<String, Object>) current;
|
||||
for (String key : line.keySet()) {
|
||||
Object cellValue = line.get(key);
|
||||
if (cellValue instanceof String) { // cell is text so
|
||||
// rename data if
|
||||
// needed
|
||||
String value = (String) cellValue;
|
||||
if (value.contains(oldName)) {
|
||||
// line.put(key, value.replaceAll(oldName,
|
||||
// newName));
|
||||
// String newValue = renameValues(value, oldName, newName, flag);
|
||||
String newValue = splitQueryData(oldName, newName, value);
|
||||
if (!value.equals(newValue)) {
|
||||
line.put(key, newValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -721,13 +724,22 @@ public final class ParameterValueUtil {
|
||||
return true;
|
||||
}
|
||||
} else if (param.getValue() instanceof List) { // for TABLE
|
||||
List<Map<String, Object>> tableValues = (List<Map<String, Object>>) param.getValue();
|
||||
for (Map<String, Object> line : tableValues) {
|
||||
for (String key : line.keySet()) {
|
||||
Object cellValue = line.get(key);
|
||||
if (cellValue instanceof String) { // cell is text so
|
||||
// test data
|
||||
if (ParameterValueUtil.valueContains((String) cellValue, name)) {
|
||||
List tableValues = (List) param.getValue();
|
||||
for (Object current : tableValues) {
|
||||
if (current != null) {
|
||||
if (current instanceof Map) {
|
||||
Map<String, Object> line = (Map<String, Object>) current;
|
||||
for (String key : line.keySet()) {
|
||||
Object cellValue = line.get(key);
|
||||
if (cellValue instanceof String) { // cell is text so
|
||||
// test data
|
||||
if (ParameterValueUtil.valueContains((String) cellValue, name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (current instanceof String) {
|
||||
if (ParameterValueUtil.valueContains((String) current, name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,14 +12,12 @@
|
||||
// ============================================================================
|
||||
package org.talend.core.nexus;
|
||||
|
||||
import java.net.Authenticator;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.PasswordAuthentication;
|
||||
import java.net.Proxy;
|
||||
import java.net.Proxy.Type;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
@@ -37,7 +35,6 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.OperationCanceledException;
|
||||
import org.talend.commons.exception.BusinessException;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.utils.network.TalendProxySelector;
|
||||
import org.talend.commons.utils.network.TalendProxySelector.IProxySelectorProvider;
|
||||
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||
@@ -167,7 +164,7 @@ public abstract class HttpClientTransport {
|
||||
}
|
||||
}
|
||||
|
||||
private IProxySelectorProvider addProxy(final DefaultHttpClient httpClient, URI requestURI) {
|
||||
public static IProxySelectorProvider addProxy(final DefaultHttpClient httpClient, URI requestURI) {
|
||||
IProxySelectorProvider proxySelectorProvider = null;
|
||||
try {
|
||||
if (Boolean.valueOf(System.getProperty(PROP_PROXY_HTTP_CLIENT_USE_DEFAULT_SETTINGS, Boolean.FALSE.toString()))) {
|
||||
@@ -185,10 +182,10 @@ public abstract class HttpClientTransport {
|
||||
}
|
||||
final Proxy finalProxy = usedProxy;
|
||||
InetSocketAddress address = (InetSocketAddress) finalProxy.address();
|
||||
String proxyServer = address.getHostName();
|
||||
String proxyServer = address.getHostString();
|
||||
int proxyPort = address.getPort();
|
||||
PasswordAuthentication proxyAuthentication = Authenticator.requestPasswordAuthentication(proxyServer,
|
||||
address.getAddress(), proxyPort, "Http Proxy", "Http proxy authentication", null);
|
||||
TalendProxySelector proxySelector = TalendProxySelector.getInstance();
|
||||
PasswordAuthentication proxyAuthentication = proxySelector.getHttpPasswordAuthentication();
|
||||
if (proxyAuthentication != null) {
|
||||
String proxyUser = proxyAuthentication.getUserName();
|
||||
if(StringUtils.isNotBlank(proxyUser)){
|
||||
@@ -203,7 +200,7 @@ public abstract class HttpClientTransport {
|
||||
}
|
||||
HttpHost proxyHost = new HttpHost(proxyServer, proxyPort);
|
||||
httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxyHost);
|
||||
proxySelectorProvider = createProxySelectorProvider();
|
||||
proxySelectorProvider = proxySelector.createDefaultProxySelectorProvider();
|
||||
}
|
||||
return proxySelectorProvider;
|
||||
} finally {
|
||||
@@ -213,61 +210,12 @@ public abstract class HttpClientTransport {
|
||||
}
|
||||
}
|
||||
|
||||
private void removeProxy(IProxySelectorProvider proxySelectorProvider) {
|
||||
public static void removeProxy(IProxySelectorProvider proxySelectorProvider) {
|
||||
if (proxySelectorProvider != null) {
|
||||
TalendProxySelector.getInstance().removeProxySelectorProvider(proxySelectorProvider);
|
||||
}
|
||||
}
|
||||
|
||||
private IProxySelectorProvider createProxySelectorProvider() {
|
||||
IProxySelectorProvider proxySelectorProvider = new TalendProxySelector.AbstractProxySelectorProvider() {
|
||||
|
||||
private Thread currentThread = Thread.currentThread();
|
||||
|
||||
@Override
|
||||
public List<Proxy> select(URI uri) {
|
||||
// return Collections.EMPTY_LIST;
|
||||
|
||||
List<Proxy> newProxys = new ArrayList<>();
|
||||
if (uri == null) {
|
||||
return newProxys;
|
||||
}
|
||||
String schema = uri.getScheme();
|
||||
if (schema != null && schema.toLowerCase().startsWith("socket")) { //$NON-NLS-1$
|
||||
try {
|
||||
URI newUri = new URI("https", uri.getUserInfo(), uri.getHost(), uri.getPort(), uri.getPath(),
|
||||
uri.getQuery(), uri.getFragment());
|
||||
List<Proxy> proxys = TalendProxySelector.getInstance().getDefaultProxySelector().select(newUri);
|
||||
if (proxys != null && !proxys.isEmpty()) {
|
||||
newProxys.addAll(proxys);
|
||||
} else {
|
||||
newUri = new URI("http", uri.getUserInfo(), uri.getHost(), uri.getPort(), uri.getPath(),
|
||||
uri.getQuery(), uri.getFragment());
|
||||
proxys = TalendProxySelector.getInstance().getDefaultProxySelector().select(newUri);
|
||||
if (proxys != null && !proxys.isEmpty()) {
|
||||
newProxys.addAll(proxys);
|
||||
}
|
||||
}
|
||||
} catch (URISyntaxException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
return newProxys;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHandle(URI uri) {
|
||||
if (Thread.currentThread() == currentThread) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
return proxySelectorProvider;
|
||||
}
|
||||
|
||||
public void processResponseCode(HttpResponse response) throws BusinessException {
|
||||
StatusLine statusLine = response.getStatusLine();
|
||||
int responseCode = statusLine.getStatusCode();
|
||||
|
||||
@@ -61,5 +61,7 @@ public interface IRepositoryArtifactHandler {
|
||||
public IRepositoryArtifactHandler clone();
|
||||
|
||||
public String getRepositoryURL(boolean isRelease);
|
||||
|
||||
public String resolveRemoteSha1(MavenArtifact artifact, boolean fromRelease) throws Exception;
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,9 @@ import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.http.HttpEntity;
|
||||
@@ -36,9 +38,7 @@ import org.dom4j.io.SAXReader;
|
||||
import org.dom4j.io.XMLWriter;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
||||
import org.eclipse.core.runtime.preferences.InstanceScope;
|
||||
import org.talend.core.prefs.ITalendCorePrefConstants;
|
||||
import org.talend.commons.utils.network.NetworkUtil;
|
||||
import org.talend.core.runtime.maven.MavenArtifact;
|
||||
|
||||
/**
|
||||
@@ -47,16 +47,21 @@ import org.talend.core.runtime.maven.MavenArtifact;
|
||||
*/
|
||||
public class NexusServerUtils {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public static final String ORG_TALEND_DESIGNER_CORE = "org.talend.designer.core"; //$NON-NLS-1$
|
||||
|
||||
public static final String ORG_TALEND_DESIGNER_CORE = NetworkUtil.ORG_TALEND_DESIGNER_CORE;
|
||||
|
||||
public static final int CONNECTION_OK = 200;
|
||||
|
||||
// the max search result is 200 by defult from nexus
|
||||
private static final int MAX_SEARCH_COUNT = 200;
|
||||
|
||||
public static final Set<String> IGNORED_TYPES = new HashSet<String>();
|
||||
|
||||
static {
|
||||
IGNORED_TYPES.add("pom");
|
||||
IGNORED_TYPES.add("sha1");
|
||||
IGNORED_TYPES.add("md5");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* DOC check if the repository exist or not
|
||||
@@ -68,9 +73,7 @@ public class NexusServerUtils {
|
||||
* @return
|
||||
*/
|
||||
public static int getTimeout() {
|
||||
IEclipsePreferences node = InstanceScope.INSTANCE.getNode(ORG_TALEND_DESIGNER_CORE);
|
||||
int timeout = node.getInt(ITalendCorePrefConstants.NEXUS_TIMEOUT, 20000);
|
||||
return timeout;
|
||||
return NetworkUtil.getNexusTimeout();
|
||||
}
|
||||
|
||||
public static boolean checkConnectionStatus(String nexusUrl, String repositoryId, final String userName, final String password) {
|
||||
@@ -199,36 +202,36 @@ public class NexusServerUtils {
|
||||
private static int readDocument(Document document, List<MavenArtifact> artifacts) throws Exception {
|
||||
List<Node> list = document.selectNodes("/searchNGResponse/data/artifact");//$NON-NLS-1$
|
||||
for (Node arNode : list) {
|
||||
MavenArtifact artifact = new MavenArtifact();
|
||||
artifacts.add(artifact);
|
||||
artifact.setGroupId(arNode.selectSingleNode("groupId").getText());//$NON-NLS-1$
|
||||
artifact.setArtifactId(arNode.selectSingleNode("artifactId").getText());//$NON-NLS-1$
|
||||
artifact.setVersion(arNode.selectSingleNode("version").getText());//$NON-NLS-1$
|
||||
Node descNode = arNode.selectSingleNode("description");//$NON-NLS-1$
|
||||
if (descNode != null) {
|
||||
artifact.setDescription(descNode.getText());
|
||||
}
|
||||
Node urlNode = arNode.selectSingleNode("url");//$NON-NLS-1$
|
||||
if (urlNode != null) {
|
||||
artifact.setUrl(urlNode.getText());
|
||||
}
|
||||
Node licenseNode = arNode.selectSingleNode("license");//$NON-NLS-1$
|
||||
if (licenseNode != null) {
|
||||
artifact.setLicense(licenseNode.getText());
|
||||
}
|
||||
|
||||
Node licenseUrlNode = arNode.selectSingleNode("licenseUrl");//$NON-NLS-1$
|
||||
if (licenseUrlNode != null) {
|
||||
artifact.setLicenseUrl(licenseUrlNode.getText());
|
||||
}
|
||||
|
||||
List<Node> artLinks = arNode.selectNodes("artifactHits/artifactHit/artifactLinks/artifactLink");//$NON-NLS-1$
|
||||
for (Node link : artLinks) {
|
||||
MavenArtifact artifact = new MavenArtifact();
|
||||
|
||||
artifact.setGroupId(arNode.selectSingleNode("groupId").getText());//$NON-NLS-1$
|
||||
artifact.setArtifactId(arNode.selectSingleNode("artifactId").getText());//$NON-NLS-1$
|
||||
artifact.setVersion(arNode.selectSingleNode("version").getText());//$NON-NLS-1$
|
||||
Node descNode = arNode.selectSingleNode("description");//$NON-NLS-1$
|
||||
if (descNode != null) {
|
||||
artifact.setDescription(descNode.getText());
|
||||
}
|
||||
Node urlNode = arNode.selectSingleNode("url");//$NON-NLS-1$
|
||||
if (urlNode != null) {
|
||||
artifact.setUrl(urlNode.getText());
|
||||
}
|
||||
Node licenseNode = arNode.selectSingleNode("license");//$NON-NLS-1$
|
||||
if (licenseNode != null) {
|
||||
artifact.setLicense(licenseNode.getText());
|
||||
}
|
||||
|
||||
Node licenseUrlNode = arNode.selectSingleNode("licenseUrl");//$NON-NLS-1$
|
||||
if (licenseUrlNode != null) {
|
||||
artifact.setLicenseUrl(licenseUrlNode.getText());
|
||||
}
|
||||
Node extensionElement = link.selectSingleNode("extension");//$NON-NLS-1$
|
||||
String extension = null;
|
||||
String classifier = null;
|
||||
if (extensionElement != null) {
|
||||
if ("pom".equals(extensionElement.getText())) {//$NON-NLS-1$
|
||||
if (IGNORED_TYPES.contains(extensionElement.getText())) {// $NON-NLS-1$
|
||||
continue;
|
||||
}
|
||||
extension = extensionElement.getText();
|
||||
@@ -239,6 +242,7 @@ public class NexusServerUtils {
|
||||
}
|
||||
artifact.setType(extension);
|
||||
artifact.setClassifier(classifier);
|
||||
artifacts.add(artifact);
|
||||
}
|
||||
}
|
||||
return list.size();
|
||||
|
||||
@@ -18,12 +18,16 @@ import java.util.Collection;
|
||||
import java.util.Dictionary;
|
||||
import java.util.Hashtable;
|
||||
|
||||
import org.eclipse.m2e.core.MavenPlugin;
|
||||
import org.ops4j.pax.url.mvn.MavenResolver;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.ServiceReference;
|
||||
import org.osgi.service.cm.ManagedService;
|
||||
import org.osgi.util.tracker.ServiceTracker;
|
||||
import org.osgi.util.tracker.ServiceTrackerCustomizer;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.utils.network.TalendProxySelector;
|
||||
import org.talend.commons.utils.network.TalendProxySelector.IProxySelectorProvider;
|
||||
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||
|
||||
/**
|
||||
@@ -44,6 +48,8 @@ public class TalendMavenResolver {
|
||||
|
||||
private static MavenResolver mavenResolver = null;
|
||||
|
||||
private static final String MVN_USER_SETTING_KEY = "org.ops4j.pax.url.mvn.settings";
|
||||
|
||||
/**
|
||||
*
|
||||
* DOC wchen TalendMavenResolver constructor comment.
|
||||
@@ -84,6 +90,15 @@ public class TalendMavenResolver {
|
||||
if (props == null) {
|
||||
props = new Hashtable<String, String>();
|
||||
}
|
||||
|
||||
// https://jira.talendforge.org/browse/TUP-26752
|
||||
String configFile = props.get(MVN_USER_SETTING_KEY);
|
||||
if (configFile == null || configFile.trim().isEmpty()) {
|
||||
// set existing user settings file
|
||||
String studioUserSettingsFile = MavenPlugin.getMavenConfiguration().getUserSettingsFile();
|
||||
props.put(MVN_USER_SETTING_KEY, studioUserSettingsFile);
|
||||
}
|
||||
|
||||
final BundleContext context = CoreRuntimePlugin.getInstance().getBundle().getBundleContext();
|
||||
Collection<ServiceReference<ManagedService>> managedServiceRefs = context.getServiceReferences(ManagedService.class,
|
||||
"(service.pid=org.ops4j.pax.url.mvn)");
|
||||
@@ -102,7 +117,24 @@ public class TalendMavenResolver {
|
||||
}
|
||||
|
||||
public static File resolve(String mvnUri) throws IOException, RuntimeException {
|
||||
return getMavenResolver().resolve(mvnUri);
|
||||
TalendProxySelector selectorInstance = null;
|
||||
IProxySelectorProvider proxySelector = null;
|
||||
try {
|
||||
try {
|
||||
selectorInstance = TalendProxySelector.getInstance();
|
||||
proxySelector = selectorInstance.createDefaultProxySelectorProvider();
|
||||
if (proxySelector != null) {
|
||||
selectorInstance.addProxySelectorProvider(proxySelector);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return getMavenResolver().resolve(mvnUri);
|
||||
} finally {
|
||||
if (proxySelector != null && selectorInstance != null) {
|
||||
selectorInstance.removeProxySelectorProvider(proxySelector);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void upload(String groupId, String artifactId, String classifier, String extension, String version,
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
// ============================================================================
|
||||
package org.talend.core.prefs;
|
||||
|
||||
import org.talend.commons.utils.network.ITalendNexusPrefConstants;
|
||||
|
||||
/**
|
||||
* Core preferences. Detailled comment <br/>
|
||||
*
|
||||
@@ -188,10 +190,14 @@ public interface ITalendCorePrefConstants {
|
||||
|
||||
public static final String PERFORMANCE_JAVA_PROCESS_CODE_FORMATE_TIMEOUT = "PERFORMANCE_JAVA_PROCESS_CODE_FORMATE_TIMEOUT"; //$NON-NLS-1$
|
||||
|
||||
public static final String NEXUS_TIMEOUT = "NEXUS_TIMEOUT"; //$NON-NLS-1$
|
||||
public static final String NEXUS_TIMEOUT = ITalendNexusPrefConstants.NEXUS_TIMEOUT;
|
||||
|
||||
public static final String NEXUS_REFRESH_FREQUENCY = "NEXUS_REFRESH_FREQUENCY"; //$NON-NLS-1$
|
||||
|
||||
public static final String NEXUS_SHARE_LIBS = "NEXUS_SHARE_LIBS";
|
||||
|
||||
public static final boolean NEXUS_SHARE_LIBS_DEFAULT = true;
|
||||
|
||||
/**
|
||||
* AutoMap algorithm weight
|
||||
*/
|
||||
|
||||
@@ -24,7 +24,7 @@ public class MavenArtifact implements Cloneable {
|
||||
private static final char ARTIFACT_SEPARATOR = '-';
|
||||
|
||||
private String repositoryUrl, groupId, artifactId, version, type, classifier, description, url, license, licenseUrl,
|
||||
distribution, username, password, lastUpdated;
|
||||
distribution, username, password, lastUpdated, sha1, md5;
|
||||
|
||||
public String getLastUpdated() {
|
||||
return this.lastUpdated;
|
||||
@@ -138,6 +138,22 @@ public class MavenArtifact implements Cloneable {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getSha1() {
|
||||
return sha1;
|
||||
}
|
||||
|
||||
public void setSha1(String sha1) {
|
||||
this.sha1 = sha1;
|
||||
}
|
||||
|
||||
public String getMd5() {
|
||||
return md5;
|
||||
}
|
||||
|
||||
public void setMd5(String md5) {
|
||||
this.md5 = md5;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* DOC ggu Comment method "getFileName".
|
||||
|
||||
@@ -42,6 +42,8 @@ public interface MavenConstants {
|
||||
|
||||
static final String POM_FILTER = "POM_FILTER";
|
||||
|
||||
static final String USE_PROFILE_MODULE = "USE_PROFILE_MODULE";
|
||||
|
||||
/*
|
||||
* for lib
|
||||
*/
|
||||
|
||||
@@ -16,9 +16,11 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.talend.core.model.general.ModuleNeeded;
|
||||
import org.talend.core.model.process.JobInfo;
|
||||
import org.talend.core.model.process.ProcessUtils;
|
||||
|
||||
/**
|
||||
* DOC nrousseau class global comment. Detailled comment
|
||||
@@ -33,8 +35,12 @@ public class LastGenerationInfo {
|
||||
|
||||
private HashMap<String, Set<ModuleNeeded>> modulesNeededWithSubjobPerJob;
|
||||
|
||||
private HashMap<String, Set<ModuleNeeded>> highPriorityModuleNeededPerJob;
|
||||
|
||||
private HashMap<String, Set<ModuleNeeded>> highPriorityModuleNeeded;
|
||||
|
||||
private HashMap<String, Set<ModuleNeeded>> testcaseModuleNeeded;
|
||||
|
||||
private HashMap<String, Set<String>> routinesNeededWithSubjobPerJob;
|
||||
|
||||
private HashMap<String, Set<String>> pigudfNeededWithSubjobPerJob;
|
||||
@@ -55,7 +61,9 @@ public class LastGenerationInfo {
|
||||
modulesNeededPerJob = new HashMap<String, Set<ModuleNeeded>>();
|
||||
contextPerJob = new HashMap<String, Set<String>>();
|
||||
modulesNeededWithSubjobPerJob = new HashMap<String, Set<ModuleNeeded>>();
|
||||
highPriorityModuleNeededPerJob = new HashMap<>();
|
||||
highPriorityModuleNeeded = new HashMap<>();
|
||||
testcaseModuleNeeded = new HashMap<>();
|
||||
lastGeneratedjobs = new HashSet<JobInfo>();
|
||||
routinesNeededPerJob = new HashMap<String, Set<String>>();
|
||||
pigudfNeededPerJob = new HashMap<String, Set<String>>();
|
||||
@@ -78,7 +86,7 @@ public class LastGenerationInfo {
|
||||
* @return the modulesNeededPerJob
|
||||
*/
|
||||
public Set<ModuleNeeded> getModulesNeededWithSubjobPerJob(String jobId, String jobVersion) {
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
if (!modulesNeededWithSubjobPerJob.containsKey(key)) {
|
||||
modulesNeededWithSubjobPerJob.put(key, new HashSet<ModuleNeeded>());
|
||||
}
|
||||
@@ -90,7 +98,7 @@ public class LastGenerationInfo {
|
||||
* @return the modulesNeededPerJob
|
||||
*/
|
||||
public Set<ModuleNeeded> getModulesNeededPerJob(String jobId, String jobVersion) {
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
if (!modulesNeededPerJob.containsKey(key)) {
|
||||
modulesNeededPerJob.put(key, new HashSet<ModuleNeeded>());
|
||||
}
|
||||
@@ -103,7 +111,7 @@ public class LastGenerationInfo {
|
||||
* @return the contextPerJob
|
||||
*/
|
||||
public Set<String> getContextPerJob(String jobId, String jobVersion) {
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
if (!contextPerJob.containsKey(key)) {
|
||||
contextPerJob.put(key, new HashSet<String>());
|
||||
}
|
||||
@@ -116,7 +124,7 @@ public class LastGenerationInfo {
|
||||
* @param modulesNeededPerJob the modulesNeededPerJob to set
|
||||
*/
|
||||
public void setModulesNeededPerJob(String jobId, String jobVersion, Set<ModuleNeeded> modulesNeeded) {
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
modulesNeededPerJob.put(key, new HashSet<ModuleNeeded>(modulesNeeded));
|
||||
}
|
||||
|
||||
@@ -125,8 +133,8 @@ public class LastGenerationInfo {
|
||||
*
|
||||
* @param modulesNeededWithSubjobPerJob the modulesNeededWithSubjobPerJob to set
|
||||
*/
|
||||
public void setModulesNeededWithSubjobPerJob(String jobId, String jobVersion, Set<ModuleNeeded> modulesNeeded) {
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
public void setModulesNeededWithSubjobPerJob(String jobId, String jobVersion, Set<ModuleNeeded> modulesNeeded) {
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
if (modulesNeeded == null) {
|
||||
modulesNeededWithSubjobPerJob.put(key, null);
|
||||
} else {
|
||||
@@ -140,17 +148,17 @@ public class LastGenerationInfo {
|
||||
* @param contextPerJob the contextPerJob to set
|
||||
*/
|
||||
public void setContextPerJob(String jobId, String jobVersion, Set<String> contexts) {
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
contextPerJob.put(key, new HashSet<String>(contexts));
|
||||
}
|
||||
|
||||
public void setUseDynamic(String jobId, String jobVersion, boolean dynamic) {
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
useDynamic.put(key, dynamic);
|
||||
}
|
||||
|
||||
public boolean isUseDynamic(String jobId, String jobVersion) {
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
if (!useDynamic.containsKey(key)) {
|
||||
return false;
|
||||
}
|
||||
@@ -162,12 +170,12 @@ public class LastGenerationInfo {
|
||||
}
|
||||
|
||||
public void setUseRules(String jobId, String jobVersion, boolean useRules) {
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
this.useRules.put(key, useRules);
|
||||
}
|
||||
|
||||
public boolean isUseRules(String jobId, String jobVersion) {
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
if (!useRules.containsKey(key)) {
|
||||
return false;
|
||||
}
|
||||
@@ -179,12 +187,12 @@ public class LastGenerationInfo {
|
||||
}
|
||||
|
||||
public void setUsePigUDFs(String jobId, String jobVersion, boolean useRules) {
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
this.usedPigUDFs.put(key, useRules);
|
||||
}
|
||||
|
||||
public boolean isUsePigUDFs(String jobId, String jobVersion) {
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
if (!usedPigUDFs.containsKey(key)) {
|
||||
return false;
|
||||
}
|
||||
@@ -251,13 +259,29 @@ public class LastGenerationInfo {
|
||||
* @return the modulesNeededPerJob
|
||||
*/
|
||||
public Set<String> getRoutinesNeededPerJob(String jobId, String jobVersion) {
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
if (!routinesNeededPerJob.containsKey(key)) {
|
||||
routinesNeededPerJob.put(key, new HashSet<String>());
|
||||
}
|
||||
return routinesNeededPerJob.get(key);
|
||||
}
|
||||
|
||||
public Set<ModuleNeeded> getHighPriorityModuleNeededPerJob(String jobId, String jobVersion) {
|
||||
String key = getProcessKey(jobId, jobVersion);
|
||||
if (!highPriorityModuleNeededPerJob.containsKey(key)) {
|
||||
highPriorityModuleNeededPerJob.put(key, new LinkedHashSet<>());
|
||||
}
|
||||
return highPriorityModuleNeededPerJob.get(key);
|
||||
}
|
||||
|
||||
public void setHighPriorityModuleNeededPerJob(String jobId, String jobVersion, Set<ModuleNeeded> moduleNeeded) {
|
||||
String key = getProcessKey(jobId, jobVersion);
|
||||
if (!highPriorityModuleNeededPerJob.containsKey(key)) {
|
||||
highPriorityModuleNeededPerJob.put(key, new LinkedHashSet<>());
|
||||
}
|
||||
highPriorityModuleNeededPerJob.get(key).addAll(moduleNeeded);
|
||||
}
|
||||
|
||||
public Set<ModuleNeeded> getHighPriorityModuleNeeded(String jobId, String jobVersion) {
|
||||
String key = getProcessKey(jobId, jobVersion);
|
||||
if (!highPriorityModuleNeeded.containsKey(key)) {
|
||||
@@ -274,12 +298,26 @@ public class LastGenerationInfo {
|
||||
highPriorityModuleNeeded.get(key).addAll(moduleNeeded);
|
||||
}
|
||||
|
||||
public Set<ModuleNeeded> getTestcaseModuleNeeded(String jobId, String jobVersion) {
|
||||
String key = getProcessKey(jobId, jobVersion);
|
||||
if (!testcaseModuleNeeded.containsKey(key)) {
|
||||
testcaseModuleNeeded.put(key, new HashSet<>());
|
||||
}
|
||||
return testcaseModuleNeeded.get(key);
|
||||
}
|
||||
|
||||
public void setTestcaseModuleNeeded(String jobId, String jobVersion, Set<ModuleNeeded> modulesNeeded) {
|
||||
testcaseModuleNeeded.put(getProcessKey(jobId, jobVersion), new HashSet<>(modulesNeeded));
|
||||
}
|
||||
|
||||
public void clearHighPriorityModuleNeeded() {
|
||||
highPriorityModuleNeededPerJob.clear();
|
||||
highPriorityModuleNeeded.clear();
|
||||
}
|
||||
|
||||
private String getProcessKey(String jobId, String jobVersion) {
|
||||
return jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
String pureJobId = ProcessUtils.getPureItemId(jobId);
|
||||
return pureJobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -288,7 +326,7 @@ public class LastGenerationInfo {
|
||||
* @return the pigudfNeededPerJob
|
||||
*/
|
||||
public Set<String> getPigudfNeededPerJob(String jobId, String jobVersion) {
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
if (!pigudfNeededPerJob.containsKey(key)) {
|
||||
pigudfNeededPerJob.put(key, new HashSet<String>());
|
||||
}
|
||||
@@ -302,7 +340,7 @@ public class LastGenerationInfo {
|
||||
* @param modulesNeededPerJob the modulesNeededPerJob to set
|
||||
*/
|
||||
public void setRoutinesNeededPerJob(String jobId, String jobVersion, Set<String> modulesNeeded) {
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
routinesNeededPerJob.put(key, new HashSet<String>(modulesNeeded));
|
||||
}
|
||||
|
||||
@@ -312,7 +350,7 @@ public class LastGenerationInfo {
|
||||
* @param pigudfNeededPerJob the pigudfNeededPerJob to set
|
||||
*/
|
||||
public void setPigudfNeededPerJob(String jobId, String jobVersion, Set<String> modulesNeeded) {
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
pigudfNeededPerJob.put(key, new HashSet<String>(modulesNeeded));
|
||||
}
|
||||
|
||||
@@ -321,7 +359,7 @@ public class LastGenerationInfo {
|
||||
* @return the modulesNeededPerJob
|
||||
*/
|
||||
public Set<String> getRoutinesNeededWithSubjobPerJob(String jobId, String jobVersion) {
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
if (!routinesNeededWithSubjobPerJob.containsKey(key)) {
|
||||
routinesNeededWithSubjobPerJob.put(key, new HashSet<String>());
|
||||
}
|
||||
@@ -334,7 +372,7 @@ public class LastGenerationInfo {
|
||||
* @return the pigudfNeededWithSubjobPerJob
|
||||
*/
|
||||
public Set<String> getPigudfNeededWithSubjobPerJob(String jobId, String jobVersion) {
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
if (!pigudfNeededWithSubjobPerJob.containsKey(key)) {
|
||||
pigudfNeededWithSubjobPerJob.put(key, new HashSet<String>());
|
||||
}
|
||||
@@ -348,7 +386,7 @@ public class LastGenerationInfo {
|
||||
* @param modulesNeededPerJob the modulesNeededPerJob to set
|
||||
*/
|
||||
public void setRoutinesNeededWithSubjobPerJob(String jobId, String jobVersion, Set<String> modulesNeeded) {
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
routinesNeededWithSubjobPerJob.put(key, new HashSet<String>(modulesNeeded));
|
||||
}
|
||||
|
||||
@@ -358,14 +396,15 @@ public class LastGenerationInfo {
|
||||
* @param pigudfNeededWithSubjobPerJob the pigudfNeededWithSubjobPerJob to set
|
||||
*/
|
||||
public void setPigudfNeededWithSubjobPerJob(String jobId, String jobVersion, Set<String> modulesNeeded) {
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
pigudfNeededWithSubjobPerJob.put(key, new HashSet<String>(modulesNeeded));
|
||||
}
|
||||
|
||||
public void clearModulesNeededWithSubjobPerJob() {
|
||||
if (!modulesNeededWithSubjobPerJob.isEmpty()) {
|
||||
modulesNeededWithSubjobPerJob.clear();
|
||||
}
|
||||
public void clearCaches() {
|
||||
clearHighPriorityModuleNeeded();
|
||||
modulesNeededPerJob.clear();
|
||||
modulesNeededWithSubjobPerJob.clear();
|
||||
testcaseModuleNeeded.clear();
|
||||
}
|
||||
|
||||
public void clean() {
|
||||
@@ -373,7 +412,8 @@ public class LastGenerationInfo {
|
||||
routinesNeededPerJob.clear();
|
||||
pigudfNeededPerJob.clear();
|
||||
modulesNeededWithSubjobPerJob.clear();
|
||||
highPriorityModuleNeeded.clear();
|
||||
clearHighPriorityModuleNeeded();
|
||||
testcaseModuleNeeded.clear();
|
||||
routinesNeededWithSubjobPerJob.clear();
|
||||
pigudfNeededWithSubjobPerJob.clear();
|
||||
contextPerJob.clear();
|
||||
|
||||
@@ -52,6 +52,8 @@ public interface TalendProcessArgumentConstant {
|
||||
|
||||
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";
|
||||
|
||||
static final String ARG_NEED_PIGUDFS = "NEED_PIGUDFS";
|
||||
|
||||
@@ -76,5 +76,7 @@ public interface IProjectSettingPreferenceConstants {
|
||||
* docker profile
|
||||
*/
|
||||
public static final String TEMPLATE_DOCKER_PROFILE_POM = "template_docker_profile_pom_script"; //$NON-NLS-1$
|
||||
|
||||
public static final String USE_STRICT_REFERENCE_JOBLET = "use_strict_reference_joblet"; //$NON-NLS-1$
|
||||
|
||||
}
|
||||
|
||||
@@ -15,7 +15,9 @@ package org.talend.core.runtime.services;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.IService;
|
||||
import org.talend.core.model.components.IComponent;
|
||||
import org.talend.core.model.process.IElementParameter;
|
||||
import org.talend.core.model.process.INode;
|
||||
|
||||
@@ -42,4 +44,13 @@ public interface IGenericService extends IService {
|
||||
|
||||
public void resetReferenceValue(INode curNode, String oldConnectionName, String newConnectionName);
|
||||
|
||||
public boolean isTcompv0(IComponent component);
|
||||
|
||||
public static IGenericService getService() {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericService.class)) {
|
||||
return GlobalServiceRegister.getDefault().getService(IGenericService.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2020 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.talend.core.IService;
|
||||
|
||||
/**
|
||||
* created by HHB on 2013-12-23 Detailled comment
|
||||
*
|
||||
*/
|
||||
public interface IMDMWebServiceHook extends IService {
|
||||
|
||||
void preRequestSendingHook(Map<String, Object> requestContext, String userName);
|
||||
|
||||
String buildStudioToken(String username);
|
||||
|
||||
String getTokenKey();
|
||||
}
|
||||
@@ -28,6 +28,8 @@ public interface INOSQLService extends IService {
|
||||
|
||||
public boolean isUseReplicaSet(Connection connection);
|
||||
|
||||
public boolean isUseSSL(Connection connection);
|
||||
|
||||
public String getMongoDBReplicaSets(Connection connection);
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (C) 2006-2020 Talend Inc. - www.talend.com
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
|
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations under the License.
|
||||
*
|
||||
*/
|
||||
package org.talend.core.service;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.talend.core.IService;
|
||||
import org.talend.core.model.components.IComponent;
|
||||
import org.talend.core.model.properties.Item;
|
||||
|
||||
/**
|
||||
* For documentation, see implementation in org.talend.sdk.component.studio-integration plugin
|
||||
*/
|
||||
public interface ITaCoKitDependencyService extends IService {
|
||||
|
||||
boolean hasTaCoKitComponents(final Stream<IComponent> components);
|
||||
|
||||
Set<String> getTaCoKitOnlyDependencies(final Stream<IComponent> components);
|
||||
|
||||
Stream<IComponent> getJobComponents(Item item);
|
||||
|
||||
Path findM2Path();
|
||||
}
|
||||
@@ -19,7 +19,9 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
@@ -79,6 +81,8 @@ public abstract class AbstractRoutineSynchronizer implements ITalendSynchronizer
|
||||
}
|
||||
|
||||
private Collection<RoutineItem> getAll(ERepositoryObjectType type, boolean syncRef) throws SystemException {
|
||||
// init code project
|
||||
getRunProcessService().getTalendCodeJavaProject(type);
|
||||
// remove routine with same name in reference project
|
||||
final Map<String, RoutineItem> beansList = new HashMap<String, RoutineItem>();
|
||||
for (IRepositoryViewObject obj : getRepositoryService().getProxyRepositoryFactory().getAll(type)) {
|
||||
@@ -95,27 +99,37 @@ public abstract class AbstractRoutineSynchronizer implements ITalendSynchronizer
|
||||
return (IRepositoryService) GlobalServiceRegister.getDefault().getService(IRepositoryService.class);
|
||||
}
|
||||
|
||||
private void getReferencedProjectRoutine(final Map<String, RoutineItem> beansList, final Project project,
|
||||
ERepositoryObjectType routineType, boolean syncRef) throws SystemException {
|
||||
for (IRepositoryViewObject obj : getRepositoryService().getProxyRepositoryFactory().getAll(project, routineType)) {
|
||||
private Set<IRepositoryViewObject> getReferencedProjectRoutine(final Map<String, RoutineItem> beansList,
|
||||
final Project project, ERepositoryObjectType routineType, boolean syncRef) throws SystemException {
|
||||
// init ref code project
|
||||
if (syncRef) {
|
||||
getRunProcessService().getTalendCodeJavaProject(routineType, project.getTechnicalLabel());
|
||||
}
|
||||
Set<IRepositoryViewObject> routines = new HashSet<>();
|
||||
routines.addAll(getRepositoryService().getProxyRepositoryFactory().getAll(project, routineType));
|
||||
for (IRepositoryViewObject obj : routines) {
|
||||
final String key = obj.getProperty().getLabel();
|
||||
// it does not have a routine with same name
|
||||
if (!beansList.containsKey(key)) {
|
||||
beansList.put(key, (RoutineItem) obj.getProperty().getItem());
|
||||
}
|
||||
if (syncRef) {
|
||||
// sync routine
|
||||
syncRoutine((RoutineItem) obj.getProperty().getItem(), false, true, true);
|
||||
}
|
||||
}
|
||||
for (ProjectReference projectReference : project.getProjectReferenceList()) {
|
||||
routines.addAll(getReferencedProjectRoutine(beansList, new Project(projectReference.getReferencedProject()),
|
||||
routineType, syncRef));
|
||||
}
|
||||
if (syncRef) {
|
||||
routines.stream().forEach(obj -> {
|
||||
try {
|
||||
syncRoutine((RoutineItem) obj.getProperty().getItem(), project.getTechnicalLabel(), true, true);
|
||||
} catch (SystemException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
});
|
||||
// sync system routine
|
||||
syncSystemRoutine(project);
|
||||
}
|
||||
|
||||
for (ProjectReference projectReference : project.getProjectReferenceList()) {
|
||||
getReferencedProjectRoutine(beansList, new Project(projectReference.getReferencedProject()), routineType, syncRef);
|
||||
}
|
||||
return routines;
|
||||
}
|
||||
|
||||
protected void syncSystemRoutine(Project project) throws SystemException {
|
||||
@@ -128,24 +142,17 @@ public abstract class AbstractRoutineSynchronizer implements ITalendSynchronizer
|
||||
}
|
||||
|
||||
protected IFile getRoutineFile(RoutineItem routineItem) throws SystemException {
|
||||
return getRoutineFile(routineItem, true);
|
||||
return getRoutineFile(routineItem, ProjectManager.getInstance().getCurrentProject().getTechnicalLabel());
|
||||
}
|
||||
|
||||
protected IFile getRoutineFile(RoutineItem routineItem, boolean currentProject) throws SystemException {
|
||||
String projectTechName;
|
||||
if (currentProject) {
|
||||
projectTechName = ProjectManager.getInstance().getCurrentProject().getTechnicalLabel();
|
||||
} else {
|
||||
projectTechName = ProjectManager.getInstance().getProject(routineItem).getTechnicalLabel();
|
||||
}
|
||||
protected IFile getRoutineFile(RoutineItem routineItem, String projectTechName) throws SystemException {
|
||||
ITalendProcessJavaProject talendProcessJavaProject = getRunProcessService()
|
||||
.getTalendCodeJavaProject(ERepositoryObjectType.getItemType(routineItem), projectTechName);
|
||||
if (talendProcessJavaProject == null) {
|
||||
return null;
|
||||
}
|
||||
IFolder routineFolder = talendProcessJavaProject.getSrcSubFolder(null, routineItem.getPackageType());
|
||||
IFile file = routineFolder.getFile(routineItem.getProperty().getLabel() + JavaUtils.JAVA_EXTENSION);
|
||||
return file;
|
||||
return routineFolder.getFile(routineItem.getProperty().getLabel() + JavaUtils.JAVA_EXTENSION);
|
||||
}
|
||||
|
||||
private IFile getProcessFile(ProcessItem item) throws SystemException {
|
||||
@@ -193,30 +200,31 @@ public abstract class AbstractRoutineSynchronizer implements ITalendSynchronizer
|
||||
|
||||
@Override
|
||||
public void syncRoutine(RoutineItem routineItem, boolean copyToTemp) throws SystemException {
|
||||
syncRoutine(routineItem, true, copyToTemp, false);
|
||||
syncRoutine(routineItem, ProjectManager.getInstance().getCurrentProject().getTechnicalLabel(), copyToTemp, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncRoutine(RoutineItem routineItem, boolean copyToTemp, boolean forceUpdate) throws SystemException {
|
||||
syncRoutine(routineItem, true, copyToTemp, forceUpdate);
|
||||
syncRoutine(routineItem, ProjectManager.getInstance().getCurrentProject().getTechnicalLabel(), copyToTemp, forceUpdate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncRoutine(RoutineItem routineItem, boolean currentProject, boolean copyToTemp, boolean forceUpdate) throws SystemException {
|
||||
public void syncRoutine(RoutineItem routineItem, String projectTechName, boolean copyToTemp, boolean forceUpdate)
|
||||
throws SystemException {
|
||||
boolean needSync = false;
|
||||
if (routineItem != null) {
|
||||
if (forceUpdate || !isRoutineUptodate(routineItem)) {
|
||||
needSync = true;
|
||||
} else {
|
||||
IFile file = getRoutineFile(routineItem, currentProject);
|
||||
IFile file = getRoutineFile(routineItem, projectTechName);
|
||||
if (file != null && !file.exists()) {
|
||||
needSync = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (needSync) {
|
||||
doSyncRoutine(routineItem, currentProject, copyToTemp);
|
||||
if (currentProject) {
|
||||
doSyncRoutine(routineItem, projectTechName, copyToTemp);
|
||||
if (ProjectManager.getInstance().getCurrentProject().getTechnicalLabel().equals(projectTechName)) {
|
||||
setRoutineAsUptodate(routineItem);
|
||||
}
|
||||
}
|
||||
@@ -224,14 +232,14 @@ public abstract class AbstractRoutineSynchronizer implements ITalendSynchronizer
|
||||
|
||||
public void syncRoutine(RoutineItem routineItem) throws SystemException {
|
||||
if (routineItem != null) {
|
||||
doSyncRoutine(routineItem, true, true);
|
||||
doSyncRoutine(routineItem, ProjectManager.getInstance().getCurrentProject().getTechnicalLabel(), true);
|
||||
setRoutineAsUptodate(routineItem);
|
||||
}
|
||||
}
|
||||
|
||||
private void doSyncRoutine(RoutineItem routineItem, boolean currentProject, boolean copyToTemp) throws SystemException {
|
||||
private void doSyncRoutine(RoutineItem routineItem, String projectTechName, boolean copyToTemp) throws SystemException {
|
||||
try {
|
||||
IFile file = getRoutineFile(routineItem, currentProject);
|
||||
IFile file = getRoutineFile(routineItem, projectTechName);
|
||||
if (file == null) {
|
||||
return;
|
||||
}
|
||||
@@ -374,7 +382,7 @@ public abstract class AbstractRoutineSynchronizer implements ITalendSynchronizer
|
||||
@Override
|
||||
public void syncAllBeansForLogOn() throws SystemException {
|
||||
for (RoutineItem beanItem : getBeans(true)) {
|
||||
syncRoutine(beanItem, true, true, true);
|
||||
syncRoutine(beanItem, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,8 @@ public interface ITalendSynchronizer {
|
||||
|
||||
void syncRoutine(RoutineItem routineItem, boolean copyToTemp, boolean forceUpdate) throws SystemException;
|
||||
|
||||
void syncRoutine(RoutineItem routineItem, boolean currentProject, boolean copyToTemp, boolean forceUpdate) throws SystemException;
|
||||
void syncRoutine(RoutineItem routineItem, String projectTechName, boolean copyToTemp, boolean forceUpdate)
|
||||
throws SystemException;
|
||||
|
||||
IFile getFile(Item item) throws SystemException;
|
||||
|
||||
|
||||
@@ -195,4 +195,7 @@ public interface IDesignerCoreService extends IService {
|
||||
public void setTACReadTimeout(int timeout);
|
||||
|
||||
boolean isDelegateNode(INode node);
|
||||
|
||||
boolean isNeedContextInJar(IProcess process);
|
||||
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.eclipse.jdt.core.IJavaProject;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.IService;
|
||||
import org.talend.core.language.ECodeLanguage;
|
||||
import org.talend.core.language.ICodeProblemsChecker;
|
||||
@@ -216,6 +217,8 @@ public interface IRunProcessService extends IService {
|
||||
|
||||
ITalendProcessJavaProject getTalendJobJavaProject(Property property);
|
||||
|
||||
IFolder getCodeSrcFolder(ERepositoryObjectType type, String projectTechName);
|
||||
|
||||
ITalendProcessJavaProject getTempJavaProject();
|
||||
|
||||
void clearProjectRelatedSettings();
|
||||
@@ -237,4 +240,12 @@ public interface IRunProcessService extends IService {
|
||||
public void handleJobDependencyLoop(JobInfo mainJobInfo, List<JobInfo> listJobs, IProgressMonitor progressMonitor)
|
||||
throws Exception;
|
||||
|
||||
public static IRunProcessService get() {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
|
||||
return GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isCIMode();
|
||||
}
|
||||
|
||||
@@ -71,7 +71,12 @@ public class ItemCacheManager {
|
||||
processItem = getRefProcessItem(ProjectManager.getInstance().getCurrentProject(), parsedArray[1]);
|
||||
} else {
|
||||
Project project = ProjectManager.getInstance().getProjectFromProjectTechLabel(parsedArray[0]);
|
||||
processItem = getProcessItem(project, parsedArray[1]);
|
||||
if (project != null) {
|
||||
processItem = getProcessItem(project, parsedArray[1]);
|
||||
}
|
||||
if (processItem == null) {
|
||||
processItem = getRefProcessItem(ProjectManager.getInstance().getCurrentProject(), parsedArray[1]);
|
||||
}
|
||||
}
|
||||
return processItem;
|
||||
}
|
||||
@@ -112,7 +117,12 @@ public class ItemCacheManager {
|
||||
refProcessItem = getRefProcessItem(ProjectManager.getInstance().getCurrentProject(), parsedArray[1], version);
|
||||
} else {
|
||||
Project project = ProjectManager.getInstance().getProjectFromProjectTechLabel(parsedArray[0]);
|
||||
refProcessItem = getProcessItem(project, parsedArray[1], version);
|
||||
if (project != null) {
|
||||
refProcessItem = getProcessItem(project, parsedArray[1], version);
|
||||
}
|
||||
if (refProcessItem == null) {
|
||||
refProcessItem = getRefProcessItem(ProjectManager.getInstance().getCurrentProject(), parsedArray[1], version);
|
||||
}
|
||||
}
|
||||
return refProcessItem;
|
||||
}
|
||||
|
||||
@@ -42,4 +42,9 @@ public abstract class AbstractLoginTask implements ILoginTask {
|
||||
return gc.getTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRequiredAlways() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,4 +27,10 @@ public interface ILoginTask {
|
||||
public boolean isCommandlineTask();
|
||||
|
||||
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException;
|
||||
|
||||
/**
|
||||
* Which indicates the task will be executed for each logon of a project, by default return false(execute only once
|
||||
* at the time of logon studio).
|
||||
*/
|
||||
boolean isRequiredAlways();
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
@@ -91,11 +92,14 @@ public final class ProjectManager {
|
||||
|
||||
private Set<Object> updatedRemoteHandlerRecords;
|
||||
|
||||
private Set<Project> tempProjects;
|
||||
|
||||
private ProjectManager() {
|
||||
beforeLogonRecords = new HashSet<String>();
|
||||
logonRecords = new HashSet<String>();
|
||||
migrationRecords = new HashSet<String>();
|
||||
updatedRemoteHandlerRecords = new HashSet<Object>();
|
||||
tempProjects = new HashSet<>();
|
||||
initCurrentProject();
|
||||
}
|
||||
|
||||
@@ -106,6 +110,18 @@ public final class ProjectManager {
|
||||
return singleton;
|
||||
}
|
||||
|
||||
public void clearTempProjects() {
|
||||
tempProjects.clear();
|
||||
}
|
||||
|
||||
public boolean removeTempProject(Project project) {
|
||||
return tempProjects.remove(project);
|
||||
}
|
||||
|
||||
public boolean addTempProject(Project project) {
|
||||
return tempProjects.add(project);
|
||||
}
|
||||
|
||||
public Project getProjectFromProjectLabel(String label) {
|
||||
if (currentProject == null) {
|
||||
initCurrentProject();
|
||||
@@ -119,6 +135,12 @@ public final class ProjectManager {
|
||||
return project;
|
||||
}
|
||||
}
|
||||
|
||||
for (Project project : tempProjects) {
|
||||
if (StringUtils.equals(project.getLabel(), label)) {
|
||||
return project;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -136,6 +158,11 @@ public final class ProjectManager {
|
||||
return project;
|
||||
}
|
||||
}
|
||||
for (Project project : tempProjects) {
|
||||
if (StringUtils.equals(project.getTechnicalLabel(), label)) {
|
||||
return project;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -200,6 +227,10 @@ public final class ProjectManager {
|
||||
* return all the referenced projects of current project.
|
||||
*/
|
||||
public List<Project> getAllReferencedProjects(boolean force) {
|
||||
return getAllReferencedProjects(getCurrentProject(), force);
|
||||
}
|
||||
|
||||
public List<Project> getAllReferencedProjects(Project targetProject, boolean force) {
|
||||
List<Project> allReferencedprojects = new ArrayList<Project>();
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IProxyRepositoryService.class)) {
|
||||
if (this.getCurrentProject() == null) {
|
||||
@@ -212,7 +243,7 @@ public final class ProjectManager {
|
||||
IProxyRepositoryFactory factory = service.getProxyRepositoryFactory();
|
||||
if (factory != null) {
|
||||
List<org.talend.core.model.properties.Project> rProjects = factory
|
||||
.getReferencedProjects(this.getCurrentProject());
|
||||
.getReferencedProjects(targetProject);
|
||||
if (rProjects != null) {
|
||||
for (org.talend.core.model.properties.Project p : rProjects) {
|
||||
Project project = new Project(p);
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -33,6 +33,8 @@ public class RepositoryConstants {
|
||||
|
||||
public static final String PROJECT_BRANCH_ID = "repository.project.branch"; //$NON-NLS-1$
|
||||
|
||||
public static final String PROJECT_ID = "repository.project.id";
|
||||
|
||||
public static final String IMG_DIRECTORY = "images"; //$NON-NLS-1$
|
||||
|
||||
public static final String IMG_DIRECTORY_OF_JOB_OUTLINE = "images/job_outlines"; //$NON-NLS-1$
|
||||
@@ -98,6 +100,8 @@ public class RepositoryConstants {
|
||||
|
||||
public static final String REPOSITORY_CLOUD_APAC_ID = "cloud_apac"; //$NON-NLS-1$
|
||||
|
||||
public static final String REPOSITORY_CLOUD_US_WEST_ID = "cloud_us_west"; //$NON-NLS-1$
|
||||
|
||||
public static final String REPOSITORY_CLOUD_CUSTOM_ID = "cloud_custom"; //$NON-NLS-1$
|
||||
|
||||
public static final String REPOSITORY_URL = "url"; //$NON-NLS-1$
|
||||
|
||||
@@ -17,6 +17,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.eclipse.emf.common.util.EMap;
|
||||
import org.eclipse.gef.commands.Command;
|
||||
@@ -152,8 +153,8 @@ public class RepositoryChangeMetadataForSAPBapi extends Command {
|
||||
|
||||
String uinqueTableName = node.getProcess().generateUniqueConnectionName(
|
||||
MultiSchemasUtil.getConnectionBaseName(newMetadatTable.getLabel()));
|
||||
String paramType = getParamType(newMetadatTable, isInput);
|
||||
if (paramType == null) {
|
||||
String type = getType(newMetadatTable, isInput);
|
||||
if (type == null) {
|
||||
return;
|
||||
}
|
||||
if (selectionIndex != null && selectionIndex < paramValues.size()) {
|
||||
@@ -165,18 +166,19 @@ public class RepositoryChangeMetadataForSAPBapi extends Command {
|
||||
paramValues.add(valueMap);
|
||||
}
|
||||
valueMap.put(ISAPConstant.NAME, TalendQuoteUtils.addQuotes(newMetadatTable.getLabel()));
|
||||
valueMap.put(ISAPConstant.TYPE, paramType);
|
||||
valueMap.put(ISAPConstant.TYPE, type);
|
||||
valueMap.put(ISAPConstant.FIELD_SCHEMA, uinqueTableName);
|
||||
if (isInput) {
|
||||
valueMap.put(ISAPConstant.PARENT_ROW, ""); //$NON-NLS-1$
|
||||
if (functionUnit != null && functionUnit.getParamData() != null
|
||||
&& functionUnit.getParamData().getInputRoot() != null) {
|
||||
for (SAPFunctionParameter param : functionUnit.getParamData().getInputRoot().getChildren()) {
|
||||
if (param.getName().equals(newMetadatTable.getTableName())) {
|
||||
valueMap.put(ISAPConstant.CHANGING, param.isChanging());
|
||||
}
|
||||
}
|
||||
|
||||
String inputParameterType = getInputParameterType(functionUnit, newMetadatTable);
|
||||
if (StringUtils.isBlank(inputParameterType)) {
|
||||
inputParameterType = ISAPConstant.PARAMETER_TYPE_IMPORT;
|
||||
}
|
||||
valueMap.put(ISAPConstant.PARAMETER_TYPE, inputParameterType);
|
||||
|
||||
valueMap.put(ISAPConstant.CHANGING, ISAPConstant.PARAMETER_TYPE_CHANGING.equals(inputParameterType));
|
||||
|
||||
Map<String, String> properties = newMetadatTable.getAdditionalProperties();
|
||||
if (properties != null) {
|
||||
properties.put(ISINPUT, TRUE);
|
||||
@@ -195,7 +197,37 @@ public class RepositoryChangeMetadataForSAPBapi extends Command {
|
||||
}
|
||||
}
|
||||
|
||||
private String getParamType(IMetadataTable table, boolean isInput) {
|
||||
private String getInputParameterType(SAPFunctionUnit funcUnit, IMetadataTable newMetadatTable) {
|
||||
String parameterType = "";
|
||||
if (funcUnit != null && funcUnit.getParamData() != null && funcUnit.getParamData().getInputRoot() != null) {
|
||||
SAPFunctionParameter foundParam = null;
|
||||
String tableName = newMetadatTable.getTableName();
|
||||
for (SAPFunctionParameter param : funcUnit.getParamData().getInputRoot().getChildren()) {
|
||||
if (tableName.equals(param.getName())) {
|
||||
foundParam = param;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (foundParam != null) {
|
||||
if (foundParam.isChanging()) {
|
||||
parameterType = ISAPConstant.PARAMETER_TYPE_CHANGING;
|
||||
} else {
|
||||
if (ISAPConstant.PARAM_TABLE.equals(foundParam.getType())) {
|
||||
if (foundParam.isTableResideInTables()) {
|
||||
parameterType = ISAPConstant.PARAMETER_TYPE_TABLES;
|
||||
} else {
|
||||
parameterType = ISAPConstant.PARAMETER_TYPE_IMPORT;
|
||||
}
|
||||
} else {
|
||||
parameterType = ISAPConstant.PARAMETER_TYPE_IMPORT;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return parameterType;
|
||||
}
|
||||
|
||||
private String getType(IMetadataTable table, boolean isInput) {
|
||||
if (functionUnit == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ import org.eclipse.ui.IWorkbench;
|
||||
import org.eclipse.ui.IWorkbenchPreferencePage;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.commons.ui.runtime.update.PreferenceKeys;
|
||||
import org.talend.commons.ui.runtime.utils.ZipFileUtils;
|
||||
import org.talend.commons.ui.swt.advanced.dataeditor.LabelFieldEditor;
|
||||
import org.talend.commons.ui.utils.workbench.preferences.OneLineComboFieldEditor;
|
||||
@@ -528,6 +529,7 @@ public abstract class I18nPreferencePage extends FieldEditorPreferencePage imple
|
||||
boolean ok = super.performOk();
|
||||
saveLanguageType();
|
||||
CorePlugin.getDefault().savePluginPreferences();
|
||||
PlatformUI.getPreferenceStore().setValue(PreferenceKeys.NEED_OSGI_CLEAN, true);
|
||||
if (isBabiliButtonClicked) {
|
||||
refreshAll();
|
||||
}
|
||||
@@ -545,6 +547,13 @@ public abstract class I18nPreferencePage extends FieldEditorPreferencePage imple
|
||||
protected void performApply() {
|
||||
saveLanguageType();
|
||||
CorePlugin.getDefault().savePluginPreferences();
|
||||
PlatformUI.getPreferenceStore().setValue(PreferenceKeys.NEED_OSGI_CLEAN, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void performDefaults() {
|
||||
super.performDefaults();
|
||||
PlatformUI.getPreferenceStore().setValue(PreferenceKeys.NEED_OSGI_CLEAN, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,11 +12,18 @@
|
||||
// ============================================================================
|
||||
package org.talend.core.ui.utils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.eclipse.core.runtime.FileLocator;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.URIUtil;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.IWorkbenchPage;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
@@ -104,4 +111,28 @@ public class PluginUtil {
|
||||
}
|
||||
return part.getEditorSite().getId();
|
||||
}
|
||||
|
||||
public static File getStudioConfigFile() throws Exception {
|
||||
URL configLocation = new URL("platform:/config/config.ini"); //$NON-NLS-1$
|
||||
URL fileUrl = FileLocator.toFileURL(configLocation);
|
||||
return URIUtil.toFile(new URI(fileUrl.getProtocol(), fileUrl.getPath(), fileUrl.getQuery()));
|
||||
}
|
||||
|
||||
public static Properties readProperties(final File config) {
|
||||
final Properties configuration = new Properties();
|
||||
try (final InputStream stream = new FileInputStream(config)) {
|
||||
configuration.load(stream);
|
||||
} catch (final IOException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
return configuration;
|
||||
}
|
||||
|
||||
public static void saveProperties(final File config, Properties prop, String comment) {
|
||||
try (FileOutputStream oFile = new FileOutputStream(config)) {
|
||||
prop.store(oFile, comment);
|
||||
} catch (final IOException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ import org.talend.core.model.metadata.QueryUtil;
|
||||
import org.talend.core.model.metadata.builder.ConvertionHelper;
|
||||
import org.talend.core.model.metadata.builder.connection.MetadataTable;
|
||||
import org.talend.core.model.process.ElementParameterParser;
|
||||
import org.talend.core.model.process.ProcessUtils;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.relationship.RelationshipItemBuilder;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
@@ -280,9 +281,10 @@ public class CoreService implements ICoreService {
|
||||
ICodeGeneratorService codeGenService = (ICodeGeneratorService) GlobalServiceRegister.getDefault().getService(
|
||||
ICodeGeneratorService.class);
|
||||
codeGenService.createRoutineSynchronizer().syncAllRoutinesForLogOn();
|
||||
codeGenService.createRoutineSynchronizer().syncAllPigudfForLogOn();
|
||||
if (ProcessUtils.isRequiredPigUDFs(null)) {
|
||||
codeGenService.createRoutineSynchronizer().syncAllPigudfForLogOn();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -43,7 +43,7 @@ public class RenameComponentConversion implements IComponentConversion {
|
||||
replaceAllInAllNodesParameterValue(item, oldNodeUniqueName, newNodeUniqueName);
|
||||
}
|
||||
|
||||
private static void replaceAllInAllNodesParameterValue(ProcessType item, String oldName, String newName) {
|
||||
protected static void replaceAllInAllNodesParameterValue(ProcessType item, String oldName, String newName) {
|
||||
for (Object o : item.getNode()) {
|
||||
NodeType nt = (NodeType) o;
|
||||
ComponentUtilities.replaceInNodeParameterValue(nt, oldName, newName);
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.model.components.conversions;
|
||||
|
||||
import org.talend.core.model.components.ComponentUtilities;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.NodeType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ProcessType;
|
||||
|
||||
public class RenameETLJDBCComponentConversion extends RenameComponentConversion{
|
||||
|
||||
private String newName;
|
||||
|
||||
private String oldName;
|
||||
|
||||
public RenameETLJDBCComponentConversion(String newName, String oldName) {
|
||||
super(newName);
|
||||
this.newName = newName;
|
||||
this.oldName = oldName;
|
||||
}
|
||||
|
||||
public void transform(NodeType node) {
|
||||
node.setComponentName(newName);
|
||||
ProcessType item = (ProcessType) node.eContainer();
|
||||
String oldNodeUniqueName = ComponentUtilities.getNodeUniqueName(node);
|
||||
String newNodeUniqueName = oldNodeUniqueName.replaceAll(oldName, newName);
|
||||
ComponentUtilities.setNodeUniqueName(node, newNodeUniqueName);
|
||||
replaceAllInAllNodesParameterValue(item, oldNodeUniqueName, newNodeUniqueName);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,11 +20,14 @@ import org.eclipse.emf.common.util.URI;
|
||||
import org.osgi.service.prefs.BackingStoreException;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.commons.exception.SystemException;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.IService;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.process.INode;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.updatesite.IUpdateSiteBean;
|
||||
|
||||
|
||||
/**
|
||||
* wchen class global comment. Detailled comment
|
||||
*/
|
||||
@@ -66,4 +69,19 @@ public interface ICoreTisService extends IService {
|
||||
|
||||
public void updateConfiguratorBundles(File configFile, File tempConfigFile) throws IOException;
|
||||
|
||||
public void afterImport(Property property) throws PersistenceException;
|
||||
|
||||
boolean hasNewPatchInPatchesFolder();
|
||||
|
||||
boolean isDefaultLicenseAndProjectType();
|
||||
|
||||
void refreshPatchesFolderCache();
|
||||
|
||||
static ICoreTisService get() {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreTisService.class)) {
|
||||
return GlobalServiceRegister.getDefault().getService(ICoreTisService.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -64,6 +64,8 @@ import org.talend.core.language.LanguageManager;
|
||||
import org.talend.core.model.components.ComponentCategory;
|
||||
import org.talend.core.model.components.EComponentType;
|
||||
import org.talend.core.model.components.IComponent;
|
||||
import org.talend.core.model.components.IComponentsFactory;
|
||||
import org.talend.core.model.components.IComponentsService;
|
||||
import org.talend.core.model.general.ModuleNeeded;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.metadata.IMetadataColumn;
|
||||
@@ -81,6 +83,7 @@ import org.talend.core.model.process.JobInfo;
|
||||
import org.talend.core.model.process.ProcessUtils;
|
||||
import org.talend.core.model.process.ReplaceNodesInProcessProvider;
|
||||
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.relationship.Relation;
|
||||
@@ -92,13 +95,16 @@ import org.talend.core.model.repository.job.JobResource;
|
||||
import org.talend.core.model.repository.job.JobResourceManager;
|
||||
import org.talend.core.model.utils.JavaResourcesHelper;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||
import org.talend.core.runtime.process.ITalendProcessJavaProject;
|
||||
import org.talend.core.runtime.process.LastGenerationInfo;
|
||||
import org.talend.core.runtime.process.TalendProcessArgumentConstant;
|
||||
import org.talend.core.runtime.process.TalendProcessOptionConstants;
|
||||
import org.talend.core.runtime.projectsetting.ProjectPreferenceManager;
|
||||
import org.talend.core.runtime.repository.build.BuildExportManager;
|
||||
import org.talend.core.service.IResourcesDependenciesService;
|
||||
import org.talend.core.services.ICoreTisService;
|
||||
import org.talend.core.services.IGITProviderService;
|
||||
import org.talend.core.services.ISVNProviderService;
|
||||
import org.talend.core.ui.IJobletProviderService;
|
||||
import org.talend.core.ui.ITestContainerProviderService;
|
||||
@@ -152,7 +158,7 @@ public class ProcessorUtilities {
|
||||
private static boolean exportJobAsMicroService = false;
|
||||
|
||||
private static IDesignerCoreService designerCoreService =
|
||||
(IDesignerCoreService) GlobalServiceRegister.getDefault().getService(IDesignerCoreService.class);
|
||||
GlobalServiceRegister.getDefault().getService(IDesignerCoreService.class);
|
||||
|
||||
private static Map<String, Integer> lastGeneratedWithStatsOrTrace = new HashMap<String, Integer>();
|
||||
|
||||
@@ -170,6 +176,8 @@ public class ProcessorUtilities {
|
||||
|
||||
private static boolean isDebug = false;
|
||||
|
||||
private static boolean isCIMode = false;
|
||||
|
||||
private static JobInfo mainJobInfo;
|
||||
|
||||
public static void addOpenEditor(IEditorPart editor) {
|
||||
@@ -557,7 +565,10 @@ public class ProcessorUtilities {
|
||||
neededLibraries);
|
||||
|
||||
// get all job testcases needed modules
|
||||
neededLibraries.addAll(getAllJobTestcaseModules(selectedProcessItem));
|
||||
Set<ModuleNeeded> testcaseModules = getAllJobTestcaseModules(selectedProcessItem);
|
||||
LastGenerationInfo.getInstance().setTestcaseModuleNeeded(jobInfo.getJobId(), jobInfo.getJobVersion(),
|
||||
testcaseModules);
|
||||
neededLibraries.addAll(testcaseModules);
|
||||
|
||||
// must install the needed libraries before generate codes with poms.
|
||||
CorePlugin.getDefault().getRunProcessService().updateLibraries(neededLibraries, currentProcess,
|
||||
@@ -613,28 +624,55 @@ public class ProcessorUtilities {
|
||||
return processor;
|
||||
}
|
||||
|
||||
private static boolean checkLoopDependencies(Relation mainJobInfo, Map<String, String> idToLastestVersionMap)
|
||||
public static boolean checkLoopDependencies(Relation mainJobInfo, Map<String, String> idToLastestVersionMap)
|
||||
throws ProcessorException {
|
||||
List<Relation> itemsJobRelatedTo = getItemsRelation(mainJobInfo, idToLastestVersionMap);
|
||||
List<Relation> relationChecked = new ArrayList<>();
|
||||
relationChecked.add(mainJobInfo);
|
||||
return checkLoopDependencies(mainJobInfo, itemsJobRelatedTo, relationChecked, idToLastestVersionMap);
|
||||
return checkLoopDependencies(mainJobInfo, mainJobInfo, itemsJobRelatedTo, relationChecked, idToLastestVersionMap);
|
||||
}
|
||||
|
||||
private static boolean checkLoopDependencies(Relation mainRelation, List<Relation> itemsJobRelatedTo,
|
||||
private static boolean checkLoopDependencies(Relation mainRelation, Relation currentRelation,
|
||||
List<Relation> itemsJobRelatedTo,
|
||||
List<Relation> relationChecked, Map<String, String> idToLastestVersionMap) throws ProcessorException {
|
||||
boolean hasDependency = false;
|
||||
for (Relation relation : itemsJobRelatedTo) {
|
||||
try {
|
||||
// means the tRunjob deactivate, or one of the specific version tRunjon deactivate, skip
|
||||
Map<String, Set<String>> actTrunjobHM = getActivateTRunjobMap(currentRelation.getId(),
|
||||
currentRelation.getVersion());
|
||||
if (actTrunjobHM.get(relation.getId()) == null
|
||||
|| !actTrunjobHM.get(relation.getId()).contains(relation.getVersion())) {
|
||||
continue;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new ProcessorException(e);
|
||||
}
|
||||
|
||||
hasDependency = relation.getId().equals(mainRelation.getId())
|
||||
&& relation.getVersion().equals(mainRelation.getVersion());
|
||||
if (!hasDependency) {
|
||||
List<Relation> itemsChildJob = getItemsRelation(relation, idToLastestVersionMap);
|
||||
if (!relationChecked.contains(relation)) {
|
||||
relationChecked.add(relation);
|
||||
hasDependency = checkLoopDependencies(mainRelation, itemsChildJob, relationChecked, idToLastestVersionMap);
|
||||
hasDependency = checkLoopDependencies(mainRelation, relation, itemsChildJob, relationChecked,
|
||||
idToLastestVersionMap);
|
||||
}
|
||||
if (!hasDependency) {
|
||||
for (Relation childRelation : itemsChildJob) {
|
||||
|
||||
try {
|
||||
// means the tRunjob deactivate, or one of the specific version tRunjon deactivate, skip
|
||||
Map<String, Set<String>> activateTRunjobMap = getActivateTRunjobMap(relation.getId(),
|
||||
relation.getVersion());
|
||||
if (activateTRunjobMap.get(childRelation.getId()) == null
|
||||
|| !activateTRunjobMap.get(childRelation.getId()).contains(childRelation.getVersion())) {
|
||||
continue;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new ProcessorException(e);
|
||||
}
|
||||
|
||||
hasDependency = checkLoopDependencies(childRelation, idToLastestVersionMap);
|
||||
if (hasDependency) {
|
||||
break;
|
||||
@@ -650,6 +688,133 @@ public class ProcessorUtilities {
|
||||
return hasDependency;
|
||||
}
|
||||
|
||||
private static Map<String, Set<String>> getActivateTRunjobMap(String id, String version) throws PersistenceException {
|
||||
Map<String, Set<String>> actTrunjobHM = new HashMap<String, Set<String>>();
|
||||
ProcessType processType = null;
|
||||
try {
|
||||
IRepositoryViewObject currentJobObject = ProxyRepositoryFactory.getInstance().getSpecificVersion(id, version, true);
|
||||
if (currentJobObject != null) {
|
||||
Item item = currentJobObject.getProperty().getItem();
|
||||
if (item instanceof ProcessItem) {
|
||||
processType = ((ProcessItem) item).getProcess();
|
||||
} else if (item instanceof JobletProcessItem) {
|
||||
processType = ((JobletProcessItem) item).getJobletProcess();
|
||||
}
|
||||
}
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
if (processType != null) {
|
||||
List<Project> allProjects = new ArrayList<Project>();
|
||||
allProjects.add(ProjectManager.getInstance().getCurrentProject());
|
||||
allProjects.addAll(ProjectManager.getInstance().getAllReferencedProjects());
|
||||
|
||||
List<String> jobletsComponentsList = new ArrayList<String>();
|
||||
IComponentsFactory componentsFactory = null;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IComponentsService.class)) {
|
||||
IComponentsService compService = GlobalServiceRegister.getDefault()
|
||||
.getService(IComponentsService.class);
|
||||
if (compService != null) {
|
||||
componentsFactory = compService.getComponentsFactory();
|
||||
for (IComponent component : componentsFactory.readComponents()) {
|
||||
if (component.getComponentType() == EComponentType.JOBLET) {
|
||||
jobletsComponentsList.add(component.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String jobletPaletteType = null;
|
||||
String frameWork = processType.getFramework();
|
||||
if (StringUtils.isBlank(frameWork)) {
|
||||
jobletPaletteType = ComponentCategory.CATEGORY_4_DI.getName();
|
||||
} else if (frameWork.equals(HadoopConstants.FRAMEWORK_SPARK)) {
|
||||
jobletPaletteType = ComponentCategory.CATEGORY_4_SPARK.getName();
|
||||
} else if (frameWork.equals(HadoopConstants.FRAMEWORK_SPARK_STREAMING)) {
|
||||
jobletPaletteType = ComponentCategory.CATEGORY_4_SPARKSTREAMING.getName();
|
||||
}
|
||||
|
||||
for (Object nodeObject : processType.getNode()) {
|
||||
NodeType node = (NodeType) nodeObject;
|
||||
// not tRunjob && not joblet then continue
|
||||
if (!node.getComponentName().equals("tRunJob") && !jobletsComponentsList.contains(node.getComponentName())) { // $NON-NLS-1$
|
||||
continue;
|
||||
}
|
||||
boolean nodeActivate = true;
|
||||
String processIds = null;
|
||||
String processVersion = null;
|
||||
for (Object elementParam : node.getElementParameter()) {
|
||||
ElementParameterType elemParamType = (ElementParameterType) elementParam;
|
||||
if ("PROCESS:PROCESS_TYPE_PROCESS".equals(elemParamType.getName())) { // $NON-NLS-1$
|
||||
processIds = elemParamType.getValue();
|
||||
if (StringUtils.isNotBlank(processIds)) {
|
||||
for (String jobId : processIds.split(ProcessorUtilities.COMMA)) {
|
||||
if (actTrunjobHM.get(jobId) == null) {
|
||||
actTrunjobHM.put(jobId, new HashSet<String>());
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if ("PROCESS:PROCESS_TYPE_VERSION".equals(elemParamType.getName()) // $NON-NLS-1$
|
||||
|| "PROCESS_TYPE_VERSION".equals(elemParamType.getName())) { // $NON-NLS-1$
|
||||
processVersion = elemParamType.getValue();
|
||||
} else if ("ACTIVATE".equals(elemParamType.getName())) { // $NON-NLS-1$
|
||||
nodeActivate = Boolean.parseBoolean(elemParamType.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
if (nodeActivate) {
|
||||
if (StringUtils.isNotBlank(processIds)) {
|
||||
for (String jobId : processIds.split(ProcessorUtilities.COMMA)) {
|
||||
String actualVersion = processVersion;
|
||||
if (RelationshipItemBuilder.LATEST_VERSION.equals(processVersion)) {
|
||||
for (Project project : allProjects) {
|
||||
IRepositoryViewObject lastVersion = null;
|
||||
lastVersion = ProxyRepositoryFactory.getInstance().getLastVersion(project, jobId);
|
||||
if (lastVersion != null) {
|
||||
actualVersion = lastVersion.getVersion();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (actTrunjobHM.get(jobId) != null) {
|
||||
actTrunjobHM.get(jobId).add(actualVersion);
|
||||
}
|
||||
|
||||
}
|
||||
} else if (componentsFactory != null && jobletPaletteType != null) {
|
||||
// for joblet
|
||||
IComponent cc = componentsFactory.get(node.getComponentName(), jobletPaletteType);
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IJobletProviderService.class)) {
|
||||
IJobletProviderService jobletService = GlobalServiceRegister.getDefault()
|
||||
.getService(IJobletProviderService.class);
|
||||
Property property = jobletService.getJobletComponentItem(cc);
|
||||
if (property != null && StringUtils.isNotBlank(property.getId())) {
|
||||
String jobletId = property.getId();
|
||||
if (actTrunjobHM.get(jobletId) == null) {
|
||||
actTrunjobHM.put(jobletId, new HashSet<String>());
|
||||
}
|
||||
String actualVersion = processVersion;
|
||||
if (RelationshipItemBuilder.LATEST_VERSION.equals(processVersion)) {
|
||||
for (Project project : allProjects) {
|
||||
IRepositoryViewObject lastVersion = null;
|
||||
lastVersion = ProxyRepositoryFactory.getInstance().getLastVersion(project, jobletId);
|
||||
if (lastVersion != null) {
|
||||
actualVersion = lastVersion.getVersion();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
actTrunjobHM.get(jobletId).add(actualVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return actTrunjobHM;
|
||||
}
|
||||
|
||||
private static List<Relation> getItemsRelation(Relation mainJobInfo, Map<String, String> idToLastestVersionMap) throws ProcessorException {
|
||||
List<Relation> itemsJobRelatedTo = new ArrayList<Relation>();
|
||||
try {
|
||||
@@ -733,11 +898,18 @@ public class ProcessorUtilities {
|
||||
|
||||
IFolder xmlMappingFolder = jobInfo.getProcessor().getTalendJavaProject().getResourceSubFolder(null,
|
||||
JavaUtils.JAVA_XML_MAPPING);
|
||||
if (xmlMappingFolder.members().length == 0
|
||||
ProjectPreferenceManager manager = CoreRuntimePlugin.getInstance().getProjectPreferenceManager();
|
||||
boolean updated = manager.getBoolean(MetadataTalendType.UPDATED_MAPPING_FILES);
|
||||
if ((xmlMappingFolder.members().length == 0 || updated)
|
||||
&& GlobalServiceRegister.getDefault().isServiceRegistered(ICoreService.class)) {
|
||||
ICoreService coreService =
|
||||
(ICoreService) GlobalServiceRegister.getDefault().getService(ICoreService.class);
|
||||
GlobalServiceRegister.getDefault().getService(ICoreService.class);
|
||||
coreService.synchronizeMapptingXML(jobInfo.getProcessor().getTalendJavaProject());
|
||||
// reset
|
||||
if (updated) {
|
||||
manager.setValue(MetadataTalendType.UPDATED_MAPPING_FILES, false);
|
||||
manager.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -758,7 +930,7 @@ public class ProcessorUtilities {
|
||||
boolean hasDynamicMetadata = false;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerCoreService.class)) {
|
||||
IDesignerCoreService designerCoreService =
|
||||
(IDesignerCoreService) GlobalServiceRegister.getDefault().getService(IDesignerCoreService.class);
|
||||
GlobalServiceRegister.getDefault().getService(IDesignerCoreService.class);
|
||||
for (INode node : currentProcess.getGraphicalNodes()) {
|
||||
if (designerCoreService.isDelegateNode(node)) { // for jdbc, currently
|
||||
return true;
|
||||
@@ -768,7 +940,7 @@ public class ProcessorUtilities {
|
||||
|
||||
ICoreTisService service = null;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreTisService.class)) {
|
||||
service = (ICoreTisService) GlobalServiceRegister.getDefault().getService(ICoreTisService.class);
|
||||
service = GlobalServiceRegister.getDefault().getService(ICoreTisService.class);
|
||||
}
|
||||
for (INode node : (List<? extends INode>) currentProcess.getGeneratingNodes()) {
|
||||
if (node.getComponent() != null && node.getComponent().getComponentType() == EComponentType.GENERIC) {
|
||||
@@ -941,8 +1113,8 @@ public class ProcessorUtilities {
|
||||
private static void generateDataSet(IProcess process, IProcessor processor) {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
|
||||
ITestContainerProviderService testContainerService =
|
||||
(ITestContainerProviderService) GlobalServiceRegister.getDefault().getService(
|
||||
ITestContainerProviderService.class);
|
||||
GlobalServiceRegister.getDefault().getService(
|
||||
ITestContainerProviderService.class);
|
||||
if (testContainerService != null) {
|
||||
if (!testContainerService.isTestContainerProcess(process)) {
|
||||
return;
|
||||
@@ -1116,7 +1288,7 @@ public class ProcessorUtilities {
|
||||
|
||||
Set<ModuleNeeded> neededLibraries =
|
||||
CorePlugin.getDefault().getDesignerCoreService().getNeededLibrariesForProcess(currentProcess,
|
||||
false);
|
||||
isCIMode && BitwiseOptionUtils.containOption(option, GENERATE_MAIN_ONLY));
|
||||
if (neededLibraries != null) {
|
||||
LastGenerationInfo.getInstance().setModulesNeededWithSubjobPerJob(jobInfo.getJobId(),
|
||||
jobInfo.getJobVersion(), neededLibraries);
|
||||
@@ -1124,7 +1296,10 @@ public class ProcessorUtilities {
|
||||
neededLibraries);
|
||||
|
||||
// get all job testcases needed modules
|
||||
neededLibraries.addAll(getAllJobTestcaseModules(selectedProcessItem));
|
||||
Set<ModuleNeeded> testcaseModules = getAllJobTestcaseModules(selectedProcessItem);
|
||||
LastGenerationInfo.getInstance().setTestcaseModuleNeeded(jobInfo.getJobId(), jobInfo.getJobVersion(),
|
||||
testcaseModules);
|
||||
neededLibraries.addAll(testcaseModules);
|
||||
|
||||
// must install the needed libraries before generate codes with poms.
|
||||
CorePlugin.getDefault().getRunProcessService().updateLibraries(neededLibraries, currentProcess,
|
||||
@@ -1206,8 +1381,8 @@ public class ProcessorUtilities {
|
||||
Set<ModuleNeeded> neededLibraries = new HashSet<>();
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
|
||||
ITestContainerProviderService testcontainerService =
|
||||
(ITestContainerProviderService) GlobalServiceRegister.getDefault().getService(
|
||||
ITestContainerProviderService.class);
|
||||
GlobalServiceRegister.getDefault().getService(
|
||||
ITestContainerProviderService.class);
|
||||
if (!testcontainerService.isTestContainerItem(selectedProcessItem)) {
|
||||
try {
|
||||
neededLibraries.addAll(testcontainerService.getAllJobTestcaseModules(selectedProcessItem));
|
||||
@@ -1229,14 +1404,23 @@ public class ProcessorUtilities {
|
||||
public static void cleanSourceFolder(IProgressMonitor progressMonitor, IProcess currentProcess,
|
||||
IProcessor processor) {
|
||||
try {
|
||||
ITalendProcessJavaProject jobProject = processor.getTalendJavaProject();
|
||||
// clean up source code
|
||||
IPath codePath = processor.getSrcCodePath().removeLastSegments(2);
|
||||
IFolder srcFolder = processor.getTalendJavaProject().getProject().getFolder(codePath);
|
||||
IFolder srcFolder = jobProject.getProject().getFolder(codePath);
|
||||
String jobPackageFolder = JavaResourcesHelper.getJobClassPackageFolder(currentProcess);
|
||||
for (IResource resource : srcFolder.members()) {
|
||||
if (resource.getProjectRelativePath().toPortableString().endsWith(jobPackageFolder)) {
|
||||
break;
|
||||
if (!resource.getProjectRelativePath().toPortableString().endsWith(jobPackageFolder)) {
|
||||
resource.delete(true, progressMonitor);
|
||||
}
|
||||
}
|
||||
// clean up resources folder if needed
|
||||
if (ProcessorUtilities.isExportConfig() && !designerCoreService.isNeedContextInJar(currentProcess)) {
|
||||
for (IResource resource : jobProject.getResourcesFolder().members()) {
|
||||
if (resource.exists()) {
|
||||
resource.delete(true, progressMonitor);
|
||||
}
|
||||
}
|
||||
resource.delete(true, progressMonitor);
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
ExceptionHandler.process(e);
|
||||
@@ -1279,7 +1463,7 @@ public class ProcessorUtilities {
|
||||
// 2.TDQ-14308 current drools file in 'src/resourcesmetadata/survivorship/' should be included to job jar.
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITDQItemService.class)) {
|
||||
ITDQItemService tdqItemService =
|
||||
(ITDQItemService) GlobalServiceRegister.getDefault().getService(ITDQItemService.class);
|
||||
GlobalServiceRegister.getDefault().getService(ITDQItemService.class);
|
||||
if (tdqItemService == null) {
|
||||
return;
|
||||
}
|
||||
@@ -1333,7 +1517,7 @@ public class ProcessorUtilities {
|
||||
}
|
||||
IProcess2 process = (IProcess2) currentProcess;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IResourcesDependenciesService.class)) {
|
||||
IResourcesDependenciesService resourcesService = (IResourcesDependenciesService) GlobalServiceRegister.getDefault()
|
||||
IResourcesDependenciesService resourcesService = GlobalServiceRegister.getDefault()
|
||||
.getService(IResourcesDependenciesService.class);
|
||||
if (resourcesService == null) {
|
||||
return;
|
||||
@@ -1410,8 +1594,8 @@ public class ProcessorUtilities {
|
||||
if (BitwiseOptionUtils.containOption(option, GENERATE_TESTS) && jobInfo.getProcessItem() != null) {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
|
||||
ITestContainerProviderService testContainerService =
|
||||
(ITestContainerProviderService) GlobalServiceRegister.getDefault().getService(
|
||||
ITestContainerProviderService.class);
|
||||
GlobalServiceRegister.getDefault().getService(
|
||||
ITestContainerProviderService.class);
|
||||
if (testContainerService != null) {
|
||||
List<ProcessItem> testsItems =
|
||||
testContainerService.getTestContainersByVersion(jobInfo.getProcessItem());
|
||||
@@ -1803,6 +1987,38 @@ public class ProcessorUtilities {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static boolean isRemoteProject() {
|
||||
ISVNProviderService svnService = null;
|
||||
if (PluginChecker.isSVNProviderPluginLoaded()) {
|
||||
svnService = GlobalServiceRegister.getDefault().getService(ISVNProviderService.class);
|
||||
}
|
||||
|
||||
|
||||
IGITProviderService gitService = null;
|
||||
if (PluginChecker.isGITProviderPluginLoaded()) {
|
||||
gitService = GlobalServiceRegister.getDefault().getService(IGITProviderService.class);
|
||||
}
|
||||
|
||||
if ((svnService != null && svnService.isProjectInSvnMode()) || (gitService != null && gitService.isProjectInGitMode()) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void updateCodeSources() throws ProcessorException {
|
||||
if (isRemoteProject()) {
|
||||
try {
|
||||
ProxyRepositoryFactory.getInstance().initialize();
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
RepositoryManager.syncRoutineAndJoblet(ERepositoryObjectType.ROUTINES);
|
||||
RepositoryManager.syncRoutineAndJoblet(ERepositoryObjectType.PIG_UDF);
|
||||
RepositoryManager.syncRoutineAndJoblet(ERepositoryObjectType.BEANS);
|
||||
}
|
||||
}
|
||||
|
||||
public static IProcessor generateCode(ProcessItem process, String contextName, boolean statistics, boolean trace)
|
||||
throws ProcessorException {
|
||||
@@ -1819,14 +2035,7 @@ public class ProcessorUtilities {
|
||||
|
||||
public static IProcessor generateCode(IProcess process, IContext context, boolean statistics, boolean trace,
|
||||
boolean contextProperties, boolean applyToChildren) throws ProcessorException {
|
||||
ISVNProviderService service = null;
|
||||
if (PluginChecker.isSVNProviderPluginLoaded()) {
|
||||
service = (ISVNProviderService) GlobalServiceRegister.getDefault().getService(ISVNProviderService.class);
|
||||
}
|
||||
if (service != null && service.isProjectInSvnMode()) {
|
||||
RepositoryManager.syncRoutineAndJoblet(ERepositoryObjectType.ROUTINES);
|
||||
RepositoryManager.syncRoutineAndJoblet(ERepositoryObjectType.PIG_UDF);
|
||||
}
|
||||
updateCodeSources();
|
||||
// achen modify to fix 0006107
|
||||
ProcessItem pItem = null;
|
||||
|
||||
@@ -1870,15 +2079,7 @@ public class ProcessorUtilities {
|
||||
|
||||
public static IProcessor generateCode(IProcess process, IContext context, boolean statistics, boolean trace,
|
||||
boolean properties, IProgressMonitor progressMonitor) throws ProcessorException {
|
||||
// added by nma, to refresh routines when generating code in SVN mode. 10225.
|
||||
ISVNProviderService service = null;
|
||||
if (PluginChecker.isSVNProviderPluginLoaded()) {
|
||||
service = (ISVNProviderService) GlobalServiceRegister.getDefault().getService(ISVNProviderService.class);
|
||||
}
|
||||
if (service != null && service.isProjectInSvnMode()) {
|
||||
RepositoryManager.syncRoutineAndJoblet(ERepositoryObjectType.ROUTINES);
|
||||
RepositoryManager.syncRoutineAndJoblet(ERepositoryObjectType.PIG_UDF);
|
||||
}
|
||||
updateCodeSources();
|
||||
// achen modify to fix 0006107
|
||||
ProcessItem pItem = null;
|
||||
|
||||
@@ -1908,14 +2109,7 @@ public class ProcessorUtilities {
|
||||
public static IProcessor generateCode(IProcessor processor, IProcess process, IContext context, boolean statistics,
|
||||
boolean trace, boolean properties, IProgressMonitor progressMonitor) throws ProcessorException {
|
||||
|
||||
ISVNProviderService service = null;
|
||||
if (PluginChecker.isSVNProviderPluginLoaded()) {
|
||||
service = (ISVNProviderService) GlobalServiceRegister.getDefault().getService(ISVNProviderService.class);
|
||||
}
|
||||
if (service != null && service.isProjectInSvnMode()) {
|
||||
RepositoryManager.syncRoutineAndJoblet(ERepositoryObjectType.ROUTINES);
|
||||
RepositoryManager.syncRoutineAndJoblet(ERepositoryObjectType.PIG_UDF);
|
||||
}
|
||||
updateCodeSources();
|
||||
|
||||
CorePlugin.getDefault().getRunProcessService().buildCodesJavaProject(progressMonitor);
|
||||
|
||||
@@ -1965,15 +2159,7 @@ public class ProcessorUtilities {
|
||||
|
||||
public static IProcessor generateCode(IProcess process, IContext context, boolean statistics, boolean trace,
|
||||
boolean properties, int option) throws ProcessorException {
|
||||
// added by nma, to refresh routines when generating code in SVN mode. 10225.
|
||||
ISVNProviderService service = null;
|
||||
if (PluginChecker.isSVNProviderPluginLoaded()) {
|
||||
service = (ISVNProviderService) GlobalServiceRegister.getDefault().getService(ISVNProviderService.class);
|
||||
}
|
||||
if (service != null && service.isProjectInSvnMode()) {
|
||||
RepositoryManager.syncRoutineAndJoblet(ERepositoryObjectType.ROUTINES);
|
||||
RepositoryManager.syncRoutineAndJoblet(ERepositoryObjectType.PIG_UDF);
|
||||
}
|
||||
updateCodeSources();
|
||||
// achen modify to fix 0006107
|
||||
JobInfo jobInfo = new JobInfo(process, context);
|
||||
jobList.clear();
|
||||
@@ -2247,8 +2433,8 @@ public class ProcessorUtilities {
|
||||
if (parentJobInfo.isTestContainer()
|
||||
&& GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
|
||||
ITestContainerProviderService testContainerService =
|
||||
(ITestContainerProviderService) GlobalServiceRegister.getDefault().getService(
|
||||
ITestContainerProviderService.class);
|
||||
GlobalServiceRegister.getDefault().getService(
|
||||
ITestContainerProviderService.class);
|
||||
if (testContainerService != null) {
|
||||
getSubjobInfo(testContainerService.getOriginalNodes(ptype), ptype, parentJobInfo, jobInfos,firstChildOnly);
|
||||
}
|
||||
@@ -2257,8 +2443,8 @@ public class ProcessorUtilities {
|
||||
if (!parentJobInfo.isTestContainer() && !parentJobInfo.isJoblet()
|
||||
&& GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
|
||||
ITestContainerProviderService testContainerService =
|
||||
(ITestContainerProviderService) GlobalServiceRegister.getDefault().getService(
|
||||
ITestContainerProviderService.class);
|
||||
GlobalServiceRegister.getDefault().getService(
|
||||
ITestContainerProviderService.class);
|
||||
if (testContainerService != null) {
|
||||
List<ProcessItem> testsItems =
|
||||
testContainerService.getTestContainersByVersion(parentJobInfo.getProcessItem());
|
||||
@@ -2345,8 +2531,8 @@ public class ProcessorUtilities {
|
||||
// for joblet node
|
||||
if (jobletPaletteType != null && PluginChecker.isJobLetPluginLoaded()) {
|
||||
IJobletProviderService service =
|
||||
(IJobletProviderService) GlobalServiceRegister.getDefault().getService(
|
||||
IJobletProviderService.class);
|
||||
GlobalServiceRegister.getDefault().getService(
|
||||
IJobletProviderService.class);
|
||||
if (service != null) {
|
||||
IComponent jobletComponent = service.getJobletComponent(node, jobletPaletteType);
|
||||
ProcessType jobletProcess = service.getJobletProcess(jobletComponent);
|
||||
@@ -2420,8 +2606,8 @@ public class ProcessorUtilities {
|
||||
} else {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IJobletProviderService.class)) {
|
||||
IJobletProviderService jobletService =
|
||||
(IJobletProviderService) GlobalServiceRegister.getDefault().getService(
|
||||
IJobletProviderService.class);
|
||||
GlobalServiceRegister.getDefault().getService(
|
||||
IJobletProviderService.class);
|
||||
if (jobletService.isJobletItem(processItem)) {
|
||||
processType = jobletService.getJobletProcess(processItem);
|
||||
parentJobInfo = new JobInfo(processItem.getProperty(), processType.getDefaultContext());
|
||||
@@ -2430,8 +2616,8 @@ public class ProcessorUtilities {
|
||||
}
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
|
||||
ITestContainerProviderService testContainerService =
|
||||
(ITestContainerProviderService) GlobalServiceRegister.getDefault().getService(
|
||||
ITestContainerProviderService.class);
|
||||
GlobalServiceRegister.getDefault().getService(
|
||||
ITestContainerProviderService.class);
|
||||
if (testContainerService.isTestContainerItem(processItem)) {
|
||||
parentJobInfo.setTestContainer(true);
|
||||
}
|
||||
@@ -2508,7 +2694,7 @@ public class ProcessorUtilities {
|
||||
public static File getJavaProjectLibFolder() {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
|
||||
IRunProcessService processService =
|
||||
(IRunProcessService) GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
|
||||
GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
|
||||
return processService.getJavaProjectLibFolder().getLocation().toFile();
|
||||
}
|
||||
return null;
|
||||
@@ -2517,7 +2703,7 @@ public class ProcessorUtilities {
|
||||
public static String getJavaProjectLibFolderPath() {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
|
||||
IRunProcessService processService =
|
||||
(IRunProcessService) GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
|
||||
GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
|
||||
return processService.getJavaProjectLibFolder().getLocation().toPortableString();
|
||||
}
|
||||
return null;
|
||||
@@ -2589,7 +2775,54 @@ public class ProcessorUtilities {
|
||||
}
|
||||
|
||||
public static boolean isEsbJob(String processId, String version) {
|
||||
return esbJobs.contains(esbJobKey(processId, version));
|
||||
ProcessItem processItem = ItemCacheManager.getProcessItem(processId, version);
|
||||
if (processItem != null && processItem.getProperty() != null && processItem.getProperty().getItem() != null) {
|
||||
Set<JobInfo> infos = ProcessorUtilities.getChildrenJobInfo(processItem.getProperty().getItem(), false);
|
||||
for (JobInfo jobInfo : infos) {
|
||||
ProcessType processType = jobInfo.getProcessItem().getProcess();
|
||||
EList<NodeType> nodes = processType.getNode();
|
||||
for (NodeType nodeType : nodes) {
|
||||
if (isEsbComponentName(nodeType.getComponentName())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isEsbJob(IProcess process) {
|
||||
return isEsbJob(process, false);
|
||||
}
|
||||
|
||||
public static boolean isEsbJob(IProcess process, boolean checkCurrentProcess) {
|
||||
|
||||
if (process instanceof IProcess2) {
|
||||
|
||||
if (checkCurrentProcess) {
|
||||
for (INode n : process.getGraphicalNodes()) {
|
||||
if (isEsbComponentName(n.getComponent().getName())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Set<JobInfo> infos = ProcessorUtilities.getChildrenJobInfo(((IProcess2) process).getProperty().getItem(), false);
|
||||
|
||||
for (JobInfo jobInfo : infos) {
|
||||
ProcessType processType = jobInfo.getProcessItem().getProcess();
|
||||
EList<NodeType> nodes = processType.getNode();
|
||||
for (NodeType nodeType : nodes) {
|
||||
if (isEsbComponentName(nodeType.getComponentName())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void addEsbJob(JobInfo jobInfo) {
|
||||
@@ -2629,4 +2862,12 @@ public class ProcessorUtilities {
|
||||
return "tRunJob".equalsIgnoreCase(componentName) || "cTalendJob".equalsIgnoreCase(componentName);
|
||||
}
|
||||
|
||||
public static boolean isCIMode() {
|
||||
return isCIMode;
|
||||
}
|
||||
|
||||
public static void setCIMode(boolean isCIMode) {
|
||||
ProcessorUtilities.isCIMode = isCIMode;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -277,6 +277,9 @@ public class ATreeNode {
|
||||
* @throws OdaException
|
||||
*/
|
||||
public void setDataType(String type) throws OdaException {
|
||||
if (type == null) {
|
||||
type = "";
|
||||
}
|
||||
originalDataType = new String(type);
|
||||
this.dataType = getDataType(type);
|
||||
}
|
||||
|
||||
@@ -43,8 +43,10 @@ import org.eclipse.xsd.XSDImport;
|
||||
import org.eclipse.xsd.XSDModelGroup;
|
||||
import org.eclipse.xsd.XSDParticle;
|
||||
import org.eclipse.xsd.XSDSchema;
|
||||
import org.eclipse.xsd.XSDSimpleTypeDefinition;
|
||||
import org.eclipse.xsd.XSDTerm;
|
||||
import org.eclipse.xsd.XSDTypeDefinition;
|
||||
import org.eclipse.xsd.XSDVariety;
|
||||
import org.eclipse.xsd.impl.XSDNamedComponentImpl;
|
||||
import org.eclipse.xsd.util.XSDConstants;
|
||||
import org.eclipse.xsd.util.XSDResourceImpl;
|
||||
@@ -355,12 +357,15 @@ public class XSDPopulationUtil2 implements IXSDPopulationUtil {
|
||||
}
|
||||
}
|
||||
if (!resolvedAsComplex) {
|
||||
String dataType = xsdElementDeclarationParticle.getTypeDefinition().getQName();
|
||||
XSDTypeDefinition typeDefinition = xsdElementDeclarationParticle.getTypeDefinition();
|
||||
String dataType = typeDefinition.getQName();
|
||||
if (!XSDConstants
|
||||
.isSchemaForSchemaNamespace(xsdElementDeclarationParticle.getTypeDefinition().getTargetNamespace())
|
||||
&& xsdElementDeclarationParticle.getTypeDefinition().getBaseType() != null) {
|
||||
if (!"xs:anySimpleType".equals(xsdElementDeclarationParticle.getTypeDefinition().getBaseType().getQName())) {
|
||||
dataType = xsdElementDeclarationParticle.getTypeDefinition().getBaseType().getQName();
|
||||
.isSchemaForSchemaNamespace(typeDefinition.getTargetNamespace())
|
||||
&& typeDefinition.getBaseType() != null) {
|
||||
if (!"xs:anySimpleType".equals(typeDefinition.getBaseType().getQName())) {
|
||||
dataType = typeDefinition.getBaseType().getQName();
|
||||
} else if (typeDefinition instanceof XSDSimpleTypeDefinition) {
|
||||
dataType = getVarietyType(((XSDSimpleTypeDefinition) typeDefinition).getVariety());
|
||||
}
|
||||
}
|
||||
partNode.setDataType(dataType);
|
||||
@@ -378,6 +383,16 @@ public class XSDPopulationUtil2 implements IXSDPopulationUtil {
|
||||
}
|
||||
}
|
||||
|
||||
private String getVarietyType(XSDVariety variety) {
|
||||
String dataType = "xs:anyType";
|
||||
if (XSDVariety.LIST_LITERAL.equals(variety)) {
|
||||
dataType = "xs:list";
|
||||
} else if (XSDVariety.UNION_LITERAL.equals(variety)) {
|
||||
dataType = "xs:union";
|
||||
}
|
||||
return dataType;
|
||||
}
|
||||
|
||||
private void handleOptionalAttribute(ATreeNode node, XSDParticle xsdParticle) {
|
||||
if (node == null || xsdParticle == null || xsdParticle.getElement() == null) {
|
||||
return;
|
||||
@@ -485,6 +500,17 @@ public class XSDPopulationUtil2 implements IXSDPopulationUtil {
|
||||
}
|
||||
if (xsdTypeDefinition instanceof XSDComplexTypeDefinition) {
|
||||
addComplexTypeDetails(xsdSchema, node, xsdTypeDefinition, prefix, namespace, "/" + elementName + "/");
|
||||
} else if (xsdTypeDefinition instanceof XSDSimpleTypeDefinition) {
|
||||
String dataType = xsdTypeDefinition.getQName();
|
||||
if (!XSDConstants.isSchemaForSchemaNamespace(xsdTypeDefinition.getTargetNamespace())
|
||||
&& xsdTypeDefinition.getBaseType() != null) {
|
||||
if (!"xs:anySimpleType".equals(xsdTypeDefinition.getBaseType().getQName())) {
|
||||
dataType = xsdTypeDefinition.getBaseType().getQName();
|
||||
} else if (xsdTypeDefinition instanceof XSDSimpleTypeDefinition) {
|
||||
dataType = getVarietyType(((XSDSimpleTypeDefinition) xsdTypeDefinition).getVariety());
|
||||
}
|
||||
}
|
||||
node.setDataType(dataType);
|
||||
}
|
||||
List<String> namespaceList = new ArrayList(namespaceToPrefix.keySet());
|
||||
Collections.reverse(namespaceList);
|
||||
@@ -565,7 +591,11 @@ public class XSDPopulationUtil2 implements IXSDPopulationUtil {
|
||||
particleToTreeNode.clear();
|
||||
}
|
||||
|
||||
return rootNodes.get(0);
|
||||
if (rootNodes.isEmpty()) {
|
||||
return null;
|
||||
} else {
|
||||
return rootNodes.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
private void addSubstitutionDetails(XSDSchema xsdSchema, ATreeNode parentNode, XSDElementDeclaration elementDeclaration,
|
||||
@@ -760,11 +790,14 @@ public class XSDPopulationUtil2 implements IXSDPopulationUtil {
|
||||
ATreeNode childNode = new ATreeNode();
|
||||
childNode.setValue(attributeDeclarationName);
|
||||
childNode.setType(ATreeNode.ATTRIBUTE_TYPE);
|
||||
String dataType = xsdAttributeDeclaration.getTypeDefinition().getQName();
|
||||
XSDTypeDefinition baseType = xsdAttributeDeclaration.getTypeDefinition().getBaseType();
|
||||
if (!XSDConstants.isSchemaForSchemaNamespace(xsdAttributeDeclaration.getTypeDefinition().getTargetNamespace())) {
|
||||
XSDSimpleTypeDefinition typeDefinition = xsdAttributeDeclaration.getTypeDefinition();
|
||||
String dataType = typeDefinition.getQName();
|
||||
XSDTypeDefinition baseType = typeDefinition.getBaseType();
|
||||
if (!XSDConstants.isSchemaForSchemaNamespace(typeDefinition.getTargetNamespace())) {
|
||||
if (baseType != null && !"xs:anySimpleType".equals(baseType.getQName())) { //$NON-NLS-1$
|
||||
dataType = baseType.getQName();
|
||||
} else if (typeDefinition instanceof XSDSimpleTypeDefinition) {
|
||||
dataType = getVarietyType(((XSDSimpleTypeDefinition) typeDefinition).getVariety());
|
||||
}
|
||||
}
|
||||
if (dataType != null && dataType.length() > 0) {
|
||||
|
||||
@@ -35,6 +35,7 @@ import org.eclipse.aether.util.artifact.SubArtifact;
|
||||
import org.eclipse.aether.util.listener.ChainedRepositoryListener;
|
||||
import org.eclipse.aether.util.listener.ChainedTransferListener;
|
||||
import org.eclipse.aether.util.repository.AuthenticationBuilder;
|
||||
import org.talend.designer.maven.aether.util.TalendAetherProxySelector;
|
||||
|
||||
/**
|
||||
* created by wchen on Aug 10, 2017 Detailled comment
|
||||
@@ -72,6 +73,8 @@ public class RepositorySystemFactory {
|
||||
.setLocalRepositoryManager(system.newLocalRepositoryManager(repositorySystemSession, localRepo));
|
||||
repositorySystemSession.setTransferListener(new ChainedTransferListener());
|
||||
repositorySystemSession.setRepositoryListener(new ChainedRepositoryListener());
|
||||
repositorySystemSession.setProxySelector(new TalendAetherProxySelector());
|
||||
sessions.put(localRepo, repositorySystemSession);
|
||||
}
|
||||
|
||||
return repositorySystemSession;
|
||||
@@ -107,6 +110,7 @@ public class RepositorySystemFactory {
|
||||
Authentication auth = new AuthenticationBuilder().addUsername(userName).addPassword(password).build();
|
||||
RemoteRepository distRepo = new RemoteRepository.Builder(repositoryId, "default", repositoryUrl).setAuthentication(auth)
|
||||
.build();
|
||||
distRepo = new RemoteRepository.Builder(distRepo).setProxy(new TalendAetherProxySelector().getProxy(distRepo)).build();
|
||||
|
||||
deployRequest.setRepository(distRepo);
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user