Compare commits
1 Commits
fix/master
...
cmeng/stig
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
90e09aa5a0 |
@@ -54,13 +54,7 @@
|
||||
id="org.talend.libraries.apache.lucene8"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"/>
|
||||
|
||||
<plugin
|
||||
id="org.talend.signon.util"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
unpack="true"/>
|
||||
|
||||
</feature>
|
||||
|
||||
@@ -72,27 +72,12 @@ public final class MessageBoxExceptionHandler {
|
||||
}
|
||||
}
|
||||
|
||||
public static void process(Throwable ex, Shell shell, boolean wrapMessage) {
|
||||
CommonExceptionHandler.process(ex);
|
||||
|
||||
if (CommonsPlugin.isHeadless() || CommonsPlugin.isJUnitTest()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (shell != null) {
|
||||
showMessage(ex, shell, wrapMessage);
|
||||
}
|
||||
}
|
||||
|
||||
public static void showMessage(Throwable ex, Shell shell) {
|
||||
showMessage(ex, shell, true);
|
||||
}
|
||||
/**
|
||||
* Open a message box showing a generic message and exception message.
|
||||
*
|
||||
* @param ex - exception to show
|
||||
*/
|
||||
public static void showMessage(Throwable ex, Shell shell, boolean wrapMessage) {
|
||||
public static void showMessage(Throwable ex, Shell shell) {
|
||||
if (ex.equals(lastShowedAction)) {
|
||||
return;
|
||||
}
|
||||
@@ -100,14 +85,10 @@ public final class MessageBoxExceptionHandler {
|
||||
|
||||
// TODO smallet use ErrorDialogWidthDetailArea ?
|
||||
String title = Messages.getString("commons.error"); //$NON-NLS-1$
|
||||
String excepMsg = ex.getMessage();
|
||||
String msg = Messages.getString("exception.errorOccured", ex.getMessage()); //$NON-NLS-1$
|
||||
//add for tup-19726/19790, as for exception detailMessage will show more details on log area.
|
||||
if(ex.getCause()!=null) {
|
||||
excepMsg = ex.getCause().getMessage();
|
||||
}
|
||||
String msg = Messages.getString("exception.errorOccured", excepMsg); //$NON-NLS-1$
|
||||
if (!wrapMessage) {
|
||||
msg = Messages.getString("exception.message", excepMsg); //$NON-NLS-1$
|
||||
msg = Messages.getString("exception.errorOccured", ex.getCause().getMessage()); //$NON-NLS-1$
|
||||
}
|
||||
Priority priority = CommonExceptionHandler.getPriority(ex);
|
||||
|
||||
|
||||
@@ -114,7 +114,6 @@ TableViewerCreator.Table.BeNull=table is null
|
||||
TableViewerCreator.TableColumn.AssertMsg=The TableColumn of TableEditorColumn with idProperty '{0}' has not the correct Table parent
|
||||
TreeToTablesLinker.Type.Unsupported=This type of currentControl is unsupported
|
||||
commons.error=Error
|
||||
exception.message={0}\nSee log for more details.
|
||||
exception.errorOccured=An error occured ({0}).\nSee log for more details.
|
||||
ModelSelectionDialog.Message=Please choose one option, or cancel.
|
||||
ModelSelectionDialog.Option=option
|
||||
|
||||
@@ -114,7 +114,6 @@ TableViewerCreator.Table.BeNull=\u30C6\u30FC\u30D6\u30EB\u304CNULL\u3067\u3059
|
||||
TableViewerCreator.TableColumn.AssertMsg=idProperty'{0}'\u304C\u3042\u308BTableEditorColumn\u306ETableColumn\u306B\u306F\u3001\u6B63\u3057\u3044\u89AA\u30C6\u30FC\u30D6\u30EB\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u305B\u3093
|
||||
TreeToTablesLinker.Type.Unsupported=currentControl\u306E\u3053\u306E\u30BF\u30A4\u30D7\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093
|
||||
commons.error=\u30A8\u30E9\u30FC
|
||||
exception.message={0}\n\u8A73\u7D30\u306F\u30ED\u30B0\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
||||
exception.errorOccured=\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F({0})\u3002\n\u8A73\u7D30\u306F\u30ED\u30B0\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
||||
ModelSelectionDialog.Message=\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\uFF11\u3064\u9078\u629E\u3059\u308B\u304B\u3001\u30AD\u30E3\u30F3\u30BB\u30EB\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
||||
ModelSelectionDialog.Option=\u30AA\u30D7\u30B7\u30E7\u30F3
|
||||
|
||||
@@ -16,14 +16,8 @@ import java.io.BufferedOutputStream;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.swt.SWT;
|
||||
@@ -164,35 +158,8 @@ public class ImageUtils {
|
||||
return imageDes;
|
||||
}
|
||||
|
||||
private static Map<byte[], ImageDataProvider> imageFromDataCachedImages = Collections.synchronizedMap(new HashMap<byte[], ImageDataProvider>());
|
||||
private static Map<Long, byte[]> cachedImagesTimeKeeping = Collections.synchronizedMap(new HashMap<Long, byte[]>());
|
||||
|
||||
private static Thread clearImageFromDataCachedImages = new Thread() {
|
||||
@SuppressWarnings("static-access")
|
||||
public void run() {
|
||||
long timeout = 5 * 60 * 1000;
|
||||
while(true) {//remove older than 5 mins
|
||||
Set<Entry<Long, byte[]>> collect = cachedImagesTimeKeeping.entrySet().stream()
|
||||
.filter(entry -> (System.currentTimeMillis() - entry.getKey()) > timeout).collect(Collectors.toSet());
|
||||
for(Entry<Long, byte[]> entry: collect) {
|
||||
Long key = entry.getKey();
|
||||
cachedImagesTimeKeeping.remove(key);
|
||||
imageFromDataCachedImages.remove(entry.getValue());
|
||||
}
|
||||
|
||||
try {
|
||||
sleep(timeout);
|
||||
} catch (InterruptedException e) {//
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
private static Map<byte[], ImageDataProvider> imageFromDataCachedImages = new HashMap<byte[], ImageDataProvider>();
|
||||
|
||||
static {
|
||||
clearImageFromDataCachedImages.setDaemon(true);
|
||||
clearImageFromDataCachedImages.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* By default, keep in memory the .
|
||||
*
|
||||
@@ -202,17 +169,12 @@ public class ImageUtils {
|
||||
*/
|
||||
public static ImageDescriptor createImageFromData(byte[] data, boolean... keepInMemory) {
|
||||
if (data != null) {
|
||||
ImageDataProvider imageProvider = null;
|
||||
Optional<byte[]> findKey = imageFromDataCachedImages.keySet().stream().filter(key->Arrays.equals(key, data)).findAny();
|
||||
if(findKey.isPresent()) {
|
||||
imageProvider = imageFromDataCachedImages.get(findKey.get());
|
||||
}
|
||||
ImageDataProvider imageProvider = imageFromDataCachedImages.get(data);
|
||||
if (imageProvider == null) {
|
||||
ByteArrayInputStream bais = new ByteArrayInputStream(data);
|
||||
ImageData img = new ImageData(bais);
|
||||
imageProvider = new TalendImageProvider(img);
|
||||
imageFromDataCachedImages.put(data, imageProvider);
|
||||
cachedImagesTimeKeeping.put(System.currentTimeMillis(), data);
|
||||
}
|
||||
return ImageDescriptor.createFromImageDataProvider(imageProvider);
|
||||
}
|
||||
@@ -221,9 +183,8 @@ public class ImageUtils {
|
||||
|
||||
public static void disposeImages(byte[] data) {
|
||||
if (data != null) {
|
||||
Optional<byte[]> findKey = imageFromDataCachedImages.keySet().stream().filter(key->Arrays.equals(key, data)).findAny();
|
||||
if(findKey.isPresent()) {
|
||||
imageFromDataCachedImages.remove(findKey.get());
|
||||
if (imageFromDataCachedImages.get(data) != null) {
|
||||
imageFromDataCachedImages.remove(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,9 +96,7 @@ public class EclipseCommandLine {
|
||||
static public final String PROP_KEY_PROFILE_ID = "eclipse.p2.profile";
|
||||
|
||||
static public final String ARG_BRANCH = "-branch";
|
||||
|
||||
static public final String ARG_PROJECT = "-project";
|
||||
|
||||
|
||||
static public final String LOGIN_ONLINE_UPDATE = "--loginOnlineUpdate";
|
||||
|
||||
static public final String ARG_TALEND_BUNDLES_CLEANED = "-talend.studio.bundles.cleaned"; //$NON-NLS-1$
|
||||
|
||||
@@ -19,8 +19,6 @@ import org.talend.repository.model.RepositoryConstants;
|
||||
*/
|
||||
public interface FileConstants {
|
||||
|
||||
String DOT = ".";
|
||||
|
||||
String OLD_TALEND_PROJECT_FILENAME = "talendProject"; //$NON-NLS-1$
|
||||
|
||||
String LOCAL_PROJECT_FILENAME = "talend.project"; //$NON-NLS-1$
|
||||
@@ -114,4 +112,5 @@ public interface FileConstants {
|
||||
String TALEND_FOLDER_NAME = "TALEND-INF"; //$NON-NLS-1$
|
||||
|
||||
String MAVEN_FOLDER_NAME = "MAVEN-INF";
|
||||
|
||||
}
|
||||
|
||||
@@ -1,127 +1,125 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.repository.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IConfigurationElement;
|
||||
import org.eclipse.swt.events.SelectionListener;
|
||||
import org.talend.commons.CommonsPlugin;
|
||||
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.commons.utils.workbench.extensions.ExtensionImplementationProvider;
|
||||
import org.talend.commons.utils.workbench.extensions.ExtensionPointLimiterImpl;
|
||||
import org.talend.commons.utils.workbench.extensions.IExtensionPointLimiter;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.ui.branding.IBrandingService;
|
||||
|
||||
/**
|
||||
* Provides, using extension points, implementation of many factories.
|
||||
*
|
||||
* <ul>
|
||||
* <li>IProcessFactory</li>
|
||||
* </ul>
|
||||
*
|
||||
* $Id: RepositoryFactoryProvider.java 38013 2010-03-05 14:21:59Z mhirt $
|
||||
*/
|
||||
public class RepositoryFactoryProvider {
|
||||
|
||||
private static List<IRepositoryFactory> list = null;
|
||||
|
||||
public static final IExtensionPointLimiter REPOSITORY_PROVIDER = new ExtensionPointLimiterImpl(
|
||||
"org.talend.core.repository.repository_provider", //$NON-NLS-1$
|
||||
"RepositoryFactory", 1, -1); //$NON-NLS-1$
|
||||
|
||||
public static synchronized List<IRepositoryFactory> getAvailableRepositories() {
|
||||
if (list == null) {
|
||||
list = new ArrayList<IRepositoryFactory>();
|
||||
List<IConfigurationElement> extension = ExtensionImplementationProvider.getInstanceV2(REPOSITORY_PROVIDER);
|
||||
String hiddenRepos = System.getProperty("hidden.repositories"); //$NON-NLS-1$
|
||||
String hiddenRepository[] = new String[]{};
|
||||
if (hiddenRepos != null) {
|
||||
hiddenRepository = hiddenRepos.split(";"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
boolean isPoweredByTalend = false;
|
||||
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault()
|
||||
.getService(IBrandingService.class);
|
||||
isPoweredByTalend = brandingService.isPoweredbyTalend();
|
||||
for (IConfigurationElement current : extension) {
|
||||
try {
|
||||
String only4TalendStr = current.getAttribute("only4Talend"); //$NON-NLS-1$
|
||||
if (Boolean.valueOf(only4TalendStr) && !isPoweredByTalend) {
|
||||
continue;
|
||||
}
|
||||
String only4OemStr = current.getAttribute("only4Oem"); //$NON-NLS-1$
|
||||
if (Boolean.valueOf(only4OemStr) && isPoweredByTalend) {
|
||||
continue;
|
||||
}
|
||||
IRepositoryFactory currentAction = (IRepositoryFactory) current.createExecutableExtension("class"); //$NON-NLS-1$
|
||||
currentAction.setId(current.getAttribute("id")); //$NON-NLS-1$
|
||||
currentAction.setName(current.getAttribute("name")); //$NON-NLS-1$
|
||||
currentAction.setAuthenticationNeeded(new Boolean(current.getAttribute("authenticationNeeded"))); //$NON-NLS-1$
|
||||
currentAction.setDisplayToUser(new Boolean(current.getAttribute("displayToUser")).booleanValue()); //$NON-NLS-1$
|
||||
|
||||
// Getting dynamic login fields:
|
||||
for (IConfigurationElement currentLoginField : current.getChildren("loginField")) { //$NON-NLS-1$
|
||||
DynamicFieldBean key = new DynamicFieldBean(currentLoginField.getAttribute("id"), //$NON-NLS-1$
|
||||
currentLoginField.getAttribute("name"), //$NON-NLS-1$
|
||||
currentLoginField.getAttribute("defaultValue"), //$NON-NLS-1$
|
||||
new Boolean(currentLoginField.getAttribute("required")), //$NON-NLS-1$
|
||||
new Boolean(currentLoginField.getAttribute("password")), //$NON-NLS-1$
|
||||
Boolean.valueOf(currentLoginField.getAttribute("readonly"))); //$NON-NLS-1$
|
||||
currentAction.getFields().add(key);
|
||||
}
|
||||
|
||||
for (IConfigurationElement currentLoginField : current.getChildren("button")) { //$NON-NLS-1$
|
||||
DynamicButtonBean key = new DynamicButtonBean(currentLoginField.getAttribute("id"), //$NON-NLS-1$
|
||||
currentLoginField.getAttribute("name"), //$NON-NLS-1$
|
||||
(SelectionListener) currentLoginField.createExecutableExtension("selectionListener")); //$NON-NLS-1$
|
||||
currentAction.getButtons().add(key);
|
||||
}
|
||||
|
||||
for (IConfigurationElement currentLoginField : current.getChildren("choiceField")) { //$NON-NLS-1$
|
||||
DynamicChoiceBean key = new DynamicChoiceBean(currentLoginField.getAttribute("id"), //$NON-NLS-1$
|
||||
currentLoginField.getAttribute("name")); //$NON-NLS-1$
|
||||
for (IConfigurationElement currentChoice : currentLoginField.getChildren("choice")) { //$NON-NLS-1$
|
||||
String value = currentChoice.getAttribute("value"); //$NON-NLS-1$
|
||||
String label = currentChoice.getAttribute("label"); //$NON-NLS-1$
|
||||
key.addChoice(value, label);
|
||||
}
|
||||
currentAction.getChoices().add(key);
|
||||
}
|
||||
if (ArrayUtils.contains(hiddenRepository, currentAction.getId())) {
|
||||
continue;
|
||||
}
|
||||
list.add(currentAction);
|
||||
} catch (CoreException e) {
|
||||
// e.printStackTrace();
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static IRepositoryFactory getRepositoriyById(String id) {
|
||||
for (IRepositoryFactory current : getAvailableRepositories()) {
|
||||
if (current.getId().equals(id)) {
|
||||
return current;
|
||||
}
|
||||
}
|
||||
ExceptionHandler.log("Can't find repository factory for: " + id);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.repository.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IConfigurationElement;
|
||||
import org.eclipse.swt.events.SelectionListener;
|
||||
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.commons.utils.workbench.extensions.ExtensionImplementationProvider;
|
||||
import org.talend.commons.utils.workbench.extensions.ExtensionPointLimiterImpl;
|
||||
import org.talend.commons.utils.workbench.extensions.IExtensionPointLimiter;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.ui.branding.IBrandingService;
|
||||
|
||||
/**
|
||||
* Provides, using extension points, implementation of many factories.
|
||||
*
|
||||
* <ul>
|
||||
* <li>IProcessFactory</li>
|
||||
* </ul>
|
||||
*
|
||||
* $Id: RepositoryFactoryProvider.java 38013 2010-03-05 14:21:59Z mhirt $
|
||||
*/
|
||||
public class RepositoryFactoryProvider {
|
||||
|
||||
private static List<IRepositoryFactory> list = null;
|
||||
|
||||
public static final IExtensionPointLimiter REPOSITORY_PROVIDER = new ExtensionPointLimiterImpl(
|
||||
"org.talend.core.repository.repository_provider", //$NON-NLS-1$
|
||||
"RepositoryFactory", 1, -1); //$NON-NLS-1$
|
||||
|
||||
public static List<IRepositoryFactory> getAvailableRepositories() {
|
||||
if (list == null) {
|
||||
list = new ArrayList<IRepositoryFactory>();
|
||||
List<IConfigurationElement> extension = ExtensionImplementationProvider.getInstanceV2(REPOSITORY_PROVIDER);
|
||||
String hiddenRepos = System.getProperty("hidden.repositories"); //$NON-NLS-1$
|
||||
String hiddenRepository[] = new String[]{};
|
||||
if (hiddenRepos != null) {
|
||||
hiddenRepository = hiddenRepos.split(";"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
boolean isPoweredByTalend = false;
|
||||
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault()
|
||||
.getService(IBrandingService.class);
|
||||
isPoweredByTalend = brandingService.isPoweredbyTalend();
|
||||
for (IConfigurationElement current : extension) {
|
||||
try {
|
||||
String only4TalendStr = current.getAttribute("only4Talend"); //$NON-NLS-1$
|
||||
if (Boolean.valueOf(only4TalendStr) && !isPoweredByTalend) {
|
||||
continue;
|
||||
}
|
||||
String only4OemStr = current.getAttribute("only4Oem"); //$NON-NLS-1$
|
||||
if (Boolean.valueOf(only4OemStr) && isPoweredByTalend) {
|
||||
continue;
|
||||
}
|
||||
IRepositoryFactory currentAction = (IRepositoryFactory) current.createExecutableExtension("class"); //$NON-NLS-1$
|
||||
currentAction.setId(current.getAttribute("id")); //$NON-NLS-1$
|
||||
currentAction.setName(current.getAttribute("name")); //$NON-NLS-1$
|
||||
currentAction.setAuthenticationNeeded(new Boolean(current.getAttribute("authenticationNeeded"))); //$NON-NLS-1$
|
||||
currentAction.setDisplayToUser(new Boolean(current.getAttribute("displayToUser")).booleanValue()); //$NON-NLS-1$
|
||||
|
||||
// Getting dynamic login fields:
|
||||
for (IConfigurationElement currentLoginField : current.getChildren("loginField")) { //$NON-NLS-1$
|
||||
DynamicFieldBean key = new DynamicFieldBean(currentLoginField.getAttribute("id"), //$NON-NLS-1$
|
||||
currentLoginField.getAttribute("name"), //$NON-NLS-1$
|
||||
currentLoginField.getAttribute("defaultValue"), //$NON-NLS-1$
|
||||
new Boolean(currentLoginField.getAttribute("required")), //$NON-NLS-1$
|
||||
new Boolean(currentLoginField.getAttribute("password")), //$NON-NLS-1$
|
||||
Boolean.valueOf(currentLoginField.getAttribute("readonly"))); //$NON-NLS-1$
|
||||
currentAction.getFields().add(key);
|
||||
}
|
||||
|
||||
for (IConfigurationElement currentLoginField : current.getChildren("button")) { //$NON-NLS-1$
|
||||
DynamicButtonBean key = new DynamicButtonBean(currentLoginField.getAttribute("id"), //$NON-NLS-1$
|
||||
currentLoginField.getAttribute("name"), //$NON-NLS-1$
|
||||
(SelectionListener) currentLoginField.createExecutableExtension("selectionListener")); //$NON-NLS-1$
|
||||
currentAction.getButtons().add(key);
|
||||
}
|
||||
|
||||
for (IConfigurationElement currentLoginField : current.getChildren("choiceField")) { //$NON-NLS-1$
|
||||
DynamicChoiceBean key = new DynamicChoiceBean(currentLoginField.getAttribute("id"), //$NON-NLS-1$
|
||||
currentLoginField.getAttribute("name")); //$NON-NLS-1$
|
||||
for (IConfigurationElement currentChoice : currentLoginField.getChildren("choice")) { //$NON-NLS-1$
|
||||
String value = currentChoice.getAttribute("value"); //$NON-NLS-1$
|
||||
String label = currentChoice.getAttribute("label"); //$NON-NLS-1$
|
||||
key.addChoice(value, label);
|
||||
}
|
||||
currentAction.getChoices().add(key);
|
||||
}
|
||||
if (ArrayUtils.contains(hiddenRepository, currentAction.getId())) {
|
||||
continue;
|
||||
}
|
||||
list.add(currentAction);
|
||||
} catch (CoreException e) {
|
||||
// e.printStackTrace();
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static IRepositoryFactory getRepositoriyById(String id) {
|
||||
for (IRepositoryFactory current : getAvailableRepositories()) {
|
||||
if (current.getId().equals(id)) {
|
||||
return current;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -349,7 +349,7 @@ public class XmiResourceManager {
|
||||
return itemResource;
|
||||
}
|
||||
|
||||
private Resource createItemResource(boolean byteArrayResource, URI itemResourceURI) {
|
||||
public Resource createItemResource(boolean byteArrayResource, URI itemResourceURI) {
|
||||
Resource itemResource;
|
||||
itemResource = getResourceSet().getResource(itemResourceURI, false);
|
||||
if (itemResource != null) {
|
||||
|
||||
@@ -129,8 +129,7 @@ Require-Bundle: org.eclipse.jdt.core,
|
||||
jackson-core-asl,
|
||||
org.talend.libraries.jackson,
|
||||
org.eclipse.m2e.core,
|
||||
org.talend.libraries.apache.common,
|
||||
org.talend.signon.util
|
||||
org.talend.libraries.apache.common
|
||||
Bundle-Activator: org.talend.core.runtime.CoreRuntimePlugin
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-ClassPath: .,
|
||||
|
||||
@@ -22,8 +22,7 @@ bin.includes = META-INF/,\
|
||||
plugin_ja.properties,\
|
||||
plugin_ru.properties,\
|
||||
plugin_swtbot.properties,\
|
||||
plugin_zh_CN.properties,\
|
||||
resources/
|
||||
plugin_zh_CN.properties
|
||||
src.includes = META-INF/,\
|
||||
mappingMetadataTypes.xml,\
|
||||
mappings/,\
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
## Component
|
||||
tSnowflakeConfiguration=java.base/java.nio
|
||||
tSnowflakeInput=java.base/java.nio
|
||||
tSnowflakeOutput=java.base/java.nio
|
||||
|
||||
tFTPClose=java.base/sun.security.ssl,java.base/sun.security.util
|
||||
tFTPConnection=java.base/sun.security.ssl,java.base/sun.security.util
|
||||
tFTPDelete=java.base/sun.security.ssl,java.base/sun.security.util
|
||||
tFTPFileExist=java.base/sun.security.ssl,java.base/sun.security.util
|
||||
tFTPFileList=java.base/sun.security.ssl,java.base/sun.security.util
|
||||
tFTPFileProperties=java.base/sun.security.ssl,java.base/sun.security.util
|
||||
tFTPGet=java.base/sun.security.ssl,java.base/sun.security.util
|
||||
tFTPPut=java.base/sun.security.ssl,java.base/sun.security.util
|
||||
tFTPRename=java.base/sun.security.ssl,java.base/sun.security.util
|
||||
tFTPTruncate=java.base/sun.security.ssl,java.base/sun.security.util
|
||||
|
||||
tNeo4jBatchOutput=java.base/java.lang,java.base/sun.nio.ch
|
||||
tNeo4jBatchOutputRelationship=java.base/java.lang,java.base/sun.nio.ch
|
||||
tNeo4jBatchSchema=java.base/java.lang,java.base/sun.nio.ch
|
||||
tNeo4jClose=java.base/java.lang,java.base/sun.nio.ch
|
||||
tNeo4jConnection=java.base/java.lang,java.base/sun.nio.ch
|
||||
tNeo4jImportTool=java.base/java.lang,java.base/sun.nio.ch
|
||||
tNeo4jInput=java.base/java.lang,java.base/sun.nio.ch
|
||||
tNeo4jRow=java.base/java.lang,java.base/sun.nio.ch
|
||||
|
||||
tMatchGroup=java.base/java.io
|
||||
tRuleSurvivorship=java.base/java.lang
|
||||
tRecordMatching=java.base/java.io
|
||||
tDqReportRun=java.base/java.lang
|
||||
|
||||
tWebService=java.base/java.lang
|
||||
tWebServiceInput=java.base/java.lang
|
||||
|
||||
## TCK framework
|
||||
TCK_COMMON_ARGS=java.base/java.io,java.base/java.lang.invoke,java.base/java.lang.reflect,java.base/java.lang,java.base/java.net,java.base/java.nio,java.base/java.util,java.base/sun.nio.ch
|
||||
|
||||
## BigData distribution
|
||||
SPARK_3_3_x=java.base/java.nio,java.base/sun.nio.ch,java.base/java.util,java.base/java.lang.invoke,java.base/sun.util.calendar
|
||||
SPARK_3_2_x=java.base/java.nio,java.base/sun.nio.ch,java.base/java.util,java.base/java.lang.invoke,java.base/sun.util.calendar
|
||||
SPARK_3_1_x=java.base/java.nio,java.base/sun.nio.ch,java.base/java.util,java.base/java.lang.invoke,java.base/sun.util.calendar
|
||||
SPARK_2_4_x=java.base/java.nio,java.base/sun.nio.ch,java.base/java.util,java.base/java.lang.invoke,java.base/sun.util.calendar
|
||||
@@ -58,8 +58,6 @@ public final class JavaUtils {
|
||||
|
||||
public static final List<String> AVAILABLE_VERSIONS = Arrays.asList(JavaCore.VERSION_1_8 );
|
||||
|
||||
public static final String ALLOW_JAVA_INTERNAL_ACCESS = "allow.java.internal.access"; //$NON-NLS-1$
|
||||
|
||||
public static final String PROCESSOR_TYPE = "javaProcessor"; //$NON-NLS-1$
|
||||
|
||||
public static final String PATH_SEPARATOR = "/"; //$NON-NLS-1$
|
||||
|
||||
@@ -15,10 +15,8 @@ package org.talend.core.context;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.properties.User;
|
||||
import org.talend.core.service.ICloudSignOnService;
|
||||
|
||||
/**
|
||||
* DOC smallet class global comment. Detailled comment <br/>
|
||||
@@ -141,14 +139,6 @@ public class RepositoryContext {
|
||||
* @return the clearPassword
|
||||
*/
|
||||
public String getClearPassword() {
|
||||
try {
|
||||
if (ICloudSignOnService.get() != null && ICloudSignOnService.get().isSignViaCloud()) {
|
||||
return ICloudSignOnService.get().getLatestToken().getAccessToken();
|
||||
}
|
||||
}catch (Exception ex) {
|
||||
ExceptionHandler.process(ex);
|
||||
}
|
||||
|
||||
return clearPassword;
|
||||
}
|
||||
|
||||
|
||||
@@ -147,15 +147,8 @@ public enum EDatabaseTypeName {
|
||||
|
||||
MAPRDB(
|
||||
"MapRDB", "MapRDB", Boolean.FALSE, "MAPRDB", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.Column_Family, true),//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
|
||||
SNOWFLAKE(
|
||||
"SNOWFLAKE",
|
||||
"SNOWFLAKE",
|
||||
Boolean.TRUE,
|
||||
"SNOWFLAKE",
|
||||
EDatabaseSchemaOrCatalogMapping.None,
|
||||
EDatabaseSchemaOrCatalogMapping.None,
|
||||
true);
|
||||
"SNOWFLAKE","SNOWFLAKE",Boolean.TRUE,"SNOWFLAKE",EDatabaseSchemaOrCatalogMapping.None, EDatabaseSchemaOrCatalogMapping.None);
|
||||
|
||||
// displayName is used in Java code.
|
||||
private String displayName;
|
||||
|
||||
@@ -387,8 +387,6 @@ public class ConnParameterKeys {
|
||||
|
||||
public static final String CONN_PARA_KEY_KNOX_DIRECTORY="CONN_PARA_KEY_KNOX_DIRECTORY";
|
||||
|
||||
public static final String CONN_PARA_KEY_KNOX_TIMEOUT="CONN_PARA_KEY_KNOX_TIMEOUT";
|
||||
|
||||
// CDE
|
||||
public static final String CONN_PARA_KEY_CDE_API_ENDPOINT="CONN_PARA_KEY_CDE_API_ENDPOINT";
|
||||
public static final String CONN_PARA_KEY_CDE_TOKEN="CONN_PARA_KEY_CDE_TOKEN";
|
||||
|
||||
32
main/plugins/org.talend.core.runtime/src/main/java/org/talend/core/model/context/ContextUtils.java
Executable file → Normal file
32
main/plugins/org.talend.core.runtime/src/main/java/org/talend/core/model/context/ContextUtils.java
Executable file → Normal file
@@ -222,32 +222,6 @@ public class ContextUtils {
|
||||
}
|
||||
return parameterType;
|
||||
}
|
||||
|
||||
// TUP-36519:For possible duplicate internalid scenario(TUP-36667) after several times' renaming in joblet. Loop all and find the nearest
|
||||
// one.
|
||||
public static ContextParameterType getContextParameterTypeById(ContextType contextType, final String uuId,
|
||||
boolean isFromContextItem, String paraName) {
|
||||
if (contextType == null || uuId == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ContextParameterType parameterType = null;
|
||||
for (ContextParameterType param : (List<ContextParameterType>) contextType.getContextParameter()) {
|
||||
String paramId = null;
|
||||
if (isFromContextItem) {
|
||||
paramId = ResourceHelper.getUUID(param);
|
||||
} else {
|
||||
paramId = param.getInternalId();
|
||||
}
|
||||
if (uuId.equals(paramId)) {
|
||||
parameterType = param;
|
||||
if (paraName != null && StringUtils.equals(paraName, param.getName())) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return parameterType;
|
||||
}
|
||||
|
||||
public static ContextParameterType getContextParameterTypeById(ContextType contextType, final String uuId,
|
||||
boolean isFromContextItem) {
|
||||
@@ -872,7 +846,7 @@ public class ContextUtils {
|
||||
if (item != null) {
|
||||
final ContextType repoContextType = ContextUtils.getContextTypeByName(item, contextType.getName());
|
||||
ContextParameterType repoContextParam = ContextUtils.getContextParameterTypeById(repoContextType,
|
||||
paramLink.getId(), item instanceof ContextItem, contextParameterType.getName());
|
||||
paramLink.getId(), item instanceof ContextItem);
|
||||
if (repoContextParam != null
|
||||
&& !StringUtils.equals(repoContextParam.getName(), contextParameterType.getName())) {
|
||||
renamedMap.put(repoContextParam.getName(), contextParameterType.getName());
|
||||
@@ -941,7 +915,7 @@ public class ContextUtils {
|
||||
if (item != null) {
|
||||
ContextType contextType = ContextUtils.getContextTypeByName(item, context.getName());
|
||||
ContextParameterType repoParameterType = ContextUtils.getContextParameterTypeById(contextType,
|
||||
parameterLink.getId(), item instanceof ContextItem, parameterType.getName());
|
||||
parameterLink.getId(), item instanceof ContextItem);
|
||||
if (repoParameterType != null
|
||||
&& !StringUtils.equals(repoParameterType.getName(), parameterType.getName())) {
|
||||
renamedMap.put(repoParameterType.getName(), parameterType.getName());
|
||||
@@ -1001,7 +975,7 @@ public class ContextUtils {
|
||||
ContextParameterType contextParameterType = null;
|
||||
if (paramLink != null && paramLink.getId() != null && contextType != null) {
|
||||
contextParameterType = getContextParameterTypeById(contextType, paramLink.getId(),
|
||||
contextItem instanceof ContextItem, paramName);
|
||||
contextItem instanceof ContextItem);
|
||||
}
|
||||
if (contextParameterType != null) {// Compare use UUID
|
||||
if (!StringUtils.equals(contextParameterType.getName(), paramName)) {
|
||||
|
||||
@@ -17,15 +17,10 @@ import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.core.pendo.PendoTrackSender;
|
||||
import org.talend.core.runtime.i18n.Messages;
|
||||
import org.talend.core.service.ICloudSignOnService;
|
||||
import org.talend.repository.model.RepositoryConstants;
|
||||
import org.talend.signon.util.TMCRepositoryUtil;
|
||||
import org.talend.signon.util.TokenMode;
|
||||
import org.talend.utils.json.JSONException;
|
||||
import org.talend.utils.json.JSONObject;
|
||||
|
||||
@@ -63,14 +58,12 @@ public class ConnectionBean implements Cloneable {
|
||||
|
||||
private static final String TOKEN = "token"; //$NON-NLS-1$
|
||||
|
||||
private static final String URL = "url"; //$NON-NLS-1$
|
||||
|
||||
private static final String STORECREDENTIALS = "storeCredentials"; //$NON-NLS-1$
|
||||
|
||||
private String credentials = ""; //$NON-NLS-1$
|
||||
|
||||
public static final String CLOUD_TOKEN_ID ="cloud_token"; //$NON-NLS-1$
|
||||
|
||||
private static final String LOGIN_VIA_CLOUD = "login_via_cloud"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* DOC smallet ConnectionBean constructor comment.
|
||||
*/
|
||||
@@ -96,24 +89,6 @@ public class ConnectionBean implements Cloneable {
|
||||
newConnection.setPassword(""); //$NON-NLS-1$
|
||||
return newConnection;
|
||||
}
|
||||
|
||||
public static ConnectionBean getDefaultCloudConnectionBean(String dataCenter) {
|
||||
ConnectionBean newConnection = new ConnectionBean();
|
||||
newConnection.setName(Messages.getString("ConnectionBean.Cloud.name", TMCRepositoryUtil.getDisplayNameByDatacenter(dataCenter))); //$NON-NLS-1$
|
||||
newConnection.setDescription(Messages.getString("ConnectionBean.CloudConnection.description", TMCRepositoryUtil.getDisplayNameByDatacenter(dataCenter))); //$NON-NLS-1$
|
||||
newConnection.setRepositoryId(TMCRepositoryUtil.getRepositoryId(dataCenter));
|
||||
newConnection.setToken(true);
|
||||
newConnection.setStoreCredentials(true);
|
||||
newConnection.setComplete(true);
|
||||
newConnection.setLoginViaCloud(true);
|
||||
newConnection.setWorkSpace(getRecentWorkSpace());
|
||||
return newConnection;
|
||||
}
|
||||
|
||||
protected static String getRecentWorkSpace() {
|
||||
String filePath = new Path(Platform.getInstanceLocation().getURL().getPath()).toFile().getPath();
|
||||
return filePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for ID.
|
||||
@@ -209,22 +184,13 @@ public class ConnectionBean implements Cloneable {
|
||||
*/
|
||||
public String getPassword() {
|
||||
try {
|
||||
|
||||
if (conDetails.has(PASSWORD)) {
|
||||
if (isStoreCredentials() && credentials != null) {
|
||||
return this.credentials;
|
||||
}
|
||||
return conDetails.getString(PASSWORD);
|
||||
} else if (conDetails.has(CLOUD_TOKEN_ID)){
|
||||
String object = conDetails.getString(CLOUD_TOKEN_ID);
|
||||
TokenMode token = TokenMode.parseFromJson(object, null);
|
||||
if (ICloudSignOnService.get() != null) {
|
||||
token = ICloudSignOnService.get().getLatestToken();
|
||||
this.setConnectionToken(token);
|
||||
}
|
||||
return token.getAccessToken();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return "";
|
||||
@@ -249,7 +215,7 @@ public class ConnectionBean implements Cloneable {
|
||||
* @return the user
|
||||
*/
|
||||
public String getUser() {
|
||||
try {
|
||||
try {
|
||||
if (conDetails.has(USER)) {
|
||||
String user = conDetails.getString(USER);
|
||||
if (isToken()) {
|
||||
@@ -260,7 +226,7 @@ public class ConnectionBean implements Cloneable {
|
||||
}
|
||||
}
|
||||
return user;
|
||||
}
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
@@ -354,25 +320,6 @@ public class ConnectionBean implements Cloneable {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isLoginViaCloud() {
|
||||
try {
|
||||
if (conDetails.has(LOGIN_VIA_CLOUD)) {
|
||||
return (Boolean) conDetails.get(LOGIN_VIA_CLOUD);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
// do nothing
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setLoginViaCloud(boolean isLoginViaCloud) {
|
||||
try {
|
||||
conDetails.put(LOGIN_VIA_CLOUD, isLoginViaCloud);
|
||||
} catch (JSONException e) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConnectionBean clone() throws CloneNotSupportedException {
|
||||
@@ -471,21 +418,14 @@ public class ConnectionBean implements Cloneable {
|
||||
|
||||
public String getUrl() {
|
||||
try {
|
||||
if (dynamicFields.containsKey(RepositoryConstants.REPOSITORY_URL)) {
|
||||
return dynamicFields.get(RepositoryConstants.REPOSITORY_URL);
|
||||
}
|
||||
if (conDetails.has(RepositoryConstants.REPOSITORY_URL)) {
|
||||
return conDetails.getString(RepositoryConstants.REPOSITORY_URL);
|
||||
if (conDetails.has(URL)) {
|
||||
return conDetails.getString(URL);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
dynamicFields.put(RepositoryConstants.REPOSITORY_URL, url);
|
||||
}
|
||||
|
||||
public boolean isStoreCredentials() {
|
||||
try {
|
||||
@@ -513,27 +453,4 @@ public class ConnectionBean implements Cloneable {
|
||||
public void setCredentials(String credentials) {
|
||||
this.credentials = credentials;
|
||||
}
|
||||
|
||||
|
||||
public TokenMode getConnectionToken() {
|
||||
try {
|
||||
if (conDetails.has(CLOUD_TOKEN_ID)) {
|
||||
String object = conDetails.getString(CLOUD_TOKEN_ID);
|
||||
return TokenMode.parseFromJson(object, null);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public void setConnectionToken(TokenMode connectionToken) {
|
||||
try {
|
||||
conDetails.put(CLOUD_TOKEN_ID, TokenMode.writeToJson(connectionToken));
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,51 +2,41 @@ package org.talend.core.model.metadata;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.talend.core.model.process.IElementParameter;
|
||||
import org.talend.core.model.process.INode;
|
||||
|
||||
public class SparkBatchMetadataTalendTypeFilter
|
||||
extends SparkMetadataTalendTypeFilter {
|
||||
public class SparkBatchMetadataTalendTypeFilter extends SparkMetadataTalendTypeFilter{
|
||||
|
||||
private INode node;
|
||||
private INode node;
|
||||
|
||||
public static List<String> dynamicTypeCompatibleComponents = Arrays.asList(
|
||||
"tDeltaLakeInput",
|
||||
"tDeltaLakeOutput",
|
||||
"tFileInputDelimited",
|
||||
"tFileInputParquet",
|
||||
"tFileOutputParquet",
|
||||
"tJDBCInput",
|
||||
"tJDBCOutput",
|
||||
"tLogRow",
|
||||
"tMongoDBInput",
|
||||
"tMongoDBOutput",
|
||||
"tSqlRow"
|
||||
);
|
||||
public static List<String> dynamicTypeCompatibleComponents = Arrays.asList(
|
||||
"tDeltaLakeInput",
|
||||
"tDeltaLakeOutput",
|
||||
"tFileInputParquet",
|
||||
"tFileOutputParquet",
|
||||
"tJDBCInput",
|
||||
"tJDBCOutput", "tLogRow", "tSqlRow"
|
||||
);
|
||||
|
||||
public SparkBatchMetadataTalendTypeFilter(INode node) {
|
||||
super(node.getComponent().getName());
|
||||
this.node = node;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getComponentSpecificTypes() {
|
||||
// For the moment only dynamic type is a component specific type
|
||||
// dynamic type is available under 2 conditions : job uses Dataset API and component is listed in
|
||||
// dynamicTypeCompatibleComponents
|
||||
INode configNode = node
|
||||
.getProcess()
|
||||
.getNodesOfType("tSparkConfiguration")
|
||||
.get(0);
|
||||
IElementParameter param = configNode.getElementParameter("USE_DATASET_API");
|
||||
if (Boolean.FALSE.equals(param.getValue())) {
|
||||
return null;
|
||||
public SparkBatchMetadataTalendTypeFilter(INode node) {
|
||||
super(node.getComponent().getName());
|
||||
this.node = node;
|
||||
}
|
||||
if (
|
||||
dynamicTypeCompatibleComponents.contains(node.getComponent().getName())
|
||||
) {
|
||||
return Arrays.asList(SparkMetadataTalendTypeFilter.DYNAMIC);
|
||||
|
||||
@Override
|
||||
public List<String> getComponentSpecificTypes() {
|
||||
// For the moment only dynamic type is a component specific type
|
||||
// dynamic type is available under 2 conditions : job uses Dataset API and component is listed in
|
||||
// dynamicTypeCompatibleComponents
|
||||
INode configNode = node.getProcess().getNodesOfType("tSparkConfiguration").get(0);
|
||||
IElementParameter param = configNode.getElementParameter("USE_DATASET_API");
|
||||
if (Boolean.FALSE.equals(param.getValue())) {
|
||||
return null;
|
||||
}
|
||||
if (dynamicTypeCompatibleComponents.contains(node.getComponent().getName())) {
|
||||
return Arrays.asList(SparkMetadataTalendTypeFilter.DYNAMIC);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
4
main/plugins/org.talend.core.runtime/src/main/java/org/talend/core/model/update/RepositoryUpdateManager.java
Executable file → Normal file
4
main/plugins/org.talend.core.runtime/src/main/java/org/talend/core/model/update/RepositoryUpdateManager.java
Executable file → Normal file
@@ -359,9 +359,7 @@ public abstract class RepositoryUpdateManager {
|
||||
List<UpdateResult> checkedResults = null;
|
||||
|
||||
if (parameter == null) { // update all job
|
||||
// TUP-36519: comment out the filter for only opening job
|
||||
// checkedResults = filterSpecialCheckedResult(results);
|
||||
checkedResults = results;
|
||||
checkedResults = filterSpecialCheckedResult(results);
|
||||
} else { // filter
|
||||
checkedResults = filterCheckedResult(results);
|
||||
}
|
||||
|
||||
@@ -19,17 +19,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.utils.VersionUtils;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.properties.ProjectReference;
|
||||
import org.talend.core.pendo.properties.IPendoDataProperties;
|
||||
import org.talend.core.pendo.properties.PendoLoginProperties;
|
||||
import org.talend.core.service.ICloudSignOnService;
|
||||
import org.talend.core.service.IStudioLiteP2Service;
|
||||
import org.talend.core.service.IStudioLiteP2Service.UpdateSiteConfig;
|
||||
import org.talend.core.ui.IInstalledPatchService;
|
||||
import org.talend.repository.ProjectManager;
|
||||
import org.talend.utils.json.JSONObject;
|
||||
@@ -85,18 +81,6 @@ public class PendoTrackDataUtil {
|
||||
loginEvent.setEnabledFeatures(enabledFeatures);
|
||||
}
|
||||
setUpRefProjectsStructure(loginEvent);
|
||||
loginEvent.setIsOneClickLogin(Boolean.FALSE.toString());
|
||||
if (ICloudSignOnService.get() != null && ICloudSignOnService.get().isSignViaCloud()) {
|
||||
loginEvent.setIsOneClickLogin(Boolean.TRUE.toString());
|
||||
}
|
||||
loginEvent.setManagedUpdate(Boolean.FALSE.toString());
|
||||
if (IStudioLiteP2Service.get() != null) {
|
||||
IProgressMonitor monitor = new NullProgressMonitor();
|
||||
UpdateSiteConfig config = IStudioLiteP2Service.get().getUpdateSiteConfig(monitor);
|
||||
if (config.isEnableTmcUpdateSettings(monitor) && !config.isOverwriteTmcUpdateSettings(monitor)) {
|
||||
loginEvent.setManagedUpdate(Boolean.TRUE.toString());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
|
||||
@@ -36,12 +36,6 @@ public class PendoLoginProperties implements IPendoDataProperties {
|
||||
@JsonProperty("referenced_projects")
|
||||
private List<String> refProjectList;
|
||||
|
||||
@JsonProperty("one_click_login")
|
||||
private String isOneClickLogin;
|
||||
|
||||
@JsonProperty("managed_update")
|
||||
private String managedUpdate;
|
||||
|
||||
/**
|
||||
* Getter for studio_version.
|
||||
*
|
||||
@@ -132,40 +126,4 @@ public class PendoLoginProperties implements IPendoDataProperties {
|
||||
this.refProjectList = refProjectList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for isOneClickLogin.
|
||||
*
|
||||
* @return the isOneClickLogin
|
||||
*/
|
||||
public String getIsOneClickLogin() {
|
||||
return isOneClickLogin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the isOneClickLogin.
|
||||
*
|
||||
* @param isOneClickLogin the isOneClickLogin to set
|
||||
*/
|
||||
public void setIsOneClickLogin(String isOneClickLogin) {
|
||||
this.isOneClickLogin = isOneClickLogin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for managedUpdate.
|
||||
*
|
||||
* @return the managedUpdate
|
||||
*/
|
||||
public String getManagedUpdate() {
|
||||
return managedUpdate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the managedUpdate.
|
||||
*
|
||||
* @param managedUpdate the managedUpdate to set
|
||||
*/
|
||||
public void setManagedUpdate(String managedUpdate) {
|
||||
this.managedUpdate = managedUpdate;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -48,8 +48,6 @@ public class PendoSignImportProperties implements IPendoDataProperties {
|
||||
@JsonProperty("valid_migration_token")
|
||||
private String validMigrationToken;
|
||||
|
||||
@JsonProperty("import_product")
|
||||
private List<String> importProduct;
|
||||
|
||||
/**
|
||||
* Getter for sourceVersion.
|
||||
@@ -210,23 +208,4 @@ public class PendoSignImportProperties implements IPendoDataProperties {
|
||||
this.validMigrationToken = validMigrationToken;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Getter for importProduct.
|
||||
* @return the importProduct
|
||||
*/
|
||||
public List<String> getImportProduct() {
|
||||
return importProduct;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the importProduct.
|
||||
* @param importProduct the importProduct to set
|
||||
*/
|
||||
public void setImportProduct(List<String> importProduct) {
|
||||
this.importProduct = importProduct;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -91,13 +91,13 @@ public class PendoTMapProperties implements IPendoDataProperties {
|
||||
* Number of input columns which are mapped to multiple output columns, either mapped directly or mapped through the
|
||||
* Var column
|
||||
*/
|
||||
@JsonProperty("mapping_1_to_n")
|
||||
@JsonProperty("1-to-n mapping")
|
||||
private int oneToNMappings;
|
||||
|
||||
/**
|
||||
* Number of output columns which have multiple source columns, either input columns or var columns
|
||||
*/
|
||||
@JsonProperty("mapping_n_to_1")
|
||||
@JsonProperty("n-to-1 mapping")
|
||||
private int nToOneMappings;
|
||||
|
||||
/**
|
||||
|
||||
@@ -552,8 +552,6 @@ BusinessAppearanceComposite.textAlignment.vertical.centre=Centre
|
||||
ConnectionBean.Local=Local
|
||||
ConnectionBean.Remote=Remote
|
||||
ConnectionBean.DefaultConnection=Default connection
|
||||
ConnectionBean.Cloud.name=Signed in: Cloud ({0})
|
||||
ConnectionBean.CloudConnection.description=Remote connection to Cloud - Signed in: Cloud ({0})
|
||||
InegerCellEditorListener.NegativeNumberMessage=The value of {0} can't be set by negative number.
|
||||
InegerCellEditorListener.NumeralMessage=The value of {0} should be numeral.
|
||||
OpenXSDFileDialog.cancel=Cancel
|
||||
|
||||
@@ -552,8 +552,6 @@ BusinessAppearanceComposite.textAlignment.vertical.centre=Centre
|
||||
ConnectionBean.Local=Local
|
||||
ConnectionBean.Remote=Distant
|
||||
ConnectionBean.DefaultConnection=Connexion par d\u00E9faut
|
||||
ConnectionBean.Cloud.name=Connect\u00E9(e) \u00E0\u00A0: Cloud ({0})
|
||||
ConnectionBean.CloudConnection.description=Connexion distante au Cloud - Connect\u00E9(e) \u00E0\u00A0: Cloud ({0})
|
||||
InegerCellEditorListener.NegativeNumberMessage=La valeur de {0} ne peut \u00EAtre un nombre n\u00E9gatif.
|
||||
InegerCellEditorListener.NumeralMessage=La valeur de {0} doit \u00EAtre num\u00E9rique.
|
||||
OpenXSDFileDialog.cancel=Annuler
|
||||
@@ -577,7 +575,7 @@ repository.servicesPort=Port
|
||||
BinRepositoryNode.label=Corbeille
|
||||
HDFS=HDFS
|
||||
HCAT=HCAT
|
||||
AbstractRepositoryContentHandler.deleteNode.exception=\u00C9chec de la suppression des pertinences de n\u0153ud\u00A0: {0}
|
||||
AbstractRepositoryContentHandler.deleteNode.exception=\u00C9chec de la suppression des pertinences de noeud\u00A0: {0}
|
||||
HadoopCustomVersionDialog.topTitle=D\u00E9finition de la version Hadoop personnalis\u00E9e
|
||||
HadoopCustomVersionDialog.title=D\u00E9finir la distribution Hadoop personnalis\u00E9e
|
||||
HadoopCustomVersionDialog.msg=Configurer les biblioth\u00E8ques n\u00E9cessaires \u00E0 la version personnalis\u00E9e de Hadoop
|
||||
|
||||
@@ -184,7 +184,7 @@ AbstractTalendFunctionParser.checkMethod=\u30EB\u30FC\u30C1\u30F3: "{0}.{1}\\"\u
|
||||
JavaGlobalVariableProposal.Description=\u8AAC\u660E: {0}
|
||||
JavaGlobalVariableProposal.VariableName=\n\n\u5909\u6570\u540D: {1}
|
||||
JavaSimpleDateFormatProposalProvider.displaySingleQuote= ' : \u4E00\u91CD\u5F15\u7528\u7B26\u3092\u8868\u793A
|
||||
JavaSimpleDateFormatProposalProvider.quoteDisplayError=\uFF12\u3064\u306E\u4E00\u91CD\u5F15\u7528\u7B26\u3067\uFF11\u3064\u306E\u4E00\u91CD\u5F15\u7528\u7B26\u3092\u793A\u3057\u307E\u3059\u3002
|
||||
JavaSimpleDateFormatProposalProvider.quoteDisplayError=\uFF12\u3064\u306E\u30B7\u30F3\u30B0\u30EB\u30AF\u30A9\u30FC\u30C8\u3067\uFF11\u3064\u306E\u30B7\u30F3\u30B0\u30EB\u30AF\u30A9\u30FC\u30C8\u3092\u793A\u3057\u307E\u3059\u3002
|
||||
JavaTypesManager.bigDecimal=BIGDECIMAL\u306F\u6570\u5024\u3067\u3059:
|
||||
JavaTypesManager.integer=INTEGER\u306F\u6570\u5024\u3067\u3059:
|
||||
JavaTypesManager.list=LIST\u306F\u6570\u5024\u3067\u3059:
|
||||
@@ -552,8 +552,6 @@ BusinessAppearanceComposite.textAlignment.vertical.centre=\u4E2D\u5FC3
|
||||
ConnectionBean.Local=\u30ED\u30FC\u30AB\u30EB
|
||||
ConnectionBean.Remote=\u30EA\u30E2\u30FC\u30C8
|
||||
ConnectionBean.DefaultConnection=\u30C7\u30D5\u30A9\u30EB\u30C8\u63A5\u7D9A
|
||||
ConnectionBean.Cloud.name=\u30B5\u30A4\u30F3\u30A4\u30F3\u6E08\u307F: \u30AF\u30E9\u30A6\u30C9({0})
|
||||
ConnectionBean.CloudConnection.description=\u30AF\u30E9\u30A6\u30C9\u3078\u306E\u30EA\u30E2\u30FC\u30C8\u63A5\u7D9A - \u30B5\u30A4\u30F3\u30A4\u30F3\u6E08\u307F: \u30AF\u30E9\u30A6\u30C9({0})
|
||||
InegerCellEditorListener.NegativeNumberMessage={0}\u306B\u306F\u8CA0\u306E\u5024\u3092\u8A2D\u5B9A\u3067\u304D\u307E\u305B\u3093\u3002
|
||||
InegerCellEditorListener.NumeralMessage={0}\u306B\u306F\u6570\u5024\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
||||
OpenXSDFileDialog.cancel=\u30AD\u30E3\u30F3\u30BB\u30EB
|
||||
|
||||
@@ -552,8 +552,6 @@ BusinessAppearanceComposite.textAlignment.vertical.centre=\u4E2D\u592E
|
||||
ConnectionBean.Local=\u672C\u5730
|
||||
ConnectionBean.Remote=\u8FDC\u7A0B
|
||||
ConnectionBean.DefaultConnection=\u9ED8\u8BA4\u8FDE\u63A5
|
||||
ConnectionBean.Cloud.name=\u5DF2\u767B\u5F55: \u4E91\u7AEF ({0})
|
||||
ConnectionBean.CloudConnection.description=\u4E91\u7AEF\u8FDC\u7A0B\u8FDE\u63A5 - \u5DF2\u767B\u5F55: \u4E91\u7AEF ({0})
|
||||
InegerCellEditorListener.NegativeNumberMessage={0} \u7684\u503C\u4E0D\u80FD\u8BBE\u5B9A\u4E3A\u8D1F\u6570\u3002
|
||||
InegerCellEditorListener.NumeralMessage={0} \u7684\u503C\u5E94\u8BE5\u4E3A\u6570\u5B57\u3002
|
||||
OpenXSDFileDialog.cancel=\u53D6\u6D88
|
||||
|
||||
@@ -78,10 +78,5 @@ public interface IProjectSettingPreferenceConstants {
|
||||
public static final String TEMPLATE_DOCKER_PROFILE_POM = "template_docker_profile_pom_script"; //$NON-NLS-1$
|
||||
|
||||
public static final String USE_STRICT_REFERENCE_JOBLET = "use_strict_reference_joblet"; //$NON-NLS-1$
|
||||
|
||||
/*
|
||||
* Default microservices application properties
|
||||
*/
|
||||
public static final String MS_APPLICATION_PROPERTIES = "ms_application_properties";
|
||||
|
||||
}
|
||||
|
||||
@@ -19,8 +19,6 @@ package org.talend.core.runtime.projectsetting;
|
||||
public interface IProjectSettingTemplateConstants {
|
||||
|
||||
final static String PATH_RESOURCES = "resources";
|
||||
|
||||
final static String PATH_APPLICATION_PROPERTIES = PATH_RESOURCES + '/' + "application.properties";
|
||||
|
||||
final static String PATH_RESOURCES_TEMPLATES = PATH_RESOURCES + '/' + "templates";
|
||||
|
||||
|
||||
@@ -1,171 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2022 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.runtime.util;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Optional;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.talend.commons.CommonsPlugin;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.utils.generation.JavaUtils;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.process.EParameterFieldType;
|
||||
import org.talend.core.model.process.JobInfo;
|
||||
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.runtime.CoreRuntimePlugin;
|
||||
import org.talend.core.runtime.projectsetting.ProjectPreferenceManager;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.NodeType;
|
||||
import org.talend.designer.runprocess.IProcessor;
|
||||
import org.talend.repository.ProjectManager;
|
||||
|
||||
public class ModuleAccessHelper {
|
||||
|
||||
private static final String FORMAT_ADD_OPPENS = "--add-opens=@=ALL-UNNAMED"; //$NON-NLS-1$
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(ModuleAccessHelper.class);
|
||||
|
||||
private static final Properties PROPS = new Properties();
|
||||
|
||||
static {
|
||||
Bundle bundle = Platform.getBundle(CoreRuntimePlugin.PLUGIN_ID);
|
||||
URL templateUrl = bundle.getEntry("resources/module_access.properties"); //$NON-NLS-1$
|
||||
try (InputStream input = templateUrl.openStream()) {
|
||||
PROPS.load(input);
|
||||
} catch (IOException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean containsKey(String key) {
|
||||
return PROPS.containsKey(key);
|
||||
}
|
||||
|
||||
private static Set<String> getModules(String key) {
|
||||
String modules = PROPS.getProperty(key);
|
||||
if (modules != null) {
|
||||
return Stream.of(modules.split(",")).map(module -> FORMAT_ADD_OPPENS.replace("@", module)) //$NON-NLS-1$ //$NON-NLS-2$
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
private static boolean allowJavaInternalAcess(Property property) {
|
||||
boolean isJava17 = false;
|
||||
String javaVersion = System.getProperty("java.version"); //$NON-NLS-1$
|
||||
String[] arr = javaVersion.split("\\.");
|
||||
try {
|
||||
isJava17 = Integer.parseInt(arr[0]) >= 17;
|
||||
} catch (NumberFormatException e) {
|
||||
LOGGER.error("Failed to parse java.version: " + javaVersion); //$NON-NLS-1$
|
||||
isJava17 = false;
|
||||
}
|
||||
if (isJava17) {
|
||||
String allow = System.getProperty(JavaUtils.ALLOW_JAVA_INTERNAL_ACCESS);
|
||||
if (allow != null) {
|
||||
return Boolean.valueOf(allow);
|
||||
}
|
||||
if (CommonsPlugin.isTUJTest()) {
|
||||
return true;
|
||||
}
|
||||
Project project;
|
||||
if (property != null) {
|
||||
project = ProjectManager.getInstance()
|
||||
.getProjectFromProjectTechLabel(ProjectManager.getInstance().getProject(property).getTechnicalLabel());
|
||||
} else {
|
||||
project = ProjectManager.getInstance().getCurrentProject();
|
||||
}
|
||||
ProjectPreferenceManager preferenceManager = new ProjectPreferenceManager(project, CoreRuntimePlugin.PLUGIN_ID,
|
||||
false);
|
||||
return preferenceManager.getBoolean(JavaUtils.ALLOW_JAVA_INTERNAL_ACCESS);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static Set<String> getModuleAccessVMArgsForProcessor(IProcessor processor) {
|
||||
Property property = processor.getProperty();
|
||||
if (property == null || property.getItem() == null || !allowJavaInternalAcess(property)) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
ProcessItem mainJobItem = (ProcessItem) property.getItem();
|
||||
Set<JobInfo> allJobInfos = new HashSet<>();
|
||||
allJobInfos.add(new JobInfo(mainJobItem, mainJobItem.getProcess().getDefaultContext()));
|
||||
allJobInfos.addAll(processor.getBuildChildrenJobsAndJoblets());
|
||||
return ModuleAccessHelper.getModuleAccessVMArgs(property, allJobInfos);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Set<String> getModuleAccessVMArgs(Property property, Set<JobInfo> allJobInfos) {
|
||||
if (property == null || property.getItem() == null || !allowJavaInternalAcess(property)) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
Set<String> vmArgs = new HashSet<>();
|
||||
boolean hasTck = false;
|
||||
for (JobInfo info : allJobInfos) {
|
||||
EList<NodeType> nodes = null;
|
||||
EList<ElementParameterType> parameters = null;
|
||||
if (info.getJobletProperty() != null) {
|
||||
JobletProcessItem item = (JobletProcessItem) info.getJobletProperty().getItem();
|
||||
if (item.getJobletProcess() != null) {
|
||||
nodes = item.getJobletProcess().getNode();
|
||||
if (item.getJobletProcess().getParameters() != null) {
|
||||
parameters = item.getJobletProcess().getParameters().getElementParameter();
|
||||
}
|
||||
}
|
||||
} else if (info.getProcessItem() != null && info.getProcessItem().getProcess() != null) {
|
||||
nodes = info.getProcessItem().getProcess().getNode();
|
||||
if (info.getProcessItem().getProcess().getParameters() != null) {
|
||||
parameters = info.getProcessItem().getProcess().getParameters().getElementParameter();
|
||||
}
|
||||
}
|
||||
if (nodes != null) {
|
||||
nodes.stream().filter(node -> containsKey(node.getComponentName()))
|
||||
.forEach(node -> vmArgs.addAll(getModules(node.getComponentName())));
|
||||
}
|
||||
if (parameters != null) {
|
||||
// FIXME currently it depends on spark version, refine the condition if needed
|
||||
Optional<ElementParameterType> optional = parameters.stream()
|
||||
.filter(p -> "SUPPORTED_SPARK_VERSION".equals(p.getName()) && containsKey(p.getValue())).findFirst();
|
||||
if (optional.isPresent()) {
|
||||
vmArgs.addAll(getModules(optional.get().getValue()));
|
||||
}
|
||||
}
|
||||
if (!hasTck) {
|
||||
hasTck = nodes.stream()
|
||||
.anyMatch(node -> node.getElementParameter().stream()
|
||||
.anyMatch(p -> ((ElementParameterType) p).getField() != null
|
||||
&& EParameterFieldType.TECHNICAL.getName().equals(((ElementParameterType) p).getField())
|
||||
&& ((ElementParameterType) p).getName().equals("TACOKIT_COMPONENT_ID")));
|
||||
}
|
||||
}
|
||||
if (hasTck) {
|
||||
vmArgs.addAll(getModules("TCK_COMMON_ARGS"));
|
||||
}
|
||||
return vmArgs;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.service;
|
||||
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.IService;
|
||||
import org.talend.signon.util.TokenMode;
|
||||
import org.talend.signon.util.listener.LoginEventListener;
|
||||
|
||||
public interface ICloudSignOnService extends IService {
|
||||
|
||||
TokenMode getToken(String authCode, String codeVerifier, String dataCenter) throws Exception;
|
||||
|
||||
void startHeartBeat() throws Exception;
|
||||
|
||||
void stopHeartBeat();
|
||||
|
||||
String generateCodeVerifier();
|
||||
|
||||
String getCodeChallenge(String seed) throws Exception;
|
||||
|
||||
boolean hasValidToken() throws Exception;
|
||||
|
||||
String getTokenUser(String url, TokenMode token) throws Exception;
|
||||
|
||||
void signonCloud(LoginEventListener listener) throws Exception;
|
||||
|
||||
TokenMode getLatestToken() throws Exception;
|
||||
|
||||
public boolean refreshToken() throws Exception;
|
||||
|
||||
boolean isSignViaCloud();
|
||||
|
||||
boolean isNeedShowSSOPage();
|
||||
|
||||
public void showReloginDialog();
|
||||
|
||||
public boolean isReloginDialogRunning();
|
||||
|
||||
public void reload();
|
||||
|
||||
public static ICloudSignOnService get() {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICloudSignOnService.class)) {
|
||||
return GlobalServiceRegister.getDefault().getService(ICloudSignOnService.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -81,8 +81,6 @@ public interface ITestContainerProviderService extends IService {
|
||||
|
||||
public List<ProcessItem> getAllTestContainers(ProcessItem item);
|
||||
|
||||
public List<ProcessItem> getAllTestContainers(ProcessItem item, boolean latest, boolean excludeDeleted);
|
||||
|
||||
public void copyDataSetFiles(IProcess process, IPath srcPath);
|
||||
|
||||
public String getTestDataValue(IProcess process, String instance, String testData);
|
||||
|
||||
@@ -160,8 +160,6 @@ public interface IRunProcessService extends IService {
|
||||
|
||||
public void checkLastGenerationHasCompilationError(boolean updateProblemsView) throws ProcessorException;
|
||||
|
||||
public void checkLastGenerationHasCompilationError(boolean updateProblemsView, boolean isJob) throws ProcessorException;
|
||||
|
||||
/**
|
||||
* DOC ycbai Comment method "getResourceFilePath".
|
||||
*
|
||||
|
||||
@@ -32,7 +32,6 @@ import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.core.model.general.ConnectionBean;
|
||||
import org.talend.core.service.ICloudSignOnService;
|
||||
import org.talend.utils.json.JSONArray;
|
||||
import org.talend.utils.json.JSONException;
|
||||
import org.talend.utils.json.JSONObject;
|
||||
@@ -159,8 +158,6 @@ public class ConnectionUserPerReader {
|
||||
}
|
||||
if (cons == null || cons.size() == 0) {
|
||||
proper.remove("connection.users");//$NON-NLS-1$
|
||||
proper.remove("connection.define");//$NON-NLS-1$
|
||||
proper.remove("connection.lastConnection");//$NON-NLS-1$
|
||||
} else {
|
||||
JSONArray usersJsonArray = new JSONArray();
|
||||
for (ConnectionBean currentConnection : cons) {
|
||||
@@ -210,6 +207,7 @@ public class ConnectionUserPerReader {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void createPropertyFile() {
|
||||
|
||||
@@ -133,7 +133,7 @@ JavaFunctionParser.checkMethod=\u30EB\u30FC\u30C1\u30F3: "{0}.{1}"\u89E3\u6790\u
|
||||
JavaGlobalVariableProposal.Description=\u8AAC\u660E: {0}
|
||||
JavaGlobalVariableProposal.VariableName=\n\n\u5909\u6570\u540D: {1}
|
||||
JavaSimpleDateFormatProposalProvider.displaySingleQuote= ' : \u4E00\u91CD\u5F15\u7528\u7B26\u3092\u8868\u793A
|
||||
JavaSimpleDateFormatProposalProvider.quoteDisplayError=\uFF12\u3064\u306E\u4E00\u91CD\u5F15\u7528\u7B26\u3067\uFF11\u3064\u306E\u4E00\u91CD\u5F15\u7528\u7B26\u3092\u793A\u3057\u307E\u3059\u3002
|
||||
JavaSimpleDateFormatProposalProvider.quoteDisplayError=\uFF12\u3064\u306E\u30B7\u30F3\u30B0\u30EB\u30AF\u30A9\u30FC\u30C8\u3067\uFF11\u3064\u306E\u30B7\u30F3\u30B0\u30EB\u30AF\u30A9\u30FC\u30C8\u3092\u793A\u3057\u307E\u3059\u3002
|
||||
JavaTypesManager.bigDecimal=BIGDECIMAL\u306F\u6570\u5024\u3067\u3059:
|
||||
JavaTypesManager.integer=INTEGER\u306F\u6570\u5024\u3067\u3059:
|
||||
JavaTypesManager.list=LIST\u306F\u6570\u5024\u3067\u3059:
|
||||
|
||||
@@ -115,7 +115,7 @@ GlobalServiceRegister.ServiceNotRegistered=\u30B5\u30FC\u30D3\u30B9{0}\u304C\u76
|
||||
GroupByContextAction.groupContext=\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u3054\u3068\u306B\u30B0\u30EB\u30FC\u30D4\u30F3\u30B0
|
||||
GroupByVariableAction.groupVariable=\u5909\u6570\u3054\u3068\u306B\u30B0\u30EB\u30FC\u30D4\u30F3\u30B0
|
||||
JavaSimpleDateFormatProposalProvider.displaySingleQuote= ' : \u4E00\u91CD\u5F15\u7528\u7B26\u3092\u8868\u793A
|
||||
JavaSimpleDateFormatProposalProvider.quoteDisplayError=\uFF12\u3064\u306E\u4E00\u91CD\u5F15\u7528\u7B26\u3067\uFF11\u3064\u306E\u4E00\u91CD\u5F15\u7528\u7B26\u3092\u793A\u3057\u307E\u3059\u3002
|
||||
JavaSimpleDateFormatProposalProvider.quoteDisplayError=\uFF12\u3064\u306E\u30B7\u30F3\u30B0\u30EB\u30AF\u30A9\u30FC\u30C8\u3067\uFF11\u3064\u306E\u30B7\u30F3\u30B0\u30EB\u30AF\u30A9\u30FC\u30C8\u3092\u793A\u3057\u307E\u3059\u3002
|
||||
JavaTypesManager.bigDecimal=BIGDECIMAL\u306F\u6570\u5024\u3067\u3059:
|
||||
JavaTypesManager.integer=INTEGER\u306F\u6570\u5024\u3067\u3059:
|
||||
JavaTypesManager.list=LIST\u306F\u6570\u5024\u3067\u3059:
|
||||
|
||||
@@ -1,103 +1,86 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.prefs;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.talend.commons.i18n.MessagesCore;
|
||||
import org.talend.core.CorePlugin;
|
||||
|
||||
/**
|
||||
* Use to retrieve general application parameters.<br/>
|
||||
*
|
||||
* $Id: Messages.java 1 2006-09-29 17:06:40 +0000 (ven., 29 sept. 2006) nrousseau $
|
||||
*
|
||||
*/
|
||||
public class GeneralParametersProvider extends MessagesCore {
|
||||
|
||||
private static final String BUNDLE_NAME = "parameters"; //$NON-NLS-1$
|
||||
|
||||
private static final String PLUGIN_ID = "org.talend.core"; //$NON-NLS-1$
|
||||
|
||||
private static ResourceBundle resourceBundle;
|
||||
|
||||
private static ResourceBundle getBundle() {
|
||||
if (resourceBundle == null) {
|
||||
try {
|
||||
resourceBundle = ResourceBundle.getBundle(BUNDLE_NAME);
|
||||
} catch (Exception e) {
|
||||
// Nothing to do (return null)
|
||||
}
|
||||
}
|
||||
return resourceBundle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value corresponding to the specified key.
|
||||
*/
|
||||
public static String getString(GeneralParameters key) {
|
||||
return getString(key.getParamName(), PLUGIN_ID, getBundle());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a sorted string array containing values corresponding to the specified key.
|
||||
*/
|
||||
public static String[] getStrings(GeneralParameters key) {
|
||||
String value = getString(key);
|
||||
String[] toReturn = value.split(","); //$NON-NLS-1$
|
||||
Arrays.sort(toReturn);
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
public static String getOnLineHelpLanguageSetting() {
|
||||
String language = CorePlugin.getDefault().getPluginPreferences().getString(ITalendCorePrefConstants.LANGUAGE_SELECTOR);
|
||||
if (StringUtils.isBlank(language)) {
|
||||
language = Locale.getDefault().getLanguage();
|
||||
}
|
||||
if (Locale.FRENCH.getLanguage().equals(language)) {
|
||||
return "fr";
|
||||
}
|
||||
if (Locale.JAPAN.getLanguage().equals(language)) {
|
||||
return "ja";
|
||||
}
|
||||
return "en"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC smallet GeneralParametersProvider class global comment. Detailled comment <br/>
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
public enum GeneralParameters {
|
||||
AUTHORIZED_LANGUAGE("param.authorizedlanguage"), //$NON-NLS-1$
|
||||
DEFAULT_PERL_INTERPRETER_WIN32("param.defaultPerlInterpreterPath.win32"), //$NON-NLS-1$
|
||||
DEFAULT_PERL_INTERPRETER_LINUX("param.defaultPerlInterpreterPath.linux"), //$NON-NLS-1$
|
||||
DEFAULT_PERL_INTERPRETER_EMBEDDED_SUFFIX_WIN32("param.defaultPerlInterpreterEmbeddedSuffix.win32"), //$NON-NLS-1$
|
||||
DEFAULT_JAVA_INTERPRETER_SUFFIX_WIN32("param.defaultJavaInterpreterSuffix.win32"), //$NON-NLS-1$
|
||||
DEFAULT_JAVA_INTERPRETER_SUFFIX_LINUX("param.defaultJavaInterpreterSuffix.linux"), //$NON-NLS-1$
|
||||
PROJECTS_EXCLUDED_FROM_EXPORT("param.projectsExcludedFromExport"); //$NON-NLS-1$
|
||||
|
||||
private String paramName;
|
||||
|
||||
GeneralParameters(String paramName) {
|
||||
this.paramName = paramName;
|
||||
}
|
||||
|
||||
public String getParamName() {
|
||||
return this.paramName;
|
||||
}
|
||||
}
|
||||
}
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.prefs;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import org.talend.commons.i18n.MessagesCore;
|
||||
|
||||
/**
|
||||
* Use to retrieve general application parameters.<br/>
|
||||
*
|
||||
* $Id: Messages.java 1 2006-09-29 17:06:40 +0000 (ven., 29 sept. 2006) nrousseau $
|
||||
*
|
||||
*/
|
||||
public class GeneralParametersProvider extends MessagesCore {
|
||||
|
||||
private static final String BUNDLE_NAME = "parameters"; //$NON-NLS-1$
|
||||
|
||||
private static final String PLUGIN_ID = "org.talend.core"; //$NON-NLS-1$
|
||||
|
||||
private static ResourceBundle resourceBundle;
|
||||
|
||||
private static ResourceBundle getBundle() {
|
||||
if (resourceBundle == null) {
|
||||
try {
|
||||
resourceBundle = ResourceBundle.getBundle(BUNDLE_NAME);
|
||||
} catch (Exception e) {
|
||||
// Nothing to do (return null)
|
||||
}
|
||||
}
|
||||
return resourceBundle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value corresponding to the specified key.
|
||||
*/
|
||||
public static String getString(GeneralParameters key) {
|
||||
return getString(key.getParamName(), PLUGIN_ID, getBundle());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a sorted string array containing values corresponding to the specified key.
|
||||
*/
|
||||
public static String[] getStrings(GeneralParameters key) {
|
||||
String value = getString(key);
|
||||
String[] toReturn = value.split(","); //$NON-NLS-1$
|
||||
Arrays.sort(toReturn);
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC smallet GeneralParametersProvider class global comment. Detailled comment <br/>
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
public enum GeneralParameters {
|
||||
AUTHORIZED_LANGUAGE("param.authorizedlanguage"), //$NON-NLS-1$
|
||||
DEFAULT_PERL_INTERPRETER_WIN32("param.defaultPerlInterpreterPath.win32"), //$NON-NLS-1$
|
||||
DEFAULT_PERL_INTERPRETER_LINUX("param.defaultPerlInterpreterPath.linux"), //$NON-NLS-1$
|
||||
DEFAULT_PERL_INTERPRETER_EMBEDDED_SUFFIX_WIN32("param.defaultPerlInterpreterEmbeddedSuffix.win32"), //$NON-NLS-1$
|
||||
DEFAULT_JAVA_INTERPRETER_SUFFIX_WIN32("param.defaultJavaInterpreterSuffix.win32"), //$NON-NLS-1$
|
||||
DEFAULT_JAVA_INTERPRETER_SUFFIX_LINUX("param.defaultJavaInterpreterSuffix.linux"), //$NON-NLS-1$
|
||||
PROJECTS_EXCLUDED_FROM_EXPORT("param.projectsExcludedFromExport"); //$NON-NLS-1$
|
||||
|
||||
private String paramName;
|
||||
|
||||
GeneralParameters(String paramName) {
|
||||
this.paramName = paramName;
|
||||
}
|
||||
|
||||
public String getParamName() {
|
||||
return this.paramName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,22 +88,12 @@ public interface ICoreTisService extends IService {
|
||||
Integer getSignatureVerifyResult(Property property, IPath resourcePath, boolean considerGP) throws Exception;
|
||||
|
||||
String getLicenseCustomer();
|
||||
|
||||
void storeLicenseAndUpdateConfig(String licenseString) throws IOException;
|
||||
|
||||
boolean isInValidGP();
|
||||
|
||||
boolean hasNewPatchInPatchesFolder();
|
||||
|
||||
boolean isDefaultLicenseAndProjectType();
|
||||
|
||||
String getLicenseProductName(String licenseString) throws Exception;
|
||||
|
||||
String getLicenseProductEdition(String licenseString) throws Exception;
|
||||
|
||||
boolean isLicenseExpired(String licenseString) throws Exception;
|
||||
|
||||
boolean isLicenseVersionCorrect(String licenseString) throws Exception;
|
||||
|
||||
void syncProjectUpdateSettingsFromServer(IProgressMonitor monitor, Project proj) throws Exception;
|
||||
|
||||
|
||||
@@ -819,8 +819,7 @@ public class ProcessorUtilities {
|
||||
// TDI-36930, just after compile, need check the compile errors first.
|
||||
// only check current build
|
||||
if (isMainJob) {
|
||||
CorePlugin.getDefault().getRunProcessService().checkLastGenerationHasCompilationError(true,
|
||||
!ComponentCategory.CATEGORY_4_CAMEL.getName().equals(currentProcess.getComponentsType()));
|
||||
CorePlugin.getDefault().getRunProcessService().checkLastGenerationHasCompilationError(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ _UI_TypeAlias_type=Type Alias
|
||||
_UI_Union_type=Union
|
||||
_UI_UnionMember_type=Membre de l'union
|
||||
_UI_ExpressionNode_type=N\u0153ud d'expression
|
||||
_UI_ConstantNode_type=N\u0153ud constant
|
||||
_UI_ConstantNode_type=Noeud constant
|
||||
_UI_ElementNode_type=N\u0153ud d'\u00E9l\u00E9ment
|
||||
_UI_FeatureNode_type=N\u0153ud de fonctionnalit\u00E9
|
||||
_UI_UniqueKey_type=Cl\u00E9 unique
|
||||
|
||||
@@ -788,7 +788,7 @@ _UI_Term_concept_feature=\u30B3\u30F3\u30BB\u30D7\u30C8
|
||||
_UI_Term_relatedTerm_feature=\u95A2\u9023\u7528\u8A9E
|
||||
_UI_Term_term_feature=\u7528\u8A9E
|
||||
_UI_Term_preferredTerm_feature=\u597D\u307E\u3057\u3044Term
|
||||
_UI_Term_synonym_feature=\u30B7\u30CE\u30CB\u30E0
|
||||
_UI_Term_synonym_feature=\u540C\u7FA9\u8A9E
|
||||
_UI_Term_widerTerm_feature=\u5E45\u5E83\u3044Term
|
||||
_UI_Term_narrowerTerm_feature=Narrower Term
|
||||
_UI_WarehouseProcess_staticDefinition_feature=\u9759\u7684\u5B9A\u7FA9
|
||||
|
||||
@@ -11,16 +11,16 @@
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
<properties>
|
||||
<tcomp.version>${component-runtime.version}</tcomp.version>
|
||||
<cxf.version>3.5.2</cxf.version>
|
||||
<cxf.version>3.5.1</cxf.version>
|
||||
<geronimo.version>1.0.2</geronimo.version>
|
||||
<jcache.version>1.0.5</jcache.version>
|
||||
<jcache_spec.version>1.0-alpha-1</jcache_spec.version>
|
||||
<johnzon.version>1.2.19</johnzon.version>
|
||||
<meecrowave.version>1.2.14</meecrowave.version>
|
||||
<johnzon.version>1.2.16</johnzon.version>
|
||||
<meecrowave.version>1.2.13</meecrowave.version>
|
||||
<microprofile.version>1.2.1</microprofile.version>
|
||||
<owb.version>2.0.27</owb.version>
|
||||
<slf4j.version>1.7.34</slf4j.version>
|
||||
<tomcat.version>9.0.63</tomcat.version>
|
||||
<owb.version>2.0.26</owb.version>
|
||||
<slf4j.version>1.7.33</slf4j.version>
|
||||
<tomcat.version>9.0.62</tomcat.version>
|
||||
<xbean.version>4.20</xbean.version>
|
||||
<reload4j.version>1.2.19</reload4j.version>
|
||||
<log4j2.version>2.17.2</log4j2.version>
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<properties>
|
||||
<tcomp.version>1.49.1</tcomp.version>
|
||||
<slf4j.version>1.7.34</slf4j.version>
|
||||
<tcomp.version>1.47.1</tcomp.version>
|
||||
<slf4j.version>1.7.32</slf4j.version>
|
||||
<reload4j.version>1.2.19</reload4j.version>
|
||||
</properties>
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ import org.talend.core.model.process.IContext;
|
||||
import org.talend.core.model.process.IProcess;
|
||||
import org.talend.core.model.process.IProcess2;
|
||||
import org.talend.core.model.process.JobInfo;
|
||||
import org.talend.core.model.process.ProcessUtils;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.model.properties.Project;
|
||||
@@ -77,7 +78,6 @@ import org.talend.core.runtime.process.TalendProcessOptionConstants;
|
||||
import org.talend.core.runtime.projectsetting.IProjectSettingPreferenceConstants;
|
||||
import org.talend.core.runtime.projectsetting.IProjectSettingTemplateConstants;
|
||||
import org.talend.core.runtime.projectsetting.ProjectPreferenceManager;
|
||||
import org.talend.core.runtime.util.ModuleAccessHelper;
|
||||
import org.talend.core.services.IGITProviderService;
|
||||
import org.talend.core.ui.ITestContainerProviderService;
|
||||
import org.talend.core.utils.TemplateFileUtils;
|
||||
@@ -202,29 +202,19 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
|
||||
final IContext context = jProcessor.getContext();
|
||||
Property property = jProcessor.getProperty();
|
||||
|
||||
Set<String> testVMArgs = null;
|
||||
if (ITestContainerProviderService.get() != null) {
|
||||
ITestContainerProviderService testService = ITestContainerProviderService.get();
|
||||
if (testService.isTestContainerProcess(process)) {
|
||||
testVMArgs = ModuleAccessHelper.getModuleAccessVMArgsForProcessor(jProcessor);
|
||||
if (ProcessUtils.isTestContainer(process)) {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
|
||||
ITestContainerProviderService testService = (ITestContainerProviderService) GlobalServiceRegister
|
||||
.getDefault()
|
||||
.getService(ITestContainerProviderService.class);
|
||||
try {
|
||||
property = testService.getParentJobItem(property.getItem()).getProperty();
|
||||
process = testService.getParentJobProcess(process);
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
} else if (property.getItem() instanceof ProcessItem) {
|
||||
List<ProcessItem> testcaseItems = testService.getAllTestContainers((ProcessItem) property.getItem(), true, true);
|
||||
testVMArgs = testcaseItems.stream().flatMap(item -> ModuleAccessHelper
|
||||
.getModuleAccessVMArgs(item.getProperty(), ProcessorUtilities.getChildrenJobInfo(item, false, true))
|
||||
.stream()).collect(Collectors.toSet());
|
||||
}
|
||||
}
|
||||
if (testVMArgs != null && !testVMArgs.isEmpty()) {
|
||||
StringBuilder vmArgsLine = new StringBuilder();
|
||||
testVMArgs.forEach(arg -> vmArgsLine.append(arg + " "));
|
||||
properties.setProperty("argLine", vmArgsLine.toString().trim());
|
||||
}
|
||||
|
||||
Project project = ProjectManager.getInstance().getProject(property);
|
||||
if (project == null) { // current project
|
||||
|
||||
@@ -45,6 +45,8 @@ public class PomIdsHelper {
|
||||
|
||||
private static Map<String, ProjectPreferenceManager> preferenceManagers = new HashMap<>();
|
||||
|
||||
private static final String ARTIFACT_ID = "artifactId";
|
||||
|
||||
/**
|
||||
* get current project groupId.
|
||||
*/
|
||||
@@ -161,6 +163,27 @@ public class PomIdsHelper {
|
||||
return getCodesVersion(projectTechName);
|
||||
}
|
||||
|
||||
public static String getGroupId(Property property) {
|
||||
if (null == getOldId(property)) {
|
||||
final String path = property.getItem().getState().getPath();
|
||||
if (null != path) {
|
||||
return path.replace('/', '.');
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static String getOldId(Property property) {
|
||||
final String oldId = (String) property.getAdditionalProperties().get(ARTIFACT_ID);
|
||||
if (null != oldId) {
|
||||
final String name = property.getLabel();
|
||||
if (oldId.startsWith(name + '_')) {
|
||||
return oldId;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static String getJobGroupId(String name) {
|
||||
if (name != null && !name.trim().isEmpty()) {
|
||||
@@ -283,6 +306,36 @@ public class PomIdsHelper {
|
||||
return version;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return "<jobVersion>-<projectName>".
|
||||
*/
|
||||
public static String getJobFeatureVersion(Property property, String bundleVersion) {
|
||||
String version = null;
|
||||
if (property != null) {
|
||||
boolean useSnapshot = false;
|
||||
if (property.getAdditionalProperties() != null) {
|
||||
version = (String) property.getAdditionalProperties().get(MavenConstants.NAME_USER_VERSION);
|
||||
// APPINT-34581 - try to take cloud version if custom does not persist
|
||||
|
||||
useSnapshot = property.getAdditionalProperties().containsKey(MavenConstants.NAME_PUBLISH_AS_SNAPSHOT);
|
||||
}
|
||||
if(version == null) {
|
||||
version = (String) property.getAdditionalProperties().get(MavenConstants.CLOUD_VERSION);
|
||||
}
|
||||
if(version == null) {
|
||||
version = bundleVersion;
|
||||
}
|
||||
if (version == null) {
|
||||
version = VersionUtils.getPublishVersion(property.getVersion());
|
||||
}
|
||||
if (useSnapshot) {
|
||||
version += MavenConstants.SNAPSHOT;
|
||||
}
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
public static String getJobVersion(JobInfo jobInfo) {
|
||||
if (jobInfo != null) {
|
||||
return jobInfo.getJobVersion();
|
||||
@@ -309,112 +362,7 @@ public class PomIdsHelper {
|
||||
ProjectPreferenceManager manager = getPreferenceManager(projectTechName);
|
||||
return manager.getBoolean(MavenConstants.USE_PROFILE_MODULE);
|
||||
}
|
||||
|
||||
private static String getPublishCloudVersion(String latestVersion) {
|
||||
if (null == latestVersion) {
|
||||
return "0.1.0";
|
||||
} else {
|
||||
int i = latestVersion.lastIndexOf('.') + 1;
|
||||
return latestVersion.substring(0, i) + (Long.parseLong(latestVersion.substring(i)) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return "<bundleVersion>".
|
||||
*/
|
||||
public static String getNotIteratedBundleVersion(Property property, String bundleVersion) {
|
||||
String version = null;
|
||||
if (property != null) {
|
||||
boolean useSnapshot = false;
|
||||
if (property.getAdditionalProperties() != null) {
|
||||
version = (String) property.getAdditionalProperties().get(MavenConstants.NAME_USER_VERSION);
|
||||
useSnapshot = property.getAdditionalProperties().containsKey(MavenConstants.NAME_PUBLISH_AS_SNAPSHOT);
|
||||
}
|
||||
if(version == null) {
|
||||
version = bundleVersion;
|
||||
}
|
||||
if (version == null) {
|
||||
version = VersionUtils.getPublishVersion(property.getVersion());
|
||||
}
|
||||
if (useSnapshot) {
|
||||
version += MavenConstants.SNAPSHOT;
|
||||
}
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return "<featureVersion>".
|
||||
*/
|
||||
public static String getNotIteratedFeatureVersion(Property property, String featureVersion) {
|
||||
String version = null;
|
||||
if (property != null) {
|
||||
boolean useSnapshot = false;
|
||||
if (property.getAdditionalProperties() != null) {
|
||||
version = (String) property.getAdditionalProperties().get(MavenConstants.NAME_USER_VERSION);
|
||||
useSnapshot = property.getAdditionalProperties().containsKey(MavenConstants.NAME_PUBLISH_AS_SNAPSHOT);
|
||||
}
|
||||
if(version == null) {
|
||||
version = featureVersion;
|
||||
}
|
||||
if (version == null) {
|
||||
version = VersionUtils.getPublishVersion(property.getVersion());
|
||||
}
|
||||
if (useSnapshot) {
|
||||
version += MavenConstants.SNAPSHOT;
|
||||
}
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return "<bundleVersion>".
|
||||
*/
|
||||
public static String getBundleVersion(Property property, String bundleVersion) {
|
||||
String version = null;
|
||||
if (property != null) {
|
||||
boolean useSnapshot = false;
|
||||
if (property.getAdditionalProperties() != null) {
|
||||
version = (String) property.getAdditionalProperties().get(MavenConstants.NAME_USER_VERSION);
|
||||
useSnapshot = property.getAdditionalProperties().containsKey(MavenConstants.NAME_PUBLISH_AS_SNAPSHOT);
|
||||
}
|
||||
if(version == null) {
|
||||
version = getPublishCloudVersion(bundleVersion);
|
||||
}
|
||||
if (version == null) {
|
||||
version = VersionUtils.getPublishVersion(property.getVersion());
|
||||
}
|
||||
if (useSnapshot) {
|
||||
version += MavenConstants.SNAPSHOT;
|
||||
}
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return "<featureVersion>".
|
||||
*/
|
||||
public static String getFeatureVersion(Property property, String featureVersion) {
|
||||
String version = null;
|
||||
if (property != null) {
|
||||
boolean useSnapshot = false;
|
||||
if (property.getAdditionalProperties() != null) {
|
||||
version = (String) property.getAdditionalProperties().get(MavenConstants.NAME_USER_VERSION);
|
||||
useSnapshot = property.getAdditionalProperties().containsKey(MavenConstants.NAME_PUBLISH_AS_SNAPSHOT);
|
||||
}
|
||||
if(version == null) {
|
||||
version = getPublishCloudVersion(featureVersion);
|
||||
}
|
||||
if (version == null) {
|
||||
version = VersionUtils.getPublishVersion(property.getVersion());
|
||||
}
|
||||
if (useSnapshot) {
|
||||
version += MavenConstants.SNAPSHOT;
|
||||
}
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
public static boolean getIfExcludeDeletedItems() {
|
||||
String excludeDeleted = System.getProperty("talend.exclude.deleted");
|
||||
if (excludeDeleted != null) {
|
||||
|
||||
@@ -135,8 +135,6 @@ public class FastDateParser {
|
||||
calendar.clear();
|
||||
calendar.set(year, month, day);
|
||||
return calendar.getTime();
|
||||
} catch (NumberFormatException numberFormatException){
|
||||
throw new RuntimeException("Unparseable date: \"" + source + "\""); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
} catch (Exception e) {
|
||||
pos.setErrorIndex(index);
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -168,9 +168,7 @@ public class SwitchContextWithTaggedValue extends AbstractSwitchContextStrategy
|
||||
// case4 both has catalog and schema case then schema maybe set null when both original and target are null with
|
||||
// same time
|
||||
if (isSpecial4Case(targetUiSchema, extractorInstance, originalUiSchema, taggedOriUiShchema)) {
|
||||
if (originalContext.equals(selectedContext)) {
|
||||
TaggedValueHelper.setTaggedValue(dbConn, TaggedValueHelper.ORIGINAL_SID, originalSid);
|
||||
}
|
||||
TaggedValueHelper.setTaggedValue(dbConn, TaggedValueHelper.ORIGINAL_SID, originalSid);
|
||||
TaggedValueHelper.setTaggedValue(dbConn, TaggedValueHelper.ORIGINAL_UISCHEMA, originalUiSchema);
|
||||
hasChanged = true;
|
||||
}
|
||||
|
||||
@@ -174,7 +174,6 @@ public class ExtendedNodeConnectionContextUtils {
|
||||
KnoxUsername,
|
||||
KnoxPassword,
|
||||
KnoxDirectory,
|
||||
KnoxTimeout,
|
||||
|
||||
//Cde
|
||||
CdeApiEndPoint,
|
||||
|
||||
@@ -160,7 +160,7 @@ JavaFunctionParser.checkMethod=\u30EB\u30FC\u30C1\u30F3: "{0}.{1}"\u89E3\u6790\u
|
||||
JavaGlobalVariableProposal.Description=\u8AAC\u660E: {0}
|
||||
JavaGlobalVariableProposal.VariableName=\n\n\u5909\u6570\u540D: {1}
|
||||
JavaSimpleDateFormatProposalProvider.displaySingleQuote= ' : \u4E00\u91CD\u5F15\u7528\u7B26\u3092\u8868\u793A
|
||||
JavaSimpleDateFormatProposalProvider.quoteDisplayError=\uFF12\u3064\u306E\u4E00\u91CD\u5F15\u7528\u7B26\u3067\uFF11\u3064\u306E\u4E00\u91CD\u5F15\u7528\u7B26\u3092\u793A\u3057\u307E\u3059\u3002
|
||||
JavaSimpleDateFormatProposalProvider.quoteDisplayError=\uFF12\u3064\u306E\u30B7\u30F3\u30B0\u30EB\u30AF\u30A9\u30FC\u30C8\u3067\uFF11\u3064\u306E\u30B7\u30F3\u30B0\u30EB\u30AF\u30A9\u30FC\u30C8\u3092\u793A\u3057\u307E\u3059\u3002
|
||||
JavaSqlFactory.NoClassName=\u30AF\u30E9\u30B9\u540D\u304C\u306A\u304F\u3001\u30C9\u30E9\u30A4\u30D0\u304C\u898B\u3064\u3051\u3089\u308C\u307E\u305B\u3093
|
||||
JavaTypesManager.bigDecimal=BIGDECIMAL\u306F\u6570\u5024\u3067\u3059:
|
||||
JavaTypesManager.integer=INTEGER\u306F\u6570\u5024\u3067\u3059:
|
||||
|
||||
@@ -17,7 +17,6 @@ import java.nio.charset.Charset;
|
||||
import java.security.Provider;
|
||||
import java.sql.Connection;
|
||||
import java.sql.Driver;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
@@ -209,20 +208,10 @@ public class JDBCDriverLoader {
|
||||
}
|
||||
connection = wapperDriver.connect(url, info);
|
||||
}
|
||||
|
||||
try {
|
||||
ResultSet schemas = connection.getMetaData().getSchemas();
|
||||
if(schemas.next()) {
|
||||
schemas.getString(1);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
// }
|
||||
// DriverManager.deregisterDriver(wapperDriver);
|
||||
// bug 9162
|
||||
list.add(connection);
|
||||
|
||||
list.add(wapperDriver);
|
||||
return list;
|
||||
} catch (Throwable e) {
|
||||
|
||||
@@ -15,7 +15,6 @@ package org.talend.core.model.metadata.builder.database.jdbc;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.talend.core.database.EDatabaseTypeName;
|
||||
import org.talend.core.model.metadata.IMetadataConnection;
|
||||
import org.talend.core.model.metadata.builder.ConvertionHelper;
|
||||
@@ -26,57 +25,6 @@ import org.talend.cwm.helper.TaggedValueHelper;
|
||||
|
||||
public class ExtractorFactory {
|
||||
|
||||
/*
|
||||
* when run the tDqReportRun, save the job's context information(selected in the job's Run tab)
|
||||
*/
|
||||
private static java.util.Properties STANDALONE_JOB_CONTEXT_PROPERTIES = new java.util.Properties();
|
||||
|
||||
public static java.util.Properties getSTANDALONE_JOB_CONTEXT_PROPERTIES() {
|
||||
return STANDALONE_JOB_CONTEXT_PROPERTIES;
|
||||
}
|
||||
|
||||
public static void setSTANDALONE_JOB_CONTEXT_PROPERTIES(java.util.Properties sTANDALONE_JOB_CONTEXT_PROPERTIES) {
|
||||
STANDALONE_JOB_CONTEXT_PROPERTIES = sTANDALONE_JOB_CONTEXT_PROPERTIES;
|
||||
}
|
||||
|
||||
public static String getJdbcUrl(java.util.Properties props) {
|
||||
if (props != null) {
|
||||
for (Object key : props.keySet()) {
|
||||
if (key != null && String.valueOf(key).toLowerCase().endsWith("_jdbcurl")) { //$NON-NLS-1$
|
||||
return String.valueOf(props.get(key));
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static final String DEFAULT = "Default"; //$NON-NLS-1$
|
||||
|
||||
public static String getCatalogFromJobContext(DatabaseConnection dbConn) {
|
||||
return getCatalogSchemaFromJobContext(dbConn, 0);
|
||||
}
|
||||
|
||||
public static String getSchemaFromJobContext(DatabaseConnection dbConn) {
|
||||
return getCatalogSchemaFromJobContext(dbConn, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param index: 0-catalog, 1-schema
|
||||
*/
|
||||
private static String getCatalogSchemaFromJobContext(DatabaseConnection dbConn, int index) {
|
||||
IUrlDbNameExtractor extractorInstance =
|
||||
getExtractorInstance(dbConn, DEFAULT, DEFAULT);
|
||||
if (extractorInstance != null) {
|
||||
String jdbcUrl = ExtractorFactory.getJdbcUrl(getSTANDALONE_JOB_CONTEXT_PROPERTIES());
|
||||
if (!StringUtils.isBlank(jdbcUrl)) {
|
||||
extractorInstance.setUrl(jdbcUrl);
|
||||
}
|
||||
extractorInstance.initUiSchemaOrSID();
|
||||
return extractorInstance.getExtractResult().get(index);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static IUrlDbNameExtractor getExtractorInstance(DatabaseMetaData dbMetadata,
|
||||
IMetadataConnection metadataConnection) {
|
||||
if (dbMetadata == null) {
|
||||
|
||||
@@ -13,11 +13,8 @@
|
||||
package org.talend.metadata.managment.ui.convert;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.talend.core.database.EDatabaseTypeName;
|
||||
import org.talend.core.model.metadata.builder.connection.DatabaseConnection;
|
||||
import org.talend.core.model.metadata.builder.database.jdbc.ExtractorFactory;
|
||||
import org.talend.cwm.helper.CatalogHelper;
|
||||
import org.talend.cwm.helper.TaggedValueHelper;
|
||||
|
||||
@@ -44,22 +41,14 @@ public class CatalogAdapter {
|
||||
DataManager dataManager = dataManagerList.get(0);
|
||||
if (dataManager instanceof DatabaseConnection) {
|
||||
DatabaseConnection parentConnection = (DatabaseConnection) dataManager;
|
||||
String originalSID =
|
||||
TaggedValueHelper.getValueString(TaggedValueHelper.ORIGINAL_SID, parentConnection);
|
||||
String targetSID = TaggedValueHelper.getValueString(TaggedValueHelper.TARGET_SID, parentConnection);
|
||||
if (Platform.isRunning()) {
|
||||
DbConnectionAdapter dbConnectionAdapter =
|
||||
new DbConnectionAdapter(parentConnection);
|
||||
if (dbConnectionAdapter.isSwitchWithTaggedValueMode()) {
|
||||
if (catalogName.equals(originalSID)) {
|
||||
return targetSID;
|
||||
}
|
||||
DbConnectionAdapter dbConnectionAdapter =
|
||||
new DbConnectionAdapter(parentConnection);
|
||||
if (dbConnectionAdapter.isSwitchWithTaggedValueMode()) {
|
||||
String originalSID = TaggedValueHelper.getValueString(TaggedValueHelper.ORIGINAL_SID, parentConnection);
|
||||
String targetSID = TaggedValueHelper.getValueString(TaggedValueHelper.TARGET_SID, parentConnection);
|
||||
if (catalogName.equals(originalSID)) {
|
||||
return targetSID;
|
||||
}
|
||||
} else if (EDatabaseTypeName.GENERAL_JDBC.getXMLType().equals(parentConnection.getDatabaseType())) {
|
||||
String tempCatalogName = ExtractorFactory.getCatalogFromJobContext(parentConnection);
|
||||
catalogName =
|
||||
StringUtils.isBlank(tempCatalogName) ? catalogName.equals(originalSID) ? targetSID : catalogName
|
||||
: tempCatalogName;
|
||||
}
|
||||
}
|
||||
return catalogName;
|
||||
@@ -76,25 +65,13 @@ public class CatalogAdapter {
|
||||
DataManager dataManager = originalCat.getDataManager().get(0);
|
||||
if (dataManager instanceof DatabaseConnection) {
|
||||
DatabaseConnection parentConnection = (DatabaseConnection) dataManager;
|
||||
String originalSID =
|
||||
TaggedValueHelper.getValueString(TaggedValueHelper.ORIGINAL_SID, parentConnection);
|
||||
String targetSID = TaggedValueHelper.getValueString(TaggedValueHelper.TARGET_SID, parentConnection);
|
||||
if (Platform.isRunning()) {
|
||||
DbConnectionAdapter dbConnectionAdapter =
|
||||
new DbConnectionAdapter(parentConnection);
|
||||
if (dbConnectionAdapter.isSwitchWithTaggedValueMode()) {
|
||||
if (catalogName.equals(originalSID)) {
|
||||
return CatalogHelper.getCatalog(parentConnection, targetSID);
|
||||
}
|
||||
}
|
||||
} else if (EDatabaseTypeName.GENERAL_JDBC.getXMLType().equals(parentConnection.getDatabaseType())) {
|
||||
String tempCatalogName = ExtractorFactory.getCatalogFromJobContext(parentConnection);
|
||||
if (StringUtils.isBlank(tempCatalogName)) {
|
||||
if (catalogName.equals(originalSID)) {
|
||||
return CatalogHelper.getCatalog(parentConnection, targetSID);
|
||||
}
|
||||
} else {
|
||||
return CatalogHelper.getCatalog(parentConnection, tempCatalogName);
|
||||
DbConnectionAdapter dbConnectionAdapter =
|
||||
new DbConnectionAdapter(parentConnection);
|
||||
if (dbConnectionAdapter.isSwitchWithTaggedValueMode()) {
|
||||
String originalSID = TaggedValueHelper.getValueString(TaggedValueHelper.ORIGINAL_SID, parentConnection);
|
||||
String targetSID = TaggedValueHelper.getValueString(TaggedValueHelper.TARGET_SID, parentConnection);
|
||||
if (catalogName.equals(originalSID)) {
|
||||
return CatalogHelper.getCatalog(parentConnection, targetSID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ import java.sql.DatabaseMetaData;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.talend.core.database.EDatabaseTypeName;
|
||||
import org.talend.core.model.context.ContextUtils;
|
||||
import org.talend.core.model.metadata.builder.connection.DatabaseConnection;
|
||||
@@ -42,26 +41,16 @@ public class DbConnectionAdapter {
|
||||
if (originalDB == null) {
|
||||
return null;
|
||||
}
|
||||
String sid = extractedTargetValue(TaggedValueHelper.ORIGINAL_SID, TaggedValueHelper.TARGET_SID,
|
||||
return extractedTargetValue(TaggedValueHelper.ORIGINAL_SID, TaggedValueHelper.TARGET_SID,
|
||||
defaultCatalog);
|
||||
if (!Platform.isRunning()) {
|
||||
String tempSid = ExtractorFactory.getCatalogFromJobContext(originalDB);
|
||||
sid = StringUtils.isBlank(tempSid) ? sid : tempSid;
|
||||
}
|
||||
return sid;
|
||||
}
|
||||
|
||||
public String getUISchema(String defaultSchema) {
|
||||
if (originalDB == null) {
|
||||
return null;
|
||||
}
|
||||
String uiSchema = extractedTargetValue(TaggedValueHelper.ORIGINAL_UISCHEMA, TaggedValueHelper.TARGET_UISCHEMA,
|
||||
return extractedTargetValue(TaggedValueHelper.ORIGINAL_UISCHEMA, TaggedValueHelper.TARGET_UISCHEMA,
|
||||
defaultSchema);
|
||||
if (!Platform.isRunning()) {
|
||||
String tempUiSchema = ExtractorFactory.getSchemaFromJobContext(originalDB);
|
||||
uiSchema = StringUtils.isBlank(tempUiSchema) ? uiSchema : tempUiSchema;
|
||||
}
|
||||
return uiSchema;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -16,11 +16,8 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.talend.core.database.EDatabaseTypeName;
|
||||
import org.talend.core.model.metadata.builder.connection.DatabaseConnection;
|
||||
import org.talend.core.model.metadata.builder.database.jdbc.ExtractorFactory;
|
||||
import org.talend.cwm.helper.CatalogHelper;
|
||||
import org.talend.cwm.helper.SchemaHelper;
|
||||
import org.talend.cwm.helper.TaggedValueHelper;
|
||||
@@ -48,26 +45,15 @@ public class SchemaAdapter {
|
||||
DataManager dataManager = findConnection(originalSch);
|
||||
if (dataManager != null && dataManager instanceof DatabaseConnection) {
|
||||
DatabaseConnection parentConnection = (DatabaseConnection) dataManager;
|
||||
String originalUISchema =
|
||||
TaggedValueHelper.getValueString(TaggedValueHelper.ORIGINAL_UISCHEMA, parentConnection);
|
||||
String targetUISchema =
|
||||
TaggedValueHelper.getValueString(TaggedValueHelper.TARGET_UISCHEMA, parentConnection);
|
||||
if (Platform.isRunning()) {
|
||||
DbConnectionAdapter dbConnectionAdapter =
|
||||
new DbConnectionAdapter(parentConnection);
|
||||
if (dbConnectionAdapter.isSwitchWithTaggedValueMode()) {
|
||||
if (schemaName.equals(originalUISchema)) {
|
||||
return targetUISchema;
|
||||
}
|
||||
}
|
||||
} else if (EDatabaseTypeName.GENERAL_JDBC.getXMLType().equals(parentConnection.getDatabaseType())) {
|
||||
String tempSchemaName = ExtractorFactory.getSchemaFromJobContext(parentConnection);
|
||||
if (StringUtils.isBlank(tempSchemaName)) {
|
||||
if (parentConnection.isContextMode() && !StringUtils.isBlank(targetUISchema)) {
|
||||
return targetUISchema;
|
||||
}
|
||||
} else {
|
||||
return tempSchemaName;
|
||||
DbConnectionAdapter dbConnectionAdapter =
|
||||
new DbConnectionAdapter(parentConnection);
|
||||
if (dbConnectionAdapter.isSwitchWithTaggedValueMode()) {
|
||||
String originalUISchema =
|
||||
TaggedValueHelper.getValueString(TaggedValueHelper.ORIGINAL_UISCHEMA, parentConnection);
|
||||
String targetUISchema =
|
||||
TaggedValueHelper.getValueString(TaggedValueHelper.TARGET_UISCHEMA, parentConnection);
|
||||
if (schemaName.equals(originalUISchema)) {
|
||||
return targetUISchema;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -106,55 +92,37 @@ public class SchemaAdapter {
|
||||
// has catalog case
|
||||
newParentCatalog = new CatalogAdapter(originalParentCatalog).getCatalog();
|
||||
dataManager = originalParentCatalog.getDataManager().get(0);
|
||||
|
||||
} else {
|
||||
|
||||
}else {
|
||||
// no catalog case
|
||||
dataManager = originalSch.getDataManager().get(0);
|
||||
}
|
||||
if (dataManager instanceof DatabaseConnection) {
|
||||
DatabaseConnection parentConnection = (DatabaseConnection) dataManager;
|
||||
String originalUISchema =
|
||||
TaggedValueHelper.getValueString(TaggedValueHelper.ORIGINAL_UISCHEMA, parentConnection);
|
||||
String targetUISchema =
|
||||
TaggedValueHelper.getValueString(TaggedValueHelper.TARGET_UISCHEMA, parentConnection);
|
||||
if (Platform.isRunning()) {
|
||||
if (dataManager instanceof DatabaseConnection) {
|
||||
DatabaseConnection parentConnection = (DatabaseConnection) dataManager;
|
||||
DbConnectionAdapter dbConnectionAdapter =
|
||||
new DbConnectionAdapter(parentConnection);
|
||||
if (dbConnectionAdapter.isSwitchWithTaggedValueMode()) {
|
||||
String originalUISchema =
|
||||
TaggedValueHelper.getValueString(TaggedValueHelper.ORIGINAL_UISCHEMA, parentConnection);
|
||||
String targetUISchema =
|
||||
TaggedValueHelper.getValueString(TaggedValueHelper.TARGET_UISCHEMA, parentConnection);
|
||||
if (schemaName.equals(originalUISchema)) {
|
||||
// schema switch exist then use targetUISchema name to find schema
|
||||
//schema switch exist then use targetUISchema name to find schema
|
||||
if (originalParentCatalog != null) {
|
||||
return SchemaHelper.getSchemaByName(CatalogHelper.getSchemas(newParentCatalog),
|
||||
targetUISchema);
|
||||
} else {
|
||||
return SchemaHelper.getSchemaByName(CatalogHelper.getSchemas(newParentCatalog), targetUISchema);
|
||||
}else {
|
||||
return SchemaHelper.getSchema(parentConnection, targetUISchema);
|
||||
}
|
||||
} else if (StringUtils.isEmpty(originalUISchema)) {
|
||||
// schema switch don't exist then use schemaName to find schema
|
||||
}else if(StringUtils.isEmpty(originalUISchema)) {
|
||||
//schema switch don't exist then use schemaName to find schema
|
||||
if (originalParentCatalog != null) {
|
||||
return SchemaHelper.getSchemaByName(CatalogHelper.getSchemas(newParentCatalog),
|
||||
schemaName);
|
||||
} else {
|
||||
return SchemaHelper.getSchemaByName(CatalogHelper.getSchemas(newParentCatalog), schemaName);
|
||||
}else {
|
||||
return SchemaHelper.getSchema(parentConnection, schemaName);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (EDatabaseTypeName.GENERAL_JDBC.getXMLType().equals(parentConnection.getDatabaseType())) {
|
||||
String tempSchemaName = ExtractorFactory.getSchemaFromJobContext(parentConnection);
|
||||
if (StringUtils.isBlank(tempSchemaName)) {
|
||||
if (parentConnection.isContextMode() && !StringUtils.isBlank(targetUISchema)) {
|
||||
tempSchemaName = targetUISchema;
|
||||
} else {
|
||||
tempSchemaName = schemaName;
|
||||
}
|
||||
}
|
||||
if (originalParentCatalog != null) {
|
||||
return SchemaHelper.getSchemaByName(CatalogHelper.getSchemas(newParentCatalog), tempSchemaName);
|
||||
} else {
|
||||
return SchemaHelper.getSchema(parentConnection, tempSchemaName);
|
||||
}
|
||||
}
|
||||
}
|
||||
return originalSch;
|
||||
}
|
||||
|
||||
@@ -164,34 +132,23 @@ public class SchemaAdapter {
|
||||
}
|
||||
Schema firstSchema=inputSchemas.get(0);
|
||||
DataManager dataManager = findConnection(firstSchema);
|
||||
String taggedTargetUISchemaName = null;
|
||||
String contextTargetUISchemaName = null;
|
||||
String taggedTargetUISchemaName=null;
|
||||
if (dataManager instanceof DatabaseConnection) {
|
||||
DatabaseConnection parentConnection = (DatabaseConnection) dataManager;
|
||||
DbConnectionAdapter dbConnectionAdapter =
|
||||
new DbConnectionAdapter(parentConnection);
|
||||
if (dbConnectionAdapter.isSwitchWithTaggedValueMode()) {
|
||||
taggedTargetUISchemaName =
|
||||
TaggedValueHelper.getValueString(TaggedValueHelper.TARGET_UISCHEMA, parentConnection);
|
||||
}
|
||||
if (Platform.isRunning()) {
|
||||
if (StringUtils.isBlank(taggedTargetUISchemaName)) {
|
||||
return inputSchemas;
|
||||
}
|
||||
} else if (EDatabaseTypeName.GENERAL_JDBC.getXMLType().equals(parentConnection.getDatabaseType())) {
|
||||
contextTargetUISchemaName = ExtractorFactory.getSchemaFromJobContext(parentConnection);
|
||||
if (!StringUtils.isBlank(contextTargetUISchemaName)) {
|
||||
taggedTargetUISchemaName = contextTargetUISchemaName;
|
||||
}
|
||||
taggedTargetUISchemaName=TaggedValueHelper.getValueString(TaggedValueHelper.TARGET_UISCHEMA, parentConnection);
|
||||
}
|
||||
}
|
||||
if (!StringUtils.isBlank(taggedTargetUISchemaName)) {
|
||||
List<Schema> schemaList = new ArrayList<>();
|
||||
for (Schema targetSchema : inputSchemas) {
|
||||
if (taggedTargetUISchemaName.equals(targetSchema.getName())) {
|
||||
schemaList.add(targetSchema);
|
||||
return schemaList;
|
||||
}
|
||||
if (StringUtils.isEmpty(taggedTargetUISchemaName)) {
|
||||
return inputSchemas;
|
||||
}
|
||||
List<Schema> schemaList=new ArrayList<>();
|
||||
for(Schema targetSchema: inputSchemas) {
|
||||
if(taggedTargetUISchemaName.equals(targetSchema.getName())) {
|
||||
schemaList.add(targetSchema);
|
||||
return schemaList;
|
||||
}
|
||||
}
|
||||
return inputSchemas;
|
||||
|
||||
@@ -288,7 +288,6 @@ public class MetadataConnectionUtils {
|
||||
String dataBase = databaseConnection.getSID();
|
||||
String dbVersionString = databaseConnection.getDbVersionString();
|
||||
String additionalParams = databaseConnection.getAdditionalParams();
|
||||
boolean supportNLS = databaseConnection.isSupportNLS();
|
||||
|
||||
// MOD qiongli 2011-9-6,TDQ 3317.handle context mode
|
||||
if (databaseConnection.isContextMode()) {
|
||||
@@ -328,7 +327,6 @@ public class MetadataConnectionUtils {
|
||||
metadataConnection.setUsername(userName);
|
||||
metadataConnection.setPassword(password);
|
||||
metadataConnection.setUrl(dbUrl);
|
||||
metadataConnection.setSupportNLS(supportNLS);
|
||||
|
||||
// TDQ-12299: transfer the OtherParameters to metadataConnection, because create impala connection use that
|
||||
// values
|
||||
|
||||
@@ -610,7 +610,7 @@ _UI_Concept_type=Concept
|
||||
_UI_ConceptTarget_type=Cible concept
|
||||
_UI_HL7Connection_type=Connexion HL7
|
||||
_UI_HeaderFooterConnection_type=Connexion En-t\u00EAte/pied de page
|
||||
_UI_XMLFileNode_type=N\u0153ud Fichier XML
|
||||
_UI_XMLFileNode_type=Noeud Fichier XML
|
||||
_UI_GenericPackage_type=Package g\u00E9n\u00E9rique
|
||||
_UI_HL7FileNode_type=N\u0153ud Fichier HL7
|
||||
_UI_TdTable_type=Table Td
|
||||
|
||||
@@ -112,6 +112,7 @@ public class Application implements IApplication {
|
||||
Boolean.TRUE.toString(), false);
|
||||
return IApplication.EXIT_RELAUNCH;
|
||||
}
|
||||
|
||||
try {
|
||||
String vmArgs = System.getProperty(EclipseCommandLine.PROP_VMARGS);
|
||||
if (StringUtils.isNotBlank(vmArgs)) {
|
||||
|
||||
@@ -26,14 +26,12 @@ import org.eclipse.ui.application.IWorkbenchConfigurer;
|
||||
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
|
||||
import org.eclipse.ui.application.WorkbenchWindowAdvisor;
|
||||
import org.eclipse.ui.internal.ide.application.IDEWorkbenchAdvisor;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.exception.LoginException;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.commons.utils.system.EclipseCommandLine;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
import org.talend.core.repository.utils.LoginTaskRegistryReader;
|
||||
import org.talend.core.service.ICloudSignOnService;
|
||||
import org.talend.core.ui.branding.IBrandingConfiguration;
|
||||
import org.talend.core.ui.branding.IBrandingService;
|
||||
import org.talend.core.ui.services.IGitUIProviderService;
|
||||
@@ -137,33 +135,20 @@ public class ApplicationWorkbenchAdvisor extends IDEWorkbenchAdvisor {
|
||||
@Override
|
||||
public void postStartup() {
|
||||
super.postStartup();
|
||||
try {
|
||||
if (ICloudSignOnService.get() != null && ICloudSignOnService.get().isSignViaCloud()) {
|
||||
ICloudSignOnService.get().startHeartBeat();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
|
||||
if (!ArrayUtils.contains(Platform.getApplicationArgs(), EclipseCommandLine.TALEND_DISABLE_LOGINDIALOG_COMMAND)) {
|
||||
RegisterManagement.getInstance().validateRegistration();
|
||||
}
|
||||
|
||||
// PerspectiveReviewUtil.checkPerspectiveDisplayItems();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean preShutdown() {
|
||||
boolean preShutwond = super.preShutdown();
|
||||
boolean commitChanges = true;
|
||||
if (ICloudSignOnService.get() != null && ICloudSignOnService.get().isReloginDialogRunning()) {
|
||||
commitChanges = false;
|
||||
if (IGitUIProviderService.get() != null && IGitUIProviderService.get().checkPendingChanges()) {
|
||||
return false;
|
||||
}
|
||||
if (commitChanges && IGitUIProviderService.get() != null && IGitUIProviderService.get().checkPendingChanges()) {
|
||||
preShutwond = false;
|
||||
}
|
||||
if (preShutwond && ICloudSignOnService.get() != null) {
|
||||
ICloudSignOnService.get().stopHeartBeat();
|
||||
}
|
||||
return preShutwond;
|
||||
return super.preShutdown();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -67,12 +67,8 @@ public class PendoImportManager {
|
||||
|
||||
private PendoSignImportProperties importProperties = new PendoSignImportProperties();
|
||||
|
||||
// sourceVersion based on item. the project version item created/modified
|
||||
private Set<String> projectVersionSet = new HashSet<String>();
|
||||
|
||||
// productVersion based on talend.project. possible list multiple projects on import wizard.
|
||||
private Set<String> importProductVersion = new HashSet<String>();
|
||||
|
||||
private Map<String, Integer> tosUnsignItemMap = new HashMap<String, Integer>();
|
||||
|
||||
private Map<String, Property> itemPropertyCache = new HashMap<String, Property>();
|
||||
@@ -134,9 +130,6 @@ public class PendoImportManager {
|
||||
if (StringUtils.isNotBlank(itemProductVersion)) {
|
||||
projectVersionSet.add(itemProductVersion);
|
||||
}
|
||||
if (itemRecord.getItemProject() != null && StringUtils.isNotBlank(itemRecord.getItemProject().getProductVersion())) {
|
||||
importProductVersion.add(itemRecord.getItemProject().getProductVersion());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e, Level.WARN);
|
||||
}
|
||||
@@ -151,10 +144,6 @@ public class PendoImportManager {
|
||||
List<String> sourceVersion = new ArrayList<String>(projectVersionSet);
|
||||
Collections.sort(sourceVersion);
|
||||
importProperties.setSourceVersion(sourceVersion);
|
||||
List<String> productVersion = new ArrayList<String>(importProductVersion);
|
||||
Collections.sort(productVersion);
|
||||
importProperties.setImportProduct(productVersion);
|
||||
|
||||
importProperties.setStudioVersion(PendoItemSignatureUtil.getStudioVersion());
|
||||
ICoreTisService tisService = ICoreTisService.get();
|
||||
if (tisService != null) {
|
||||
|
||||
@@ -984,7 +984,6 @@ DatabaseForm.redshift.driverVersion=Driver version
|
||||
DatabaseForm.redshift.driverVersion.tip=Select a Redshift driver
|
||||
DatabaseForm.redshift.useStringAdditionParam=Use string parameter
|
||||
DatabaseForm.supportnls=Support NLS
|
||||
DatabaseForm.supportnls.warntip=Change the previous status will take effect after restart studio
|
||||
DatabaseTableFilterForm.allSynonyms=All synonyms
|
||||
DatabaseTableFilterForm.edit=Edit...
|
||||
DatabaseTableFilterForm.editFilterName=Edit Filter Name
|
||||
|
||||
@@ -983,7 +983,6 @@ DatabaseForm.helpInfo.installDriverLink.label=Installer un pilote
|
||||
DatabaseForm.redshift.driverVersion=Version du pilote
|
||||
DatabaseForm.redshift.driverVersion.tip=S\u00E9lectionnez un pilote Redshift
|
||||
DatabaseForm.redshift.useStringAdditionParam=Utiliser un param\u00E8tre de cha\u00EEne de caract\u00E8res
|
||||
DatabaseForm.supportnls=Support de NLS
|
||||
DatabaseTableFilterForm.allSynonyms=Tous les synonymes
|
||||
DatabaseTableFilterForm.edit=Modifier...
|
||||
DatabaseTableFilterForm.editFilterName=Modifier le nom du filtre
|
||||
|
||||
@@ -65,7 +65,6 @@ import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Group;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Link;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
@@ -1084,24 +1083,12 @@ public class DatabaseForm extends AbstractForm {
|
||||
}
|
||||
|
||||
private void createOracleUIForNLS(Composite parent) {
|
||||
supportNLSContainer = new Composite(parent, SWT.NONE);
|
||||
GridData containerLayoutData = new GridData();
|
||||
containerLayoutData.exclude = true;
|
||||
supportNLSContainer.setLayoutData(containerLayoutData);
|
||||
supportNLSContainer.setVisible(false);
|
||||
|
||||
GridLayout containerLayout = new GridLayout();
|
||||
containerLayout.numColumns = 2;
|
||||
containerLayout.marginWidth = 0;
|
||||
containerLayout.marginHeight = 0;
|
||||
containerLayout.horizontalSpacing = 0;
|
||||
containerLayout.makeColumnsEqualWidth = false;
|
||||
supportNLSContainer.setLayout(containerLayout);
|
||||
|
||||
isOracleSupportNLS = new Button(supportNLSContainer, SWT.CHECK);
|
||||
isOracleSupportNLS = new Button(parent, SWT.CHECK);
|
||||
isOracleSupportNLS.setText(Messages.getString("DatabaseForm.supportnls"));//$NON-NLS-1$
|
||||
GridData oracleSupportNLSLayoutData = new GridData();
|
||||
oracleSupportNLSLayoutData.exclude = true;
|
||||
isOracleSupportNLS.setLayoutData(oracleSupportNLSLayoutData);
|
||||
isOracleSupportNLS.setVisible(false);
|
||||
isOracleSupportNLS.addSelectionListener(new SelectionAdapter() {
|
||||
|
||||
@Override
|
||||
@@ -1109,10 +1096,6 @@ public class DatabaseForm extends AbstractForm {
|
||||
getConnection().setSupportNLS(isOracleSupportNLS.getSelection());
|
||||
}
|
||||
});
|
||||
imageLabel = new Label(supportNLSContainer, SWT.NONE);
|
||||
imageLabel.setImage(ImageProvider.getImage(EImage.WARNING_ICON));
|
||||
imageLabel.setLayoutData(new GridData());
|
||||
imageLabel.setToolTipText(Messages.getString("DatabaseForm.supportnls.warntip"));
|
||||
}
|
||||
|
||||
private void createHiveDataprocField(Composite parent) {
|
||||
@@ -6805,10 +6788,6 @@ public class DatabaseForm extends AbstractForm {
|
||||
|
||||
private static String DEFAULT_HIVE_METASTORE_PORT = "9083";
|
||||
|
||||
private Label imageLabel;
|
||||
|
||||
private Composite supportNLSContainer;
|
||||
|
||||
/**
|
||||
* SetEditable fields.
|
||||
*
|
||||
@@ -7286,16 +7265,15 @@ public class DatabaseForm extends AbstractForm {
|
||||
}
|
||||
|
||||
private void showOracleSupportNLS(boolean show) {
|
||||
GridData layoutData = (GridData) supportNLSContainer.getLayoutData();
|
||||
GridData layoutData = (GridData) isOracleSupportNLS.getLayoutData();
|
||||
layoutData.exclude = !show;
|
||||
supportNLSContainer.setLayoutData(layoutData);
|
||||
supportNLSContainer.setVisible(show);
|
||||
imageLabel.setVisible(show);
|
||||
isOracleSupportNLS.setLayoutData(layoutData);
|
||||
isOracleSupportNLS.setVisible(show);
|
||||
if(!show) {
|
||||
isOracleSupportNLS.setSelection(false);
|
||||
getConnection().setSupportNLS(false);
|
||||
}
|
||||
supportNLSContainer.getParent().layout();
|
||||
isOracleSupportNLS.getParent().layout();
|
||||
}
|
||||
|
||||
private boolean isSupportNLSOracleVersion(String dbVersionString) {
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/commons-exec.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
@@ -1,47 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>org.talend.signon.util</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||
<nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -1,20 +0,0 @@
|
||||
Manifest-Version: 1.0
|
||||
Automatic-Module-Name: org.talend.signon.util
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Cloud sign on util
|
||||
Bundle-SymbolicName: org.talend.signon.util;singleton:=true
|
||||
Bundle-Version: 8.8.8.qualifier
|
||||
Eclipse-LazyStart: true
|
||||
Bundle-ClassPath: .,
|
||||
lib/commons-exec.jar
|
||||
Bundle-Vendor: .Talend SA.
|
||||
Import-Package: org.osgi.framework;version="1.10.0",
|
||||
org.talend.utils.json
|
||||
Export-Package: org.talend.signon.util,
|
||||
org.talend.signon.util.i18n,
|
||||
org.talend.signon.util.listener
|
||||
Require-Bundle: org.talend.utils,
|
||||
org.apache.log4j,
|
||||
org.eclipse.osgi,
|
||||
org.eclipse.equinox.common,
|
||||
org.eclipse.core.runtime
|
||||
@@ -1 +0,0 @@
|
||||
jarprocessor.exclude.children=true
|
||||
@@ -1,8 +0,0 @@
|
||||
source.. = src/main/java/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
plugin.xml,\
|
||||
schema/,\
|
||||
lib/commons-exec.jar
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.2"?>
|
||||
<plugin>
|
||||
</plugin>
|
||||
@@ -1,44 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.talend.studio</groupId>
|
||||
<artifactId>tcommon-studio-se</artifactId>
|
||||
<version>8.8.8-SNAPSHOT</version>
|
||||
<relativePath>../../../</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>org.talend.signon.util</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>2.8</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<!-- same as org.talend.libraries.excel -->
|
||||
<id>copy-maven-repository</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<stripVersion>true</stripVersion>
|
||||
<outputDirectory>${project.basedir}/lib</outputDirectory>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-exec</artifactId>
|
||||
<version>1.3</version>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -1 +0,0 @@
|
||||
SSOClientExec.error.timeout=Timeout waiting for login
|
||||
@@ -1 +0,0 @@
|
||||
SSOClientExec.error.timeout=D\u00E9lai d'attente avant expiration de la connexion
|
||||
@@ -1 +0,0 @@
|
||||
SSOClientExec.error.timeout=\u30ED\u30B0\u30A4\u30F3\u5F85\u3061\u306E\u30BF\u30A4\u30E0\u30A2\u30A6\u30C8
|
||||
@@ -1 +0,0 @@
|
||||
SSOClientExec.error.timeout=\u7B49\u5F85\u767B\u5F55\u8D85\u65F6
|
||||
@@ -1,55 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.signon.util;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
|
||||
/**
|
||||
* DOC amaumont class global comment. Detailled comment <br/>
|
||||
*
|
||||
*/
|
||||
public class EnvironmentUtils {
|
||||
|
||||
public static boolean isWindowsSystem() {
|
||||
return getEnvOs().startsWith("Windows"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public static boolean isLinuxUnixSystem() {
|
||||
return !isWindowsSystem() && !isMacOsSytem();
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC amaumont Comment method "isMacOsSytem".
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static boolean isMacOsSytem() {
|
||||
return getEnvOs().startsWith("Mac"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC amaumont Comment method "getEnv".
|
||||
*/
|
||||
public static String getEnvOs() {
|
||||
return System.getProperty("os.name"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public static boolean isX86_64() {
|
||||
return StringUtils.equals(Platform.ARCH_X86_64, Platform.getOSArch());
|
||||
}
|
||||
|
||||
public static boolean isAarch64() {
|
||||
return StringUtils.equals(Platform.ARCH_AARCH64, Platform.getOSArch());
|
||||
}
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.signon.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
|
||||
import org.eclipse.osgi.service.datalocation.Location;
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.Filter;
|
||||
import org.osgi.framework.FrameworkUtil;
|
||||
import org.osgi.framework.InvalidSyntaxException;
|
||||
import org.osgi.framework.ServiceReference;
|
||||
import org.osgi.util.tracker.ServiceTracker;
|
||||
|
||||
public class EquinoxUtils {
|
||||
|
||||
public static URL[] getConfigAreaURL(BundleContext context) {
|
||||
Location configLocation = getConfigLocation(context);
|
||||
if (configLocation == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
URL baseURL = configLocation.getURL();
|
||||
if (configLocation.getParentLocation() != null && configLocation.getURL() != null) {
|
||||
if (baseURL == null) {
|
||||
return new URL[] { configLocation.getParentLocation().getURL() };
|
||||
} else {
|
||||
return new URL[] { baseURL, configLocation.getParentLocation().getURL() };
|
||||
}
|
||||
}
|
||||
if (baseURL != null) {
|
||||
return new URL[] { baseURL };
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Location getConfigLocation(BundleContext context) {
|
||||
Filter filter = null;
|
||||
try {
|
||||
filter = context.createFilter(Location.CONFIGURATION_FILTER);
|
||||
} catch (InvalidSyntaxException e) {
|
||||
// should not happen
|
||||
}
|
||||
ServiceTracker configLocationTracker = new ServiceTracker(context, filter, null);
|
||||
configLocationTracker.open();
|
||||
try {
|
||||
return (Location) configLocationTracker.getService();
|
||||
} finally {
|
||||
configLocationTracker.close();
|
||||
}
|
||||
}
|
||||
|
||||
public static URI getInstallLocationURI(BundleContext context) {
|
||||
try {
|
||||
ServiceReference[] references = context.getServiceReferences(Location.class.getName(), Location.INSTALL_FILTER);
|
||||
if (references != null && references.length > 0) {
|
||||
ServiceReference reference = references[0];
|
||||
Location installLocation = (Location) context.getService(reference);
|
||||
if (installLocation != null) {
|
||||
try {
|
||||
if (installLocation.isSet()) {
|
||||
URL location = installLocation.getURL();
|
||||
return URIUtil.toURI(location);
|
||||
}
|
||||
} catch (URISyntaxException e) {
|
||||
// TODO: log an error
|
||||
} finally {
|
||||
context.ungetService(reference);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (InvalidSyntaxException e) {
|
||||
// TODO: log an error
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// always return a valid bundlesContext or throw a runtimeException
|
||||
public static BundleContext getCurrentBundleContext() {
|
||||
Bundle bundle = FrameworkUtil.getBundle(EquinoxUtils.class);
|
||||
if (bundle != null) {
|
||||
BundleContext bundleContext = bundle.getBundleContext();
|
||||
if (bundleContext != null) {
|
||||
return bundleContext;
|
||||
} else {
|
||||
throw new RuntimeException(
|
||||
"could not find current BundleContext, this should never happen, check that the bunlde is activated when this class is accessed");
|
||||
}
|
||||
} else {
|
||||
throw new RuntimeException(
|
||||
"could not find current Bundle, this should never happen, check that the bunlde is activated when this class is accessed");
|
||||
}
|
||||
}
|
||||
|
||||
public static File getConfigurationFolder() {
|
||||
BundleContext configuratorBundleContext = getCurrentBundleContext();
|
||||
final URL url = getConfigLocation(configuratorBundleContext).getURL();
|
||||
try {
|
||||
return URIUtil.toFile(URIUtil.toURI(url));
|
||||
} catch (URISyntaxException e) {
|
||||
//
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.signon.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
import org.apache.commons.exec.CommandLine;
|
||||
import org.apache.commons.exec.DefaultExecutor;
|
||||
import org.apache.commons.exec.ExecuteException;
|
||||
import org.apache.commons.exec.ExecuteWatchdog;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.eclipse.equinox.app.IApplication;
|
||||
import org.talend.signon.util.i18n.Messages;
|
||||
import org.talend.signon.util.listener.LoginEventListener;
|
||||
|
||||
public class SSOClientExec implements Runnable {
|
||||
|
||||
private static Logger LOGGER = Logger.getLogger(SSOClientExec.class);
|
||||
|
||||
public static final String STUDIO_CALL_PREFIX = "studioCall:";
|
||||
|
||||
private static final String STUDIO_SSO_CLIENT_DEBUG_PORT = "talend.studio.sso.client.debug.port";
|
||||
|
||||
private File execFile;
|
||||
|
||||
private String codeChallenge;
|
||||
|
||||
private String clientId;
|
||||
|
||||
private int port;
|
||||
|
||||
private ExecuteWatchdog executeWatchdog;
|
||||
|
||||
private Exception error;
|
||||
|
||||
private LoginEventListener listener;
|
||||
|
||||
public SSOClientExec(File execFile, String clientId, String codeChallenge, int port, LoginEventListener listener) {
|
||||
this.execFile = execFile;
|
||||
this.clientId = clientId;
|
||||
this.codeChallenge = codeChallenge;
|
||||
this.port = port;
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
int exitValue = 0;
|
||||
try {
|
||||
CommandLine cmdLine = new CommandLine(execFile);
|
||||
String url = getInvokeParameter(clientId, port);
|
||||
cmdLine.addArgument(url);
|
||||
if (SSOClientUtil.isDebugMode()) {
|
||||
LOGGER.info("Opening:" + url.substring(STUDIO_CALL_PREFIX.length()));
|
||||
}
|
||||
if (getClientDebugPort() != null) {
|
||||
cmdLine.addArgument("-vmargs");
|
||||
cmdLine.addArgument("-Xdebug");
|
||||
String cmd = "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=*:" + getClientDebugPort();
|
||||
cmdLine.addArgument(cmd);
|
||||
}
|
||||
DefaultExecutor executor = new DefaultExecutor();
|
||||
executeWatchdog = new ExecuteWatchdog(900000);
|
||||
executor.setWatchdog(executeWatchdog);
|
||||
executor.setExitValues(new int[] { 0, 24, 143 }); // normal, restart, process existed
|
||||
if (!execFile.canExecute()) {
|
||||
execFile.setExecutable(true);
|
||||
}
|
||||
executor.setWorkingDirectory(execFile.getParentFile());
|
||||
exitValue = executor.execute(cmdLine);
|
||||
if (IApplication.EXIT_RELAUNCH == exitValue) {
|
||||
cmdLine = new CommandLine(execFile);
|
||||
if (getClientDebugPort() != null) {
|
||||
cmdLine.addArgument("-vmargs");
|
||||
cmdLine.addArgument("-Xdebug");
|
||||
String cmd = "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=*:" + getClientDebugPort();
|
||||
cmdLine.addArgument(cmd);
|
||||
}
|
||||
exitValue = executor.execute(cmdLine);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
error = e;
|
||||
LOGGER.error(e);
|
||||
listener.loginFailed(e);
|
||||
}
|
||||
}
|
||||
|
||||
private String getClientDebugPort() {
|
||||
return System.getProperty(STUDIO_SSO_CLIENT_DEBUG_PORT);
|
||||
}
|
||||
|
||||
private String getInvokeParameter(String clientID, int callbackPort) throws UnsupportedEncodingException {
|
||||
return STUDIO_CALL_PREFIX + SSOClientUtil.getInstance().getSignOnURL(clientID, codeChallenge, callbackPort);
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
if (executeWatchdog != null && !executeWatchdog.killedProcess()) {
|
||||
executeWatchdog.destroyProcess();
|
||||
}
|
||||
}
|
||||
|
||||
public Exception getError() {
|
||||
return error;
|
||||
}
|
||||
}
|
||||
@@ -1,131 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.signon.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.eclipse.core.runtime.FileLocator;
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.talend.utils.io.FilesUtils;
|
||||
|
||||
public class SSOClientInstaller {
|
||||
|
||||
private static Logger LOGGER = Logger.getLogger(SSOClientInstaller.class);
|
||||
|
||||
private final String SIGN_CLIENT_BUNDLE_NAME = "org.talend.singlesignon.client";
|
||||
|
||||
private final String INSTALL_FOLDER_NAME = "repository";
|
||||
|
||||
private final String INSTALL_FILE_NAME = "TalendSignTool.zip";
|
||||
|
||||
private final String version = "8.0.1.202206081050";
|
||||
|
||||
private static final SSOClientInstaller instance = new SSOClientInstaller();
|
||||
|
||||
public static SSOClientInstaller getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
private SSOClientInstaller() {
|
||||
}
|
||||
|
||||
public boolean isNeedInstall() {
|
||||
String installedVersion = getInstalledVersion();
|
||||
if (SSOClientUtil.isDebugMode()) {
|
||||
LOGGER.info(String.format("Installed client version is %s and latest version is %s .", installedVersion, version));
|
||||
}
|
||||
if (installedVersion != null && installedVersion.compareTo(version) >= 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void install() throws Exception {
|
||||
File sourceFile = getInstallFile();
|
||||
if (!sourceFile.exists()) {
|
||||
LOGGER.error("Can't find install file:" + sourceFile.getAbsolutePath());
|
||||
}
|
||||
File targetFolder = getInstallDir();
|
||||
if (targetFolder.exists()) {
|
||||
FilesUtils.deleteFolder(targetFolder, true);
|
||||
LOGGER.info("Deleted target folder:" + targetFolder.getAbsolutePath());
|
||||
}
|
||||
targetFolder.mkdirs();
|
||||
if (SSOClientUtil.isDebugMode()) {
|
||||
LOGGER.info("Created target folder:" + targetFolder.getAbsolutePath());
|
||||
}
|
||||
FilesUtils.unzip(sourceFile.getAbsolutePath(), targetFolder.getAbsolutePath(), true);
|
||||
if (SSOClientUtil.isDebugMode()) {
|
||||
LOGGER.info("Installed client:" + targetFolder.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
private String getInstalledVersion() {
|
||||
FileInputStream in = null;
|
||||
try {
|
||||
File eclipseProductFile = getEclipseProductFile();
|
||||
if (eclipseProductFile != null && eclipseProductFile.exists()) {
|
||||
Properties p = new Properties();
|
||||
in = new FileInputStream(eclipseProductFile);
|
||||
p.load(in);
|
||||
String productFileVersion = p.getProperty("version"); //$NON-NLS-1$
|
||||
return productFileVersion;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOGGER.error(e);
|
||||
} finally {
|
||||
if (in != null) {
|
||||
try {
|
||||
in.close();
|
||||
} catch (IOException e) {
|
||||
LOGGER.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private File getEclipseProductFile() throws URISyntaxException {
|
||||
File eclipseproductFile = new File(getInstallDir(), ".eclipseproduct");//$NON-NLS-1$
|
||||
return eclipseproductFile;
|
||||
}
|
||||
|
||||
protected File getInstallDir() {
|
||||
return SSOClientUtil.getSSOClientFolder();
|
||||
}
|
||||
|
||||
protected File getInstallFile() throws IOException {
|
||||
BundleContext context = EquinoxUtils.getCurrentBundleContext();
|
||||
Bundle[] bundles = context.getBundles();
|
||||
Bundle bundle = null;
|
||||
for (Bundle b : bundles) {
|
||||
if (SIGN_CLIENT_BUNDLE_NAME.equals(b.getSymbolicName())) {
|
||||
bundle = b;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (bundle != null) {
|
||||
File bundleFile = FileLocator.getBundleFile(bundle).getAbsoluteFile();
|
||||
File folder = new File(bundleFile, INSTALL_FOLDER_NAME);
|
||||
File installFile = new File(folder, INSTALL_FILE_NAME);
|
||||
return installFile;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,217 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.signon.util;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.talend.signon.util.listener.LoginEventListener;
|
||||
|
||||
public class SSOClientMonitor implements Runnable {
|
||||
|
||||
private static Logger LOGGER = Logger.getLogger(SSOClientMonitor.class);
|
||||
|
||||
private static final String STUDIO_AUTH_CODE_KEY = "code";
|
||||
|
||||
private static final String STUDIO_AUTH_STATE_KEY = "state";
|
||||
|
||||
private static final String STUDIO_CALLBACK_PREFIX = "studioCallback:";
|
||||
|
||||
private static final String STUDIO_CALLBACK_ERROR_PREFIX = "studioCallbackError:";
|
||||
|
||||
private static final SSOClientMonitor instance = new SSOClientMonitor();
|
||||
|
||||
private static int listenPort = -1;
|
||||
|
||||
private static volatile boolean isRunning = false;
|
||||
|
||||
private Set<LoginEventListener> listenerSet = new HashSet<LoginEventListener>();
|
||||
|
||||
public static SSOClientMonitor getInscance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
private SSOClientMonitor() {
|
||||
|
||||
}
|
||||
|
||||
private void processData(String msg) {
|
||||
if (msg.startsWith(STUDIO_CALLBACK_PREFIX)) {
|
||||
msg = msg.substring(STUDIO_CALLBACK_PREFIX.length());
|
||||
Map<String, String> data = decodeMsg(msg);
|
||||
String code = data.get(STUDIO_AUTH_CODE_KEY);
|
||||
String state = data.get(STUDIO_AUTH_STATE_KEY);
|
||||
|
||||
String[] splits = state.split(",");
|
||||
String dateCenter = TMCRepositoryUtil.getDefaultDataCenter();
|
||||
if (splits.length == 2) {
|
||||
dateCenter = splits[1];
|
||||
}
|
||||
fireLoginStop(code, dateCenter);
|
||||
}
|
||||
|
||||
if (msg.startsWith(STUDIO_CALLBACK_ERROR_PREFIX)) {
|
||||
msg = msg.substring(STUDIO_CALLBACK_ERROR_PREFIX.length());
|
||||
fireLoginFailed(new Exception (msg));
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, String> decodeMsg(String data) {
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
if (data.startsWith(STUDIO_CALLBACK_PREFIX)) {
|
||||
data = data.substring(STUDIO_CALLBACK_PREFIX.length());
|
||||
}
|
||||
if (data.startsWith(SSOUtil.STUDIO_REDIRECT_URL)) {
|
||||
data = data.substring(SSOUtil.STUDIO_REDIRECT_URL.length());
|
||||
}
|
||||
if (data.startsWith("?")) {
|
||||
data = data.substring("?".length());
|
||||
}
|
||||
|
||||
String[] splits = data.split("&");
|
||||
for (int i = 0; i < splits.length; i++) {
|
||||
String str = splits[i];
|
||||
String[] spls = str.split("=");
|
||||
if (spls.length == 2) {
|
||||
map.put(spls[0], spls[1]);
|
||||
} else {
|
||||
LOGGER.error("Parse msg error is should be contains =:" + str);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
isRunning = false;
|
||||
listenPort = -1;
|
||||
}
|
||||
|
||||
private Integer newPort() {
|
||||
final Integer port = Integer.getInteger("stduio.login.client.monitor.port", -1);
|
||||
if (port <= 0) {
|
||||
try (ServerSocket socket = new ServerSocket(0)) {
|
||||
socket.setReuseAddress(true);
|
||||
return socket.getLocalPort();
|
||||
} catch (final IOException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
return port;
|
||||
}
|
||||
|
||||
private void fireLoginStop(String code, String dataCenter) {
|
||||
for (LoginEventListener l : listenerSet) {
|
||||
try {
|
||||
l.loginStop(code, dataCenter);
|
||||
} catch (Exception ex) {
|
||||
LOGGER.error(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void fireLoginStart() {
|
||||
for (LoginEventListener l : listenerSet) {
|
||||
try {
|
||||
l.loginStart();
|
||||
} catch (Exception ex) {
|
||||
LOGGER.error(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void fireLoginFailed(Exception ex) {
|
||||
for (LoginEventListener l : listenerSet) {
|
||||
try {
|
||||
l.loginFailed(ex);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addLoginEventListener(LoginEventListener listener) {
|
||||
listenerSet.add(listener);
|
||||
}
|
||||
|
||||
public void removeLoginEventListener(LoginEventListener listener) {
|
||||
if (listenerSet.contains(listener)) {
|
||||
listenerSet.remove(listener);
|
||||
}
|
||||
}
|
||||
|
||||
public int getListenPort() {
|
||||
return listenPort;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (isRunning) {
|
||||
LOGGER.info("Login client monitor started.");
|
||||
return;
|
||||
}
|
||||
listenPort = newPort();
|
||||
ServerSocket server;
|
||||
try {
|
||||
server = new ServerSocket(listenPort);
|
||||
if (SSOClientUtil.isDebugMode()) {
|
||||
LOGGER.info("Start sso client monitor on " + listenPort);
|
||||
}
|
||||
isRunning = true;
|
||||
fireLoginStart();
|
||||
while (isRunning) {
|
||||
Socket socket = server.accept();
|
||||
try {
|
||||
InputStream inputStream = socket.getInputStream();
|
||||
byte[] bytes = new byte[1024];
|
||||
int len;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
while ((len = inputStream.read(bytes)) != -1) {
|
||||
sb.append(new String(bytes, 0, len, StandardCharsets.UTF_8));
|
||||
}
|
||||
inputStream.close();
|
||||
processData(sb.toString());
|
||||
stop();
|
||||
if (SSOClientUtil.isDebugMode()) {
|
||||
LOGGER.info("Stop sso client monitor");
|
||||
}
|
||||
break;
|
||||
} catch (Exception e) {
|
||||
LOGGER.error(e);
|
||||
fireLoginFailed(e);
|
||||
} finally {
|
||||
try {
|
||||
socket.close();
|
||||
} catch (IOException e) {
|
||||
LOGGER.error(e);
|
||||
fireLoginFailed(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
LOGGER.error(ex);
|
||||
fireLoginFailed(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isRunning() {
|
||||
return isRunning;
|
||||
}
|
||||
}
|
||||
@@ -1,285 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.signon.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.talend.signon.util.listener.LoginEventListener;
|
||||
import org.talend.utils.io.FilesUtils;
|
||||
|
||||
public class SSOClientUtil {
|
||||
|
||||
private static Logger LOGGER = Logger.getLogger(SSOClientUtil.class);
|
||||
|
||||
private static final String STUDIO_CLIENT_ID = "0c51933d-c542-4918-9baf-86ef709af5d8";
|
||||
|
||||
private static final String CLIENT_FILE_PATH_PROPERTY = "talend.studio.signon.client.path";
|
||||
|
||||
private static final String CLIENT_FILE_NAME_ON_WINDOWS = "Talend_Sign_On_Tool_win-x86_64.exe";
|
||||
|
||||
private static final String CLIENT_FILE_NAME_ON_LINUX_X86 = "Talend_Sign_On_Tool_linux_gtk_x86_64";
|
||||
|
||||
private static final String CLIENT_FILE_NAME_ON_LINUX_AARCH64 = "Talend_Sign_On_Tool_linux_gtk_aarch64";
|
||||
|
||||
private static final String CLIENT_FILE_NAME_ON_MAC_X86 = "Talend_Sign_On_Tool.app";
|
||||
|
||||
private static final String CLIENT_FILE_NAME_ON_MAC_AARCH64 = "Talend_Sign_On_Tool_aarch64.app";
|
||||
|
||||
private static final String STUDIO_INI_FILE_NAME_ON_WINDOWS = "Talend-Studio-win-x86_64.ini";
|
||||
|
||||
private static final String STUDIO_INI_FILE_NAME_ON_LINUX_X86 = "Talend-Studio-linux-gtk-x86_64.ini";
|
||||
|
||||
private static final String STUDIO_INI_FILE_NAME_ON_LINUX_AARCH64 = "Talend-Studio-linux-gtk-aarch64.ini";
|
||||
|
||||
private static final String STUDIO_INI_FILE_NAME_ON_MAC_X86 = "Talend-Studio-macosx-cocoa.ini";
|
||||
|
||||
private static final String STUDIO_INI_FILE_NAME_ON_MAC_AARCH64 = "Talend-Studio-macosx-cocoa.ini";
|
||||
|
||||
private static final String CLIENT_INI_FILE_NAME_ON_WINDOWS = "Talend_Sign_On_Tool_win-x86_64.ini";
|
||||
|
||||
private static final String CLIENT_INI_FILE_NAME_ON_LINUX_X86 = "Talend_Sign_On_Tool_linux_gtk_x86_64.ini";
|
||||
|
||||
private static final String CLIENT_INI_FILE_NAME_ON_LINUX_AARCH64 = "Talend_Sign_On_Tool_linux_gtk_aarch64.ini";
|
||||
|
||||
private static final String CLIENT_INI_FILE_NAME_ON_MAC_X86 = "Talend_Sign_On_Tool.ini";
|
||||
|
||||
private static final String CLIENT_INI_FILE_NAME_ON_MAC_AARCH64 = "Talend_Sign_On_Tool_aarch64.ini";
|
||||
|
||||
private static final String DEBUG_PARAMETER_NAME = "-Xdebug";
|
||||
|
||||
static final String KEEP_STUDIO_DEBUG_PARAM = "talend.keep.debug.parameter";
|
||||
|
||||
private static final String CLIENT_FOLDER_NAME = "studio_sso_client";
|
||||
|
||||
static final String DATA_CENTER_KEY = "talend.tmc.datacenter";
|
||||
|
||||
static final String DATA_CENTER_DISPLAY_KEY = "talend.tmc.datacenter.display";
|
||||
|
||||
public static final String TALEND_DEBUG = "--talendDebug"; //$NON-NLS-1$
|
||||
|
||||
private static final SSOClientUtil instance = new SSOClientUtil();
|
||||
|
||||
private boolean needSetupJVMParam = true;
|
||||
|
||||
private SSOClientExec signOnClientExec;
|
||||
|
||||
private SSOClientUtil() {
|
||||
if (SSOClientInstaller.getInstance().isNeedInstall()) {
|
||||
try {
|
||||
SSOClientInstaller.getInstance().install();
|
||||
} catch (Exception e) {
|
||||
LOGGER.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getClientID() throws IOException {
|
||||
return STUDIO_CLIENT_ID;
|
||||
}
|
||||
|
||||
private File getSSOClientAppFile() throws Exception {
|
||||
if (System.getProperty(CLIENT_FILE_PATH_PROPERTY) != null) {
|
||||
return new File(System.getProperty(CLIENT_FILE_PATH_PROPERTY));
|
||||
}
|
||||
File folder = getSSOClientFolder();
|
||||
if (EnvironmentUtils.isWindowsSystem()) {
|
||||
return new File(folder, CLIENT_FILE_NAME_ON_WINDOWS);
|
||||
} else if (EnvironmentUtils.isLinuxUnixSystem()) {
|
||||
if (EnvironmentUtils.isX86_64()) {
|
||||
return new File(folder, CLIENT_FILE_NAME_ON_LINUX_X86);
|
||||
} else if (EnvironmentUtils.isAarch64()) {
|
||||
return new File(folder, CLIENT_FILE_NAME_ON_LINUX_AARCH64);
|
||||
}
|
||||
} else if (EnvironmentUtils.isMacOsSytem()) {
|
||||
File appFolder = null;
|
||||
if (EnvironmentUtils.isX86_64()) {
|
||||
appFolder = new File(folder, CLIENT_FILE_NAME_ON_MAC_X86);
|
||||
} else if (EnvironmentUtils.isAarch64()) {
|
||||
appFolder = new File(folder, CLIENT_FILE_NAME_ON_MAC_AARCH64);
|
||||
}
|
||||
if (appFolder != null) {
|
||||
return new File(appFolder, "Contents/MacOS/Talend_Sign_On_Tool");
|
||||
}
|
||||
}
|
||||
throw new Exception("Unsupported OS");
|
||||
}
|
||||
|
||||
public static File getSSOClientFolder() {
|
||||
File configFolder = EquinoxUtils.getConfigurationFolder();
|
||||
File signClientFolder = new File(configFolder, CLIENT_FOLDER_NAME);
|
||||
return signClientFolder;
|
||||
}
|
||||
|
||||
private synchronized void startSignOnClient(LoginEventListener listener) throws Exception {
|
||||
if (needSetupJVMParam) {
|
||||
setupJVMParams();
|
||||
needSetupJVMParam = false;
|
||||
}
|
||||
if (signOnClientExec != null) {
|
||||
signOnClientExec.stop();
|
||||
}
|
||||
String clientId = getClientID();
|
||||
File execFile = getSSOClientAppFile();
|
||||
String codeChallenge = listener.getCodeChallenge();
|
||||
if (isDebugMode()) {
|
||||
LOGGER.info("Prepare to start log in cloud client monitor");
|
||||
}
|
||||
SSOClientMonitor signOnClientListener = SSOClientMonitor.getInscance();
|
||||
signOnClientListener.addLoginEventListener(listener);
|
||||
new Thread(signOnClientListener).start();
|
||||
if (isDebugMode()) {
|
||||
LOGGER.info("Log in cloud client monitor started.");
|
||||
}
|
||||
while (!SSOClientMonitor.isRunning()) {
|
||||
TimeUnit.MILLISECONDS.sleep(100);
|
||||
}
|
||||
if (signOnClientListener.getListenPort() < 0) {
|
||||
throw new Exception("Log in cloud client monitor start failed.");
|
||||
}
|
||||
if (isDebugMode()) {
|
||||
LOGGER.info("Prepare to start cloud client on " + signOnClientListener.getListenPort());
|
||||
}
|
||||
signOnClientExec = new SSOClientExec(execFile, clientId, codeChallenge, signOnClientListener.getListenPort(), listener);
|
||||
new Thread(signOnClientExec).start();
|
||||
if (isDebugMode()) {
|
||||
LOGGER.info("Login cloud client started.");
|
||||
}
|
||||
}
|
||||
|
||||
private void setupJVMParams() throws Exception {
|
||||
File studioIniFile = getStudioIniFile();
|
||||
if (studioIniFile != null && studioIniFile.exists()) {
|
||||
List<String> fileContentList = FilesUtils.getContentLines(studioIniFile.getPath());
|
||||
int debugIndex = -1;
|
||||
for (int i = 0; i < fileContentList.size(); i++) {
|
||||
String str = fileContentList.get(i);
|
||||
if (DEBUG_PARAMETER_NAME.equals(str.trim())) {
|
||||
debugIndex = i;
|
||||
}
|
||||
}
|
||||
if (!keepDebugParam() && debugIndex >= 0 && fileContentList.size() > debugIndex + 1) {
|
||||
fileContentList.remove(debugIndex + 1);
|
||||
fileContentList.remove(debugIndex);
|
||||
}
|
||||
saveIniFile(fileContentList);
|
||||
} else {
|
||||
LOGGER.error("Can't find Studio's ini file.");
|
||||
}
|
||||
}
|
||||
|
||||
private boolean keepDebugParam() {
|
||||
return Boolean.valueOf(System.getProperty(KEEP_STUDIO_DEBUG_PARAM));
|
||||
}
|
||||
|
||||
private void saveIniFile(List<String> list) throws Exception {
|
||||
File clientIniFile = getClientIniFile();
|
||||
if (!clientIniFile.exists()) {
|
||||
clientIniFile.createNewFile();
|
||||
}
|
||||
FileWriter writer = null;
|
||||
try {
|
||||
writer = new FileWriter(clientIniFile);
|
||||
for (String str : list) {
|
||||
writer.write(str + System.lineSeparator());
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
LOGGER.error(ex);
|
||||
} finally {
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
|
||||
private File getClientIniFile() throws Exception {
|
||||
String fileName = null;
|
||||
if (EnvironmentUtils.isWindowsSystem()) {
|
||||
fileName = CLIENT_INI_FILE_NAME_ON_WINDOWS;
|
||||
} else if (EnvironmentUtils.isLinuxUnixSystem()) {
|
||||
if (EnvironmentUtils.isX86_64()) {
|
||||
fileName = CLIENT_INI_FILE_NAME_ON_LINUX_X86;
|
||||
} else if (EnvironmentUtils.isAarch64()) {
|
||||
fileName = CLIENT_INI_FILE_NAME_ON_LINUX_AARCH64;
|
||||
}
|
||||
} else if (EnvironmentUtils.isMacOsSytem()) {
|
||||
if (EnvironmentUtils.isX86_64()) {
|
||||
fileName = CLIENT_INI_FILE_NAME_ON_MAC_X86;
|
||||
} else if (EnvironmentUtils.isAarch64()) {
|
||||
fileName = CLIENT_INI_FILE_NAME_ON_MAC_AARCH64;
|
||||
}
|
||||
} else {
|
||||
throw new Exception("Unsupported OS");
|
||||
}
|
||||
return new File(getSSOClientFolder(), fileName);
|
||||
}
|
||||
|
||||
private File getStudioIniFile() throws Exception {
|
||||
String fileName = null;
|
||||
if (EnvironmentUtils.isWindowsSystem()) {
|
||||
fileName = STUDIO_INI_FILE_NAME_ON_WINDOWS;
|
||||
} else if (EnvironmentUtils.isLinuxUnixSystem()) {
|
||||
if (EnvironmentUtils.isX86_64()) {
|
||||
fileName = STUDIO_INI_FILE_NAME_ON_LINUX_X86;
|
||||
} else if (EnvironmentUtils.isAarch64()) {
|
||||
fileName = STUDIO_INI_FILE_NAME_ON_LINUX_AARCH64;
|
||||
}
|
||||
} else if (EnvironmentUtils.isMacOsSytem()) {
|
||||
if (EnvironmentUtils.isX86_64()) {
|
||||
fileName = STUDIO_INI_FILE_NAME_ON_MAC_X86;
|
||||
} else if (EnvironmentUtils.isAarch64()) {
|
||||
fileName = STUDIO_INI_FILE_NAME_ON_MAC_AARCH64;
|
||||
}
|
||||
} else {
|
||||
throw new Exception("Unsupported OS");
|
||||
}
|
||||
return new File(Platform.getInstallLocation().getDataArea(fileName).getPath());
|
||||
}
|
||||
|
||||
public static SSOClientUtil getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void signOnCloud(LoginEventListener listener) throws Exception {
|
||||
SSOClientUtil.getInstance().startSignOnClient(listener);
|
||||
}
|
||||
|
||||
public String getSignOnURL(String clientID, String codeChallenge, int callbackPort) throws UnsupportedEncodingException {
|
||||
String dataCenter = TMCRepositoryUtil.getDefaultDataCenter();
|
||||
StringBuffer urlSB = new StringBuffer();
|
||||
urlSB.append(TMCRepositoryUtil.getBaseLoginURL(dataCenter)).append("?");
|
||||
urlSB.append("client_id=").append(URLEncoder.encode(clientID, StandardCharsets.UTF_8.name())).append("&");
|
||||
urlSB.append("redirect_uri=")
|
||||
.append(URLEncoder.encode(TMCRepositoryUtil.getRedirectURL(dataCenter), StandardCharsets.UTF_8.name()))
|
||||
.append("&");
|
||||
urlSB.append("scope=").append(URLEncoder.encode("openid refreshToken", StandardCharsets.UTF_8.name())).append("&");
|
||||
urlSB.append("response_type=").append(URLEncoder.encode("code", StandardCharsets.UTF_8.name())).append("&");
|
||||
urlSB.append("code_challenge_method=").append(URLEncoder.encode("S256", StandardCharsets.UTF_8.name())).append("&");
|
||||
urlSB.append("code_challenge=").append(URLEncoder.encode(codeChallenge, StandardCharsets.UTF_8.name())).append("&");
|
||||
String state = String.valueOf(callbackPort) + SSOUtil.STATE_PARAM_SEPARATOR + TMCRepositoryUtil.getDefaultDataCenter();
|
||||
urlSB.append("state=").append(URLEncoder.encode(state, StandardCharsets.UTF_8.name()));
|
||||
return urlSB.toString();
|
||||
}
|
||||
|
||||
public static boolean isDebugMode() {
|
||||
return Boolean.getBoolean("talendDebug") //$NON-NLS-1$
|
||||
|| ArrayUtils.contains(Platform.getApplicationArgs(), SSOClientUtil.TALEND_DEBUG);
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.signon.util;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.Base64;
|
||||
|
||||
public class SSOUtil {
|
||||
|
||||
public static final String STUDIO_REDIRECT_URL = "talendstudio://code";
|
||||
|
||||
public static final String STATE_PARAM_SEPARATOR = ",";
|
||||
|
||||
public static String generateCodeVerifier() {
|
||||
SecureRandom secureRandom = new SecureRandom();
|
||||
byte[] codeVerifier = new byte[32];
|
||||
secureRandom.nextBytes(codeVerifier);
|
||||
return Base64.getUrlEncoder().withoutPadding().encodeToString(codeVerifier);
|
||||
}
|
||||
|
||||
public static String getCodeChallenge(String seed) throws Exception {
|
||||
byte[] bytes = seed.getBytes("US-ASCII");
|
||||
MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
|
||||
messageDigest.update(bytes, 0, bytes.length);
|
||||
byte[] digest = messageDigest.digest();
|
||||
return Base64.getUrlEncoder().withoutPadding().encodeToString(digest);
|
||||
}
|
||||
}
|
||||
@@ -1,152 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.signon.util;
|
||||
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.eclipse.core.runtime.preferences.ConfigurationScope;
|
||||
import org.osgi.service.prefs.BackingStoreException;
|
||||
import org.osgi.service.prefs.Preferences;
|
||||
|
||||
|
||||
public class TMCRepositoryUtil {
|
||||
private static Logger LOGGER = Logger.getLogger(TMCRepositoryUtil.class);
|
||||
|
||||
public static final String REPOSITORY_CLOUD_US_ID = "cloud_us"; //$NON-NLS-1$
|
||||
|
||||
public static final String REPOSITORY_CLOUD_EU_ID = "cloud_eu"; //$NON-NLS-1$
|
||||
|
||||
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_AUS_ID = "cloud_aus"; //$NON-NLS-1$
|
||||
|
||||
public static final String REPOSITORY_CLOUD_US_DISPALY = "United States - East on AWS"; //$NON-NLS-1$
|
||||
|
||||
public static final String REPOSITORY_CLOUD_EU_DISPALY = "Europe on AWS"; //$NON-NLS-1$
|
||||
|
||||
public static final String REPOSITORY_CLOUD_APAC_DISPALY = "Asia Pacific on AWS"; //$NON-NLS-1$
|
||||
|
||||
public static final String REPOSITORY_CLOUD_US_WEST_DISPALY = "United States - West on Azure"; //$NON-NLS-1$
|
||||
|
||||
public static final String REPOSITORY_CLOUD_AUS_DISPALY = "Australia on AWS"; //$NON-NLS-1$
|
||||
|
||||
public static final String REPOSITORY_CLOUD_CUSTOM_ID = "cloud_custom"; //$NON-NLS-1$
|
||||
|
||||
public static final String AUTHORIZE_URL = "https://iam.%s.cloud.talend.com/oidc/idp/authorize"; //$NON-NLS-1$
|
||||
|
||||
public static final String ADMIN_URL = "https://tmc.%s.cloud.talend.com/studio_cloud_connection"; //$NON-NLS-1$
|
||||
|
||||
public static final String TOKEN_URL = "https://iam.%s.cloud.talend.com/oidc/oauth2/token"; //$NON-NLS-1$
|
||||
|
||||
public static final String SUCCESS_REDIRECT_URL = "https://iam.%s.cloud.talend.com/idp/login-sso-success"; //$NON-NLS-1$
|
||||
|
||||
public static final String ONLINE_HELP_URL = "https://document-link.us.cloud.talend.com/ts_ug_launch-studio?version=%s&lang=%s&env=prd";
|
||||
|
||||
public static final String ORG_TALEND_WORKSPACE_PREF_NODE = "org.eclipse.ui.ide"; //$NON-NLS-1$
|
||||
|
||||
public static final String ORG_TALEND_RECENT_DATA_CENTERR = "org.talend.recent.datacenter";
|
||||
|
||||
public static String getBaseLoginURL(String dataCenter) {
|
||||
if (dataCenter == null) {
|
||||
dataCenter = TMCRepositoryUtil.getDefaultDataCenter();
|
||||
}
|
||||
return String.format(AUTHORIZE_URL, dataCenter);
|
||||
}
|
||||
|
||||
public static String getDefaultDataCenter() {
|
||||
String defaultDataCenter = "us";
|
||||
if (getRecentDataCenter() != null) {
|
||||
defaultDataCenter = getRecentDataCenter();
|
||||
}
|
||||
if (System.getProperty(SSOClientUtil.DATA_CENTER_KEY) != null) {
|
||||
defaultDataCenter = System.getProperty(SSOClientUtil.DATA_CENTER_KEY);
|
||||
}
|
||||
return defaultDataCenter;
|
||||
}
|
||||
|
||||
public static void saveRecentDataCenter(String dataCenter) {
|
||||
Preferences node = new ConfigurationScope().getNode(ORG_TALEND_WORKSPACE_PREF_NODE);
|
||||
node.put(ORG_TALEND_RECENT_DATA_CENTERR, dataCenter);
|
||||
try {
|
||||
node.flush();
|
||||
} catch (BackingStoreException e) {
|
||||
LOGGER.error("failed to store workspace location in preferences :", e); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
public static String getRecentDataCenter() {
|
||||
Preferences node = new ConfigurationScope().getNode(ORG_TALEND_WORKSPACE_PREF_NODE);
|
||||
return node.get(ORG_TALEND_RECENT_DATA_CENTERR, null);
|
||||
}
|
||||
|
||||
public static String getCloudAdminURL(String dataCenter) {
|
||||
return String.format(ADMIN_URL, dataCenter);
|
||||
}
|
||||
|
||||
public static String getTokenURL(String dataCenter) {
|
||||
return String.format(TOKEN_URL, dataCenter);
|
||||
}
|
||||
|
||||
public static String getRedirectURL(String dataCenter) {
|
||||
if (dataCenter == null) {
|
||||
dataCenter = getDefaultDataCenter();
|
||||
}
|
||||
return String.format(SUCCESS_REDIRECT_URL, dataCenter);
|
||||
}
|
||||
|
||||
public static String getDisplayNameByDatacenter(String dataCenter) {
|
||||
if ("ap".equals(dataCenter)) {
|
||||
return REPOSITORY_CLOUD_APAC_DISPALY;
|
||||
}
|
||||
if ("us".equals(dataCenter)) {
|
||||
return REPOSITORY_CLOUD_US_DISPALY;
|
||||
}
|
||||
if ("us-west".equals(dataCenter)) {
|
||||
return REPOSITORY_CLOUD_US_WEST_DISPALY;
|
||||
}
|
||||
if ("eu".equals(dataCenter)) {
|
||||
return REPOSITORY_CLOUD_EU_DISPALY;
|
||||
}
|
||||
if ("au".equals(dataCenter)) {
|
||||
return REPOSITORY_CLOUD_AUS_DISPALY;
|
||||
}
|
||||
|
||||
if (System.getProperty(SSOClientUtil.DATA_CENTER_DISPLAY_KEY) != null) {
|
||||
return System.getProperty(SSOClientUtil.DATA_CENTER_DISPLAY_KEY);
|
||||
}
|
||||
|
||||
return dataCenter;
|
||||
}
|
||||
|
||||
public static String getRepositoryId(String dataCenter) {
|
||||
if ("ap".equals(dataCenter)) {
|
||||
return REPOSITORY_CLOUD_APAC_ID;
|
||||
}
|
||||
if ("us".equals(dataCenter)) {
|
||||
return REPOSITORY_CLOUD_US_ID;
|
||||
}
|
||||
if ("us-west".equals(dataCenter)) {
|
||||
return REPOSITORY_CLOUD_US_WEST_ID;
|
||||
}
|
||||
if ("eu".equals(dataCenter)) {
|
||||
return REPOSITORY_CLOUD_EU_ID;
|
||||
}
|
||||
if ("au".equals(REPOSITORY_CLOUD_AUS_ID)) {
|
||||
return REPOSITORY_CLOUD_EU_ID;
|
||||
}
|
||||
return REPOSITORY_CLOUD_CUSTOM_ID;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,165 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.signon.util;
|
||||
|
||||
import org.talend.utils.json.JSONException;
|
||||
import org.talend.utils.json.JSONObject;
|
||||
|
||||
public class TokenMode {
|
||||
|
||||
private static final String ACCESS_TOKEN_KEY = "access_token";
|
||||
|
||||
private static final String EXPIRES_IN_KEY = "expires_in";
|
||||
|
||||
private static final String ID_TOKEN_KEY = "id_token";
|
||||
|
||||
private static final String REFRESH_TOKEN_KEY = "refresh_token";
|
||||
|
||||
private static final String SCOPE_KEY = "scope";
|
||||
|
||||
private static final String TOKEN_TYPE_KEY = "token_type";
|
||||
|
||||
private static final String LAST_REFRESH_TIME_KEY = "last_refresh_time";
|
||||
|
||||
private static final String DATA_CENTER_KEY = "data_center";
|
||||
|
||||
private String clientId;
|
||||
|
||||
private String accessToken;
|
||||
|
||||
private String refreshToken;
|
||||
|
||||
private long expiresIn;
|
||||
|
||||
private String idToken;
|
||||
|
||||
private String scope;
|
||||
|
||||
private String tokenType;
|
||||
|
||||
private String dataCenter;
|
||||
|
||||
private long lastRefreshTime = System.currentTimeMillis();
|
||||
|
||||
public String getClientId() {
|
||||
return clientId;
|
||||
}
|
||||
|
||||
public void setClientId(String clientId) {
|
||||
this.clientId = clientId;
|
||||
}
|
||||
|
||||
public String getAccessToken() {
|
||||
return accessToken;
|
||||
}
|
||||
|
||||
public void setAccessToken(String accessToken) {
|
||||
this.accessToken = accessToken;
|
||||
}
|
||||
|
||||
public String getRefreshToken() {
|
||||
return refreshToken;
|
||||
}
|
||||
|
||||
public void setRefreshToken(String refreshToken) {
|
||||
this.refreshToken = refreshToken;
|
||||
}
|
||||
|
||||
public long getExpiresIn() {
|
||||
return expiresIn;
|
||||
}
|
||||
|
||||
public void setExpiresIn(long expiresIn) {
|
||||
this.expiresIn = expiresIn;
|
||||
}
|
||||
|
||||
public String getIdToken() {
|
||||
return idToken;
|
||||
}
|
||||
|
||||
public void setIdToken(String idToken) {
|
||||
this.idToken = idToken;
|
||||
}
|
||||
|
||||
public String getScope() {
|
||||
return scope;
|
||||
}
|
||||
|
||||
public void setScope(String scope) {
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
public String getTokenType() {
|
||||
return tokenType;
|
||||
}
|
||||
|
||||
public void setTokenType(String tokenType) {
|
||||
this.tokenType = tokenType;
|
||||
}
|
||||
|
||||
public long getLastRefreshTime() {
|
||||
return lastRefreshTime;
|
||||
}
|
||||
|
||||
public void setLastRefreshTime(long lastRefreshTime) {
|
||||
this.lastRefreshTime = lastRefreshTime;
|
||||
}
|
||||
|
||||
public String getDataCenter() {
|
||||
return dataCenter;
|
||||
}
|
||||
|
||||
public void setDataCenter(String dataCenter) {
|
||||
this.dataCenter = dataCenter;
|
||||
}
|
||||
|
||||
public static TokenMode parseFromJson(String jsonString, String dataCenter) throws JSONException {
|
||||
JSONObject jsonObj = new JSONObject(jsonString);
|
||||
TokenMode token = new TokenMode();
|
||||
token.setAccessToken(jsonObj.getString(TokenMode.ACCESS_TOKEN_KEY));
|
||||
token.setExpiresIn(jsonObj.getLong(TokenMode.EXPIRES_IN_KEY));
|
||||
token.setRefreshToken(jsonObj.getString(TokenMode.REFRESH_TOKEN_KEY));
|
||||
if (jsonObj.has(TokenMode.ID_TOKEN_KEY)) {
|
||||
token.setIdToken(jsonObj.getString(TokenMode.ID_TOKEN_KEY));
|
||||
}
|
||||
if (jsonObj.has(TokenMode.SCOPE_KEY)) {
|
||||
token.setScope(jsonObj.getString(TokenMode.SCOPE_KEY));
|
||||
}
|
||||
if (jsonObj.has(TokenMode.TOKEN_TYPE_KEY)) {
|
||||
token.setTokenType(jsonObj.getString(TokenMode.TOKEN_TYPE_KEY));
|
||||
}
|
||||
if (jsonObj.has(TokenMode.LAST_REFRESH_TIME_KEY)) {
|
||||
token.setLastRefreshTime(jsonObj.getLong(TokenMode.LAST_REFRESH_TIME_KEY));
|
||||
}
|
||||
if (dataCenter == null && jsonObj.has(TokenMode.DATA_CENTER_KEY)) {
|
||||
token.setDataCenter(jsonObj.getString(TokenMode.DATA_CENTER_KEY));
|
||||
} else {
|
||||
token.setDataCenter(dataCenter);
|
||||
}
|
||||
return token;
|
||||
}
|
||||
|
||||
public static JSONObject writeToJson(TokenMode token) throws JSONException {
|
||||
JSONObject object = new JSONObject();
|
||||
object.put(TokenMode.ACCESS_TOKEN_KEY, token.getAccessToken());
|
||||
object.put(TokenMode.EXPIRES_IN_KEY, token.getExpiresIn());
|
||||
object.put(TokenMode.ID_TOKEN_KEY, token.getIdToken());
|
||||
object.put(TokenMode.REFRESH_TOKEN_KEY, token.getRefreshToken());
|
||||
object.put(TokenMode.SCOPE_KEY, token.getScope());
|
||||
object.put(TokenMode.TOKEN_TYPE_KEY, token.getTokenType());
|
||||
object.put(TokenMode.LAST_REFRESH_TIME_KEY, token.getLastRefreshTime());
|
||||
object.put(TokenMode.DATA_CENTER_KEY, token.getDataCenter());
|
||||
|
||||
return object;
|
||||
}
|
||||
}
|
||||
@@ -1,195 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.signon.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* This class copies various methods from the URIUtil class in org.eclipse.equinox.common. Unless otherwise noted the
|
||||
* implementations here should mirror those in the common implementation.
|
||||
*/
|
||||
public class URIUtil {
|
||||
|
||||
public static final String SCHEME_FILE = "file"; //$NON-NLS-1$
|
||||
|
||||
private static final String UNC_PREFIX = "//"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Appends the given extension to the path of the give base URI and returns the corresponding new path.
|
||||
*
|
||||
* @param base The base URI to append to
|
||||
* @param extension The path extension to be added
|
||||
* @return The appended URI
|
||||
*/
|
||||
public static URI append(URI base, String extension) {
|
||||
try {
|
||||
String path = base.getPath();
|
||||
if (path == null)
|
||||
return appendOpaque(base, extension);
|
||||
// if the base is already a directory then resolve will just do the right thing
|
||||
if (path.endsWith("/")) {//$NON-NLS-1$
|
||||
URI result = base.resolve(extension);
|
||||
// Fix UNC paths that are incorrectly normalized by URI#resolve (see Java bug 4723726)
|
||||
String resultPath = result.getPath();
|
||||
if (path.startsWith(UNC_PREFIX) && (resultPath == null || !resultPath.startsWith(UNC_PREFIX)))
|
||||
result = new URI(result.getScheme(), "///" + result.getSchemeSpecificPart(), result.getFragment()); //$NON-NLS-1$
|
||||
return result;
|
||||
}
|
||||
path = path + "/" + extension; //$NON-NLS-1$
|
||||
return new URI(base.getScheme(), base.getUserInfo(), base.getHost(), base.getPort(), path, base.getQuery(),
|
||||
base.getFragment());
|
||||
} catch (URISyntaxException e) {
|
||||
// shouldn't happen because we started from a valid URI
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Special case of appending to an opaque URI. Since opaque URIs have no path segment the best we can do is append
|
||||
* to the scheme-specific part
|
||||
*/
|
||||
private static URI appendOpaque(URI base, String extension) throws URISyntaxException {
|
||||
String ssp = base.getSchemeSpecificPart();
|
||||
if (ssp.endsWith("/")) //$NON-NLS-1$
|
||||
ssp += extension;
|
||||
else
|
||||
ssp = ssp + "/" + extension; //$NON-NLS-1$
|
||||
return new URI(base.getScheme(), ssp, base.getFragment());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a URI corresponding to the given unencoded string.
|
||||
*
|
||||
* @throws URISyntaxException If the string cannot be formed into a valid URI
|
||||
*/
|
||||
public static URI fromString(String uriString) throws URISyntaxException {
|
||||
int colon = uriString.indexOf(':');
|
||||
int hash = uriString.lastIndexOf('#');
|
||||
boolean noHash = hash < 0;
|
||||
if (noHash)
|
||||
hash = uriString.length();
|
||||
String scheme = colon < 0 ? null : uriString.substring(0, colon);
|
||||
String ssp = uriString.substring(colon + 1, hash);
|
||||
String fragment = noHash ? null : uriString.substring(hash + 1);
|
||||
// use java.io.File for constructing file: URIs
|
||||
if (scheme != null && scheme.equals(SCHEME_FILE)) {
|
||||
File file = new File(uriString.substring(5));
|
||||
if (file.isAbsolute())
|
||||
return file.toURI();
|
||||
scheme = null;
|
||||
if (File.separatorChar != '/')
|
||||
ssp = ssp.replace(File.separatorChar, '/');
|
||||
}
|
||||
return new URI(scheme, ssp, fragment);
|
||||
}
|
||||
|
||||
/*
|
||||
* Compares two URI for equality. Return false if one of them is null
|
||||
*/
|
||||
public static boolean sameURI(URI url1, URI url2) {
|
||||
if (url1 == url2)
|
||||
return true;
|
||||
if (url1 == null || url2 == null)
|
||||
return false;
|
||||
if (url1.equals(url2))
|
||||
return true;
|
||||
|
||||
if (url1.isAbsolute() != url2.isAbsolute())
|
||||
return false;
|
||||
|
||||
// check if we have two local file references that are case variants
|
||||
File file1 = toFile(url1);
|
||||
return file1 == null ? false : file1.equals(toFile(url2));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the URI as a local file, or <code>null</code> if the given URI does not represent a local file.
|
||||
*
|
||||
* @param uri The URI to return the file for
|
||||
* @return The local file corresponding to the given URI, or <code>null</code>
|
||||
*/
|
||||
public static File toFile(URI uri) {
|
||||
try {
|
||||
if (!SCHEME_FILE.equalsIgnoreCase(uri.getScheme()))
|
||||
return null;
|
||||
// assume all illegal characters have been properly encoded, so use URI class to unencode
|
||||
return new File(uri);
|
||||
} catch (IllegalArgumentException e) {
|
||||
// File constructor does not support non-hierarchical URI
|
||||
String path = uri.getPath();
|
||||
// path is null for non-hierarchical URI such as file:c:/tmp
|
||||
if (path == null)
|
||||
path = uri.getSchemeSpecificPart();
|
||||
return new File(path);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of the given URI that doesn't have illegal characters encoded. This string is
|
||||
* suitable for later passing to {@link #fromString(String)}.
|
||||
*
|
||||
* @param uri The URI to convert to string format
|
||||
* @return An unencoded string representation of the URI
|
||||
*/
|
||||
public static String toUnencodedString(URI uri) {
|
||||
StringBuffer result = new StringBuffer();
|
||||
String scheme = uri.getScheme();
|
||||
if (scheme != null)
|
||||
result.append(scheme).append(':');
|
||||
// there is always a ssp
|
||||
result.append(uri.getSchemeSpecificPart());
|
||||
String fragment = uri.getFragment();
|
||||
if (fragment != null)
|
||||
result.append('#').append(fragment);
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the URL as a URI. This method will handle broken URLs that are not properly encoded (for example they
|
||||
* contain unencoded space characters).
|
||||
*/
|
||||
public static URI toURI(URL url) throws URISyntaxException {
|
||||
// URL behaves differently across platforms so for file: URLs we parse from string form
|
||||
if (SCHEME_FILE.equals(url.getProtocol())) {
|
||||
String pathString = url.toExternalForm().substring(5);
|
||||
// ensure there is a leading slash to handle common malformed URLs such as file:c:/tmp
|
||||
if (pathString.indexOf('/') != 0)
|
||||
pathString = '/' + pathString;
|
||||
else if (pathString.startsWith(UNC_PREFIX) && !pathString.startsWith(UNC_PREFIX, 2)) {
|
||||
// URL encodes UNC path with two slashes, but URI uses four (see bug 207103)
|
||||
pathString = UNC_PREFIX + pathString;
|
||||
}
|
||||
return new URI(SCHEME_FILE, null, pathString, null);
|
||||
}
|
||||
try {
|
||||
return new URI(url.toExternalForm());
|
||||
} catch (URISyntaxException e) {
|
||||
// try multi-argument URI constructor to perform encoding
|
||||
return new URI(url.getProtocol(), url.getUserInfo(), url.getHost(), url.getPort(), url.getPath(), url.getQuery(),
|
||||
url.getRef());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a URI as a URL.
|
||||
*
|
||||
* @throws MalformedURLException
|
||||
*/
|
||||
public static URL toURL(URI uri) throws MalformedURLException {
|
||||
return new URL(uri.toString());
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.signon.util.i18n;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
* DOC zwzhao class global comment. Detailled comment
|
||||
*/
|
||||
public class Messages extends MessagesCore {
|
||||
|
||||
private static final String BUNDLE_NAME = "messages"; //$NON-NLS-1$
|
||||
|
||||
private static final String PLUGIN_ID = "org.talend.license.gui";
|
||||
|
||||
private static ResourceBundle resourceBundle = ResourceBundle.getBundle(BUNDLE_NAME);
|
||||
|
||||
/**
|
||||
* Returns the i18n formatted message for <i>key</i> in the class bundle.
|
||||
*
|
||||
* @param key - the key for the desired string
|
||||
* @return the string for the given key in the class resource bundle
|
||||
* @see MessagesCore#getString(String, ResourceBundle)
|
||||
*/
|
||||
public static String getString(String key) {
|
||||
return getString(key, PLUGIN_ID, resourceBundle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the i18n formatted message for <i>key</i> and <i>args</i> in the specified bundle.
|
||||
*
|
||||
* @param key - the key for the desired string
|
||||
* @param args - arg to include in the string
|
||||
* @return the string for the given key in the given resource bundle
|
||||
* @see MessagesCore#getString(String, ResourceBundle, Object[])
|
||||
*/
|
||||
public static String getString(String key, Object... args) {
|
||||
return getString(key, PLUGIN_ID, resourceBundle, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the i18n formatted message for <i>key</i> and <i>locale<i> in the class bundle.
|
||||
*
|
||||
* @param key - the key for the desired string
|
||||
* @param locale - the locale for which a resource bundle is desired
|
||||
* @return the string for the given key in the given locale resource bundle
|
||||
*/
|
||||
public static String getLocaleString(String key, Locale locale) {
|
||||
ResourceBundle resourceBundle = ResourceBundle.getBundle(BUNDLE_NAME, locale);
|
||||
return getString(key, PLUGIN_ID, resourceBundle);
|
||||
}
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.signon.util.i18n;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
* DOC zwzhao class global comment. Detailled comment
|
||||
*/
|
||||
public abstract class MessagesCore {
|
||||
|
||||
public static final String KEY_NOT_FOUND_PREFIX = "!!!"; //$NON-NLS-1$
|
||||
|
||||
public static final String KEY_NOT_FOUND_SUFFIX = "!!!"; //$NON-NLS-1$
|
||||
|
||||
// add by wzhang for 13249, MessageFormat will not indicate {0} as i18n args if in couple single quotes.
|
||||
public static final String SINGLE_QUOTE = "'"; //$NON-NLS-1$
|
||||
|
||||
public static final String SINGLE_QUOTE_MUTI = "''"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Returns the i18n formatted message for <i>key</i> in the specified bundle.
|
||||
*
|
||||
* @param key - the key for the desired string
|
||||
* @param resourceBundle - the ResourceBundle to search in
|
||||
* @return the string for the given key in the given resource bundle
|
||||
*/
|
||||
public static String getString(String key, String pluginId, ResourceBundle resourceBundle) {
|
||||
if (resourceBundle == null) {
|
||||
return KEY_NOT_FOUND_PREFIX + key + KEY_NOT_FOUND_SUFFIX;
|
||||
}
|
||||
try {
|
||||
return resourceBundle.getString(key);
|
||||
|
||||
} catch (MissingResourceException e) {
|
||||
return KEY_NOT_FOUND_PREFIX + key + KEY_NOT_FOUND_SUFFIX;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the i18n formatted message for <i>key</i> and <i>args</i> in the specified bundle.
|
||||
*
|
||||
* @param key - the key for the desired string
|
||||
* @param resourceBundle - the ResourceBundle to search in
|
||||
* @param args - arg to include in the string
|
||||
* @return the string for the given key in the given resource bundle
|
||||
*/
|
||||
// modified by wzhang. add a pluginId parameter
|
||||
public static String getString(String key, String pluginId, ResourceBundle resourceBundle, Object... args) {
|
||||
try {
|
||||
return MessageFormat.format(getString(key, pluginId, resourceBundle).replaceAll(SINGLE_QUOTE, SINGLE_QUOTE_MUTI),
|
||||
args);
|
||||
} catch (Exception e) {
|
||||
return KEY_NOT_FOUND_PREFIX + key + KEY_NOT_FOUND_SUFFIX;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the i18n formatted message for <i>key</i> and <i>args</i> in the specified bundle.
|
||||
*
|
||||
* @param key - the key for the desired string
|
||||
* @param resourceBundle - the ResourceBundle to search in
|
||||
* @param args - arg to include in the string
|
||||
* @return the string for the given key in the given resource bundle
|
||||
* @deprecated
|
||||
*/
|
||||
public static String getString(String key, ResourceBundle resourceBundle, Object... args) {
|
||||
return getString(key, null, resourceBundle, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the i18n formatted message for <i>key</i> in the specified bundle.
|
||||
*
|
||||
* @param key - the key for the desired string
|
||||
* @param resourceBundle - the ResourceBundle to search in
|
||||
* @return the string for the given key in the given resource bundle
|
||||
* @deprecated
|
||||
*/
|
||||
public static String getString(String key, ResourceBundle resourceBundle) {
|
||||
return getString(key, null, resourceBundle);
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.signon.util.listener;
|
||||
|
||||
public interface LoginEventListener {
|
||||
|
||||
public void loginStart();
|
||||
|
||||
public void loginStop(String authCode, String dataCenter);
|
||||
|
||||
public void loginFailed(Exception ex);
|
||||
|
||||
public String getCodeChallenge();
|
||||
}
|
||||
2
pom.xml
2
pom.xml
@@ -112,7 +112,6 @@
|
||||
<module>main/plugins/org.talend.themes.css.talend</module>
|
||||
<module>main/plugins/org.talend.designer.maven.tos/resources</module>
|
||||
<module>main/plugins/org.talend.designer.maven.tos</module>
|
||||
<module>main/plugins/org.talend.signon.util</module>
|
||||
|
||||
<module>main/plugins/org.talend.designer.maven.repo.tck</module>
|
||||
<module>main/plugins/org.talend.designer.maven.repo.tcksdk</module>
|
||||
@@ -121,7 +120,6 @@
|
||||
<module>main/plugins/org.talend.libraries.persist.lookup</module>
|
||||
<module>main/plugins/org.talend.designer.maven.aether</module>
|
||||
<!--<module>test/features/org.talend.test.tos.feature</module>-->
|
||||
<module>test/plugins/org.talend.common.ui.runtime.test</module>
|
||||
<module>test/plugins/org.talend.commons.runtime.test</module>
|
||||
<module>test/plugins/org.talend.commons.ui.test</module>
|
||||
<module>test/plugins/org.talend.core.repository.test</module>
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<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">
|
||||
<attributes>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>org.talend.common.ui.runtime.test</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -1,11 +0,0 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: org.talend.common.ui.runtime.test
|
||||
Bundle-SymbolicName: org.talend.common.ui.runtime.test
|
||||
Bundle-Version: 8.8.8.qualifier
|
||||
Fragment-Host: org.talend.common.ui.runtime
|
||||
Automatic-Module-Name: org.talend.common.ui.runtime.test
|
||||
Require-Bundle: org.junit;bundle-version="[4.0.0,5.0.0)",
|
||||
org.talend.utils,
|
||||
org.talend.testutils
|
||||
Bundle-ClassPath: .
|
||||
@@ -1,4 +0,0 @@
|
||||
source.. = src/main/java/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.
|
||||
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.talend.studio</groupId>
|
||||
<artifactId>tcommon-studio-se</artifactId>
|
||||
<version>8.8.8-SNAPSHOT</version>
|
||||
<relativePath>../../../</relativePath>
|
||||
</parent>
|
||||
<artifactId>org.talend.common.ui.runtime.test</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
</project>
|
||||
@@ -1,56 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2022 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.commons.ui.runtime.image;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotSame;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.junit.Test;
|
||||
|
||||
public class ImageUtilsTest {
|
||||
|
||||
@Test
|
||||
public void testCreateImageFromData() {
|
||||
IImage icon = ECoreImage.PROCESS_ICON;
|
||||
ImageDescriptor imgDesc = ImageDescriptor.createFromFile(icon.getLocation(), icon.getPath());
|
||||
|
||||
byte[] data1 = ImageUtils.saveImageToData(imgDesc);
|
||||
byte[] data2 = new byte[data1.length];
|
||||
System.arraycopy(data1, 0, data2, 0, data1.length);
|
||||
assertTrue(Arrays.equals(data1, data2));
|
||||
|
||||
ImageDescriptor createdImageFromData1 = ImageUtils.createImageFromData(data1);
|
||||
ImageDescriptor createdImageFromData2 = ImageUtils.createImageFromData(data2);
|
||||
assertEquals(createdImageFromData2, createdImageFromData1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDisposeImages() {
|
||||
IImage icon = ECoreImage.PROCESS_ICON;
|
||||
ImageDescriptor imgDesc = ImageDescriptor.createFromFile(icon.getLocation(), icon.getPath());
|
||||
|
||||
byte[] data1 = ImageUtils.saveImageToData(imgDesc);
|
||||
byte[] data2 = new byte[data1.length];
|
||||
System.arraycopy(data1, 0, data2, 0, data1.length);
|
||||
assertTrue(Arrays.equals(data1, data2));
|
||||
|
||||
ImageDescriptor createdImageFromData1 = ImageUtils.createImageFromData(data1);
|
||||
ImageUtils.disposeImages(data2);
|
||||
ImageDescriptor createdImageFromData2 = ImageUtils.createImageFromData(data1);
|
||||
assertNotSame(createdImageFromData1, createdImageFromData2);
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,6 @@
|
||||
// ============================================================================
|
||||
package org.talend.designer.core.image;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.graphics.ImageData;
|
||||
@@ -227,11 +225,15 @@ public class CoreImageProviderTest {
|
||||
|
||||
byte[] data1 = ImageUtils.saveImageToData(imgDesc);
|
||||
byte[] data2 = ImageUtils.saveImageToData(imgDesc);
|
||||
Assert.assertTrue(Arrays.equals(data2, data1));
|
||||
Assert.assertNotEquals(data2, data1);
|
||||
|
||||
ImageDescriptor newImgDesc1 = ImageUtils.createImageFromData(data1);
|
||||
ImageDescriptor newImgDesc2 = ImageUtils.createImageFromData(data2);
|
||||
Assert.assertEquals(newImgDesc2, newImgDesc1);
|
||||
Assert.assertNotEquals(newImgDesc2, newImgDesc1);
|
||||
|
||||
Image img1 = newImgDesc1.createImage();
|
||||
Image img2 = newImgDesc2.createImage();
|
||||
Assert.assertNotEquals(img2, img1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user