Compare commits
1 Commits
bugfix/mas
...
hwang/TUP-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
950cb7e5f3 |
@@ -51,17 +51,16 @@
|
||||
fragment="true"/>
|
||||
|
||||
<plugin
|
||||
id="org.talend.libraries.apache.lucene8"
|
||||
id="org.talend.libraries.apache.lucene6"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="true"/>
|
||||
version="0.0.0"/>
|
||||
|
||||
<plugin
|
||||
id="org.talend.libraries.apache.lucene4"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="true"/>
|
||||
unpack="false"/>
|
||||
|
||||
</feature>
|
||||
|
||||
@@ -20,10 +20,8 @@
|
||||
<import plugin="org.apache.servicemix.bundles.avro" version="0.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.junit" version="0.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.slf4j.api" version="0.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.apache.commons.configuration" version="2.0.0" match="greaterOrEqual"/>
|
||||
</requires>
|
||||
<plugin id="org.talend.daikon" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
|
||||
<plugin id="org.talend.daikon.exception" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
|
||||
<plugin id="org.talend.daikon.crypto.utils" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
|
||||
<plugin id="org.talend.utils" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
|
||||
</feature>
|
||||
|
||||
@@ -114,9 +114,6 @@ public class CommonsPlugin implements BundleActivator {
|
||||
return Boolean.getBoolean("junit_test"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public static boolean isTUJTest() {
|
||||
return "org.talend.rcp.branding.tuj.product".equals(Platform.getProduct().getId()); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/**
|
||||
* Answer the file associated with name. This handles the case of running as a plugin and running standalone which
|
||||
|
||||
@@ -58,6 +58,3 @@ AS400ResultSet.unknowCloumn=Invalid argument\: unknown column name
|
||||
AS400ResultSet.parameterIndex=Invalid argument\: parameter index
|
||||
AS400ResultSet.outofRange=\ is out of range.
|
||||
ITaCoKitService.exception.multipleInstance=More than one instance found: {0}
|
||||
TalendProxySelector.exception.badUriMap=Bad uri map: {0}
|
||||
TalendProxySelector.exception.proxySelectionError=Error occurs when selecting proxy for {0}
|
||||
|
||||
|
||||
@@ -21,23 +21,29 @@ import javax.crypto.SecretKeyFactory;
|
||||
import javax.crypto.spec.DESKeySpec;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.talend.utils.security.StudioEncryption;
|
||||
import org.talend.utils.security.AESEncryption;
|
||||
|
||||
/**
|
||||
* DOC chuang class global comment. Detailled comment
|
||||
*/
|
||||
public class PasswordEncryptUtil {
|
||||
|
||||
public static final String ENCRYPT_KEY = "Encrypt"; //$NON-NLS-1$
|
||||
public static String ENCRYPT_KEY = "Encrypt"; //$NON-NLS-1$
|
||||
|
||||
private static String rawKey = "Talend-Key"; //$NON-NLS-1$
|
||||
|
||||
public static String PREFIX_PASSWORD = "ENC:["; //$NON-NLS-1$
|
||||
|
||||
public static String POSTFIX_PASSWORD = "]"; //$NON-NLS-1$
|
||||
|
||||
private static SecretKey key = null;
|
||||
|
||||
private static final SecureRandom SECURERANDOM = new SecureRandom();
|
||||
private static SecureRandom secureRandom = new SecureRandom();
|
||||
|
||||
private static SecretKey getSecretKey() throws Exception {
|
||||
if (key == null) {
|
||||
byte rawKeyData[] = StudioEncryption.getKeySource(StudioEncryption.EncryptionKeyName.MIGRATION.toString(), false)
|
||||
.getKey();
|
||||
|
||||
byte rawKeyData[] = rawKey.getBytes();
|
||||
DESKeySpec dks = new DESKeySpec(rawKeyData);
|
||||
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES"); //$NON-NLS-1$
|
||||
key = keyFactory.generateSecret(dks);
|
||||
@@ -59,7 +65,7 @@ public class PasswordEncryptUtil {
|
||||
|
||||
SecretKey key = getSecretKey();
|
||||
Cipher c = Cipher.getInstance("DES"); //$NON-NLS-1$
|
||||
c.init(Cipher.ENCRYPT_MODE, key, SECURERANDOM);
|
||||
c.init(Cipher.ENCRYPT_MODE, key, secureRandom);
|
||||
byte[] cipherByte = c.doFinal(input.getBytes());
|
||||
String dec = new String(Base64.encodeBase64(cipherByte));
|
||||
return dec;
|
||||
@@ -79,7 +85,7 @@ public class PasswordEncryptUtil {
|
||||
byte[] dec = Base64.decodeBase64(input.getBytes());
|
||||
SecretKey key = getSecretKey();
|
||||
Cipher c = Cipher.getInstance("DES"); //$NON-NLS-1$
|
||||
c.init(Cipher.DECRYPT_MODE, key, SECURERANDOM);
|
||||
c.init(Cipher.DECRYPT_MODE, key, secureRandom);
|
||||
byte[] clearByte = c.doFinal(dec);
|
||||
return new String(clearByte);
|
||||
}
|
||||
@@ -93,7 +99,7 @@ public class PasswordEncryptUtil {
|
||||
if (input == null) {
|
||||
return input;
|
||||
}
|
||||
return StudioEncryption.getStudioEncryption(StudioEncryption.EncryptionKeyName.ROUTINE).encrypt(input);
|
||||
return PREFIX_PASSWORD + AESEncryption.encryptPassword(input) + POSTFIX_PASSWORD;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,7 +19,6 @@ import java.io.InputStream;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.util.Properties;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -193,27 +192,6 @@ public class VersionUtils {
|
||||
return talendVersion;
|
||||
}
|
||||
|
||||
public static String getTalendPureVersion(String fullProductVersion) {
|
||||
String version = fullProductVersion;
|
||||
String[] splitStr = fullProductVersion.split("-"); //$NON-NLS-1$
|
||||
Pattern pattern = Pattern.compile("((\\d+\\.){2}\\d.*)"); //$NON-NLS-1$
|
||||
StringBuffer versionStr = new StringBuffer();
|
||||
boolean find = false;
|
||||
for (String str : splitStr) {
|
||||
if (find) {
|
||||
versionStr.append("-").append(str); //$NON-NLS-1$
|
||||
}else {
|
||||
Matcher matcher = pattern.matcher(str);
|
||||
if (matcher.find()) {
|
||||
find = true;
|
||||
versionStr.append(str); // $NON-NLS-1$
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return getTalendVersion(versionStr.toString());
|
||||
}
|
||||
|
||||
public static String getTalendVersion(String productVersion) {
|
||||
try {
|
||||
org.osgi.framework.Version v = new org.osgi.framework.Version(productVersion);
|
||||
|
||||
@@ -342,7 +342,7 @@ public class CharsetToolkit {
|
||||
return (buffer[0] == -2 && buffer[1] == -1);
|
||||
}
|
||||
|
||||
public static String getCharset(File file) {
|
||||
public static String getCharset(File file){
|
||||
String charset = "UTF-8";
|
||||
byte[] fileContent = null;
|
||||
FileInputStream fin = null;
|
||||
@@ -350,18 +350,11 @@ public class CharsetToolkit {
|
||||
fin = new FileInputStream(file.getPath());
|
||||
fileContent = new byte[(int) file.length()];
|
||||
fin.read(fileContent);
|
||||
byte[] data = fileContent;
|
||||
|
||||
byte[] data = fileContent;
|
||||
charset = getCharset(data);
|
||||
} catch (IOException e) {
|
||||
charset = "UTF-8";
|
||||
} finally {
|
||||
if (fin != null) {
|
||||
try {
|
||||
fin.close();
|
||||
} catch (IOException e) {
|
||||
// Ignore here
|
||||
}
|
||||
}
|
||||
}
|
||||
return charset;
|
||||
}
|
||||
|
||||
@@ -49,10 +49,9 @@ public class NetworkUtil {
|
||||
if ("true".equals(disableInternet)) { //$NON-NLS-1$
|
||||
return false;
|
||||
}
|
||||
HttpURLConnection conn = null;
|
||||
try {
|
||||
URL url = new URL(HTTP_NETWORK_URL);
|
||||
conn = (HttpURLConnection) url.openConnection();
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setConnectTimeout(4000);
|
||||
conn.setReadTimeout(4000);
|
||||
|
||||
@@ -64,36 +63,9 @@ public class NetworkUtil {
|
||||
if (strMessage.equals("OK")) { //$NON-NLS-1$
|
||||
return true;
|
||||
}
|
||||
conn.disconnect();
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
} finally {
|
||||
conn.disconnect();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isNetworkValid(String url) {
|
||||
if (url == null) {
|
||||
return isNetworkValid();
|
||||
}
|
||||
return checkValidWithHttp(url);
|
||||
}
|
||||
|
||||
private static boolean checkValidWithHttp(String urlString) {
|
||||
HttpURLConnection conn = null;
|
||||
try {
|
||||
URL url = new URL(urlString);
|
||||
conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setConnectTimeout(4000);
|
||||
conn.setReadTimeout(4000);
|
||||
conn.setRequestMethod("HEAD"); //$NON-NLS-1$
|
||||
conn.getResponseMessage();
|
||||
} catch (Exception e) {
|
||||
// if not reachable , will throw exception(time out/unknown host) .So if catched exception, make it a
|
||||
// invalid server
|
||||
return false;
|
||||
} finally {
|
||||
conn.disconnect();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -13,155 +13,37 @@
|
||||
package org.talend.commons.utils.network;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.PasswordAuthentication;
|
||||
import java.net.Proxy;
|
||||
import java.net.ProxySelector;
|
||||
import java.net.SocketAddress;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Priority;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.i18n.internal.Messages;
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public class TalendProxySelector extends ProxySelector {
|
||||
|
||||
public static final String PROP_PRINT_LOGS = "talend.studio.proxy.printLogs";
|
||||
|
||||
private static final String ECLIPSE_PROXY_SELECTOR = ".EclipseProxySelector"; //$NON-NLS-1$
|
||||
|
||||
private static final String PROP_ALLOW_PROXY_REDIRECT = "talend.studio.proxy.allowProxyRedirect";
|
||||
|
||||
private static final String PROP_ALLOW_PROXY_REDIRECT_EXCLUDE = "talend.studio.proxy.redirect.whiteList";
|
||||
|
||||
private static final String PROP_PROXY_HOST_MAP = "talend.studio.proxy.hostMap";
|
||||
|
||||
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
|
||||
*/
|
||||
private static final String PROP_PROXY_MAP_HOST_DEFAULT = "";
|
||||
|
||||
/**
|
||||
* Example: svn.company.com;nexus.company.com
|
||||
*/
|
||||
private static final String PROP_ALLOW_PROXY_REDIRECT_EXCLUDE_DEFAULT = "";
|
||||
|
||||
private static final String KEY_DEFAULT = ":default:";
|
||||
|
||||
private ProxySelector defaultSelector;
|
||||
|
||||
final private Map<Object, Collection<IProxySelectorProvider>> selectorProviders;
|
||||
|
||||
private Map<String, Map<String, String>> hostMap;
|
||||
|
||||
private Set<String> redirectWhiteList;
|
||||
final private List<IProxySelectorProvider> selectorProviders;
|
||||
|
||||
private volatile static TalendProxySelector instance;
|
||||
|
||||
private static Object instanceLock = new Object();
|
||||
|
||||
private boolean printProxyLog = false;
|
||||
|
||||
private boolean allowProxyRedirect = false;
|
||||
|
||||
private boolean disableDefaultSelector = false;
|
||||
|
||||
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()));
|
||||
disableDefaultSelector = Boolean.valueOf(System.getProperty(PROP_DISABLE_DEFAULT_SELECTOR, Boolean.FALSE.toString()));
|
||||
printProxyLog = Boolean.valueOf(System.getProperty(PROP_PRINT_LOGS, Boolean.FALSE.toString()));
|
||||
|
||||
initHostMap();
|
||||
initRedirectList();
|
||||
}
|
||||
|
||||
private void initHostMap() {
|
||||
try {
|
||||
hostMap = new HashMap<>();
|
||||
String property = System.getProperty(PROP_PROXY_HOST_MAP, PROP_PROXY_MAP_HOST_DEFAULT);
|
||||
if (StringUtils.isEmpty(property)) {
|
||||
return;
|
||||
}
|
||||
String[] splits = property.split(";");
|
||||
for (String split : splits) {
|
||||
try {
|
||||
int index = split.indexOf(',');
|
||||
String uri = split.substring(0, index);
|
||||
String key = StringUtils.strip(uri);
|
||||
if (StringUtils.isBlank(key)) {
|
||||
key = KEY_DEFAULT;
|
||||
}
|
||||
key = key.toLowerCase();
|
||||
Map<String, String> protocolMap = hostMap.get(key);
|
||||
if (protocolMap == null) {
|
||||
protocolMap = new HashMap<>();
|
||||
hostMap.put(key, protocolMap);
|
||||
}
|
||||
int protocolMapIndex = index + 1;
|
||||
String protocolMapStr = split.substring(protocolMapIndex);
|
||||
String[] entry = protocolMapStr.split(",");
|
||||
for (String pMap : entry) {
|
||||
try {
|
||||
String[] mapEntry = pMap.split(":");
|
||||
if (mapEntry.length != 2) {
|
||||
ExceptionHandler.process(
|
||||
new Exception(Messages.getString("TalendProxySelector.exception.badUriMap", pMap)));
|
||||
continue;
|
||||
}
|
||||
protocolMap.put(mapEntry[0].toLowerCase(), mapEntry[1].toLowerCase());
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void initRedirectList() {
|
||||
try {
|
||||
redirectWhiteList = new HashSet<>();
|
||||
String property = System.getProperty(PROP_ALLOW_PROXY_REDIRECT_EXCLUDE, PROP_ALLOW_PROXY_REDIRECT_EXCLUDE_DEFAULT);
|
||||
if (StringUtils.isEmpty(property)) {
|
||||
return;
|
||||
}
|
||||
String[] split = property.split(";");
|
||||
for (String host : split) {
|
||||
host = StringUtils.strip(host);
|
||||
if (StringUtils.isBlank(host)) {
|
||||
host = KEY_DEFAULT;
|
||||
}
|
||||
redirectWhiteList.add(host);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
selectorProviders = new ArrayList<>();
|
||||
}
|
||||
|
||||
public static TalendProxySelector getInstance() {
|
||||
@@ -199,109 +81,8 @@ public class TalendProxySelector extends ProxySelector {
|
||||
|
||||
@Override
|
||||
public List<Proxy> select(final URI uri) {
|
||||
Set<Proxy> results = new LinkedHashSet<>();
|
||||
|
||||
try {
|
||||
final Set<Proxy> resultFromProviders = getProxysFromProviders(uri);
|
||||
if (resultFromProviders != null && !resultFromProviders.isEmpty()) {
|
||||
results.addAll(resultFromProviders);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
|
||||
ProxySelector defaultProxySelector = getDefaultProxySelector();
|
||||
if (defaultProxySelector != null) {
|
||||
URI newUri = getNewUri(uri);
|
||||
List<Proxy> defaultProxys = defaultProxySelector.select(newUri);
|
||||
try {
|
||||
results.addAll(filterProxys(uri, defaultProxys));
|
||||
} catch (Exception e) {
|
||||
results.addAll(defaultProxys);
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
if (printProxyLog) {
|
||||
String proxys = results.toString();
|
||||
ExceptionHandler.log("Selected proxys for " + uri + ", " + proxys);
|
||||
ExceptionHandler.process(new Exception("Proxy call stacks"), Priority.INFO);
|
||||
}
|
||||
return new LinkedList<Proxy>(results);
|
||||
}
|
||||
|
||||
private List<Proxy> filterProxys(final URI uri, List<Proxy> defaultProxys) {
|
||||
List<Proxy> result = new ArrayList<>();
|
||||
if (defaultProxys != null && !defaultProxys.isEmpty()) {
|
||||
for (Proxy proxy : defaultProxys) {
|
||||
SocketAddress addr = null;
|
||||
Proxy.Type proxyType = null;
|
||||
if (proxy != null) {
|
||||
proxyType = proxy.type();
|
||||
addr = proxy.address();
|
||||
}
|
||||
|
||||
boolean redirect = true;
|
||||
if (!allowProxyRedirect) {
|
||||
String host = uri.getHost();
|
||||
if (host == null) {
|
||||
host = "";
|
||||
}
|
||||
host = StringUtils.strip(host).toLowerCase();
|
||||
if (this.redirectWhiteList.contains(host) || this.redirectWhiteList.contains(KEY_DEFAULT)) {
|
||||
redirect = true;
|
||||
} else if (Proxy.Type.DIRECT == proxyType
|
||||
|| (addr != null && StringUtils.equals(uri.getHost(), ((InetSocketAddress) addr).getHostString()))) {
|
||||
redirect = false;
|
||||
}
|
||||
}
|
||||
if (redirect) {
|
||||
result.add(proxy);
|
||||
} else {
|
||||
result.add(Proxy.NO_PROXY);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private URI getNewUri(URI uri) {
|
||||
URI newUri = uri;
|
||||
if (newUri != null) {
|
||||
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)) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return newUri;
|
||||
}
|
||||
|
||||
private Set<Proxy> getProxysFromProviders(final URI uri) {
|
||||
final Set<Proxy> resultFromProviders = new LinkedHashSet<>();
|
||||
Collection<IProxySelectorProvider> providers = getCustomProviders(uri);
|
||||
final Set<Proxy> resultFromProviders = new HashSet<>();
|
||||
List<IProxySelectorProvider> providers = getProxySelectorProviders();
|
||||
if (providers != null) {
|
||||
providers.stream().forEach(p -> {
|
||||
if (instance == p) {
|
||||
@@ -319,79 +100,36 @@ public class TalendProxySelector extends ProxySelector {
|
||||
}
|
||||
});
|
||||
}
|
||||
return resultFromProviders;
|
||||
}
|
||||
List<Proxy> result = new ArrayList<>();
|
||||
|
||||
private Collection<IProxySelectorProvider> getCustomProviders(final URI uri) {
|
||||
Collection<IProxySelectorProvider> providers = Collections.EMPTY_LIST;
|
||||
Collection<Object> possibleKeys = getPossibleKeys(uri);
|
||||
for (Object key : possibleKeys) {
|
||||
providers = this.selectorProviders.get(key);
|
||||
if (providers != null) {
|
||||
break;
|
||||
if (resultFromProviders != null && !resultFromProviders.isEmpty()) {
|
||||
result.addAll(resultFromProviders);
|
||||
}
|
||||
|
||||
ProxySelector defaultProxySelector = getDefaultProxySelector();
|
||||
if (defaultProxySelector != null) {
|
||||
List<Proxy> defaultProxys = defaultProxySelector.select(uri);
|
||||
if (defaultProxys != null && !defaultProxys.isEmpty()) {
|
||||
result.addAll(defaultProxys);
|
||||
}
|
||||
}
|
||||
return providers;
|
||||
}
|
||||
|
||||
public PasswordAuthentication getHttpPasswordAuthentication() {
|
||||
String[] schemas = new String[] { "http", "https" };
|
||||
for (String schema : schemas) {
|
||||
String proxyUser = System.getProperty(schema + ".proxyUser");
|
||||
String proxyPassword = System.getProperty(schema + ".proxyPassword");
|
||||
|
||||
if (StringUtils.isNotBlank(proxyUser)) {
|
||||
char[] pwdChars = new char[0];
|
||||
if (proxyPassword != null && !proxyPassword.isEmpty()) {
|
||||
pwdChars = proxyPassword.toCharArray();
|
||||
}
|
||||
return new PasswordAuthentication(proxyUser, pwdChars);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return result;
|
||||
}
|
||||
|
||||
public boolean addProxySelectorProvider(IProxySelectorProvider provider) {
|
||||
try {
|
||||
Object key = provider.getKey();
|
||||
Collection<IProxySelectorProvider> collection = this.selectorProviders.get(key);
|
||||
if (collection == null) {
|
||||
synchronized (this.selectorProviders) {
|
||||
collection = this.selectorProviders.get(key);
|
||||
if (collection == null) {
|
||||
collection = Collections.synchronizedList(new LinkedList<>());
|
||||
this.selectorProviders.put(key, collection);
|
||||
}
|
||||
}
|
||||
}
|
||||
collection.add(provider);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
List<IProxySelectorProvider> proxySelectorProviders = getProxySelectorProviders();
|
||||
if (!proxySelectorProviders.contains(provider)) {
|
||||
return proxySelectorProviders.add(provider);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean removeProxySelectorProvider(IProxySelectorProvider provider) {
|
||||
try {
|
||||
Object key = provider.getKey();
|
||||
Collection<IProxySelectorProvider> collection = this.selectorProviders.get(key);
|
||||
if (collection != null) {
|
||||
synchronized (this.selectorProviders) {
|
||||
collection = this.selectorProviders.get(key);
|
||||
if (collection != null) {
|
||||
collection.remove(provider);
|
||||
if (collection.isEmpty()) {
|
||||
this.selectorProviders.remove(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return false;
|
||||
return getProxySelectorProviders().remove(provider);
|
||||
}
|
||||
|
||||
private List<IProxySelectorProvider> getProxySelectorProviders() {
|
||||
return selectorProviders;
|
||||
}
|
||||
|
||||
public ProxySelector getDefaultProxySelector() {
|
||||
@@ -404,7 +142,7 @@ public class TalendProxySelector extends ProxySelector {
|
||||
|
||||
@Override
|
||||
public void connectFailed(final URI uri, final SocketAddress sa, final IOException ioe) {
|
||||
Collection<IProxySelectorProvider> providers = getCustomProviders(uri);
|
||||
List<IProxySelectorProvider> providers = getProxySelectorProviders();
|
||||
if (providers != null) {
|
||||
providers.stream().forEach(p -> {
|
||||
if (p.canHandle(uri)) {
|
||||
@@ -419,110 +157,22 @@ public class TalendProxySelector extends ProxySelector {
|
||||
}
|
||||
}
|
||||
|
||||
public IProxySelectorProvider createDefaultProxySelectorProvider() {
|
||||
if (disableDefaultSelector) {
|
||||
return null;
|
||||
}
|
||||
return new DefaultProxySelectorProvider(Thread.currentThread());
|
||||
}
|
||||
|
||||
public IProxySelectorProvider createDefaultProxySelectorProvider(String host) {
|
||||
if (disableDefaultSelector) {
|
||||
return null;
|
||||
}
|
||||
return new DefaultProxySelectorProvider(host);
|
||||
}
|
||||
|
||||
public static Collection<Object> getPossibleKeys(URI uri) {
|
||||
Collection<Object> possibleKeys = new ArrayList<>();
|
||||
possibleKeys.add(Thread.currentThread());
|
||||
if (uri != null) {
|
||||
String uriHost = uri.getHost();
|
||||
if (StringUtils.isNotBlank(uriHost)) {
|
||||
possibleKeys.add(uriHost);
|
||||
}
|
||||
}
|
||||
return possibleKeys;
|
||||
}
|
||||
|
||||
private class DefaultProxySelectorProvider extends AbstractProxySelectorProvider {
|
||||
|
||||
private Thread currentThread = null;
|
||||
|
||||
private String host = null;
|
||||
|
||||
public DefaultProxySelectorProvider(Thread thread) {
|
||||
this.currentThread = thread;
|
||||
}
|
||||
|
||||
public DefaultProxySelectorProvider(String host) {
|
||||
this.host = host;
|
||||
if (StringUtils.isNotBlank(this.host)) {
|
||||
this.host = this.host.toLowerCase();
|
||||
}
|
||||
}
|
||||
public static abstract class AbstractProxySelectorProvider implements IProxySelectorProvider {
|
||||
|
||||
@Override
|
||||
public Object getKey() {
|
||||
if (this.currentThread != null) {
|
||||
return currentThread;
|
||||
}
|
||||
if (this.host != null) {
|
||||
return this.host;
|
||||
}
|
||||
return super.getKey();
|
||||
public void connectFailed(final URI uri, final SocketAddress sa, final IOException ioe) {
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHandle(URI uri) {
|
||||
if (disableDefaultSelector) {
|
||||
return false;
|
||||
}
|
||||
if (currentThread != null && Thread.currentThread() == currentThread) {
|
||||
return true;
|
||||
}
|
||||
if (host != null) {
|
||||
if (uri == null) {
|
||||
return false;
|
||||
}
|
||||
String uriHost = uri.getHost();
|
||||
if (StringUtils.isNotBlank(uriHost)) {
|
||||
return this.host.equals(uriHost.toLowerCase());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Proxy> select(URI uri) {
|
||||
List<Proxy> result = new ArrayList<>();
|
||||
try {
|
||||
ProxySelector defaultProxySelector = getDefaultProxySelector();
|
||||
if (defaultProxySelector != null) {
|
||||
List<Proxy> defaultProxys = defaultProxySelector.select(uri);
|
||||
if (defaultProxys != null && !defaultProxys.isEmpty()) {
|
||||
for (Proxy proxy : defaultProxys) {
|
||||
SocketAddress addr = null;
|
||||
Proxy.Type proxyType = null;
|
||||
if (proxy != null) {
|
||||
proxyType = proxy.type();
|
||||
addr = proxy.address();
|
||||
}
|
||||
if (Proxy.Type.DIRECT == proxyType || (addr != null
|
||||
&& StringUtils.equals(uri.getHost(), ((InetSocketAddress) addr).getHostString()))) {
|
||||
result.add(Proxy.NO_PROXY);
|
||||
} else {
|
||||
result.add(proxy);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
public static interface IProxySelectorProvider {
|
||||
|
||||
boolean canHandle(final URI uri);
|
||||
|
||||
List<Proxy> select(final URI uri);
|
||||
|
||||
void connectFailed(final URI uri, final SocketAddress sa, final IOException ioe);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -136,4 +136,3 @@ ArchiveDirectoryChooser.DataTransfer_browse=B&rowse...
|
||||
ArchiveDirectoryChooser.WizardProjectsImportPage_ArchiveSelectTitle=Select &archive file:
|
||||
ArchiveDirectoryChooser.FileExport_selectDestinationMessage=Select a directory to export to.
|
||||
ArchiveDirectoryChooser.ArchiveExport_description=Export resources to an archive file on the local file system.
|
||||
DisplayUtils.NotSupportedExceptionOnLinux=Linux/Unit doesn't support multiple display.
|
||||
|
||||
@@ -20,8 +20,6 @@ import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.ui.i18n.Messages;
|
||||
import org.talend.commons.utils.system.EnvironmentUtils;
|
||||
|
||||
/**
|
||||
* Utility methods to work with Display object
|
||||
@@ -130,13 +128,6 @@ public class DisplayUtils {
|
||||
}
|
||||
|
||||
public static void syncExecInNewUIThread(Runnable runnable, DeviceData deviceData) throws Exception {
|
||||
/**
|
||||
* Linux doesn't allow creating a display instance in a new thread after upgrading eclipse platform 4.10, we can
|
||||
* remove this check if future eclipse version support it again
|
||||
*/
|
||||
if (EnvironmentUtils.isLinuxUnixSystem()) {
|
||||
throw new UnsupportedOperationException(Messages.getString("DisplayUtils.NotSupportedExceptionOnLinux"));//$NON-NLS-1$
|
||||
}
|
||||
final Semaphore semaphore = new Semaphore(1, true);
|
||||
semaphore.acquire();
|
||||
Thread thread = new Thread(new Runnable() {
|
||||
|
||||
@@ -22,7 +22,6 @@ import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.ScrollBar;
|
||||
import org.eclipse.swt.widgets.Table;
|
||||
import org.eclipse.swt.widgets.Tree;
|
||||
@@ -112,7 +111,7 @@ public class BackgroundRefresher implements IBackgroundRefresher {
|
||||
*/
|
||||
@Override
|
||||
protected void execute(final boolean isFinalExecution, Object data) {
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
drawableComposite.getBgDrawableComposite().getDisplay().syncExec(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
if (isFinalExecution) {
|
||||
@@ -340,7 +339,7 @@ public class BackgroundRefresher implements IBackgroundRefresher {
|
||||
}
|
||||
if ((WindowSystem.isGTK() || EnvironmentUtils.isMacOsSytem()) && child instanceof Tree) {
|
||||
returnedPoint.y += ((Tree) child).getHeaderHeight();
|
||||
returnedPoint.y += ((Tree) child).getItemHeight();
|
||||
returnedPoint.y += ((Table) child).getItemHeight();
|
||||
}
|
||||
child = child.getParent();
|
||||
ScrollBar vScrollBar = child.getVerticalBar();
|
||||
|
||||
@@ -33,7 +33,6 @@ import org.eclipse.swt.widgets.TreeItem;
|
||||
import org.talend.commons.ui.runtime.i18n.Messages;
|
||||
import org.talend.commons.ui.runtime.utils.TableUtils;
|
||||
import org.talend.commons.ui.runtime.ws.WindowSystem;
|
||||
import org.talend.commons.ui.swt.advanced.dataeditor.AbstractDataTableEditorView;
|
||||
import org.talend.commons.ui.swt.drawing.background.IBackgroundRefresher;
|
||||
import org.talend.commons.ui.swt.drawing.background.IBgDrawableComposite;
|
||||
import org.talend.commons.ui.swt.drawing.link.BezierHorizontalLink;
|
||||
@@ -465,19 +464,4 @@ public class TreeToTablesLinker<D1, D2> extends BgDrawableComposite implements I
|
||||
}
|
||||
}
|
||||
|
||||
protected <B> void loadItemDataForLazyLoad(AbstractDataTableEditorView<B> tableEditorView) {
|
||||
if (!tableEditorView.getTableViewerCreator().isLazyLoad()) {
|
||||
return;
|
||||
}
|
||||
List<B> beansList = tableEditorView.getExtendedTableModel().getBeansList();
|
||||
Table table = tableEditorView.getTable();
|
||||
for (TableItem tableItem : table.getItems()) {
|
||||
if (tableItem.getData() == null) {
|
||||
int index = table.indexOf(tableItem);
|
||||
B schemaTarget = beansList.get(index);
|
||||
tableItem.setData(schemaTarget);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -212,5 +212,4 @@ RenameFolderAction.warning.cannotFind.message=Cannot rename folder, it may have
|
||||
RenameFolderAction.warning.cannotFind.title=Action not available
|
||||
|
||||
ConvertJobsUtil.warning.title=Warning
|
||||
ConvertJobsUtil.warning.message=The target framework is not fully supported for this release.
|
||||
SyncLibrariesLoginTask.createStatsLogAndImplicitParamter=Create stats log and implicit parameters
|
||||
ConvertJobsUtil.warning.message=The target framework is not fully supported for this release.
|
||||
@@ -2,25 +2,12 @@ package org.talend.core.repository.logintask;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import org.eclipse.core.resources.IResourceRuleFactory;
|
||||
import org.eclipse.core.resources.IWorkspace;
|
||||
import org.eclipse.core.resources.IWorkspaceRunnable;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.jobs.ISchedulingRule;
|
||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.exception.LoginException;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.ICoreService;
|
||||
import org.talend.core.repository.i18n.Messages;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
import org.talend.core.repository.utils.ProjectDataJsonProvider;
|
||||
import org.talend.login.AbstractLoginTask;
|
||||
import org.talend.repository.ProjectManager;
|
||||
import org.talend.repository.RepositoryWorkUnit;
|
||||
|
||||
public class SyncLibrariesLoginTask extends AbstractLoginTask implements IRunnableWithProgress {
|
||||
|
||||
@@ -33,38 +20,7 @@ public class SyncLibrariesLoginTask extends AbstractLoginTask implements IRunnab
|
||||
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
||||
try {
|
||||
if (ProjectDataJsonProvider.hasFilledProjectSettingFile(ProjectManager.getInstance().getCurrentProject())) {
|
||||
return;
|
||||
}
|
||||
} catch (PersistenceException e1) {
|
||||
ExceptionHandler.process(e1);
|
||||
return;
|
||||
}
|
||||
ProxyRepositoryFactory.getInstance().executeRepositoryWorkUnit(
|
||||
new RepositoryWorkUnit<Void>(Messages.getString("SyncLibrariesLoginTask.createStatsLogAndImplicitParamter")) {
|
||||
|
||||
@Override
|
||||
protected void run() throws LoginException, PersistenceException {
|
||||
try {
|
||||
IWorkspace workspace = ResourcesPlugin.getWorkspace();
|
||||
IResourceRuleFactory ruleFactory = workspace.getRuleFactory();
|
||||
ProjectManager projectManager = ProjectManager.getInstance();
|
||||
ISchedulingRule refreshRule = ruleFactory.refreshRule(
|
||||
projectManager.getResourceProject(projectManager.getCurrentProject().getEmfProject()));
|
||||
workspace.run(new IWorkspaceRunnable() {
|
||||
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws CoreException {
|
||||
coreService
|
||||
.createStatsLogAndImplicitParamter(ProjectManager.getInstance().getCurrentProject());
|
||||
}
|
||||
}, refreshRule, IWorkspace.AVOID_UPDATE, monitor);
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
coreService.createStatsLogAndImplicitParamter(ProjectManager.getInstance().getCurrentProject());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -215,18 +215,8 @@ public interface IRepositoryFactory {
|
||||
public void deleteObjectPhysical(Project project, IRepositoryViewObject objToDelete, String version,
|
||||
boolean fromEmptyRecycleBin, boolean isDeleteOnRemote) throws PersistenceException;
|
||||
|
||||
/**
|
||||
*
|
||||
* Batch delete the object of the given object list.
|
||||
*
|
||||
* @param project - The object's project.
|
||||
* @param objToDeleteList - The objects list.
|
||||
* @param isDeleteAllVersion - True: delete all version by object id; False: delete object by id and version.
|
||||
* @param isDeleteOnRemote
|
||||
* @throws PersistenceException
|
||||
*/
|
||||
public void batchDeleteObjectPhysical(Project project, List<IRepositoryViewObject> objToDeleteList,
|
||||
boolean isDeleteAllVersion, boolean isDeleteOnRemote) throws PersistenceException;
|
||||
public void batchDeleteObjectPhysical(Project project, List<IRepositoryViewObject> objToDeleteList, boolean isDeleteOnRemote)
|
||||
throws PersistenceException;
|
||||
|
||||
/**
|
||||
* Restore a logically deleted object. <code>isDeleted</code> on this object will now returned <code>false</code>.
|
||||
|
||||
@@ -774,20 +774,6 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
log.info(Messages.getString("ProxyRepositoryFactory.log.physicalDeletion", str)); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.talend.repository.model.IProxyRepositoryFactory#forceBatchDeleteObjectPhysical(org.talend.core.model.general.
|
||||
* Project, java.util.List, boolean, boolean)
|
||||
*/
|
||||
@Override
|
||||
public void forceBatchDeleteObjectPhysical(Project project, List<IRepositoryViewObject> objToDeleteList,
|
||||
boolean isDeleteAllVersion, boolean isDeleteOnRemote) throws PersistenceException {
|
||||
this.repositoryFactoryFromProvider.batchDeleteObjectPhysical(project, objToDeleteList, isDeleteAllVersion,
|
||||
isDeleteOnRemote);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
@@ -946,7 +932,7 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
.getService(IRunProcessService.class);
|
||||
service.batchDeleteAllVersionTalendJobProject(idList);
|
||||
}
|
||||
this.repositoryFactoryFromProvider.batchDeleteObjectPhysical(project, repositoryObjectList, true, false);
|
||||
this.repositoryFactoryFromProvider.batchDeleteObjectPhysical(project, repositoryObjectList, false);
|
||||
|
||||
// save project will handle git/svn update
|
||||
this.repositoryFactoryFromProvider.saveProject(project);
|
||||
|
||||
@@ -406,38 +406,6 @@ public class ProjectDataJsonProvider {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean hasFilledProjectSettingFile(org.talend.core.model.general.Project project) throws PersistenceException {
|
||||
FileInputStream InputStream = null;
|
||||
boolean hasFilled = false;
|
||||
try {
|
||||
IProject physProject = ResourceUtils.getProject(project);
|
||||
IPath location = physProject.getLocation();
|
||||
File file = ProjectDataJsonProvider.getLoadingConfigurationFile(location, FileConstants.PROJECTSETTING_FILE_NAME);
|
||||
if (file != null && file.exists()) {
|
||||
InputStream = new FileInputStream(file);
|
||||
ProjectSettings projectSetting = new ObjectMapper().readValue(new FileInputStream(file), ProjectSettings.class);
|
||||
if (projectSetting != null) {
|
||||
ImplicitContextSettingJson implicitContextSettingJson = projectSetting.getImplicitContextSettingJson();
|
||||
if (implicitContextSettingJson != null) {
|
||||
ParametersTypeJson parametersTypeJson = implicitContextSettingJson.getParametersTypeJson();
|
||||
if (parametersTypeJson != null) {
|
||||
List<ElementParameterTypeJson> elementParameters = parametersTypeJson.getElementParameters();
|
||||
if (elementParameters.size() > 0) {
|
||||
hasFilled = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e1) {
|
||||
throw new PersistenceException(e1);
|
||||
} finally {
|
||||
closeInputStream(InputStream);
|
||||
}
|
||||
return hasFilled;
|
||||
}
|
||||
|
||||
protected static ImplicitContextSettingJson getImplicitContextSettingJson(ImplicitContextSettings implicitContextSettings) {
|
||||
if (implicitContextSettings != null) {
|
||||
ImplicitContextSettingJson implicitContextSettingJson = new ImplicitContextSettingJson(implicitContextSettings);
|
||||
|
||||
@@ -131,22 +131,4 @@ public class ProjectHelper {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* define the different value for the project types the string value in the licence files Matcht the java enum name
|
||||
* this is a copy of org.talend.commons.model.KeyConstants.ProjectType to avoid adding the all library
|
||||
*
|
||||
*/
|
||||
public static enum ProjectType {
|
||||
DI,
|
||||
DQ,
|
||||
MDM;
|
||||
}
|
||||
|
||||
public static int getProjectTypeOrdinal(org.talend.core.model.properties.Project project) {
|
||||
if (project != null && project.getType() != null) {
|
||||
return ProjectType.valueOf(project.getType()).ordinal();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
<dbType type="CHAR"/>
|
||||
<dbType type="NCHAR"/>
|
||||
<dbType type="LONG"/>
|
||||
<dbType type="CLOB"/>
|
||||
<dbtype type="CLOB"/>
|
||||
</talendType>
|
||||
</talendToDbTypes>
|
||||
<dbToTalendTypes><!-- Adviced mappings -->
|
||||
|
||||
@@ -29,8 +29,6 @@
|
||||
<dbType type="xs:time" ignoreLen="true" ignorePre="true"/>
|
||||
<dbType type="xs:decimal" ignoreLen="true" ignorePre="true"/>
|
||||
<dbType type="xs:QName" ignoreLen="true" ignorePre="true"/>
|
||||
<dbType type="xs:list" ignoreLen="true" ignorePre="true"/>
|
||||
<dbType type="xs:union" ignoreLen="true" ignorePre="true"/>
|
||||
</dbTypes>
|
||||
|
||||
<language name="java">
|
||||
@@ -143,12 +141,6 @@
|
||||
<dbType type="xs:time">
|
||||
<talendType type="id_Date" default="true" />
|
||||
</dbType>
|
||||
<dbType type="xs:list">
|
||||
<talendType type="id_List" default="true" />
|
||||
</dbType>
|
||||
<dbType type="xs:union">
|
||||
<talendType type="id_Object" default="true" />
|
||||
</dbType>
|
||||
</dbToTalendTypes>
|
||||
</language>
|
||||
</dbms>
|
||||
|
||||
@@ -12,14 +12,11 @@
|
||||
// ============================================================================
|
||||
package org.talend.core;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.talend.core.model.process.INode;
|
||||
import org.talend.core.model.process.IProcess;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.utils.IXSDPopulationUtil;
|
||||
@@ -50,8 +47,6 @@ public interface IESBService extends IService {
|
||||
|
||||
public StringBuffer getAllTheJObNames(IRepositoryNode jobList);
|
||||
|
||||
public List<String> getSerivceRelatedJobIds(Item serviceItem);
|
||||
|
||||
public void deleteOldRelation(String jobID);
|
||||
|
||||
// public void setSelectedItem(Item, )
|
||||
@@ -64,8 +59,6 @@ public interface IESBService extends IService {
|
||||
|
||||
public void copyDataServiceRelateJob(Item newItem);
|
||||
|
||||
public boolean isRESTService(ProcessItem processItem);
|
||||
|
||||
public IXSDPopulationUtil getXSDPopulationUtil();
|
||||
|
||||
public boolean isWSDLEditor(IWorkbenchPart part);
|
||||
|
||||
@@ -89,8 +89,6 @@ public interface ILibraryManagerService extends IService {
|
||||
* @return
|
||||
*/
|
||||
public boolean retrieve(String jarNeeded, String pathToStore, IProgressMonitor... monitorWrap);
|
||||
|
||||
public boolean retrieve(String jarNeeded, String jarURL, String pathToStore, IProgressMonitor... monitorWrap);
|
||||
|
||||
public boolean retrieve(String jarNeeded, String pathToStore, boolean showDialog, IProgressMonitor... monitorWrap);
|
||||
|
||||
@@ -208,12 +206,8 @@ public interface ILibraryManagerService extends IService {
|
||||
*/
|
||||
public boolean isJarNeedToBeDeployed(File jarFile);
|
||||
|
||||
public boolean isSameFile(File f1, File f2);
|
||||
|
||||
public void checkModuleStatus(ModuleNeeded module);
|
||||
|
||||
public String getJarNameFromMavenuri(String mavenURI);
|
||||
|
||||
public void guessMavenRUIFromIndex(File jarFile, Map<String, String> sourceAndMavenUri);
|
||||
|
||||
}
|
||||
|
||||
@@ -210,9 +210,4 @@ public interface ITDQRepositoryService extends IService {
|
||||
* @param ruManager: RepositoryUpdateManager
|
||||
*/
|
||||
void updateAllContextInAnalysisAndReport(RepositoryUpdateManager ruManager, Object parameter, boolean isUpdated);
|
||||
|
||||
/**
|
||||
* @param chooseContext the context name which want to swtich
|
||||
*/
|
||||
void popupSwitchContextFailedMessage(String chooseContext);
|
||||
}
|
||||
|
||||
@@ -316,7 +316,7 @@ public class ClassLoaderFactory {
|
||||
String jarsStr = (String) metadataConn.getParameter(ConnParameterKeys.CONN_PARA_KEY_HADOOP_CUSTOM_JARS);
|
||||
moduleList = jarsStr.split(";"); //$NON-NLS-1$
|
||||
} else {
|
||||
String index = getDistributionIndex(metadataConn);
|
||||
String index = getDistributionIndex(metadataConn); //$NON-NLS-1$
|
||||
moduleList = getDriverModuleList(index);
|
||||
}
|
||||
return moduleList;
|
||||
@@ -365,41 +365,39 @@ public class ClassLoaderFactory {
|
||||
return hdClassLoader;
|
||||
}
|
||||
|
||||
private static IConfigurationElement[] getConfigurationElements() {
|
||||
checkCache();
|
||||
private static synchronized IConfigurationElement[] getConfigurationElements() {
|
||||
if (isCacheChanged()) {
|
||||
IExtensionRegistry registry = Platform.getExtensionRegistry();
|
||||
configurationElements = registry.getConfigurationElementsFor(EXTENSION_POINT_ID);
|
||||
}
|
||||
return configurationElements;
|
||||
}
|
||||
|
||||
private synchronized static void checkCache() {
|
||||
boolean isCacheChanged = false;
|
||||
private static boolean isCacheChanged() {
|
||||
if (classLoadersMap == null) {
|
||||
return true;
|
||||
}
|
||||
if (configurationElements == null) {
|
||||
return true;
|
||||
}
|
||||
if (configurationElements != null) {
|
||||
for (IConfigurationElement configElement : configurationElements) {
|
||||
if (!configElement.isValid()) {
|
||||
isCacheChanged = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!StringUtils.equals(cacheVersion, BigDataBasicUtil.getDynamicDistributionCacheVersion())) {
|
||||
isCacheChanged = true;
|
||||
}
|
||||
if (isCacheChanged) {
|
||||
init();
|
||||
IExtensionRegistry registry = Platform.getExtensionRegistry();
|
||||
configurationElements = registry.getConfigurationElementsFor(EXTENSION_POINT_ID);
|
||||
cacheVersion = BigDataBasicUtil.getDynamicDistributionCacheVersion();
|
||||
} else {
|
||||
if (classLoadersMap == null) {
|
||||
init();
|
||||
}
|
||||
if (configurationElements == null) {
|
||||
IExtensionRegistry registry = Platform.getExtensionRegistry();
|
||||
configurationElements = registry.getConfigurationElementsFor(EXTENSION_POINT_ID);
|
||||
}
|
||||
if (cacheVersion != null && !cacheVersion.equals(BigDataBasicUtil.getDynamicDistributionCacheVersion())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static Map<String, DynamicClassLoader> getClassLoaderMap() {
|
||||
checkCache();
|
||||
if (isCacheChanged()) {
|
||||
init();
|
||||
cacheVersion = BigDataBasicUtil.getDynamicDistributionCacheVersion();
|
||||
}
|
||||
return classLoadersMap;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,8 +47,6 @@ public class DatabaseConnStrUtil {
|
||||
// for match url has :<port> exist
|
||||
private static final String PATTERN_PORT = "(:\\d{1,5})";
|
||||
|
||||
private static final String DATABASE_STRING = "DATABASE=";
|
||||
|
||||
private static String getStringReplace(final String init, final String before, final String after,
|
||||
final boolean supportContext) {
|
||||
return getStringReplace(init, before, after, supportContext, false);
|
||||
@@ -129,13 +127,6 @@ public class DatabaseConnStrUtil {
|
||||
} else {
|
||||
s = getStringReplace(s, EDatabaseConnVar.PORT.getVariable(), port, supportContext);
|
||||
}
|
||||
if (EDatabaseConnTemplate.TERADATA.equals(connStr)) {
|
||||
if (StringUtils.isNotBlank(sid)) {
|
||||
s = getStringReplace(s, EDatabaseConnVar.SID.getVariable(), DATABASE_STRING + sid, supportContext);
|
||||
} else {
|
||||
s = getStringReplace(s, EDatabaseConnVar.SID.getVariable() + ",", sid, supportContext); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
s = getStringReplace(s, EDatabaseConnVar.SID.getVariable(), sid, supportContext);
|
||||
s = getStringReplace(s, EDatabaseConnVar.SERVICE_NAME.getVariable(), sid, supportContext);
|
||||
s = getStringReplace(s, EDatabaseConnVar.DATASOURCE.getVariable(), datasource, supportContext);
|
||||
@@ -574,7 +565,7 @@ public class DatabaseConnStrUtil {
|
||||
List<ERepositoryObjectType> extraTypes = new ArrayList<>();
|
||||
IGenericDBService dbService = null;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericDBService.class)) {
|
||||
dbService = GlobalServiceRegister.getDefault().getService(IGenericDBService.class);
|
||||
dbService = (IGenericDBService) GlobalServiceRegister.getDefault().getService(IGenericDBService.class);
|
||||
}
|
||||
if (dbService != null) {
|
||||
extraTypes.addAll(dbService.getExtraTypes());
|
||||
|
||||
@@ -107,7 +107,7 @@ public enum EDatabaseVersion4Drivers {
|
||||
|
||||
PLUSPSQL_PRIOR_TO_V9(new DbVersion4Drivers(EDatabaseTypeName.PLUSPSQL,
|
||||
"Prior to v9", "PRIOR_TO_V9", "postgresql-8.4-703.jdbc4.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
PLUSPSQL_V9_X(new DbVersion4Drivers(EDatabaseTypeName.PLUSPSQL, "v9 and later", "V9_X", "postgresql-9.4-1201.jdbc41.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
PLUSPSQL_V9_X(new DbVersion4Drivers(EDatabaseTypeName.PLUSPSQL, "v9.X", "V9_X", "postgresql-9.4-1201.jdbc41.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
IBMDB2(new DbVersion4Drivers(EDatabaseTypeName.IBMDB2, new String[] { "db2jcc4.jar", "db2jcc_license_cu.jar", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"db2jcc_license_cisuz.jar" })), //$NON-NLS-1$
|
||||
IBMDB2ZOS(new DbVersion4Drivers(EDatabaseTypeName.IBMDB2ZOS, new String[] { "db2jcc4.jar", "db2jcc_license_cu.jar", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
@@ -164,11 +164,11 @@ public enum EDatabaseVersion4Drivers {
|
||||
MAPRDB(new DbVersion4Drivers(EDatabaseTypeName.MAPRDB, new String[] {})),
|
||||
|
||||
REDSHIFT(new DbVersion4Drivers(EDatabaseTypeName.REDSHIFT, "redshift", "REDSHIFT", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"redshift-jdbc42-no-awssdk-1.2.32.1056.jar")), //$NON-NLS-1$
|
||||
"redshift-jdbc42-no-awssdk-1.2.20.1043.jar")), //$NON-NLS-1$
|
||||
REDSHIFT_SSO(new DbVersion4Drivers(EDatabaseTypeName.REDSHIFT_SSO, "redshift sso", "REDSHIFT_SSO", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
new String[] { "redshift-jdbc42-no-awssdk-1.2.32.1056.jar", "aws-java-sdk-1.11.406.jar", "jackson-core-2.9.9.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"jackson-databind-2.9.9.jar", "jackson-annotations-2.9.0.jar", "httpcore-4.4.9.jar", "httpclient-4.5.5.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$//$NON-NLS-4$
|
||||
"joda-time-2.8.1.jar", "commons-logging-1.1.3.jar", "commons-codec-1.6.jar" })), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
new String[] { "redshift-jdbc42-no-awssdk-1.2.20.1043.jar", "aws-java-sdk-1.11.406.jar", "jackson-core-2.9.5.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"jackson-databind-2.9.5.jar", "jackson-annotations-2.9.0.jar", "httpcore-4.4.9.jar", "httpclient-4.5.5.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$//$NON-NLS-4$
|
||||
"joda-time-2.8.1.jar", "commons-logging-1.1.3.jar" })), //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
AMAZON_AURORA(new DbVersion4Drivers(EDatabaseTypeName.AMAZON_AURORA, "mysql-connector-java-5.1.30-bin.jar")); //$NON-NLS-1$
|
||||
|
||||
|
||||
@@ -60,15 +60,6 @@ public interface IComponent {
|
||||
|
||||
public String getOriginalName();
|
||||
|
||||
/**
|
||||
* Only for component display (palette,search)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
default public String getDisplayName() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
public String getLongName();
|
||||
|
||||
public String getOriginalFamilyName();
|
||||
|
||||
@@ -98,15 +98,6 @@ public class JobContext implements IContext, Cloneable {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean containsSameParameterIgnoreCase(String parameterName) {
|
||||
for (IContextParameter contextParam : contextParameterList) {
|
||||
if (contextParam.getName() != null && contextParam.getName().equalsIgnoreCase(parameterName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Commented by Marvin Wang on Mar.2, 2012, the user who invokes the method should notice that if the
|
||||
* <code>JobContext</code> has more than one <code>ContextParameter</code>s which names are same, this case will
|
||||
|
||||
@@ -29,4 +29,5 @@ public interface INexusService extends IService {
|
||||
|
||||
ArtifactRepositoryBean getPublishNexusServerBean(String repositoryId);
|
||||
|
||||
ArtifactRepositoryBean getArtifactRepositoryFromServer();
|
||||
}
|
||||
|
||||
@@ -54,6 +54,8 @@ public interface IMetadataTable {
|
||||
public List<IMetadataColumn> getListColumns();
|
||||
|
||||
public List<IMetadataColumn> getListColumns(boolean withUnselected);
|
||||
|
||||
public List<IMetadataColumn> getListColumns(boolean withUnselected, boolean isCopyTable);
|
||||
|
||||
public void setListColumns(List<IMetadataColumn> listColumns);
|
||||
|
||||
|
||||
@@ -45,14 +45,6 @@ public interface ISAPConstant {
|
||||
|
||||
public static final String CHANGING = "CHANGING";//$NON-NLS-1$
|
||||
|
||||
public static final String PARAMETER_TYPE = "PARAMETER_TYPE";//$NON-NLS-1$
|
||||
|
||||
public static final String PARAMETER_TYPE_IMPORT = "IMPORT";//$NON-NLS-1$
|
||||
|
||||
public static final String PARAMETER_TYPE_CHANGING = "CHANGING";//$NON-NLS-1$
|
||||
|
||||
public static final String PARAMETER_TYPE_TABLES = "TABLES";//$NON-NLS-1$
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -130,9 +130,9 @@ public class MetadataTable implements IMetadataTable, Cloneable {
|
||||
return getListColumns(false);
|
||||
// return this.listColumns;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public synchronized List<IMetadataColumn> getListColumns(boolean withUnselected) {
|
||||
public synchronized List<IMetadataColumn> getListColumns(boolean withUnselected, boolean isCopyTable) {
|
||||
Iterator<IMetadataColumn> it = this.listColumns.iterator();
|
||||
while (it.hasNext()) {
|
||||
IMetadataColumn column = it.next();
|
||||
@@ -153,7 +153,7 @@ public class MetadataTable implements IMetadataTable, Cloneable {
|
||||
List<IMetadataColumn> temp = new ArrayList<IMetadataColumn>();
|
||||
temp.addAll(this.listColumns);
|
||||
temp.addAll(this.unusedColumns);
|
||||
if (originalColumns != null && isRepository) {
|
||||
if (originalColumns != null && isRepository && !isCopyTable) {
|
||||
Collections.sort(temp, new Comparator<IMetadataColumn>() {
|
||||
|
||||
@Override
|
||||
@@ -169,6 +169,11 @@ public class MetadataTable implements IMetadataTable, Cloneable {
|
||||
return this.listColumns;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized List<IMetadataColumn> getListColumns(boolean withUnselected) {
|
||||
return getListColumns(withUnselected, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDynamicSchema() {
|
||||
return getDynamicColumn() != null;
|
||||
@@ -252,8 +257,8 @@ public class MetadataTable implements IMetadataTable, Cloneable {
|
||||
if (!(input instanceof IMetadataTable)) {
|
||||
return false;
|
||||
}
|
||||
List<IMetadataColumn> thisColumnListWithUnselected = this.getListColumns(true);
|
||||
List<IMetadataColumn> inputColumnListWithUnselected = input.getListColumns(true);
|
||||
List<IMetadataColumn> thisColumnListWithUnselected = this.getListColumns(true, true);
|
||||
List<IMetadataColumn> inputColumnListWithUnselected = input.getListColumns(true, true);
|
||||
if (thisColumnListWithUnselected == null) {
|
||||
if (inputColumnListWithUnselected != null) {
|
||||
return false;
|
||||
|
||||
@@ -585,12 +585,17 @@ public final class MetadataToolHelper {
|
||||
|
||||
public static void copyTable(IMetadataTable source, IMetadataTable target, String targetDbms,
|
||||
boolean avoidUsedColumnsFromInput) {
|
||||
copyTable(source, target, targetDbms, avoidUsedColumnsFromInput, false);
|
||||
}
|
||||
|
||||
public static void copyTable(IMetadataTable source, IMetadataTable target, String targetDbms,
|
||||
boolean avoidUsedColumnsFromInput, boolean withCustoms) {
|
||||
if (source == null || target == null) {
|
||||
return;
|
||||
}
|
||||
List<IMetadataColumn> columnsToRemove = new ArrayList<IMetadataColumn>();
|
||||
List<String> readOnlycolumns = new ArrayList<String>();
|
||||
for (IMetadataColumn column : target.getListColumns(true)) {
|
||||
for (IMetadataColumn column : target.getListColumns(true, true)) {
|
||||
if (!column.isCustom()) {
|
||||
columnsToRemove.add(column);
|
||||
}
|
||||
@@ -602,9 +607,9 @@ public final class MetadataToolHelper {
|
||||
target.getListUnusedColumns().removeAll(columnsToRemove);
|
||||
|
||||
List<IMetadataColumn> columnsTAdd = new ArrayList<IMetadataColumn>();
|
||||
for (IMetadataColumn column : source.getListColumns(!avoidUsedColumnsFromInput)) {
|
||||
for (IMetadataColumn column : source.getListColumns(!avoidUsedColumnsFromInput, true)) {
|
||||
IMetadataColumn targetColumn = target.getColumn(column.getLabel());
|
||||
IMetadataColumn newTargetColumn = column.clone();
|
||||
IMetadataColumn newTargetColumn = column.clone(withCustoms);
|
||||
if (targetColumn == null) {
|
||||
columnsTAdd.add(newTargetColumn);
|
||||
newTargetColumn
|
||||
@@ -669,7 +674,7 @@ public final class MetadataToolHelper {
|
||||
List<IMetadataColumn> targetColumns = target.getListColumns();
|
||||
List<String> temp = new ArrayList<String>(tColumns);
|
||||
if (targetColumns != null) {
|
||||
final List<String> columnNames = new ArrayList<String>();
|
||||
List<String> columnNames = new ArrayList<String>();
|
||||
for(IMetadataColumn column : targetColumns){
|
||||
columnNames.add(column.getLabel());
|
||||
}
|
||||
|
||||
@@ -93,10 +93,10 @@ public class ComponentToRepositoryProperty {
|
||||
// impossible to use OCI in oracle
|
||||
IElementParameter elementParameter = node.getElementParameter("CONNECTION_TYPE"); //$NON-NLS-1$
|
||||
if (elementParameter != null) {
|
||||
if ("ORACLE_WALLET".equals(elementParameter.getValue())) { //$NON-NLS-1$
|
||||
if ("ORACLE_OCI".equals(elementParameter.getValue())) { //$NON-NLS-1$
|
||||
Shell shell = Display.getCurrent().getActiveShell();
|
||||
String title = Messages.getString("ComponentToRepositoryProperty.error"); //$NON-NLS-1$
|
||||
String message = Messages.getString("ComponentToRepositoryProperty.ImpossibleUseWALLET"); //$NON-NLS-1$
|
||||
String message = Messages.getString("ComponentToRepositoryProperty.ImpossibleUseOCI"); //$NON-NLS-1$
|
||||
MessageDialog.openError(shell, title, message);
|
||||
return false;
|
||||
}
|
||||
@@ -503,10 +503,6 @@ public class ComponentToRepositoryProperty {
|
||||
parameter = node.getElementParameter("CONNECTION_TYPE"); //$NON-NLS-1$
|
||||
// if ("ORACLE_OCI".equals(parameter.getValue())) {
|
||||
// }
|
||||
if ("ORACLE_OCI".equals(parameter.getValue())) {
|
||||
connection.setDatabaseType(EDatabaseTypeName.ORACLE_OCI.getDisplayName());
|
||||
connection.setProductId(EDatabaseTypeName.ORACLE_OCI.getProduct());
|
||||
}
|
||||
|
||||
if ("ORACLE_SERVICE_NAME".equals(parameter.getValue()) || "service_name".equals(parameter.getValue())) { //$NON-NLS-1$ //$NON-NLS-2$
|
||||
connection.setDatabaseType(EDatabaseTypeName.ORACLESN.getDisplayName());
|
||||
@@ -514,8 +510,7 @@ public class ComponentToRepositoryProperty {
|
||||
} else if ("ORACLE_SID".equals(parameter.getValue()) || "sid".equals(parameter.getValue())) { //$NON-NLS-1$ //$NON-NLS-2$
|
||||
connection.setDatabaseType(EDatabaseTypeName.ORACLEFORSID.getDisplayName());
|
||||
connection.setProductId(EDatabaseTypeName.ORACLESN.getProduct());
|
||||
} else if ("ORACLE_CUSTOM".equals(parameter.getValue()) || "rac".equals(parameter.getValue()) //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|| "ORACLE_RAC".equals(parameter.getValue())) {
|
||||
} else if ("ORACLE_CUSTOM".equals(parameter.getValue()) || "rac".equals(parameter.getValue())) { //$NON-NLS-1$ //$NON-NLS-2$
|
||||
connection.setDatabaseType(EDatabaseTypeName.ORACLE_CUSTOM.getDisplayName());
|
||||
connection.setProductId(EDatabaseTypeName.ORACLESN.getProduct());
|
||||
}
|
||||
@@ -673,12 +668,6 @@ public class ComponentToRepositoryProperty {
|
||||
if (connection.getDatabaseType().equals(EDatabaseTypeName.ORACLESN.getDisplayName())) {
|
||||
setDatabaseValueForOracleSeverName(connection, node, param);
|
||||
}
|
||||
if (connection.getDatabaseType().equals(EDatabaseTypeName.ORACLE_CUSTOM.getDisplayName())) {
|
||||
setDatabaseValueForOracleCustom(connection, node, param);
|
||||
}
|
||||
if (connection.getDatabaseType().equals(EDatabaseTypeName.ORACLE_OCI.getDisplayName())) {
|
||||
setDatabaseValueForOracleOci(connection, node, param);
|
||||
}
|
||||
if (connection.getDatabaseType().equals(EDatabaseTypeName.ACCESS.getDisplayName())) {
|
||||
setDatabaseValueForAccess(connection, node, param);
|
||||
}
|
||||
@@ -694,9 +683,6 @@ public class ComponentToRepositoryProperty {
|
||||
if (connection.getDatabaseType().equals(EDatabaseTypeName.PSQL.getDisplayName())) {
|
||||
setDatabaseValueForPSQL(connection, node, param);
|
||||
}
|
||||
if (connection.getDatabaseType().equals(EDatabaseTypeName.PLUSPSQL.getDisplayName())) {
|
||||
setDatabaseValueForPLUSPSQL(connection, node, param);
|
||||
}
|
||||
if (connection.getDatabaseType().equals(EDatabaseTypeName.SYBASEASE.getDisplayName())
|
||||
|| connection.getDatabaseType().equals(EDatabaseTypeName.SYBASEIQ.getDisplayName())) {
|
||||
setDatabaseValueForSysbase(connection, node, param);
|
||||
@@ -713,11 +699,6 @@ public class ComponentToRepositoryProperty {
|
||||
if (connection.getDatabaseType().equals(EDatabaseTypeName.GENERAL_JDBC.getDisplayName())) {
|
||||
setDatabaseValueForJdbc(connection, node, param);
|
||||
}
|
||||
|
||||
if (connection.getDatabaseType().equals(EDatabaseTypeName.MSSQL.getDisplayName())) {
|
||||
setDatabaseValueForMSSql(connection, node, param);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -775,53 +756,6 @@ public class ComponentToRepositoryProperty {
|
||||
}
|
||||
}
|
||||
|
||||
private static void setDatabaseValueForOracleCustom(DatabaseConnection connection, INode node, IElementParameter param) {
|
||||
|
||||
if ("DB_VERSION".equals(param.getRepositoryValue())) { //$NON-NLS-1$
|
||||
String value = getParameterValue(connection, node, param);
|
||||
String dbVersionName = EDatabaseVersion4Drivers.getDbVersionName(EDatabaseTypeName.ORACLE_CUSTOM, value);
|
||||
if (value != null) {
|
||||
connection.setDbVersionString(dbVersionName);
|
||||
}
|
||||
}
|
||||
if ("SID".equals(param.getRepositoryValue())) { //$NON-NLS-1$
|
||||
if (param != null && "ORACLE_OCI".equals(param.getValue())) { //$NON-NLS-1$
|
||||
String value = getParameterValue(connection, node, node.getElementParameter("LOCAL_SERVICE_NAME")); //$NON-NLS-1$
|
||||
if (value != null) {
|
||||
connection.setSID(value);
|
||||
}
|
||||
} else {
|
||||
String value = getParameterValue(connection, node, node.getElementParameter("DBNAME")); //$NON-NLS-1$
|
||||
if (value != null) {
|
||||
connection.setSID(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void setDatabaseValueForOracleOci(DatabaseConnection connection, INode node, IElementParameter param) {
|
||||
|
||||
if ("DB_VERSION".equals(param.getRepositoryValue())) { //$NON-NLS-1$
|
||||
String value = getParameterValue(connection, node, param);
|
||||
String dbVersionName = EDatabaseVersion4Drivers.getDbVersionName(EDatabaseTypeName.ORACLE_OCI, value);
|
||||
if (value != null) {
|
||||
connection.setDbVersionString(dbVersionName);
|
||||
}
|
||||
}
|
||||
if ("SID".equals(param.getRepositoryValue())) { //$NON-NLS-1$
|
||||
if (param != null && "ORACLE_OCI".equals(param.getValue())) { //$NON-NLS-1$
|
||||
String value = getParameterValue(connection, node, node.getElementParameter("LOCAL_SERVICE_NAME")); //$NON-NLS-1$
|
||||
if (value != null) {
|
||||
connection.setSID(value);
|
||||
}
|
||||
} else {
|
||||
String value = getParameterValue(connection, node, node.getElementParameter("DBNAME")); //$NON-NLS-1$
|
||||
if (value != null) {
|
||||
connection.setSID(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private static void setDatabaseValueForAs400(DatabaseConnection connection, INode node, IElementParameter param) {
|
||||
if ("DB_VERSION".equals(param.getRepositoryValue())) { //$NON-NLS-1$
|
||||
String value = getParameterValue(connection, node, param);
|
||||
@@ -863,16 +797,6 @@ public class ComponentToRepositoryProperty {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void setDatabaseValueForPLUSPSQL(DatabaseConnection connection, INode node, IElementParameter param) {
|
||||
if ("DB_VERSION".equals(param.getRepositoryValue())) { //$NON-NLS-1$
|
||||
String value = getParameterValue(connection, node, param);
|
||||
String dbVersionName = EDatabaseVersion4Drivers.getDbVersionName(EDatabaseTypeName.PLUSPSQL, value);
|
||||
if (value != null) {
|
||||
connection.setDbVersionString(dbVersionName);
|
||||
}
|
||||
}
|
||||
}
|
||||
private static void setDatabaseValueForSysbase(DatabaseConnection connection, INode node, IElementParameter param) {
|
||||
if ("DB_VERSION".equals(param.getRepositoryValue())) { //$NON-NLS-1$
|
||||
String value = getParameterValue(connection, node, param); // $NON-NLS-1$
|
||||
@@ -882,16 +806,6 @@ public class ComponentToRepositoryProperty {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void setDatabaseValueForMSSql(DatabaseConnection connection, INode node, IElementParameter param) {
|
||||
if ("DRIVER".equals(param.getRepositoryValue())) { //$NON-NLS-1$
|
||||
String value = getParameterValue(connection, node, param);
|
||||
String dbVersionName = EDatabaseVersion4Drivers.getDbVersionName(EDatabaseTypeName.MSSQL, value);
|
||||
if (value != null) {
|
||||
connection.setDbVersionString(dbVersionName);
|
||||
}
|
||||
}
|
||||
}
|
||||
private static void setDatabaseValueForAccess(DatabaseConnection connection, INode node, IElementParameter param) {
|
||||
if ("DB_VERSION".equals(param.getRepositoryValue())) { //$NON-NLS-1$
|
||||
String value = getParameterValue(connection, node, param);
|
||||
|
||||
@@ -1697,11 +1697,6 @@ public class RepositoryToComponentProperty {
|
||||
return "STANDARD";
|
||||
}
|
||||
}
|
||||
if (value.equals("DBTYPE")) {
|
||||
String repositoryType = connection.getDatabaseType();
|
||||
EDatabaseTypeName typeFromDbType = EDatabaseTypeName.getTypeFromDbType(repositoryType);
|
||||
return typeFromDbType.getXMLType();
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ public abstract class AbstractNode implements INode {
|
||||
|
||||
private ComponentProperties componentProperties;
|
||||
|
||||
List<? extends IElementParameter> elementParameters = new ArrayList<IElementParameter>();
|
||||
List<? extends IElementParameter> elementParameters;
|
||||
|
||||
private List<? extends IConnection> outgoingConnections = new ArrayList<IConnection>();
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ import org.talend.core.model.components.IComponent;
|
||||
import org.talend.core.model.metadata.IMetadataColumn;
|
||||
import org.talend.core.model.metadata.IMetadataTable;
|
||||
import org.talend.core.model.metadata.MetadataTable;
|
||||
import org.talend.core.model.process.node.MapperExternalNode;
|
||||
|
||||
/**
|
||||
* Concrete class to instanciate as an AbstractNode for the BigData code generators
|
||||
@@ -77,9 +76,6 @@ public class BigDataNode extends AbstractNode implements IBigDataNode {
|
||||
IBigDataNode node = (IBigDataNode) incomingConnections.get(0).getSource();
|
||||
String requiredOutputType = node.getRequiredOutputType();
|
||||
return requiredOutputType != null ? requiredOutputType : node.getIncomingType();
|
||||
} else if (incomingConnections.get(0).getSource() instanceof MapperExternalNode) {
|
||||
MapperExternalNode node = (MapperExternalNode) incomingConnections.get(0).getSource();
|
||||
return node.getShouldGenerateDataset() ? "DATASET" : "KEYVALUE";
|
||||
} else {
|
||||
// We are on an external node => PairRDD
|
||||
// TODO Maybe on the futur we need to handle RDD or DataFrame, but this required a big refactoring
|
||||
|
||||
@@ -22,7 +22,6 @@ public enum EParameterFieldType {
|
||||
TEXT,
|
||||
TEXT_AREA,
|
||||
PASSWORD,
|
||||
LICENSEKEY, // xqliu TDQ-17742
|
||||
MEMO_SQL,
|
||||
MEMO_PERL,
|
||||
MEMO_JAVA,
|
||||
@@ -124,8 +123,7 @@ public enum EParameterFieldType {
|
||||
TACOKIT_GUESS_SCHEMA,
|
||||
TACOKIT_BUTTON,
|
||||
TACOKIT_SUGGESTABLE_TABLE,
|
||||
TACOKIT_VALUE_SELECTION,
|
||||
TACOKIT_TEXT_AREA_SELECTION;
|
||||
TACOKIT_VALUE_SELECTION;
|
||||
|
||||
public String getName() {
|
||||
return toString();
|
||||
|
||||
@@ -62,6 +62,4 @@ public interface IContext {
|
||||
public IContext clone();
|
||||
|
||||
public boolean sameAs(IContext context);
|
||||
|
||||
public boolean containsSameParameterIgnoreCase(String parameterName);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.commons.utils.VersionUtils;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.IESBService;
|
||||
import org.talend.core.ITDQItemService;
|
||||
import org.talend.core.PluginChecker;
|
||||
import org.talend.core.hadoop.IHadoopClusterService;
|
||||
@@ -34,6 +33,7 @@ import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.JobletProcessItem;
|
||||
import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.model.properties.ProjectReference;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.properties.SQLPatternItem;
|
||||
import org.talend.core.model.relationship.Relation;
|
||||
@@ -898,14 +898,33 @@ public final class ProcessUtils {
|
||||
ERepositoryObjectType itemType = ERepositoryObjectType.getItemType(property.getItem());
|
||||
// route job
|
||||
if (itemType != null && (itemType.equals(ERepositoryObjectType.PROCESS_ROUTE)
|
||||
|| itemType.equals(ERepositoryObjectType.PROCESS_ROUTELET)
|
||||
|| "CAMEL".equals(process.getComponentsType()))) {
|
||||
|| itemType.equals(ERepositoryObjectType.PROCESS_ROUTELET))) {
|
||||
needBeans = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return needBeans && GlobalServiceRegister.getDefault().isServiceRegistered(IESBService.class);
|
||||
|
||||
if (needBeans && GlobalServiceRegister.getDefault().isServiceRegistered(IProxyRepositoryService.class)) {
|
||||
IProxyRepositoryService service = (IProxyRepositoryService) GlobalServiceRegister.getDefault()
|
||||
.getService(IProxyRepositoryService.class);
|
||||
ERepositoryObjectType beansType = ERepositoryObjectType.valueOf("BEANS"); //$NON-NLS-1$
|
||||
try {
|
||||
IProxyRepositoryFactory factory = service.getProxyRepositoryFactory();
|
||||
List<IRepositoryViewObject> all = factory.getAll(project, beansType);
|
||||
List<ProjectReference> references = ProjectManager.getInstance().getCurrentProject()
|
||||
.getProjectReferenceList(true);
|
||||
for (ProjectReference ref : references) {
|
||||
all.addAll(factory.getAll(new Project(ref.getReferencedProject()), beansType));
|
||||
}
|
||||
if (!all.isEmpty()) { // has bean
|
||||
return true;
|
||||
}
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isRequiredPigUDFs(IProcess process) {
|
||||
|
||||
@@ -20,8 +20,4 @@ import org.talend.core.model.process.AbstractExternalNode;
|
||||
*/
|
||||
public abstract class MapperExternalNode extends AbstractExternalNode {
|
||||
|
||||
public boolean getShouldGenerateDataset() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -575,8 +575,6 @@ public class ERepositoryObjectType extends DynaEnum<ERepositoryObjectType> {
|
||||
public final static ERepositoryObjectType METADATA_SAP_BW_INFOOBJECT = ERepositoryObjectType
|
||||
.valueOf("METADATA_SAP_BW_INFOOBJECT"); //$NON-NLS-1$
|
||||
|
||||
public final static ERepositoryObjectType JDBC = ERepositoryObjectType.valueOf("JDBC"); //$NON-NLS-1$
|
||||
|
||||
private static Map<String, ERepositoryObjectType> typeCacheById = new HashMap<String, ERepositoryObjectType>();
|
||||
|
||||
ERepositoryObjectType(String key, String folder, String type, boolean isStaticNode, int ordinal, String[] products,
|
||||
@@ -1313,7 +1311,7 @@ public class ERepositoryObjectType extends DynaEnum<ERepositoryObjectType> {
|
||||
|
||||
public boolean addExtraProducts(String[] productsArray) {
|
||||
if (productsArray != null && productsArray.length > 0) {
|
||||
if (this.products == null || this.products.length == 0) {
|
||||
if (this.products == null && this.products.length == 0) {
|
||||
this.products = productsArray;
|
||||
} else {
|
||||
String[] tmp = new String[this.products.length + productsArray.length];
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
package org.talend.core.model.routines;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
@@ -32,12 +31,9 @@ import org.osgi.framework.Bundle;
|
||||
import org.talend.commons.utils.resource.FileExtensions;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.ILibraryManagerService;
|
||||
import org.talend.core.ISVNProviderServiceInCoreRuntime;
|
||||
import org.talend.core.PluginChecker;
|
||||
import org.talend.core.model.general.LibraryInfo;
|
||||
import org.talend.core.nexus.ArtifactRepositoryBean;
|
||||
import org.talend.core.nexus.TalendLibsServerManager;
|
||||
import org.talend.core.runtime.maven.MavenArtifact;
|
||||
import org.talend.core.runtime.maven.MavenConstants;
|
||||
import org.talend.core.runtime.maven.MavenUrlHelper;
|
||||
|
||||
/**
|
||||
* wchen class global comment. Detailled comment
|
||||
@@ -100,12 +96,9 @@ public class RoutineLibraryMananger {
|
||||
try {
|
||||
URL fileUrl = FileLocator.toFileURL(entry);
|
||||
if(fileUrl != null){
|
||||
if (!"file".equals(fileUrl.getProtocol())) throw new IllegalArgumentException();
|
||||
File file = new File(fileUrl.getFile());
|
||||
if (needDeploy(fileUrl)) {
|
||||
URI fileUri = file.toURI();
|
||||
libManagerService.deploy(fileUri);
|
||||
}
|
||||
if (!"file".equals(fileUrl.getProtocol())) throw new IllegalArgumentException();
|
||||
URI fileUri = new File(fileUrl.getFile()).toURI();
|
||||
libManagerService.deploy(fileUri);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("Cannot deploy: " + bundleName + path);
|
||||
@@ -121,56 +114,6 @@ public class RoutineLibraryMananger {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean needDeploy(URL fileUrl) throws IOException, Exception {
|
||||
File file = new File(fileUrl.getFile());
|
||||
ILibraryManagerService libManagerService = null;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ILibraryManagerService.class)) {
|
||||
libManagerService = (ILibraryManagerService) GlobalServiceRegister.getDefault()
|
||||
.getService(ILibraryManagerService.class);
|
||||
}
|
||||
if (libManagerService != null) {
|
||||
Map<String, String> sourceAndMavenUri = new HashMap<>();
|
||||
libManagerService.guessMavenRUIFromIndex(file, sourceAndMavenUri);
|
||||
String mavUri = null;
|
||||
boolean isSnapshot = false;
|
||||
for (String key : sourceAndMavenUri.keySet()) {
|
||||
if (sourceAndMavenUri.get(key).equals(file.getPath())) {
|
||||
mavUri = key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (mavUri == null) {
|
||||
return true;
|
||||
}
|
||||
final MavenArtifact parseMvnUrl = MavenUrlHelper.parseMvnUrl(mavUri);
|
||||
if (parseMvnUrl != null) {
|
||||
if (parseMvnUrl.getVersion() != null && parseMvnUrl.getVersion().endsWith(MavenConstants.SNAPSHOT)) {
|
||||
isSnapshot = true;
|
||||
}
|
||||
}
|
||||
TalendLibsServerManager manager = TalendLibsServerManager.getInstance();
|
||||
ArtifactRepositoryBean customNexusServer = manager.getCustomNexusServer();
|
||||
File jarFile = null;
|
||||
try {
|
||||
jarFile = libManagerService.resolveJar(customNexusServer, mavUri);
|
||||
} catch (Exception ex) {
|
||||
// Ignore here
|
||||
}
|
||||
boolean exist = (jarFile != null && jarFile.exists());
|
||||
if (exist) {
|
||||
if (isSnapshot) {
|
||||
boolean isSame = libManagerService.isSameFile(jarFile, file);
|
||||
if (!isSame) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public Map<String, List<LibraryInfo>> getRoutineAndJars() {
|
||||
if (routineAndJars == null) {
|
||||
routineAndJars = new HashMap<String, List<LibraryInfo>>();
|
||||
|
||||
@@ -684,15 +684,16 @@ public class NodeUtil {
|
||||
}
|
||||
List<? extends IConnection> listInConns = node.getIncomingConnections();
|
||||
if (listInConns != null && listInConns.size() > 0) {
|
||||
for (IConnection connection : listInConns) {
|
||||
if (EConnectionType.FLOW_REF != connection.getLineStyle()) {
|
||||
String retResult = getPrivateConnClassName(connection);
|
||||
return retResult != null ? retResult : conn.getName();
|
||||
}
|
||||
String retResult = getPrivateConnClassName(listInConns.get(0));
|
||||
if (retResult == null) {
|
||||
return conn.getName();
|
||||
} else {
|
||||
return retResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,11 +41,11 @@ import org.talend.core.model.process.EParameterFieldType;
|
||||
import org.talend.core.model.process.IContextParameter;
|
||||
import org.talend.core.model.process.IElementParameter;
|
||||
import org.talend.core.utils.TalendQuoteUtils;
|
||||
import org.talend.daikon.security.CryptoHelper;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ContextParameterType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ElementValueType;
|
||||
import org.talend.repository.ProjectManager;
|
||||
import org.talend.utils.security.StudioEncryption;
|
||||
|
||||
/**
|
||||
* cli class global comment. Detailled comment
|
||||
@@ -77,24 +77,21 @@ public final class ParameterValueUtil {
|
||||
}
|
||||
}
|
||||
} else if (param.getValue() instanceof List) { // for TABLE
|
||||
List tableValues = (List) param.getValue();
|
||||
for (Object current : tableValues) {
|
||||
if (current != null && current instanceof Map) {
|
||||
Map<String, Object> line = (Map<String, Object>) current;
|
||||
for (String key : line.keySet()) {
|
||||
Object cellValue = line.get(key);
|
||||
if (cellValue instanceof String) { // cell is text so
|
||||
// rename data if
|
||||
// needed
|
||||
String value = (String) cellValue;
|
||||
if (value.contains(oldName)) {
|
||||
// line.put(key, value.replaceAll(oldName,
|
||||
// newName));
|
||||
// String newValue = renameValues(value, oldName, newName, flag);
|
||||
String newValue = splitQueryData(oldName, newName, value);
|
||||
if (!value.equals(newValue)) {
|
||||
line.put(key, newValue);
|
||||
}
|
||||
List<Map<String, Object>> tableValues = (List<Map<String, Object>>) param.getValue();
|
||||
for (Map<String, Object> line : tableValues) {
|
||||
for (String key : line.keySet()) {
|
||||
Object cellValue = line.get(key);
|
||||
if (cellValue instanceof String) { // cell is text so
|
||||
// rename data if
|
||||
// needed
|
||||
String value = (String) cellValue;
|
||||
if (value.contains(oldName)) {
|
||||
// line.put(key, value.replaceAll(oldName,
|
||||
// newName));
|
||||
// String newValue = renameValues(value, oldName, newName, flag);
|
||||
String newValue = splitQueryData(oldName, newName, value);
|
||||
if (!value.equals(newValue)) {
|
||||
line.put(key, newValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -724,22 +721,13 @@ public final class ParameterValueUtil {
|
||||
return true;
|
||||
}
|
||||
} else if (param.getValue() instanceof List) { // for TABLE
|
||||
List tableValues = (List) param.getValue();
|
||||
for (Object current : tableValues) {
|
||||
if (current != null) {
|
||||
if (current instanceof Map) {
|
||||
Map<String, Object> line = (Map<String, Object>) current;
|
||||
for (String key : line.keySet()) {
|
||||
Object cellValue = line.get(key);
|
||||
if (cellValue instanceof String) { // cell is text so
|
||||
// test data
|
||||
if (ParameterValueUtil.valueContains((String) cellValue, name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (current instanceof String) {
|
||||
if (ParameterValueUtil.valueContains((String) current, name)) {
|
||||
List<Map<String, Object>> tableValues = (List<Map<String, Object>>) param.getValue();
|
||||
for (Map<String, Object> line : tableValues) {
|
||||
for (String key : line.keySet()) {
|
||||
Object cellValue = line.get(key);
|
||||
if (cellValue instanceof String) { // cell is text so
|
||||
// test data
|
||||
if (ParameterValueUtil.valueContains((String) cellValue, name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -842,8 +830,7 @@ public final class ParameterValueUtil {
|
||||
if (contextParam != null) {
|
||||
String docValue = contextParam.getValue();
|
||||
if (docValue != null) {
|
||||
String encryptValue = StudioEncryption.getStudioEncryption(StudioEncryption.EncryptionKeyName.SYSTEM)
|
||||
.encrypt(docValue);
|
||||
String encryptValue = CryptoHelper.getDefault().encrypt(docValue);
|
||||
if (encryptValue != null) {
|
||||
return encryptValue;
|
||||
}
|
||||
@@ -879,8 +866,7 @@ public final class ParameterValueUtil {
|
||||
if (param != null) {
|
||||
Object docValue = param.getValue();
|
||||
if (docValue != null && docValue instanceof String) {
|
||||
String encryptValue = StudioEncryption.getStudioEncryption(StudioEncryption.EncryptionKeyName.SYSTEM)
|
||||
.encrypt(docValue.toString());
|
||||
String encryptValue = CryptoHelper.getDefault().encrypt(docValue.toString());
|
||||
if (encryptValue != null) {
|
||||
return encryptValue;
|
||||
}
|
||||
|
||||
@@ -12,12 +12,14 @@
|
||||
// ============================================================================
|
||||
package org.talend.core.nexus;
|
||||
|
||||
import java.net.Authenticator;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.PasswordAuthentication;
|
||||
import java.net.Proxy;
|
||||
import java.net.Proxy.Type;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
@@ -35,8 +37,9 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.OperationCanceledException;
|
||||
import org.talend.commons.exception.BusinessException;
|
||||
import org.talend.commons.utils.network.IProxySelectorProvider;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.utils.network.TalendProxySelector;
|
||||
import org.talend.commons.utils.network.TalendProxySelector.IProxySelectorProvider;
|
||||
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||
import org.talend.core.runtime.maven.MavenArtifact;
|
||||
import org.talend.core.runtime.maven.MavenUrlHelper;
|
||||
@@ -164,7 +167,7 @@ public abstract class HttpClientTransport {
|
||||
}
|
||||
}
|
||||
|
||||
public static IProxySelectorProvider addProxy(final DefaultHttpClient httpClient, URI requestURI) {
|
||||
private IProxySelectorProvider addProxy(final DefaultHttpClient httpClient, URI requestURI) {
|
||||
IProxySelectorProvider proxySelectorProvider = null;
|
||||
try {
|
||||
if (Boolean.valueOf(System.getProperty(PROP_PROXY_HTTP_CLIENT_USE_DEFAULT_SETTINGS, Boolean.FALSE.toString()))) {
|
||||
@@ -182,10 +185,10 @@ public abstract class HttpClientTransport {
|
||||
}
|
||||
final Proxy finalProxy = usedProxy;
|
||||
InetSocketAddress address = (InetSocketAddress) finalProxy.address();
|
||||
String proxyServer = address.getHostString();
|
||||
String proxyServer = address.getHostName();
|
||||
int proxyPort = address.getPort();
|
||||
TalendProxySelector proxySelector = TalendProxySelector.getInstance();
|
||||
PasswordAuthentication proxyAuthentication = proxySelector.getHttpPasswordAuthentication();
|
||||
PasswordAuthentication proxyAuthentication = Authenticator.requestPasswordAuthentication(proxyServer,
|
||||
address.getAddress(), proxyPort, "Http Proxy", "Http proxy authentication", null);
|
||||
if (proxyAuthentication != null) {
|
||||
String proxyUser = proxyAuthentication.getUserName();
|
||||
if(StringUtils.isNotBlank(proxyUser)){
|
||||
@@ -200,7 +203,7 @@ public abstract class HttpClientTransport {
|
||||
}
|
||||
HttpHost proxyHost = new HttpHost(proxyServer, proxyPort);
|
||||
httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxyHost);
|
||||
proxySelectorProvider = proxySelector.createDefaultProxySelectorProvider();
|
||||
proxySelectorProvider = createProxySelectorProvider();
|
||||
}
|
||||
return proxySelectorProvider;
|
||||
} finally {
|
||||
@@ -210,12 +213,61 @@ public abstract class HttpClientTransport {
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeProxy(IProxySelectorProvider proxySelectorProvider) {
|
||||
private void removeProxy(IProxySelectorProvider proxySelectorProvider) {
|
||||
if (proxySelectorProvider != null) {
|
||||
TalendProxySelector.getInstance().removeProxySelectorProvider(proxySelectorProvider);
|
||||
}
|
||||
}
|
||||
|
||||
private IProxySelectorProvider createProxySelectorProvider() {
|
||||
IProxySelectorProvider proxySelectorProvider = new TalendProxySelector.AbstractProxySelectorProvider() {
|
||||
|
||||
private Thread currentThread = Thread.currentThread();
|
||||
|
||||
@Override
|
||||
public List<Proxy> select(URI uri) {
|
||||
// return Collections.EMPTY_LIST;
|
||||
|
||||
List<Proxy> newProxys = new ArrayList<>();
|
||||
if (uri == null) {
|
||||
return newProxys;
|
||||
}
|
||||
String schema = uri.getScheme();
|
||||
if (schema != null && schema.toLowerCase().startsWith("socket")) { //$NON-NLS-1$
|
||||
try {
|
||||
URI newUri = new URI("https", uri.getUserInfo(), uri.getHost(), uri.getPort(), uri.getPath(),
|
||||
uri.getQuery(), uri.getFragment());
|
||||
List<Proxy> proxys = TalendProxySelector.getInstance().getDefaultProxySelector().select(newUri);
|
||||
if (proxys != null && !proxys.isEmpty()) {
|
||||
newProxys.addAll(proxys);
|
||||
} else {
|
||||
newUri = new URI("http", uri.getUserInfo(), uri.getHost(), uri.getPort(), uri.getPath(),
|
||||
uri.getQuery(), uri.getFragment());
|
||||
proxys = TalendProxySelector.getInstance().getDefaultProxySelector().select(newUri);
|
||||
if (proxys != null && !proxys.isEmpty()) {
|
||||
newProxys.addAll(proxys);
|
||||
}
|
||||
}
|
||||
} catch (URISyntaxException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
return newProxys;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHandle(URI uri) {
|
||||
if (Thread.currentThread() == currentThread) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
return proxySelectorProvider;
|
||||
}
|
||||
|
||||
public void processResponseCode(HttpResponse response) throws BusinessException {
|
||||
StatusLine statusLine = response.getStatusLine();
|
||||
int responseCode = statusLine.getStatusCode();
|
||||
|
||||
@@ -29,6 +29,4 @@ public class NexusConstants {
|
||||
public static final String SNAPSHOTS = "@snapshots";//$NON-NLS-1$
|
||||
|
||||
public static final String DISALLOW_RELEASES = "@noreleases";//$NON-NLS-1$
|
||||
|
||||
public static final String DYNAMIC_DISTRIBUTION = "https://talend-update.talend.com/nexus/content/groups/dynamicdistribution/";
|
||||
}
|
||||
|
||||
@@ -1,33 +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.nexus;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ResolverExceptionHandler {
|
||||
|
||||
public static IOException hideCredential(IOException e) {
|
||||
// hide the user/password in the error
|
||||
String regex = "\\://(.+)\\:(.+)@"; //$NON-NLS-1$
|
||||
String message = e.getMessage();
|
||||
message = message.replaceAll(regex, "://"); //$NON-NLS-1$
|
||||
Exception cause = null;
|
||||
if (e.getCause() != null) {
|
||||
String causeMessage = e.getCause().getMessage();
|
||||
causeMessage = causeMessage.replaceAll(regex, "://"); //$NON-NLS-1$
|
||||
cause = new Exception(causeMessage);
|
||||
}
|
||||
return new IOException(message, cause);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -63,16 +63,6 @@ public class TalendLibsServerManager {
|
||||
|
||||
public static final String TALEND_LIB_SERVER = "https://talend-update.talend.com/nexus/";//$NON-NLS-1$
|
||||
|
||||
public static final String NEXUS_PROXY_URL = "nexus.proxy.url";
|
||||
|
||||
public static final String NEXUS_PROXY_TYPE = "nexus.proxy.type";
|
||||
|
||||
public static final String NEXUS_PROXY_USERNAME = "nexus.proxy.username";
|
||||
|
||||
public static final String NEXUS_PROXY_PASSWORD = "nexus.proxy.password";
|
||||
|
||||
public static final String NEXUS_PROXY_REPOSITORY_ID = "nexus.proxy.repository.id";
|
||||
|
||||
public static final String TALEND_LIB_USER = "";//$NON-NLS-1$
|
||||
|
||||
public static final String TALEND_LIB_PASSWORD = "";//$NON-NLS-1$
|
||||
@@ -177,15 +167,12 @@ public class TalendLibsServerManager {
|
||||
|
||||
public ArtifactRepositoryBean getTalentArtifactServer() {
|
||||
ArtifactRepositoryBean serverBean = new ArtifactRepositoryBean();
|
||||
String nexusType = System.getProperty(NEXUS_PROXY_TYPE);
|
||||
if (nexusType != null) {
|
||||
serverBean.setType(nexusType);
|
||||
}
|
||||
serverBean.setServer(System.getProperty(NEXUS_PROXY_URL, TALEND_LIB_SERVER));
|
||||
serverBean.setUserName(System.getProperty(NEXUS_PROXY_USERNAME, TALEND_LIB_USER));
|
||||
serverBean.setPassword(System.getProperty(NEXUS_PROXY_PASSWORD, TALEND_LIB_PASSWORD));
|
||||
serverBean.setRepositoryId(System.getProperty(NEXUS_PROXY_REPOSITORY_ID, TALEND_LIB_REPOSITORY));
|
||||
serverBean.setServer(System.getProperty(KEY_LIB_REPO_URL, TALEND_LIB_SERVER));
|
||||
serverBean.setUserName(TALEND_LIB_USER);
|
||||
serverBean.setPassword(TALEND_LIB_PASSWORD);
|
||||
serverBean.setRepositoryId(TALEND_LIB_REPOSITORY);
|
||||
serverBean.setOfficial(true);
|
||||
|
||||
return serverBean;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,9 +24,6 @@ import org.osgi.framework.ServiceReference;
|
||||
import org.osgi.service.cm.ManagedService;
|
||||
import org.osgi.util.tracker.ServiceTracker;
|
||||
import org.osgi.util.tracker.ServiceTrackerCustomizer;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.utils.network.IProxySelectorProvider;
|
||||
import org.talend.commons.utils.network.TalendProxySelector;
|
||||
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||
|
||||
/**
|
||||
@@ -104,27 +101,8 @@ public class TalendMavenResolver {
|
||||
|
||||
}
|
||||
|
||||
public static File resolve(String mvnUri) throws IOException {
|
||||
TalendProxySelector selectorInstance = null;
|
||||
IProxySelectorProvider proxySelector = null;
|
||||
try {
|
||||
try {
|
||||
selectorInstance = TalendProxySelector.getInstance();
|
||||
proxySelector = selectorInstance.createDefaultProxySelectorProvider();
|
||||
if (proxySelector != null) {
|
||||
selectorInstance.addProxySelectorProvider(proxySelector);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return getMavenResolver().resolve(mvnUri);
|
||||
} catch (IOException e) {
|
||||
throw ResolverExceptionHandler.hideCredential(e);
|
||||
} finally {
|
||||
if (proxySelector != null && selectorInstance != null) {
|
||||
selectorInstance.removeProxySelectorProvider(proxySelector);
|
||||
}
|
||||
}
|
||||
public static File resolve(String mvnUri) throws IOException, RuntimeException {
|
||||
return getMavenResolver().resolve(mvnUri);
|
||||
}
|
||||
|
||||
public static void upload(String groupId, String artifactId, String classifier, String extension, String version,
|
||||
@@ -132,11 +110,7 @@ public class TalendMavenResolver {
|
||||
getMavenResolver().upload(groupId, artifactId, classifier, extension, version, artifact);
|
||||
}
|
||||
|
||||
public static void initMavenResovler() throws RuntimeException {
|
||||
getMavenResolver();
|
||||
}
|
||||
|
||||
private static MavenResolver getMavenResolver() throws RuntimeException {
|
||||
public static MavenResolver getMavenResolver() throws RuntimeException {
|
||||
if (mavenResolver == null) {
|
||||
final BundleContext context = CoreRuntimePlugin.getInstance().getBundle().getBundleContext();
|
||||
ServiceReference<org.ops4j.pax.url.mvn.MavenResolver> mavenResolverService = context
|
||||
|
||||
@@ -101,8 +101,6 @@ public interface ITalendCorePrefConstants {
|
||||
|
||||
public static final String FORBIDDEN_MAPPING_LENGTH_PREC_LOGIC = "forbidden_mapping_length_prec_logic"; //$NON-NLS-1$
|
||||
|
||||
public static final String METADATA_PREFERENCE_PAGE_ENABLE_BASIC = "metadata_preference_page_enable_basic"; //$NON-NLS-1$
|
||||
|
||||
public static final String DATA_COLLECTOR_ENABLED = "active_data_collector"; //$NON-NLS-1$
|
||||
|
||||
public static final String DATA_COLLECTOR_UPLOAD_PERIOD = "active_data_collector_times"; //$NON-NLS-1$
|
||||
|
||||
@@ -23,10 +23,6 @@ public interface IAdditionalInfo {
|
||||
|
||||
void onEvent(final String event, final Object... parameters);
|
||||
|
||||
default Object func(final String funcName, final Object... params) throws Exception {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
void cloneAddionalInfoTo(final IAdditionalInfo targetAdditionalInfo);
|
||||
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -24,7 +24,7 @@ public class MavenArtifact implements Cloneable {
|
||||
private static final char ARTIFACT_SEPARATOR = '-';
|
||||
|
||||
private String repositoryUrl, groupId, artifactId, version, type, classifier, description, url, license, licenseUrl,
|
||||
distribution, username, password, lastUpdated, sha1, md5;
|
||||
distribution, username, password, lastUpdated;
|
||||
|
||||
public String getLastUpdated() {
|
||||
return this.lastUpdated;
|
||||
@@ -138,22 +138,6 @@ public class MavenArtifact implements Cloneable {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getSha1() {
|
||||
return sha1;
|
||||
}
|
||||
|
||||
public void setSha1(String sha1) {
|
||||
this.sha1 = sha1;
|
||||
}
|
||||
|
||||
public String getMd5() {
|
||||
return md5;
|
||||
}
|
||||
|
||||
public void setMd5(String md5) {
|
||||
this.md5 = md5;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* DOC ggu Comment method "getFileName".
|
||||
|
||||
@@ -42,8 +42,6 @@ public interface MavenConstants {
|
||||
|
||||
static final String POM_FILTER = "POM_FILTER";
|
||||
|
||||
static final String USE_PROFILE_MODULE = "USE_PROFILE_MODULE";
|
||||
|
||||
/*
|
||||
* for lib
|
||||
*/
|
||||
|
||||
@@ -19,7 +19,7 @@ import java.net.URLDecoder;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.core.runtime.Assert;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.utils.security.StudioEncryption;
|
||||
import org.talend.daikon.security.CryptoHelper;
|
||||
|
||||
/**
|
||||
* DOC ggu class global comment. Detailled comment
|
||||
@@ -47,6 +47,8 @@ public class MavenUrlHelper {
|
||||
|
||||
public static final String USER_PASSWORD_SPLITER = ":";
|
||||
|
||||
private static CryptoHelper cryptoHelper;
|
||||
|
||||
public static MavenArtifact parseMvnUrl(String mvnUrl) {
|
||||
return parseMvnUrl(mvnUrl, true);
|
||||
}
|
||||
@@ -330,15 +332,19 @@ public class MavenUrlHelper {
|
||||
return uri;
|
||||
}
|
||||
|
||||
private static CryptoHelper getCryptoHelper() {
|
||||
if (cryptoHelper == null) {
|
||||
cryptoHelper = CryptoHelper.getDefault();
|
||||
}
|
||||
return cryptoHelper;
|
||||
}
|
||||
|
||||
public static String encryptPassword(String password) {
|
||||
return StudioEncryption.getStudioEncryption(StudioEncryption.EncryptionKeyName.SYSTEM).encrypt(password);
|
||||
return getCryptoHelper().encrypt(password);
|
||||
}
|
||||
|
||||
public static String decryptPassword(String password) {
|
||||
if (StudioEncryption.hasEncryptionSymbol(password)) {
|
||||
return StudioEncryption.getStudioEncryption(StudioEncryption.EncryptionKeyName.SYSTEM).decrypt(password);
|
||||
}
|
||||
return password;
|
||||
return getCryptoHelper().decrypt(password);
|
||||
}
|
||||
|
||||
public static String generateModuleNameByMavenURI(String uri) {
|
||||
|
||||
@@ -19,7 +19,6 @@ import java.util.Set;
|
||||
|
||||
import org.talend.core.model.general.ModuleNeeded;
|
||||
import org.talend.core.model.process.JobInfo;
|
||||
import org.talend.core.model.process.ProcessUtils;
|
||||
|
||||
/**
|
||||
* DOC nrousseau class global comment. Detailled comment
|
||||
@@ -79,7 +78,7 @@ public class LastGenerationInfo {
|
||||
* @return the modulesNeededPerJob
|
||||
*/
|
||||
public Set<ModuleNeeded> getModulesNeededWithSubjobPerJob(String jobId, String jobVersion) {
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
if (!modulesNeededWithSubjobPerJob.containsKey(key)) {
|
||||
modulesNeededWithSubjobPerJob.put(key, new HashSet<ModuleNeeded>());
|
||||
}
|
||||
@@ -91,7 +90,7 @@ public class LastGenerationInfo {
|
||||
* @return the modulesNeededPerJob
|
||||
*/
|
||||
public Set<ModuleNeeded> getModulesNeededPerJob(String jobId, String jobVersion) {
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
if (!modulesNeededPerJob.containsKey(key)) {
|
||||
modulesNeededPerJob.put(key, new HashSet<ModuleNeeded>());
|
||||
}
|
||||
@@ -104,7 +103,7 @@ public class LastGenerationInfo {
|
||||
* @return the contextPerJob
|
||||
*/
|
||||
public Set<String> getContextPerJob(String jobId, String jobVersion) {
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
if (!contextPerJob.containsKey(key)) {
|
||||
contextPerJob.put(key, new HashSet<String>());
|
||||
}
|
||||
@@ -117,7 +116,7 @@ public class LastGenerationInfo {
|
||||
* @param modulesNeededPerJob the modulesNeededPerJob to set
|
||||
*/
|
||||
public void setModulesNeededPerJob(String jobId, String jobVersion, Set<ModuleNeeded> modulesNeeded) {
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
modulesNeededPerJob.put(key, new HashSet<ModuleNeeded>(modulesNeeded));
|
||||
}
|
||||
|
||||
@@ -126,8 +125,8 @@ public class LastGenerationInfo {
|
||||
*
|
||||
* @param modulesNeededWithSubjobPerJob the modulesNeededWithSubjobPerJob to set
|
||||
*/
|
||||
public void setModulesNeededWithSubjobPerJob(String jobId, String jobVersion, Set<ModuleNeeded> modulesNeeded) {
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
public void setModulesNeededWithSubjobPerJob(String jobId, String jobVersion, Set<ModuleNeeded> modulesNeeded) {
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
if (modulesNeeded == null) {
|
||||
modulesNeededWithSubjobPerJob.put(key, null);
|
||||
} else {
|
||||
@@ -141,17 +140,17 @@ public class LastGenerationInfo {
|
||||
* @param contextPerJob the contextPerJob to set
|
||||
*/
|
||||
public void setContextPerJob(String jobId, String jobVersion, Set<String> contexts) {
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
contextPerJob.put(key, new HashSet<String>(contexts));
|
||||
}
|
||||
|
||||
public void setUseDynamic(String jobId, String jobVersion, boolean dynamic) {
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
useDynamic.put(key, dynamic);
|
||||
}
|
||||
|
||||
public boolean isUseDynamic(String jobId, String jobVersion) {
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
if (!useDynamic.containsKey(key)) {
|
||||
return false;
|
||||
}
|
||||
@@ -163,12 +162,12 @@ public class LastGenerationInfo {
|
||||
}
|
||||
|
||||
public void setUseRules(String jobId, String jobVersion, boolean useRules) {
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
this.useRules.put(key, useRules);
|
||||
}
|
||||
|
||||
public boolean isUseRules(String jobId, String jobVersion) {
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
if (!useRules.containsKey(key)) {
|
||||
return false;
|
||||
}
|
||||
@@ -180,12 +179,12 @@ public class LastGenerationInfo {
|
||||
}
|
||||
|
||||
public void setUsePigUDFs(String jobId, String jobVersion, boolean useRules) {
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
this.usedPigUDFs.put(key, useRules);
|
||||
}
|
||||
|
||||
public boolean isUsePigUDFs(String jobId, String jobVersion) {
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
if (!usedPigUDFs.containsKey(key)) {
|
||||
return false;
|
||||
}
|
||||
@@ -252,7 +251,7 @@ public class LastGenerationInfo {
|
||||
* @return the modulesNeededPerJob
|
||||
*/
|
||||
public Set<String> getRoutinesNeededPerJob(String jobId, String jobVersion) {
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
if (!routinesNeededPerJob.containsKey(key)) {
|
||||
routinesNeededPerJob.put(key, new HashSet<String>());
|
||||
}
|
||||
@@ -280,8 +279,7 @@ public class LastGenerationInfo {
|
||||
}
|
||||
|
||||
private String getProcessKey(String jobId, String jobVersion) {
|
||||
String pureJobId = ProcessUtils.getPureItemId(jobId);
|
||||
return pureJobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
return jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -290,7 +288,7 @@ public class LastGenerationInfo {
|
||||
* @return the pigudfNeededPerJob
|
||||
*/
|
||||
public Set<String> getPigudfNeededPerJob(String jobId, String jobVersion) {
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
if (!pigudfNeededPerJob.containsKey(key)) {
|
||||
pigudfNeededPerJob.put(key, new HashSet<String>());
|
||||
}
|
||||
@@ -304,7 +302,7 @@ public class LastGenerationInfo {
|
||||
* @param modulesNeededPerJob the modulesNeededPerJob to set
|
||||
*/
|
||||
public void setRoutinesNeededPerJob(String jobId, String jobVersion, Set<String> modulesNeeded) {
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
routinesNeededPerJob.put(key, new HashSet<String>(modulesNeeded));
|
||||
}
|
||||
|
||||
@@ -314,7 +312,7 @@ public class LastGenerationInfo {
|
||||
* @param pigudfNeededPerJob the pigudfNeededPerJob to set
|
||||
*/
|
||||
public void setPigudfNeededPerJob(String jobId, String jobVersion, Set<String> modulesNeeded) {
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
pigudfNeededPerJob.put(key, new HashSet<String>(modulesNeeded));
|
||||
}
|
||||
|
||||
@@ -323,7 +321,7 @@ public class LastGenerationInfo {
|
||||
* @return the modulesNeededPerJob
|
||||
*/
|
||||
public Set<String> getRoutinesNeededWithSubjobPerJob(String jobId, String jobVersion) {
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
if (!routinesNeededWithSubjobPerJob.containsKey(key)) {
|
||||
routinesNeededWithSubjobPerJob.put(key, new HashSet<String>());
|
||||
}
|
||||
@@ -336,7 +334,7 @@ public class LastGenerationInfo {
|
||||
* @return the pigudfNeededWithSubjobPerJob
|
||||
*/
|
||||
public Set<String> getPigudfNeededWithSubjobPerJob(String jobId, String jobVersion) {
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
if (!pigudfNeededWithSubjobPerJob.containsKey(key)) {
|
||||
pigudfNeededWithSubjobPerJob.put(key, new HashSet<String>());
|
||||
}
|
||||
@@ -350,7 +348,7 @@ public class LastGenerationInfo {
|
||||
* @param modulesNeededPerJob the modulesNeededPerJob to set
|
||||
*/
|
||||
public void setRoutinesNeededWithSubjobPerJob(String jobId, String jobVersion, Set<String> modulesNeeded) {
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
routinesNeededWithSubjobPerJob.put(key, new HashSet<String>(modulesNeeded));
|
||||
}
|
||||
|
||||
@@ -360,7 +358,7 @@ public class LastGenerationInfo {
|
||||
* @param pigudfNeededWithSubjobPerJob the pigudfNeededWithSubjobPerJob to set
|
||||
*/
|
||||
public void setPigudfNeededWithSubjobPerJob(String jobId, String jobVersion, Set<String> modulesNeeded) {
|
||||
String key = this.getProcessKey(jobId, jobVersion);
|
||||
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
|
||||
pigudfNeededWithSubjobPerJob.put(key, new HashSet<String>(modulesNeeded));
|
||||
}
|
||||
|
||||
@@ -370,15 +368,6 @@ public class LastGenerationInfo {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear modules per job cache, not thread safe
|
||||
*/
|
||||
public void clearModulesNeededPerJob() {
|
||||
if (!modulesNeededPerJob.isEmpty()) {
|
||||
modulesNeededPerJob.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public void clean() {
|
||||
modulesNeededPerJob.clear();
|
||||
routinesNeededPerJob.clear();
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// 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.service;
|
||||
|
||||
import org.talend.core.IService;
|
||||
|
||||
public interface IUpdateService extends IService {
|
||||
|
||||
boolean checkComponentNexusUpdate();
|
||||
|
||||
}
|
||||
@@ -99,8 +99,6 @@ public interface IJobletProviderService extends IService {
|
||||
public IEditorPart openJobletItem(JobletProcessItem item);
|
||||
|
||||
public boolean isJobletItem(Item item);
|
||||
|
||||
public boolean isJobletProcess(IProcess process);
|
||||
|
||||
public Action getMoveToJobletAction(IWorkbenchPart part, INode jobletNode, Map<INode, IConnection> nodeMap);
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@ import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.core.prefs.SSLPreferenceConstants;
|
||||
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||
import org.talend.daikon.security.CryptoHelper;
|
||||
import org.talend.daikon.security.SSLContextProvider;
|
||||
import org.talend.utils.security.StudioEncryption;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -34,7 +34,7 @@ public class StudioSSLContextProvider {
|
||||
|
||||
private static SSLContext context;
|
||||
|
||||
private static final IPreferenceStore STORE = CoreRuntimePlugin.getInstance().getCoreService().getPreferenceStore();
|
||||
private static final IPreferenceStore store = CoreRuntimePlugin.getInstance().getCoreService().getPreferenceStore();
|
||||
|
||||
public static synchronized SSLContext getContext() throws Exception {
|
||||
if (null == context) {
|
||||
@@ -44,14 +44,15 @@ public class StudioSSLContextProvider {
|
||||
}
|
||||
|
||||
public static synchronized void buildContext() throws Exception {
|
||||
String keypath = STORE.getString(SSLPreferenceConstants.KEYSTORE_FILE);
|
||||
String keypass = STORE.getString(SSLPreferenceConstants.KEYSTORE_PASSWORD);
|
||||
String keytype = STORE.getString(SSLPreferenceConstants.KEYSTORE_TYPE);
|
||||
String trustpath = STORE.getString(SSLPreferenceConstants.TRUSTSTORE_FILE);
|
||||
String trustpass = STORE.getString(SSLPreferenceConstants.TRUSTSTORE_PASSWORD);
|
||||
String trusttype = STORE.getString(SSLPreferenceConstants.TRUSTSTORE_TYPE);
|
||||
keypass = StudioEncryption.getStudioEncryption(StudioEncryption.EncryptionKeyName.SYSTEM).decrypt(keypass);
|
||||
trustpass = StudioEncryption.getStudioEncryption(StudioEncryption.EncryptionKeyName.SYSTEM).decrypt(trustpass);
|
||||
String keypath = store.getString(SSLPreferenceConstants.KEYSTORE_FILE);
|
||||
String keypass = store.getString(SSLPreferenceConstants.KEYSTORE_PASSWORD);
|
||||
String keytype = store.getString(SSLPreferenceConstants.KEYSTORE_TYPE);
|
||||
String trustpath = store.getString(SSLPreferenceConstants.TRUSTSTORE_FILE);
|
||||
String trustpass = store.getString(SSLPreferenceConstants.TRUSTSTORE_PASSWORD);
|
||||
String trusttype = store.getString(SSLPreferenceConstants.TRUSTSTORE_TYPE);
|
||||
CryptoHelper cryptoHelper = CryptoHelper.getDefault();
|
||||
keypass = cryptoHelper.decrypt(keypass);
|
||||
trustpass = cryptoHelper.decrypt(trustpass);
|
||||
try {
|
||||
if (StringUtils.isEmpty(keypath) && StringUtils.isEmpty(trustpath)) {
|
||||
context = null;
|
||||
@@ -87,12 +88,12 @@ public class StudioSSLContextProvider {
|
||||
|
||||
private static void changeProperty() {
|
||||
final IPreferenceStore sslStore = CoreRuntimePlugin.getInstance().getCoreService().getPreferenceStore();
|
||||
CryptoHelper cryptoHelper = CryptoHelper.getDefault();
|
||||
String keyStore = sslStore.getString(SSLPreferenceConstants.KEYSTORE_FILE);
|
||||
if (keyStore != null && !"".equals(keyStore.trim())) {
|
||||
System.setProperty(SSLPreferenceConstants.KEYSTORE_FILE, keyStore);
|
||||
System.setProperty(SSLPreferenceConstants.KEYSTORE_PASSWORD,
|
||||
StudioEncryption.getStudioEncryption(StudioEncryption.EncryptionKeyName.SYSTEM)
|
||||
.decrypt(sslStore.getString(SSLPreferenceConstants.KEYSTORE_PASSWORD)));
|
||||
cryptoHelper.decrypt(sslStore.getString(SSLPreferenceConstants.KEYSTORE_PASSWORD)));
|
||||
System.setProperty(SSLPreferenceConstants.KEYSTORE_TYPE, sslStore.getString(SSLPreferenceConstants.KEYSTORE_TYPE));
|
||||
} else {
|
||||
System.clearProperty(SSLPreferenceConstants.KEYSTORE_FILE);
|
||||
@@ -103,8 +104,7 @@ public class StudioSSLContextProvider {
|
||||
if (trustStore != null && !"".equals(trustStore.trim())) {
|
||||
System.setProperty(SSLPreferenceConstants.TRUSTSTORE_FILE, trustStore);
|
||||
System.setProperty(SSLPreferenceConstants.TRUSTSTORE_PASSWORD,
|
||||
StudioEncryption.getStudioEncryption(StudioEncryption.EncryptionKeyName.SYSTEM)
|
||||
.decrypt(sslStore.getString(SSLPreferenceConstants.TRUSTSTORE_PASSWORD)));
|
||||
cryptoHelper.decrypt(sslStore.getString(SSLPreferenceConstants.TRUSTSTORE_PASSWORD)));
|
||||
System.setProperty(SSLPreferenceConstants.TRUSTSTORE_TYPE, sslStore.getString(SSLPreferenceConstants.TRUSTSTORE_TYPE));
|
||||
} else {
|
||||
System.clearProperty(SSLPreferenceConstants.TRUSTSTORE_FILE);
|
||||
|
||||
@@ -19,9 +19,7 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
@@ -81,8 +79,6 @@ public abstract class AbstractRoutineSynchronizer implements ITalendSynchronizer
|
||||
}
|
||||
|
||||
private Collection<RoutineItem> getAll(ERepositoryObjectType type, boolean syncRef) throws SystemException {
|
||||
// init code project
|
||||
getRunProcessService().getTalendCodeJavaProject(type);
|
||||
// remove routine with same name in reference project
|
||||
final Map<String, RoutineItem> beansList = new HashMap<String, RoutineItem>();
|
||||
for (IRepositoryViewObject obj : getRepositoryService().getProxyRepositoryFactory().getAll(type)) {
|
||||
@@ -99,37 +95,27 @@ public abstract class AbstractRoutineSynchronizer implements ITalendSynchronizer
|
||||
return (IRepositoryService) GlobalServiceRegister.getDefault().getService(IRepositoryService.class);
|
||||
}
|
||||
|
||||
private Set<IRepositoryViewObject> getReferencedProjectRoutine(final Map<String, RoutineItem> beansList,
|
||||
final Project project, ERepositoryObjectType routineType, boolean syncRef) throws SystemException {
|
||||
// init ref code project
|
||||
if (syncRef) {
|
||||
getRunProcessService().getTalendCodeJavaProject(routineType, project.getTechnicalLabel());
|
||||
}
|
||||
Set<IRepositoryViewObject> routines = new HashSet<>();
|
||||
routines.addAll(getRepositoryService().getProxyRepositoryFactory().getAll(project, routineType));
|
||||
for (IRepositoryViewObject obj : routines) {
|
||||
private void getReferencedProjectRoutine(final Map<String, RoutineItem> beansList, final Project project,
|
||||
ERepositoryObjectType routineType, boolean syncRef) throws SystemException {
|
||||
for (IRepositoryViewObject obj : getRepositoryService().getProxyRepositoryFactory().getAll(project, routineType)) {
|
||||
final String key = obj.getProperty().getLabel();
|
||||
// it does not have a routine with same name
|
||||
if (!beansList.containsKey(key)) {
|
||||
beansList.put(key, (RoutineItem) obj.getProperty().getItem());
|
||||
}
|
||||
}
|
||||
for (ProjectReference projectReference : project.getProjectReferenceList()) {
|
||||
routines.addAll(getReferencedProjectRoutine(beansList, new Project(projectReference.getReferencedProject()),
|
||||
routineType, syncRef));
|
||||
if (syncRef) {
|
||||
// sync routine
|
||||
syncRoutine((RoutineItem) obj.getProperty().getItem(), false, true, true);
|
||||
}
|
||||
}
|
||||
if (syncRef) {
|
||||
routines.stream().forEach(obj -> {
|
||||
try {
|
||||
syncRoutine((RoutineItem) obj.getProperty().getItem(), project.getTechnicalLabel(), true, true);
|
||||
} catch (SystemException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
});
|
||||
// sync system routine
|
||||
syncSystemRoutine(project);
|
||||
}
|
||||
return routines;
|
||||
|
||||
for (ProjectReference projectReference : project.getProjectReferenceList()) {
|
||||
getReferencedProjectRoutine(beansList, new Project(projectReference.getReferencedProject()), routineType, syncRef);
|
||||
}
|
||||
}
|
||||
|
||||
protected void syncSystemRoutine(Project project) throws SystemException {
|
||||
@@ -142,17 +128,24 @@ public abstract class AbstractRoutineSynchronizer implements ITalendSynchronizer
|
||||
}
|
||||
|
||||
protected IFile getRoutineFile(RoutineItem routineItem) throws SystemException {
|
||||
return getRoutineFile(routineItem, ProjectManager.getInstance().getCurrentProject().getTechnicalLabel());
|
||||
return getRoutineFile(routineItem, true);
|
||||
}
|
||||
|
||||
protected IFile getRoutineFile(RoutineItem routineItem, String projectTechName) throws SystemException {
|
||||
protected IFile getRoutineFile(RoutineItem routineItem, boolean currentProject) throws SystemException {
|
||||
String projectTechName;
|
||||
if (currentProject) {
|
||||
projectTechName = ProjectManager.getInstance().getCurrentProject().getTechnicalLabel();
|
||||
} else {
|
||||
projectTechName = ProjectManager.getInstance().getProject(routineItem).getTechnicalLabel();
|
||||
}
|
||||
ITalendProcessJavaProject talendProcessJavaProject = getRunProcessService()
|
||||
.getTalendCodeJavaProject(ERepositoryObjectType.getItemType(routineItem), projectTechName);
|
||||
if (talendProcessJavaProject == null) {
|
||||
return null;
|
||||
}
|
||||
IFolder routineFolder = talendProcessJavaProject.getSrcSubFolder(null, routineItem.getPackageType());
|
||||
return routineFolder.getFile(routineItem.getProperty().getLabel() + JavaUtils.JAVA_EXTENSION);
|
||||
IFile file = routineFolder.getFile(routineItem.getProperty().getLabel() + JavaUtils.JAVA_EXTENSION);
|
||||
return file;
|
||||
}
|
||||
|
||||
private IFile getProcessFile(ProcessItem item) throws SystemException {
|
||||
@@ -200,31 +193,30 @@ public abstract class AbstractRoutineSynchronizer implements ITalendSynchronizer
|
||||
|
||||
@Override
|
||||
public void syncRoutine(RoutineItem routineItem, boolean copyToTemp) throws SystemException {
|
||||
syncRoutine(routineItem, ProjectManager.getInstance().getCurrentProject().getTechnicalLabel(), copyToTemp, false);
|
||||
syncRoutine(routineItem, true, copyToTemp, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncRoutine(RoutineItem routineItem, boolean copyToTemp, boolean forceUpdate) throws SystemException {
|
||||
syncRoutine(routineItem, ProjectManager.getInstance().getCurrentProject().getTechnicalLabel(), copyToTemp, forceUpdate);
|
||||
syncRoutine(routineItem, true, copyToTemp, forceUpdate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncRoutine(RoutineItem routineItem, String projectTechName, boolean copyToTemp, boolean forceUpdate)
|
||||
throws SystemException {
|
||||
public void syncRoutine(RoutineItem routineItem, boolean currentProject, boolean copyToTemp, boolean forceUpdate) throws SystemException {
|
||||
boolean needSync = false;
|
||||
if (routineItem != null) {
|
||||
if (forceUpdate || !isRoutineUptodate(routineItem)) {
|
||||
needSync = true;
|
||||
} else {
|
||||
IFile file = getRoutineFile(routineItem, projectTechName);
|
||||
IFile file = getRoutineFile(routineItem, currentProject);
|
||||
if (file != null && !file.exists()) {
|
||||
needSync = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (needSync) {
|
||||
doSyncRoutine(routineItem, projectTechName, copyToTemp);
|
||||
if (ProjectManager.getInstance().getCurrentProject().getTechnicalLabel().equals(projectTechName)) {
|
||||
doSyncRoutine(routineItem, currentProject, copyToTemp);
|
||||
if (currentProject) {
|
||||
setRoutineAsUptodate(routineItem);
|
||||
}
|
||||
}
|
||||
@@ -232,14 +224,14 @@ public abstract class AbstractRoutineSynchronizer implements ITalendSynchronizer
|
||||
|
||||
public void syncRoutine(RoutineItem routineItem) throws SystemException {
|
||||
if (routineItem != null) {
|
||||
doSyncRoutine(routineItem, ProjectManager.getInstance().getCurrentProject().getTechnicalLabel(), true);
|
||||
doSyncRoutine(routineItem, true, true);
|
||||
setRoutineAsUptodate(routineItem);
|
||||
}
|
||||
}
|
||||
|
||||
private void doSyncRoutine(RoutineItem routineItem, String projectTechName, boolean copyToTemp) throws SystemException {
|
||||
private void doSyncRoutine(RoutineItem routineItem, boolean currentProject, boolean copyToTemp) throws SystemException {
|
||||
try {
|
||||
IFile file = getRoutineFile(routineItem, projectTechName);
|
||||
IFile file = getRoutineFile(routineItem, currentProject);
|
||||
if (file == null) {
|
||||
return;
|
||||
}
|
||||
@@ -382,7 +374,7 @@ public abstract class AbstractRoutineSynchronizer implements ITalendSynchronizer
|
||||
@Override
|
||||
public void syncAllBeansForLogOn() throws SystemException {
|
||||
for (RoutineItem beanItem : getBeans(true)) {
|
||||
syncRoutine(beanItem, true, true);
|
||||
syncRoutine(beanItem, true, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,8 +45,7 @@ public interface ITalendSynchronizer {
|
||||
|
||||
void syncRoutine(RoutineItem routineItem, boolean copyToTemp, boolean forceUpdate) throws SystemException;
|
||||
|
||||
void syncRoutine(RoutineItem routineItem, String projectTechName, boolean copyToTemp, boolean forceUpdate)
|
||||
throws SystemException;
|
||||
void syncRoutine(RoutineItem routineItem, boolean currentProject, boolean copyToTemp, boolean forceUpdate) throws SystemException;
|
||||
|
||||
IFile getFile(Item item) throws SystemException;
|
||||
|
||||
|
||||
@@ -159,8 +159,6 @@ public interface IDesignerCoreService extends IService {
|
||||
|
||||
public Set<ModuleNeeded> getNeededLibrariesForProcess(IProcess process, boolean withChildrens);
|
||||
|
||||
public Set<ModuleNeeded> getNeededLibrariesForProcessBeforeUpdateLog(IProcess process, boolean withChildrens);
|
||||
|
||||
public Set<ModuleNeeded> getNeededModules(INode node, boolean withChildrens);
|
||||
|
||||
public void switchToCurContextsView();
|
||||
@@ -197,7 +195,4 @@ public interface IDesignerCoreService extends IService {
|
||||
public void setTACReadTimeout(int timeout);
|
||||
|
||||
boolean isDelegateNode(INode node);
|
||||
|
||||
boolean isNeedContextInJar(IProcess process);
|
||||
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
// ============================================================================
|
||||
package org.talend.designer.runprocess;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -255,9 +254,6 @@ public interface IProcessor {
|
||||
|
||||
public String[] getCommandLine(boolean needContext, boolean externalUse, int statOption, int traceOption,
|
||||
String... codeOptions);
|
||||
|
||||
public String[] getCommandLine(boolean needContext, boolean externalUse, int statOption, int traceOption, boolean ignoreCustomJVMSetting,
|
||||
String... codeOptions);
|
||||
|
||||
public void setContext(IContext context);
|
||||
|
||||
@@ -299,8 +295,6 @@ public interface IProcessor {
|
||||
String[] getJVMArgs();
|
||||
|
||||
Set<ModuleNeeded> getNeededModules(int options);
|
||||
|
||||
public void updateModulesAfterSetLog4j(Collection<ModuleNeeded> modulesNeeded);
|
||||
|
||||
Set<JobInfo> getBuildChildrenJobs();
|
||||
|
||||
|
||||
@@ -216,8 +216,6 @@ public interface IRunProcessService extends IService {
|
||||
|
||||
ITalendProcessJavaProject getTalendJobJavaProject(Property property);
|
||||
|
||||
IFolder getCodeSrcFolder(ERepositoryObjectType type, String projectTechName);
|
||||
|
||||
ITalendProcessJavaProject getTempJavaProject();
|
||||
|
||||
void clearProjectRelatedSettings();
|
||||
@@ -239,6 +237,4 @@ public interface IRunProcessService extends IService {
|
||||
public void handleJobDependencyLoop(JobInfo mainJobInfo, List<JobInfo> listJobs, IProgressMonitor progressMonitor)
|
||||
throws Exception;
|
||||
|
||||
public boolean isSelectLog4j2();
|
||||
|
||||
}
|
||||
|
||||
@@ -71,12 +71,7 @@ public class ItemCacheManager {
|
||||
processItem = getRefProcessItem(ProjectManager.getInstance().getCurrentProject(), parsedArray[1]);
|
||||
} else {
|
||||
Project project = ProjectManager.getInstance().getProjectFromProjectTechLabel(parsedArray[0]);
|
||||
if (project != null) {
|
||||
processItem = getProcessItem(project, parsedArray[1]);
|
||||
}
|
||||
if (processItem == null) {
|
||||
processItem = getRefProcessItem(ProjectManager.getInstance().getCurrentProject(), parsedArray[1]);
|
||||
}
|
||||
processItem = getProcessItem(project, parsedArray[1]);
|
||||
}
|
||||
return processItem;
|
||||
}
|
||||
@@ -117,12 +112,7 @@ public class ItemCacheManager {
|
||||
refProcessItem = getRefProcessItem(ProjectManager.getInstance().getCurrentProject(), parsedArray[1], version);
|
||||
} else {
|
||||
Project project = ProjectManager.getInstance().getProjectFromProjectTechLabel(parsedArray[0]);
|
||||
if (project != null) {
|
||||
refProcessItem = getProcessItem(project, parsedArray[1], version);
|
||||
}
|
||||
if (refProcessItem == null) {
|
||||
refProcessItem = getRefProcessItem(ProjectManager.getInstance().getCurrentProject(), parsedArray[1], version);
|
||||
}
|
||||
refProcessItem = getProcessItem(project, parsedArray[1], version);
|
||||
}
|
||||
return refProcessItem;
|
||||
}
|
||||
|
||||
@@ -200,10 +200,6 @@ public final class ProjectManager {
|
||||
* return all the referenced projects of current project.
|
||||
*/
|
||||
public List<Project> getAllReferencedProjects(boolean force) {
|
||||
return getAllReferencedProjects(getCurrentProject(), force);
|
||||
}
|
||||
|
||||
public List<Project> getAllReferencedProjects(Project targetProject, boolean force) {
|
||||
List<Project> allReferencedprojects = new ArrayList<Project>();
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IProxyRepositoryService.class)) {
|
||||
if (this.getCurrentProject() == null) {
|
||||
@@ -216,7 +212,7 @@ public final class ProjectManager {
|
||||
IProxyRepositoryFactory factory = service.getProxyRepositoryFactory();
|
||||
if (factory != null) {
|
||||
List<org.talend.core.model.properties.Project> rProjects = factory
|
||||
.getReferencedProjects(targetProject);
|
||||
.getReferencedProjects(this.getCurrentProject());
|
||||
if (rProjects != null) {
|
||||
for (org.talend.core.model.properties.Project p : rProjects) {
|
||||
Project project = new Project(p);
|
||||
|
||||
@@ -461,9 +461,6 @@ public interface IProxyRepositoryFactory {
|
||||
|
||||
public void forceDeleteObjectPhysical(IRepositoryViewObject objToDelete, String version, boolean isDeleteOnRemote) throws PersistenceException;
|
||||
|
||||
public void forceBatchDeleteObjectPhysical(Project project, List<IRepositoryViewObject> objToDeleteList,
|
||||
boolean isDeleteAllVersion, boolean isDeleteOnRemote) throws PersistenceException;
|
||||
|
||||
public Property getUptodateProperty(Project project, Property property) throws PersistenceException;
|
||||
|
||||
public Property getUptodateProperty(Property property) throws PersistenceException;
|
||||
|
||||
@@ -138,6 +138,4 @@ public interface IRepositoryService extends IService {
|
||||
|
||||
boolean isGIT();
|
||||
|
||||
public void setShouldCheckRepoViewCommonNavigatorDirty(IRepositoryView repView, boolean shouldFlag);
|
||||
|
||||
}
|
||||
|
||||
@@ -98,8 +98,6 @@ public class RepositoryConstants {
|
||||
|
||||
public static final String REPOSITORY_CLOUD_APAC_ID = "cloud_apac"; //$NON-NLS-1$
|
||||
|
||||
public static final String REPOSITORY_CLOUD_US_WEST_ID = "cloud_us_west"; //$NON-NLS-1$
|
||||
|
||||
public static final String REPOSITORY_CLOUD_CUSTOM_ID = "cloud_custom"; //$NON-NLS-1$
|
||||
|
||||
public static final String REPOSITORY_URL = "url"; //$NON-NLS-1$
|
||||
|
||||
@@ -35,7 +35,6 @@ import org.talend.core.model.general.ConnectionBean;
|
||||
import org.talend.utils.json.JSONArray;
|
||||
import org.talend.utils.json.JSONException;
|
||||
import org.talend.utils.json.JSONObject;
|
||||
import org.talend.utils.security.EncryptedProperties;
|
||||
|
||||
/**
|
||||
* DOC hwang class global comment. Detailled comment
|
||||
@@ -127,8 +126,8 @@ public class ConnectionUserPerReader {
|
||||
if (!isHaveUserPer()) {
|
||||
createPropertyFile();
|
||||
}
|
||||
try (FileInputStream fi = new FileInputStream(perfile)) {
|
||||
proper.load(fi);
|
||||
try {
|
||||
proper.load(new FileInputStream(perfile));
|
||||
isRead = true;
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
@@ -177,7 +176,9 @@ public class ConnectionUserPerReader {
|
||||
}
|
||||
proper.setProperty("connection.define", usersJsonArray.toString());//$NON-NLS-1$
|
||||
}
|
||||
try (FileOutputStream out = new FileOutputStream(perfile)) {
|
||||
try {
|
||||
|
||||
FileOutputStream out = new FileOutputStream(perfile);
|
||||
proper.store(out, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -201,8 +202,9 @@ public class ConnectionUserPerReader {
|
||||
proper.remove("connection.lastConnection"); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
;
|
||||
try (FileOutputStream out = new FileOutputStream(perfile)) {
|
||||
FileOutputStream out;
|
||||
try {
|
||||
out = new FileOutputStream(perfile);
|
||||
proper.store(out, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -284,7 +286,9 @@ public class ConnectionUserPerReader {
|
||||
IPreferenceStore prefStore = PlatformUI.getPreferenceStore();
|
||||
proper.setProperty("connection.readRegistration", Integer.toString(prefStore.getInt("REGISTRATION_TRIES")));
|
||||
proper.setProperty("connection.readRegistrationDone", Integer.toString(prefStore.getInt("REGISTRATION_DONE")));
|
||||
try (FileOutputStream out = new FileOutputStream(perfile)) {
|
||||
try {
|
||||
|
||||
FileOutputStream out = new FileOutputStream(perfile);
|
||||
proper.store(out, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -313,7 +317,8 @@ public class ConnectionUserPerReader {
|
||||
String val = entry.getValue();
|
||||
proper.setProperty(key, val);
|
||||
}
|
||||
try (FileOutputStream out = new FileOutputStream(perfile)) {
|
||||
try {
|
||||
FileOutputStream out = new FileOutputStream(perfile);
|
||||
proper.store(out, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -329,7 +334,9 @@ public class ConnectionUserPerReader {
|
||||
}
|
||||
IPreferenceStore prefStore = PlatformUI.getPreferenceStore();
|
||||
proper.setProperty("connection.licenseManagement", Integer.toString(prefStore.getInt("LICENSE_VALIDATION_DONE")));
|
||||
try (FileOutputStream out = new FileOutputStream(perfile)) {
|
||||
try {
|
||||
|
||||
FileOutputStream out = new FileOutputStream(perfile);
|
||||
proper.store(out, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -355,7 +362,8 @@ public class ConnectionUserPerReader {
|
||||
this.readProperties();
|
||||
}
|
||||
proper.setProperty("connection.installDone", Boolean.TRUE.toString()); //$NON-NLS-1$
|
||||
try (FileOutputStream out = new FileOutputStream(perfile)) {
|
||||
try {
|
||||
FileOutputStream out = new FileOutputStream(perfile);
|
||||
proper.store(out, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.utils.security;
|
||||
package org.talend.repository.ui.login.connections;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.talend.utils.security.StudioEncryption;
|
||||
import org.talend.daikon.security.CryptoHelper;
|
||||
|
||||
|
||||
/**
|
||||
@@ -22,10 +22,15 @@ import org.talend.utils.security.StudioEncryption;
|
||||
*/
|
||||
public class EncryptedProperties extends Properties {
|
||||
|
||||
private CryptoHelper crypto;
|
||||
|
||||
public EncryptedProperties() {
|
||||
crypto = new CryptoHelper("Il faudrait trouver une passphrase plus originale que celle-ci!");
|
||||
}
|
||||
|
||||
public String getProperty(String key) {
|
||||
try {
|
||||
return StudioEncryption.getStudioEncryption(StudioEncryption.EncryptionKeyName.SYSTEM)
|
||||
.decrypt(super.getProperty(key));
|
||||
return crypto.decrypt(super.getProperty(key));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Couldn't decrypt property");
|
||||
}
|
||||
@@ -33,8 +38,7 @@ public class EncryptedProperties extends Properties {
|
||||
|
||||
public synchronized Object setProperty(String key, String value) {
|
||||
try {
|
||||
return super.setProperty(key,
|
||||
StudioEncryption.getStudioEncryption(StudioEncryption.EncryptionKeyName.SYSTEM).encrypt(value));
|
||||
return super.setProperty(key, crypto.encrypt(value));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Couldn't encrypt property");
|
||||
}
|
||||
@@ -619,6 +619,4 @@ I18nPreferencePage.importBabili=Import Translation from Babili
|
||||
I18nPreferencePage.restart=Restart
|
||||
I18nPreferencePage.restartButton=Need to restart to take effect.
|
||||
I18nPreferencePage.restoreDefault=Restore default
|
||||
I18nPreferencePage.wait_process=Process will hold on several minutes, please wait...
|
||||
MetadataPreferencePage.EnableBasic.name=Enable Basic Authentication Header
|
||||
MetadataPreferencePage.MessageDialog.Restart=Will restart the studio to apply this setting. \nAre you sure?
|
||||
I18nPreferencePage.wait_process=Process will hold on several minutes, please wait...
|
||||
@@ -152,11 +152,11 @@ public class FilteredCheckboxTree extends Composite {
|
||||
*/
|
||||
static {
|
||||
ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(PlatformUI.PLUGIN_ID,
|
||||
"$nl$/icons/full/etool16/clear_co.png"); //$NON-NLS-1$
|
||||
"$nl$/icons/full/etool16/clear_co.gif"); //$NON-NLS-1$
|
||||
if (descriptor != null) {
|
||||
JFaceResources.getImageRegistry().put(CLEAR_ICON, descriptor);
|
||||
}
|
||||
descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(PlatformUI.PLUGIN_ID, "$nl$/icons/full/dtool16/clear_co.png"); //$NON-NLS-1$
|
||||
descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(PlatformUI.PLUGIN_ID, "$nl$/icons/full/dtool16/clear_co.gif"); //$NON-NLS-1$
|
||||
if (descriptor != null) {
|
||||
JFaceResources.getImageRegistry().put(DCLEAR_ICON, descriptor);
|
||||
}
|
||||
|
||||
@@ -472,7 +472,7 @@ public class ContextNebulaGridComposite extends AbstractContextTabEditComposite
|
||||
paramNameFound = true;
|
||||
paramName = NEW_PARAM_NAME + numParam;
|
||||
for (int i = 0; i < listParams.size(); i++) {
|
||||
if (paramName.equalsIgnoreCase(listParams.get(i).getName())) {
|
||||
if (paramName.equals(listParams.get(i).getName())) {
|
||||
paramNameFound = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -715,13 +715,6 @@ public class SelectRepositoryContextDialog extends SelectionDialog {
|
||||
if (param != null && param.isBuiltIn()) {
|
||||
return false;
|
||||
}
|
||||
if (param == null) {
|
||||
boolean containsSameParameterIgnoreCase = manager.getDefaultContext()
|
||||
.containsSameParameterIgnoreCase(paramType.getName());
|
||||
if (containsSameParameterIgnoreCase) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.eclipse.emf.common.util.EMap;
|
||||
import org.eclipse.gef.commands.Command;
|
||||
@@ -153,8 +152,8 @@ public class RepositoryChangeMetadataForSAPBapi extends Command {
|
||||
|
||||
String uinqueTableName = node.getProcess().generateUniqueConnectionName(
|
||||
MultiSchemasUtil.getConnectionBaseName(newMetadatTable.getLabel()));
|
||||
String type = getType(newMetadatTable, isInput);
|
||||
if (type == null) {
|
||||
String paramType = getParamType(newMetadatTable, isInput);
|
||||
if (paramType == null) {
|
||||
return;
|
||||
}
|
||||
if (selectionIndex != null && selectionIndex < paramValues.size()) {
|
||||
@@ -166,19 +165,18 @@ public class RepositoryChangeMetadataForSAPBapi extends Command {
|
||||
paramValues.add(valueMap);
|
||||
}
|
||||
valueMap.put(ISAPConstant.NAME, TalendQuoteUtils.addQuotes(newMetadatTable.getLabel()));
|
||||
valueMap.put(ISAPConstant.TYPE, type);
|
||||
valueMap.put(ISAPConstant.TYPE, paramType);
|
||||
valueMap.put(ISAPConstant.FIELD_SCHEMA, uinqueTableName);
|
||||
if (isInput) {
|
||||
valueMap.put(ISAPConstant.PARENT_ROW, ""); //$NON-NLS-1$
|
||||
|
||||
String inputParameterType = getInputParameterType(functionUnit, newMetadatTable);
|
||||
if (StringUtils.isBlank(inputParameterType)) {
|
||||
inputParameterType = ISAPConstant.PARAMETER_TYPE_IMPORT;
|
||||
if (functionUnit != null && functionUnit.getParamData() != null
|
||||
&& functionUnit.getParamData().getInputRoot() != null) {
|
||||
for (SAPFunctionParameter param : functionUnit.getParamData().getInputRoot().getChildren()) {
|
||||
if (param.getName().equals(newMetadatTable.getTableName())) {
|
||||
valueMap.put(ISAPConstant.CHANGING, param.isChanging());
|
||||
}
|
||||
}
|
||||
}
|
||||
valueMap.put(ISAPConstant.PARAMETER_TYPE, inputParameterType);
|
||||
|
||||
valueMap.put(ISAPConstant.CHANGING, ISAPConstant.PARAMETER_TYPE_CHANGING.equals(inputParameterType));
|
||||
|
||||
Map<String, String> properties = newMetadatTable.getAdditionalProperties();
|
||||
if (properties != null) {
|
||||
properties.put(ISINPUT, TRUE);
|
||||
@@ -197,37 +195,7 @@ public class RepositoryChangeMetadataForSAPBapi extends Command {
|
||||
}
|
||||
}
|
||||
|
||||
private String getInputParameterType(SAPFunctionUnit funcUnit, IMetadataTable newMetadatTable) {
|
||||
String parameterType = "";
|
||||
if (funcUnit != null && funcUnit.getParamData() != null && funcUnit.getParamData().getInputRoot() != null) {
|
||||
SAPFunctionParameter foundParam = null;
|
||||
String tableName = newMetadatTable.getTableName();
|
||||
for (SAPFunctionParameter param : funcUnit.getParamData().getInputRoot().getChildren()) {
|
||||
if (tableName.equals(param.getName())) {
|
||||
foundParam = param;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (foundParam != null) {
|
||||
if (foundParam.isChanging()) {
|
||||
parameterType = ISAPConstant.PARAMETER_TYPE_CHANGING;
|
||||
} else {
|
||||
if (ISAPConstant.PARAM_TABLE.equals(foundParam.getType())) {
|
||||
if (foundParam.isTableResideInTables()) {
|
||||
parameterType = ISAPConstant.PARAMETER_TYPE_TABLES;
|
||||
} else {
|
||||
parameterType = ISAPConstant.PARAMETER_TYPE_IMPORT;
|
||||
}
|
||||
} else {
|
||||
parameterType = ISAPConstant.PARAMETER_TYPE_IMPORT;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return parameterType;
|
||||
}
|
||||
|
||||
private String getType(IMetadataTable table, boolean isInput) {
|
||||
private String getParamType(IMetadataTable table, boolean isInput) {
|
||||
if (functionUnit == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -47,9 +47,7 @@ import org.talend.commons.utils.VersionUtils;
|
||||
import org.talend.core.CorePlugin;
|
||||
import org.talend.core.model.genhtml.FileCopyUtils;
|
||||
import org.talend.core.prefs.ITalendCorePrefConstants;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
import org.talend.core.ui.i18n.Messages;
|
||||
import org.talend.repository.model.IProxyRepositoryFactory;
|
||||
|
||||
public abstract class I18nPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
|
||||
|
||||
@@ -140,27 +138,19 @@ public abstract class I18nPreferencePage extends FieldEditorPreferencePage imple
|
||||
serbian = "Serbian"; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
String slovak = "Sloven\u010dina";//$NON-NLS-1$
|
||||
try {
|
||||
utf8Bytes = slovak.getBytes("UTF8");//$NON-NLS-1$
|
||||
slovak = new String(utf8Bytes, "UTF8");//$NON-NLS-1$
|
||||
} catch (UnsupportedEncodingException e2) {
|
||||
slovak = "Slovak";//$NON-NLS-1$
|
||||
}
|
||||
|
||||
String[][] entryNamesAndValues = { { Locale.ENGLISH.getDisplayLanguage(Locale.ENGLISH), Locale.ENGLISH.getLanguage() },
|
||||
{ Locale.FRENCH.getDisplayLanguage(Locale.FRENCH) + " (French)", Locale.FRENCH.getLanguage() }, //$NON-NLS-1$
|
||||
{ Locale.CHINESE.getDisplayLanguage(Locale.CHINESE) + " (Chinese)", "zh_CN" }, //$NON-NLS-1$ //$NON-NLS-2$
|
||||
{ Locale.GERMAN.getDisplayLanguage(Locale.GERMAN) + " (German)", Locale.GERMAN.getLanguage() }, //$NON-NLS-1$
|
||||
{ Locale.JAPANESE.getDisplayLanguage(Locale.JAPANESE) + " (Japanese)", Locale.JAPANESE.getLanguage() }, //$NON-NLS-1$
|
||||
{ Locale.ITALIAN.getDisplayLanguage(Locale.ITALIAN) + " (Italian)", Locale.ITALIAN.getLanguage() }, //$NON-NLS-1$
|
||||
{ "Brasil (Brazilian)", "pt_BR" }, //$NON-NLS-1$ //$NON-NLS-2$
|
||||
{ spanish + " (Spanish)", "es" }, { russian + " (Russion)", "ru" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
{ Locale.KOREA.getDisplayLanguage(Locale.KOREA) + " (Korean)", "kr" }, { "Turkish (Turkish)", "tr" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
{ greek + " (Greek)", "el" }, { "Hrvatski (Croatian)", "hr" }, { arabic + " (Arabic)", "ar" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ //$NON-NLS-6$
|
||||
{ serbian + " (Serbian)", "sr" }, { "Polski (Polish)", "pl" }, { "Romanian (Romanian)", "ro" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ //$NON-NLS-6$
|
||||
{ "Netherlands (Netherlands)", "nl" }, { slovak + " (Slovak)", "sk" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
{ "Current OS Language", Locale.getDefault().getLanguage() } };//$NON-NLS-1$
|
||||
String[][] entryNamesAndValues =
|
||||
{ { Locale.ENGLISH.getDisplayLanguage(Locale.ENGLISH), Locale.ENGLISH.getLanguage() },
|
||||
{ Locale.FRENCH.getDisplayLanguage(Locale.FRENCH), Locale.FRENCH.getLanguage() },
|
||||
{ Locale.CHINESE.getDisplayLanguage(Locale.CHINESE), "zh_CN" },
|
||||
{ Locale.GERMAN.getDisplayLanguage(Locale.GERMAN), Locale.GERMAN.getLanguage() },
|
||||
{ Locale.JAPANESE.getDisplayLanguage(Locale.JAPANESE), Locale.JAPANESE.getLanguage() },
|
||||
{ Locale.ITALIAN.getDisplayLanguage(Locale.ITALIAN), Locale.ITALIAN.getLanguage() },
|
||||
{ "Brasil", "pt_BR" }, //$NON-NLS-1$ //$NON-NLS-2$
|
||||
{ spanish, "es" }, { russian, "ru" }, //$NON-NLS-1$ //$NON-NLS-2$
|
||||
{ Locale.KOREA.getDisplayLanguage(Locale.KOREA), "kr" }, { "Turkish", "tr" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
{ greek, "el" }, { "Hrvatski", "hr" }, { arabic, "ar" }, { serbian, "sr" }, { "Polski", "pl" },
|
||||
{ "Romanian", "ro" }, { "Netherlands", "nl" } }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
// // /$NON-NLS-7$
|
||||
languageSelectionEditor = new OneLineComboFieldEditor(ITalendCorePrefConstants.LANGUAGE_SELECTOR,
|
||||
Messages.getString("I18nPreferencePage.needRestart"), entryNamesAndValues, getFieldEditorParent()); //$NON-NLS-1$
|
||||
addField(languageSelectionEditor);
|
||||
@@ -229,8 +219,6 @@ public abstract class I18nPreferencePage extends FieldEditorPreferencePage imple
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
handleUserReadOnlyStatus(composite);
|
||||
}
|
||||
|
||||
private void applyBabiliResource(String zipFileName) {
|
||||
@@ -661,27 +649,4 @@ public abstract class I18nPreferencePage extends FieldEditorPreferencePage imple
|
||||
fields.add(editor);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.preference.PreferencePage#contributeButtons(org.eclipse.swt.widgets.Composite)
|
||||
*/
|
||||
@Override
|
||||
protected void contributeButtons(Composite parent) {
|
||||
super.contributeButtons(parent);
|
||||
handleUserReadOnlyStatus(parent);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* When the user is read only for current project then setting composite is disable
|
||||
*
|
||||
* @param mainComposite
|
||||
*/
|
||||
public void handleUserReadOnlyStatus(Composite mainComposite) {
|
||||
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
|
||||
if (factory.isUserReadOnlyOnCurrentProject()) {
|
||||
mainComposite.setEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,5 @@
|
||||
package org.talend.core.ui.preference.metadata;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.jface.preference.BooleanFieldEditor;
|
||||
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
||||
import org.eclipse.jface.preference.IntegerFieldEditor;
|
||||
@@ -11,20 +7,13 @@ import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
import org.eclipse.ui.IWorkbench;
|
||||
import org.eclipse.ui.IWorkbenchPreferencePage;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.core.prefs.ITalendCorePrefConstants;
|
||||
import org.talend.core.ui.CoreUIPlugin;
|
||||
import org.talend.core.ui.i18n.Messages;
|
||||
import org.talend.core.ui.utils.PluginUtil;
|
||||
|
||||
public class MetadataPrecisionPage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
|
||||
|
||||
IntegerFieldEditor xmlColumnsLimit;
|
||||
|
||||
private static final String DISABLED_SCHEMES_KEY = "jdk.http.auth.tunneling.disabledSchemes";
|
||||
|
||||
public MetadataPrecisionPage() {
|
||||
setPreferenceStore(CoreUIPlugin.getDefault().getPreferenceStore());
|
||||
}
|
||||
@@ -41,9 +30,6 @@ public class MetadataPrecisionPage extends FieldEditorPreferencePage implements
|
||||
textControl.setToolTipText("Set the maximum number of schema table columns the xml metadata support. ");
|
||||
xmlColumnsLimit.setValidRange(1, Short.MAX_VALUE);
|
||||
addField(xmlColumnsLimit);
|
||||
|
||||
addField(new BooleanFieldEditor(ITalendCorePrefConstants.METADATA_PREFERENCE_PAGE_ENABLE_BASIC,
|
||||
Messages.getString("MetadataPreferencePage.EnableBasic.name"), getFieldEditorParent()));
|
||||
}
|
||||
|
||||
public void init(IWorkbench workbench) {
|
||||
@@ -53,29 +39,7 @@ public class MetadataPrecisionPage extends FieldEditorPreferencePage implements
|
||||
|
||||
public boolean performOk() {
|
||||
getPreferenceStore().setValue(ITalendCorePrefConstants.MAXIMUM_AMOUNT_OF_COLUMNS_FOR_XML, xmlColumnsLimit.getIntValue());
|
||||
boolean stored = getPreferenceStore().getBoolean(ITalendCorePrefConstants.METADATA_PREFERENCE_PAGE_ENABLE_BASIC);
|
||||
boolean ok = super.performOk();
|
||||
boolean checked = getPreferenceStore().getBoolean(ITalendCorePrefConstants.METADATA_PREFERENCE_PAGE_ENABLE_BASIC);
|
||||
if (stored != checked) {
|
||||
try {
|
||||
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
|
||||
boolean confirm = MessageDialog.openConfirm(window.getShell(), "Confirm", //$NON-NLS-1$
|
||||
Messages.getString("MetadataPreferencePage.MessageDialog.Restart")); //$NON-NLS-1$
|
||||
File configFile = PluginUtil.getStudioConfigFile();
|
||||
Properties configProperties = PluginUtil.readProperties(configFile);
|
||||
if (checked) {
|
||||
configProperties.setProperty(DISABLED_SCHEMES_KEY, "");
|
||||
} else {
|
||||
configProperties.remove(DISABLED_SCHEMES_KEY);
|
||||
}
|
||||
PluginUtil.saveProperties(configFile, configProperties, null);
|
||||
if (confirm) {
|
||||
PlatformUI.getWorkbench().restart();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
return super.performOk();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@ import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.prefs.ITalendCorePrefConstants;
|
||||
import org.talend.core.ui.CoreUIPlugin;
|
||||
import org.talend.core.ui.branding.IBrandingService;
|
||||
import org.talend.daikon.security.CryptoHelper;
|
||||
import org.talend.daikon.token.TokenGenerator;
|
||||
import org.talend.utils.security.StudioEncryption;
|
||||
|
||||
import us.monoid.json.JSONObject;
|
||||
|
||||
@@ -47,7 +47,7 @@ public class DefaultTokenCollector extends AbstractTokenCollector {
|
||||
}
|
||||
|
||||
public static String calcUniqueId() {
|
||||
return TokenGenerator.generateMachineToken((src) -> StudioEncryption.getStudioEncryption(StudioEncryption.EncryptionKeyName.SYSTEM).encrypt(src));
|
||||
return TokenGenerator.generateMachineToken(new CryptoHelper(CryptoHelper.PASSPHRASE));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -12,18 +12,11 @@
|
||||
// ============================================================================
|
||||
package org.talend.core.ui.utils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.eclipse.core.runtime.FileLocator;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.URIUtil;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.IWorkbenchPage;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
@@ -111,28 +104,4 @@ public class PluginUtil {
|
||||
}
|
||||
return part.getEditorSite().getId();
|
||||
}
|
||||
|
||||
public static File getStudioConfigFile() throws Exception {
|
||||
URL configLocation = new URL("platform:/config/config.ini"); //$NON-NLS-1$
|
||||
URL fileUrl = FileLocator.toFileURL(configLocation);
|
||||
return URIUtil.toFile(new URI(fileUrl.getProtocol(), fileUrl.getPath(), fileUrl.getQuery()));
|
||||
}
|
||||
|
||||
public static Properties readProperties(final File config) {
|
||||
final Properties configuration = new Properties();
|
||||
try (final InputStream stream = new FileInputStream(config)) {
|
||||
configuration.load(stream);
|
||||
} catch (final IOException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
return configuration;
|
||||
}
|
||||
|
||||
public static void saveProperties(final File config, Properties prop, String comment) {
|
||||
try (FileOutputStream oFile = new FileOutputStream(config)) {
|
||||
prop.store(oFile, comment);
|
||||
}catch(final IOException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,6 @@ import org.talend.core.model.metadata.QueryUtil;
|
||||
import org.talend.core.model.metadata.builder.ConvertionHelper;
|
||||
import org.talend.core.model.metadata.builder.connection.MetadataTable;
|
||||
import org.talend.core.model.process.ElementParameterParser;
|
||||
import org.talend.core.model.process.ProcessUtils;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.relationship.RelationshipItemBuilder;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
@@ -281,10 +280,9 @@ public class CoreService implements ICoreService {
|
||||
ICodeGeneratorService codeGenService = (ICodeGeneratorService) GlobalServiceRegister.getDefault().getService(
|
||||
ICodeGeneratorService.class);
|
||||
codeGenService.createRoutineSynchronizer().syncAllRoutinesForLogOn();
|
||||
if (ProcessUtils.isRequiredPigUDFs(null)) {
|
||||
codeGenService.createRoutineSynchronizer().syncAllPigudfForLogOn();
|
||||
}
|
||||
codeGenService.createRoutineSynchronizer().syncAllPigudfForLogOn();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.io.BufferedReader;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.exception.WarningException;
|
||||
|
||||
/**
|
||||
* cli class global comment. Detailled comment
|
||||
@@ -104,31 +104,26 @@ public final class ProcessStreamTrashReaderUtil {
|
||||
|
||||
public static void readAndForget(final Process process) {
|
||||
try {
|
||||
final String encoding = "UTF-8";
|
||||
// input stream thread
|
||||
new Thread() {
|
||||
|
||||
public void run() {
|
||||
InputStream is = process.getInputStream();
|
||||
InputStreamReader din = new InputStreamReader(is);
|
||||
BufferedReader reader = new BufferedReader(din);
|
||||
try {
|
||||
InputStream is = process.getInputStream();
|
||||
InputStreamReader din = new InputStreamReader(is, encoding);
|
||||
BufferedReader reader = new BufferedReader(din);
|
||||
String line = null;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
System.out.println("getInputStream " + line); //$NON-NLS-1$
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
// nothing to do
|
||||
} finally {
|
||||
try {
|
||||
String line = null;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
System.out.println("getInputStream " + line); //$NON-NLS-1$
|
||||
}
|
||||
is.close();
|
||||
} catch (Exception ex) {
|
||||
// nothing to do
|
||||
} finally {
|
||||
try {
|
||||
is.close();
|
||||
} catch (Exception ex) {
|
||||
// nothing to do
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
@@ -137,31 +132,23 @@ public final class ProcessStreamTrashReaderUtil {
|
||||
new Thread() {
|
||||
|
||||
public void run() {
|
||||
InputStream is = process.getErrorStream();
|
||||
InputStreamReader din = new InputStreamReader(is);
|
||||
BufferedReader reader = new BufferedReader(din);
|
||||
try {
|
||||
InputStream is = process.getErrorStream();
|
||||
InputStreamReader din = new InputStreamReader(is, encoding);
|
||||
BufferedReader reader = new BufferedReader(din);
|
||||
StringBuilder strBuilder = new StringBuilder();
|
||||
String line = null;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
System.out.println("getErrorStream " + line); //$NON-NLS-1$
|
||||
throw new WarningException("AAAAA");
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
// nothing to do
|
||||
} finally {
|
||||
try {
|
||||
String line = null;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
System.out.println("getErrorStream " + line); //$NON-NLS-1$
|
||||
strBuilder.append(line).append("\n");
|
||||
}
|
||||
is.close();
|
||||
} catch (Exception ex) {
|
||||
// nothing to do
|
||||
} finally {
|
||||
try {
|
||||
is.close();
|
||||
} catch (Exception ex) {
|
||||
// nothing to do
|
||||
}
|
||||
}
|
||||
if (!strBuilder.toString().replaceAll("[\n]", " ").trim().isEmpty()) {
|
||||
throw new Exception(strBuilder.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
|
||||
@@ -15,10 +15,7 @@ package org.talend.core.services;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.emf.common.util.URI;
|
||||
import org.osgi.service.prefs.BackingStoreException;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
@@ -57,9 +54,6 @@ public interface ICoreTisService extends IService {
|
||||
|
||||
public void downLoadAndInstallUpdates(String userName, String password, String adminUrl) throws Exception;
|
||||
|
||||
public void downLoadAndInstallUpdates(IProgressMonitor monitor, String userName, String password, String adminUrl)
|
||||
throws Exception;
|
||||
|
||||
public boolean isLicenseExpired();
|
||||
|
||||
public boolean isTheSameType(String userName, String password, String adminUrl);
|
||||
@@ -72,10 +66,4 @@ public interface ICoreTisService extends IService {
|
||||
|
||||
public void updateConfiguratorBundles(File configFile, File tempConfigFile) throws IOException;
|
||||
|
||||
Map<String, String> getExtraBundleInfo4Patch(File featureIndexFile) throws IOException;
|
||||
|
||||
Map<String, String> getDropBundleInfo() throws IOException;
|
||||
|
||||
Set<String> getComponentBlackList();
|
||||
|
||||
}
|
||||
|
||||
@@ -64,8 +64,6 @@ import org.talend.core.language.LanguageManager;
|
||||
import org.talend.core.model.components.ComponentCategory;
|
||||
import org.talend.core.model.components.EComponentType;
|
||||
import org.talend.core.model.components.IComponent;
|
||||
import org.talend.core.model.components.IComponentsFactory;
|
||||
import org.talend.core.model.components.IComponentsService;
|
||||
import org.talend.core.model.general.ModuleNeeded;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.metadata.IMetadataColumn;
|
||||
@@ -83,7 +81,6 @@ import org.talend.core.model.process.JobInfo;
|
||||
import org.talend.core.model.process.ProcessUtils;
|
||||
import org.talend.core.model.process.ReplaceNodesInProcessProvider;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.JobletProcessItem;
|
||||
import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.relationship.Relation;
|
||||
@@ -261,7 +258,6 @@ public class ProcessorUtilities {
|
||||
exportConfig = false;
|
||||
exportAsOSGI = false;
|
||||
exportTimeStamp = null;
|
||||
exportJobAsMicroService = false;
|
||||
}
|
||||
|
||||
public static String getInterpreter() {
|
||||
@@ -617,55 +613,28 @@ public class ProcessorUtilities {
|
||||
return processor;
|
||||
}
|
||||
|
||||
public static boolean checkLoopDependencies(Relation mainJobInfo, Map<String, String> idToLastestVersionMap)
|
||||
private static boolean checkLoopDependencies(Relation mainJobInfo, Map<String, String> idToLastestVersionMap)
|
||||
throws ProcessorException {
|
||||
List<Relation> itemsJobRelatedTo = getItemsRelation(mainJobInfo, idToLastestVersionMap);
|
||||
List<Relation> relationChecked = new ArrayList<>();
|
||||
relationChecked.add(mainJobInfo);
|
||||
return checkLoopDependencies(mainJobInfo, mainJobInfo, itemsJobRelatedTo, relationChecked, idToLastestVersionMap);
|
||||
return checkLoopDependencies(mainJobInfo, itemsJobRelatedTo, relationChecked, idToLastestVersionMap);
|
||||
}
|
||||
|
||||
private static boolean checkLoopDependencies(Relation mainRelation, Relation currentRelation,
|
||||
List<Relation> itemsJobRelatedTo,
|
||||
private static boolean checkLoopDependencies(Relation mainRelation, List<Relation> itemsJobRelatedTo,
|
||||
List<Relation> relationChecked, Map<String, String> idToLastestVersionMap) throws ProcessorException {
|
||||
boolean hasDependency = false;
|
||||
for (Relation relation : itemsJobRelatedTo) {
|
||||
try {
|
||||
// means the tRunjob deactivate, or one of the specific version tRunjon deactivate, skip
|
||||
Map<String, Set<String>> actTrunjobHM = getActivateTRunjobMap(currentRelation.getId(),
|
||||
currentRelation.getVersion());
|
||||
if (actTrunjobHM.get(relation.getId()) == null
|
||||
|| !actTrunjobHM.get(relation.getId()).contains(relation.getVersion())) {
|
||||
continue;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new ProcessorException(e);
|
||||
}
|
||||
|
||||
hasDependency = relation.getId().equals(mainRelation.getId())
|
||||
&& relation.getVersion().equals(mainRelation.getVersion());
|
||||
if (!hasDependency) {
|
||||
List<Relation> itemsChildJob = getItemsRelation(relation, idToLastestVersionMap);
|
||||
if (!relationChecked.contains(relation)) {
|
||||
relationChecked.add(relation);
|
||||
hasDependency = checkLoopDependencies(mainRelation, relation, itemsChildJob, relationChecked,
|
||||
idToLastestVersionMap);
|
||||
hasDependency = checkLoopDependencies(mainRelation, itemsChildJob, relationChecked, idToLastestVersionMap);
|
||||
}
|
||||
if (!hasDependency) {
|
||||
for (Relation childRelation : itemsChildJob) {
|
||||
|
||||
try {
|
||||
// means the tRunjob deactivate, or one of the specific version tRunjon deactivate, skip
|
||||
Map<String, Set<String>> activateTRunjobMap = getActivateTRunjobMap(relation.getId(),
|
||||
relation.getVersion());
|
||||
if (activateTRunjobMap.get(childRelation.getId()) == null
|
||||
|| !activateTRunjobMap.get(childRelation.getId()).contains(childRelation.getVersion())) {
|
||||
continue;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new ProcessorException(e);
|
||||
}
|
||||
|
||||
hasDependency = checkLoopDependencies(childRelation, idToLastestVersionMap);
|
||||
if (hasDependency) {
|
||||
break;
|
||||
@@ -681,133 +650,6 @@ public class ProcessorUtilities {
|
||||
return hasDependency;
|
||||
}
|
||||
|
||||
private static Map<String, Set<String>> getActivateTRunjobMap(String id, String version) throws PersistenceException {
|
||||
Map<String, Set<String>> actTrunjobHM = new HashMap<String, Set<String>>();
|
||||
ProcessType processType = null;
|
||||
try {
|
||||
IRepositoryViewObject currentJobObject = ProxyRepositoryFactory.getInstance().getSpecificVersion(id, version, true);
|
||||
if (currentJobObject != null) {
|
||||
Item item = currentJobObject.getProperty().getItem();
|
||||
if (item instanceof ProcessItem) {
|
||||
processType = ((ProcessItem) item).getProcess();
|
||||
} else if (item instanceof JobletProcessItem) {
|
||||
processType = ((JobletProcessItem) item).getJobletProcess();
|
||||
}
|
||||
}
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
if (processType != null) {
|
||||
List<Project> allProjects = new ArrayList<Project>();
|
||||
allProjects.add(ProjectManager.getInstance().getCurrentProject());
|
||||
allProjects.addAll(ProjectManager.getInstance().getAllReferencedProjects());
|
||||
|
||||
List<String> jobletsComponentsList = new ArrayList<String>();
|
||||
IComponentsFactory componentsFactory = null;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IComponentsService.class)) {
|
||||
IComponentsService compService = (IComponentsService) GlobalServiceRegister.getDefault()
|
||||
.getService(IComponentsService.class);
|
||||
if (compService != null) {
|
||||
componentsFactory = compService.getComponentsFactory();
|
||||
for (IComponent component : componentsFactory.readComponents()) {
|
||||
if (component.getComponentType() == EComponentType.JOBLET) {
|
||||
jobletsComponentsList.add(component.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String jobletPaletteType = null;
|
||||
String frameWork = processType.getFramework();
|
||||
if (StringUtils.isBlank(frameWork)) {
|
||||
jobletPaletteType = ComponentCategory.CATEGORY_4_DI.getName();
|
||||
} else if (frameWork.equals(HadoopConstants.FRAMEWORK_SPARK)) {
|
||||
jobletPaletteType = ComponentCategory.CATEGORY_4_SPARK.getName();
|
||||
} else if (frameWork.equals(HadoopConstants.FRAMEWORK_SPARK_STREAMING)) {
|
||||
jobletPaletteType = ComponentCategory.CATEGORY_4_SPARKSTREAMING.getName();
|
||||
}
|
||||
|
||||
for (Object nodeObject : processType.getNode()) {
|
||||
NodeType node = (NodeType) nodeObject;
|
||||
// not tRunjob && not joblet then continue
|
||||
if (!node.getComponentName().equals("tRunJob") && !jobletsComponentsList.contains(node.getComponentName())) { // $NON-NLS-1$
|
||||
continue;
|
||||
}
|
||||
boolean nodeActivate = true;
|
||||
String processIds = null;
|
||||
String processVersion = null;
|
||||
for (Object elementParam : node.getElementParameter()) {
|
||||
ElementParameterType elemParamType = (ElementParameterType) elementParam;
|
||||
if ("PROCESS:PROCESS_TYPE_PROCESS".equals(elemParamType.getName())) { // $NON-NLS-1$
|
||||
processIds = elemParamType.getValue();
|
||||
if (StringUtils.isNotBlank(processIds)) {
|
||||
for (String jobId : processIds.split(ProcessorUtilities.COMMA)) {
|
||||
if (actTrunjobHM.get(jobId) == null) {
|
||||
actTrunjobHM.put(jobId, new HashSet<String>());
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if ("PROCESS:PROCESS_TYPE_VERSION".equals(elemParamType.getName()) // $NON-NLS-1$
|
||||
|| "PROCESS_TYPE_VERSION".equals(elemParamType.getName())) { // $NON-NLS-1$
|
||||
processVersion = elemParamType.getValue();
|
||||
} else if ("ACTIVATE".equals(elemParamType.getName())) { // $NON-NLS-1$
|
||||
nodeActivate = Boolean.parseBoolean(elemParamType.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
if (nodeActivate) {
|
||||
if (StringUtils.isNotBlank(processIds)) {
|
||||
for (String jobId : processIds.split(ProcessorUtilities.COMMA)) {
|
||||
String actualVersion = processVersion;
|
||||
if (RelationshipItemBuilder.LATEST_VERSION.equals(processVersion)) {
|
||||
for (Project project : allProjects) {
|
||||
IRepositoryViewObject lastVersion = null;
|
||||
lastVersion = ProxyRepositoryFactory.getInstance().getLastVersion(project, jobId);
|
||||
if (lastVersion != null) {
|
||||
actualVersion = lastVersion.getVersion();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (actTrunjobHM.get(jobId) != null) {
|
||||
actTrunjobHM.get(jobId).add(actualVersion);
|
||||
}
|
||||
|
||||
}
|
||||
} else if (componentsFactory != null && jobletPaletteType != null) {
|
||||
// for joblet
|
||||
IComponent cc = componentsFactory.get(node.getComponentName(), jobletPaletteType);
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IJobletProviderService.class)) {
|
||||
IJobletProviderService jobletService = (IJobletProviderService) GlobalServiceRegister.getDefault()
|
||||
.getService(IJobletProviderService.class);
|
||||
Property property = jobletService.getJobletComponentItem(cc);
|
||||
if (property != null && StringUtils.isNotBlank(property.getId())) {
|
||||
String jobletId = property.getId();
|
||||
if (actTrunjobHM.get(jobletId) == null) {
|
||||
actTrunjobHM.put(jobletId, new HashSet<String>());
|
||||
}
|
||||
String actualVersion = processVersion;
|
||||
if (RelationshipItemBuilder.LATEST_VERSION.equals(processVersion)) {
|
||||
for (Project project : allProjects) {
|
||||
IRepositoryViewObject lastVersion = null;
|
||||
lastVersion = ProxyRepositoryFactory.getInstance().getLastVersion(project, jobletId);
|
||||
if (lastVersion != null) {
|
||||
actualVersion = lastVersion.getVersion();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
actTrunjobHM.get(jobletId).add(actualVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return actTrunjobHM;
|
||||
}
|
||||
|
||||
private static List<Relation> getItemsRelation(Relation mainJobInfo, Map<String, String> idToLastestVersionMap) throws ProcessorException {
|
||||
List<Relation> itemsJobRelatedTo = new ArrayList<Relation>();
|
||||
try {
|
||||
@@ -914,7 +756,7 @@ public class ProcessorUtilities {
|
||||
|
||||
public static boolean hasMetadataDynamic(IProcess currentProcess, JobInfo jobInfo) {
|
||||
boolean hasDynamicMetadata = false;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerCoreService.class) && !isExportConfig()) {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerCoreService.class)) {
|
||||
IDesignerCoreService designerCoreService =
|
||||
(IDesignerCoreService) GlobalServiceRegister.getDefault().getService(IDesignerCoreService.class);
|
||||
for (INode node : currentProcess.getGraphicalNodes()) {
|
||||
@@ -1231,11 +1073,9 @@ public class ProcessorUtilities {
|
||||
JobInfo parentJob = jobInfo.getFatherJobInfo();
|
||||
if (parentJob != null && (parentJob.getProcessor() != null)) {
|
||||
for (JobInfo subJob : parentJob.getProcessor().getBuildChildrenJobs()) {
|
||||
|
||||
if (ProcessUtils.isSameProperty(subJob.getJobId(), jobInfo.getJobId(), false)) {
|
||||
subJob.setProcessor(processor);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (!timerStarted) {
|
||||
@@ -1389,23 +1229,14 @@ public class ProcessorUtilities {
|
||||
public static void cleanSourceFolder(IProgressMonitor progressMonitor, IProcess currentProcess,
|
||||
IProcessor processor) {
|
||||
try {
|
||||
ITalendProcessJavaProject jobProject = processor.getTalendJavaProject();
|
||||
// clean up source code
|
||||
IPath codePath = processor.getSrcCodePath().removeLastSegments(2);
|
||||
IFolder srcFolder = jobProject.getProject().getFolder(codePath);
|
||||
IFolder srcFolder = processor.getTalendJavaProject().getProject().getFolder(codePath);
|
||||
String jobPackageFolder = JavaResourcesHelper.getJobClassPackageFolder(currentProcess);
|
||||
for (IResource resource : srcFolder.members()) {
|
||||
if (!resource.getProjectRelativePath().toPortableString().endsWith(jobPackageFolder)) {
|
||||
resource.delete(true, progressMonitor);
|
||||
}
|
||||
}
|
||||
// clean up resources folder if needed
|
||||
if (ProcessorUtilities.isExportConfig() && !designerCoreService.isNeedContextInJar(currentProcess)) {
|
||||
for (IResource resource : jobProject.getResourcesFolder().members()) {
|
||||
if (resource.exists()) {
|
||||
resource.delete(true, progressMonitor);
|
||||
}
|
||||
if (resource.getProjectRelativePath().toPortableString().endsWith(jobPackageFolder)) {
|
||||
break;
|
||||
}
|
||||
resource.delete(true, progressMonitor);
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
ExceptionHandler.process(e);
|
||||
@@ -2195,15 +2026,7 @@ public class ProcessorUtilities {
|
||||
public static String[] getCommandLine(String targetPlatform, boolean skipClasspathJar, boolean externalUse,
|
||||
String processId, String contextName, int statisticPort, int tracePort, String... codeOptions)
|
||||
throws ProcessorException {
|
||||
return getCommandLine(targetPlatform, skipClasspathJar, externalUse,
|
||||
processId, contextName, statisticPort, tracePort, false, codeOptions);
|
||||
}
|
||||
|
||||
//ignoreCustomJVMSetting mean will generate the java command without the job VM setting in studio "Run job" setting and studio preferences "Run/Debug" setting
|
||||
//only use for TDI-42443 in tRunJob
|
||||
public static String[] getCommandLine(String targetPlatform, boolean skipClasspathJar, boolean externalUse,
|
||||
String processId, String contextName, int statisticPort, int tracePort, boolean ignoreCustomJVMSetting, String... codeOptions)
|
||||
throws ProcessorException {
|
||||
IProcessor processor = findProcessorFromJobList(processId, contextName, null);
|
||||
if (processor != null && targetPlatform.equals(processor.getTargetPlatform())) {
|
||||
if (processor.isProcessUnloaded()) {
|
||||
@@ -2212,7 +2035,7 @@ public class ProcessorUtilities {
|
||||
boolean oldSkipClasspathJar = processor.isSkipClasspathJar();
|
||||
processor.setSkipClasspathJar(skipClasspathJar);
|
||||
try {
|
||||
return processor.getCommandLine(true, externalUse, statisticPort, tracePort, ignoreCustomJVMSetting, codeOptions);
|
||||
return processor.getCommandLine(true, externalUse, statisticPort, tracePort, codeOptions);
|
||||
} finally {
|
||||
processor.setSkipClasspathJar(oldSkipClasspathJar);
|
||||
}
|
||||
@@ -2230,7 +2053,7 @@ public class ProcessorUtilities {
|
||||
}
|
||||
// because all jobs are based one new way, set the flag "oldBuildJob" to false.
|
||||
return getCommandLine(false, skipClasspathJar, targetPlatform, externalUse, process,
|
||||
selectedProcessItem.getProperty(), contextName, true, statisticPort, tracePort, ignoreCustomJVMSetting, codeOptions);
|
||||
selectedProcessItem.getProperty(), contextName, true, statisticPort, tracePort, codeOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2304,14 +2127,6 @@ public class ProcessorUtilities {
|
||||
public static String[] getCommandLine(boolean oldBuildJob, boolean skipClasspathJar, String targetPlatform,
|
||||
boolean externalUse, IProcess currentProcess, Property property, String contextName, boolean needContext,
|
||||
int statisticPort, int tracePort, String... codeOptions) throws ProcessorException {
|
||||
return getCommandLine(oldBuildJob, skipClasspathJar, targetPlatform,
|
||||
externalUse, currentProcess, property, contextName, needContext,
|
||||
statisticPort, tracePort, false, codeOptions);
|
||||
}
|
||||
|
||||
private static String[] getCommandLine(boolean oldBuildJob, boolean skipClasspathJar, String targetPlatform,
|
||||
boolean externalUse, IProcess currentProcess, Property property, String contextName, boolean needContext,
|
||||
int statisticPort, int tracePort, boolean ignoreCustomJVMSetting, String... codeOptions) throws ProcessorException {
|
||||
if (currentProcess == null) {
|
||||
return new String[] {};
|
||||
}
|
||||
@@ -2324,7 +2139,7 @@ public class ProcessorUtilities {
|
||||
processor.setSkipClasspathJar(skipClasspathJar);
|
||||
processor.setTargetPlatform(targetPlatform);
|
||||
processor.setOldBuildJob(oldBuildJob);
|
||||
return processor.getCommandLine(needContext, externalUse, statisticPort, tracePort, ignoreCustomJVMSetting, codeOptions);
|
||||
return processor.getCommandLine(needContext, externalUse, statisticPort, tracePort, codeOptions);
|
||||
}
|
||||
|
||||
public static String[] getCommandLine(boolean oldBuildJob, String targetPlatform, boolean externalUse,
|
||||
@@ -2773,44 +2588,15 @@ public class ProcessorUtilities {
|
||||
return doSupportDynamicHadoopConfLoading(property) && !isExportAsOSGI();
|
||||
}
|
||||
|
||||
public static boolean isEsbJob(IProcess process) {
|
||||
return isEsbJob(process, false);
|
||||
}
|
||||
|
||||
public static boolean isEsbJob(IProcess process, boolean checkCurrentProcess) {
|
||||
|
||||
if (process instanceof IProcess2) {
|
||||
|
||||
if (checkCurrentProcess) {
|
||||
for (INode n : process.getGraphicalNodes()) {
|
||||
if (isEsbComponentName(n.getComponent().getName())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Set<JobInfo> infos = ProcessorUtilities.getChildrenJobInfo(((IProcess2) process).getProperty().getItem(), false);
|
||||
|
||||
for (JobInfo jobInfo : infos) {
|
||||
ProcessType processType = jobInfo.getProcessItem().getProcess();
|
||||
EList<NodeType> nodes = processType.getNode();
|
||||
for (NodeType nodeType : nodes) {
|
||||
if (isEsbComponentName(nodeType.getComponentName())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
public static boolean isEsbJob(String processId, String version) {
|
||||
return esbJobs.contains(esbJobKey(processId, version));
|
||||
}
|
||||
|
||||
private static void addEsbJob(JobInfo jobInfo) {
|
||||
if (esbJobs.contains(esbJobKey(jobInfo.getJobId(), jobInfo.getJobVersion()))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
esbJobs.add(esbJobKey(jobInfo.getJobId(), jobInfo.getJobVersion()));
|
||||
if (jobInfo.getFatherJobInfo() != null) {
|
||||
addEsbJob(jobInfo.getFatherJobInfo());
|
||||
@@ -2842,4 +2628,5 @@ public class ProcessorUtilities {
|
||||
public static boolean isNeedProjectProcessId(String componentName) {
|
||||
return "tRunJob".equalsIgnoreCase(componentName) || "cTalendJob".equalsIgnoreCase(componentName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -277,9 +277,6 @@ public class ATreeNode {
|
||||
* @throws OdaException
|
||||
*/
|
||||
public void setDataType(String type) throws OdaException {
|
||||
if (type == null) {
|
||||
type = "";
|
||||
}
|
||||
originalDataType = new String(type);
|
||||
this.dataType = getDataType(type);
|
||||
}
|
||||
|
||||
@@ -43,10 +43,8 @@ import org.eclipse.xsd.XSDImport;
|
||||
import org.eclipse.xsd.XSDModelGroup;
|
||||
import org.eclipse.xsd.XSDParticle;
|
||||
import org.eclipse.xsd.XSDSchema;
|
||||
import org.eclipse.xsd.XSDSimpleTypeDefinition;
|
||||
import org.eclipse.xsd.XSDTerm;
|
||||
import org.eclipse.xsd.XSDTypeDefinition;
|
||||
import org.eclipse.xsd.XSDVariety;
|
||||
import org.eclipse.xsd.impl.XSDNamedComponentImpl;
|
||||
import org.eclipse.xsd.util.XSDConstants;
|
||||
import org.eclipse.xsd.util.XSDResourceImpl;
|
||||
@@ -357,15 +355,12 @@ public class XSDPopulationUtil2 implements IXSDPopulationUtil {
|
||||
}
|
||||
}
|
||||
if (!resolvedAsComplex) {
|
||||
XSDTypeDefinition typeDefinition = xsdElementDeclarationParticle.getTypeDefinition();
|
||||
String dataType = typeDefinition.getQName();
|
||||
String dataType = xsdElementDeclarationParticle.getTypeDefinition().getQName();
|
||||
if (!XSDConstants
|
||||
.isSchemaForSchemaNamespace(typeDefinition.getTargetNamespace())
|
||||
&& typeDefinition.getBaseType() != null) {
|
||||
if (!"xs:anySimpleType".equals(typeDefinition.getBaseType().getQName())) {
|
||||
dataType = typeDefinition.getBaseType().getQName();
|
||||
} else if (typeDefinition instanceof XSDSimpleTypeDefinition) {
|
||||
dataType = getVarietyType(((XSDSimpleTypeDefinition) typeDefinition).getVariety());
|
||||
.isSchemaForSchemaNamespace(xsdElementDeclarationParticle.getTypeDefinition().getTargetNamespace())
|
||||
&& xsdElementDeclarationParticle.getTypeDefinition().getBaseType() != null) {
|
||||
if (!"xs:anySimpleType".equals(xsdElementDeclarationParticle.getTypeDefinition().getBaseType().getQName())) {
|
||||
dataType = xsdElementDeclarationParticle.getTypeDefinition().getBaseType().getQName();
|
||||
}
|
||||
}
|
||||
partNode.setDataType(dataType);
|
||||
@@ -383,16 +378,6 @@ public class XSDPopulationUtil2 implements IXSDPopulationUtil {
|
||||
}
|
||||
}
|
||||
|
||||
private String getVarietyType(XSDVariety variety) {
|
||||
String dataType = "xs:anyType";
|
||||
if (XSDVariety.LIST_LITERAL.equals(variety)) {
|
||||
dataType = "xs:list";
|
||||
} else if (XSDVariety.UNION_LITERAL.equals(variety)) {
|
||||
dataType = "xs:union";
|
||||
}
|
||||
return dataType;
|
||||
}
|
||||
|
||||
private void handleOptionalAttribute(ATreeNode node, XSDParticle xsdParticle) {
|
||||
if (node == null || xsdParticle == null || xsdParticle.getElement() == null) {
|
||||
return;
|
||||
@@ -500,17 +485,6 @@ public class XSDPopulationUtil2 implements IXSDPopulationUtil {
|
||||
}
|
||||
if (xsdTypeDefinition instanceof XSDComplexTypeDefinition) {
|
||||
addComplexTypeDetails(xsdSchema, node, xsdTypeDefinition, prefix, namespace, "/" + elementName + "/");
|
||||
} else if (xsdTypeDefinition instanceof XSDSimpleTypeDefinition) {
|
||||
String dataType = xsdTypeDefinition.getQName();
|
||||
if (!XSDConstants.isSchemaForSchemaNamespace(xsdTypeDefinition.getTargetNamespace())
|
||||
&& xsdTypeDefinition.getBaseType() != null) {
|
||||
if (!"xs:anySimpleType".equals(xsdTypeDefinition.getBaseType().getQName())) {
|
||||
dataType = xsdTypeDefinition.getBaseType().getQName();
|
||||
} else if (xsdTypeDefinition instanceof XSDSimpleTypeDefinition) {
|
||||
dataType = getVarietyType(((XSDSimpleTypeDefinition) xsdTypeDefinition).getVariety());
|
||||
}
|
||||
}
|
||||
node.setDataType(dataType);
|
||||
}
|
||||
List<String> namespaceList = new ArrayList(namespaceToPrefix.keySet());
|
||||
Collections.reverse(namespaceList);
|
||||
@@ -591,11 +565,7 @@ public class XSDPopulationUtil2 implements IXSDPopulationUtil {
|
||||
particleToTreeNode.clear();
|
||||
}
|
||||
|
||||
if (rootNodes.isEmpty()) {
|
||||
return null;
|
||||
} else {
|
||||
return rootNodes.get(0);
|
||||
}
|
||||
return rootNodes.get(0);
|
||||
}
|
||||
|
||||
private void addSubstitutionDetails(XSDSchema xsdSchema, ATreeNode parentNode, XSDElementDeclaration elementDeclaration,
|
||||
@@ -790,14 +760,11 @@ public class XSDPopulationUtil2 implements IXSDPopulationUtil {
|
||||
ATreeNode childNode = new ATreeNode();
|
||||
childNode.setValue(attributeDeclarationName);
|
||||
childNode.setType(ATreeNode.ATTRIBUTE_TYPE);
|
||||
XSDSimpleTypeDefinition typeDefinition = xsdAttributeDeclaration.getTypeDefinition();
|
||||
String dataType = typeDefinition.getQName();
|
||||
XSDTypeDefinition baseType = typeDefinition.getBaseType();
|
||||
if (!XSDConstants.isSchemaForSchemaNamespace(typeDefinition.getTargetNamespace())) {
|
||||
String dataType = xsdAttributeDeclaration.getTypeDefinition().getQName();
|
||||
XSDTypeDefinition baseType = xsdAttributeDeclaration.getTypeDefinition().getBaseType();
|
||||
if (!XSDConstants.isSchemaForSchemaNamespace(xsdAttributeDeclaration.getTypeDefinition().getTargetNamespace())) {
|
||||
if (baseType != null && !"xs:anySimpleType".equals(baseType.getQName())) { //$NON-NLS-1$
|
||||
dataType = baseType.getQName();
|
||||
} else if (typeDefinition instanceof XSDSimpleTypeDefinition) {
|
||||
dataType = getVarietyType(((XSDSimpleTypeDefinition) typeDefinition).getVariety());
|
||||
}
|
||||
}
|
||||
if (dataType != null && dataType.length() > 0) {
|
||||
|
||||
@@ -1,34 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry exported="true" kind="lib" path="lib/wagon-http-lightweight.jar" sourcepath="D:/.m2/repository/org/apache/maven/wagon/wagon-http-lightweight/3.0.0/wagon-http-lightweight-3.0.0-sources.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-transport-file.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-transport-http.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/wagon-file.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jsoup.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/wagon-http-shared.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/wagon-http.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/commons-codec.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/httpclient.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/httpcore.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jcl-over-slf4j.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-api.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-connector-basic.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-impl.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-spi.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-transport-classpath.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-transport-wagon.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-util.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/plexus-utils.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/slf4j-api.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/wagon-provider-api.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-aether-provider-3.2.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-model-3.2.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-model-builder-3.2.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-repository-metadata-3.2.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/plexus-interpolation-1.19.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/plexus-utils-3.0.17.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry exported="true" kind="lib" path="lib/commons-codec.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/httpclient.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/httpcore.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jcl-over-slf4j.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-api.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-connector-basic.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-impl.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-spi.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-transport-classpath.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-transport-file.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-transport-http.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-transport-wagon.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-util.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/plexus-utils.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/slf4j-api.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/wagon-provider-api.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-aether-provider-3.2.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-model-3.2.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-model-builder-3.2.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-repository-metadata-3.2.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/plexus-interpolation-1.19.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/plexus-utils-3.0.17.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
||||
@@ -26,18 +26,13 @@ Bundle-ClassPath: .,
|
||||
lib/maven-resolver-impl.jar,
|
||||
lib/maven-resolver-spi.jar,
|
||||
lib/maven-resolver-transport-classpath.jar,
|
||||
lib/maven-resolver-transport-file.jar,
|
||||
lib/maven-resolver-transport-http.jar,
|
||||
lib/maven-resolver-transport-wagon.jar,
|
||||
lib/maven-resolver-util.jar,
|
||||
lib/plexus-utils.jar,
|
||||
lib/slf4j-api.jar,
|
||||
lib/wagon-provider-api.jar,
|
||||
lib/jsoup.jar,
|
||||
lib/wagon-http-shared.jar,
|
||||
lib/wagon-http.jar,
|
||||
lib/wagon-file.jar,
|
||||
lib/maven-resolver-transport-file.jar,
|
||||
lib/maven-resolver-transport-http.jar,
|
||||
lib/wagon-http-lightweight.jar
|
||||
lib/wagon-provider-api.jar
|
||||
Export-Package: org.talend.designer.maven.aether,
|
||||
org.talend.designer.maven.aether.comparator,
|
||||
org.talend.designer.maven.aether.node,
|
||||
|
||||
@@ -2,11 +2,4 @@ source.. = src/main/java/
|
||||
output.. = target/classes/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
lib/,\
|
||||
lib/jsoup.jar,\
|
||||
lib/wagon-http-shared.jar,\
|
||||
lib/wagon-http.jar,\
|
||||
lib/wagon-file.jar,\
|
||||
lib/maven-resolver-transport-file.jar,\
|
||||
lib/maven-resolver-transport-http.jar,\
|
||||
lib/wagon-http-lightweight.jar
|
||||
lib/
|
||||
|
||||
Binary file not shown.
@@ -11,7 +11,6 @@
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
<properties>
|
||||
<maven.resolver.version>1.3.1</maven.resolver.version>
|
||||
<wagon.version>3.0.0</wagon.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
@@ -46,25 +45,10 @@
|
||||
<version>${maven.resolver.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-file</artifactId>
|
||||
<version>${wagon.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-http</artifactId>
|
||||
<version>${wagon.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-http-lightweight</artifactId>
|
||||
<version>${wagon.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.resolver</groupId>
|
||||
<groupId>org.apache.maven.resolver</groupId>
|
||||
<artifactId>maven-resolver-transport-file</artifactId>
|
||||
<version>${maven.resolver.version}</version>
|
||||
</dependency>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.resolver</groupId>
|
||||
<artifactId>maven-resolver-transport-http</artifactId>
|
||||
|
||||
@@ -17,21 +17,24 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.maven.repository.internal.MavenRepositorySystemUtils;
|
||||
import org.codehaus.plexus.PlexusContainerException;
|
||||
import org.eclipse.aether.DefaultRepositorySystemSession;
|
||||
import org.eclipse.aether.RepositorySystem;
|
||||
import org.eclipse.aether.artifact.Artifact;
|
||||
import org.eclipse.aether.artifact.DefaultArtifact;
|
||||
import org.eclipse.aether.connector.basic.BasicRepositoryConnectorFactory;
|
||||
import org.eclipse.aether.deployment.DeployRequest;
|
||||
import org.eclipse.aether.impl.DefaultServiceLocator;
|
||||
import org.eclipse.aether.repository.Authentication;
|
||||
import org.eclipse.aether.repository.LocalRepository;
|
||||
import org.eclipse.aether.repository.RemoteRepository;
|
||||
import org.eclipse.aether.spi.connector.RepositoryConnectorFactory;
|
||||
import org.eclipse.aether.spi.connector.transport.TransporterFactory;
|
||||
import org.eclipse.aether.transport.file.FileTransporterFactory;
|
||||
import org.eclipse.aether.transport.http.HttpTransporterFactory;
|
||||
import org.eclipse.aether.util.artifact.SubArtifact;
|
||||
import org.eclipse.aether.util.listener.ChainedRepositoryListener;
|
||||
import org.eclipse.aether.util.listener.ChainedTransferListener;
|
||||
import org.eclipse.aether.util.repository.AuthenticationBuilder;
|
||||
import org.talend.designer.maven.aether.util.MavenLibraryResolverProvider;
|
||||
import org.talend.designer.maven.aether.util.TalendAetherProxySelector;
|
||||
|
||||
/**
|
||||
* created by wchen on Aug 10, 2017 Detailled comment
|
||||
@@ -41,19 +44,34 @@ public class RepositorySystemFactory {
|
||||
|
||||
private static Map<LocalRepository, DefaultRepositorySystemSession> sessions = new HashMap<LocalRepository, DefaultRepositorySystemSession>();
|
||||
|
||||
private static DefaultRepositorySystemSession newRepositorySystemSession(String localRepositoryPath)
|
||||
throws PlexusContainerException {
|
||||
private static RepositorySystem system;
|
||||
|
||||
private static RepositorySystem newRepositorySystem() {
|
||||
DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
|
||||
locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class);
|
||||
locator.addService(TransporterFactory.class, FileTransporterFactory.class);
|
||||
locator.addService(TransporterFactory.class, HttpTransporterFactory.class);
|
||||
|
||||
locator.setErrorHandler(new DefaultServiceLocator.ErrorHandler() {
|
||||
|
||||
@Override
|
||||
public void serviceCreationFailed(Class<?> type, Class<?> impl, Throwable exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
});
|
||||
|
||||
return locator.getService(RepositorySystem.class);
|
||||
}
|
||||
|
||||
private static DefaultRepositorySystemSession newRepositorySystemSession(String localRepositoryPath) {
|
||||
LocalRepository localRepo = new LocalRepository(localRepositoryPath);
|
||||
DefaultRepositorySystemSession repositorySystemSession = sessions.get(localRepo);
|
||||
if (repositorySystemSession == null) {
|
||||
repositorySystemSession = MavenRepositorySystemUtils.newSession();
|
||||
repositorySystemSession
|
||||
.setLocalRepositoryManager(
|
||||
MavenLibraryResolverProvider.newRepositorySystem().newLocalRepositoryManager(repositorySystemSession,
|
||||
localRepo));
|
||||
.setLocalRepositoryManager(system.newLocalRepositoryManager(repositorySystemSession, localRepo));
|
||||
repositorySystemSession.setTransferListener(new ChainedTransferListener());
|
||||
repositorySystemSession.setRepositoryListener(new ChainedRepositoryListener());
|
||||
repositorySystemSession.setProxySelector(new TalendAetherProxySelector());
|
||||
}
|
||||
|
||||
return repositorySystemSession;
|
||||
@@ -63,7 +81,9 @@ public class RepositorySystemFactory {
|
||||
String userName, String password, String groupId, String artifactId, String classifier, String extension,
|
||||
String version) throws Exception {
|
||||
DefaultRepositorySystemSession session = null;
|
||||
RepositorySystem system = MavenLibraryResolverProvider.newRepositorySystem();
|
||||
if (system == null) {
|
||||
system = newRepositorySystem();
|
||||
}
|
||||
session = newRepositorySystemSession(localRepository);
|
||||
|
||||
DeployRequest deployRequest = new DeployRequest();
|
||||
@@ -87,7 +107,6 @@ public class RepositorySystemFactory {
|
||||
Authentication auth = new AuthenticationBuilder().addUsername(userName).addPassword(password).build();
|
||||
RemoteRepository distRepo = new RemoteRepository.Builder(repositoryId, "default", repositoryUrl).setAuthentication(auth)
|
||||
.build();
|
||||
distRepo = new RemoteRepository.Builder(distRepo).setProxy(new TalendAetherProxySelector().getProxy(distRepo)).build();
|
||||
|
||||
deployRequest.setRepository(distRepo);
|
||||
|
||||
|
||||
@@ -36,11 +36,10 @@ import org.eclipse.aether.artifact.Artifact;
|
||||
import org.eclipse.aether.artifact.DefaultArtifact;
|
||||
import org.eclipse.aether.collection.CollectRequest;
|
||||
import org.eclipse.aether.collection.DependencySelector;
|
||||
import org.eclipse.aether.connector.basic.BasicRepositoryConnectorFactory;
|
||||
import org.eclipse.aether.graph.DefaultDependencyNode;
|
||||
import org.eclipse.aether.graph.Exclusion;
|
||||
import org.eclipse.aether.impl.DefaultServiceLocator;
|
||||
import org.eclipse.aether.internal.transport.wagon.PlexusWagonConfigurator;
|
||||
import org.eclipse.aether.internal.transport.wagon.PlexusWagonProvider;
|
||||
import org.eclipse.aether.repository.Authentication;
|
||||
import org.eclipse.aether.repository.LocalRepository;
|
||||
import org.eclipse.aether.repository.RemoteRepository;
|
||||
@@ -49,6 +48,10 @@ import org.eclipse.aether.resolution.ArtifactRequest;
|
||||
import org.eclipse.aether.resolution.ArtifactResult;
|
||||
import org.eclipse.aether.resolution.VersionRangeRequest;
|
||||
import org.eclipse.aether.resolution.VersionRangeResult;
|
||||
import org.eclipse.aether.spi.connector.RepositoryConnectorFactory;
|
||||
import org.eclipse.aether.spi.connector.transport.TransporterFactory;
|
||||
import org.eclipse.aether.transport.file.FileTransporterFactory;
|
||||
import org.eclipse.aether.transport.http.HttpTransporterFactory;
|
||||
import org.eclipse.aether.util.artifact.JavaScopes;
|
||||
import org.eclipse.aether.util.graph.selector.AndDependencySelector;
|
||||
import org.eclipse.aether.util.graph.selector.OptionalDependencySelector;
|
||||
@@ -108,11 +111,11 @@ public class DynamicDistributionAetherUtils {
|
||||
|
||||
RepositorySystem repoSystem = null;
|
||||
if (multiThread) {
|
||||
repoSystem = MavenLibraryResolverProvider.newRepositorySystemForResolver();
|
||||
repoSystem = newRepositorySystem();
|
||||
} else {
|
||||
repoSystem = repoSystemMap.get(key);
|
||||
if (repoSystem == null) {
|
||||
repoSystem = MavenLibraryResolverProvider.newRepositorySystemForResolver();
|
||||
repoSystem = newRepositorySystem();
|
||||
repoSystemMap.put(key, repoSystem);
|
||||
}
|
||||
}
|
||||
@@ -149,7 +152,6 @@ public class DynamicDistributionAetherUtils {
|
||||
builder = builder.setAuthentication(auth);
|
||||
}
|
||||
RemoteRepository central = builder.build();
|
||||
central = new RemoteRepository.Builder(central).setProxy(new TalendAetherProxySelector().getProxy(central)).build();
|
||||
|
||||
CollectRequest collectRequest = new CollectRequest();
|
||||
collectRequest.setRoot(dependency);
|
||||
@@ -281,7 +283,7 @@ public class DynamicDistributionAetherUtils {
|
||||
if (monitor == null) {
|
||||
monitor = new DummyDynamicMonitor();
|
||||
}
|
||||
RepositorySystem repSystem = MavenLibraryResolverProvider.newRepositorySystemForResolver();
|
||||
RepositorySystem repSystem = newRepositorySystem();
|
||||
RepositorySystemSession repSysSession = newSession(repSystem, localPath, monitor);
|
||||
updateDependencySelector((DefaultRepositorySystemSession) repSysSession, monitor);
|
||||
|
||||
@@ -305,7 +307,6 @@ public class DynamicDistributionAetherUtils {
|
||||
builder = builder.setAuthentication(auth);
|
||||
}
|
||||
RemoteRepository central = builder.build();
|
||||
central = new RemoteRepository.Builder(central).setProxy(new TalendAetherProxySelector().getProxy(central)).build();
|
||||
|
||||
VersionRangeRequest verRangeRequest = new VersionRangeRequest();
|
||||
verRangeRequest.addRepository(central);
|
||||
@@ -328,7 +329,7 @@ public class DynamicDistributionAetherUtils {
|
||||
if (monitor == null) {
|
||||
monitor = new DummyDynamicMonitor();
|
||||
}
|
||||
RepositorySystem repSystem = MavenLibraryResolverProvider.newRepositorySystemForResolver();
|
||||
RepositorySystem repSystem = newRepositorySystem();
|
||||
RepositorySystemSession repSysSession = newSession(repSystem, localPath, monitor);
|
||||
updateDependencySelector((DefaultRepositorySystemSession) repSysSession, monitor);
|
||||
|
||||
@@ -352,7 +353,6 @@ public class DynamicDistributionAetherUtils {
|
||||
builder = builder.setAuthentication(auth);
|
||||
}
|
||||
RemoteRepository central = builder.build();
|
||||
central = new RemoteRepository.Builder(central).setProxy(new TalendAetherProxySelector().getProxy(central)).build();
|
||||
|
||||
VersionRangeRequest verRangeRequest = new VersionRangeRequest();
|
||||
verRangeRequest.addRepository(central);
|
||||
@@ -411,13 +411,21 @@ public class DynamicDistributionAetherUtils {
|
||||
// }
|
||||
// }
|
||||
|
||||
private static RepositorySystem newRepositorySystem() {
|
||||
DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
|
||||
locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class);
|
||||
locator.addService(TransporterFactory.class, FileTransporterFactory.class);
|
||||
locator.addService(TransporterFactory.class, HttpTransporterFactory.class);
|
||||
|
||||
return locator.getService(RepositorySystem.class);
|
||||
}
|
||||
|
||||
private static RepositorySystemSession newSession(RepositorySystem system, String repositoryPath, IDynamicMonitor monitor)
|
||||
throws CoreException {
|
||||
DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
|
||||
|
||||
LocalRepository localRepo = new LocalRepository(repositoryPath);
|
||||
session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, localRepo));
|
||||
session.setProxySelector(new TalendAetherProxySelector());
|
||||
|
||||
updateDependencySelector(session, monitor);
|
||||
|
||||
|
||||
@@ -12,25 +12,12 @@
|
||||
// ============================================================================
|
||||
package org.talend.designer.maven.aether.util;
|
||||
|
||||
import java.io.FileReader;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.maven.model.License;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.Parent;
|
||||
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.HttpWagon;
|
||||
import org.apache.maven.wagon.providers.http.LightweightHttpWagonAuthenticator;
|
||||
import org.apache.maven.wagon.providers.http.LightweightHttpsWagon;
|
||||
import org.codehaus.plexus.DefaultPlexusContainer;
|
||||
import org.codehaus.plexus.PlexusContainer;
|
||||
import org.codehaus.plexus.PlexusContainerException;
|
||||
import org.eclipse.aether.DefaultRepositorySystemSession;
|
||||
import org.eclipse.aether.RepositorySystem;
|
||||
import org.eclipse.aether.RepositorySystemSession;
|
||||
@@ -38,8 +25,6 @@ import org.eclipse.aether.artifact.Artifact;
|
||||
import org.eclipse.aether.artifact.DefaultArtifact;
|
||||
import org.eclipse.aether.connector.basic.BasicRepositoryConnectorFactory;
|
||||
import org.eclipse.aether.impl.DefaultServiceLocator;
|
||||
import org.eclipse.aether.internal.transport.wagon.PlexusWagonConfigurator;
|
||||
import org.eclipse.aether.internal.transport.wagon.PlexusWagonProvider;
|
||||
import org.eclipse.aether.repository.Authentication;
|
||||
import org.eclipse.aether.repository.LocalRepository;
|
||||
import org.eclipse.aether.repository.RemoteRepository;
|
||||
@@ -49,12 +34,9 @@ import org.eclipse.aether.spi.connector.RepositoryConnectorFactory;
|
||||
import org.eclipse.aether.spi.connector.transport.TransporterFactory;
|
||||
import org.eclipse.aether.transport.file.FileTransporterFactory;
|
||||
import org.eclipse.aether.transport.http.HttpTransporterFactory;
|
||||
import org.eclipse.aether.transport.wagon.WagonTransporterFactory;
|
||||
import org.eclipse.aether.util.repository.AuthenticationBuilder;
|
||||
import org.eclipse.m2e.core.MavenPlugin;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.core.nexus.ArtifactRepositoryBean;
|
||||
import org.talend.core.nexus.NexusConstants;
|
||||
import org.talend.core.nexus.TalendLibsServerManager;
|
||||
import org.talend.core.runtime.maven.MavenArtifact;
|
||||
|
||||
@@ -66,17 +48,10 @@ public class MavenLibraryResolverProvider {
|
||||
|
||||
private RepositorySystem defaultRepoSystem;
|
||||
|
||||
private RepositorySystem dynamicRepoSystem;
|
||||
|
||||
|
||||
private RepositorySystemSession defaultRepoSystemSession;
|
||||
|
||||
private RepositorySystemSession dynamicRepoSystemSession;
|
||||
|
||||
private RemoteRepository defaultRemoteRepository = null;
|
||||
|
||||
private RemoteRepository dynamicRemoteRepository = null;
|
||||
|
||||
private static MavenLibraryResolverProvider instance;
|
||||
|
||||
public static MavenLibraryResolverProvider getInstance() {
|
||||
@@ -95,11 +70,9 @@ public class MavenLibraryResolverProvider {
|
||||
return instance;
|
||||
}
|
||||
|
||||
private MavenLibraryResolverProvider() throws PlexusContainerException {
|
||||
defaultRepoSystem = newRepositorySystemForResolver();
|
||||
dynamicRepoSystem = newRepositorySystemForResolver();
|
||||
private MavenLibraryResolverProvider() {
|
||||
defaultRepoSystem = newRepositorySystem();
|
||||
defaultRepoSystemSession = newSession(defaultRepoSystem, getLocalMVNRepository());
|
||||
dynamicRepoSystemSession = newSession(dynamicRepoSystem, getLocalMVNRepository());
|
||||
ArtifactRepositoryBean talendServer = TalendLibsServerManager.getInstance().getTalentArtifactServer();
|
||||
if (talendServer.getUserName() == null && talendServer.getPassword() == null) {
|
||||
defaultRemoteRepository = new RemoteRepository.Builder("talend", "default", talendServer.getRepositoryURL()).build(); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
@@ -109,108 +82,55 @@ public class MavenLibraryResolverProvider {
|
||||
defaultRemoteRepository = new RemoteRepository.Builder("talend", "default", talendServer.getRepositoryURL()) //$NON-NLS-1$ //$NON-NLS-2$
|
||||
.setAuthentication(authentication).build();
|
||||
}
|
||||
defaultRemoteRepository = new RemoteRepository.Builder(defaultRemoteRepository)
|
||||
.setProxy(new TalendAetherProxySelector().getProxy(defaultRemoteRepository)).build();
|
||||
|
||||
Authentication authentication = new AuthenticationBuilder().addUsername("studio-dl-client").addPassword(
|
||||
"studio-dl-client")
|
||||
.build();
|
||||
String serverUrl = talendServer.getServer();
|
||||
if (!serverUrl.endsWith(NexusConstants.SLASH)) {
|
||||
serverUrl += NexusConstants.SLASH;
|
||||
}
|
||||
dynamicRemoteRepository = new RemoteRepository.Builder("talend2", "default",
|
||||
NexusConstants.DYNAMIC_DISTRIBUTION).setAuthentication(authentication).build();
|
||||
dynamicRemoteRepository = new RemoteRepository.Builder(dynamicRemoteRepository)
|
||||
.setProxy(new TalendAetherProxySelector().getProxy(dynamicRemoteRepository)).build();
|
||||
|
||||
}
|
||||
|
||||
public ArtifactResult resolveArtifact(MavenArtifact aritfact, boolean is4Parent) throws Exception {
|
||||
ArtifactRequest artifactRequest = new ArtifactRequest();
|
||||
public ArtifactResult resolveArtifact(MavenArtifact aritfact) throws Exception {
|
||||
RemoteRepository remoteRepo = getRemoteRepositroy(aritfact);
|
||||
artifactRequest.addRepository(remoteRepo);
|
||||
if (is4Parent) {
|
||||
artifactRequest.addRepository(dynamicRemoteRepository);
|
||||
}
|
||||
Artifact artifact = new DefaultArtifact(aritfact.getGroupId(), aritfact.getArtifactId(), aritfact.getClassifier(),
|
||||
aritfact.getType(), aritfact.getVersion());
|
||||
ArtifactRequest artifactRequest = new ArtifactRequest();
|
||||
artifactRequest.addRepository(remoteRepo);
|
||||
artifactRequest.setArtifact(artifact);
|
||||
ArtifactResult result = null;
|
||||
if (is4Parent) {
|
||||
result = dynamicRepoSystem.resolveArtifact(dynamicRepoSystemSession, artifactRequest);
|
||||
} else {
|
||||
result = defaultRepoSystem.resolveArtifact(defaultRepoSystemSession, artifactRequest);
|
||||
}
|
||||
ArtifactResult result = defaultRepoSystem.resolveArtifact(defaultRepoSystemSession, artifactRequest);
|
||||
return result;
|
||||
}
|
||||
|
||||
public Map<String, Object> resolveDescProperties(MavenArtifact aritfact, boolean is4Parent) throws Exception {
|
||||
public Map<String, Object> resolveDescProperties(MavenArtifact aritfact) throws Exception {
|
||||
Map<String, Object> properties = null;
|
||||
MavenArtifact clonedArtifact = aritfact.clone();
|
||||
clonedArtifact.setType("pom"); //$NON-NLS-1$
|
||||
ArtifactResult result = resolveArtifact(clonedArtifact, is4Parent);
|
||||
ArtifactResult result = resolveArtifact(clonedArtifact);
|
||||
if (result != null && result.isResolved()) {
|
||||
properties = new HashMap<String, Object>();
|
||||
MavenXpp3Reader reader = new MavenXpp3Reader();
|
||||
Model model = reader.read(new FileReader(result.getArtifact().getFile()));
|
||||
// Model model = MavenPlugin.getMavenModelManager().readMavenModel(result.getArtifact().getFile());
|
||||
Model model = MavenPlugin.getMavenModelManager().readMavenModel(result.getArtifact().getFile());
|
||||
if (model != null) {
|
||||
properties.put("type", model.getPackaging()); //$NON-NLS-1$
|
||||
|
||||
int licenseCount = 0;
|
||||
properties.put("license.count", model.getLicenses().size()); //$NON-NLS-1$
|
||||
if (model.getLicenses() != null) {
|
||||
for (int i = 0; i < model.getLicenses().size(); i++) {
|
||||
License license = model.getLicenses().get(i);
|
||||
if (StringUtils.isNotBlank(license.getName()) || StringUtils.isNotBlank(license.getUrl())) {
|
||||
properties.put("license." + i + ".name", license.getName()); //$NON-NLS-1$//$NON-NLS-2$
|
||||
properties.put("license." + i + ".url", license.getUrl()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
properties.put("license." + i + ".comments", license.getComments()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
properties.put("license." + i + ".distribution", license.getDistribution()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
licenseCount++;
|
||||
}
|
||||
properties.put("license." + i + ".name", license.getName()); //$NON-NLS-1$//$NON-NLS-2$
|
||||
properties.put("license." + i + ".url", license.getUrl()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
properties.put("license." + i + ".comments", license.getComments()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
properties.put("license." + i + ".distribution", license.getDistribution()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
}
|
||||
properties.put("license.count", licenseCount); //$NON-NLS-1$
|
||||
Parent parent = model.getParent();
|
||||
if (parent != null) {
|
||||
properties.put("parent.groupId", parent.getGroupId());
|
||||
properties.put("parent.version", parent.getVersion());
|
||||
properties.put("parent.artifactId", parent.getArtifactId());
|
||||
} else {
|
||||
properties.remove("parent.groupId");
|
||||
properties.remove("parent.version");
|
||||
properties.remove("parent.artifactId");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return properties;
|
||||
}
|
||||
|
||||
public RemoteRepository getRemoteRepositroy(MavenArtifact aritfact) {
|
||||
RemoteRepository remoteRepository = null;
|
||||
Consumer<RemoteRepository> update = null;
|
||||
if (aritfact != null && aritfact.getRepositoryUrl() != null) {
|
||||
if (urlToRepositoryMap.containsKey(aritfact.getRepositoryUrl())) {
|
||||
remoteRepository = urlToRepositoryMap.get(aritfact.getRepositoryUrl());
|
||||
} else {
|
||||
remoteRepository = buildRemoteRepository(aritfact);
|
||||
urlToRepositoryMap.put(aritfact.getRepositoryUrl(), remoteRepository);
|
||||
return urlToRepositoryMap.get(aritfact.getRepositoryUrl());
|
||||
}
|
||||
update = (r) -> urlToRepositoryMap.put(aritfact.getRepositoryUrl(), r);
|
||||
} else {
|
||||
remoteRepository = defaultRemoteRepository;
|
||||
update = (r) -> defaultRemoteRepository = r;
|
||||
|
||||
RemoteRepository repository = buildRemoteRepository(aritfact);
|
||||
urlToRepositoryMap.put(aritfact.getRepositoryUrl(), repository);
|
||||
return repository;
|
||||
}
|
||||
try {
|
||||
remoteRepository = new RemoteRepository.Builder(remoteRepository)
|
||||
.setProxy(defaultRepoSystemSession.getProxySelector().getProxy(remoteRepository)).build();
|
||||
update.accept(remoteRepository);
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return remoteRepository;
|
||||
return defaultRemoteRepository;
|
||||
}
|
||||
|
||||
private RemoteRepository buildRemoteRepository(MavenArtifact aritfact) {
|
||||
@@ -223,53 +143,15 @@ public class MavenLibraryResolverProvider {
|
||||
repository = new RemoteRepository.Builder("talend", "default", aritfact.getRepositoryUrl()) //$NON-NLS-1$ //$NON-NLS-2$
|
||||
.setAuthentication(authentication).build();
|
||||
}
|
||||
repository = new RemoteRepository.Builder(repository).setProxy(new TalendAetherProxySelector().getProxy(repository))
|
||||
.build();
|
||||
return repository;
|
||||
}
|
||||
|
||||
public static RepositorySystem newRepositorySystem() throws PlexusContainerException {
|
||||
DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
|
||||
locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class);
|
||||
// TUP-24695 change to wagon transporters
|
||||
locator.addService(TransporterFactory.class, WagonTransporterFactory.class);
|
||||
|
||||
PlexusContainer pc = new DefaultPlexusContainer();
|
||||
|
||||
LightweightHttpsWagon https = new LightweightHttpsWagon();
|
||||
https.setAuthenticator(new LightweightHttpWagonAuthenticator());
|
||||
|
||||
pc.addComponent(https, Wagon.class, "https");
|
||||
pc.addComponent(new HttpWagon(), Wagon.class, "http");
|
||||
pc.addComponent(new FileWagon(), Wagon.class, "file");
|
||||
|
||||
WagonTransporterFactory tf = (WagonTransporterFactory) locator.getService(TransporterFactory.class);
|
||||
tf.setWagonConfigurator(new PlexusWagonConfigurator(pc));
|
||||
tf.setWagonProvider(new PlexusWagonProvider(pc));
|
||||
|
||||
locator.setErrorHandler(new DefaultServiceLocator.ErrorHandler() {
|
||||
|
||||
@Override
|
||||
public void serviceCreationFailed(Class<?> type, Class<?> impl, Throwable exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
});
|
||||
return locator.getService(RepositorySystem.class);
|
||||
}
|
||||
|
||||
public static RepositorySystem newRepositorySystemForResolver() {
|
||||
private RepositorySystem newRepositorySystem() {
|
||||
DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
|
||||
locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class);
|
||||
locator.addService(TransporterFactory.class, FileTransporterFactory.class);
|
||||
locator.addService(TransporterFactory.class, HttpTransporterFactory.class);
|
||||
|
||||
locator.setErrorHandler(new DefaultServiceLocator.ErrorHandler() {
|
||||
|
||||
@Override
|
||||
public void serviceCreationFailed(Class<?> type, Class<?> impl, Throwable exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
});
|
||||
return locator.getService(RepositorySystem.class);
|
||||
}
|
||||
|
||||
@@ -278,7 +160,6 @@ public class MavenLibraryResolverProvider {
|
||||
|
||||
LocalRepository localRepo = new LocalRepository( /* "target/local-repo" */target);
|
||||
session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, localRepo));
|
||||
session.setProxySelector(new TalendAetherProxySelector());
|
||||
|
||||
return session;
|
||||
}
|
||||
|
||||
@@ -1,98 +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.designer.maven.aether.util;
|
||||
|
||||
import org.eclipse.aether.repository.Authentication;
|
||||
import org.eclipse.aether.repository.Proxy;
|
||||
import org.eclipse.aether.repository.ProxySelector;
|
||||
import org.eclipse.aether.repository.RemoteRepository;
|
||||
import org.eclipse.aether.util.repository.AuthenticationBuilder;
|
||||
import org.eclipse.aether.util.repository.DefaultProxySelector;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.utils.network.TalendProxySelector;
|
||||
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public class TalendAetherProxySelector implements ProxySelector {
|
||||
|
||||
private boolean isTalendDebug = false;
|
||||
|
||||
public TalendAetherProxySelector() {
|
||||
isTalendDebug = Boolean.valueOf(System.getProperty(TalendProxySelector.PROP_PRINT_LOGS, "false"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Proxy getProxy(RemoteRepository repository) {
|
||||
/**
|
||||
* Update each time in case the settings are changed
|
||||
*/
|
||||
Proxy proxy = createProxySelector().getProxy(repository);
|
||||
if (isTalendDebug) {
|
||||
try {
|
||||
if (repository != null) {
|
||||
String proxyStr = "";
|
||||
if (proxy != null) {
|
||||
proxyStr = proxy.getType() + " " + proxy.toString() + ", proxy user: "
|
||||
+ (proxy.getAuthentication() != null ? "..." : "<empty>");
|
||||
}
|
||||
ExceptionHandler.log("Aether proxy> host: " + repository.getHost() + ", proxy: " + proxyStr);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
return proxy;
|
||||
}
|
||||
|
||||
private DefaultProxySelector createProxySelector() {
|
||||
DefaultProxySelector proxySelector = new DefaultProxySelector();
|
||||
javaDefaultProxy(proxySelector);
|
||||
return proxySelector;
|
||||
}
|
||||
|
||||
private void javaDefaultProxy(DefaultProxySelector proxySelector) {
|
||||
String[] schemas = new String[] { "http", "https" };
|
||||
for (String schema : schemas) {
|
||||
Proxy proxy = createProxy(schema);
|
||||
if (proxy != null) {
|
||||
proxySelector.add(proxy, System.getProperty(schema + ".nonProxyHosts"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private org.eclipse.aether.repository.Proxy createProxy(String schema) {
|
||||
String proxyHost = System.getProperty(schema + ".proxyHost");
|
||||
if (proxyHost == null) {
|
||||
return null;
|
||||
}
|
||||
String proxyUser = System.getProperty(schema + ".proxyUser");
|
||||
String proxyPassword = System.getProperty(schema + ".proxyPassword");
|
||||
int proxyPort = Integer.parseInt(System.getProperty(schema + ".proxyPort", "8080"));
|
||||
|
||||
Authentication authentication = createAuthentication(proxyUser, proxyPassword);
|
||||
org.eclipse.aether.repository.Proxy proxyObj = new org.eclipse.aether.repository.Proxy(schema, proxyHost, proxyPort,
|
||||
authentication);
|
||||
return proxyObj;
|
||||
}
|
||||
|
||||
private Authentication createAuthentication(String proxyUser, String proxyPassword) {
|
||||
Authentication authentication = null;
|
||||
if (proxyUser != null) {
|
||||
authentication = new AuthenticationBuilder().addUsername(proxyUser).addPassword(proxyPassword).build();
|
||||
}
|
||||
return authentication;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -46,6 +46,12 @@
|
||||
<version>${project.version}</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.talend.studio</groupId>
|
||||
<artifactId>features-maven-plugin-2-2-9-tos</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.talend.studio</groupId>
|
||||
<artifactId>maven-bundle-plugin-2-3-7-tos</artifactId>
|
||||
@@ -70,30 +76,18 @@
|
||||
<version>${project.version}</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.talend.studio</groupId>
|
||||
<artifactId>build-helper-maven-plugin-3-0-0-tos</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.talend.studio</groupId>
|
||||
<artifactId>karaf-maven-plugin-4-2-4-tos</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.talend.studio</groupId>
|
||||
<artifactId>studio-maven-repository-zip</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.talend.studio</groupId>
|
||||
<artifactId>karaf-maven-plugin-4-2-4-tos</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.talend.studio</groupId>
|
||||
<artifactId>build-helper-maven-plugin-3-0-0-tos</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<profiles>
|
||||
<profile>
|
||||
|
||||
@@ -7,30 +7,41 @@
|
||||
<version>7.3.1-SNAPSHOT</version>
|
||||
<relativePath>../../../</relativePath>
|
||||
</parent>
|
||||
<artifactId>karaf-maven-plugin-4-2-4-tos</artifactId>
|
||||
<artifactId>features-maven-plugin-2-2-9-tos</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.karaf.tooling</groupId>
|
||||
<artifactId>karaf-maven-plugin</artifactId>
|
||||
<version>4.2.4</version>
|
||||
<artifactId>features-maven-plugin</artifactId>
|
||||
<version>2.2.9</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>jcl-over-slf4j</artifactId>
|
||||
<version>1.7.12</version>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>org.apache.felix.bundlerepository</artifactId>
|
||||
<version>1.6.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.shared</groupId>
|
||||
<artifactId>maven-dependency-tree</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<groupId>org.osgi</groupId>
|
||||
<artifactId>org.osgi.core</artifactId>
|
||||
<version>4.2.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-framework-bom</artifactId>
|
||||
<version>5.0.2.RELEASE</version>
|
||||
<type>pom</type>
|
||||
<groupId>org.easymock</groupId>
|
||||
<artifactId>easymock</artifactId>
|
||||
<version>3.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Required by commons-lang-2.6.pom -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-parent</artifactId>
|
||||
<version>17</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
@@ -10,9 +10,9 @@
|
||||
<artifactId>studio-maven-repository-build</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>plugins/features-maven-plugin-2-2-9</module>
|
||||
<module>plugins/maven-bundle-plugin-2-3-7</module>
|
||||
<module>plugins/maven-bundle-plugin-2-5-3</module>
|
||||
<module>plugins/karaf-maven-plugin-4-2-4</module>
|
||||
<module>plugins/maven-install-plugin-2-5-1</module>
|
||||
<module>plugins/talend-compiler-plugin</module>
|
||||
<module>plugins/build-helper-maven-plugin-3-0-0</module>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user