Compare commits
1 Commits
onimych/TD
...
mbasiuk/bu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
34c43be7e9 |
@@ -13,8 +13,7 @@ Require-Bundle: org.apache.log4j;visibility:=reexport,
|
||||
org.talend.libraries.apache,
|
||||
com.ibm.icu,
|
||||
org.apache.commons.io,
|
||||
org.talend.utils,
|
||||
org.eclipse.core.net
|
||||
org.talend.utils
|
||||
Export-Package: org.talend.commons,
|
||||
org.talend.commons.exception,
|
||||
org.talend.commons.i18n,
|
||||
|
||||
@@ -17,7 +17,6 @@ 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;
|
||||
@@ -25,7 +24,6 @@ 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;
|
||||
@@ -57,8 +55,6 @@ 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;
|
||||
}
|
||||
@@ -183,13 +179,4 @@ 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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// 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.exception;
|
||||
|
||||
public class ClientException extends PersistenceException {
|
||||
|
||||
private Integer httpCode;
|
||||
|
||||
public ClientException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public ClientException(Integer httpCode, String message) {
|
||||
super(message);
|
||||
this.httpCode = httpCode;
|
||||
}
|
||||
|
||||
public ClientException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public ClientException(Integer httpCode, String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
this.httpCode = httpCode;
|
||||
}
|
||||
|
||||
public ClientException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public ClientException(Integer httpCode, Throwable cause) {
|
||||
super(cause);
|
||||
this.httpCode = httpCode;
|
||||
}
|
||||
|
||||
public Integer getHttpCode() {
|
||||
return httpCode;
|
||||
}
|
||||
|
||||
public void setHttpCode(Integer httpCode) {
|
||||
this.httpCode = httpCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getLocalizedMessage();
|
||||
}
|
||||
}
|
||||
@@ -36,8 +36,7 @@ public class PasswordEncryptUtil {
|
||||
|
||||
private static SecretKey getSecretKey() throws Exception {
|
||||
if (key == null) {
|
||||
byte rawKeyData[] = StudioEncryption
|
||||
.getKeySource(StudioEncryption.EncryptionKeyName.MIGRATION.toString(), false)
|
||||
byte rawKeyData[] = StudioEncryption.getKeySource(StudioEncryption.EncryptionKeyName.MIGRATION.toString(), false)
|
||||
.getKey();
|
||||
DESKeySpec dks = new DESKeySpec(rawKeyData);
|
||||
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES"); //$NON-NLS-1$
|
||||
@@ -107,8 +106,7 @@ public class PasswordEncryptUtil {
|
||||
* @return
|
||||
*/
|
||||
public static boolean isPasswordType(String type) {
|
||||
return "Password".equals(type) || "id_Password".equals(type) || "LicenseKey".equals(type) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
|| "id_LicenseKey".equals(type); //$NON-NLS-1$
|
||||
return "Password".equals(type) || "id_Password".equals(type); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -121,7 +119,7 @@ public class PasswordEncryptUtil {
|
||||
* @return
|
||||
*/
|
||||
public static boolean isPasswordField(String field) {
|
||||
return "PASSWORD".equals(field) || "LICENSEKEY".equals(field); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
return "PASSWORD".equals(field); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,8 +13,6 @@
|
||||
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;
|
||||
@@ -37,14 +35,8 @@ 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
|
||||
@@ -59,23 +51,9 @@ public class TalendProxySelector extends ProxySelector {
|
||||
|
||||
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";
|
||||
private static final String PROP_DISABLE_DEFAULT_SELECTOR = "talend.studio.proxy.disableDefaultSelector";
|
||||
|
||||
/**
|
||||
* Example: update.talend.com,socket:http,https:http;nexus.talend.com,socket,http;,socket:http
|
||||
@@ -89,20 +67,7 @@ public class TalendProxySelector extends ProxySelector {
|
||||
|
||||
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;
|
||||
private ProxySelector defaultSelector;
|
||||
|
||||
final private Map<Object, Collection<IProxySelectorProvider>> selectorProviders;
|
||||
|
||||
@@ -118,36 +83,15 @@ public class TalendProxySelector extends ProxySelector {
|
||||
|
||||
private boolean allowProxyRedirect = false;
|
||||
|
||||
private boolean disableDefaultSelectorProvider = false;
|
||||
private boolean disableDefaultSelector = 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();
|
||||
private TalendProxySelector(final ProxySelector defaultSelector) {
|
||||
this.defaultSelector = defaultSelector;
|
||||
|
||||
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()));
|
||||
disableDefaultSelector = Boolean.valueOf(System.getProperty(PROP_DISABLE_DEFAULT_SELECTOR, 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();
|
||||
@@ -232,18 +176,6 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -256,72 +188,34 @@ public class TalendProxySelector extends ProxySelector {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
if (instance.getEclipseDefaultSelector() == null
|
||||
if (instance.getDefaultProxySelector() == null
|
||||
|| (proxySelector != null && proxySelector.getClass().getName().endsWith(ECLIPSE_PROXY_SELECTOR))) {
|
||||
instance.setEclipseDefaultSelector(proxySelector);
|
||||
instance.setDefaultProxySelector(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) {
|
||||
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);
|
||||
final Set<Proxy> resultFromProviders = getProxysFromProviders(uri);
|
||||
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);
|
||||
}
|
||||
URI newUri = getNewUri(uri);
|
||||
List<Proxy> defaultProxys = defaultProxySelector.select(newUri);
|
||||
try {
|
||||
results.addAll(filterProxys(validatedUri, defaultProxys));
|
||||
results.addAll(filterProxys(uri, defaultProxys));
|
||||
} catch (Exception e) {
|
||||
results.addAll(defaultProxys);
|
||||
ExceptionHandler.process(e);
|
||||
@@ -335,54 +229,6 @@ public class TalendProxySelector extends ProxySelector {
|
||||
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()) {
|
||||
@@ -418,48 +264,38 @@ public class TalendProxySelector extends ProxySelector {
|
||||
return result;
|
||||
}
|
||||
|
||||
private URI getNewUri(URI uri, boolean validateUri) {
|
||||
private URI getNewUri(URI uri) {
|
||||
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);
|
||||
}
|
||||
String host = newUri.getHost();
|
||||
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());
|
||||
if (protocolMap != null) {
|
||||
String schema = newUri.getScheme();
|
||||
if (schema != null) {
|
||||
String lowercasedProtocol = schema.toLowerCase();
|
||||
String preferedProtocol = protocolMap.get(lowercasedProtocol);
|
||||
if (StringUtils.isNotBlank(preferedProtocol)) {
|
||||
try {
|
||||
newUri = new URI(preferedProtocol, newUri.getUserInfo(), newUri.getHost(), newUri.getPort(),
|
||||
newUri.getPath(), newUri.getQuery(), newUri.getFragment());
|
||||
} catch (URISyntaxException e) {
|
||||
if (printProxyLog) {
|
||||
ExceptionHandler.process(new Exception(
|
||||
Messages.getString("TalendProxySelector.exception.proxySelectionError", newUri), e),
|
||||
Priority.WARN);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} 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;
|
||||
}
|
||||
|
||||
@@ -559,45 +395,11 @@ public class TalendProxySelector extends ProxySelector {
|
||||
}
|
||||
|
||||
public ProxySelector getDefaultProxySelector() {
|
||||
switch (eProxySelector) {
|
||||
case jre:
|
||||
return getJreProxySelector();
|
||||
default:
|
||||
return eclipseDefaultSelector;
|
||||
}
|
||||
return defaultSelector;
|
||||
}
|
||||
|
||||
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;
|
||||
public void setDefaultProxySelector(final ProxySelector selector) {
|
||||
defaultSelector = selector;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -611,26 +413,21 @@ public class TalendProxySelector extends ProxySelector {
|
||||
});
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
ProxySelector defaultProxySelector = getDefaultProxySelector();
|
||||
if (defaultProxySelector != null) {
|
||||
defaultProxySelector.connectFailed(uri, sa, ioe);
|
||||
}
|
||||
}
|
||||
|
||||
public IProxySelectorProvider createDefaultProxySelectorProvider() {
|
||||
if (disableDefaultSelectorProvider) {
|
||||
if (disableDefaultSelector) {
|
||||
return null;
|
||||
}
|
||||
return new DefaultProxySelectorProvider(Thread.currentThread());
|
||||
}
|
||||
|
||||
public IProxySelectorProvider createDefaultProxySelectorProvider(String host) {
|
||||
if (disableDefaultSelectorProvider) {
|
||||
if (disableDefaultSelector) {
|
||||
return null;
|
||||
}
|
||||
return new DefaultProxySelectorProvider(host);
|
||||
@@ -648,11 +445,6 @@ public class TalendProxySelector extends ProxySelector {
|
||||
return possibleKeys;
|
||||
}
|
||||
|
||||
private enum EProxySelector {
|
||||
eclipse_default,
|
||||
jre
|
||||
}
|
||||
|
||||
private class DefaultProxySelectorProvider extends AbstractProxySelectorProvider {
|
||||
|
||||
private Thread currentThread = null;
|
||||
@@ -683,7 +475,7 @@ public class TalendProxySelector extends ProxySelector {
|
||||
|
||||
@Override
|
||||
public boolean canHandle(URI uri) {
|
||||
if (disableDefaultSelectorProvider) {
|
||||
if (disableDefaultSelector) {
|
||||
return false;
|
||||
}
|
||||
if (currentThread != null && Thread.currentThread() == currentThread) {
|
||||
|
||||
@@ -58,8 +58,6 @@ 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) {
|
||||
@@ -298,9 +296,6 @@ 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) {
|
||||
|
||||
@@ -1 +1 @@
|
||||
talend.version=7.4.1
|
||||
talend.version=7.3.1
|
||||
|
||||
@@ -25,7 +25,9 @@ import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Item;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.swt.widgets.Table;
|
||||
import org.eclipse.swt.widgets.TableItem;
|
||||
import org.eclipse.swt.widgets.Tree;
|
||||
@@ -104,6 +106,15 @@ public class TableToTreeLinker<D1, D2> extends BgDrawableComposite implements IB
|
||||
this.source = sourceTable;
|
||||
|
||||
dataToTableItemCache = new DataToTableItemCache(sourceTable);
|
||||
if (Platform.OS_LINUX.equals(Platform.getOS())) {
|
||||
this.source.addListener(SWT.EraseItem, new Listener() {
|
||||
|
||||
@Override
|
||||
public void handleEvent(Event event) {
|
||||
drawBackground(event.gc);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
protected IStyleLink getDefaultStyleLink() {
|
||||
@@ -231,7 +242,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()) || Platform.OS_LINUX.equals(Platform.getOS())) {
|
||||
if (Platform.OS_MACOSX.equals(Platform.getOS())) {
|
||||
pointStartStraight.x = sourceToCommonPoint.x + tableItem.getParent().getBounds().width;
|
||||
pointEndStraight.x = pointStartStraight.x;
|
||||
} else {
|
||||
@@ -312,9 +323,6 @@ public class TableToTreeLinker<D1, D2> extends BgDrawableComposite implements IB
|
||||
if (Platform.OS_LINUX.equals(Platform.getOS())) {
|
||||
pointEndCentralCurve.y = pointEndCentralCurve.y - tableItem.getBounds().height - treeItemHeight / 2;
|
||||
}
|
||||
if (Platform.OS_MACOSX.equals(Platform.getOS())) {
|
||||
pointEndCentralCurve.y = pointEndCentralCurve.y - tableItem.getBounds().height;
|
||||
}
|
||||
drawableLink.setPoint1(pointEndStraight);
|
||||
drawableLink.setPoint2(pointEndCentralCurve);
|
||||
|
||||
|
||||
@@ -22,8 +22,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.collections.PredicateUtils;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.ISafeRunnable;
|
||||
|
||||
@@ -70,7 +70,6 @@ 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;
|
||||
@@ -108,7 +107,6 @@ 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;
|
||||
@@ -2036,11 +2034,6 @@ 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
|
||||
@@ -2060,7 +2053,6 @@ 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();
|
||||
@@ -2238,11 +2230,6 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
tdqRepositoryService.initProxyRepository();
|
||||
}
|
||||
}
|
||||
// regenerate relationship index
|
||||
if (project.getEmfProject().getItemsRelations().isEmpty()) {
|
||||
RelationshipItemBuilder.getInstance().buildAndSaveIndex();
|
||||
}
|
||||
|
||||
fullLogonFinished = true;
|
||||
this.repositoryFactoryFromProvider.afterLogon(monitor);
|
||||
} finally {
|
||||
@@ -2422,14 +2409,9 @@ 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);
|
||||
|
||||
@@ -24,8 +24,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.collections.PredicateUtils;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
@@ -77,9 +75,7 @@ public class RecycleBinManager {
|
||||
}
|
||||
|
||||
public List<String> getDeletedFolders(Project project) {
|
||||
List<String> folders = new ArrayList<String>(project.getEmfProject().getDeletedFolders());
|
||||
CollectionUtils.filter(folders, PredicateUtils.notNullPredicate());
|
||||
return folders;
|
||||
return new ArrayList<String>(project.getEmfProject().getDeletedFolders());
|
||||
}
|
||||
|
||||
public void clearCache() {
|
||||
@@ -234,9 +230,7 @@ public class RecycleBinManager {
|
||||
if (isSynchronizeToProject) {
|
||||
project.getDeletedFolders().clear();
|
||||
for (String deletedFolder : recycleBin.getDeletedFolders()) {
|
||||
if (deletedFolder != null) {
|
||||
project.getDeletedFolders().add(deletedFolder);
|
||||
}
|
||||
project.getDeletedFolders().add(deletedFolder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,8 +13,6 @@
|
||||
package org.talend.core.repository.ui.dialog;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -32,14 +30,12 @@ import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Table;
|
||||
import org.eclipse.swt.widgets.TableColumn;
|
||||
import org.eclipse.swt.widgets.TableItem;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
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.IRepositoryObject;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.repository.utils.RepositoryNodeSortUtil;
|
||||
import org.talend.core.ui.ITestContainerProviderService;
|
||||
import org.talend.repository.model.RepositoryNode;
|
||||
import org.talend.repository.model.IRepositoryNode.EProperties;
|
||||
@@ -111,8 +107,7 @@ public class PastSelectorDialog extends Dialog {
|
||||
modificationTime.setWidth(200);
|
||||
modificationTime.setText("Modification Time");
|
||||
|
||||
RepositoryNodeSortUtil util = new RepositoryNodeSortUtil();
|
||||
for (IRepositoryViewObject object : util.getSortVersion(versions)) {
|
||||
for (IRepositoryViewObject object : versions) {
|
||||
TableItem item = new TableItem(table, SWT.NONE);
|
||||
item.setData(object);
|
||||
item.setText(0, object.getVersion());
|
||||
@@ -192,7 +187,7 @@ public class PastSelectorDialog extends Dialog {
|
||||
});
|
||||
return composite;
|
||||
}
|
||||
|
||||
|
||||
public Set<IRepositoryViewObject> getSelectedVersionItems() {
|
||||
return this.selectedVersionItems;
|
||||
}
|
||||
|
||||
@@ -292,13 +292,13 @@ public class ConvertJobsUtil {
|
||||
String[] items = JobBatchFramework.getFrameworkToDispaly();
|
||||
frameworkCombo.setItems(items);
|
||||
if (items.length > 0) {
|
||||
frameworkCombo.setText(JobBatchFramework.SPARKFRAMEWORK.getDisplayName());
|
||||
frameworkCombo.select(0);
|
||||
}
|
||||
} else if (JobType.BIGDATASTREAMING.getDisplayName().equals(jobTypeValue)) {
|
||||
String[] items = JobStreamingFramework.getFrameworkToDispaly();
|
||||
frameworkCombo.setItems(items);
|
||||
if (items.length > 0) {
|
||||
frameworkCombo.setText(JobStreamingFramework.SPARKSTREAMINGFRAMEWORK.getDisplayName());
|
||||
frameworkCombo.select(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@ 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;
|
||||
@@ -117,9 +116,7 @@ public class ProjectDataJsonProvider {
|
||||
RecycleBin recycleBin = RecycleBinManager.getInstance().getRecycleBin(project);
|
||||
project.getDeletedFolders().clear();
|
||||
for (String element : recycleBin.getDeletedFolders()) {
|
||||
if (element != null) {
|
||||
project.getDeletedFolders().add(element);
|
||||
}
|
||||
project.getDeletedFolders().add(element);
|
||||
}
|
||||
}
|
||||
if ((loadContent & CONTENT_MIGRATIONTASK) > 0) {
|
||||
@@ -143,10 +140,9 @@ public class ProjectDataJsonProvider {
|
||||
ProjectDataJsonProvider.loadProjectSettings(project, input);
|
||||
}
|
||||
IPath relationShipPath = settingFolderPath.append(FileConstants.RELATIONSHIP_FILE_NAME);
|
||||
try (InputStream is = inputStreamProvider.getStream(relationShipPath)) {
|
||||
if (is != null) {
|
||||
ProjectDataJsonProvider.loadRelationShips(project, is);
|
||||
}
|
||||
input = inputStreamProvider.getStream(relationShipPath);
|
||||
if (input != null) {
|
||||
ProjectDataJsonProvider.loadRelationShips(project, input);
|
||||
}
|
||||
IPath migrationTaskPath = settingFolderPath.append(FileConstants.MIGRATION_TASK_FILE_NAME);
|
||||
input = inputStreamProvider.getStream(migrationTaskPath);
|
||||
@@ -188,11 +184,10 @@ 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 (FileInputStream fis = new FileInputStream(file)) {
|
||||
loadRelationShips(project, fis);
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
ExceptionHandler.process(e);
|
||||
try {
|
||||
loadRelationShips(project, new FileInputStream(file));
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new PersistenceException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -212,8 +207,9 @@ public class ProjectDataJsonProvider {
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
ExceptionHandler.process(e);
|
||||
throw new PersistenceException(e);
|
||||
} finally {
|
||||
closeInputStream(input);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// 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.repository.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import org.talend.commons.utils.Version;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
|
||||
/**
|
||||
* @author hwang
|
||||
*
|
||||
*/
|
||||
public class RepositoryNodeSortUtil {
|
||||
|
||||
public List<IRepositoryViewObject> getSortVersion(List<IRepositoryViewObject> versions) {
|
||||
List<IRepositoryViewObject> temp = new ArrayList<IRepositoryViewObject>();
|
||||
temp.addAll(versions);
|
||||
|
||||
Collections.sort(temp, new Comparator<IRepositoryViewObject>() {
|
||||
|
||||
@Override
|
||||
public int compare(IRepositoryViewObject o1, IRepositoryViewObject o2) {
|
||||
String version1 = o1.getVersion();
|
||||
String version2 = o2.getVersion();
|
||||
if(version1 != null && version2 != null) {
|
||||
return new Version(version1).compareTo(new Version(version2));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
return temp;
|
||||
}
|
||||
}
|
||||
@@ -121,8 +121,7 @@ Require-Bundle: org.eclipse.jdt.core,
|
||||
org.talend.components.api,
|
||||
org.apache.servicemix.bundles.avro,
|
||||
jackson-core-asl,
|
||||
org.talend.libraries.jackson,
|
||||
org.eclipse.m2e.core
|
||||
org.talend.libraries.jackson
|
||||
Bundle-Activator: org.talend.core.runtime.CoreRuntimePlugin
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-ClassPath: .,
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// 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.database;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.talend.core.runtime.hd.hive.HiveMetadataHelper;
|
||||
|
||||
/**
|
||||
* DOC hzhao class global comment. Detailled comment
|
||||
*/
|
||||
public enum EImpalaDriver {
|
||||
|
||||
HIVE2("HIVE2", "HIVE2", "org.apache.hive.jdbc.HiveDriver"),
|
||||
IMPALA40("IMPALA40", "IMPALA40", "com.cloudera.impala.jdbc4.Driver"),
|
||||
IMPALA41("IMPALA41", "IMPALA41", "com.cloudera.impala.jdbc41.Driver");
|
||||
|
||||
EImpalaDriver(String displayName, String name, String driver) {
|
||||
this.displayName = displayName;
|
||||
this.name = name;
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
private String displayName;
|
||||
|
||||
private String name;
|
||||
|
||||
private String driver;
|
||||
|
||||
public String getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getDriver() {
|
||||
return driver;
|
||||
}
|
||||
|
||||
public static boolean isSupport(String distribution, String version, boolean byDisplay, String supportMethodName) {
|
||||
return HiveMetadataHelper.doSupportMethod(distribution, version, byDisplay, supportMethodName);
|
||||
}
|
||||
|
||||
public static String[] getImpalaDriverDisplay(String distribution, String version, boolean byDisplay) {
|
||||
List<String> list = new ArrayList<>(0);
|
||||
for (EImpalaDriver driver : EImpalaDriver.values()) {
|
||||
if (isSupport(distribution, version, byDisplay, "doSupportImpalaConnector")) {
|
||||
list.add(driver.getDisplayName());
|
||||
}
|
||||
}
|
||||
return list.toArray(new String[0]);
|
||||
}
|
||||
|
||||
public static EImpalaDriver getByDisplay(String display) {
|
||||
for (EImpalaDriver driver : EImpalaDriver.values()) {
|
||||
if (driver.getDisplayName().equals(display)) {
|
||||
return driver;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static EImpalaDriver getByName(String name) {
|
||||
for (EImpalaDriver driver : EImpalaDriver.values()) {
|
||||
if (driver.getName().equals(name)) {
|
||||
return driver;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -263,8 +263,6 @@ public class ConnParameterKeys {
|
||||
|
||||
public static final String IMPALA_AUTHENTICATION_PRINCIPLA = "IMPALA_AUTHENTICATION_PRINCIPLA";//$NON-NLS-1$
|
||||
|
||||
public static final String IMPALA_DRIVER = "IMPALA_DRIVER";
|
||||
|
||||
/**
|
||||
* Google Dataproc keys.
|
||||
*/
|
||||
@@ -304,8 +302,6 @@ public class ConnParameterKeys {
|
||||
/**DataBricks*/
|
||||
public static final String CONN_PARA_KEY_DATABRICKS_ENDPOINT="CONN_PARA_KEY_DATABRICKS_ENDPOINT";
|
||||
|
||||
public static final String CONN_PARA_KEY_DATABRICKS_CLOUD_PROVIDER = "CONN_PARA_KEY_DATABRICKS_CLOUD_PROVIDER";
|
||||
|
||||
public static final String CONN_PARA_KEY_DATABRICKS_CLUSTER_ID="CONN_PARA_KEY_DATABRICKS_CLUSTER_ID";
|
||||
|
||||
public static final String CONN_PARA_KEY_DATABRICKS_TOKEN="CONN_PARA_KEY_DATABRICKS_TOKEN";
|
||||
|
||||
@@ -114,7 +114,6 @@ public enum EHadoopProperties {
|
||||
QUBOLE_S3_REGION,
|
||||
|
||||
DATABRICKS_ENDPOINT,
|
||||
DATABRICKS_CLOUD_PROVIDER,
|
||||
DATABRICKS_CLUSTER_ID,
|
||||
DATABRICKS_TOKEN,
|
||||
DATABRICKS_DBFS_DEP_FOLDER;
|
||||
|
||||
@@ -23,8 +23,6 @@ public interface IMultipleComponentConnection {
|
||||
|
||||
public String getConnectionType();
|
||||
|
||||
public String getConnectorName();
|
||||
|
||||
public void setConnectionType(String connectionType);
|
||||
|
||||
public String getNameTarget();
|
||||
|
||||
@@ -14,8 +14,6 @@ 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/>
|
||||
*
|
||||
@@ -35,7 +33,4 @@ public interface IMultipleComponentItem {
|
||||
public String getComponent();
|
||||
|
||||
public void setComponent(String component);
|
||||
|
||||
public void updateNode(INode newNode, INode oldNode);
|
||||
|
||||
}
|
||||
|
||||
@@ -50,6 +50,4 @@ public interface IMultipleComponentManager {
|
||||
|
||||
public boolean isLookupMode();
|
||||
|
||||
public String getParamSeperator();
|
||||
|
||||
}
|
||||
|
||||
@@ -56,7 +56,6 @@ public class ConnectionBean implements Cloneable {
|
||||
|
||||
private static final String TOKEN = "token"; //$NON-NLS-1$
|
||||
|
||||
private static final String URL = "url"; //$NON-NLS-1$
|
||||
/**
|
||||
* DOC smallet ConnectionBean constructor comment.
|
||||
*/
|
||||
@@ -397,15 +396,4 @@ public class ConnectionBean implements Cloneable {
|
||||
}
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
try {
|
||||
if (conDetails.has(URL)) {
|
||||
return conDetails.getString(URL);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -68,8 +68,6 @@ 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();
|
||||
|
||||
|
||||
@@ -243,11 +243,6 @@ 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;
|
||||
}
|
||||
@@ -268,7 +263,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 && !order) {
|
||||
if (isRepository) {
|
||||
boolean exist = false;
|
||||
for (int j = 0; j < thisColumnListWithUnselected.size(); j++) {
|
||||
IMetadataColumn myColumn = thisColumnListWithUnselected.get(j);
|
||||
|
||||
@@ -76,8 +76,6 @@ 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,
|
||||
@@ -478,7 +476,7 @@ public final class MetadataTalendType {
|
||||
if (!mappingFolder.exists() || mappingFolder.listFiles().length < 1) {
|
||||
ICoreService service = null;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreService.class)) {
|
||||
service = GlobalServiceRegister.getDefault().getService(ICoreService.class);
|
||||
service = (ICoreService) GlobalServiceRegister.getDefault().getService(ICoreService.class);
|
||||
service.syncMappingsFileFromSystemToProject();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@ public final class MetadataToolHelper {
|
||||
|
||||
boolean isKeyword = KeywordsValidator.isKeyword(originalColumnName);
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String returnedColumnName = "";
|
||||
if (!isKeyword) {
|
||||
boolean isAllowSpecific = isAllowSpecificCharacters();
|
||||
|
||||
@@ -311,17 +311,17 @@ public final class MetadataToolHelper {
|
||||
// other characters should have only a-z or A-Z or _ or 0-9
|
||||
if (((car >= 'a') && (car <= 'z')) || ((car >= 'A') && (car <= 'Z')) || car == '_'
|
||||
|| ((car >= '0') && (car <= '9') && (i != 0))) {
|
||||
sb.append(car);
|
||||
returnedColumnName += car;
|
||||
} else {
|
||||
sb.append(underLine);
|
||||
returnedColumnName += underLine;
|
||||
}
|
||||
} else {
|
||||
sb.append(car);
|
||||
returnedColumnName += car;
|
||||
}
|
||||
}
|
||||
}
|
||||
String returnedColumnName = trimBeginEnd_(sb.toString());
|
||||
if (isKeyword || "".equals(returnedColumnName)) {
|
||||
if (isKeyword || org.apache.commons.lang.StringUtils
|
||||
.countMatches(returnedColumnName, underLine) > (originalColumnName.length() / 2)) {
|
||||
returnedColumnName = "Column" + index; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
@@ -329,39 +329,6 @@ public final class MetadataToolHelper {
|
||||
|
||||
}
|
||||
|
||||
// __abc -> _abc
|
||||
// __abc___ -> _abc
|
||||
// abc -> abc
|
||||
// _abc -> _abc
|
||||
// _____ -> ""
|
||||
public static String trimBeginEnd_(String columnName) {
|
||||
if (columnName == null) {
|
||||
return null;
|
||||
}
|
||||
int len = columnName.length();
|
||||
int st = 0;
|
||||
char[] val = columnName.toCharArray(); /* avoid getfield opcode */
|
||||
|
||||
while ((st < len) && (val[st] == '_')) {
|
||||
st++;
|
||||
}
|
||||
while ((st < len) && (val[len - 1] == '_')) {
|
||||
len--;
|
||||
}
|
||||
if ((st > 0) || (len < columnName.length())) {
|
||||
if (st == columnName.length()) {
|
||||
return "";
|
||||
}
|
||||
if (st > 0) {
|
||||
return columnName.substring(st - 1, len);
|
||||
} else {
|
||||
return columnName.substring(st, len);
|
||||
}
|
||||
} else {
|
||||
return columnName;
|
||||
}
|
||||
}
|
||||
|
||||
public static String validateColumnName(final String columnName, final int index, List<String> labels) {
|
||||
String name = validateColumnName(columnName, index);
|
||||
UniqueStringGenerator<String> uniqueStringGenerator = new UniqueStringGenerator<String>(name, labels) {
|
||||
|
||||
@@ -26,7 +26,6 @@ import org.talend.components.api.properties.ComponentProperties;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.database.EDatabase4DriverClassName;
|
||||
import org.talend.core.database.EDatabaseTypeName;
|
||||
import org.talend.core.database.conn.ConnParameterKeys;
|
||||
import org.talend.core.database.conn.DatabaseConnStrUtil;
|
||||
import org.talend.core.database.conn.version.EDatabaseVersion4Drivers;
|
||||
import org.talend.core.model.components.EComponentType;
|
||||
@@ -668,18 +667,6 @@ public class ComponentToRepositoryProperty {
|
||||
connection.setServerName(value);
|
||||
}
|
||||
}
|
||||
if ("IMPALA_DRIVER".equals(param.getRepositoryValue())) {
|
||||
String value = getParameterValue(connection, node, param);
|
||||
if (value != null) {
|
||||
connection.getParameters().put(ConnParameterKeys.IMPALA_DRIVER, value);
|
||||
}
|
||||
}
|
||||
if ("IMPALA_ADDITIONAL_JDBC".equals(param.getRepositoryValue())) {
|
||||
String value = getParameterValue(connection, node, param);
|
||||
if (value != null) {
|
||||
connection.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_HIVE_ADDITIONAL_JDBC_SETTINGS, value);
|
||||
}
|
||||
}
|
||||
|
||||
if (connection.getDatabaseType().equals(EDatabaseTypeName.ORACLEFORSID.getDisplayName())) {
|
||||
setDatabaseValueForOracleSid(connection, node, param);
|
||||
|
||||
@@ -917,8 +917,6 @@ public class RepositoryToComponentProperty {
|
||||
return EDatabaseTypeName.ORACLE_CUSTOM.getXmlName();
|
||||
} else if (databaseType.equals(EDatabaseTypeName.MSSQL.getDisplayName())) {
|
||||
return EDatabaseTypeName.MSSQL.getXMLType(); // for component
|
||||
} else if (databaseType.equals(EDatabaseTypeName.REDSHIFT_SSO.getDisplayName())) {
|
||||
return EDatabaseTypeName.REDSHIFT_SSO.getXmlName(); // for component
|
||||
}
|
||||
|
||||
else {
|
||||
@@ -1710,18 +1708,9 @@ public class RepositoryToComponentProperty {
|
||||
EDatabaseTypeName typeFromDbType = EDatabaseTypeName.getTypeFromDbType(repositoryType);
|
||||
return typeFromDbType.getXMLType();
|
||||
}
|
||||
if ("IMPALA_ADDITIONAL_JDBC".equals(value)) { //$NON-NLS-1$
|
||||
String additionJdbc = connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HIVE_ADDITIONAL_JDBC_SETTINGS);
|
||||
if (isContextMode(connection, additionJdbc)) {
|
||||
return additionJdbc;
|
||||
} else {
|
||||
return TalendQuoteUtils.addQuotes(additionJdbc);
|
||||
}
|
||||
}
|
||||
if ("IMPALA_DRIVER".equals(value)) {
|
||||
return connection.getParameters().get(ConnParameterKeys.IMPALA_DRIVER);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
private static String getAppropriateValue(Connection connection, String rawValue) {
|
||||
|
||||
@@ -140,13 +140,4 @@ public enum EParameterFieldType {
|
||||
}
|
||||
return TEXT; // Default Value
|
||||
}
|
||||
|
||||
public static boolean isPassword(String field) {
|
||||
return EParameterFieldType.PASSWORD.getName().equals(field)
|
||||
|| EParameterFieldType.LICENSEKEY.getName().equals(field);
|
||||
}
|
||||
|
||||
public static boolean isPassword(EParameterFieldType type) {
|
||||
return EParameterFieldType.PASSWORD.equals(type) || EParameterFieldType.LICENSEKEY.equals(type);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -931,26 +931,18 @@ 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 : supportedTypes) {
|
||||
for (ERepositoryObjectType curTyp : getTypes()) {
|
||||
if (curTyp != null) {
|
||||
list.addAll(factory.getAll(project, curTyp, true, true));
|
||||
}
|
||||
@@ -964,44 +956,21 @@ public class RelationshipItemBuilder {
|
||||
for (IRepositoryViewObject object : list) {
|
||||
Item item = object.getProperty().getItem();
|
||||
monitor.subTask(Messages.getString("RelationshipItemBuilder.forItem") + item.getProperty().getLabel()); //$NON-NLS-1$
|
||||
findRelationItems(item, fromMigration);
|
||||
addOrUpdateItem(item, true);
|
||||
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);
|
||||
@@ -1123,24 +1092,14 @@ 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 false;
|
||||
return;
|
||||
}
|
||||
|
||||
boolean relationsModified = true;
|
||||
@@ -1184,7 +1143,12 @@ public class RelationshipItemBuilder {
|
||||
currentProjectItemsRelations.get(relation).addAll(oldProjectRelations);
|
||||
}
|
||||
}
|
||||
return relationsModified;
|
||||
if (relationsModified && !modified) {
|
||||
modified = true;
|
||||
}
|
||||
if (!fromMigration && modified) {
|
||||
autoSaveRelations();
|
||||
}
|
||||
}
|
||||
|
||||
public Set<Relation> getItemRelations(Item item) {
|
||||
|
||||
@@ -529,11 +529,6 @@ public class ERepositoryObjectType extends DynaEnum<ERepositoryObjectType> {
|
||||
*/
|
||||
public final static ERepositoryObjectType PROCESS_ROUTE = ERepositoryObjectType.valueOf("ROUTE"); //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* <font color="red">This value may be <b>null</b> in some licenses, <b>should add NPE check</b></font>
|
||||
*/
|
||||
public final static ERepositoryObjectType PROCESS_ROUTE_DESIGN = ERepositoryObjectType.valueOf("ROUTE_DESIGNS");
|
||||
|
||||
/**
|
||||
* <font color="red">This value may be <b>null</b> in some licenses, <b>should add NPE check</b></font>
|
||||
*/
|
||||
|
||||
@@ -98,7 +98,6 @@ import org.talend.core.model.utils.UpdateRepositoryHelper;
|
||||
import org.talend.core.prefs.ITalendCorePrefConstants;
|
||||
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||
import org.talend.core.runtime.i18n.Messages;
|
||||
import org.talend.core.runtime.services.IGenericDBService;
|
||||
import org.talend.core.service.IMRProcessService;
|
||||
import org.talend.core.service.IMetadataManagmentService;
|
||||
import org.talend.core.service.IStormProcessService;
|
||||
@@ -691,15 +690,10 @@ public abstract class RepositoryUpdateManager {
|
||||
Set<String> set = valueMap.keySet();
|
||||
List<String> list = new ArrayList<String>(set);
|
||||
IProxyRepositoryFactory factory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
|
||||
boolean foundCompProperties = false;
|
||||
ConnectionItem dbConnectionItem = null;
|
||||
Map<String, String> oldToNewHM = new HashMap<String, String>();
|
||||
|
||||
for (String newValue : list) {
|
||||
String oldValue = valueMap.get(newValue);
|
||||
oldValue = "context." + oldValue;
|
||||
newValue = "context." + newValue;
|
||||
oldToNewHM.put(oldValue, newValue);
|
||||
List<IRepositoryViewObject> dbConnList = factory.getAll(ERepositoryObjectType.METADATA_CONNECTIONS, true);
|
||||
for (IRepositoryViewObject obj : dbConnList) {
|
||||
Item item = obj.getProperty().getItem();
|
||||
@@ -713,11 +707,6 @@ public abstract class RepositoryUpdateManager {
|
||||
if (citem == contextItem) {
|
||||
if (conn instanceof DatabaseConnection) {
|
||||
DatabaseConnection dbConn = (DatabaseConnection) conn;
|
||||
String compProperties = dbConn.getCompProperties();
|
||||
if (!foundCompProperties && StringUtils.isNotBlank(compProperties)) {
|
||||
foundCompProperties = true;
|
||||
dbConnectionItem = (ConnectionItem) item;
|
||||
}
|
||||
if (dbConn.getAdditionalParams() != null && dbConn.getAdditionalParams().equals(oldValue)) {
|
||||
dbConn.setAdditionalParams(newValue);
|
||||
} else if (dbConn.getUsername() != null && dbConn.getUsername().equals(oldValue)) {
|
||||
@@ -1109,11 +1098,6 @@ public abstract class RepositoryUpdateManager {
|
||||
}
|
||||
}
|
||||
|
||||
if (foundCompProperties && GlobalServiceRegister.getDefault().isServiceRegistered(IGenericDBService.class)) {
|
||||
IGenericDBService service = GlobalServiceRegister.getDefault().getService(IGenericDBService.class);
|
||||
service.updateCompPropertiesForContextMode(dbConnectionItem.getConnection(), oldToNewHM);
|
||||
factory.save(dbConnectionItem);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateParameters(DatabaseConnection dbConn, String oldValue, String newValue) {
|
||||
@@ -1801,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, true);
|
||||
update = !oldMetadataTable.sameMetadataAs(newMetadataTable, IMetadataColumn.OPTIONS_NONE);
|
||||
isAddColumn = isAddColumn(newMetadataTable, oldMetadataTable);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -857,7 +857,7 @@ public final class ParameterValueUtil {
|
||||
Object docValue = param.getValue();
|
||||
if (docValue != null) {
|
||||
if ((param.getRepositoryValue() != null && param.getRepositoryValue().toUpperCase().contains("PASSWORD") //$NON-NLS-1$
|
||||
|| EParameterFieldType.isPassword(param.getFieldType()))//
|
||||
|| EParameterFieldType.PASSWORD.equals(param.getFieldType()))//
|
||||
&& !ContextParameterUtils.containContextVariables((String) docValue)) {
|
||||
|
||||
if (isHidePassword()) { // if hide will display the *
|
||||
@@ -893,7 +893,7 @@ public final class ParameterValueUtil {
|
||||
if (param != null) {
|
||||
String docValue = param.getValue();
|
||||
if (docValue != null) {
|
||||
if (EParameterFieldType.isPassword(param.getField()) && isHidePassword()
|
||||
if (EParameterFieldType.PASSWORD.getName().equals(param.getField()) && isHidePassword()
|
||||
&& !ContextParameterUtils.containContextVariables(docValue)) {
|
||||
// the value has been raw, so just get dispaly value.
|
||||
docValue = PasswordEncryptUtil.getPasswordDisplay(param.getRawValue());
|
||||
|
||||
@@ -70,7 +70,5 @@ public interface IRepositoryArtifactHandler {
|
||||
public IRepositoryArtifactHandler clone();
|
||||
|
||||
public String getRepositoryURL(boolean isRelease);
|
||||
|
||||
public String resolveRemoteSha1(MavenArtifact artifact, boolean fromRelease) throws Exception;
|
||||
|
||||
}
|
||||
|
||||
@@ -187,13 +187,11 @@ public class TalendLibsServerManager {
|
||||
* Check user library connection with the setting from remote administrator
|
||||
*
|
||||
* @return
|
||||
* @throws PersistenceException
|
||||
*/
|
||||
public boolean canConnectUserLibrary() throws PersistenceException {
|
||||
public boolean canConnectUserLibrary() {
|
||||
boolean canConnect = false;
|
||||
IProxyRepositoryFactory factory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
|
||||
RepositoryContext repositoryContext = factory.getRepositoryContext();
|
||||
ArtifactRepositoryBean bean = null;
|
||||
try {
|
||||
if (repositoryContext != null && repositoryContext.getFields() != null && !factory.isLocalConnectionProvider()
|
||||
&& !repositoryContext.isOffline()) {
|
||||
@@ -210,7 +208,7 @@ public class TalendLibsServerManager {
|
||||
&& GlobalServiceRegister.getDefault().isServiceRegistered(IRemoteService.class)) {
|
||||
IRemoteService remoteService = (IRemoteService) GlobalServiceRegister.getDefault()
|
||||
.getService(IRemoteService.class);
|
||||
bean = remoteService.getLibNexusServer(userName, password, adminUrl);
|
||||
ArtifactRepositoryBean bean = remoteService.getLibNexusServer(userName, password, adminUrl);
|
||||
if (bean != null) {
|
||||
IRepositoryArtifactHandler handler = RepositoryArtifactHandlerManager.getRepositoryHandler(bean);
|
||||
if (handler.checkConnection()) {
|
||||
@@ -225,9 +223,6 @@ public class TalendLibsServerManager {
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
if (bean == null) {
|
||||
throw new PersistenceException(Messages.getString("TalendLibsServerManager.cannotGetUserLibraryServer"));
|
||||
}
|
||||
return canConnect;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ 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;
|
||||
@@ -48,8 +47,6 @@ 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.
|
||||
@@ -90,13 +87,6 @@ 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)");
|
||||
|
||||
Binary file not shown.
@@ -32,12 +32,8 @@ 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>> contextPerJob;
|
||||
@@ -56,9 +52,7 @@ 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>>();
|
||||
routinesNeededWithSubjobPerJob = new HashMap<String, Set<String>>();
|
||||
@@ -241,22 +235,6 @@ public class LastGenerationInfo {
|
||||
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)) {
|
||||
@@ -273,20 +251,7 @@ 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();
|
||||
}
|
||||
|
||||
@@ -327,19 +292,26 @@ public class LastGenerationInfo {
|
||||
routinesNeededWithSubjobPerJob.put(key, new HashSet<String>(modulesNeeded));
|
||||
}
|
||||
|
||||
public void clearCaches() {
|
||||
clearHighPriorityModuleNeeded();
|
||||
modulesNeededPerJob.clear();
|
||||
modulesNeededWithSubjobPerJob.clear();
|
||||
testcaseModuleNeeded.clear();
|
||||
public void clearModulesNeededWithSubjobPerJob() {
|
||||
if (!modulesNeededWithSubjobPerJob.isEmpty()) {
|
||||
modulesNeededWithSubjobPerJob.clear();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear modules per job cache, not thread safe
|
||||
*/
|
||||
public void clearModulesNeededPerJob() {
|
||||
if (!modulesNeededPerJob.isEmpty()) {
|
||||
modulesNeededPerJob.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public void clean() {
|
||||
modulesNeededPerJob.clear();
|
||||
routinesNeededPerJob.clear();
|
||||
modulesNeededWithSubjobPerJob.clear();
|
||||
clearHighPriorityModuleNeeded();
|
||||
testcaseModuleNeeded.clear();
|
||||
highPriorityModuleNeeded.clear();
|
||||
routinesNeededWithSubjobPerJob.clear();
|
||||
contextPerJob.clear();
|
||||
|
||||
|
||||
@@ -64,10 +64,7 @@ public interface TalendProcessOptionConstants {
|
||||
|
||||
public static final int MODULES_WITH_INDEPENDENT = 1 << 2;
|
||||
|
||||
/**
|
||||
* @Deprecated will get all modules of node inside joblet recursively, use {@link #MODULES_DEFAULT} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
// include joblet module but without joblet's dependencies
|
||||
public static final int MODULES_WITH_JOBLET = 1 << 3;
|
||||
|
||||
public static final int MODULES_FOR_MR = 1 << 4;
|
||||
|
||||
@@ -76,7 +76,5 @@ 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$
|
||||
|
||||
}
|
||||
|
||||
@@ -64,6 +64,4 @@ public interface IGenericDBService extends IService{
|
||||
|
||||
public ERepositoryObjectType getExtraDBType(ERepositoryObjectType type);
|
||||
|
||||
public void updateCompPropertiesForContextMode(Connection connection, Map<String, String> contextVarMap);
|
||||
|
||||
}
|
||||
|
||||
@@ -15,9 +15,7 @@ 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;
|
||||
|
||||
@@ -44,13 +42,4 @@ 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// 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,8 +28,6 @@ public interface INOSQLService extends IService {
|
||||
|
||||
public boolean isUseReplicaSet(Connection connection);
|
||||
|
||||
public boolean isUseSSL(Connection connection);
|
||||
|
||||
public String getMongoDBReplicaSets(Connection connection);
|
||||
|
||||
public boolean updateNoSqlConnection(Connection connection) throws Exception;
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* 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();
|
||||
}
|
||||
@@ -281,17 +281,6 @@ public final class TalendQuoteUtils {
|
||||
return text;
|
||||
}
|
||||
|
||||
public static boolean isEnclosed(String text) {
|
||||
if (text == null) {
|
||||
return false;
|
||||
}
|
||||
text = text.trim();
|
||||
if (text.length() < 2) {
|
||||
return false;
|
||||
}
|
||||
return text.startsWith(QUOTATION_MARK) && text.endsWith(QUOTATION_MARK);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* ggu Comment method "addQuotesForSQLString".
|
||||
|
||||
@@ -18,6 +18,7 @@ import java.util.Set;
|
||||
import org.apache.log4j.Level;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
@@ -243,6 +244,4 @@ public interface IRunProcessService extends IService {
|
||||
|
||||
public IFolder getJavaProjectExternalResourcesFolder(IProcess process);
|
||||
|
||||
public boolean isCIMode();
|
||||
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ public class ExternalNodeComponentHandler extends AbstractComponentHandler {
|
||||
|
||||
else if (elemparameter.getRepositoryValue() != null
|
||||
&& elemparameter.getRepositoryValue().toUpperCase().contains("PASSWORD") //$NON-NLS-1$
|
||||
|| EParameterFieldType.isPassword(elemparameter.getFieldType())) {
|
||||
|| elemparameter.getFieldType() == EParameterFieldType.PASSWORD) {
|
||||
value = ParameterValueUtil.getValue4Doc(elemparameter).toString();
|
||||
}
|
||||
Element columnElement = parametersElement.addElement("column"); //$NON-NLS-1$
|
||||
|
||||
@@ -193,7 +193,7 @@ public class InternalNodeComponentHandler extends AbstractComponentHandler {
|
||||
// }
|
||||
else if (elemparameter.getRepositoryValue() != null
|
||||
&& elemparameter.getRepositoryValue().toUpperCase().contains("PASSWORD") //$NON-NLS-1$
|
||||
|| EParameterFieldType.isPassword(elemparameter.getFieldType())) {
|
||||
|| elemparameter.getFieldType() == EParameterFieldType.PASSWORD) {
|
||||
name = elemparameter.getDisplayName();
|
||||
value = ParameterValueUtil.getValue4Doc(elemparameter).toString();
|
||||
} else {
|
||||
|
||||
@@ -16,13 +16,13 @@ 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 ResetComponentNameConversion extends RenameComponentConversion{
|
||||
public class RenameETLJDBCComponentConversion extends RenameComponentConversion{
|
||||
|
||||
private String newName;
|
||||
|
||||
private String oldName;
|
||||
|
||||
public ResetComponentNameConversion(String newName, String oldName) {
|
||||
public RenameETLJDBCComponentConversion(String newName, String oldName) {
|
||||
super(newName);
|
||||
this.newName = newName;
|
||||
this.oldName = oldName;
|
||||
@@ -477,10 +477,6 @@ public class TalendTextUtils {
|
||||
return TalendQuoteUtils.removeQuotes(text, quotation);
|
||||
}
|
||||
|
||||
public static boolean isEnclosed(String text) {
|
||||
return TalendQuoteUtils.isEnclosed(text);
|
||||
}
|
||||
|
||||
public static String getStringConnect() {
|
||||
return TalendQuoteUtils.getStringConnect();
|
||||
}
|
||||
|
||||
@@ -107,12 +107,10 @@ 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;
|
||||
@@ -168,7 +166,7 @@ public class ProcessorUtilities {
|
||||
private static boolean exportJobAsMicroService = false;
|
||||
|
||||
private static IDesignerCoreService designerCoreService =
|
||||
GlobalServiceRegister.getDefault().getService(IDesignerCoreService.class);
|
||||
(IDesignerCoreService) GlobalServiceRegister.getDefault().getService(IDesignerCoreService.class);
|
||||
|
||||
private static Map<String, Integer> lastGeneratedWithStatsOrTrace = new HashMap<String, Integer>();
|
||||
|
||||
@@ -567,10 +565,8 @@ public class ProcessorUtilities {
|
||||
neededLibraries);
|
||||
|
||||
// get all job testcases needed modules
|
||||
Set<ModuleNeeded> testcaseModules = getAllJobTestcaseModules(selectedProcessItem);
|
||||
LastGenerationInfo.getInstance().setTestcaseModuleNeeded(jobInfo.getJobId(), jobInfo.getJobVersion(),
|
||||
testcaseModules);
|
||||
neededLibraries.addAll(testcaseModules);
|
||||
neededLibraries.addAll(getAllJobTestcaseModules(selectedProcessItem));
|
||||
|
||||
// must install the needed libraries before generate codes with poms.
|
||||
CorePlugin.getDefault().getRunProcessService().updateLibraries(neededLibraries, currentProcess,
|
||||
retrievedJarsForCurrentBuild);
|
||||
@@ -711,7 +707,7 @@ public class ProcessorUtilities {
|
||||
List<String> jobletsComponentsList = new ArrayList<String>();
|
||||
IComponentsFactory componentsFactory = null;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IComponentsService.class)) {
|
||||
IComponentsService compService = GlobalServiceRegister.getDefault()
|
||||
IComponentsService compService = (IComponentsService) GlobalServiceRegister.getDefault()
|
||||
.getService(IComponentsService.class);
|
||||
if (compService != null) {
|
||||
componentsFactory = compService.getComponentsFactory();
|
||||
@@ -784,7 +780,7 @@ public class ProcessorUtilities {
|
||||
// for joblet
|
||||
IComponent cc = componentsFactory.get(node.getComponentName(), jobletPaletteType);
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IJobletProviderService.class)) {
|
||||
IJobletProviderService jobletService = GlobalServiceRegister.getDefault()
|
||||
IJobletProviderService jobletService = (IJobletProviderService) GlobalServiceRegister.getDefault()
|
||||
.getService(IJobletProviderService.class);
|
||||
Property property = jobletService.getJobletComponentItem(cc);
|
||||
if (property != null && StringUtils.isNotBlank(property.getId())) {
|
||||
@@ -874,18 +870,11 @@ public class ProcessorUtilities {
|
||||
|
||||
IFolder xmlMappingFolder = jobInfo.getProcessor().getTalendJavaProject().getResourceSubFolder(null,
|
||||
JavaUtils.JAVA_XML_MAPPING);
|
||||
ProjectPreferenceManager manager = CoreRuntimePlugin.getInstance().getProjectPreferenceManager();
|
||||
boolean updated = manager.getBoolean(MetadataTalendType.UPDATED_MAPPING_FILES);
|
||||
if ((xmlMappingFolder.members().length == 0 || updated)
|
||||
if (xmlMappingFolder.members().length == 0
|
||||
&& GlobalServiceRegister.getDefault().isServiceRegistered(ICoreService.class)) {
|
||||
ICoreService coreService =
|
||||
GlobalServiceRegister.getDefault().getService(ICoreService.class);
|
||||
(ICoreService) 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) {
|
||||
@@ -898,7 +887,7 @@ public class ProcessorUtilities {
|
||||
boolean hasDynamicMetadata = false;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerCoreService.class) && !isExportConfig()) {
|
||||
IDesignerCoreService designerCoreService =
|
||||
GlobalServiceRegister.getDefault().getService(IDesignerCoreService.class);
|
||||
(IDesignerCoreService) GlobalServiceRegister.getDefault().getService(IDesignerCoreService.class);
|
||||
for (INode node : currentProcess.getGraphicalNodes()) {
|
||||
if (designerCoreService.isDelegateNode(node)) { // for jdbc, currently
|
||||
return true;
|
||||
@@ -908,7 +897,7 @@ public class ProcessorUtilities {
|
||||
|
||||
ICoreTisService service = null;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreTisService.class)) {
|
||||
service = GlobalServiceRegister.getDefault().getService(ICoreTisService.class);
|
||||
service = (ICoreTisService) GlobalServiceRegister.getDefault().getService(ICoreTisService.class);
|
||||
}
|
||||
for (INode node : (List<? extends INode>) currentProcess.getGeneratingNodes()) {
|
||||
if (node.getComponent() != null && node.getComponent().getComponentType() == EComponentType.GENERIC) {
|
||||
@@ -1081,8 +1070,8 @@ public class ProcessorUtilities {
|
||||
private static void generateDataSet(IProcess process, IProcessor processor) {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
|
||||
ITestContainerProviderService testContainerService =
|
||||
GlobalServiceRegister.getDefault().getService(
|
||||
ITestContainerProviderService.class);
|
||||
(ITestContainerProviderService) GlobalServiceRegister.getDefault().getService(
|
||||
ITestContainerProviderService.class);
|
||||
if (testContainerService != null) {
|
||||
if (!testContainerService.isTestContainerProcess(process)) {
|
||||
return;
|
||||
@@ -1257,10 +1246,7 @@ public class ProcessorUtilities {
|
||||
neededLibraries);
|
||||
|
||||
// get all job testcases needed modules
|
||||
Set<ModuleNeeded> testcaseModules = getAllJobTestcaseModules(selectedProcessItem);
|
||||
LastGenerationInfo.getInstance().setTestcaseModuleNeeded(jobInfo.getJobId(), jobInfo.getJobVersion(),
|
||||
testcaseModules);
|
||||
neededLibraries.addAll(testcaseModules);
|
||||
neededLibraries.addAll(getAllJobTestcaseModules(selectedProcessItem));
|
||||
|
||||
// must install the needed libraries before generate codes with poms.
|
||||
CorePlugin.getDefault().getRunProcessService().updateLibraries(neededLibraries, currentProcess,
|
||||
@@ -1340,8 +1326,8 @@ public class ProcessorUtilities {
|
||||
Set<ModuleNeeded> neededLibraries = new HashSet<>();
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
|
||||
ITestContainerProviderService testcontainerService =
|
||||
GlobalServiceRegister.getDefault().getService(
|
||||
ITestContainerProviderService.class);
|
||||
(ITestContainerProviderService) GlobalServiceRegister.getDefault().getService(
|
||||
ITestContainerProviderService.class);
|
||||
if (!testcontainerService.isTestContainerItem(selectedProcessItem)) {
|
||||
try {
|
||||
neededLibraries.addAll(testcontainerService.getAllJobTestcaseModules(selectedProcessItem));
|
||||
@@ -1422,7 +1408,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 =
|
||||
GlobalServiceRegister.getDefault().getService(ITDQItemService.class);
|
||||
(ITDQItemService) GlobalServiceRegister.getDefault().getService(ITDQItemService.class);
|
||||
if (tdqItemService == null) {
|
||||
return;
|
||||
}
|
||||
@@ -1476,7 +1462,7 @@ public class ProcessorUtilities {
|
||||
}
|
||||
IProcess2 process = (IProcess2) currentProcess;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IResourcesDependenciesService.class)) {
|
||||
IResourcesDependenciesService resourcesService = GlobalServiceRegister.getDefault()
|
||||
IResourcesDependenciesService resourcesService = (IResourcesDependenciesService) GlobalServiceRegister.getDefault()
|
||||
.getService(IResourcesDependenciesService.class);
|
||||
if (resourcesService == null) {
|
||||
return;
|
||||
@@ -1553,8 +1539,8 @@ public class ProcessorUtilities {
|
||||
if (BitwiseOptionUtils.containOption(option, GENERATE_TESTS) && jobInfo.getProcessItem() != null) {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
|
||||
ITestContainerProviderService testContainerService =
|
||||
GlobalServiceRegister.getDefault().getService(
|
||||
ITestContainerProviderService.class);
|
||||
(ITestContainerProviderService) GlobalServiceRegister.getDefault().getService(
|
||||
ITestContainerProviderService.class);
|
||||
if (testContainerService != null) {
|
||||
List<ProcessItem> testsItems =
|
||||
testContainerService.getTestContainersByVersion(jobInfo.getProcessItem());
|
||||
@@ -1955,7 +1941,7 @@ public class ProcessorUtilities {
|
||||
boolean contextProperties, boolean applyToChildren) throws ProcessorException {
|
||||
ISVNProviderService service = null;
|
||||
if (PluginChecker.isSVNProviderPluginLoaded()) {
|
||||
service = GlobalServiceRegister.getDefault().getService(ISVNProviderService.class);
|
||||
service = (ISVNProviderService) GlobalServiceRegister.getDefault().getService(ISVNProviderService.class);
|
||||
}
|
||||
if (service != null && service.isProjectInSvnMode()) {
|
||||
RepositoryManager.syncRoutineAndJoblet(ERepositoryObjectType.ROUTINES);
|
||||
@@ -2006,7 +1992,7 @@ public class ProcessorUtilities {
|
||||
// added by nma, to refresh routines when generating code in SVN mode. 10225.
|
||||
ISVNProviderService service = null;
|
||||
if (PluginChecker.isSVNProviderPluginLoaded()) {
|
||||
service = GlobalServiceRegister.getDefault().getService(ISVNProviderService.class);
|
||||
service = (ISVNProviderService) GlobalServiceRegister.getDefault().getService(ISVNProviderService.class);
|
||||
}
|
||||
if (service != null && service.isProjectInSvnMode()) {
|
||||
RepositoryManager.syncRoutineAndJoblet(ERepositoryObjectType.ROUTINES);
|
||||
@@ -2042,7 +2028,7 @@ public class ProcessorUtilities {
|
||||
|
||||
ISVNProviderService service = null;
|
||||
if (PluginChecker.isSVNProviderPluginLoaded()) {
|
||||
service = GlobalServiceRegister.getDefault().getService(ISVNProviderService.class);
|
||||
service = (ISVNProviderService) GlobalServiceRegister.getDefault().getService(ISVNProviderService.class);
|
||||
}
|
||||
if (service != null && service.isProjectInSvnMode()) {
|
||||
RepositoryManager.syncRoutineAndJoblet(ERepositoryObjectType.ROUTINES);
|
||||
@@ -2099,7 +2085,7 @@ public class ProcessorUtilities {
|
||||
// added by nma, to refresh routines when generating code in SVN mode. 10225.
|
||||
ISVNProviderService service = null;
|
||||
if (PluginChecker.isSVNProviderPluginLoaded()) {
|
||||
service = GlobalServiceRegister.getDefault().getService(ISVNProviderService.class);
|
||||
service = (ISVNProviderService) GlobalServiceRegister.getDefault().getService(ISVNProviderService.class);
|
||||
}
|
||||
if (service != null && service.isProjectInSvnMode()) {
|
||||
RepositoryManager.syncRoutineAndJoblet(ERepositoryObjectType.ROUTINES);
|
||||
@@ -2393,8 +2379,8 @@ public class ProcessorUtilities {
|
||||
if (parentJobInfo.isTestContainer()
|
||||
&& GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
|
||||
ITestContainerProviderService testContainerService =
|
||||
GlobalServiceRegister.getDefault().getService(
|
||||
ITestContainerProviderService.class);
|
||||
(ITestContainerProviderService) GlobalServiceRegister.getDefault().getService(
|
||||
ITestContainerProviderService.class);
|
||||
if (testContainerService != null) {
|
||||
getSubjobInfo(testContainerService.getOriginalNodes(ptype), ptype, parentJobInfo, jobInfos,firstChildOnly);
|
||||
}
|
||||
@@ -2403,8 +2389,8 @@ public class ProcessorUtilities {
|
||||
if (!parentJobInfo.isTestContainer() && !parentJobInfo.isJoblet()
|
||||
&& GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
|
||||
ITestContainerProviderService testContainerService =
|
||||
GlobalServiceRegister.getDefault().getService(
|
||||
ITestContainerProviderService.class);
|
||||
(ITestContainerProviderService) GlobalServiceRegister.getDefault().getService(
|
||||
ITestContainerProviderService.class);
|
||||
if (testContainerService != null) {
|
||||
List<ProcessItem> testsItems =
|
||||
testContainerService.getTestContainersByVersion(parentJobInfo.getProcessItem());
|
||||
@@ -2491,8 +2477,8 @@ public class ProcessorUtilities {
|
||||
// for joblet node
|
||||
if (jobletPaletteType != null && PluginChecker.isJobLetPluginLoaded()) {
|
||||
IJobletProviderService service =
|
||||
GlobalServiceRegister.getDefault().getService(
|
||||
IJobletProviderService.class);
|
||||
(IJobletProviderService) GlobalServiceRegister.getDefault().getService(
|
||||
IJobletProviderService.class);
|
||||
if (service != null) {
|
||||
IComponent jobletComponent = service.getJobletComponent(node, jobletPaletteType);
|
||||
ProcessType jobletProcess = service.getJobletProcess(jobletComponent);
|
||||
@@ -2566,8 +2552,8 @@ public class ProcessorUtilities {
|
||||
} else {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IJobletProviderService.class)) {
|
||||
IJobletProviderService jobletService =
|
||||
GlobalServiceRegister.getDefault().getService(
|
||||
IJobletProviderService.class);
|
||||
(IJobletProviderService) GlobalServiceRegister.getDefault().getService(
|
||||
IJobletProviderService.class);
|
||||
if (jobletService.isJobletItem(processItem)) {
|
||||
processType = jobletService.getJobletProcess(processItem);
|
||||
parentJobInfo = new JobInfo(processItem.getProperty(), processType.getDefaultContext());
|
||||
@@ -2576,8 +2562,8 @@ public class ProcessorUtilities {
|
||||
}
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
|
||||
ITestContainerProviderService testContainerService =
|
||||
GlobalServiceRegister.getDefault().getService(
|
||||
ITestContainerProviderService.class);
|
||||
(ITestContainerProviderService) GlobalServiceRegister.getDefault().getService(
|
||||
ITestContainerProviderService.class);
|
||||
if (testContainerService.isTestContainerItem(processItem)) {
|
||||
parentJobInfo.setTestContainer(true);
|
||||
}
|
||||
@@ -2654,7 +2640,7 @@ public class ProcessorUtilities {
|
||||
public static File getJavaProjectLibFolder() {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
|
||||
IRunProcessService processService =
|
||||
GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
|
||||
(IRunProcessService) GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
|
||||
return processService.getJavaProjectLibFolder().getLocation().toFile();
|
||||
}
|
||||
return null;
|
||||
@@ -2663,7 +2649,7 @@ public class ProcessorUtilities {
|
||||
public static String getJavaProjectLibFolderPath() {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
|
||||
IRunProcessService processService =
|
||||
GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
|
||||
(IRunProcessService) GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
|
||||
return processService.getJavaProjectLibFolder().getLocation().toPortableString();
|
||||
}
|
||||
return null;
|
||||
@@ -2672,7 +2658,7 @@ public class ProcessorUtilities {
|
||||
public static String getJavaProjectExternalResourcesFolderPath(IProcess process) {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
|
||||
IRunProcessService processService =
|
||||
GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
|
||||
(IRunProcessService) GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
|
||||
return processService.getJavaProjectExternalResourcesFolder(process).getLocation().toPortableString();
|
||||
}
|
||||
return null;
|
||||
@@ -2864,10 +2850,6 @@ public class ProcessorUtilities {
|
||||
return jarFilePath;
|
||||
}
|
||||
|
||||
public static boolean isCIMode() {
|
||||
return isCIMode;
|
||||
}
|
||||
|
||||
public static void setCIMode(boolean isCIMode) {
|
||||
ProcessorUtilities.isCIMode = isCIMode;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
|
||||
import org.apache.maven.repository.internal.MavenRepositorySystemUtils;
|
||||
import org.apache.maven.wagon.Wagon;
|
||||
import org.apache.maven.wagon.providers.file.FileWagon;
|
||||
import org.apache.maven.wagon.providers.http.LightweightHttpWagon;
|
||||
import org.apache.maven.wagon.providers.http.HttpWagon;
|
||||
import org.apache.maven.wagon.providers.http.LightweightHttpWagonAuthenticator;
|
||||
import org.apache.maven.wagon.providers.http.LightweightHttpsWagon;
|
||||
import org.codehaus.plexus.DefaultPlexusContainer;
|
||||
@@ -238,13 +238,9 @@ public class MavenLibraryResolverProvider {
|
||||
|
||||
LightweightHttpsWagon https = new LightweightHttpsWagon();
|
||||
https.setAuthenticator(new LightweightHttpWagonAuthenticator());
|
||||
https.setPreemptiveAuthentication(true);
|
||||
LightweightHttpWagon http = new LightweightHttpWagon();
|
||||
http.setAuthenticator(new LightweightHttpWagonAuthenticator());
|
||||
http.setPreemptiveAuthentication(true);
|
||||
|
||||
pc.addComponent(https, Wagon.class, "https");
|
||||
pc.addComponent(http, Wagon.class, "http");
|
||||
pc.addComponent(new HttpWagon(), Wagon.class, "http");
|
||||
pc.addComponent(new FileWagon(), Wagon.class, "file");
|
||||
|
||||
WagonTransporterFactory tf = (WagonTransporterFactory) locator.getService(TransporterFactory.class);
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
</parent>
|
||||
<artifactId>studio-components-dependencies</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<properties>
|
||||
<components.version>0.29.0-SNAPSHOT</components.version>
|
||||
</properties>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>talend_open</id>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<artifactId>studio-tacokit-dependencies</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<properties>
|
||||
<tacokit.components.version>1.8.0-SNAPSHOT</tacokit.components.version>
|
||||
<tacokit.components.version>1.6.0</tacokit.components.version>
|
||||
</properties>
|
||||
<repositories>
|
||||
<repository>
|
||||
@@ -35,14 +35,14 @@
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<!-- Following dependency management block is a quickfix for 7.3.1 release. After release it should be removed and
|
||||
couchbase-locales version should be fixed in couchbase component pom.xml-->
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.talend.components</groupId>
|
||||
<artifactId>connectors-se</artifactId>
|
||||
<version>${tacokit.components.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
<artifactId>couchbase-locales</artifactId>
|
||||
<version>1.6.5</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
@@ -53,11 +53,6 @@
|
||||
<artifactId>couchbase</artifactId>
|
||||
<version>${tacokit.components.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.talend.components</groupId>
|
||||
<artifactId>cosmosDB</artifactId>
|
||||
<version>${tacokit.components.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
|
||||
@@ -33,9 +33,6 @@ public abstract class AbstractRepositoryNodeRepositorySettingTester implements I
|
||||
if (contentType.equals(getType())) {
|
||||
return true;
|
||||
}
|
||||
if (contentType.equals(ERepositoryObjectType.PROCESS_ROUTE_DESIGN)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
package org.talend.designer.maven.tools;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
@@ -24,19 +24,16 @@ import org.apache.maven.model.Dependency;
|
||||
import org.apache.maven.model.Exclusion;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.ILibraryManagerService;
|
||||
import org.talend.core.model.general.ModuleNeeded;
|
||||
import org.talend.core.model.process.IProcess2;
|
||||
import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.runtime.process.LastGenerationInfo;
|
||||
import org.talend.core.runtime.process.TalendProcessOptionConstants;
|
||||
import org.talend.core.ui.ITestContainerProviderService;
|
||||
import org.talend.designer.maven.utils.PomUtil;
|
||||
import org.talend.designer.maven.utils.SortableDependency;
|
||||
import org.talend.designer.runprocess.IProcessor;
|
||||
import org.talend.designer.runprocess.ProcessorException;
|
||||
|
||||
@@ -48,71 +45,54 @@ public class ProcessorDependenciesManager {
|
||||
|
||||
private final IProcessor processor;
|
||||
|
||||
private final Property property;
|
||||
|
||||
public ProcessorDependenciesManager(IProcessor processor) {
|
||||
this.processor = processor;
|
||||
property = processor.getProperty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Will add the dependencies to the maven model.
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public boolean updateDependencies(IProgressMonitor progressMonitor, Model model) throws ProcessorException {
|
||||
try {
|
||||
Set<ModuleNeeded> neededLibraries = new HashSet<>();
|
||||
Set<String> uniqueDependencies = new HashSet<>();
|
||||
Set<ModuleNeeded> jobModules = getProcessNeededModules();
|
||||
Set<ModuleNeeded> testcaseModules = getTestcaseNeededModules(property);
|
||||
neededLibraries.addAll(jobModules);
|
||||
neededLibraries.addAll(testcaseModules);
|
||||
if (!neededLibraries.isEmpty()) {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ILibraryManagerService.class)) {
|
||||
ILibraryManagerService repositoryBundleService = GlobalServiceRegister.getDefault()
|
||||
.getService(ILibraryManagerService.class);
|
||||
repositoryBundleService.installModules(neededLibraries, null);
|
||||
List neededDependencies = new ArrayList<Dependency>();
|
||||
Set<ModuleNeeded> neededLibraries = getAllModuleNeededWithTestCase();
|
||||
Set<String> uniquDependenciesSet = new HashSet<>();
|
||||
|
||||
for (ModuleNeeded module : neededLibraries) {
|
||||
Dependency dependency = null;
|
||||
// if (module.getDeployStatus() == ELibraryInstallStatus.DEPLOYED) {
|
||||
// }
|
||||
final String mavenUri = module.getMavenUri();
|
||||
if (uniquDependenciesSet.contains(mavenUri)) {
|
||||
continue; // must be same GAV, avoid the different other attrs for modules
|
||||
}
|
||||
uniquDependenciesSet.add(mavenUri);
|
||||
dependency = PomUtil.createModuleDependency(mavenUri);
|
||||
if (dependency != null) {
|
||||
if (module.isExcludeDependencies()) {
|
||||
Exclusion exclusion = new Exclusion();
|
||||
exclusion.setGroupId("*"); //$NON-NLS-1$
|
||||
exclusion.setArtifactId("*"); //$NON-NLS-1$
|
||||
dependency.addExclusion(exclusion);
|
||||
}
|
||||
neededDependencies.add(dependency);
|
||||
}
|
||||
}
|
||||
List neededDependencies = new ArrayList<>();
|
||||
neededDependencies.addAll(convertToDependency(jobModules, uniqueDependencies, false));
|
||||
neededDependencies.addAll(convertToDependency(testcaseModules, uniqueDependencies, true));
|
||||
Collections.sort(neededDependencies);
|
||||
|
||||
java.util.Collections.sort(neededDependencies);
|
||||
boolean fresh = false;
|
||||
if (property != null && property.getItem() != null && processor.getProcess() instanceof IProcess2) {
|
||||
if (processor.getProperty() != null && processor.getProperty().getItem() != null
|
||||
&& processor.getProcess() instanceof IProcess2) {
|
||||
// is standard job.
|
||||
fresh = true;
|
||||
}
|
||||
return updateDependencies(progressMonitor, model, neededDependencies, fresh);
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new ProcessorException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
private List convertToDependency(Set<ModuleNeeded> neededLibraries, Set<String> uniqueDependencies, boolean optional) {
|
||||
List neededDependencies = new ArrayList<>();
|
||||
for (ModuleNeeded module : neededLibraries) {
|
||||
final String mavenUri = module.getMavenUri();
|
||||
if (uniqueDependencies.contains(mavenUri)) {
|
||||
continue; // must be same GAV, avoid the different other attrs for modules
|
||||
}
|
||||
uniqueDependencies.add(mavenUri);
|
||||
Dependency dependency = PomUtil.createModuleDependency(mavenUri);
|
||||
if (dependency != null) {
|
||||
((SortableDependency) dependency).setAssemblyOptional(optional);
|
||||
if (module.isExcludeDependencies()) {
|
||||
Exclusion exclusion = new Exclusion();
|
||||
exclusion.setGroupId("*"); //$NON-NLS-1$
|
||||
exclusion.setArtifactId("*"); //$NON-NLS-1$
|
||||
dependency.addExclusion(exclusion);
|
||||
}
|
||||
neededDependencies.add(dependency);
|
||||
}
|
||||
}
|
||||
return neededDependencies;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* DOC ggu Comment method "updateDependencies". add the job Needed Libraries for current model.
|
||||
@@ -179,35 +159,35 @@ public class ProcessorDependenciesManager {
|
||||
return changed;
|
||||
}
|
||||
|
||||
private Set<ModuleNeeded> getProcessNeededModules() {
|
||||
Set<ModuleNeeded> neededLibraries = LastGenerationInfo.getInstance()
|
||||
private Set<ModuleNeeded> getAllModuleNeededWithTestCase() throws PersistenceException {
|
||||
// add the job modules.
|
||||
Set<ModuleNeeded> neededLibraries = new HashSet<>();
|
||||
Collection<ModuleNeeded> modulesNeeded = LastGenerationInfo.getInstance()
|
||||
.getModulesNeededPerJob(processor.getProcess().getId(), processor.getProcess().getVersion());
|
||||
if (neededLibraries.isEmpty()) {
|
||||
neededLibraries = processor.getNeededModules(TalendProcessOptionConstants.MODULES_DEFAULT);
|
||||
if (modulesNeeded.isEmpty()) {
|
||||
modulesNeeded = processor.getNeededModules(TalendProcessOptionConstants.MODULES_WITH_JOBLET);
|
||||
}
|
||||
neededLibraries.addAll(modulesNeeded);
|
||||
|
||||
// add testcase modules
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
|
||||
ITestContainerProviderService testcontainerService = (ITestContainerProviderService) GlobalServiceRegister
|
||||
.getDefault().getService(ITestContainerProviderService.class);
|
||||
Set<ModuleNeeded> testcaseModules = null;
|
||||
if (processor.getProperty() != null && processor.getProperty().getItem() instanceof ProcessItem) {
|
||||
ProcessItem item = (ProcessItem) processor.getProperty().getItem();
|
||||
testcaseModules = testcontainerService.getAllJobTestcaseModules(item);
|
||||
neededLibraries.addAll(testcaseModules);
|
||||
if (testcaseModules != null) {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ILibraryManagerService.class)) {
|
||||
ILibraryManagerService repositoryBundleService = (ILibraryManagerService) GlobalServiceRegister
|
||||
.getDefault().getService(ILibraryManagerService.class);
|
||||
repositoryBundleService.installModules(neededLibraries, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return neededLibraries;
|
||||
}
|
||||
|
||||
public static Set<ModuleNeeded> getTestcaseNeededModules(Property property) {
|
||||
if (property == null || !(property.getItem() instanceof ProcessItem)) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
Set<ModuleNeeded> testcaseModules = LastGenerationInfo.getInstance().getTestcaseModuleNeeded(property.getId(),
|
||||
property.getVersion());
|
||||
if (testcaseModules.isEmpty()) {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
|
||||
ITestContainerProviderService testcontainerService = GlobalServiceRegister.getDefault()
|
||||
.getService(ITestContainerProviderService.class);
|
||||
try {
|
||||
testcaseModules = testcontainerService.getAllJobTestcaseModules((ProcessItem) property.getItem());
|
||||
LastGenerationInfo.getInstance().setTestcaseModuleNeeded(property.getId(), property.getVersion(),
|
||||
testcaseModules);
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return testcaseModules;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,22 +18,18 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.versioning.ComparableVersion;
|
||||
import org.apache.maven.model.Activation;
|
||||
import org.apache.maven.model.Dependency;
|
||||
import org.apache.maven.model.Model;
|
||||
@@ -61,10 +57,11 @@ import org.talend.core.model.process.ProcessUtils;
|
||||
import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.model.properties.Project;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.utils.JavaResourcesHelper;
|
||||
import org.talend.core.repository.utils.ItemResourceUtil;
|
||||
import org.talend.core.runtime.maven.MavenArtifact;
|
||||
import org.talend.core.runtime.maven.MavenConstants;
|
||||
import org.talend.core.runtime.maven.MavenUrlHelper;
|
||||
import org.talend.core.runtime.process.ITalendProcessJavaProject;
|
||||
import org.talend.core.runtime.process.JobInfoProperties;
|
||||
import org.talend.core.runtime.process.LastGenerationInfo;
|
||||
@@ -78,7 +75,6 @@ import org.talend.core.utils.TemplateFileUtils;
|
||||
import org.talend.designer.maven.model.TalendMavenConstants;
|
||||
import org.talend.designer.maven.template.ETalendMavenVariables;
|
||||
import org.talend.designer.maven.template.MavenTemplateManager;
|
||||
import org.talend.designer.maven.tools.ProcessorDependenciesManager;
|
||||
import org.talend.designer.maven.utils.PomIdsHelper;
|
||||
import org.talend.designer.maven.utils.PomUtil;
|
||||
import org.talend.designer.maven.utils.SortableDependency;
|
||||
@@ -624,106 +620,139 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
|
||||
}
|
||||
|
||||
protected void updateDependencySet(IFile assemblyFile) {
|
||||
Set<String> jobCoordinate = new HashSet<>();
|
||||
Set<String> talendLibCoordinate = new HashSet<>();
|
||||
Set<String> _3rdLibCoordinate = new HashSet<>();
|
||||
Map<String, Set<Dependency>> duplicateLibs = new HashMap<>();
|
||||
IProcessor processor = getJobProcessor();
|
||||
Map<String, Dependency> jobCoordinateMap = new HashMap<String, Dependency>();
|
||||
Set<JobInfo> childrenJobInfo = new HashSet<>();
|
||||
if (!hasLoopDependency()) {
|
||||
childrenJobInfo = getJobProcessor().getBuildChildrenJobs();
|
||||
}
|
||||
|
||||
// current job
|
||||
Property currentJobProperty = processor.getProperty();
|
||||
jobCoordinate.add(getJobCoordinate(currentJobProperty));
|
||||
|
||||
// children jobs without test cases
|
||||
Set<JobInfo> childrenJobInfo = !hasLoopDependency() ? processor.getBuildChildrenJobs().stream().filter(j -> !j.isTestContainer()).collect(Collectors.toSet()) : Collections.emptySet();
|
||||
childrenJobInfo.forEach(j -> jobCoordinate.add(getJobCoordinate(j.getProcessItem().getProperty())));
|
||||
// add children jobs
|
||||
for (JobInfo jobInfo : childrenJobInfo) {
|
||||
Property property = jobInfo.getProcessItem().getProperty();
|
||||
String coordinate =
|
||||
getCoordinate(PomIdsHelper.getJobGroupId(property), PomIdsHelper.getJobArtifactId(jobInfo),
|
||||
MavenConstants.PACKAGING_JAR, PomIdsHelper.getJobVersion(property));
|
||||
Dependency dependency = getDependencyObject(PomIdsHelper.getJobGroupId(property), PomIdsHelper.getJobArtifactId(jobInfo), PomIdsHelper.getJobVersion(property),
|
||||
MavenConstants.PACKAGING_JAR, null);
|
||||
jobCoordinateMap.put(coordinate, dependency);
|
||||
}
|
||||
|
||||
// talend libraries and codes
|
||||
String projectGroupId = PomIdsHelper.getProjectGroupId(ProjectManager.getInstance().getProject(currentJobProperty).getTechnicalLabel());
|
||||
// add parent job
|
||||
Property parentProperty = this.getJobProcessor().getProperty();
|
||||
String parentCoordinate =
|
||||
getCoordinate(PomIdsHelper.getJobGroupId(parentProperty), PomIdsHelper.getJobArtifactId(parentProperty),
|
||||
MavenConstants.PACKAGING_JAR, PomIdsHelper.getJobVersion(parentProperty));
|
||||
Dependency parentDependency = getDependencyObject(PomIdsHelper.getJobGroupId(parentProperty), PomIdsHelper.getJobArtifactId(parentProperty), PomIdsHelper.getJobVersion(parentProperty),
|
||||
MavenConstants.PACKAGING_JAR, null);
|
||||
jobCoordinateMap.put(parentCoordinate, parentDependency);
|
||||
|
||||
// add talend libraries and codes
|
||||
Map<String, Dependency> talendLibCoordinateMap = new HashMap<String, Dependency>();
|
||||
String projectTechName = ProjectManager.getInstance().getProject(parentProperty).getTechnicalLabel();
|
||||
String projectGroupId = PomIdsHelper.getProjectGroupId(projectTechName);
|
||||
|
||||
List<Dependency> dependencies = new ArrayList<>();
|
||||
// codes
|
||||
List<Dependency> dependencies = new ArrayList<>();
|
||||
addCodesDependencies(dependencies);
|
||||
for (Dependency dependency : dependencies) {
|
||||
talendLibCoordinateMap.put(getCoordinate(dependency), dependency);
|
||||
}
|
||||
|
||||
// codes dependencies (optional)
|
||||
ERepositoryObjectType.getAllTypesOfCodes().forEach(t -> dependencies.addAll(PomUtil.getCodesDependencies(t)));
|
||||
|
||||
// libraries of talend/3rd party
|
||||
dependencies.addAll(convertToDistinctedJobDependencies(currentJobProperty.getId(), currentJobProperty.getVersion(),
|
||||
processor.getNeededModules(TalendProcessOptionConstants.MODULES_EXCLUDE_SHADED)));
|
||||
|
||||
// missing modules from the job generation of children
|
||||
childrenJobInfo.forEach(j -> dependencies.addAll(convertToDistinctedJobDependencies(j.getJobId(), j.getJobVersion(),
|
||||
LastGenerationInfo.getInstance().getModulesNeededPerJob(j.getJobId(), j.getJobVersion()))));
|
||||
|
||||
Set<ModuleNeeded> modules = new HashSet<>();
|
||||
// testcase modules from current job (optional)
|
||||
modules.addAll(ProcessorDependenciesManager.getTestcaseNeededModules(currentJobProperty));
|
||||
|
||||
// testcase modules from children job (optional)
|
||||
childrenJobInfo.forEach(
|
||||
j -> modules.addAll(ProcessorDependenciesManager.getTestcaseNeededModules(j.getProcessItem().getProperty())));
|
||||
|
||||
dependencies.addAll(
|
||||
modules.stream().filter(m -> !m.isExcluded()).map(m -> createDenpendency(m, true)).collect(Collectors.toSet()));
|
||||
|
||||
dependencies.stream().filter(d -> !MavenConstants.PACKAGING_POM.equals(d.getType())).forEach(d -> {
|
||||
String coordinate = getCoordinate(d);
|
||||
String groupId = d.getGroupId();
|
||||
boolean optional = ((SortableDependency) d).isAssemblyOptional();
|
||||
if (jobCoordinate.contains(coordinate) || talendLibCoordinate.contains(coordinate)
|
||||
|| _3rdLibCoordinate.contains(coordinate)) {
|
||||
return;
|
||||
// libraries
|
||||
dependencies.clear();
|
||||
Set<ModuleNeeded> modules = getJobProcessor()
|
||||
.getNeededModules(TalendProcessOptionConstants.MODULES_WITH_JOBLET
|
||||
| TalendProcessOptionConstants.MODULES_EXCLUDE_SHADED);
|
||||
for (ModuleNeeded module : modules) {
|
||||
String mavenUri = module.getMavenUri();
|
||||
Dependency dependency = PomUtil.createModuleDependency(mavenUri);
|
||||
dependencies.add(dependency);
|
||||
}
|
||||
for (Dependency dependency : dependencies) {
|
||||
if (MavenConstants.PACKAGING_POM.equals(dependency.getType())) {
|
||||
continue;
|
||||
}
|
||||
if (MavenConstants.DEFAULT_LIB_GROUP_ID.equals(groupId) || groupId.startsWith(projectGroupId)) {
|
||||
if (!optional) {
|
||||
talendLibCoordinate.add(coordinate);
|
||||
String dependencyGroupId = dependency.getGroupId();
|
||||
String coordinate = getCoordinate(dependency);
|
||||
if (!jobCoordinateMap.containsKey(coordinate)) {
|
||||
if (MavenConstants.DEFAULT_LIB_GROUP_ID.equals(dependencyGroupId)) {
|
||||
talendLibCoordinateMap.put(coordinate, dependency);
|
||||
}
|
||||
} else {
|
||||
if (!optional) {
|
||||
_3rdLibCoordinate.add(coordinate);
|
||||
}
|
||||
addToDuplicateLibs(duplicateLibs, d);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// add 3rd party libraries
|
||||
Map<String, Dependency> _3rdDepLibMap = new HashMap<String, Dependency>();
|
||||
Map<String, Set<Dependency>> duplicateLibs = new HashMap<>();
|
||||
for (Dependency dependency : dependencies) {
|
||||
if (MavenConstants.PACKAGING_POM.equals(dependency.getType())) {
|
||||
continue;
|
||||
}
|
||||
String coordinate = getCoordinate(dependency);
|
||||
if (!jobCoordinateMap.containsKey(coordinate) && !talendLibCoordinateMap.containsKey(coordinate)) {
|
||||
_3rdDepLibMap.put(coordinate, dependency);
|
||||
addToDuplicateLibs(duplicateLibs, dependency);
|
||||
}
|
||||
}
|
||||
|
||||
// add missing modules from the job generation of children
|
||||
Set<ModuleNeeded> fullModulesList = new HashSet<>();
|
||||
for (JobInfo jobInfo : childrenJobInfo) {
|
||||
fullModulesList
|
||||
.addAll(LastGenerationInfo
|
||||
.getInstance()
|
||||
.getModulesNeededWithSubjobPerJob(jobInfo.getJobId(), jobInfo.getJobVersion()));
|
||||
}
|
||||
for (ModuleNeeded moduleNeeded : fullModulesList) {
|
||||
if (moduleNeeded.isExcluded()) {
|
||||
continue;
|
||||
}
|
||||
MavenArtifact artifact = MavenUrlHelper.parseMvnUrl(moduleNeeded.getMavenUri());
|
||||
String coordinate = getCoordinate(artifact.getGroupId(), artifact.getArtifactId(), artifact.getType(),
|
||||
artifact.getVersion());
|
||||
if (!jobCoordinateMap.containsKey(coordinate) && !talendLibCoordinateMap.containsKey(coordinate)
|
||||
&& !_3rdDepLibMap.containsKey(coordinate)) {
|
||||
Dependency dependencyObject = getDependencyObject(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(), artifact.getClassifier());
|
||||
if (MavenConstants.DEFAULT_LIB_GROUP_ID.equals(artifact.getGroupId())
|
||||
|| artifact.getGroupId().startsWith(projectGroupId)) {
|
||||
talendLibCoordinateMap.put(coordinate, dependencyObject);
|
||||
} else {
|
||||
_3rdDepLibMap.put(coordinate, dependencyObject);
|
||||
Dependency dependency = PomUtil
|
||||
.createDependency(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(),
|
||||
artifact.getType(), artifact.getClassifier());
|
||||
addToDuplicateLibs(duplicateLibs, dependency);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Iterator<String> iterator = duplicateLibs.keySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Set<Dependency> dupDependencies = duplicateLibs.get(iterator.next());
|
||||
if (dupDependencies.size() < 2 // remove unique dependency
|
||||
/* || dupDependencies.stream().filter(d -> !((SortableDependency) d).isAssemblyOptional()).count() == 1 */) {
|
||||
// remove when only one required dependencies, means others are from codes/testcase
|
||||
// don't do this now at least it won't have problem in studio
|
||||
// in some case, the needed jar is not in main job pom, maven will get the nearest one which could be
|
||||
// wrong
|
||||
String key = iterator.next();
|
||||
Set<Dependency> dupDependencies = duplicateLibs.get(key);
|
||||
if (dupDependencies.size() < 2) {
|
||||
// remove non-duplicated dependencies
|
||||
iterator.remove();
|
||||
} else {
|
||||
// remove duplicate dependencies from 3rd party libs
|
||||
dupDependencies.stream().map(d -> getCoordinate(d)).forEach(c -> _3rdLibCoordinate.remove(c));
|
||||
// remove duplicated dependencies from 3rd lib list
|
||||
for (Dependency dependency : dupDependencies) {
|
||||
_3rdDepLibMap.remove(getCoordinate(dependency));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
Document document = PomUtil.loadAssemblyFile(null, assemblyFile);
|
||||
// add talend libs & codes
|
||||
setupDependencySetNode(document, talendLibCoordinate, "lib", "${artifact.artifactId}.${artifact.extension}", false,
|
||||
false);
|
||||
// add 3rd party libs: groupId:artifactId:type:version
|
||||
setupDependencySetNode(document,
|
||||
_3rdLibCoordinate.stream().filter(s -> s.split(":").length == 4).collect(Collectors.toSet()), "lib", null,
|
||||
setupDependencySetNode(document, talendLibCoordinateMap, "lib", "${artifact.artifactId}.${artifact.extension}",
|
||||
false, false);
|
||||
// add 3rd party libs with classifier: groupId:artifactId:type:classifier:version
|
||||
setupDependencySetNode(document,
|
||||
_3rdLibCoordinate.stream().filter(s -> s.split(":").length == 5).collect(Collectors.toSet()), "lib", null,
|
||||
false, false);
|
||||
// FIXME if later add classifier for org.talend.libraries libs, code and job artifact, need to handle it
|
||||
// like 3rd libs as well
|
||||
|
||||
// add 3rd party libs <dependencySet>
|
||||
setupDependencySetNode(document, _3rdDepLibMap, "lib", null, false, false);
|
||||
// add jobs
|
||||
setupDependencySetNode(document, jobCoordinate, "${talend.job.name}",
|
||||
setupDependencySetNode(document, jobCoordinateMap, "${talend.job.name}",
|
||||
"${artifact.build.finalName}.${artifact.extension}", true, false);
|
||||
// add duplicate dependencies if exists
|
||||
setupFileNode(document, duplicateLibs.values().stream().flatMap(s -> s.stream()).collect(Collectors.toSet()));
|
||||
setupFileNode(document, duplicateLibs);
|
||||
|
||||
PomUtil.saveAssemblyFile(assemblyFile, document);
|
||||
} catch (Exception e) {
|
||||
@@ -731,90 +760,66 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
|
||||
}
|
||||
}
|
||||
|
||||
// remove duplicate job dependencies and only keep the latest one
|
||||
// keep high priority dependencies if set by tLibraryLoad
|
||||
private Set<Dependency> convertToDistinctedJobDependencies(String jobId, String jobVersion, Set<ModuleNeeded> neededModules) {
|
||||
Set<Dependency> highPriorityDependencies = LastGenerationInfo.getInstance()
|
||||
.getHighPriorityModuleNeededPerJob(jobId, jobVersion).stream().map(m -> createDenpendency(m, false))
|
||||
.collect(Collectors.toSet());
|
||||
Map<String, Dependency> highPriorityDependenciesMap = new HashMap<>();
|
||||
highPriorityDependencies.forEach(d -> highPriorityDependenciesMap.putIfAbsent(getCheckDupCoordinate(d), d));
|
||||
|
||||
Set<Dependency> jobDependencies = neededModules.stream().filter(m -> !m.isExcluded()).map(m -> createDenpendency(m, false)).collect(Collectors.toSet());
|
||||
Map<String, Set<Dependency>> jobDependenciesMap = new HashMap<>();
|
||||
jobDependencies.forEach(d -> {
|
||||
String coordinate = getCheckDupCoordinate(d);
|
||||
if (jobDependenciesMap.get(coordinate) == null) {
|
||||
jobDependenciesMap.put(coordinate, new LinkedHashSet<>());
|
||||
}
|
||||
jobDependenciesMap.get(coordinate).add(d);
|
||||
});
|
||||
|
||||
Set<Dependency> filteredDependencies = new HashSet<>();
|
||||
jobDependenciesMap.forEach((key, value) -> {
|
||||
Optional<Dependency> target = null;
|
||||
if (highPriorityDependenciesMap.containsKey(key)) {
|
||||
Dependency highPriorityDependency = highPriorityDependenciesMap.get(key);
|
||||
target = value.stream().filter(d -> getCoordinate(highPriorityDependency).equals(getCoordinate(d))).findFirst();
|
||||
} else {
|
||||
target = value.stream().sorted(
|
||||
(d1, d2) -> new ComparableVersion(d2.getVersion()).compareTo(new ComparableVersion(d1.getVersion())))
|
||||
.findFirst();
|
||||
}
|
||||
if (target.isPresent()) {
|
||||
filteredDependencies.add(target.get());
|
||||
}
|
||||
});
|
||||
|
||||
return filteredDependencies;
|
||||
}
|
||||
|
||||
private Dependency createDenpendency(ModuleNeeded moduleNeeded, boolean optional) {
|
||||
SortableDependency dependency = (SortableDependency) PomUtil.createModuleDependency(moduleNeeded.getMavenUri());
|
||||
dependency.setAssemblyOptional(optional);
|
||||
return dependency;
|
||||
}
|
||||
|
||||
private String getCoordinate(Dependency dependency) {
|
||||
return getCoordinate(dependency.getGroupId(), dependency.getArtifactId(), dependency.getType(),
|
||||
dependency.getVersion(), dependency.getClassifier());
|
||||
dependency.getVersion());
|
||||
}
|
||||
|
||||
private String getCheckDupCoordinate(Dependency dependency) {
|
||||
return getCoordinate(dependency.getGroupId(), dependency.getArtifactId(), dependency.getType(), null,
|
||||
dependency.getClassifier());
|
||||
}
|
||||
|
||||
protected String getJobCoordinate(Property property) {
|
||||
return getCoordinate(PomIdsHelper.getJobGroupId(property), PomIdsHelper.getJobArtifactId(property),
|
||||
MavenConstants.PACKAGING_JAR, PomIdsHelper.getJobVersion(property), null);
|
||||
}
|
||||
|
||||
protected String getCoordinate(String groupId, String artifactId, String type, String version, String classifier) {
|
||||
protected String getCoordinate(String groupId, String artifactId, String type, String version) {
|
||||
String separator = ":"; //$NON-NLS-1$
|
||||
String coordinate = groupId + separator + artifactId;
|
||||
if (StringUtils.isNotBlank(type)) {
|
||||
coordinate += separator + type;
|
||||
String coordinate = groupId + separator;
|
||||
coordinate += artifactId + separator;
|
||||
if (type != null) {
|
||||
coordinate += type;
|
||||
}
|
||||
if (StringUtils.isNotBlank(classifier)) {
|
||||
coordinate += separator + classifier;
|
||||
}
|
||||
if (StringUtils.isNotBlank(version)) {
|
||||
|
||||
if (version != null) {
|
||||
coordinate += separator + version;
|
||||
}
|
||||
|
||||
return coordinate;
|
||||
}
|
||||
|
||||
protected String getAssemblyCoordinate(Dependency dependency) {
|
||||
String separator = ":"; //$NON-NLS-1$
|
||||
String coordinate = dependency.getGroupId() + separator;
|
||||
coordinate += dependency.getArtifactId() + separator;
|
||||
if (dependency.getType() != null) {
|
||||
coordinate += dependency.getType();
|
||||
}
|
||||
if (dependency.getClassifier() != null) {
|
||||
coordinate += separator + "*";
|
||||
}
|
||||
if (dependency.getVersion() != null) {
|
||||
coordinate += separator + dependency.getVersion();
|
||||
}
|
||||
|
||||
return coordinate;
|
||||
}
|
||||
|
||||
protected Dependency getDependencyObject(String groupId, String artifactId, String version, String type, String classifier) {
|
||||
Dependency object = new SortableDependency();
|
||||
object.setGroupId(groupId);
|
||||
object.setArtifactId(artifactId);
|
||||
object.setVersion(version);
|
||||
object.setType(type);
|
||||
object.setClassifier(classifier);
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
private void addToDuplicateLibs(Map<String, Set<Dependency>> map, Dependency dependency) {
|
||||
String coordinate = getCheckDupCoordinate(dependency);
|
||||
String coordinate =
|
||||
getCoordinate(dependency.getGroupId(), dependency.getArtifactId(), dependency.getType(), null);
|
||||
if (!map.containsKey(coordinate)) {
|
||||
map.put(coordinate, new HashSet<>());
|
||||
Set<Dependency> set = new HashSet<>();
|
||||
map.put(coordinate, set);
|
||||
}
|
||||
map.get(coordinate).add(dependency);
|
||||
}
|
||||
|
||||
protected void setupDependencySetNode(Document document, Set<String> libIncludes, String outputDir, String fileNameMapping,
|
||||
boolean useProjectArtifact, boolean unpack) {
|
||||
protected void setupDependencySetNode(Document document, Map<String, Dependency> libIncludes, String outputDir,
|
||||
String fileNameMapping, boolean useProjectArtifact, boolean unpack) {
|
||||
if (libIncludes.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
@@ -834,9 +839,9 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
|
||||
Node includesNode = document.createElement("includes");
|
||||
dependencySetNode.appendChild(includesNode);
|
||||
|
||||
for (String coodinate : libIncludes) {
|
||||
for (Dependency dependency : libIncludes.values()) {
|
||||
Node includeNode = document.createElement("include");
|
||||
includeNode.setTextContent(coodinate);
|
||||
includeNode.setTextContent(getAssemblyCoordinate(dependency));
|
||||
includesNode.appendChild(includeNode);
|
||||
}
|
||||
|
||||
@@ -858,40 +863,44 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
|
||||
|
||||
}
|
||||
|
||||
private void setupFileNode(Document document, Set<Dependency> duplicateDependencies) throws CoreException {
|
||||
Node filesNode = document.getElementsByTagName("files").item(0);
|
||||
// TESB-27614:NPE while building a route
|
||||
if (filesNode == null) {
|
||||
return;
|
||||
}
|
||||
private void setupFileNode(Document document, Map<String, Set<Dependency>> duplicateDependencies) {
|
||||
if (duplicateDependencies.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
IMaven maven = MavenPlugin.getMaven();
|
||||
ArtifactRepository repository = maven.getLocalRepository();
|
||||
for (Dependency dependency : duplicateDependencies) {
|
||||
if (((SortableDependency) dependency).isAssemblyOptional()) {
|
||||
continue;
|
||||
try {
|
||||
IMaven maven = MavenPlugin.getMaven();
|
||||
ArtifactRepository repository = maven.getLocalRepository();
|
||||
Node filesNode = document.getElementsByTagName("files").item(0);
|
||||
// TESB-27614:NPE while building a route
|
||||
if (filesNode != null) {
|
||||
for (Entry<String, Set<Dependency>> entry : duplicateDependencies.entrySet()) {
|
||||
Set<Dependency> dependencies = entry.getValue();
|
||||
for (Dependency dependency : dependencies) {
|
||||
String sourceLocation = maven
|
||||
.getArtifactPath(repository, dependency.getGroupId(), dependency.getArtifactId(),
|
||||
dependency.getVersion(), dependency.getType(), dependency.getClassifier());
|
||||
Path path = new File(repository.getBasedir()).toPath().resolve(sourceLocation);
|
||||
sourceLocation = path.toString();
|
||||
String destName = path.getFileName().toString();
|
||||
Node fileNode = document.createElement("file");
|
||||
filesNode.appendChild(fileNode);
|
||||
|
||||
Node sourcesNode = document.createElement("source");
|
||||
sourcesNode.setTextContent(sourceLocation);
|
||||
fileNode.appendChild(sourcesNode);
|
||||
|
||||
Node outputDirNode = document.createElement("outputDirectory");
|
||||
outputDirNode.setTextContent("lib");
|
||||
fileNode.appendChild(outputDirNode);
|
||||
|
||||
Node destNameNode = document.createElement("destName");
|
||||
destNameNode.setTextContent(destName);
|
||||
fileNode.appendChild(destNameNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
String sourceLocation = maven.getArtifactPath(repository, dependency.getGroupId(), dependency.getArtifactId(),
|
||||
dependency.getVersion(), dependency.getType(), dependency.getClassifier());
|
||||
Path path = new File(repository.getBasedir()).toPath().resolve(sourceLocation);
|
||||
sourceLocation = path.toString();
|
||||
String destName = path.getFileName().toString();
|
||||
Node fileNode = document.createElement("file");
|
||||
filesNode.appendChild(fileNode);
|
||||
|
||||
Node sourcesNode = document.createElement("source");
|
||||
sourcesNode.setTextContent(sourceLocation);
|
||||
fileNode.appendChild(sourcesNode);
|
||||
|
||||
Node outputDirNode = document.createElement("outputDirectory");
|
||||
outputDirNode.setTextContent("lib");
|
||||
fileNode.appendChild(outputDirNode);
|
||||
|
||||
Node destNameNode = document.createElement("destName");
|
||||
destNameNode.setTextContent(destName);
|
||||
fileNode.appendChild(destNameNode);
|
||||
} catch (CoreException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,14 +17,16 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.maven.model.Dependency;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.Plugin;
|
||||
import org.apache.maven.model.PluginExecution;
|
||||
import org.apache.maven.model.Profile;
|
||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
@@ -43,6 +45,7 @@ import org.talend.core.model.relationship.RelationshipItemBuilder;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
import org.talend.core.runtime.maven.MavenConstants;
|
||||
import org.talend.core.runtime.process.ITalendProcessJavaProject;
|
||||
import org.talend.core.runtime.process.TalendProcessArgumentConstant;
|
||||
import org.talend.core.runtime.process.TalendProcessOptionConstants;
|
||||
@@ -51,6 +54,7 @@ import org.talend.core.runtime.projectsetting.IProjectSettingTemplateConstants;
|
||||
import org.talend.designer.maven.model.TalendMavenConstants;
|
||||
import org.talend.designer.maven.template.MavenTemplateManager;
|
||||
import org.talend.designer.maven.tools.AggregatorPomsHelper;
|
||||
import org.talend.designer.maven.utils.PomIdsHelper;
|
||||
import org.talend.designer.maven.utils.PomUtil;
|
||||
import org.talend.designer.runprocess.IProcessor;
|
||||
import org.talend.repository.model.IProxyRepositoryFactory;
|
||||
@@ -186,22 +190,31 @@ public class CreateMavenStandardJobOSGiPom extends CreateMavenJobPom {
|
||||
|
||||
@Override
|
||||
protected void updateDependencySet(IFile assemblyFile) {
|
||||
Set<String> jobCoordinate = new HashSet<>();
|
||||
Map<String, Dependency> jobCoordinateMap = new HashMap<String, Dependency>();
|
||||
if (!hasLoopDependency()) {
|
||||
// add children jobs
|
||||
Set<JobInfo> childrenJobInfo = getJobProcessor().getBuildChildrenJobs();
|
||||
for (JobInfo jobInfo : childrenJobInfo) {
|
||||
jobCoordinate.add(getJobCoordinate(jobInfo.getProcessItem().getProperty()));
|
||||
Property property = jobInfo.getProcessItem().getProperty();
|
||||
String coordinate = getCoordinate(PomIdsHelper.getJobGroupId(property), PomIdsHelper.getJobArtifactId(jobInfo),
|
||||
MavenConstants.PACKAGING_JAR, PomIdsHelper.getJobVersion(property));
|
||||
Dependency dependency = getDependencyObject(PomIdsHelper.getJobGroupId(property), PomIdsHelper.getJobArtifactId(jobInfo), PomIdsHelper.getJobVersion(property),
|
||||
MavenConstants.PACKAGING_JAR, null);
|
||||
jobCoordinateMap.put(coordinate, dependency);
|
||||
}
|
||||
}
|
||||
// add current job
|
||||
Property currentJobProperty = getJobProcessor().getProperty();
|
||||
String parentCoordinate = getJobCoordinate(currentJobProperty);
|
||||
jobCoordinate.add(parentCoordinate);
|
||||
// add parent job
|
||||
Property parentProperty = this.getJobProcessor().getProperty();
|
||||
String parentCoordinate = getCoordinate(PomIdsHelper.getJobGroupId(parentProperty),
|
||||
PomIdsHelper.getJobArtifactId(parentProperty), MavenConstants.PACKAGING_JAR,
|
||||
PomIdsHelper.getJobVersion(parentProperty));
|
||||
Dependency parentDependency = getDependencyObject(PomIdsHelper.getJobGroupId(parentProperty), PomIdsHelper.getJobArtifactId(parentProperty), PomIdsHelper.getJobVersion(parentProperty),
|
||||
MavenConstants.PACKAGING_JAR, null);
|
||||
jobCoordinateMap.put(parentCoordinate, parentDependency);
|
||||
try {
|
||||
Document document = PomUtil.loadAssemblyFile(null, assemblyFile);
|
||||
// add jobs
|
||||
setupDependencySetNode(document, jobCoordinate, null, "${artifact.build.finalName}.${artifact.extension}", true,
|
||||
setupDependencySetNode(document, jobCoordinateMap, null, "${artifact.build.finalName}.${artifact.extension}", true,
|
||||
true);
|
||||
PomUtil.saveAssemblyFile(assemblyFile, document);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -98,7 +98,12 @@ public class MavenProjectUtils {
|
||||
IRunProcessService service = (IRunProcessService) GlobalServiceRegister.getDefault().getDefault()
|
||||
.getService(IRunProcessService.class);
|
||||
|
||||
changeClasspath(monitor, project, MavenSystemFolders.ALL_DIRS_EXT);
|
||||
if (service.isdebug()) {
|
||||
changeClasspath(monitor, project, MavenSystemFolders.ALL_DIRS_EXT);
|
||||
} else {
|
||||
|
||||
changeClasspath(monitor, project);
|
||||
}
|
||||
}
|
||||
|
||||
// only need this when pom has no parent.
|
||||
|
||||
@@ -34,7 +34,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
@@ -82,7 +81,6 @@ import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.relationship.Relation;
|
||||
import org.talend.core.model.relationship.RelationshipItemBuilder;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.model.utils.JavaResourcesHelper;
|
||||
import org.talend.core.nexus.TalendMavenResolver;
|
||||
@@ -98,7 +96,6 @@ import org.talend.designer.maven.template.MavenTemplateManager;
|
||||
import org.talend.designer.maven.tools.AggregatorPomsHelper;
|
||||
import org.talend.designer.maven.tools.ProcessorDependenciesManager;
|
||||
import org.talend.designer.runprocess.IProcessor;
|
||||
import org.talend.designer.runprocess.IRunProcessService;
|
||||
import org.talend.repository.ProjectManager;
|
||||
import org.talend.utils.xml.XmlUtils;
|
||||
import org.w3c.dom.Attr;
|
||||
@@ -1136,20 +1133,4 @@ public class PomUtil {
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
public static Set<Dependency> getCodesDependencies(ERepositoryObjectType codeType) {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
|
||||
IRunProcessService runProcessService = GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
|
||||
try {
|
||||
Model model = MODEL_MANAGER.readMavenModel(runProcessService.getTalendCodeJavaProject(codeType).getProjectPom());
|
||||
return model.getDependencies().stream().map(
|
||||
d -> createDependency(d.getGroupId(), d.getArtifactId(), d.getVersion(), d.getType(), d.getClassifier()))
|
||||
.peek(d -> ((SortableDependency) d).setAssemblyOptional(true)).collect(Collectors.toSet());
|
||||
} catch (CoreException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,80 +1,13 @@
|
||||
package org.talend.designer.maven.utils;
|
||||
|
||||
import org.apache.maven.artifact.versioning.ComparableVersion;
|
||||
import org.apache.maven.model.Dependency;
|
||||
|
||||
public class SortableDependency extends Dependency implements Comparable<SortableDependency> {
|
||||
|
||||
private static final long serialVersionUID = -6295226523517981508L;
|
||||
|
||||
/**
|
||||
* dependencies in testcase/routines/beans no need to be assembled in final zip.
|
||||
*/
|
||||
private boolean isAssemblyOptional;
|
||||
|
||||
@Override
|
||||
public int compareTo(SortableDependency o) {
|
||||
int compare = getArtifactId().compareTo(o.getArtifactId());
|
||||
if (compare == 0) {
|
||||
// FIXME according to Maven official Doc for dependencies:
|
||||
// https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
|
||||
// when pom has duplicate version of dependencies, Maven should take the first one
|
||||
// but in practice(maven 3.5.3 embedded), it always take the last one
|
||||
// we only need job dependencies in final job zip rather than testcase's
|
||||
// so we always put the latest job dependency at the bottom
|
||||
// if maven fix it in future, we need to reverse the order as well.
|
||||
if (isAssemblyOptional && !o.isAssemblyOptional) {
|
||||
return -1;
|
||||
}
|
||||
if (!isAssemblyOptional && o.isAssemblyOptional) {
|
||||
return 1;
|
||||
}
|
||||
return new ComparableVersion(getVersion()).compareTo(new ComparableVersion(o.getVersion()));
|
||||
}
|
||||
return compare;
|
||||
}
|
||||
|
||||
public boolean isAssemblyOptional() {
|
||||
return isAssemblyOptional;
|
||||
}
|
||||
|
||||
public void setAssemblyOptional(boolean isAssemblyOptional) {
|
||||
this.isAssemblyOptional = isAssemblyOptional;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = 17;
|
||||
result = 31 * result + (getGroupId() == null ? 0 : getGroupId().hashCode());
|
||||
result = 31 * result + (getArtifactId() == null ? 0 : getArtifactId().hashCode());
|
||||
result = 31 * result + (getVersion() == null ? 0 : getVersion().hashCode());
|
||||
result = 31 * result + (getType() == null ? 0 : getType().hashCode());
|
||||
result = 31 * result + (getClassifier() == null ? 0 : getClassifier().hashCode());
|
||||
result = 31 * result + (isAssemblyOptional() ? 1231 : 1237);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (!(obj instanceof SortableDependency)) {
|
||||
return false;
|
||||
}
|
||||
SortableDependency caseobj = (SortableDependency) obj;
|
||||
|
||||
return (getGroupId() == caseobj.getGroupId() || (getGroupId() != null && getGroupId().equals(caseobj.getGroupId())))
|
||||
&& (getArtifactId() == caseobj.getArtifactId()
|
||||
|| (getArtifactId() != null && getArtifactId().equals(caseobj.getArtifactId())))
|
||||
&& (getVersion() == caseobj.getVersion() || (getVersion() != null && getVersion().equals(caseobj.getVersion())))
|
||||
&& (getType() == caseobj.getType() || (getType() != null && getType().equals(caseobj.getType())))
|
||||
&& (getClassifier() == caseobj.getClassifier()
|
||||
|| (getClassifier() != null && getClassifier().equals(caseobj.getClassifier())))
|
||||
&& (isAssemblyOptional() == caseobj.isAssemblyOptional());
|
||||
return getArtifactId().compareTo(o.getArtifactId());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -85,7 +85,6 @@ import org.talend.core.model.general.ILibrariesService;
|
||||
import org.talend.core.model.general.ModuleNeeded.ELibraryInstallStatus;
|
||||
import org.talend.core.model.general.ModuleStatusProvider;
|
||||
import org.talend.core.model.general.ModuleToInstall;
|
||||
import org.talend.core.nexus.TalendLibsServerManager;
|
||||
import org.talend.core.runtime.maven.MavenConstants;
|
||||
import org.talend.designer.core.IDesignerCoreService;
|
||||
import org.talend.librariesmanager.ui.LibManagerUiPlugin;
|
||||
@@ -148,8 +147,7 @@ public class ExternalModulesInstallDialog extends TitleAreaDialog implements IMo
|
||||
}
|
||||
|
||||
private void checkNetworkStatus() {
|
||||
boolean networkValid = NetworkUtil
|
||||
.isNetworkValid(TalendLibsServerManager.getInstance().getTalentArtifactServer().getServer());
|
||||
boolean networkValid = NetworkUtil.isNetworkValid(System.getProperty("nexus.proxy.url"));
|
||||
if (!networkValid) {
|
||||
setErrorMessage(Messages.getString("ExternalModulesInstallDialog.networkUnavailable.msg")); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
@@ -148,8 +148,7 @@ public class RemoteModulesHelper {
|
||||
|
||||
Set<String> unavailableModules = new HashSet<String>();
|
||||
// if the network is not valid, all jars are not available.
|
||||
boolean networkValid = NetworkUtil
|
||||
.isNetworkValid(TalendLibsServerManager.getInstance().getTalentArtifactServer().getServer());
|
||||
boolean networkValid = NetworkUtil.isNetworkValid(System.getProperty("nexus.proxy.url"));
|
||||
if (!networkValid) {
|
||||
if (!alreadyWarnedAboutConnectionIssue) {
|
||||
log.warn("failed to connect to internet");
|
||||
|
||||
@@ -14,6 +14,7 @@ package routines.system;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.dom4j.Element;
|
||||
@@ -109,31 +110,26 @@ public class GetJarsToRegister {
|
||||
private String addLibsPath(String line, java.util.Map<String, String> crcMap) {
|
||||
for (java.util.Map.Entry<String, String> entry : crcMap.entrySet()) {
|
||||
line = adaptLibPaths(line, entry);
|
||||
if (new java.io.File(line).exists()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return line;
|
||||
}
|
||||
|
||||
private String adaptLibPaths(String line, java.util.Map.Entry<String, String> entry) {
|
||||
line = line.replace("\\", "/");
|
||||
String jarName = entry.getValue();
|
||||
String crc = entry.getKey();
|
||||
String libStringFinder = "../lib/" + jarName;
|
||||
String libStringFinder2 = "./" + jarName; // for the job jar itself.
|
||||
String replacement = "../../../cache/lib/" + crc + "/" + jarName;
|
||||
|
||||
if (line.contains(libStringFinder)) {
|
||||
line = line.replace(libStringFinder, replacement);
|
||||
line = line.replace(libStringFinder, "../../../cache/lib/" + crc + "/" + jarName);
|
||||
} else if (line.toLowerCase().contains(libStringFinder2)) {
|
||||
line = line.toLowerCase().replace(libStringFinder2, replacement);
|
||||
line = line.toLowerCase().replace(libStringFinder2, "../../../cache/lib/" + crc + "/" + jarName);
|
||||
} else if (line.toLowerCase().equals(jarName)) {
|
||||
line = replacement;
|
||||
line = "../../../cache/lib/" + crc + "/" + jarName;
|
||||
} else if (line.contains(":$ROOT_PATH/" + jarName + ":")) {
|
||||
line = line.replace(":$ROOT_PATH/" + jarName + ":", ":$ROOT_PATH/" + replacement + ":");
|
||||
line = line.replace(":$ROOT_PATH/" + jarName + ":", ":$ROOT_PATH/../../../cache/lib/" + crc + "/" + jarName + ":");
|
||||
} else if (line.contains(";" + jarName + ";")) {
|
||||
line = line.replace(";" + jarName + ";", ";" + replacement + ";");
|
||||
line = line.replace(";" + jarName + ";", ";../../../cache/lib/" + crc + "/" + jarName + ";");
|
||||
}
|
||||
return line;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,10 @@
|
||||
package org.talend.librariesmanager.maven;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
@@ -21,6 +24,9 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.codehaus.jackson.map.util.ISO8601Utils;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
@@ -35,8 +41,7 @@ import org.talend.core.nexus.TalendLibsServerManager;
|
||||
import org.talend.core.runtime.maven.MavenArtifact;
|
||||
import org.talend.core.runtime.maven.MavenUrlHelper;
|
||||
import org.talend.librariesmanager.i18n.Messages;
|
||||
import org.talend.librariesmanager.model.service.LocalLibraryManager;
|
||||
import org.talend.librariesmanager.nexus.utils.ShareLibrariesUtil;
|
||||
import org.talend.librariesmanager.nexus.utils.VersionUtil;
|
||||
|
||||
/**
|
||||
* created by Talend on 2015年7月31日 Detailled comment
|
||||
@@ -91,7 +96,7 @@ public abstract class ShareLibrareisHelper {
|
||||
if (searchResults != null) {
|
||||
for (MavenArtifact result : searchResults) {
|
||||
checkCancel(monitor);
|
||||
ShareLibrariesUtil.putArtifactToMap(result, releaseArtifactMap, false);
|
||||
putArtifactToMap(result, releaseArtifactMap, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -101,7 +106,7 @@ public abstract class ShareLibrareisHelper {
|
||||
if (searchResults != null) {
|
||||
for (MavenArtifact result : searchResults) {
|
||||
checkCancel(monitor);
|
||||
ShareLibrariesUtil.putArtifactToMap(result, snapshotArtifactMap, true);
|
||||
putArtifactToMap(result, snapshotArtifactMap, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -116,12 +121,6 @@ public abstract class ShareLibrareisHelper {
|
||||
if (artifact == null) {
|
||||
continue;
|
||||
}
|
||||
// If from custom component definition file
|
||||
if (LocalLibraryManager.isSystemCacheFile(file.getName())
|
||||
|| (LocalLibraryManager.isComponentDefinitionFileType(file.getName())
|
||||
&& isTalendLibraryGroupId(artifact))) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
Integer.parseInt(artifact.getType());
|
||||
// FIXME unexpected type if it's an integer, should fix it in component module definition.
|
||||
@@ -130,7 +129,7 @@ public abstract class ShareLibrareisHelper {
|
||||
//
|
||||
}
|
||||
boolean isSnapshotVersion = isSnapshotVersion(artifact.getVersion());
|
||||
String key = ShareLibrariesUtil.getArtifactKey(artifact, isSnapshotVersion);
|
||||
String key = getArtifactKey(artifact, isSnapshotVersion);
|
||||
List<MavenArtifact> artifactList = null;
|
||||
if (isSnapshotVersion) {
|
||||
artifactList = snapshotArtifactMap.get(key);
|
||||
@@ -143,8 +142,7 @@ public abstract class ShareLibrareisHelper {
|
||||
}
|
||||
}
|
||||
if (artifactList != null && artifactList.size() > 0) {
|
||||
if (ShareLibrariesUtil.isSameFileWithRemote(file, artifactList, customNexusServer, customerRepHandler,
|
||||
isSnapshotVersion)) {
|
||||
if (isSameFileWithRemote(file, artifactList, customNexusServer)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -175,19 +173,92 @@ public abstract class ShareLibrareisHelper {
|
||||
|
||||
}
|
||||
|
||||
private boolean isTalendLibraryGroupId(MavenArtifact artifact) {
|
||||
if ("org.talend.libraries".equalsIgnoreCase(artifact.getGroupId())) {
|
||||
public void putArtifactToMap(MavenArtifact artifact, Map<String, List<MavenArtifact>> map, boolean isShapshot) {
|
||||
String key = getArtifactKey(artifact, isShapshot);
|
||||
List<MavenArtifact> list = map.get(key);
|
||||
if (list == null) {
|
||||
list = new ArrayList<MavenArtifact>();
|
||||
map.put(key, list);
|
||||
}
|
||||
list.add(artifact);
|
||||
}
|
||||
|
||||
private String getArtifactKey(MavenArtifact artifact, boolean isShapshot) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(artifact.getGroupId()).append("-");
|
||||
sb.append(artifact.getArtifactId()).append("-");
|
||||
String version = artifact.getVersion();
|
||||
if (isShapshot) {
|
||||
version = VersionUtil.getSNAPSHOTVersion(version);
|
||||
}
|
||||
sb.append(version);
|
||||
if (StringUtils.isNotEmpty(artifact.getClassifier())) {
|
||||
sb.append("-").append(artifact.getClassifier());
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private boolean isSameFileWithRemote(File localFile, List<MavenArtifact> artifactList,
|
||||
ArtifactRepositoryBean customNexusServer) throws Exception {
|
||||
String localFileShaCode = DigestUtils.shaHex(new FileInputStream(localFile));
|
||||
MavenArtifact lastUpdatedArtifact = null;
|
||||
if (ArtifactRepositoryBean.NexusType.ARTIFACTORY.name().equalsIgnoreCase(customNexusServer.getType())) {
|
||||
lastUpdatedArtifact = getLateUpdatedMavenArtifact(artifactList);
|
||||
} else {
|
||||
lastUpdatedArtifact = artifactList.stream().max(Comparator.comparing(e -> e.getVersion())).get();
|
||||
}
|
||||
if (lastUpdatedArtifact != null && StringUtils.equals(localFileShaCode, lastUpdatedArtifact.getSha1())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private MavenArtifact getLateUpdatedMavenArtifact(List<MavenArtifact> artifactList) {
|
||||
if (artifactList.size() == 1) {
|
||||
return artifactList.get(0);
|
||||
}
|
||||
MavenArtifact latestVersion = null;
|
||||
Date lastUpdate = null;
|
||||
for (MavenArtifact art : artifactList) {
|
||||
if (latestVersion == null) {
|
||||
if (art.getLastUpdated() != null) {
|
||||
latestVersion = art;
|
||||
lastUpdate = parsetDate(art.getLastUpdated());
|
||||
}
|
||||
} else if (art.getLastUpdated() != null && lastUpdate != null) {
|
||||
Date artLastUpdate = parsetDate(art.getLastUpdated());
|
||||
if (artLastUpdate != null && lastUpdate.getTime() < artLastUpdate.getTime()) {
|
||||
latestVersion = art;
|
||||
lastUpdate = artLastUpdate;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (latestVersion != null) {
|
||||
return latestVersion;
|
||||
} else {
|
||||
return artifactList.get(artifactList.size() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
private Date parsetDate(String strDate) {
|
||||
Date date = null;
|
||||
if (strDate != null) {
|
||||
try {
|
||||
date = ISO8601Utils.parse(strDate);
|
||||
} catch (Exception ex) {
|
||||
ExceptionHandler.process(ex);
|
||||
}
|
||||
}
|
||||
return date;
|
||||
}
|
||||
|
||||
private boolean isSnapshotVersion(String version) {
|
||||
if (version != null && version.toUpperCase().endsWith(MavenUrlHelper.VERSION_SNAPSHOT)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void setJobName(Job job, String jobName) {
|
||||
if (job != null) {
|
||||
job.setName(jobName);
|
||||
|
||||
@@ -29,7 +29,6 @@ import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -62,10 +61,10 @@ import org.talend.core.model.components.ComponentProviderInfo;
|
||||
import org.talend.core.model.components.IComponent;
|
||||
import org.talend.core.model.components.IComponentsService;
|
||||
import org.talend.core.model.general.ILibrariesService;
|
||||
import org.talend.core.model.general.ILibrariesService.IChangedLibrariesListener;
|
||||
import org.talend.core.model.general.ModuleNeeded;
|
||||
import org.talend.core.model.general.ModuleNeeded.ELibraryInstallStatus;
|
||||
import org.talend.core.model.general.ModuleStatusProvider;
|
||||
import org.talend.core.model.general.ILibrariesService.IChangedLibrariesListener;
|
||||
import org.talend.core.model.general.ModuleNeeded.ELibraryInstallStatus;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.nexus.ArtifactRepositoryBean;
|
||||
import org.talend.core.nexus.IRepositoryArtifactHandler;
|
||||
@@ -85,7 +84,6 @@ import org.talend.designer.maven.utils.PomUtil;
|
||||
import org.talend.librariesmanager.maven.MavenArtifactsHandler;
|
||||
import org.talend.librariesmanager.model.ExtensionModuleManager;
|
||||
import org.talend.librariesmanager.model.ModulesNeededProvider;
|
||||
import org.talend.librariesmanager.nexus.utils.ShareLibrariesUtil;
|
||||
import org.talend.librariesmanager.prefs.LibrariesManagerUtils;
|
||||
import org.talend.osgi.hook.notification.JarMissingObservable;
|
||||
|
||||
@@ -117,18 +115,6 @@ public class LocalLibraryManager implements ILibraryManagerService, IChangedLibr
|
||||
|
||||
private static final String DYNAMIC_DISTRIBUTION_HOST_URL = NexusConstants.DYNAMIC_DISTRIBUTION.substring(8);
|
||||
|
||||
private static final List<String> COMPONENT_DEFINITION_FILE_TYPE_LIST = new ArrayList<String>() {
|
||||
|
||||
{
|
||||
add(".javajet");
|
||||
add(".png");
|
||||
add(".jpg");
|
||||
add("_java.xml");
|
||||
add(".properties");
|
||||
add(".txt");
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* DOC nrousseau LocalLibraryManager constructor comment.
|
||||
*/
|
||||
@@ -329,15 +315,15 @@ public class LocalLibraryManager implements ILibraryManagerService, IChangedLibr
|
||||
return retrieve(testModule, pathToStore, popUp, refresh);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean retrieve(String jarNeeded, String mavenUri, String pathToStore, IProgressMonitor... monitorWrap) {
|
||||
ModuleNeeded testModule = new ModuleNeeded("", jarNeeded, "", true);
|
||||
if (mavenUri != null) {
|
||||
testModule.setMavenUri(mavenUri);
|
||||
}
|
||||
@Override
|
||||
public boolean retrieve(String jarNeeded, String mavenUri, String pathToStore, IProgressMonitor... monitorWrap) {
|
||||
ModuleNeeded testModule = new ModuleNeeded("", jarNeeded, "", true);
|
||||
if(mavenUri != null) {
|
||||
testModule.setMavenUri(mavenUri);
|
||||
}
|
||||
boolean refresh = true;
|
||||
return retrieve(testModule, pathToStore, true, refresh);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean retrieve(ModuleNeeded module, String pathToStore, boolean showDialog, boolean refresh) {
|
||||
@@ -419,24 +405,6 @@ public class LocalLibraryManager implements ILibraryManagerService, IChangedLibr
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isComponentDefinitionFileType(String fileName) {
|
||||
if (fileName != null) {
|
||||
for (String type : COMPONENT_DEFINITION_FILE_TYPE_LIST) {
|
||||
if (fileName.toLowerCase().endsWith(type)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isSystemCacheFile(String fileName) {
|
||||
if ("Thumbs.db".equals(fileName)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private File retrieveJarFromLocal(ModuleNeeded module) {
|
||||
File jarFile = null;
|
||||
Set<String> toResolve = guessMavenURI(module);
|
||||
@@ -1350,8 +1318,7 @@ public class LocalLibraryManager implements ILibraryManagerService, IChangedLibr
|
||||
if (jarFiles.size() > 0) {
|
||||
for (File jarFile : jarFiles) {
|
||||
String name = jarFile.getName();
|
||||
if (!canDeployFromCustomComponentFolder(name)
|
||||
|| platformURLMap.get(name) != null) {
|
||||
if (platformURLMap.get(name) != null) {
|
||||
continue;
|
||||
}
|
||||
needToDeploy.add(jarFile);
|
||||
@@ -1371,82 +1338,29 @@ public class LocalLibraryManager implements ILibraryManagerService, IChangedLibr
|
||||
}
|
||||
|
||||
// deploy needed jars for User and Exchange component providers
|
||||
Map<String, List<MavenArtifact>> snapshotArtifactMap = new HashMap<String, List<MavenArtifact>>();
|
||||
Map<String, List<MavenArtifact>> releaseArtifactMap = new HashMap<String, List<MavenArtifact>>();
|
||||
if (!needToDeploy.isEmpty()) {
|
||||
// search on nexus to avoid deploy the jar many times
|
||||
Set<File> existFiles = new HashSet<>();
|
||||
ArtifactRepositoryBean customNexusServer = TalendLibsServerManager.getInstance().getCustomNexusServer();
|
||||
IRepositoryArtifactHandler customerRepHandler = RepositoryArtifactHandlerManager
|
||||
.getRepositoryHandler(customNexusServer);
|
||||
List<MavenArtifact> snapshotResult = new ArrayList<>();
|
||||
List<MavenArtifact> releaseResult = new ArrayList<>();
|
||||
try {
|
||||
snapshotResult = customerRepHandler.search(MavenConstants.DEFAULT_LIB_GROUP_ID, null, null, false, true);
|
||||
if (snapshotResult != null) {
|
||||
for (MavenArtifact result : snapshotResult) {
|
||||
ShareLibrariesUtil.putArtifactToMap(result, releaseArtifactMap, true);
|
||||
}
|
||||
}
|
||||
releaseResult = customerRepHandler.search(MavenConstants.DEFAULT_LIB_GROUP_ID, null, null, true, false);
|
||||
if (releaseResult != null) {
|
||||
for (MavenArtifact result : releaseResult) {
|
||||
ShareLibrariesUtil.putArtifactToMap(result, releaseArtifactMap, false);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
for(File exsitFile:needToDeploy) {
|
||||
if (customerRepHandler != null) {
|
||||
try {
|
||||
String name = exsitFile.getName();
|
||||
String mvnUrlSnapshot = MavenUrlHelper.generateMvnUrlForJarName(name, true, true);
|
||||
MavenArtifact artifactSnapshot = MavenUrlHelper.parseMvnUrl(mvnUrlSnapshot);
|
||||
String keySnapshot = ShareLibrariesUtil.getArtifactKey(artifactSnapshot, true);
|
||||
List<MavenArtifact> artifactListSnapshot = null;
|
||||
artifactListSnapshot = snapshotArtifactMap.get(keySnapshot);
|
||||
// snapshot
|
||||
if (artifactListSnapshot != null && artifactListSnapshot.size() > 0) {
|
||||
if (ShareLibrariesUtil.isSameFileWithRemote(exsitFile, artifactListSnapshot, customNexusServer,
|
||||
customerRepHandler, false)) {
|
||||
existFiles.add(exsitFile);
|
||||
}
|
||||
}
|
||||
// release
|
||||
String mvnUrlRelease = MavenUrlHelper.generateMvnUrlForJarName(name, true, false);
|
||||
MavenArtifact artifactRelease = MavenUrlHelper.parseMvnUrl(mvnUrlRelease);
|
||||
String keyRelease = ShareLibrariesUtil.getArtifactKey(artifactRelease, false);
|
||||
List<MavenArtifact> artifactListRelease = null;
|
||||
artifactListRelease = releaseArtifactMap.get(keyRelease);
|
||||
if (artifactListRelease != null && artifactListRelease.size() > 0) {
|
||||
if (ShareLibrariesUtil.isSameFileWithRemote(exsitFile, artifactListRelease, customNexusServer,
|
||||
customerRepHandler, false)) {
|
||||
existFiles.add(exsitFile);
|
||||
}
|
||||
}
|
||||
}catch(Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
needToDeploy.removeAll(existFiles);
|
||||
// check sha code to avoid same jar in diff component depoly multi times
|
||||
Map<String, File> shaMap = new HashMap<>();
|
||||
Iterator<File> it = needToDeploy.iterator();
|
||||
while (it.hasNext()) {
|
||||
if (customerRepHandler != null) {
|
||||
List<MavenArtifact> searchResult = new ArrayList<>();
|
||||
try {
|
||||
File dupFile = it.next();
|
||||
String localFileShaCode = DigestUtils.shaHex(new FileInputStream(dupFile));
|
||||
if (shaMap.get(localFileShaCode) == null) {
|
||||
shaMap.put(localFileShaCode, dupFile);
|
||||
} else {
|
||||
it.remove();
|
||||
}
|
||||
searchResult = customerRepHandler.search(MavenConstants.DEFAULT_LIB_GROUP_ID, null, null, true, true);
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
for (MavenArtifact artifact : searchResult) {
|
||||
for (File file : needToDeploy) {
|
||||
if (artifact.getFileName().equals(file.getName())) {
|
||||
existFiles.add(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
needToDeploy.removeAll(existFiles);
|
||||
for (File file : needToDeploy) {
|
||||
try {
|
||||
// deploy as release version if can't find mvn url from index
|
||||
@@ -1459,14 +1373,6 @@ public class LocalLibraryManager implements ILibraryManagerService, IChangedLibr
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private boolean canDeployFromCustomComponentFolder(String fileName) {
|
||||
if (isSystemCacheFile(fileName) || isComponentDefinitionFileType(fileName)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void warnDuplicated(List<ModuleNeeded> modules, Set<String> duplicates, String type) {
|
||||
for (String lib : duplicates) {
|
||||
Set<String> components = new HashSet<>();
|
||||
|
||||
@@ -218,10 +218,4 @@ public abstract class AbstractArtifactRepositoryHandler implements IRepositoryAr
|
||||
|
||||
@Override
|
||||
public abstract IRepositoryArtifactHandler clone();
|
||||
|
||||
@Override
|
||||
public String resolveRemoteSha1(MavenArtifact artifact, boolean fromRelease) throws Exception {
|
||||
return artifact.getSha1();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -177,12 +177,5 @@ public class Nexus2RepositoryHandler extends AbstractArtifactRepositoryHandler {
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolveRemoteSha1(MavenArtifact artifact, boolean fromRelease) throws Exception {
|
||||
return NexusServerUtils.resolveSha1(serverBean.getServer(), serverBean.getUserName(), serverBean.getPassword(),
|
||||
fromRelease ? serverBean.getRepositoryId() : serverBean.getSnapshotRepId(), artifact.getGroupId(),
|
||||
artifact.getArtifactId(), artifact.getVersion(), artifact.getType());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,126 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// 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.librariesmanager.nexus.utils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.codehaus.jackson.map.util.ISO8601Utils;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.core.nexus.ArtifactRepositoryBean;
|
||||
import org.talend.core.nexus.IRepositoryArtifactHandler;
|
||||
import org.talend.core.runtime.maven.MavenArtifact;
|
||||
|
||||
public class ShareLibrariesUtil {
|
||||
|
||||
public static boolean isSameFileWithRemote(File localFile, List<MavenArtifact> artifactList,
|
||||
ArtifactRepositoryBean customNexusServer, IRepositoryArtifactHandler customerRepHandler, boolean isSnapshotVersion)
|
||||
throws Exception {
|
||||
String localFileShaCode = DigestUtils.shaHex(new FileInputStream(localFile));
|
||||
String remoteSha1 = null;
|
||||
if (ArtifactRepositoryBean.NexusType.ARTIFACTORY.name().equalsIgnoreCase(customNexusServer.getType())) {
|
||||
MavenArtifact lastUpdatedArtifact = getLateUpdatedMavenArtifact(artifactList);
|
||||
if (lastUpdatedArtifact != null) {
|
||||
remoteSha1 = lastUpdatedArtifact.getSha1();
|
||||
}
|
||||
} else if (ArtifactRepositoryBean.NexusType.NEXUS_3.name().equalsIgnoreCase(customNexusServer.getType())) {
|
||||
MavenArtifact lastUpdatedArtifact = artifactList.stream().max(Comparator.comparing(e -> e.getVersion())).get();
|
||||
if (lastUpdatedArtifact != null) {
|
||||
remoteSha1 = lastUpdatedArtifact.getSha1();
|
||||
}
|
||||
} else {
|
||||
if (!isSnapshotVersion && !Boolean.getBoolean("force_libs_release_update")) {
|
||||
return true;
|
||||
}
|
||||
MavenArtifact lastUpdatedArtifact = artifactList.get(0);
|
||||
if (lastUpdatedArtifact != null) {
|
||||
remoteSha1 = customerRepHandler.resolveRemoteSha1(lastUpdatedArtifact, !isSnapshotVersion);
|
||||
}
|
||||
}
|
||||
if (StringUtils.equals(localFileShaCode, remoteSha1)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static MavenArtifact getLateUpdatedMavenArtifact(List<MavenArtifact> artifactList) {
|
||||
if (artifactList.size() == 1) {
|
||||
return artifactList.get(0);
|
||||
}
|
||||
MavenArtifact latestVersion = null;
|
||||
Date lastUpdate = null;
|
||||
for (MavenArtifact art : artifactList) {
|
||||
if (latestVersion == null) {
|
||||
if (art.getLastUpdated() != null) {
|
||||
latestVersion = art;
|
||||
lastUpdate = parsetDate(art.getLastUpdated());
|
||||
}
|
||||
} else if (art.getLastUpdated() != null && lastUpdate != null) {
|
||||
Date artLastUpdate = parsetDate(art.getLastUpdated());
|
||||
if (artLastUpdate != null && lastUpdate.getTime() < artLastUpdate.getTime()) {
|
||||
latestVersion = art;
|
||||
lastUpdate = artLastUpdate;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (latestVersion != null) {
|
||||
return latestVersion;
|
||||
} else {
|
||||
return artifactList.get(artifactList.size() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
private static Date parsetDate(String strDate) {
|
||||
Date date = null;
|
||||
if (strDate != null) {
|
||||
try {
|
||||
date = ISO8601Utils.parse(strDate);
|
||||
} catch (Exception ex) {
|
||||
ExceptionHandler.process(ex);
|
||||
}
|
||||
}
|
||||
return date;
|
||||
}
|
||||
|
||||
public static void putArtifactToMap(MavenArtifact artifact, Map<String, List<MavenArtifact>> map, boolean isShapshot) {
|
||||
String key = getArtifactKey(artifact, isShapshot);
|
||||
List<MavenArtifact> list = map.get(key);
|
||||
if (list == null) {
|
||||
list = new ArrayList<MavenArtifact>();
|
||||
map.put(key, list);
|
||||
}
|
||||
list.add(artifact);
|
||||
}
|
||||
|
||||
public static String getArtifactKey(MavenArtifact artifact, boolean isShapshot) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(artifact.getGroupId()).append("-");
|
||||
sb.append(artifact.getArtifactId()).append("-");
|
||||
String version = artifact.getVersion();
|
||||
if (isShapshot) {
|
||||
version = VersionUtil.getSNAPSHOTVersion(version);
|
||||
}
|
||||
sb.append(version);
|
||||
if (StringUtils.isNotEmpty(artifact.getClassifier())) {
|
||||
sb.append("-").append(artifact.getClassifier());
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -72,8 +72,6 @@ import org.talend.core.model.metadata.MetadataTalendType;
|
||||
import org.talend.core.model.utils.ResourceModelHelper;
|
||||
import org.talend.core.model.utils.XSDValidater;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||
import org.talend.core.runtime.projectsetting.ProjectPreferenceManager;
|
||||
import org.talend.metadata.managment.ui.MetadataManagmentUiPlugin;
|
||||
import org.talend.metadata.managment.ui.dialog.MappingFileCheckViewerDialog;
|
||||
import org.talend.metadata.managment.ui.i18n.Messages;
|
||||
@@ -545,12 +543,12 @@ public class MetadataTalendTypeEditor extends FieldEditor {
|
||||
if (info != null) {
|
||||
String id = null;
|
||||
String infoName = info.fileName;
|
||||
for (Dbms allDbm : allDbms) {
|
||||
if (allDbm.getLabel().equalsIgnoreCase(infoName.substring(0, infoName.indexOf(".")).replace("_", " "))) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
id = allDbm.getId();
|
||||
for (int i = 0; i < allDbms.length; i++) {
|
||||
if (allDbms[i].getLabel().equalsIgnoreCase(infoName.substring(0, infoName.indexOf(".")).replace("_", " "))) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
id = allDbms[i].getId();
|
||||
}
|
||||
}
|
||||
setSelectId(id);
|
||||
setSelectId(id); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -571,7 +569,7 @@ public class MetadataTalendTypeEditor extends FieldEditor {
|
||||
if (confirm) {
|
||||
ICoreService coreService = null;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreService.class)) {
|
||||
coreService = GlobalServiceRegister.getDefault().getService(ICoreService.class);
|
||||
coreService = (ICoreService) GlobalServiceRegister.getDefault().getService(ICoreService.class);
|
||||
coreService.syncMappingsFileFromSystemToProject();
|
||||
tmpFileManager.reload();
|
||||
}
|
||||
@@ -688,9 +686,6 @@ public class MetadataTalendTypeEditor extends FieldEditor {
|
||||
}
|
||||
if (needReload) {
|
||||
tmpFileManager.reload();
|
||||
ProjectPreferenceManager manager = CoreRuntimePlugin.getInstance().getProjectPreferenceManager();
|
||||
manager.setValue(MetadataTalendType.UPDATED_MAPPING_FILES, true);
|
||||
manager.save();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1634,10 +1634,6 @@ public final class DBConnectionContextUtils {
|
||||
String impalaPrin = conn.getParameters().get(ConnParameterKeys.IMPALA_AUTHENTICATION_PRINCIPLA);
|
||||
conn.getParameters().put(ConnParameterKeys.IMPALA_AUTHENTICATION_PRINCIPLA,
|
||||
ContextParameterUtils.getOriginalValue(contextType, impalaPrin));
|
||||
String addtionalJDBCParameters = conn.getParameters()
|
||||
.get(ConnParameterKeys.CONN_PARA_KEY_HIVE_ADDITIONAL_JDBC_SETTINGS);
|
||||
conn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_HIVE_ADDITIONAL_JDBC_SETTINGS,
|
||||
ContextParameterUtils.getOriginalValue(contextType, addtionalJDBCParameters));
|
||||
}
|
||||
|
||||
if (EDatabaseTypeName.ORACLE_CUSTOM.equals(EDatabaseTypeName.getTypeFromDbType(conn.getDatabaseType()))) {
|
||||
|
||||
@@ -135,7 +135,6 @@ public class ExtendedNodeConnectionContextUtils {
|
||||
|
||||
// DataBricks
|
||||
DataBricksEndpoint,
|
||||
DataBricksCloudProvider,
|
||||
DataBricksClusterId,
|
||||
DataBricksToken,
|
||||
DataBricksDBFSDepFolder
|
||||
|
||||
@@ -67,25 +67,13 @@ public class ContextSetsSelectionDialog extends SelectionDialog {
|
||||
initSets();
|
||||
}
|
||||
|
||||
public ContextSetsSelectionDialog(ContextItem contextItem) {
|
||||
this(calcShell(), contextItem, false);
|
||||
}
|
||||
|
||||
public ContextSetsSelectionDialog(List<ContextType> contexts, String defaultContextName, boolean canCancel) {
|
||||
super(calcShell());
|
||||
initDialog(contexts, canCancel, Messages.getString("ContextSetsSelectionDialog.ReportMessages")); //$NON-NLS-1$
|
||||
this.defalutContext = defaultContextName;
|
||||
initSets();
|
||||
}
|
||||
|
||||
public ContextSetsSelectionDialog(Shell parentShell, Object source, boolean canCancel, String defaultContextName,
|
||||
String message) {
|
||||
super(parentShell == null ? calcShell() : parentShell);
|
||||
initDialog(source, canCancel, message); // $NON-NLS-1$
|
||||
this.defalutContext = defaultContextName;
|
||||
initSets();
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC xqliu Comment method "initDialog".
|
||||
*
|
||||
* @param object
|
||||
* @param cancelFlag
|
||||
* @param message
|
||||
*/
|
||||
private void initDialog(Object object, boolean cancelFlag, String message) {
|
||||
this.source = object;
|
||||
this.canCancel = cancelFlag;
|
||||
@@ -101,6 +89,17 @@ public class ContextSetsSelectionDialog extends SelectionDialog {
|
||||
newShell.setImage(ImageProvider.getImage(ECoreImage.CONTEXT_ICON));
|
||||
}
|
||||
|
||||
public ContextSetsSelectionDialog(ContextItem contextItem) {
|
||||
this(calcShell(), contextItem, false);
|
||||
}
|
||||
|
||||
public ContextSetsSelectionDialog(List<ContextType> contexts, String defaultContextName, boolean canCancel) {
|
||||
super(calcShell());
|
||||
initDialog(contexts, canCancel, Messages.getString("ContextSetsSelectionDialog.ReportMessages")); //$NON-NLS-1$
|
||||
this.defalutContext = defaultContextName;
|
||||
initSets();
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC zli Comment method "calcShell".
|
||||
*
|
||||
|
||||
@@ -1039,7 +1039,7 @@ public class ExtractMetaDataUtils {
|
||||
if (driverJarPathArg.contains(";")) {
|
||||
String jars[] = driverJarPathArg.split(";");
|
||||
for (String jar : jars) {
|
||||
String jarName = librairesManagerService.getJarNameFromMavenuri(jar);
|
||||
String jarName = librairesManagerService.getJarNameFromMavenuri(driverJarPathArg);
|
||||
// TDQ-16842 msjian:sometimes for the import jdbc connection, the jarName is null
|
||||
if (jarName == null) {
|
||||
jarName = jar.split("/")[1] + ".jar";
|
||||
|
||||
@@ -31,7 +31,6 @@ import org.talend.core.classloader.ClassLoaderFactory;
|
||||
import org.talend.core.classloader.DynamicClassLoader;
|
||||
import org.talend.core.database.EDatabase4DriverClassName;
|
||||
import org.talend.core.database.EDatabaseTypeName;
|
||||
import org.talend.core.database.EImpalaDriver;
|
||||
import org.talend.core.database.conn.ConnParameterKeys;
|
||||
import org.talend.core.hadoop.IHadoopDistributionService;
|
||||
import org.talend.core.hadoop.conf.EHadoopConfProperties;
|
||||
@@ -39,7 +38,6 @@ import org.talend.core.model.metadata.IMetadataConnection;
|
||||
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||
import org.talend.core.runtime.hd.IHDistribution;
|
||||
import org.talend.core.runtime.hd.IHDistributionVersion;
|
||||
import org.talend.core.runtime.hd.hive.HiveMetadataHelper;
|
||||
import org.talend.core.utils.ReflectionUtils;
|
||||
|
||||
import metadata.managment.i18n.Messages;
|
||||
@@ -73,13 +71,15 @@ public class ImpalaConnectionManager extends DataBaseConnectionManager {
|
||||
String connURL = metadataConn.getUrl();
|
||||
String username = metadataConn.getUsername();
|
||||
String password = metadataConn.getPassword();
|
||||
|
||||
// 1. Get class loader.
|
||||
ClassLoader currClassLoader = Thread.currentThread().getContextClassLoader();
|
||||
ClassLoader impalaClassLoader = getClassLoader(metadataConn);
|
||||
Thread.currentThread().setContextClassLoader(impalaClassLoader);
|
||||
try {
|
||||
// 2. Fetch the HiveDriver from the new classloader
|
||||
String driverClass = EDatabase4DriverClassName.IMPALA.getDriverClass();
|
||||
Class<?> driver = Class.forName(EDatabase4DriverClassName.IMPALA.getDriverClass(), true, impalaClassLoader);
|
||||
Driver hiveDriver = (Driver) driver.newInstance();
|
||||
|
||||
Map<String, Object> otherParametersMap = metadataConn.getOtherParameters();
|
||||
if (otherParametersMap != null) {
|
||||
@@ -92,60 +92,7 @@ public class ImpalaConnectionManager extends DataBaseConnectionManager {
|
||||
ReflectionUtils.invokeStaticMethod("org.apache.hadoop.security.UserGroupInformation", //$NON-NLS-1$
|
||||
impalaClassLoader, "setConfiguration", new Object[] { conf }); //$NON-NLS-1$
|
||||
}
|
||||
// addtional jdbc settings
|
||||
Object jdbcObj = otherParametersMap.get(ConnParameterKeys.CONN_PARA_KEY_HIVE_ADDITIONAL_JDBC_SETTINGS);
|
||||
if (jdbcObj != null) {
|
||||
String addJDBCSetting = String.valueOf(jdbcObj);
|
||||
if (!"".equals(addJDBCSetting.trim())) {
|
||||
if (!addJDBCSetting.startsWith(";")) {
|
||||
addJDBCSetting = ";" + addJDBCSetting;
|
||||
}
|
||||
connURL += addJDBCSetting;
|
||||
}
|
||||
}
|
||||
IHadoopDistributionService hadoopService = getHadoopDistributionService();
|
||||
if ((hadoopService != null)) {
|
||||
// driver
|
||||
Object driverObj = otherParametersMap.get(ConnParameterKeys.IMPALA_DRIVER);
|
||||
String driverType = null;
|
||||
String impalaDriver = null;
|
||||
if (driverObj != null) {
|
||||
driverType = String.valueOf(driverObj);
|
||||
}
|
||||
// distribution
|
||||
Object distObj = otherParametersMap.get(ConnParameterKeys.CONN_PARA_KEY_IMPALA_DISTRIBUTION);
|
||||
String distribution = null;
|
||||
if (distObj != null) {
|
||||
distribution = String.valueOf(distObj);
|
||||
}
|
||||
// version
|
||||
Object versionObj = otherParametersMap.get(ConnParameterKeys.CONN_PARA_KEY_IMPALA_VERSION);
|
||||
String version = null;
|
||||
if (versionObj != null) {
|
||||
version = String.valueOf(versionObj);
|
||||
}
|
||||
IHDistribution impalaDistribution = hadoopService.getImpalaDistributionManager()
|
||||
.getDistribution(distribution, false);
|
||||
if (distribution != null && version != null) {
|
||||
if (driverType != null && !"".equals(driverType.trim()) && (impalaDistribution.useCustom()
|
||||
|| HiveMetadataHelper.doSupportHive2(distribution, version, false))) {
|
||||
if (EImpalaDriver.HIVE2.getDisplayName().equalsIgnoreCase(driverType)) {
|
||||
driverClass = EImpalaDriver.HIVE2.getDriver();
|
||||
}
|
||||
if (EImpalaDriver.IMPALA40.getDisplayName().equalsIgnoreCase(driverType)) {
|
||||
driverClass = EImpalaDriver.IMPALA40.getDriver();
|
||||
}
|
||||
if (EImpalaDriver.IMPALA41.getDisplayName().equalsIgnoreCase(driverType)) {
|
||||
driverClass = EImpalaDriver.IMPALA41.getDriver();
|
||||
}
|
||||
} else {
|
||||
throw new IllegalArgumentException("impala can not work with Hive1");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Class<?> driver = Class.forName(driverClass, true, impalaClassLoader);
|
||||
Driver hiveDriver = (Driver) driver.newInstance();
|
||||
|
||||
// 3. Try to connect by driver
|
||||
Properties info = new Properties();
|
||||
|
||||
@@ -24,12 +24,10 @@ import java.util.Map;
|
||||
|
||||
import javax.xml.ws.BindingProvider;
|
||||
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.classloader.ClassLoaderFactory;
|
||||
import org.talend.core.classloader.DynamicClassLoader;
|
||||
import org.talend.core.model.metadata.builder.connection.MDMConnection;
|
||||
import org.talend.core.model.metadata.designerproperties.MDMVersions;
|
||||
import org.talend.core.service.IMDMWebServiceHook;
|
||||
import org.talend.core.utils.ReflectionUtils;
|
||||
|
||||
/**
|
||||
@@ -38,8 +36,6 @@ import org.talend.core.utils.ReflectionUtils;
|
||||
*/
|
||||
public class S60MdmConnectionHelper extends AbsMdmConnectionHelper {
|
||||
|
||||
private IMDMWebServiceHook webServceHook;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
@@ -61,31 +57,18 @@ public class S60MdmConnectionHelper extends AbsMdmConnectionHelper {
|
||||
if (!newUrl.trim().endsWith("?wsdl")) {
|
||||
newUrl = newUrl + "?wsdl";
|
||||
}
|
||||
|
||||
ClassLoader oldContextClassLoader = Thread.currentThread().getContextClassLoader();
|
||||
try {
|
||||
Class<?> tMDMService_ServiceClass = Class.forName("org.talend.mdm.webservice.TMDMService_Service", true, classLoader);
|
||||
Thread.currentThread().setContextClassLoader(tMDMService_ServiceClass.getClassLoader());
|
||||
Object serviceService = ReflectionUtils.newInstance("org.talend.mdm.webservice.TMDMService_Service", classLoader,
|
||||
new Object[] { new URL(newUrl) });
|
||||
Object invokeMethod = ReflectionUtils.invokeMethod(serviceService, "getTMDMPort", new Object[0]);
|
||||
if (invokeMethod instanceof BindingProvider) {
|
||||
stub = (BindingProvider) invokeMethod;
|
||||
Map<String, Object> requestContext = stub.getRequestContext();
|
||||
requestContext.put(javax.xml.ws.BindingProvider.SESSION_MAINTAIN_PROPERTY, false);
|
||||
requestContext.put(javax.xml.ws.BindingProvider.USERNAME_PROPERTY, userName);
|
||||
requestContext.put(javax.xml.ws.BindingProvider.PASSWORD_PROPERTY, password);
|
||||
IMDMWebServiceHook wsHook = getWebServiceHook();
|
||||
if (wsHook != null) {
|
||||
wsHook.preRequestSendingHook(requestContext, userName);
|
||||
}
|
||||
Object wsping = ReflectionUtils.newInstance("org.talend.mdm.webservice.WSPing", classLoader, new Object[0]);
|
||||
ReflectionUtils.invokeMethod(stub, "ping", new Object[] { wsping });
|
||||
}
|
||||
} finally {
|
||||
Thread.currentThread().setContextClassLoader(oldContextClassLoader);
|
||||
Object serviceService = ReflectionUtils.newInstance("org.talend.mdm.webservice.TMDMService_Service", classLoader,
|
||||
new Object[] { new URL(newUrl) });
|
||||
Object invokeMethod = ReflectionUtils.invokeMethod(serviceService, "getTMDMPort", new Object[0]);
|
||||
if (invokeMethod instanceof BindingProvider) {
|
||||
stub = (BindingProvider) invokeMethod;
|
||||
Map<String, Object> requestContext = stub.getRequestContext();
|
||||
requestContext.put(javax.xml.ws.BindingProvider.SESSION_MAINTAIN_PROPERTY, false);
|
||||
requestContext.put(javax.xml.ws.BindingProvider.USERNAME_PROPERTY, userName);
|
||||
requestContext.put(javax.xml.ws.BindingProvider.PASSWORD_PROPERTY, password);
|
||||
Object wsping = ReflectionUtils.newInstance("org.talend.mdm.webservice.WSPing", classLoader, new Object[0]);
|
||||
ReflectionUtils.invokeMethod(stub, "ping", new Object[] { wsping });
|
||||
}
|
||||
|
||||
return stub;
|
||||
}
|
||||
|
||||
@@ -116,13 +99,6 @@ public class S60MdmConnectionHelper extends AbsMdmConnectionHelper {
|
||||
|
||||
}
|
||||
|
||||
private IMDMWebServiceHook getWebServiceHook() {
|
||||
if (webServceHook == null && GlobalServiceRegister.getDefault().isServiceRegistered(IMDMWebServiceHook.class)) {
|
||||
webServceHook = GlobalServiceRegister.getDefault().getService(IMDMWebServiceHook.class);
|
||||
}
|
||||
return webServceHook;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
||||
@@ -445,8 +445,7 @@ public class DBConnectionFillerImpl extends MetadataFillerImpl<DatabaseConnectio
|
||||
ResultSet catalogNames = null;
|
||||
if (dbJDBCMetadata instanceof SybaseDatabaseMetaData) {
|
||||
// Whether in context mode or not, metaConnection can get the correct username always
|
||||
String username = metaConnection == null ? dbConn.getUsername() : metaConnection.getUsername();
|
||||
catalogNames = ((SybaseDatabaseMetaData) dbJDBCMetadata).getCatalogs(username);
|
||||
catalogNames = ((SybaseDatabaseMetaData) dbJDBCMetadata).getCatalogs(metaConnection.getUsername());
|
||||
} else {
|
||||
catalogNames = dbJDBCMetadata.getCatalogs();
|
||||
}
|
||||
|
||||
@@ -121,5 +121,4 @@ DataTransferMessages.DataTransfer_browse=B&rowse...
|
||||
DataTransferMessages.ArchiveExport_selectDestinationTitle=Export to Archive File
|
||||
WorkbenchMessages.ShowView_errorTitle=Problems Showing View
|
||||
ComponentsManager.form.install.dialog.restart.title=Restarting Studio
|
||||
ComponentsManager.form.install.dialog.restart.message=We need to restart studio to finish the installation.\n\nDo you want to restart studio right now?
|
||||
JavaVersion.CheckError=Java upgrade required, minimal required java version is {0}, current version is {1}.
|
||||
ComponentsManager.form.install.dialog.restart.message=We need to restart studio to finish the installation.\n\nDo you want to restart studio right now?
|
||||
@@ -104,17 +104,6 @@ public class Application implements IApplication {
|
||||
StudioKeysFileCheck.check(ConfigurationScope.INSTANCE.getLocation().toFile());
|
||||
|
||||
Display display = PlatformUI.createDisplay();
|
||||
|
||||
try {
|
||||
StudioKeysFileCheck.validateJavaVersion();
|
||||
} catch (Exception e) {
|
||||
Shell shell = new Shell(display, SWT.NONE);
|
||||
MessageDialog.openError(shell, null, // $NON-NLS-1$
|
||||
Messages.getString("JavaVersion.CheckError", StudioKeysFileCheck.JAVA_VERSION_MINIMAL_STRING,
|
||||
StudioKeysFileCheck.getJavaVersion()));
|
||||
return IApplication.EXIT_RELAUNCH;
|
||||
}
|
||||
|
||||
try {
|
||||
// TUP-5816 don't put any code ahead of this part unless you make sure it won't trigger workspace
|
||||
// initialization.
|
||||
|
||||
@@ -12,13 +12,6 @@
|
||||
// ============================================================================
|
||||
package org.talend.rcp.intro.contentProvider;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
@@ -28,8 +21,6 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.ui.forms.widgets.FormToolkit;
|
||||
@@ -218,8 +209,6 @@ public class DynamicContentProvider extends IntroProvider {
|
||||
return;
|
||||
}
|
||||
HttpURLConnection urlConnection = null;
|
||||
InputStream inStream = null;
|
||||
String filePath = null;
|
||||
try {
|
||||
URL url = new URL(getOnlinePageURL(onlinePageUrl));
|
||||
urlConnection = (HttpURLConnection) url.openConnection();
|
||||
@@ -228,11 +217,7 @@ public class DynamicContentProvider extends IntroProvider {
|
||||
urlConnection.setDoInput(true);
|
||||
urlConnection.setUseCaches(false);
|
||||
urlConnection.setReadTimeout(2000);
|
||||
int state = urlConnection.getResponseCode();
|
||||
inStream = urlConnection.getInputStream();
|
||||
if (state == HttpURLConnection.HTTP_OK) {
|
||||
filePath = downHtml(inStream);
|
||||
}
|
||||
urlConnection.getInputStream();
|
||||
setDIVStyle(dom, true);
|
||||
} catch (Exception e) {
|
||||
setDIVStyle(dom, false);
|
||||
@@ -240,11 +225,9 @@ public class DynamicContentProvider extends IntroProvider {
|
||||
} finally {
|
||||
urlConnection.disconnect();
|
||||
}
|
||||
|
||||
if(filePath == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// online content
|
||||
|
||||
Element tdElem = dom.createElement("td"); //$NON-NLS-1$
|
||||
setTDAttribute(tdElem);
|
||||
parent.appendChild(tdElem);
|
||||
@@ -262,55 +245,13 @@ public class DynamicContentProvider extends IntroProvider {
|
||||
}
|
||||
|
||||
Element iFrame = dom.createElement("iframe"); //$NON-NLS-1$
|
||||
iFrame.setAttribute("src", filePath); //$NON-NLS-1$
|
||||
iFrame.setAttribute("src", getOnlinePageURL(onlinePageUrl)); //$NON-NLS-1$
|
||||
iFrame.setAttribute("frameborder", "0"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
iFrame.setAttribute("width", "240px"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
iFrame.setAttribute("height", "370px"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
iFrame.appendChild(dom.createTextNode(" ")); //$NON-NLS-1$
|
||||
div.appendChild(iFrame);
|
||||
}
|
||||
|
||||
private String downHtml(InputStream inStream) {
|
||||
if(inStream == null) {
|
||||
return null;
|
||||
}
|
||||
File file = null;
|
||||
BufferedWriter output = null;
|
||||
BufferedReader reader = null;
|
||||
try {
|
||||
String path = new Path(Platform.getConfigurationLocation().getURL().getPath()).toFile().getAbsolutePath();
|
||||
file = new File(path, "WelcomPage3.html");
|
||||
file.deleteOnExit();
|
||||
|
||||
String result = null;
|
||||
reader = new BufferedReader(new InputStreamReader(inStream, "utf-8"));
|
||||
String line = null;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
if(result==null){
|
||||
result=line;
|
||||
}else{
|
||||
result += line;
|
||||
}
|
||||
}
|
||||
|
||||
output = new BufferedWriter(new FileWriter(file));
|
||||
output.write(result);
|
||||
output.flush();
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
} finally {
|
||||
try {
|
||||
output.close();
|
||||
reader.close();
|
||||
inStream.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
if(!file.exists()){
|
||||
return null;
|
||||
}
|
||||
return file.toURI().toString();
|
||||
}
|
||||
|
||||
protected void createTopMessage(Document dom, Element parent) {
|
||||
Element topMessageElem = dom.createElement("div"); //$NON-NLS-1$
|
||||
|
||||
@@ -14,9 +14,7 @@ package org.talend.repository.items.importexport.ui.wizard.imports.providers;
|
||||
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
import org.eclipse.jface.viewers.ViewerSorter;
|
||||
import org.talend.commons.utils.Version;
|
||||
import org.talend.repository.items.importexport.wizard.models.FolderImportNode;
|
||||
import org.talend.repository.items.importexport.wizard.models.ImportNode;
|
||||
import org.talend.repository.items.importexport.wizard.models.ItemImportNode;
|
||||
import org.talend.repository.items.importexport.wizard.models.ProjectImportNode;
|
||||
import org.talend.repository.items.importexport.wizard.models.TypeImportNode;
|
||||
@@ -55,33 +53,15 @@ public class ImportItemsViewerSorter extends ViewerSorter {
|
||||
*/
|
||||
@Override
|
||||
public int compare(Viewer viewer, Object o1, Object o2) {
|
||||
if(o1 instanceof ImportNode && o2 instanceof ImportNode) {
|
||||
|
||||
if(((ImportNode)o1).getItemRecord() != null && ((ImportNode)o2).getItemRecord() != null
|
||||
&& ((ImportNode)o1).getItemRecord().getProperty() != null
|
||||
&& ((ImportNode)o2).getItemRecord().getProperty() != null) {
|
||||
String label1 = ((ImportNode)o1).getItemRecord().getProperty().getLabel();
|
||||
String label2 = ((ImportNode)o2).getItemRecord().getProperty().getLabel();
|
||||
if (label1 == null) {
|
||||
return -1;
|
||||
}
|
||||
if (label2 == null) {
|
||||
return 1;
|
||||
}
|
||||
if(label1.equals(label2)) {
|
||||
String version1 = ((ImportNode)o1).getItemRecord().getProperty().getVersion();
|
||||
String version2 = ((ImportNode)o2).getItemRecord().getProperty().getVersion();
|
||||
|
||||
if (version1 == null) {
|
||||
return -1;
|
||||
}
|
||||
if (version2 == null) {
|
||||
return 1;
|
||||
}
|
||||
return new Version(version1).compareTo(new Version(version2));
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (o1 instanceof TypeImportNode && o2 instanceof TypeImportNode) {
|
||||
// // maybe it's not good to use the ordinal.
|
||||
// return ((TypeImportNode) o2).getType().ordinal() - ((TypeImportNode) o1).getType().ordinal();
|
||||
// } else if (o1 instanceof TypeImportNode) {
|
||||
// return 1;
|
||||
// } else if (o2 instanceof TypeImportNode) {
|
||||
// return -1;
|
||||
//
|
||||
// }
|
||||
return super.compare(viewer, o1, o2);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,15 +13,14 @@
|
||||
package org.talend.repository.items.importexport.handlers.exports;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.talend.commons.runtime.utils.io.FileCopyUtils;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.model.process.JobInfo;
|
||||
import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.runtime.process.ITalendProcessJavaProject;
|
||||
import org.talend.core.runtime.repository.build.IBuildResourcesProvider;
|
||||
@@ -37,11 +36,11 @@ public class SyncChildrenContextsResourcesProvider implements IBuildResourcesPro
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.core.runtime.repository.build.IBuildResourcesProvider#prepare(org.eclipse.core.runtime.
|
||||
* IProgressMonitor , java.util.Map)
|
||||
*
|
||||
* @see
|
||||
* org.talend.core.runtime.repository.build.IBuildResourcesProvider#prepare(org.eclipse.core.runtime.IProgressMonitor
|
||||
* , java.util.Map)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void prepare(IProgressMonitor monitor, Map<String, Object> parameters) throws Exception {
|
||||
if (parameters == null) {
|
||||
@@ -56,8 +55,7 @@ public class SyncChildrenContextsResourcesProvider implements IBuildResourcesPro
|
||||
if (processItem == null) {
|
||||
return;
|
||||
}
|
||||
final Set<JobInfo> dependenciesItems = (Set<JobInfo>) ParametersUtil.getObject(parameters, OBJ_ITEM_DEPENDENCIES,
|
||||
Set.class);
|
||||
final List dependenciesItems = (List) ParametersUtil.getObject(parameters, OBJ_ITEM_DEPENDENCIES, List.class);
|
||||
if (dependenciesItems == null || dependenciesItems.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
@@ -69,15 +67,19 @@ public class SyncChildrenContextsResourcesProvider implements IBuildResourcesPro
|
||||
|
||||
final IFolder mainResourcesFolder = processJavaProject.getExternalResourcesFolder();
|
||||
final File targetFolder = mainResourcesFolder.getLocation().toFile();
|
||||
dependenciesItems.stream().filter(jobInfo -> !jobInfo.isJoblet()).map(JobInfo::getProcessItem).forEach(item -> {
|
||||
ITalendProcessJavaProject childJavaProject = runProcessService.getTalendJobJavaProject(item.getProperty());
|
||||
if (childJavaProject != null) {
|
||||
final IFolder childResourcesFolder = childJavaProject.getExternalResourcesFolder();
|
||||
if (childResourcesFolder.exists()) {
|
||||
FileCopyUtils.syncFolder(childResourcesFolder.getLocation().toFile(), targetFolder, false);
|
||||
|
||||
for (Object item : dependenciesItems) {
|
||||
if (item instanceof ProcessItem) {
|
||||
ITalendProcessJavaProject childJavaProject = runProcessService.getTalendJobJavaProject(((ProcessItem) item)
|
||||
.getProperty());
|
||||
if (childJavaProject != null) {
|
||||
final IFolder childResourcesFolder = childJavaProject.getExternalResourcesFolder();
|
||||
if (childResourcesFolder.exists()) {
|
||||
FileCopyUtils.syncFolder(childResourcesFolder.getLocation().toFile(), targetFolder, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
mainResourcesFolder.refreshLocal(IResource.DEPTH_INFINITE, monitor);
|
||||
}
|
||||
|
||||
@@ -13,15 +13,14 @@
|
||||
package org.talend.repository.items.importexport.handlers.exports;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.talend.commons.runtime.utils.io.FileCopyUtils;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.model.process.JobInfo;
|
||||
import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.runtime.process.ITalendProcessJavaProject;
|
||||
import org.talend.core.runtime.repository.build.IBuildResourcesProvider;
|
||||
@@ -30,16 +29,8 @@ import org.talend.designer.runprocess.IRunProcessService;
|
||||
|
||||
public class SyncChildrenSourceCodeProvider implements IBuildResourcesProvider {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void prepare(IProgressMonitor monitor, Map<String, Object> parameters) throws Exception {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
|
||||
IRunProcessService service = GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
|
||||
if (service.isCIMode()) {
|
||||
// don't sync any children source code to parent job in CI.
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (parameters == null) {
|
||||
return;
|
||||
}
|
||||
@@ -52,8 +43,7 @@ public class SyncChildrenSourceCodeProvider implements IBuildResourcesProvider {
|
||||
if (processItem == null) {
|
||||
return;
|
||||
}
|
||||
final Set<JobInfo> dependenciesItems = (Set<JobInfo>) ParametersUtil.getObject(parameters, OBJ_ITEM_DEPENDENCIES,
|
||||
Set.class);
|
||||
final List dependenciesItems = (List) ParametersUtil.getObject(parameters, OBJ_ITEM_DEPENDENCIES, List.class);
|
||||
if (dependenciesItems == null || dependenciesItems.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
@@ -66,15 +56,18 @@ public class SyncChildrenSourceCodeProvider implements IBuildResourcesProvider {
|
||||
final IFolder mainSrcFolder = processJavaProject.getSrcFolder();
|
||||
final File targetFolder = mainSrcFolder.getLocation().toFile();
|
||||
|
||||
dependenciesItems.stream().filter(jobInfo -> !jobInfo.isJoblet()).map(JobInfo::getProcessItem).forEach(item -> {
|
||||
ITalendProcessJavaProject childJavaProject = runProcessService.getTalendJobJavaProject(item.getProperty());
|
||||
if (childJavaProject != null) {
|
||||
final IFolder childSrcFolder = childJavaProject.getSrcFolder();
|
||||
if (childSrcFolder.exists()) {
|
||||
FileCopyUtils.syncFolder(childSrcFolder.getLocation().toFile(), targetFolder, false);
|
||||
for (Object item : dependenciesItems) {
|
||||
if (item instanceof ProcessItem) {
|
||||
ITalendProcessJavaProject childJavaProject = runProcessService
|
||||
.getTalendJobJavaProject(((ProcessItem) item).getProperty());
|
||||
if (childJavaProject != null) {
|
||||
final IFolder childSrcFolder = childJavaProject.getSrcFolder();
|
||||
if (childSrcFolder.exists()) {
|
||||
FileCopyUtils.syncFolder(childSrcFolder.getLocation().toFile(), targetFolder, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
mainSrcFolder.refreshLocal(IResource.DEPTH_INFINITE, monitor);
|
||||
}
|
||||
|
||||
@@ -13,15 +13,14 @@
|
||||
package org.talend.repository.items.importexport.handlers.exports;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.talend.commons.runtime.utils.io.FileCopyUtils;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.model.process.JobInfo;
|
||||
import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.runtime.process.ITalendProcessJavaProject;
|
||||
import org.talend.core.runtime.repository.build.IBuildResourcesProvider;
|
||||
@@ -32,7 +31,6 @@ public class SyncChildrenTestReportsProvider implements IBuildResourcesProvider
|
||||
|
||||
private static final String TEST_REPORTS_FOLDER = "surefire-reports";
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void prepare(IProgressMonitor monitor, Map<String, Object> parameters) throws Exception {
|
||||
if (parameters == null) {
|
||||
@@ -47,8 +45,7 @@ public class SyncChildrenTestReportsProvider implements IBuildResourcesProvider
|
||||
if (processItem == null) {
|
||||
return;
|
||||
}
|
||||
final Set<JobInfo> dependenciesItems = (Set<JobInfo>) ParametersUtil.getObject(parameters, OBJ_ITEM_DEPENDENCIES,
|
||||
Set.class);
|
||||
final List dependenciesItems = (List) ParametersUtil.getObject(parameters, OBJ_ITEM_DEPENDENCIES, List.class);
|
||||
if (dependenciesItems == null || dependenciesItems.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
@@ -61,17 +58,16 @@ public class SyncChildrenTestReportsProvider implements IBuildResourcesProvider
|
||||
final File reportTargetFolder = processJavaProject.getTargetFolder().getFolder(TEST_REPORTS_FOLDER).getLocation()
|
||||
.toFile();
|
||||
|
||||
for (JobInfo jobInfo : dependenciesItems) {
|
||||
if (jobInfo.isJoblet()) {
|
||||
continue;
|
||||
}
|
||||
ITalendProcessJavaProject childJavaProject = runProcessService
|
||||
.getTalendJobJavaProject(jobInfo.getProcessItem().getProperty());
|
||||
if (childJavaProject != null) {
|
||||
childJavaProject.getTargetFolder().refreshLocal(IResource.DEPTH_INFINITE, monitor);
|
||||
final IFolder childReportFolder = childJavaProject.getTargetFolder().getFolder(TEST_REPORTS_FOLDER);
|
||||
if (childReportFolder.exists()) {
|
||||
FileCopyUtils.syncFolder(childReportFolder.getLocation().toFile(), reportTargetFolder, false);
|
||||
for (Object item : dependenciesItems) {
|
||||
if (item instanceof ProcessItem) {
|
||||
ITalendProcessJavaProject childJavaProject = runProcessService
|
||||
.getTalendJobJavaProject(((ProcessItem) item).getProperty());
|
||||
if (childJavaProject != null) {
|
||||
childJavaProject.getTargetFolder().refreshLocal(IResource.DEPTH_INFINITE, monitor);
|
||||
final IFolder childReportFolder = childJavaProject.getTargetFolder().getFolder(TEST_REPORTS_FOLDER);
|
||||
if (childReportFolder.exists()) {
|
||||
FileCopyUtils.syncFolder(childReportFolder.getLocation().toFile(), reportTargetFolder, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -850,8 +850,6 @@ DatabaseForm.hbase.distributionAlert=Distribution must be specified
|
||||
DatabaseForm.impala.distributionAlert=Distribution must be specified
|
||||
DatabaseForm.hbase.versionAlert=HBase version must be specified
|
||||
DatabaseForm.impala.versionAlert=Impala version must be specified
|
||||
DatabaseForm.impala.driverVersion=Impala Driver
|
||||
DatabaseForm.impala.driverVersion.tip=Select a hive impala driver
|
||||
DatabaseForm.maprdb.settings=Version
|
||||
DatabaseForm.maprdb.distribution=Distribution
|
||||
DatabaseForm.maprdb.distribution.tooltip=Set the hadoop distribution
|
||||
|
||||
@@ -89,7 +89,6 @@ import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.ILibraryManagerService;
|
||||
import org.talend.core.ILibraryManagerUIService;
|
||||
import org.talend.core.database.EDatabaseTypeName;
|
||||
import org.talend.core.database.EImpalaDriver;
|
||||
import org.talend.core.database.conn.ConnParameterKeys;
|
||||
import org.talend.core.database.conn.DatabaseConnStrUtil;
|
||||
import org.talend.core.database.conn.EDatabaseConnVar;
|
||||
@@ -215,8 +214,6 @@ public class DatabaseForm extends AbstractForm {
|
||||
*/
|
||||
private LabelledCombo hiveServerVersionCombo;
|
||||
|
||||
private LabelledCombo impalaDriverCombo;
|
||||
|
||||
private LabelledText serverText;
|
||||
|
||||
private LabelledText portText;
|
||||
@@ -983,7 +980,6 @@ public class DatabaseForm extends AbstractForm {
|
||||
.getString("DatabaseForm.dbversion.tip"), new String[0], 2, true); //$NON-NLS-1$
|
||||
|
||||
createHiveServerVersionField(typeDbCompositeParent);
|
||||
createImpalaDriverField(typeDbCompositeParent);
|
||||
|
||||
setHideVersionInfoWidgets(true);
|
||||
|
||||
@@ -1830,7 +1826,7 @@ public class DatabaseForm extends AbstractForm {
|
||||
}
|
||||
|
||||
private void showIfAdditionalJDBCSettings() {
|
||||
setHidAdditionalJDBCSettings(!isSupportHiveAdditionalSettings() && !isSupportImpalaAdditionalSettings());
|
||||
setHidAdditionalJDBCSettings(!isSupportHiveAdditionalSettings());
|
||||
}
|
||||
|
||||
private void showIfHiveMetastore() {
|
||||
@@ -1874,20 +1870,6 @@ public class DatabaseForm extends AbstractForm {
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isSupportImpalaAdditionalSettings() {
|
||||
if (isImpalaDBConnSelected()) {
|
||||
IHDistribution hiveDistribution = getCurrentImpalaDistribution(true);
|
||||
String hiveVerson = getImpalaVersionCombo().getText();
|
||||
if (hiveDistribution != null && hiveVerson != null) {
|
||||
if (!EImpalaDriver.isSupport(hiveDistribution.getDisplayName(), hiveVerson, true, "useCloudLauncher")
|
||||
&& HiveMetadataHelper.doSupportHive2(hiveDistribution.getDisplayName(), hiveVerson, true)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void updateCheckButtonStatus() {
|
||||
if (isHiveDBConnSelected()) {
|
||||
boolean update = HiveMetadataHelper.isHiveWizardCheckEnabled(hiveDistributionCombo.getText(),
|
||||
@@ -3227,7 +3209,6 @@ public class DatabaseForm extends AbstractForm {
|
||||
hcPropertyTypeCombo.setReadOnly(isContextMode());
|
||||
hiveModeCombo.setReadOnly(isContextMode());
|
||||
hiveServerVersionCombo.setReadOnly(isContextMode());
|
||||
impalaDriverCombo.setReadOnly(isContextMode());
|
||||
|
||||
useKerberos.setEnabled(!isContextMode());
|
||||
useKeyTab.setEnabled(!isContextMode());
|
||||
@@ -3764,14 +3745,6 @@ public class DatabaseForm extends AbstractForm {
|
||||
hiveServerVersionCombo.setHideWidgets(true);
|
||||
}
|
||||
|
||||
private void createImpalaDriverField(Composite parent) {
|
||||
impalaDriverCombo = new LabelledCombo(parent, Messages.getString("DatabaseForm.impala.driverVersion"), //$NON-NLS-1$
|
||||
Messages.getString("DatabaseForm.impala.driverVersion.tip"), //$NON-NLS-1$
|
||||
new String[] {}, 2, true);
|
||||
|
||||
impalaDriverCombo.setHideWidgets(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Added by Marvin Wang on Oct. 15, 2012.
|
||||
*
|
||||
@@ -5112,8 +5085,6 @@ public class DatabaseForm extends AbstractForm {
|
||||
}
|
||||
if (isImpalaDBConnSelected()) {
|
||||
fillDefaultsWhenImpalaVersionChanged();
|
||||
} else {
|
||||
doImpalaNotSelected();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5580,10 +5551,8 @@ public class DatabaseForm extends AbstractForm {
|
||||
handleHadoopCustomVersion(ECustomVersionType.HIVE);
|
||||
}
|
||||
});
|
||||
regHiveRelatedWidgetImpalaDriverComboListener();
|
||||
}
|
||||
|
||||
|
||||
private void handleHadoopCustomVersion(final ECustomVersionType type) {
|
||||
HadoopCustomVersionDefineDialog customVersionDialog = new HadoopCustomVersionDefineDialog(getShell(),
|
||||
HadoopVersionControlUtils.getCustomVersionMap(getConnection(), type.getGroup())) {
|
||||
@@ -6556,8 +6525,7 @@ public class DatabaseForm extends AbstractForm {
|
||||
passwordText.hide();
|
||||
} else if (isImpala) {
|
||||
// usernameText.hide();
|
||||
// passwordText.hide();
|
||||
impalaDriverCombo.setHideWidgets(false);
|
||||
passwordText.hide();
|
||||
} else if (isHiveDBConnSelected()) {
|
||||
if (isHiveEmbeddedMode()) {
|
||||
// Need to revert if required, changed by Marvin Wang on Nov. 22, 2012.
|
||||
@@ -6760,8 +6728,6 @@ public class DatabaseForm extends AbstractForm {
|
||||
addContextParams(EDBParamName.Port, true);
|
||||
addContextParams(EDBParamName.Database, true);
|
||||
addContextParams(EDBParamName.ImpalaPrincipal, useKerberosForImpala.getSelection());
|
||||
addContextParams(EDBParamName.Password, true);
|
||||
addContextParams(EDBParamName.hiveAdditionalJDBCParameters, isSupportImpalaAdditionalSettings());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7060,7 +7026,6 @@ public class DatabaseForm extends AbstractForm {
|
||||
if (isImpalaDBConnSelected()) {
|
||||
adaptImpalaHadoopPartEditable();
|
||||
updateHadoopProperties(!isContextMode());
|
||||
additionalJDBCSettingsText.setEditable(!isContextMode());
|
||||
}
|
||||
if (isOracleCustomDBConnSelected()) {
|
||||
adaptOracleCustomPartEditable();
|
||||
@@ -7120,6 +7085,7 @@ public class DatabaseForm extends AbstractForm {
|
||||
|
||||
String useKrb = connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_USE_KRB);
|
||||
String impalaPrincipla = connection.getParameters().get(ConnParameterKeys.IMPALA_AUTHENTICATION_PRINCIPLA);
|
||||
|
||||
if (Boolean.valueOf(useKrb)) {
|
||||
useKerberosForImpala.setSelection(true);
|
||||
GridData hadoopData = (GridData) authenticationComForImpala.getLayoutData();
|
||||
@@ -7131,23 +7097,7 @@ public class DatabaseForm extends AbstractForm {
|
||||
authenticationComForImpala.getParent().layout();
|
||||
}
|
||||
impalaPrincipalTxt.setText(impalaPrincipla == null ? "impala/_HOST@EXAMPLE.COM" : impalaPrincipla); //$NON-NLS-1$
|
||||
String distributionObj = connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_IMPALA_DISTRIBUTION);
|
||||
String impalaVersion = connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_IMPALA_VERSION);
|
||||
IHadoopDistributionService hadoopService = getHadoopDistributionService();
|
||||
if (hadoopService != null) {
|
||||
IHDistribution impalaDistribution = hadoopService.getImpalaDistributionManager().getDistribution(distributionObj,
|
||||
false);
|
||||
IHDistributionVersion hdVersion = null;
|
||||
if (impalaDistribution != null) {
|
||||
hdVersion = impalaDistribution.getHDVersion(impalaVersion, false);
|
||||
}
|
||||
updateImpalaVersionPart(impalaDistribution);
|
||||
updateImpalaDriverAndMakeSelection(impalaDistribution, hdVersion);
|
||||
}
|
||||
// addtional jdbc setting
|
||||
String additionalJDBCSettings = connection.getParameters()
|
||||
.get(ConnParameterKeys.CONN_PARA_KEY_HIVE_ADDITIONAL_JDBC_SETTINGS);
|
||||
additionalJDBCSettingsText.setText(additionalJDBCSettings == null ? "" : additionalJDBCSettings);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -7533,16 +7483,6 @@ public class DatabaseForm extends AbstractForm {
|
||||
});
|
||||
}
|
||||
|
||||
private void regHiveRelatedWidgetImpalaDriverComboListener() {
|
||||
impalaDriverCombo.getCombo().addSelectionListener(new SelectionAdapter() {
|
||||
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
doImpalaDriverSelected();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a listener for the text widget of metastore connection url, it invokes
|
||||
* {@link #doMetastoreConnURLModify()()} when the text contents is changed. Added by Marvin Wang on Oct 17, 2012.
|
||||
@@ -8128,14 +8068,6 @@ public class DatabaseForm extends AbstractForm {
|
||||
updateHiveServerAndMakeSelection(hiveDistribution, hiveVersion);
|
||||
}
|
||||
|
||||
protected void doImpalaDriverSelected() {
|
||||
if (!isContextMode()) {
|
||||
modifyFieldValue();
|
||||
getConnection().getParameters().put(ConnParameterKeys.IMPALA_DRIVER,
|
||||
EImpalaDriver.getByDisplay(impalaDriverCombo.getText()).getName());
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateHiveDistributionAndMakeSelection(IHDistribution hiveDistribution) {
|
||||
hiveDistributionCombo.getCombo().setItems(HiveMetadataHelper.getDistributionsDisplay());
|
||||
if (hiveDistribution != null) {
|
||||
@@ -8157,18 +8089,6 @@ public class DatabaseForm extends AbstractForm {
|
||||
return hiveDistribution;
|
||||
}
|
||||
|
||||
private IHDistribution getCurrentImpalaDistribution(boolean withDefault) {
|
||||
IHDistribution hiveDistribution = HiveMetadataHelper.getDistribution(impalaDistributionCombo.getText(), true);
|
||||
IHadoopDistributionService hadoopService = getHadoopDistributionService();
|
||||
if (withDefault && hiveDistribution == null && hadoopService != null) {
|
||||
IHDistribution[] distributions = hadoopService.getImpalaDistributionManager().getDistributions();
|
||||
if (distributions.length > 0) {
|
||||
hiveDistribution = distributions[0];
|
||||
}
|
||||
}
|
||||
return hiveDistribution;
|
||||
}
|
||||
|
||||
protected void updateHiveVersionAndMakeSelection(IHDistribution hiveDistribution, IHDistributionVersion hiveVersion) {
|
||||
if (hiveDistribution == null) {
|
||||
hiveDistribution = getCurrentHiveDistribution(true);
|
||||
@@ -8251,43 +8171,6 @@ public class DatabaseForm extends AbstractForm {
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateImpalaDriverAndMakeSelection(IHDistribution hiveDistribution,
|
||||
IHDistributionVersion hiveVersion) {
|
||||
if (hiveDistribution == null) {
|
||||
hiveDistribution = getCurrentHiveDistribution(true);
|
||||
}
|
||||
IHadoopDistributionService hadoopDistributionService = getHadoopDistributionService();
|
||||
if (hiveDistribution == null || hadoopDistributionService == null) {
|
||||
return;
|
||||
}
|
||||
IHDistributionVersion[] hdVersions = hiveDistribution.getHDVersions();
|
||||
if (hiveVersion == null && hdVersions.length > 0) {
|
||||
hiveVersion = hdVersions[0];
|
||||
}
|
||||
|
||||
DatabaseConnection conn = getConnection();
|
||||
String[] impalaDriverDisplay = EImpalaDriver.getImpalaDriverDisplay(hiveDistribution.getName(),
|
||||
hiveVersion == null ? null : hiveVersion.getVersion(), false);
|
||||
if (impalaDriverDisplay != null && impalaDriverDisplay.length == 0) {
|
||||
// hive2 by default
|
||||
impalaDriverCombo.getCombo().setItems(EImpalaDriver.HIVE2.getDisplayName());
|
||||
} else {
|
||||
impalaDriverCombo.getCombo().setItems(impalaDriverDisplay);
|
||||
}
|
||||
String impalaDriver = conn.getParameters().get(ConnParameterKeys.IMPALA_DRIVER);
|
||||
if (impalaDriver != null) {
|
||||
EImpalaDriver driver = EImpalaDriver.getByName(impalaDriver);
|
||||
if (driver != null) {
|
||||
impalaDriverCombo.setText(driver.getDisplayName());
|
||||
} else {
|
||||
impalaDriverCombo.select(0);
|
||||
}
|
||||
} else {
|
||||
impalaDriverCombo.select(0);
|
||||
}
|
||||
getConnection().getParameters().put(ConnParameterKeys.IMPALA_DRIVER,
|
||||
EImpalaDriver.getByDisplay(impalaDriverCombo.getText()).getName());
|
||||
}
|
||||
/**
|
||||
* It is invoked when the mode STANDALONE is selected. Added by Marvin Wang on Aug. 3, 2012.
|
||||
*/
|
||||
@@ -8421,9 +8304,6 @@ public class DatabaseForm extends AbstractForm {
|
||||
doHiveUIContentsLayout();
|
||||
}
|
||||
|
||||
protected void doImpalaNotSelected() {
|
||||
impalaDriverCombo.setHideWidgets(true);
|
||||
}
|
||||
/**
|
||||
* This method is used to handle the groups including version info, hadoop info and metastore info are hide or
|
||||
* visible. Added by Marvin Wang on Oct 16, 2012.
|
||||
@@ -8766,10 +8646,6 @@ public class DatabaseForm extends AbstractForm {
|
||||
return this.hiveVersionCombo;
|
||||
}
|
||||
|
||||
public LabelledCombo getImpalaVersionCombo() {
|
||||
return this.impalaVersionCombo;
|
||||
}
|
||||
|
||||
public ContextType getSelectedContextType() {
|
||||
return this.selectedContextType;
|
||||
}
|
||||
|
||||
@@ -449,7 +449,7 @@ public class DatabaseTableForm extends AbstractForm {
|
||||
|
||||
// init the fields
|
||||
// nameText.setText(MetadataToolHelper.validateValue(metadataTable.getLabel()));
|
||||
nameText.setText(metadataTable.getLabel());
|
||||
nameText.setText(MetadataToolHelper.validateTableName(metadataTable.getLabel()));
|
||||
commentText.setText(metadataTable.getComment());
|
||||
if (metadataTable.getTableType() != null) {
|
||||
typeText.setText(Messages.getString("DatabaseTableForm.type", metadataTable.getTableType())); //$NON-NLS-1$
|
||||
@@ -1070,6 +1070,9 @@ public class DatabaseTableForm extends AbstractForm {
|
||||
} else if (existNames.contains(table.getLabel())) {
|
||||
updateStatus(IStatus.ERROR, Messages.getString("CommonWizard.nameAlreadyExist") + " \"" + table.getLabel() + "\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
return false;
|
||||
} else if (!MetadataToolHelper.isValidSchemaName(table.getLabel())) {
|
||||
updateStatus(IStatus.ERROR, Messages.getString("DatabaseTableForm.illegalChar", table.getLabel())); //$NON-NLS-1$
|
||||
return false;
|
||||
}
|
||||
|
||||
// if (table.getColumns().size() == 0) {// this one has been removed,see bug 0016029
|
||||
|
||||
@@ -444,21 +444,4 @@ public class RepoViewCommonViewer extends CommonViewer implements INavigatorCont
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void associate(Object element, Item item) {
|
||||
Object data = item.getData();
|
||||
if (data != element) {
|
||||
if (data != null) {
|
||||
disassociate(item);
|
||||
}
|
||||
item.setData(element);
|
||||
mapElement(element, item);
|
||||
} else {
|
||||
// Always map the element, even if data == element,
|
||||
// since unmapAllElements() can leave the map inconsistent
|
||||
// See bug 2741 for details.
|
||||
mapElement(element, item);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -78,13 +78,6 @@ public class ComponentsLocalNexusInstallFactory extends ComponentsNexusInstallFa
|
||||
if (monitor.isCanceled()) {
|
||||
throw new OperationCanceledException();
|
||||
}
|
||||
|
||||
if (!syncManager.isRepositoryServerAvailable(monitor, getIndexArtifact())) {
|
||||
if (isTalendDebug) {
|
||||
log.info("Failed to sync component index file: " + getIndexArtifact());
|
||||
}
|
||||
return Collections.EMPTY_SET;
|
||||
}
|
||||
File indexFile = null;
|
||||
try {
|
||||
indexFile = syncManager.downloadIndexFile(monitor, getIndexArtifact());
|
||||
|
||||
@@ -24,7 +24,6 @@ import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||
import org.talend.commons.utils.network.NetworkUtil;
|
||||
import org.talend.core.model.general.ModuleNeeded;
|
||||
import org.talend.core.model.general.ModuleToInstall;
|
||||
import org.talend.core.nexus.TalendLibsServerManager;
|
||||
import org.talend.librariesmanager.model.ModulesNeededProvider;
|
||||
import org.talend.librariesmanager.utils.RemoteModulesHelper;
|
||||
import org.talend.updates.runtime.i18n.Messages;
|
||||
@@ -39,7 +38,6 @@ public class PluginOptionalMissingJarsExtraUpdatesFactory extends AbstractExtraU
|
||||
|
||||
private static Logger log = Logger.getLogger(PluginOptionalMissingJarsExtraUpdatesFactory.class);
|
||||
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
@@ -50,7 +48,7 @@ public class PluginOptionalMissingJarsExtraUpdatesFactory extends AbstractExtraU
|
||||
@Override
|
||||
public void retrieveUninstalledExtraFeatures(IProgressMonitor monitor, Set<ExtraFeature> uninstalledExtraFeatures)
|
||||
throws Exception {
|
||||
if (!NetworkUtil.isNetworkValid(TalendLibsServerManager.getInstance().getTalentArtifactServer().getServer())) {
|
||||
if (!NetworkUtil.isNetworkValid(System.getProperty("nexus.proxy.url"))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -96,5 +94,7 @@ public class PluginOptionalMissingJarsExtraUpdatesFactory extends AbstractExtraU
|
||||
.getString("missing.optional.third.parties.libs.feature.description"), false/* mustInstall */)); //$NON-NLS-1$
|
||||
}
|
||||
}// else nothing to install so nothing to install ;)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -90,9 +90,6 @@ public class ComponentSyncManager {
|
||||
}
|
||||
|
||||
public boolean isRepositoryServerAvailable(IProgressMonitor progress, MavenArtifact artifact) throws Exception {
|
||||
if (getServerBean() == null) {
|
||||
return false;
|
||||
}
|
||||
IRepositoryArtifactHandler artifactHandler = null;
|
||||
boolean isSnapshot = isSnapshot(artifact);
|
||||
if (isSnapshot) {
|
||||
|
||||
@@ -12,16 +12,11 @@
|
||||
// ============================================================================
|
||||
package org.talend.utils;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/*
|
||||
* Created by bhe on Dec 24, 2019
|
||||
*/
|
||||
public class JavaVersion implements Comparable<JavaVersion> {
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(JavaVersion.class.getCanonicalName());
|
||||
|
||||
private int major, minor, security;
|
||||
|
||||
public JavaVersion(String v) {
|
||||
@@ -46,11 +41,7 @@ public class JavaVersion implements Comparable<JavaVersion> {
|
||||
String[] version = v.split("[\\._]");
|
||||
this.major = Integer.parseInt(version[0]);
|
||||
if (version.length > 1) {
|
||||
try {
|
||||
this.minor = Integer.parseInt(version[1]);
|
||||
} catch (Exception e) {
|
||||
LOGGER.log(Level.WARNING, "Minor version parse error of " + v, e);
|
||||
}
|
||||
this.minor = Integer.parseInt(version[1]);
|
||||
}
|
||||
if (version.length > 2) {
|
||||
// strip non number part if any
|
||||
@@ -62,11 +53,8 @@ public class JavaVersion implements Comparable<JavaVersion> {
|
||||
break;
|
||||
}
|
||||
}
|
||||
try {
|
||||
this.security = Integer.parseInt(securityNumber);
|
||||
} catch (Exception e) {
|
||||
LOGGER.log(Level.WARNING, "Security version parse error of " + v, e);
|
||||
}
|
||||
|
||||
this.security = Integer.parseInt(securityNumber);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ public class StudioKeysFileCheck {
|
||||
|
||||
private static final String JAVA_VERSION_PROP = "java.version";
|
||||
|
||||
public static final String JAVA_VERSION_MINIMAL_STRING = "1.8.0_161";
|
||||
private static final String JAVA_VERSION_MINIMAL_STRING = "1.8.0_161";
|
||||
|
||||
private static final JavaVersion JAVA_VERSION_MINIMAL = new JavaVersion(JAVA_VERSION_MINIMAL_STRING);
|
||||
|
||||
@@ -61,7 +61,7 @@ public class StudioKeysFileCheck {
|
||||
* Validate java version, throw runtime exception if not satisfied.
|
||||
*/
|
||||
public static void validateJavaVersion() {
|
||||
String currentVersion = getJavaVersion();
|
||||
String currentVersion = System.getProperty(JAVA_VERSION_PROP);
|
||||
JavaVersion cv = new JavaVersion(currentVersion);
|
||||
if (cv.compareTo(JAVA_VERSION_MINIMAL) < 0) {
|
||||
RuntimeException e = new RuntimeException(
|
||||
@@ -71,8 +71,4 @@ public class StudioKeysFileCheck {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getJavaVersion() {
|
||||
return System.getProperty(JAVA_VERSION_PROP);
|
||||
}
|
||||
}
|
||||
|
||||
3
pom.xml
3
pom.xml
@@ -9,6 +9,9 @@
|
||||
</parent>
|
||||
<artifactId>tcommon-studio-se</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<properties>
|
||||
<org.talend.daikon.crypto-utils.version>0.31.10</org.talend.daikon.crypto-utils.version>
|
||||
</properties>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>talend_open</id>
|
||||
|
||||
@@ -162,12 +162,4 @@ public class UpdatesHelperTest {
|
||||
compDefineFile.createNewFile();
|
||||
Assert.assertTrue(UpdatesHelper.isOldComponent(compDefineFolder));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_isOldComponent_templates() throws IOException {
|
||||
File compDefineFolder = new File(workFolder, UpdatesHelper.COMPONENT_TEMPLATES);
|
||||
compDefineFolder.mkdirs();
|
||||
Assert.assertTrue(UpdatesHelper.isOldComponent(compDefineFolder));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// 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.repository.utils;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.talend.core.model.properties.ItemState;
|
||||
import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.model.properties.PropertiesFactory;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.model.repository.RepositoryViewObject;
|
||||
import org.talend.core.repository.utils.RepositoryNodeSortUtil;
|
||||
|
||||
/**
|
||||
* @author hwang
|
||||
*
|
||||
*/
|
||||
public class RepositoryNodeSortUtilTest {
|
||||
|
||||
@Test
|
||||
public void testGetSortVersion() {
|
||||
Property property1 = PropertiesFactory.eINSTANCE.createProperty();
|
||||
property1.setId("property1"); //$NON-NLS-1$
|
||||
property1.setVersion("2.9"); //$NON-NLS-1$
|
||||
property1.setLabel("test1");//$NON-NLS-1$
|
||||
ProcessItem item1 = PropertiesFactory.eINSTANCE.createProcessItem();
|
||||
ItemState state = PropertiesFactory.eINSTANCE.createItemState();
|
||||
state.setDeleted(false);
|
||||
item1.setState(state);
|
||||
property1.setItem(item1);
|
||||
IRepositoryViewObject object1 = new RepositoryViewObject(property1, true);
|
||||
|
||||
property1 = PropertiesFactory.eINSTANCE.createProperty();
|
||||
property1.setId("property1"); //$NON-NLS-1$
|
||||
property1.setVersion("0.3"); //$NON-NLS-1$
|
||||
property1.setLabel("test1");//$NON-NLS-1$
|
||||
item1 = PropertiesFactory.eINSTANCE.createProcessItem();
|
||||
state = PropertiesFactory.eINSTANCE.createItemState();
|
||||
state.setDeleted(false);
|
||||
item1.setState(state);
|
||||
property1.setItem(item1);
|
||||
IRepositoryViewObject object2 = new RepositoryViewObject(property1, true);
|
||||
|
||||
property1 = PropertiesFactory.eINSTANCE.createProperty();
|
||||
property1.setId("property1"); //$NON-NLS-1$
|
||||
property1.setVersion("2.11"); //$NON-NLS-1$
|
||||
property1.setLabel("test1");//$NON-NLS-1$
|
||||
item1 = PropertiesFactory.eINSTANCE.createProcessItem();
|
||||
state = PropertiesFactory.eINSTANCE.createItemState();
|
||||
state.setDeleted(false);
|
||||
item1.setState(state);
|
||||
property1.setItem(item1);
|
||||
IRepositoryViewObject object3 = new RepositoryViewObject(property1, true);
|
||||
|
||||
List<IRepositoryViewObject> temp = new ArrayList<IRepositoryViewObject>();
|
||||
RepositoryNodeSortUtil util = new RepositoryNodeSortUtil();
|
||||
|
||||
temp = new ArrayList<IRepositoryViewObject>();
|
||||
temp.add(object3);
|
||||
temp.add(object2);
|
||||
temp.add(object1);
|
||||
List<IRepositoryViewObject> result = util.getSortVersion(temp);
|
||||
assertTrue("0.3".equals(result.get(0).getVersion()));
|
||||
assertTrue("2.9".equals(result.get(1).getVersion()));
|
||||
assertTrue("2.11".equals(result.get(2).getVersion()));
|
||||
}
|
||||
}
|
||||
@@ -9,4 +9,3 @@ Require-Bundle: org.junit;bundle-version="4.11.0",
|
||||
org.talend.testutils,
|
||||
org.talend.components.common,
|
||||
javax.xml.soap
|
||||
Import-Package: org.talend.core.repository.model
|
||||
|
||||
@@ -12,11 +12,8 @@
|
||||
// ============================================================================
|
||||
package org.talend.core.model.metadata;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
@@ -42,6 +39,7 @@ import org.talend.core.prefs.ITalendCorePrefConstants;
|
||||
import org.talend.cwm.helper.TaggedValueHelper;
|
||||
import org.talend.daikon.avro.AvroUtils;
|
||||
import org.talend.daikon.avro.SchemaConstants;
|
||||
import org.talend.repository.model.IProxyRepositoryFactory;
|
||||
|
||||
import orgomg.cwm.objectmodel.core.TaggedValue;
|
||||
|
||||
@@ -194,7 +192,7 @@ public class MetadataToolAvroHelperTest {
|
||||
assertEquals(map.size() + 1, table.getColumns().size());
|
||||
int i = 0;
|
||||
for (String talendType : map.keySet()) {
|
||||
assertThat(table.getColumns().get(i).getLabel(), is(talendType.replace("[", "").replace("]", "")));
|
||||
assertThat(table.getColumns().get(i).getLabel(), is(talendType.replace('[', '_').replace(']', '_')));
|
||||
assertThat(table.getColumns().get(i).getTalendType(), is(talendType));
|
||||
assertThat(table.getColumns().get(i).getPattern(), is("")); //$NON-NLS-1$
|
||||
assertThat(table.getColumns().get(i).getLength(), is(-1L));
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user