Compare commits
34 Commits
jill/fix/m
...
cmeng/stig
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
90e09aa5a0 | ||
|
|
732c9f7ba3 | ||
|
|
e7d7296d1d | ||
|
|
cff426e05b | ||
|
|
3942a7342a | ||
|
|
cac70d58bd | ||
|
|
a68d173505 | ||
|
|
c9a6da75a9 | ||
|
|
dd67814905 | ||
|
|
9168a6f562 | ||
|
|
214124111d | ||
|
|
312478cf8e | ||
|
|
0eaca0c7ce | ||
|
|
176c01a871 | ||
|
|
d47cb925a1 | ||
|
|
8f10d203c2 | ||
|
|
1eb962e58b | ||
|
|
60cb70dda8 | ||
|
|
3d4f36615b | ||
|
|
86b682b026 | ||
|
|
8ef7d24ab1 | ||
|
|
2f62d6b559 | ||
|
|
a856a6dfef | ||
|
|
57d7f049f1 | ||
|
|
e5858570fd | ||
|
|
1c7284282f | ||
|
|
2cf0e2f063 | ||
|
|
a2f23b8c70 | ||
|
|
4bc2f2212f | ||
|
|
b3aeb8789f | ||
|
|
cdf3f74dab | ||
|
|
03ec9564c4 | ||
|
|
2e100d48ec | ||
|
|
9d53e9e58a |
@@ -5,7 +5,7 @@
|
||||
<copyright url="http://www.example.com/copyright">[Enter Copyright Description here.]</copyright>
|
||||
<license url="http://www.example.com/license">[Enter License Description here.]</license>
|
||||
<requires>
|
||||
<import plugin="org.bouncycastle.bcprov" version="1.69.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.bouncycastle.bcprov" version="1.70.0" match="greaterOrEqual"/>
|
||||
<import plugin="com.cedarsoftware.json-io" version="0.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="com.fasterxml.jackson.core.jackson-annotations" version="2.9.0" match="greaterOrEqual"/>
|
||||
<import plugin="com.fasterxml.jackson.core.jackson-core" version="2.9.8" match="greaterOrEqual"/>
|
||||
|
||||
@@ -88,6 +88,8 @@ public class EclipseCommandLine {
|
||||
static public final String TALEND_CONTINUE_LOGON = "-talendContinueLogon";
|
||||
|
||||
static public final String TALEND_CONTINUE_UPDATE = "-talendContinueUpdate";
|
||||
|
||||
static public final String TALEND_CLEAN_M2 = "-talendCleanM2";
|
||||
|
||||
static public final String TALEND_CLEAN_UNINSTALLED_BUNDLES = "-talendCleanUninstalledBundles";
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ Require-Bundle: org.eclipse.ui,
|
||||
org.talend.libraries.apache,
|
||||
org.eclipse.osgi.services,
|
||||
org.eclipse.ui.navigator,
|
||||
org.eclipse.e4.ui.css.swt.theme,
|
||||
org.talend.libraries.jackson
|
||||
Export-Package: org.talend.core.repository,
|
||||
org.talend.core.repository.constants,
|
||||
|
||||
@@ -39,6 +39,18 @@ public final class Constant {
|
||||
*/
|
||||
public static final String ITEM_EVENT_PROPERTY_KEY = "item"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* key used to get/set the property of an event related to an item (REPOSITORY_ITEM_EVENT_PREFIX). The value is the
|
||||
* cloudVersion string.
|
||||
*/
|
||||
public static final String VERSION_EVENT_CLOUD_KEY = "cloudVersion"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* key used to get/set the property of an event related to an item (REPOSITORY_ITEM_EVENT_PREFIX). The value is the
|
||||
* cloudName string.
|
||||
*/
|
||||
public static final String VERSION_EVENT_CLOUD_NAME = "cloudName"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* key used to get/set the property of an event related to a list of files modified in the repository
|
||||
* (REPOSITORY_ITEM_EVENT_PREFIX). The value is the Collection of String (list of all files modified).
|
||||
@@ -62,4 +74,9 @@ public final class Constant {
|
||||
* (REPOSITORY_ITEM_EVENT_PREFIX). The value is the Collection of String (list of all files modified).
|
||||
*/
|
||||
public static final String PROJECT_RELOAD_PROPERTY_KEY = "project"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* suffix used when issuing an event on the OSGI event bus when published to cloud.
|
||||
*/
|
||||
public static final String CLOUD_PUBLISH_EVENT_SUFFIX = "cloud"; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
@@ -0,0 +1,280 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// 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.repository.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Level;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.core.ICoreService;
|
||||
import org.talend.core.PluginChecker;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.properties.RoutineItem;
|
||||
import org.talend.core.model.properties.SQLPatternItem;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.pendo.PendoItemSignatureUtil;
|
||||
import org.talend.core.pendo.PendoItemSignatureUtil.SignatureStatus;
|
||||
import org.talend.core.pendo.PendoItemSignatureUtil.TOSProdNameEnum;
|
||||
import org.talend.core.pendo.PendoItemSignatureUtil.ValueEnum;
|
||||
import org.talend.core.pendo.PendoTrackDataUtil;
|
||||
import org.talend.core.pendo.PendoTrackDataUtil.TrackEvent;
|
||||
import org.talend.core.pendo.PendoTrackSender;
|
||||
import org.talend.core.pendo.properties.PendoSignLogonProperties;
|
||||
import org.talend.utils.migration.MigrationTokenUtil;
|
||||
|
||||
/**
|
||||
* DOC jding class global comment. Detailled comment
|
||||
*/
|
||||
public class PendoItemSignatureManager {
|
||||
|
||||
private PendoSignLogonProperties itemSignProperties = new PendoSignLogonProperties();
|
||||
|
||||
private static PendoItemSignatureManager manager;
|
||||
|
||||
private static boolean isTrackAvailable;
|
||||
|
||||
static {
|
||||
manager = new PendoItemSignatureManager();
|
||||
try {
|
||||
isTrackAvailable = PluginChecker.isTIS() && PendoTrackSender.getInstance().isTrackSendAvailable();
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e, Level.WARN);
|
||||
}
|
||||
}
|
||||
|
||||
private PendoItemSignatureManager() {
|
||||
}
|
||||
|
||||
public static PendoItemSignatureManager getInstance() {
|
||||
return manager;
|
||||
}
|
||||
|
||||
private Set<String> signByLoginMigrationItems = new HashSet<String>();
|
||||
|
||||
public void countItemSignByMigration(String file) {
|
||||
if (!isTrackAvailable) {
|
||||
return;
|
||||
}
|
||||
if (!ProxyRepositoryFactory.getInstance().isFullLogonFinished()) {
|
||||
signByLoginMigrationItems.add(file);
|
||||
}
|
||||
}
|
||||
|
||||
public void collectProperties() {
|
||||
ICoreService coreService = ICoreService.get();
|
||||
if (coreService == null || !isTrackAvailable) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
itemSignProperties.setSignByMigration(signByLoginMigrationItems.size());
|
||||
|
||||
String seperator = "@";
|
||||
Map<String, Integer> tosUnsignItemMap = new HashMap<String, Integer>();
|
||||
Map<String, Integer> invalidItemVersionMap = new HashMap<String, Integer>();
|
||||
Set<String> checkedItem = new HashSet<String>();
|
||||
ProxyRepositoryFactory proxyRepositoryFactory = ProxyRepositoryFactory.getInstance();
|
||||
ERepositoryObjectType[] types = (ERepositoryObjectType[]) ERepositoryObjectType.values();
|
||||
for (ERepositoryObjectType type : types) {
|
||||
List<IRepositoryViewObject> allObjectList = proxyRepositoryFactory.getAll(type);
|
||||
for (IRepositoryViewObject repositoryObject : allObjectList) {
|
||||
Property property = repositoryObject.getProperty();
|
||||
if (property == null || property.eResource() == null) {
|
||||
continue;
|
||||
}
|
||||
String itemKey = repositoryObject.getRepositoryObjectType() + seperator + property.getId() + seperator
|
||||
+ property.getVersion();
|
||||
if (isBuiltInItem(repositoryObject) || checkedItem.contains(itemKey)) {
|
||||
continue;
|
||||
}
|
||||
checkedItem.add(itemKey);
|
||||
Integer verifyResult = null;
|
||||
try {
|
||||
verifyResult = coreService.getSignatureVerifyResult(property, null, false);
|
||||
if (verifyResult != null) {
|
||||
switch (verifyResult) {
|
||||
case SignatureStatus.V_VALID:
|
||||
itemSignProperties.setValidItems(itemSignProperties.getValidItems() + 1);
|
||||
break;
|
||||
case SignatureStatus.V_UNSIGNED:
|
||||
String itemProductName = PendoItemSignatureUtil
|
||||
.getItemProductName(property);
|
||||
if (StringUtils.isNotBlank(itemProductName)) {
|
||||
String tosCategory = TOSProdNameEnum.getTOSCategoryByProdName(itemProductName);
|
||||
if (StringUtils.isBlank(tosCategory)) {
|
||||
itemSignProperties.setUnsignEEItems(itemSignProperties.getUnsignEEItems() + 1);
|
||||
} else {
|
||||
if (tosUnsignItemMap.get(tosCategory) == null) {
|
||||
tosUnsignItemMap.put(tosCategory, 0);
|
||||
}
|
||||
tosUnsignItemMap.put(tosCategory, tosUnsignItemMap.get(tosCategory) + 1);
|
||||
}
|
||||
}
|
||||
addInvalidItemVersion(property, invalidItemVersionMap);
|
||||
break;
|
||||
default:
|
||||
addInvalidItemVersion(property, invalidItemVersionMap);
|
||||
itemSignProperties.setInvalidSignItems(itemSignProperties.getInvalidSignItems() + 1);
|
||||
}
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e, Level.WARN);
|
||||
if (verifyResult == null) {
|
||||
// exception during verify
|
||||
addInvalidItemVersion(property, invalidItemVersionMap);
|
||||
itemSignProperties.setInvalidSignItems(itemSignProperties.getInvalidSignItems() + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
itemSignProperties.setInvalidItemSourceVersion(getSortInvalidItems(invalidItemVersionMap));
|
||||
itemSignProperties.setUnsignSEItems(getSortTOSUnsignItems(tosUnsignItemMap));
|
||||
|
||||
itemSignProperties.setStudioVersion(PendoItemSignatureUtil.getStudioVersion());
|
||||
if (coreService.isInValidGP()) {
|
||||
itemSignProperties.setGracePeriod(ValueEnum.YES.getDisplayValue());
|
||||
} else {
|
||||
itemSignProperties.setGracePeriod(ValueEnum.NO.getDisplayValue());
|
||||
}
|
||||
String prodDate = PendoItemSignatureUtil.formatDate(System.getProperty(PendoItemSignatureUtil.PROD_DATE_ID),
|
||||
"yyyy-MM-dd");
|
||||
itemSignProperties.setInstallDate(prodDate);
|
||||
String projectCreateDate = PendoItemSignatureUtil.getCurrentProjectCreateDate();
|
||||
itemSignProperties.setProjectCreateDate(PendoItemSignatureUtil.formatDate(projectCreateDate, "yyyy-MM-dd"));
|
||||
|
||||
String value = System.getProperty(PendoItemSignatureUtil.MIGRATION_TOKEN_KEY);
|
||||
Map<String, Date> tokenTime = MigrationTokenUtil.getMigrationTokenTime(value);
|
||||
if (tokenTime == null || tokenTime.isEmpty()) {
|
||||
itemSignProperties.setValidMigrationToken(ValueEnum.NOT_APPLICATE.getDisplayValue());
|
||||
} else {
|
||||
String customer = coreService.getLicenseCustomer();
|
||||
Date tokenDate = tokenTime.get(customer);
|
||||
Date currentDate = new Date();
|
||||
if (tokenDate != null && tokenDate.after(currentDate)) {
|
||||
itemSignProperties.setValidMigrationToken(ValueEnum.YES.getDisplayValue());
|
||||
} else {
|
||||
itemSignProperties.setValidMigrationToken(ValueEnum.NO.getDisplayValue());
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e, Level.WARN);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void addInvalidItemVersion(Property property, Map<String, Integer> invalidItemVersionMap) {
|
||||
String itemProductVersion = PendoItemSignatureUtil.getItemProductVersion(property);
|
||||
if (StringUtils.isNotBlank(itemProductVersion)) {
|
||||
if (invalidItemVersionMap.get(itemProductVersion) == null) {
|
||||
invalidItemVersionMap.put(itemProductVersion, 0);
|
||||
}
|
||||
invalidItemVersionMap.put(itemProductVersion, invalidItemVersionMap.get(itemProductVersion) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isBuiltInItem(IRepositoryViewObject repositoryObject) {
|
||||
if (repositoryObject.getProperty().getItem() instanceof SQLPatternItem) {
|
||||
SQLPatternItem sqlPatternItem = (SQLPatternItem) repositoryObject.getProperty().getItem();
|
||||
if (sqlPatternItem.isSystem()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (repositoryObject.getProperty().getItem() instanceof RoutineItem) {
|
||||
RoutineItem routineItem = (RoutineItem) repositoryObject.getProperty().getItem();
|
||||
if (routineItem.isBuiltIn()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private String getSortTOSUnsignItems(Map<String, Integer> tosUnsignItemMap) {
|
||||
List<Map.Entry<String, Integer>> resultMapList = new ArrayList<Map.Entry<String, Integer>>(tosUnsignItemMap.entrySet());
|
||||
Collections.sort(resultMapList, new Comparator<Map.Entry<String, Integer>>() {
|
||||
|
||||
@Override
|
||||
public int compare(Entry<String, Integer> o1, Entry<String, Integer> o2) {
|
||||
List<TOSProdNameEnum> categoryList = Arrays.asList(TOSProdNameEnum.values());
|
||||
TOSProdNameEnum category1 = TOSProdNameEnum.valueOf(o1.getKey());
|
||||
TOSProdNameEnum category2 = TOSProdNameEnum.valueOf(o2.getKey());
|
||||
return categoryList.indexOf(category1) - categoryList.indexOf(category2);
|
||||
}
|
||||
});
|
||||
Map<String, Integer> tosUnsignMap = new LinkedHashMap<String, Integer>();
|
||||
resultMapList.forEach(entry -> {
|
||||
tosUnsignMap.put(entry.getKey(), entry.getValue());
|
||||
});
|
||||
return PendoTrackDataUtil.convertEntityJsonString(tosUnsignMap);
|
||||
}
|
||||
|
||||
private String getSortInvalidItems(Map<String, Integer> invalidItemVersionMap) {
|
||||
List<Map.Entry<String, Integer>> resultMapList = new ArrayList<Map.Entry<String, Integer>>(
|
||||
invalidItemVersionMap.entrySet());
|
||||
Collections.sort(resultMapList, new Comparator<Map.Entry<String, Integer>>(){
|
||||
|
||||
@Override
|
||||
public int compare(Entry<String, Integer> o1, Entry<String, Integer> o2) {
|
||||
return o1.getKey().compareTo(o2.getKey());
|
||||
}
|
||||
|
||||
});
|
||||
Map<String, Integer> invalidMap = new LinkedHashMap<String, Integer>();
|
||||
resultMapList.forEach(entry -> {
|
||||
invalidMap.put(entry.getKey(), entry.getValue());
|
||||
});
|
||||
return PendoTrackDataUtil.convertEntityJsonString(invalidMap);
|
||||
}
|
||||
|
||||
public void sendTrackToPendo() {
|
||||
if (!isTrackAvailable) {
|
||||
return;
|
||||
}
|
||||
Job job = new Job("send pendo track") {
|
||||
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
try {
|
||||
collectProperties();
|
||||
PendoTrackSender.getInstance().sendTrackData(TrackEvent.ITEM_SIGNATURE, itemSignProperties);
|
||||
} catch (Exception e) {
|
||||
// warning only
|
||||
ExceptionHandler.process(e, Level.WARN);
|
||||
}
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
};
|
||||
job.setUser(false);
|
||||
job.setPriority(Job.INTERACTIVE);
|
||||
job.schedule();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -93,6 +93,7 @@ import org.talend.core.context.CommandLineContext;
|
||||
import org.talend.core.context.Context;
|
||||
import org.talend.core.context.RepositoryContext;
|
||||
import org.talend.core.exception.TalendInternalPersistenceException;
|
||||
import org.talend.core.hadoop.BigDataBasicUtil;
|
||||
import org.talend.core.hadoop.IHadoopDistributionService;
|
||||
import org.talend.core.model.components.IComponentsService;
|
||||
import org.talend.core.model.general.ILibrariesService;
|
||||
@@ -2209,6 +2210,9 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
|
||||
// init dynamic distirbution after `beforeLogon`, before loading libraries.
|
||||
initDynamicDistribution(monitor);
|
||||
|
||||
// need to set m2
|
||||
LoginTaskRegistryReader loginTaskRegistryReader = new LoginTaskRegistryReader();
|
||||
ILoginTask[] allLoginTasks = loginTaskRegistryReader.getAllCommandlineTaskListInstance();
|
||||
@@ -2315,6 +2319,7 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
if (monitor != null && monitor.isCanceled()) {
|
||||
throw new OperationCanceledException(""); //$NON-NLS-1$
|
||||
}
|
||||
PendoItemSignatureManager.getInstance().sendTrackToPendo();
|
||||
|
||||
boolean isCommandLineLocalRefProject = false;
|
||||
CommandLineContext commandLineContext = (CommandLineContext) CoreRuntimePlugin.getInstance().getContext()
|
||||
@@ -2404,6 +2409,18 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private void initDynamicDistribution(IProgressMonitor monitor) {
|
||||
try {
|
||||
if (BigDataBasicUtil.isDynamicDistributionLoaded(monitor)) {
|
||||
BigDataBasicUtil.reloadAllDynamicDistributions(monitor);
|
||||
} else {
|
||||
BigDataBasicUtil.loadDynamicDistribution(monitor);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
// to fix the ops4j and m2e.core maven handler conflict issue TUP-31484
|
||||
private void unregisterM2EServiceBeforeLogon() {
|
||||
|
||||
@@ -15,6 +15,10 @@ package org.talend.core.repository.ui.view;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.e4.ui.css.swt.theme.ITheme;
|
||||
import org.eclipse.e4.ui.css.swt.theme.IThemeEngine;
|
||||
import org.eclipse.e4.ui.css.swt.theme.IThemeManager;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.resource.JFaceResources;
|
||||
import org.eclipse.jface.viewers.IColorProvider;
|
||||
@@ -23,6 +27,11 @@ import org.eclipse.jface.viewers.LabelProvider;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.graphics.Font;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.ServiceReference;
|
||||
import org.talend.commons.runtime.model.repository.ECDCStatus;
|
||||
import org.talend.commons.runtime.model.repository.ERepositoryStatus;
|
||||
import org.talend.commons.ui.runtime.image.ECoreImage;
|
||||
@@ -49,6 +58,7 @@ import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.model.repository.RepositoryContentManager;
|
||||
import org.talend.core.model.repository.RepositoryNodeProviderRegistryReader;
|
||||
import org.talend.core.model.repository.RepositoryViewObject;
|
||||
import org.talend.core.repository.CoreRepositoryPlugin;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
import org.talend.core.repository.model.repositoryObject.MetadataTableRepositoryObject;
|
||||
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||
@@ -87,6 +97,8 @@ public class RepositoryLabelProvider extends LabelProvider implements IColorProv
|
||||
|
||||
private static final Color MERGED_REFERENCED_ITEMS_COLOR = new Color(null, 120, 120, 120);
|
||||
|
||||
private static final Color WHITE = new Color(null, 255, 255, 255);
|
||||
|
||||
private IRepositoryView view;
|
||||
|
||||
private static boolean refreshProperty = true;
|
||||
@@ -480,6 +492,21 @@ public class RepositoryLabelProvider extends LabelProvider implements IColorProv
|
||||
@Override
|
||||
public Color getForeground(Object element) {
|
||||
RepositoryNode node = (RepositoryNode) element;
|
||||
try {
|
||||
Bundle bundle = Platform.getBundle(CoreRepositoryPlugin.PLUGIN_ID);
|
||||
BundleContext context = bundle.getBundleContext();
|
||||
ServiceReference ref = context.getServiceReference(IThemeManager.class.getName());
|
||||
IThemeManager manager = (IThemeManager) context.getService(ref);
|
||||
IThemeEngine engine = manager
|
||||
.getEngineForDisplay(PlatformUI.getWorkbench().getActiveWorkbenchWindow() == null ? Display.getCurrent()
|
||||
: PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().getDisplay());
|
||||
ITheme curTheme = engine.getActiveTheme();
|
||||
if (curTheme.getId().contains("dark")) {
|
||||
return null;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
switch (node.getType()) {
|
||||
case REFERENCED_PROJECT:
|
||||
return STABLE_PRIMARY_ENTRY_COLOR;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.talend.core.model.metadata.ColumnNameChanged;
|
||||
import org.talend.core.model.metadata.IMetadataTable;
|
||||
import org.talend.core.model.metadata.builder.connection.MetadataTable;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.runtime.process.ITalendProcessJavaProject;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.NodeType;
|
||||
@@ -134,6 +135,12 @@ public interface ICoreService extends IService {
|
||||
*/
|
||||
void installComponents(IProgressMonitor monitor);
|
||||
|
||||
Integer getSignatureVerifyResult(Property property, IPath resourcePath, boolean considerGP) throws Exception;
|
||||
|
||||
String getLicenseCustomer();
|
||||
|
||||
boolean isInValidGP();
|
||||
|
||||
public static ICoreService get() {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreService.class)) {
|
||||
return GlobalServiceRegister.getDefault().getService(ICoreService.class);
|
||||
|
||||
@@ -351,11 +351,19 @@ public class ConnParameterKeys {
|
||||
|
||||
public static final String CONN_PARA_KEY_DATABRICKS_CLOUD_PROVIDER = "CONN_PARA_KEY_DATABRICKS_CLOUD_PROVIDER";
|
||||
|
||||
public static final String CONN_PARA_KEY_DATABRICKS_CLUSTER_TYPE = "CONN_PARA_KEY_DATABRICKS_CLUSTER_TYPE";
|
||||
|
||||
public static final String CONN_PARA_KEY_DATABRICKS_RUN_MODE = "CONN_PARA_KEY_DATABRICKS_RUN_MODE";
|
||||
|
||||
public static final String CONN_PARA_KEY_DATABRICKS_CLUSTER_ID="CONN_PARA_KEY_DATABRICKS_CLUSTER_ID";
|
||||
|
||||
public static final String CONN_PARA_KEY_DATABRICKS_TOKEN="CONN_PARA_KEY_DATABRICKS_TOKEN";
|
||||
|
||||
public static final String CONN_PARA_KEY_DATABRICKS_NODE_TYPE="CONN_PARA_KEY_DATABRICKS_NODE_TYPE";
|
||||
|
||||
public static final String CONN_PARA_KEY_DATABRICKS_DRIVER_NODE_TYPE="CONN_PARA_KEY_DATABRICKS_DRIVER_NODE_TYPE";
|
||||
|
||||
public static final String CONN_PARA_KEY_DATABRICKS_RUNTIME_VERSION="CONN_PARA_KEY_DATABRICKS_RUNTIME_VERSION";
|
||||
|
||||
public static final String CONN_PARA_KEY_DATABRICKS_DBFS_DEP_FOLDER="CONN_PARA_KEY_DATABRICKS_DBFS_DEP_FOLDER";
|
||||
|
||||
|
||||
@@ -207,7 +207,13 @@ public enum EDatabaseConnTemplate {
|
||||
"2181")), //$NON-NLS-1$
|
||||
|
||||
MAPRDB(new DbConnStr(EDatabaseTypeName.MAPRDB, "127.0.0.1", //$NON-NLS-1$
|
||||
"5181")); //$NON-NLS-1$
|
||||
"5181")), //$NON-NLS-1$
|
||||
|
||||
SNOWFLAKE(
|
||||
new DbConnStr(EDatabaseTypeName.SNOWFLAKE, //
|
||||
"jdbc:snowflake://<host>:<port>/?<property>",
|
||||
"3306" //$NON-NLS-1$
|
||||
)); // $NON-NLS-1$
|
||||
|
||||
private DbConnStr connStr;
|
||||
|
||||
|
||||
@@ -56,14 +56,14 @@ public enum EDatabaseVersion4Drivers {
|
||||
HSQLDB_SERVER(new DbVersion4Drivers(EDatabaseTypeName.HSQLDB_SERVER, "hsqldb.jar")), //$NON-NLS-1$
|
||||
HSQLDB_WEBSERVER(new DbVersion4Drivers(EDatabaseTypeName.HSQLDB_WEBSERVER, "hsqldb.jar")), //$NON-NLS-1$
|
||||
|
||||
H2(new DbVersion4Drivers(EDatabaseTypeName.H2, "h2-2.1.210.jar")), //$NON-NLS-1$
|
||||
H2(new DbVersion4Drivers(EDatabaseTypeName.H2, "h2-2.1.214.jar")), //$NON-NLS-1$
|
||||
|
||||
//
|
||||
JAVADB_EMBEDED(new DbVersion4Drivers(EDatabaseTypeName.JAVADB_EMBEDED, "derby.jar")), //$NON-NLS-1$
|
||||
SQLITE(new DbVersion4Drivers(EDatabaseTypeName.SQLITE, "sqlitejdbc-v056.jar")), //$NON-NLS-1$
|
||||
FIREBIRD(new DbVersion4Drivers(EDatabaseTypeName.FIREBIRD, "jaybird-full-2.1.1.jar")), //$NON-NLS-1$
|
||||
TERADATA(new DbVersion4Drivers(EDatabaseTypeName.TERADATA,
|
||||
new String[] { "terajdbc4-17.10.00.27.jar" })), //$NON-NLS-1$ //$NON-NLS-2$
|
||||
new String[] { "terajdbc4-17.10.00.27.jar" })), //$NON-NLS-1$
|
||||
JAVADB_DERBYCLIENT(new DbVersion4Drivers(EDatabaseTypeName.JAVADB_DERBYCLIENT, "derbyclient.jar")), //$NON-NLS-1$
|
||||
NETEZZA(new DbVersion4Drivers(EDatabaseTypeName.NETEZZA, "nzjdbc.jar")), //$NON-NLS-1$
|
||||
INFORMIX(new DbVersion4Drivers(EDatabaseTypeName.INFORMIX, "ifxjdbc.jar")), //$NON-NLS-1$
|
||||
@@ -96,12 +96,12 @@ public enum EDatabaseVersion4Drivers {
|
||||
GREENPLUM_PSQL(new DbVersion4Drivers(EDatabaseTypeName.GREENPLUM,"PostgreSQL", "POSTGRESQL", "postgresql-8.4-703.jdbc4.jar")), //$NON-NLS-1$
|
||||
GREENPLUM(new DbVersion4Drivers(EDatabaseTypeName.GREENPLUM,"Greenplum", "GREENPLUM", "greenplum-5.1.4.000275.jar")), //$NON-NLS-1$
|
||||
// PSQL_V10(new DbVersion4Drivers(EDatabaseTypeName.PSQL, "v10", "V10", "postgresql-42.2.5.jar")),
|
||||
PSQL_V9_X(new DbVersion4Drivers(EDatabaseTypeName.PSQL, "v9 and later", "V9_X", "postgresql-42.2.25.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
PSQL_V9_X(new DbVersion4Drivers(EDatabaseTypeName.PSQL, "v9 and later", "V9_X", "postgresql-42.2.26.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
PSQL_PRIOR_TO_V9(new DbVersion4Drivers(EDatabaseTypeName.PSQL, "Prior to v9", "PRIOR_TO_V9", "postgresql-8.4-703.jdbc4.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
|
||||
PLUSPSQL_PRIOR_TO_V9(new DbVersion4Drivers(EDatabaseTypeName.PLUSPSQL,
|
||||
"Prior to v9", "PRIOR_TO_V9", "postgresql-8.4-703.jdbc4.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
PLUSPSQL_V9_X(new DbVersion4Drivers(EDatabaseTypeName.PLUSPSQL, "v9 and later", "V9_X", "postgresql-42.2.25.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
PLUSPSQL_V9_X(new DbVersion4Drivers(EDatabaseTypeName.PLUSPSQL, "v9 and later", "V9_X", "postgresql-42.2.26.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
IBMDB2(new DbVersion4Drivers(EDatabaseTypeName.IBMDB2, new String[] { "db2jcc4.jar", "db2jcc_license_cu.jar", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"db2jcc_license_cisuz.jar" })), //$NON-NLS-1$
|
||||
IBMDB2ZOS(new DbVersion4Drivers(EDatabaseTypeName.IBMDB2ZOS, new String[] { "db2jcc4.jar", "db2jcc_license_cu.jar", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
@@ -154,6 +154,14 @@ public enum EHadoopProperties {
|
||||
|
||||
DATABRICKS_DBFS_DEP_FOLDER,
|
||||
|
||||
DATABRICKS_NODE_TYPE,
|
||||
|
||||
DATABRICKS_DRIVER_NODE_TYPE,
|
||||
|
||||
DATABRICKS_RUNTIME_VERSION,
|
||||
|
||||
DATABRICKS_CLUSTER_TYPE,
|
||||
|
||||
UNIV_STANDALONE_MASTER,
|
||||
|
||||
UNIV_STANDALONE_EXEC_MEMORY,
|
||||
|
||||
@@ -194,6 +194,10 @@ public interface IMetadataConnection extends IMetadata {
|
||||
public String getContextName();
|
||||
|
||||
public void setContextName(String contextName);
|
||||
|
||||
public boolean isSupportNLS();
|
||||
|
||||
public void setSupportNLS(boolean newSupportNLS);
|
||||
|
||||
/**
|
||||
* Returns the value that you stored in the data collection by the key. Normally, it is like this key-value. For
|
||||
|
||||
@@ -260,6 +260,7 @@ public final class ConvertionHelper {
|
||||
result.setContentModel(connection.isContextMode());
|
||||
result.setContextId(sourceConnection.getContextId());
|
||||
result.setContextName(sourceConnection.getContextName());
|
||||
result.setSupportNLS(sourceConnection.isSupportNLS());
|
||||
// handle oracle database connnection of general_jdbc.
|
||||
result.setSchema(getMeataConnectionSchema(result));
|
||||
convertOtherParameters(result, connection);
|
||||
|
||||
@@ -113,6 +113,7 @@ public class MetadataConnection implements IMetadataConnection {
|
||||
|
||||
private String contextName;
|
||||
|
||||
private boolean supportNLS = false;
|
||||
// ~
|
||||
|
||||
private String comment;
|
||||
@@ -729,6 +730,14 @@ public class MetadataConnection implements IMetadataConnection {
|
||||
public void setContextName(String contextName) {
|
||||
this.contextName = contextName;
|
||||
}
|
||||
|
||||
public boolean isSupportNLS() {
|
||||
return supportNLS;
|
||||
}
|
||||
|
||||
public void setSupportNLS(boolean supportNLS) {
|
||||
this.supportNLS = supportNLS;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
|
||||
@@ -1250,6 +1250,11 @@ public class RepositoryToComponentProperty {
|
||||
return value2;
|
||||
|
||||
}
|
||||
|
||||
if(value.equals("SUPPORT_NLS")) {
|
||||
return connection.isSupportNLS();
|
||||
}
|
||||
|
||||
if (value.equals("CDC_TYPE_MODE")) { //$NON-NLS-1$
|
||||
return new Boolean(CDCTypeMode.LOG_MODE.getName().equals(connection.getCdcTypeMode()));
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.eclipse.ui.preferences.ScopedPreferenceStore;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.utils.PasswordEncryptUtil;
|
||||
import org.talend.commons.utils.generation.CodeGenerationUtils;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.language.ECodeLanguage;
|
||||
import org.talend.core.language.LanguageManager;
|
||||
import org.talend.core.model.metadata.types.JavaType;
|
||||
@@ -37,6 +38,7 @@ import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.model.utils.JavaResourcesHelper;
|
||||
import org.talend.core.model.utils.SQLPatternUtils;
|
||||
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||
import org.talend.core.service.IDesignerXMLMapperService;
|
||||
import org.talend.core.utils.TalendQuoteUtils;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ContextType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType;
|
||||
@@ -293,8 +295,7 @@ public final class ElementParameterParser {
|
||||
|
||||
List<IElementParameter> params = (List<IElementParameter>) element.getElementParametersWithChildrens();
|
||||
if (params != null && !params.isEmpty()) {
|
||||
for (int i = 0; i < params.size(); i++) {
|
||||
IElementParameter param = params.get(i);
|
||||
for (IElementParameter param : params) {
|
||||
if (text.indexOf(param.getVariableName()) != -1
|
||||
|| (param.getVariableName() != null && param.getVariableName().contains(text))) {
|
||||
if (param.getFieldType() == EParameterFieldType.TABLE) {
|
||||
@@ -422,8 +423,8 @@ public final class ElementParameterParser {
|
||||
}
|
||||
IElementParameter param;
|
||||
|
||||
for (int i = 0; i < element.getElementParameters().size(); i++) {
|
||||
param = element.getElementParameters().get(i);
|
||||
for (IElementParameter element2 : element.getElementParameters()) {
|
||||
param = element2;
|
||||
if (text.indexOf(param.getVariableName()) != -1) {
|
||||
if (param.getFieldType() == EParameterFieldType.TABLE) {
|
||||
return createTableValuesXML((List<Map<String, Object>>) param.getValue(), param);
|
||||
@@ -483,7 +484,21 @@ public final class ElementParameterParser {
|
||||
if (element instanceof INode) {
|
||||
INode node = (INode) element;
|
||||
if (node.getExternalNode() != null) {
|
||||
return EcoreUtil.copy(node.getExternalNode().getExternalEmfData());
|
||||
Object obj = null;
|
||||
if (node.isVirtualGenerateNode()) {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerXMLMapperService.class)) {
|
||||
final IDesignerXMLMapperService service = GlobalServiceRegister.getDefault()
|
||||
.getService(IDesignerXMLMapperService.class);
|
||||
if (service != null) {
|
||||
obj = service.rebuildXmlMapData(node.getExternalNode());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (obj != null) {
|
||||
return obj;
|
||||
} else {
|
||||
return EcoreUtil.copy(node.getExternalNode().getExternalEmfData());
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -496,8 +511,8 @@ public final class ElementParameterParser {
|
||||
}
|
||||
IElementParameter param;
|
||||
newText = text;
|
||||
for (int i = 0; i < element.getElementParameters().size(); i++) {
|
||||
param = element.getElementParameters().get(i);
|
||||
for (IElementParameter element2 : element.getElementParameters()) {
|
||||
param = element2;
|
||||
if (newText.contains(param.getVariableName())) {
|
||||
String value = getDisplayValue(param);
|
||||
newText = newText.replace(param.getVariableName(), value);
|
||||
|
||||
@@ -37,7 +37,7 @@ public abstract class AbstractJobParameterInRepositoryRelationshipHandler extend
|
||||
Set<Relation> relationSet = new HashSet<Relation>();
|
||||
|
||||
for (ElementParameterType paramType : parametersMap.values()) {
|
||||
if (paramType.getName().endsWith(":" + getRepositoryTypeName())) { //$NON-NLS-1$
|
||||
if (paramType.getName() != null && paramType.getName().endsWith(":" + getRepositoryTypeName())) { //$NON-NLS-1$
|
||||
String name = paramType.getName().split(":")[0]; //$NON-NLS-1$
|
||||
ElementParameterType repositoryTypeParam = parametersMap.get(name + ":" //$NON-NLS-1$
|
||||
+ getRepositoryTypeName());
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.talend.core.runtime.projectsetting.ProjectPreferenceManager;
|
||||
import org.talend.core.service.IRemoteService;
|
||||
import org.talend.repository.model.IProxyRepositoryFactory;
|
||||
import org.talend.repository.model.RepositoryConstants;
|
||||
import org.talend.utils.security.StudioEncryption;
|
||||
|
||||
/**
|
||||
* created by wchen on 2015年6月16日 Detailled comment
|
||||
@@ -255,7 +256,7 @@ public class TalendLibsServerManager {
|
||||
if (enableProxyFlag) {
|
||||
serverBean.setServer(prefManager.getValue(TalendLibsServerManager.NEXUS_PROXY_URL));
|
||||
serverBean.setUserName(prefManager.getValue(TalendLibsServerManager.NEXUS_PROXY_USERNAME));
|
||||
serverBean.setPassword(prefManager.getValue(TalendLibsServerManager.NEXUS_PROXY_PASSWORD));
|
||||
serverBean.setPassword(StudioEncryption.getStudioEncryption(StudioEncryption.EncryptionKeyName.SYSTEM).decrypt(prefManager.getValue(TalendLibsServerManager.NEXUS_PROXY_PASSWORD)));
|
||||
serverBean.setRepositoryId(prefManager.getValue(TalendLibsServerManager.NEXUS_PROXY_REPOSITORY_ID));
|
||||
serverBean.setType(prefManager.getValue(TalendLibsServerManager.NEXUS_PROXY_TYPE));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// 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.pendo;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.emf.common.util.EMap;
|
||||
import org.talend.commons.utils.VersionUtils;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.runtime.projectsetting.ProjectPreferenceManager;
|
||||
import org.talend.core.runtime.util.EmfResourceUtil;
|
||||
import org.talend.repository.ProjectManager;
|
||||
import org.talend.utils.security.CryptoMigrationUtil;
|
||||
import org.talend.utils.security.StudioEncryption;
|
||||
|
||||
/**
|
||||
* DOC jding class global comment. Detailled comment
|
||||
*/
|
||||
public class PendoItemSignatureUtil {
|
||||
|
||||
public static final String MIGRATION_TOKEN_KEY = "force_import_unsupported_job";
|
||||
|
||||
public static final String REPOSITORY_PLUGIN_ID = "org.talend.repository";
|
||||
|
||||
public static final String PROJ_DATE_ID = "repository.project.id";
|
||||
|
||||
public static final String PROD_DATE_ID = "product.date.id";
|
||||
|
||||
public static String getCurrentProjectCreateDate() {
|
||||
Project currentProject = ProjectManager.getInstance().getCurrentProject();
|
||||
if (currentProject != null) {
|
||||
ProjectPreferenceManager projectPrefManager = new ProjectPreferenceManager(
|
||||
PendoItemSignatureUtil.REPOSITORY_PLUGIN_ID, false);
|
||||
String projDate = projectPrefManager.getValue(PendoItemSignatureUtil.PROJ_DATE_ID);
|
||||
if (StringUtils.isNotBlank(projDate)) {
|
||||
String decrypt = null;
|
||||
if (StudioEncryption.hasEncryptionSymbol(projDate)) {
|
||||
decrypt = StudioEncryption.getStudioEncryption(StudioEncryption.EncryptionKeyName.MIGRATION_TOKEN)
|
||||
.decrypt(projDate);
|
||||
} else {
|
||||
decrypt = CryptoMigrationUtil.decrypt(projDate);
|
||||
}
|
||||
return decrypt;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getStudioVersion() {
|
||||
String studioVersion = VersionUtils.getDisplayVersion();
|
||||
String patchInstalledVersion = PendoTrackDataUtil.getLatestPatchInstalledVersion();
|
||||
if (StringUtils.isNotBlank(patchInstalledVersion)) {
|
||||
studioVersion = patchInstalledVersion;
|
||||
}
|
||||
return studioVersion;
|
||||
}
|
||||
|
||||
public static String getItemProductVersion(Property property) {
|
||||
String productVersion = null;
|
||||
EMap additionalProperties = property.getAdditionalProperties();
|
||||
if (additionalProperties.get("modified_product_version") != null) {
|
||||
productVersion = additionalProperties.get("modified_product_version").toString();
|
||||
} else if (additionalProperties.get("created_product_version") != null) {
|
||||
productVersion = additionalProperties.get("created_product_version").toString();
|
||||
}
|
||||
if (StringUtils.isNotBlank(productVersion)) {
|
||||
productVersion = VersionUtils.getTalendPureVersion(productVersion);
|
||||
}
|
||||
return productVersion;
|
||||
}
|
||||
|
||||
public static String getItemProductName(Property property) {
|
||||
String productName = null;
|
||||
EMap additionalProperties = property.getAdditionalProperties();
|
||||
if (additionalProperties.get("modified_product_fullname") != null) {
|
||||
productName = additionalProperties.get("modified_product_fullname").toString();
|
||||
} else if (additionalProperties.get("created_product_fullname") != null) {
|
||||
productName = additionalProperties.get("created_product_fullname").toString();
|
||||
}
|
||||
return productName;
|
||||
}
|
||||
|
||||
public static String formatDate(String dateString, String pattern) {
|
||||
String formattedDate = "";
|
||||
if (StringUtils.isNotBlank(dateString)) {
|
||||
Date date = new Date(Long.parseLong(dateString));
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
|
||||
formattedDate = sdf.format(date);
|
||||
}
|
||||
return formattedDate;
|
||||
}
|
||||
|
||||
public interface SignatureStatus {
|
||||
|
||||
public static final int V_VALID = 0;
|
||||
|
||||
public static final int V_INVALID = EmfResourceUtil.V_INVALID << 0;
|
||||
|
||||
public static final int V_UNSIGNED = V_INVALID << 1;
|
||||
}
|
||||
|
||||
public enum TOSProdNameEnum {
|
||||
|
||||
TOS_DI("Talend Open Studio for Data Integration"),
|
||||
TOS_BD("Talend Open Studio for Big Data"),
|
||||
TOS_ESB("Talend Open Studio for ESB"),
|
||||
TOS_TOP("Talend Open Studio for Data Quality");
|
||||
|
||||
private String prodName;
|
||||
|
||||
TOSProdNameEnum(String prodName) {
|
||||
this.prodName = prodName;
|
||||
}
|
||||
|
||||
public String getProdName() {
|
||||
return prodName;
|
||||
}
|
||||
|
||||
public static String getTOSCategoryByProdName(String prodName) {
|
||||
String category = null;
|
||||
for (TOSProdNameEnum tosProdNameEnum : TOSProdNameEnum.values()) {
|
||||
if (tosProdNameEnum.getProdName().equals(prodName)) {
|
||||
category = tosProdNameEnum.name();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return category;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public enum ValueEnum {
|
||||
|
||||
YES("Y"),
|
||||
NO("N"),
|
||||
NOT_APPLICATE("N/A");
|
||||
|
||||
private String displayValue;
|
||||
|
||||
ValueEnum(String displayValue) {
|
||||
this.displayValue = displayValue;
|
||||
}
|
||||
|
||||
public String getDisplayValue() {
|
||||
return displayValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,11 +61,7 @@ public class PendoTrackDataUtil {
|
||||
}
|
||||
|
||||
public static IPendoDataProperties getLoginEventProperties() {
|
||||
String studioPatch = null;
|
||||
IInstalledPatchService installedPatchService = IInstalledPatchService.get();
|
||||
if (installedPatchService != null) {
|
||||
studioPatch = installedPatchService.getLatestInstalledPatchVersion();
|
||||
}
|
||||
String studioPatch = getLatestPatchInstalledVersion();
|
||||
PendoLoginProperties loginEvent = new PendoLoginProperties();
|
||||
IStudioLiteP2Service studioLiteP2Service = IStudioLiteP2Service.get();
|
||||
try {
|
||||
@@ -93,6 +89,15 @@ public class PendoTrackDataUtil {
|
||||
return loginEvent;
|
||||
}
|
||||
|
||||
public static String getLatestPatchInstalledVersion() {
|
||||
String studioPatch = "";
|
||||
IInstalledPatchService installedPatchService = IInstalledPatchService.get();
|
||||
if (installedPatchService != null) {
|
||||
studioPatch = installedPatchService.getLatestInstalledVersion(true);
|
||||
}
|
||||
return studioPatch;
|
||||
}
|
||||
|
||||
private static void setUpRefProjectsStructure(PendoLoginProperties loginEvent) {
|
||||
ProjectManager projectManager = ProjectManager.getInstance();
|
||||
Project currentProject = projectManager.getCurrentProject();
|
||||
@@ -162,7 +167,9 @@ public class PendoTrackDataUtil {
|
||||
OPEN_IN_APITester("Open in API Tester"),
|
||||
OPEN_API_DOCUMENTATION("Open API Documentation"),
|
||||
AUTOMAP("tMap Automap"),
|
||||
TMAP("Studio tMap");
|
||||
TMAP("tMap"),
|
||||
ITEM_IMPORT("Import items"),
|
||||
ITEM_SIGNATURE("Item Signature");
|
||||
|
||||
private String event;
|
||||
|
||||
|
||||
@@ -55,9 +55,9 @@ import org.talend.utils.json.JSONObject;
|
||||
*/
|
||||
public class PendoTrackSender {
|
||||
|
||||
private static final String PROP_PENDO_LOCAL_CHECK = "talend.pendo.localDebug";
|
||||
public static final String PROP_PENDO_LOCAL_CHECK = "talend.pendo.localDebug";
|
||||
|
||||
private static final String PROP_PENDO_LOG_DATA = "talend.pendo.logRuntimeData";
|
||||
public static final String PROP_PENDO_LOG_DATA = "talend.pendo.logRuntimeData";
|
||||
|
||||
private static final String PREFIX_API = "api";
|
||||
|
||||
@@ -79,13 +79,18 @@ public class PendoTrackSender {
|
||||
|
||||
private static String pendoInfo;
|
||||
|
||||
public PendoTrackSender() {
|
||||
private PendoTrackSender() {
|
||||
}
|
||||
|
||||
static {
|
||||
instance = new PendoTrackSender();
|
||||
RepositoryContext repositoryContext = getRepositoryContext();
|
||||
if (repositoryContext != null) {
|
||||
adminUrl = repositoryContext.getFields().get(RepositoryConstants.REPOSITORY_URL);
|
||||
}
|
||||
}
|
||||
|
||||
public static PendoTrackSender getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new PendoTrackSender();
|
||||
}
|
||||
if (StringUtils.isBlank(adminUrl)) {
|
||||
RepositoryContext repositoryContext = getRepositoryContext();
|
||||
if (repositoryContext != null) {
|
||||
@@ -118,7 +123,7 @@ public class PendoTrackSender {
|
||||
|
||||
public void sendTrackData(TrackEvent event, IPendoDataProperties properties) throws Exception {
|
||||
if (isPendoLocalDebug()) {
|
||||
ExceptionHandler.log(PendoTrackDataUtil.convertEntityJsonString(properties));
|
||||
ExceptionHandler.log(event.getEvent() + ":" + PendoTrackDataUtil.convertEntityJsonString(properties));
|
||||
return;
|
||||
}
|
||||
DefaultHttpClient client = null;
|
||||
|
||||
@@ -0,0 +1,211 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// 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.pendo.properties;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* DOC jding class global comment. Detailled comment
|
||||
*/
|
||||
public class PendoSignImportProperties implements IPendoDataProperties {
|
||||
|
||||
@JsonProperty("source_version")
|
||||
private List<String> sourceVersion;
|
||||
|
||||
@JsonProperty("studio_version")
|
||||
private String studioVersion;
|
||||
|
||||
@JsonProperty("valid_items")
|
||||
private int validItems;
|
||||
|
||||
@JsonProperty("unsigned_items_from_SE")
|
||||
private String unsignSEItems;
|
||||
|
||||
@JsonProperty("unsigned_items_from_EE")
|
||||
private int unsignEEItems;
|
||||
|
||||
@JsonProperty("grace_period")
|
||||
private String gracePeriod;
|
||||
|
||||
@JsonProperty("installed_date")
|
||||
private String installDate;
|
||||
|
||||
@JsonProperty("project_creation_date")
|
||||
private String projectCreateDate;
|
||||
|
||||
@JsonProperty("valid_migration_token")
|
||||
private String validMigrationToken;
|
||||
|
||||
|
||||
/**
|
||||
* Getter for sourceVersion.
|
||||
* @return the sourceVersion
|
||||
*/
|
||||
public List<String> getSourceVersion() {
|
||||
return sourceVersion;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the sourceVersion.
|
||||
* @param sourceVersion the sourceVersion to set
|
||||
*/
|
||||
public void setSourceVersion(List<String> sourceVersion) {
|
||||
this.sourceVersion = sourceVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for studioVersion.
|
||||
*
|
||||
* @return the studioVersion
|
||||
*/
|
||||
public String getStudioVersion() {
|
||||
return studioVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the studioVersion.
|
||||
*
|
||||
* @param studioVersion the studioVersion to set
|
||||
*/
|
||||
public void setStudioVersion(String studioVersion) {
|
||||
this.studioVersion = studioVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for validItems.
|
||||
*
|
||||
* @return the validItems
|
||||
*/
|
||||
public int getValidItems() {
|
||||
return validItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the validItems.
|
||||
*
|
||||
* @param validItems the validItems to set
|
||||
*/
|
||||
public void setValidItems(int validItems) {
|
||||
this.validItems = validItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for unsignSEItems.
|
||||
* @return the unsignSEItems
|
||||
*/
|
||||
public String getUnsignSEItems() {
|
||||
return unsignSEItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the unsignSEItems.
|
||||
* @param unsignSEItems the unsignSEItems to set
|
||||
*/
|
||||
public void setUnsignSEItems(String unsignSEItems) {
|
||||
this.unsignSEItems = unsignSEItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for unsignEEItems.
|
||||
*
|
||||
* @return the unsignEEItems
|
||||
*/
|
||||
public int getUnsignEEItems() {
|
||||
return unsignEEItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the unsignEEItems.
|
||||
*
|
||||
* @param unsignEEItems the unsignEEItems to set
|
||||
*/
|
||||
public void setUnsignEEItems(int unsignEEItems) {
|
||||
this.unsignEEItems = unsignEEItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for gracePeriod.
|
||||
*
|
||||
* @return the gracePeriod
|
||||
*/
|
||||
public String getGracePeriod() {
|
||||
return gracePeriod;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the gracePeriod.
|
||||
*
|
||||
* @param gracePeriod the gracePeriod to set
|
||||
*/
|
||||
public void setGracePeriod(String gracePeriod) {
|
||||
this.gracePeriod = gracePeriod;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for installDate.
|
||||
*
|
||||
* @return the installDate
|
||||
*/
|
||||
public String getInstallDate() {
|
||||
return installDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the installDate.
|
||||
*
|
||||
* @param installDate the installDate to set
|
||||
*/
|
||||
public void setInstallDate(String installDate) {
|
||||
this.installDate = installDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for projectCreateDate.
|
||||
*
|
||||
* @return the projectCreateDate
|
||||
*/
|
||||
public String getProjectCreateDate() {
|
||||
return projectCreateDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the projectCreateDate.
|
||||
*
|
||||
* @param projectCreateDate the projectCreateDate to set
|
||||
*/
|
||||
public void setProjectCreateDate(String projectCreateDate) {
|
||||
this.projectCreateDate = projectCreateDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for validMigrationToken.
|
||||
*
|
||||
* @return the validMigrationToken
|
||||
*/
|
||||
public String getValidMigrationToken() {
|
||||
return validMigrationToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the validMigrationToken.
|
||||
*
|
||||
* @param validMigrationToken the validMigrationToken to set
|
||||
*/
|
||||
public void setValidMigrationToken(String validMigrationToken) {
|
||||
this.validMigrationToken = validMigrationToken;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,251 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// 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.pendo.properties;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* DOC jding class global comment. Detailled comment
|
||||
*/
|
||||
public class PendoSignLogonProperties implements IPendoDataProperties {
|
||||
|
||||
@JsonProperty("studio_version")
|
||||
private String studioVersion;
|
||||
|
||||
@JsonProperty("valid_items")
|
||||
private int validItems;
|
||||
|
||||
@JsonProperty("signature_invalid_items")
|
||||
private int invalidSignItems;
|
||||
|
||||
@JsonProperty("unsigned_items_from_SE")
|
||||
private String unsignSEItems;
|
||||
|
||||
@JsonProperty("unsigned_items_from_EE")
|
||||
private int unsignEEItems;
|
||||
|
||||
@JsonProperty("invalid_item_source_version")
|
||||
private String invalidItemSourceVersion;
|
||||
|
||||
@JsonProperty("signed_by_migration")
|
||||
private int signByMigration;
|
||||
|
||||
@JsonProperty("grace_period")
|
||||
private String gracePeriod;
|
||||
|
||||
@JsonProperty("installed_date")
|
||||
private String installDate;
|
||||
|
||||
@JsonProperty("project_creation_date")
|
||||
private String projectCreateDate;
|
||||
|
||||
@JsonProperty("valid_migration_token")
|
||||
private String validMigrationToken;
|
||||
|
||||
/**
|
||||
* Getter for studioVersion.
|
||||
*
|
||||
* @return the studioVersion
|
||||
*/
|
||||
public String getStudioVersion() {
|
||||
return studioVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the studioVersion.
|
||||
*
|
||||
* @param studioVersion the studioVersion to set
|
||||
*/
|
||||
public void setStudioVersion(String studioVersion) {
|
||||
this.studioVersion = studioVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for validItems.
|
||||
*
|
||||
* @return the validItems
|
||||
*/
|
||||
public int getValidItems() {
|
||||
return validItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the validItems.
|
||||
*
|
||||
* @param validItems the validItems to set
|
||||
*/
|
||||
public void setValidItems(int validItems) {
|
||||
this.validItems = validItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for invalidSignItems.
|
||||
*
|
||||
* @return the invalidSignItems
|
||||
*/
|
||||
public int getInvalidSignItems() {
|
||||
return invalidSignItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the invalidSignItems.
|
||||
*
|
||||
* @param invalidSignItems the invalidSignItems to set
|
||||
*/
|
||||
public void setInvalidSignItems(int invalidSignItems) {
|
||||
this.invalidSignItems = invalidSignItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for unsignSEItems.
|
||||
* @return the unsignSEItems
|
||||
*/
|
||||
public String getUnsignSEItems() {
|
||||
return unsignSEItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the unsignSEItems.
|
||||
* @param unsignSEItems the unsignSEItems to set
|
||||
*/
|
||||
public void setUnsignSEItems(String unsignSEItems) {
|
||||
this.unsignSEItems = unsignSEItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for unsignEEItems.
|
||||
*
|
||||
* @return the unsignEEItems
|
||||
*/
|
||||
public int getUnsignEEItems() {
|
||||
return unsignEEItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the unsignEEItems.
|
||||
*
|
||||
* @param unsignEEItems the unsignEEItems to set
|
||||
*/
|
||||
public void setUnsignEEItems(int unsignEEItems) {
|
||||
this.unsignEEItems = unsignEEItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for invalidItemSourceVersion.
|
||||
*
|
||||
* @return the invalidItemSourceVersion
|
||||
*/
|
||||
public String getInvalidItemSourceVersion() {
|
||||
return invalidItemSourceVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the invalidItemSourceVersion.
|
||||
*
|
||||
* @param invalidItemSourceVersion the invalidItemSourceVersion to set
|
||||
*/
|
||||
public void setInvalidItemSourceVersion(String invalidItemSourceVersion) {
|
||||
this.invalidItemSourceVersion = invalidItemSourceVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for signByMigration.
|
||||
*
|
||||
* @return the signByMigration
|
||||
*/
|
||||
public int getSignByMigration() {
|
||||
return signByMigration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the signByMigration.
|
||||
*
|
||||
* @param signByMigration the signByMigration to set
|
||||
*/
|
||||
public void setSignByMigration(int signByMigration) {
|
||||
this.signByMigration = signByMigration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for gracePeriod.
|
||||
*
|
||||
* @return the gracePeriod
|
||||
*/
|
||||
public String getGracePeriod() {
|
||||
return gracePeriod;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the gracePeriod.
|
||||
*
|
||||
* @param gracePeriod the gracePeriod to set
|
||||
*/
|
||||
public void setGracePeriod(String gracePeriod) {
|
||||
this.gracePeriod = gracePeriod;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for installDate.
|
||||
*
|
||||
* @return the installDate
|
||||
*/
|
||||
public String getInstallDate() {
|
||||
return installDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the installDate.
|
||||
*
|
||||
* @param installDate the installDate to set
|
||||
*/
|
||||
public void setInstallDate(String installDate) {
|
||||
this.installDate = installDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for projectCreateDate.
|
||||
*
|
||||
* @return the projectCreateDate
|
||||
*/
|
||||
public String getProjectCreateDate() {
|
||||
return projectCreateDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the projectCreateDate.
|
||||
*
|
||||
* @param projectCreateDate the projectCreateDate to set
|
||||
*/
|
||||
public void setProjectCreateDate(String projectCreateDate) {
|
||||
this.projectCreateDate = projectCreateDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for validMigrationToken.
|
||||
*
|
||||
* @return the validMigrationToken
|
||||
*/
|
||||
public String getValidMigrationToken() {
|
||||
return validMigrationToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the validMigrationToken.
|
||||
*
|
||||
* @param validMigrationToken the validMigrationToken to set
|
||||
*/
|
||||
public void setValidMigrationToken(String validMigrationToken) {
|
||||
this.validMigrationToken = validMigrationToken;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -449,7 +449,7 @@ repository.rulesSql=SQL
|
||||
repository.rulesParser=Parser
|
||||
repository.rulesMatcher=Match
|
||||
repository.systemIndicators=System Indicators
|
||||
repository.userDefineIndicators=User Defined Indicators
|
||||
repository.userDefineIndicators=User-defined Indicators
|
||||
repository.userDefineIndicators.lib=lib
|
||||
repository.systemIndicators.advancedStatistics=Advanced Statistics
|
||||
repository.systemIndicators.businessRules=Business Rules
|
||||
|
||||
@@ -449,7 +449,7 @@ repository.rulesSql=SQL
|
||||
repository.rulesParser=\u30D1\u30FC\u30B5\u30FC
|
||||
repository.rulesMatcher=\u4E00\u81F4
|
||||
repository.systemIndicators=\u30B7\u30B9\u30C6\u30E0\u30A4\u30F3\u30C7\u30A3\u30B1\u30FC\u30BF\u30FC
|
||||
repository.userDefineIndicators=\u30E6\u30FC\u30B6\u30FC\u5B9A\u7FA9\u30A4\u30F3\u30B8\u30B1\u30FC\u30BF\u30FC
|
||||
repository.userDefineIndicators=\u30E6\u30FC\u30B6\u30FC\u5B9A\u7FA9\u306E\u30A4\u30F3\u30B8\u30B1\u30FC\u30BF\u30FC
|
||||
repository.userDefineIndicators.lib=lib
|
||||
repository.systemIndicators.advancedStatistics=\u8A73\u7D30\u7D71\u8A08
|
||||
repository.systemIndicators.businessRules=\u30D3\u30B8\u30CD\u30B9\u30EB\u30FC\u30EB
|
||||
|
||||
@@ -19,7 +19,9 @@ package org.talend.core.runtime.maven;
|
||||
public interface MavenConstants {
|
||||
|
||||
static final String NAME_GROUP_ID = "GROUP_ID";
|
||||
|
||||
|
||||
static final String CLOUD_VERSION = "CLOUD_VERSION";
|
||||
|
||||
static final String NAME_USER_VERSION = "USER_VERSION";
|
||||
|
||||
static final String NAME_PUBLISH_AS_SNAPSHOT = "PUBLISH_AS_SNAPSHOT";
|
||||
|
||||
@@ -48,6 +48,10 @@ public interface TalendProcessOptionConstants {
|
||||
|
||||
public static final int GENERATE_POM_NOT_CLEAR_CACHE = 1 << 11;
|
||||
|
||||
/**
|
||||
* for DQ clean item
|
||||
*/
|
||||
public static final int GENERATE_NO_RESET_DQ = 1 << 12;
|
||||
/**
|
||||
* clean options
|
||||
*/
|
||||
|
||||
@@ -30,4 +30,6 @@ public interface IDesignerXMLMapperService extends IService {
|
||||
*/
|
||||
public boolean isVirtualComponent(final INode node);
|
||||
|
||||
public Object rebuildXmlMapData(final INode node);
|
||||
|
||||
}
|
||||
|
||||
@@ -128,6 +128,12 @@ public interface IStudioLiteP2Service extends IService {
|
||||
|
||||
void setupTmcUpdate(IProgressMonitor monitor, IStudioUpdateConfig updateConfig) throws Exception;
|
||||
|
||||
boolean removeM2() throws Exception;
|
||||
|
||||
void saveRemoveM2(boolean remove) throws Exception;
|
||||
|
||||
void cleanM2(IProgressMonitor monitor);
|
||||
|
||||
public static IStudioLiteP2Service get() {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IStudioLiteP2Service.class)) {
|
||||
return GlobalServiceRegister.getDefault().getService(IStudioLiteP2Service.class);
|
||||
|
||||
@@ -42,6 +42,7 @@ import org.talend.core.model.metadata.builder.ConvertionHelper;
|
||||
import org.talend.core.model.metadata.builder.connection.MetadataTable;
|
||||
import org.talend.core.model.process.ElementParameterParser;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.relationship.RelationshipItemBuilder;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.model.repository.RepositoryManager;
|
||||
@@ -56,6 +57,7 @@ import org.talend.core.model.utils.TalendTextUtils;
|
||||
import org.talend.core.prefs.PreferenceManipulator;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
import org.talend.core.runtime.process.ITalendProcessJavaProject;
|
||||
import org.talend.core.services.ICoreTisService;
|
||||
import org.talend.core.services.IJobCheckService;
|
||||
import org.talend.core.utils.KeywordsValidator;
|
||||
import org.talend.designer.codegen.ICodeGeneratorService;
|
||||
@@ -400,4 +402,31 @@ public class CoreService implements ICoreService {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getSignatureVerifyResult(Property property, IPath resourcePath, boolean considerGP) throws Exception {
|
||||
ICoreTisService coreTisService = ICoreTisService.get();
|
||||
if (coreTisService != null) {
|
||||
return coreTisService.getSignatureVerifyResult(property, resourcePath, considerGP);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLicenseCustomer() {
|
||||
ICoreTisService coreTisService = ICoreTisService.get();
|
||||
if (coreTisService != null) {
|
||||
return coreTisService.getLicenseCustomer();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInValidGP() {
|
||||
ICoreTisService coreTisService = ICoreTisService.get();
|
||||
if (coreTisService != null) {
|
||||
return coreTisService.isInValidGP();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.model.components.conversions.IComponentConversion;
|
||||
import org.talend.core.model.components.conversions.RenameComponentConversion;
|
||||
import org.talend.core.model.components.conversions.DefaultRenameComponentConversion;
|
||||
import org.talend.core.model.components.filters.IComponentFilter;
|
||||
import org.talend.core.model.components.filters.NameComponentFilter;
|
||||
import org.talend.core.model.properties.Item;
|
||||
@@ -56,6 +57,20 @@ public class ModifyComponentsAction {
|
||||
throws PersistenceException {
|
||||
searchAndModify(item, item.getProcess(), filter, conversions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename component name
|
||||
* @param item job item
|
||||
* @param processType Process type
|
||||
* @param oldName old base name, for tck component, name does not include prefix "t", while for non tck components, name includes prefix "t".
|
||||
* @param newName new base name, for tck component, name does not include prefix "t", while for non tck components, name includes prefix "t".
|
||||
* @return
|
||||
* @throws PersistenceException
|
||||
*/
|
||||
public static boolean searchAndRenameComponent(Item item, ProcessType processType, String oldName, String newName) throws PersistenceException {
|
||||
return searchAndModify(item, processType, new NameComponentFilter(oldName), Arrays.<IComponentConversion> asList(new DefaultRenameComponentConversion(oldName, newName)));
|
||||
|
||||
}
|
||||
|
||||
public static boolean searchAndModify(Item item, ProcessType processType, IComponentFilter filter,
|
||||
List<IComponentConversion> conversions) throws PersistenceException {
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// 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.model.components.conversions;
|
||||
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.talend.commons.runtime.model.components.IComponentConstants;
|
||||
import org.talend.core.model.components.ComponentUtilities;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ConnectionType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.MetadataType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.NodeType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ProcessType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.SubjobType;
|
||||
|
||||
/**
|
||||
* @author bhe created on Jul 6, 2022
|
||||
*
|
||||
*/
|
||||
public class DefaultRenameComponentConversion implements IComponentConversion {
|
||||
|
||||
private String newName;
|
||||
|
||||
private String oldName;
|
||||
|
||||
/**
|
||||
* Rename component name
|
||||
*
|
||||
* @param oldName old base name of the component, e.g. NetSuiteV2019Input
|
||||
* @param newName new base name of the component, e.g. NetSuiteNewInput
|
||||
*/
|
||||
public DefaultRenameComponentConversion(String oldName, String newName) {
|
||||
super();
|
||||
this.newName = newName;
|
||||
this.oldName = oldName;
|
||||
}
|
||||
|
||||
public void transform(NodeType node) {
|
||||
node.setComponentName(newName);
|
||||
ProcessType item = (ProcessType) node.eContainer();
|
||||
String oldNodeUniqueName = ComponentUtilities.getNodeUniqueName(node);
|
||||
ComponentUtilities.setNodeUniqueName(node, oldNodeUniqueName.replaceAll(oldName, newName));
|
||||
replaceAllInAllNodesParameterValue(item, this.oldName, this.newName);
|
||||
}
|
||||
|
||||
protected static void replaceAllInAllNodesParameterValue(ProcessType item, String oldName, String newName) {
|
||||
for (Object o : item.getNode()) {
|
||||
NodeType nt = (NodeType) o;
|
||||
ComponentUtilities.replaceInNodeParameterValue(nt, oldName, newName);
|
||||
EList metaList = nt.getMetadata();
|
||||
if (metaList != null) {
|
||||
if (!metaList.isEmpty()) {
|
||||
for (Object obj : metaList) {
|
||||
MetadataType meta = (MetadataType) obj;
|
||||
if (meta.getName().contains(oldName)) {
|
||||
meta.setName(meta.getName().replaceAll(oldName, newName));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Object o : item.getConnection()) {
|
||||
ConnectionType currentConnection = (ConnectionType) o;
|
||||
if (currentConnection.getSource().contains(oldName)) {
|
||||
currentConnection.setSource(currentConnection.getSource().replaceAll(oldName, newName));
|
||||
}
|
||||
if (currentConnection.getTarget().contains(oldName)) {
|
||||
currentConnection.setTarget(currentConnection.getTarget().replaceAll(oldName, newName));
|
||||
}
|
||||
if (currentConnection.getMetaname().contains(oldName)) {
|
||||
currentConnection.setMetaname(currentConnection.getMetaname().replaceAll(oldName, newName));
|
||||
}
|
||||
|
||||
if ("RUN_IF".equals(currentConnection.getConnectorName())) {
|
||||
for (Object obj : currentConnection.getElementParameter()) {
|
||||
ElementParameterType type = (ElementParameterType) obj;
|
||||
if ("CONDITION".equals(type.getName())) {
|
||||
if (type.getValue() != null && type.getValue().contains(oldName)) {
|
||||
String replaceAll = type.getValue().replaceAll(oldName, newName);
|
||||
type.setValue(replaceAll);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Object o : item.getSubjob()) {
|
||||
SubjobType sj = (SubjobType) o;
|
||||
for (Object obj : sj.getElementParameter()) {
|
||||
ElementParameterType p = (ElementParameterType) obj;
|
||||
if (p.getName().equals(IComponentConstants.UNIQUE_NAME)) {
|
||||
if (p.getValue() != null && p.getValue().contains(oldName)) {
|
||||
String replaceAll = p.getValue().replaceAll(oldName, newName);
|
||||
p.setValue(replaceAll);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getNewName() {
|
||||
return this.newName;
|
||||
}
|
||||
|
||||
public void setNewName(String newName) {
|
||||
this.newName = newName;
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.emf.common.util.URI;
|
||||
import org.osgi.service.prefs.BackingStoreException;
|
||||
@@ -84,6 +85,12 @@ public interface ICoreTisService extends IService {
|
||||
|
||||
public void afterImport (Property property) throws PersistenceException;
|
||||
|
||||
Integer getSignatureVerifyResult(Property property, IPath resourcePath, boolean considerGP) throws Exception;
|
||||
|
||||
String getLicenseCustomer();
|
||||
|
||||
boolean isInValidGP();
|
||||
|
||||
boolean hasNewPatchInPatchesFolder();
|
||||
|
||||
boolean isDefaultLicenseAndProjectType();
|
||||
|
||||
@@ -278,6 +278,19 @@ public class ProcessorUtilities {
|
||||
needExportItemsForDQ = false;
|
||||
}
|
||||
|
||||
public static void resetExportConfig(boolean noResetDq) {
|
||||
interpreter = null;
|
||||
codeLocation = null;
|
||||
libraryPath = null;
|
||||
exportConfig = false;
|
||||
exportAsOSGI = false;
|
||||
exportTimeStamp = null;
|
||||
exportJobAsMicroService = false;
|
||||
if (!noResetDq) {
|
||||
needExportItemsForDQ = false;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getInterpreter() {
|
||||
return interpreter;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<properties>
|
||||
<tcomp.version>1.46.1</tcomp.version>
|
||||
<tcomp.version>1.47.1</tcomp.version>
|
||||
<slf4j.version>1.7.32</slf4j.version>
|
||||
<reload4j.version>1.2.19</reload4j.version>
|
||||
</properties>
|
||||
|
||||
@@ -25,8 +25,22 @@
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-configuration2</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-configuration2</artifactId>
|
||||
<version>2.8.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-text</artifactId>
|
||||
<version>1.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson</groupId>
|
||||
<artifactId>jackson-bom</artifactId>
|
||||
|
||||
@@ -241,7 +241,8 @@ public class BuildCacheManager {
|
||||
property.getVersion(), true);
|
||||
if (obj != null) {
|
||||
IRunProcessService.get().generatePom(obj.getProperty().getItem(),
|
||||
TalendProcessOptionConstants.GENERATE_POM_NOT_CLEAR_CACHE);
|
||||
TalendProcessOptionConstants.GENERATE_POM_NOT_CLEAR_CACHE
|
||||
| TalendProcessOptionConstants.GENERATE_NO_RESET_DQ);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -331,7 +332,7 @@ public class BuildCacheManager {
|
||||
|
||||
private ITalendProcessJavaProject getTalendJobJavaProject(Property property) {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
|
||||
IRunProcessService service = (IRunProcessService) GlobalServiceRegister.getDefault()
|
||||
IRunProcessService service = GlobalServiceRegister.getDefault()
|
||||
.getService(IRunProcessService.class);
|
||||
return service.getTalendJobJavaProject(property);
|
||||
}
|
||||
@@ -347,7 +348,7 @@ public class BuildCacheManager {
|
||||
|
||||
private boolean isBuildJob() {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
|
||||
IRunProcessService service = (IRunProcessService) GlobalServiceRegister.getDefault()
|
||||
IRunProcessService service = GlobalServiceRegister.getDefault()
|
||||
.getService(IRunProcessService.class);
|
||||
return service.isExportConfig();
|
||||
}
|
||||
|
||||
@@ -140,8 +140,12 @@ public abstract class AbstractMavenCodesTemplatePom extends AbstractMavenGeneral
|
||||
Exclusion jacksonExclusion = new Exclusion();
|
||||
jacksonExclusion.setGroupId("com.fasterxml.jackson.core"); //$NON-NLS-1$
|
||||
jacksonExclusion.setArtifactId("jackson-databind "); //$NON-NLS-1$
|
||||
Exclusion configuration2Exclusion = new Exclusion();
|
||||
configuration2Exclusion.setGroupId("org.apache.commons"); //$NON-NLS-1$
|
||||
configuration2Exclusion.setArtifactId("commons-configuration2"); //$NON-NLS-1$
|
||||
dependency.addExclusion(exclusion);
|
||||
dependency.addExclusion(jacksonExclusion);
|
||||
dependency.addExclusion(configuration2Exclusion);
|
||||
}
|
||||
existedDependencies.add(dependency);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry exported="true" kind="lib" path="lib/lucene-core-3.0.3.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/lucene-core-8.11.2.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="output" path="class"/>
|
||||
|
||||
@@ -4,22 +4,38 @@ Bundle-Name: Lucene plug-in
|
||||
Bundle-SymbolicName: org.talend.libraries.apache.lucene
|
||||
Bundle-Version: 8.8.8.qualifier
|
||||
Bundle-Vendor: .Talend SA.
|
||||
Bundle-ClassPath: lib/lucene-core-3.0.3.jar,
|
||||
Bundle-ClassPath: lib/lucene-core-8.11.2.jar,
|
||||
.
|
||||
Export-Package: org.apache.lucene,
|
||||
org.apache.lucene.analysis,
|
||||
org.apache.lucene.analysis.standard,
|
||||
org.apache.lucene.analysis.tokenattributes,
|
||||
org.apache.lucene.codecs,
|
||||
org.apache.lucene.codecs.blocktree,
|
||||
org.apache.lucene.codecs.compressing,
|
||||
org.apache.lucene.codecs.lucene50,
|
||||
org.apache.lucene.codecs.lucene60,
|
||||
org.apache.lucene.codecs.lucene80,
|
||||
org.apache.lucene.codecs.lucene84,
|
||||
org.apache.lucene.codecs.lucene86,
|
||||
org.apache.lucene.codecs.lucene87,
|
||||
org.apache.lucene.codecs.perfield,
|
||||
org.apache.lucene.document,
|
||||
org.apache.lucene.geo,
|
||||
org.apache.lucene.index,
|
||||
org.apache.lucene.messages,
|
||||
org.apache.lucene.queryParser,
|
||||
org.apache.lucene.search,
|
||||
org.apache.lucene.search.function,
|
||||
org.apache.lucene.search.payloads,
|
||||
org.apache.lucene.search.comparators,
|
||||
org.apache.lucene.search.similarities,
|
||||
org.apache.lucene.search.spans,
|
||||
org.apache.lucene.store,
|
||||
org.apache.lucene.util,
|
||||
org.apache.lucene.util.cache
|
||||
org.apache.lucene.util.automaton,
|
||||
org.apache.lucene.util.bkd,
|
||||
org.apache.lucene.util.compress,
|
||||
org.apache.lucene.util.fst,
|
||||
org.apache.lucene.util.graph,
|
||||
org.apache.lucene.util.hppc,
|
||||
org.apache.lucene.util.mutable,
|
||||
org.apache.lucene.util.packed
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Eclipse-BundleShape: dir
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
output.. = class/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
lib/lucene-core-2.9.3.jar,\
|
||||
lib/lucene-core-3.0.3.jar
|
||||
lib/lucene-core-8.11.2.jar
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -9,4 +9,36 @@
|
||||
</parent>
|
||||
<artifactId>org.talend.libraries.apache.lucene</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
||||
<properties>
|
||||
<lucene.version>8.11.2</lucene.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-core</artifactId>
|
||||
<version>${lucene.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-dependencies</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.basedir}/lib</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry exported="true" kind="lib" path="lib/lucene-analyzers-common-8.3.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/lucene-core-8.3.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/lucene-queries-8.3.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/lucene-queryparser-8.3.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/lucene-analyzers-common-8.11.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/lucene-backward-codecs-8.11.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/lucene-core-8.11.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/lucene-queries-8.11.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/lucene-queryparser-8.11.2.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
|
||||
@@ -5,10 +5,11 @@ Bundle-SymbolicName: org.talend.libraries.apache.lucene8
|
||||
Bundle-Version: 8.8.8.qualifier
|
||||
Bundle-Vendor: .Talend SA.
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-ClassPath: lib/lucene-analyzers-common-8.3.1.jar,
|
||||
lib/lucene-core-8.3.1.jar,
|
||||
lib/lucene-queries-8.3.1.jar,
|
||||
lib/lucene-queryparser-8.3.1.jar
|
||||
Bundle-ClassPath: lib/lucene-analyzers-common-8.11.2.jar,
|
||||
lib/lucene-backward-codecs-8.11.2.jar,
|
||||
lib/lucene-core-8.11.2.jar,
|
||||
lib/lucene-queries-8.11.2.jar,
|
||||
lib/lucene-queryparser-8.11.2.jar
|
||||
Export-Package: org.apache.lucene,
|
||||
org.apache.lucene.analysis,
|
||||
org.apache.lucene.analysis.ar,
|
||||
@@ -78,6 +79,8 @@ Export-Package: org.apache.lucene,
|
||||
org.apache.lucene.codecs.lucene60,
|
||||
org.apache.lucene.codecs.lucene70,
|
||||
org.apache.lucene.codecs.lucene80,
|
||||
org.apache.lucene.codecs.lucene84,
|
||||
org.apache.lucene.codecs.lucene86,
|
||||
org.apache.lucene.codecs.perfield,
|
||||
org.apache.lucene.collation,
|
||||
org.apache.lucene.collation.tokenattributes,
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
lib/lucene-analyzers-common-8.3.1.jar,\
|
||||
lib/lucene-core-8.3.1.jar,\
|
||||
lib/lucene-queries-8.3.1.jar,\
|
||||
lib/lucene-queryparser-8.3.1.jar
|
||||
lib/lucene-analyzers-common-8.11.2.jar,\
|
||||
lib/lucene-backward-codecs-8.11.2.jar,\
|
||||
lib/lucene-core-8.11.2.jar,\
|
||||
lib/lucene-queries-8.11.2.jar,\
|
||||
lib/lucene-queryparser-8.11.2.jar
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -9,4 +9,57 @@
|
||||
</parent>
|
||||
<artifactId>org.talend.libraries.apache.lucene8</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
||||
<properties>
|
||||
<lucene.version>8.11.2</lucene.version>
|
||||
</properties>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-analyzers-common</artifactId>
|
||||
<version>${lucene.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-backward-codecs</artifactId>
|
||||
<version>${lucene.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-core</artifactId>
|
||||
<version>${lucene.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-queries</artifactId>
|
||||
<version>${lucene.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-queryparser</artifactId>
|
||||
<version>${lucene.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-dependencies</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.basedir}/lib</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="lib" path="lib/h2-2.1.210.jar"/>
|
||||
<classpathentry kind="lib" path="lib/h2-2.1.214.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
||||
@@ -4,7 +4,7 @@ Bundle-Name: H2
|
||||
Bundle-SymbolicName: org.talend.libraries.jdbc.h2
|
||||
Bundle-Version: 8.8.8.qualifier
|
||||
Bundle-ClassPath: .,
|
||||
lib/h2-2.1.210.jar
|
||||
lib/h2-2.1.214.jar
|
||||
Export-Package: org.h2,
|
||||
org.h2.api;uses:="org.h2.command.ddl,org.h2.table",
|
||||
org.h2.bnf;uses:="org.h2.server.web",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
lib/h2-2.1.210.jar
|
||||
lib/h2-2.1.214.jar
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<artifactItem>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<version>2.1.210</version>
|
||||
<version>2.1.214</version>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
|
||||
@@ -268,11 +268,13 @@ public class JSONObject {
|
||||
public JSONObject(Object bean, Class<?> expectedClass) {
|
||||
this();
|
||||
|
||||
if(bean.getClass() != expectedClass) {
|
||||
throw new JSONException("expectedClass doesn't match the bean or is null");
|
||||
}
|
||||
Class<?> clazz = bean.getClass();
|
||||
if((clazz == expectedClass) || (expectedClass!=null && expectedClass.isAssignableFrom(clazz))) {
|
||||
populateMap(bean);
|
||||
return;
|
||||
}
|
||||
|
||||
populateMap(bean);
|
||||
throw new JSONException("expectedClass doesn't match the bean or is null");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -193,11 +193,15 @@ public class ResumeUtil {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void flush() {
|
||||
if(csvWriter != null) {
|
||||
csvWriter.flush(true);
|
||||
}
|
||||
if (csvWriter == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
synchronized (csvWriter) {
|
||||
csvWriter.flush(true);
|
||||
}
|
||||
}
|
||||
|
||||
// Util: invoke target check point
|
||||
|
||||
@@ -29,6 +29,7 @@ Bundle-Vendor: .Talend SA.
|
||||
Bundle-Localization: plugin
|
||||
Export-Package: org.talend.metadata.managment.ui,
|
||||
org.talend.metadata.managment.ui.celleditor,
|
||||
org.talend.metadata.managment.ui.convert.strategy,
|
||||
org.talend.metadata.managment.ui.dialog,
|
||||
org.talend.metadata.managment.ui.editor,
|
||||
org.talend.metadata.managment.ui.i18n,
|
||||
|
||||
@@ -510,10 +510,12 @@ InegerCellEditorListener.NumeralMessage=Valeur d'entr\u00E9e invalide
|
||||
MetadataTalendTypeEditor.button.edit=Mo&difier
|
||||
MetadataTalendTypeEditor.button.export=E&xporter
|
||||
MetadataTalendTypeEditor.button.import=I&mporter
|
||||
MetadataTalendTypeEditor.button.restore=R&estaurer
|
||||
MetadataTalendTypeEditor.column1.Name=Fichier de mapping de m\u00E9tadonn\u00E9es
|
||||
MetadataTalendTypeEditor.editMappingDialog.title=Modifier le fichier de mapping
|
||||
MetadataTalendTypeEditor.error.message=Message d'erreur
|
||||
MetadataTalendTypeEditor.fileIsImported=Le fichier a d\u00E9j\u00E0 \u00E9t\u00E9 import\u00E9.
|
||||
MetadataTalendTypeEditor.fileOverwrite=Ce fichier existe d\u00E9j\u00E0. L'\u00E9craser\u00A0?
|
||||
MetadataTalendTypeEditor.fileIsInvalid=Le fichier de m\u00E9tadonn\u00E9es import\u00E9 n'est pas valide.
|
||||
MetadataTalendTypeEditor.fileNameStartRule=Le nom de fichier doit commencer par 'mapping_'.
|
||||
ContextModeSelectPage.contextModes=Cr\u00E9er un contexte ou r\u00E9utiliser le contexte existant
|
||||
@@ -549,5 +551,5 @@ MetadataTalendTypeEditor.confirmMessage=Voulez-vous remplacer les param\u00E8tre
|
||||
PromptDialog.title=Ex\u00E9cuter le contexte {0} avec les param\u00E8tres\u00A0:
|
||||
PromptDialog.stringTip=Le texte d'entr\u00E9e doit \u00EAtre entour\u00E9 par des guillemets.
|
||||
PromptDialog.choose.title=Choisissez un contexte
|
||||
PromptDialog.variablePrompts.name=Variables
|
||||
PromptDialog.variablePrompts.name=Variables \u00E0 compl\u00E9ter
|
||||
PromptDialog.context.environments.name=Environnement
|
||||
|
||||
@@ -510,10 +510,12 @@ InegerCellEditorListener.NumeralMessage=\u5165\u529B\u5024\u304C\u7121\u52B9\u30
|
||||
MetadataTalendTypeEditor.button.edit=\u7DE8\u96C6(&D)
|
||||
MetadataTalendTypeEditor.button.export=\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8(&X)
|
||||
MetadataTalendTypeEditor.button.import=\u30A4\u30F3\u30DD\u30FC\u30C8(&M)
|
||||
MetadataTalendTypeEditor.button.restore=\u5FA9\u5143(&E)
|
||||
MetadataTalendTypeEditor.column1.Name=\u30E1\u30BF\u30C7\u30FC\u30BF\u30DE\u30C3\u30D4\u30F3\u30B0\u30D5\u30A1\u30A4\u30EB
|
||||
MetadataTalendTypeEditor.editMappingDialog.title=\u30DE\u30C3\u30D4\u30F3\u30B0\u30D5\u30A1\u30A4\u30EB\u3092\u7DE8\u96C6
|
||||
MetadataTalendTypeEditor.error.message=\u30A8\u30E9\u30FC\u30E1\u30C3\u30BB\u30FC\u30B8
|
||||
MetadataTalendTypeEditor.fileIsImported=\u3053\u306E\u30D5\u30A1\u30A4\u30EB\u306F\u65E2\u306B\u30A4\u30F3\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u3059\u3002
|
||||
MetadataTalendTypeEditor.fileOverwrite=\u3053\u306E\u30D5\u30A1\u30A4\u30EB\u306F\u65E2\u306B\u5B58\u5728\u3057\u307E\u3059\u3002\u4E0A\u66F8\u304D\u3057\u307E\u3059\u304B?
|
||||
MetadataTalendTypeEditor.fileIsInvalid=\u30A4\u30F3\u30DD\u30FC\u30C8\u3055\u308C\u305F\u30E1\u30BF\u30C7\u30FC\u30BF\u30D5\u30A1\u30A4\u30EB\u304C\u7121\u52B9\u3067\u3059\u3002
|
||||
MetadataTalendTypeEditor.fileNameStartRule=\u30D5\u30A1\u30A4\u30EB\u540D\u306F 'mapping_' \u3067\u59CB\u3081\u3066\u304F\u3060\u3055\u3044\u3002
|
||||
ContextModeSelectPage.contextModes=\u65B0\u898F\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u3092\u4F5C\u6210\u3059\u308B\u304B\u3001\u65E2\u5B58\u306E\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u3092\u518D\u4F7F\u7528
|
||||
|
||||
@@ -510,10 +510,12 @@ InegerCellEditorListener.NumeralMessage=\u8F93\u5165\u503C\u65E0\u6548
|
||||
MetadataTalendTypeEditor.button.edit=\u7F16\u8F91(&D)
|
||||
MetadataTalendTypeEditor.button.export=\u5BFC\u51FA(&X)
|
||||
MetadataTalendTypeEditor.button.import=\u5BFC\u5165 (&M)
|
||||
MetadataTalendTypeEditor.button.restore=\u6062\u590D (&E)
|
||||
MetadataTalendTypeEditor.column1.Name=\u5143\u6570\u636E\u6620\u5C04\u6587\u4EF6
|
||||
MetadataTalendTypeEditor.editMappingDialog.title=\u7F16\u8F91\u6620\u5C04\u6587\u4EF6
|
||||
MetadataTalendTypeEditor.error.message=\u9519\u8BEF\u6D88\u606F
|
||||
MetadataTalendTypeEditor.fileIsImported=\u6B64\u6587\u4EF6\u5DF2\u88AB\u5BFC\u5165\u3002
|
||||
MetadataTalendTypeEditor.fileOverwrite=\u6B64\u6587\u4EF6\u5DF2\u5B58\u5728\uFF0C\u8986\u76D6\u5417?
|
||||
MetadataTalendTypeEditor.fileIsInvalid=\u5BFC\u5165\u7684\u5143\u6570\u636E\u6587\u4EF6\u65E0\u6548\u3002
|
||||
MetadataTalendTypeEditor.fileNameStartRule=\u6587\u4EF6\u540D\u5FC5\u987B\u4EE5 'mapping_' \u5F00\u5934\u3002
|
||||
ContextModeSelectPage.contextModes=\u521B\u5EFA\u4E00\u4E2A\u65B0\u7684\u73AF\u5883\u6216\u91CD\u65B0\u4F7F\u7528\u73B0\u6709\u7684\u73AF\u5883
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// 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.metadata.managment.ui.convert.strategy;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.core.hadoop.IHadoopClusterService;
|
||||
import org.talend.core.hadoop.repository.HadoopRepositoryUtil;
|
||||
import org.talend.core.model.context.ContextUtils;
|
||||
import org.talend.core.model.metadata.builder.connection.Connection;
|
||||
import org.talend.core.model.properties.ConnectionItem;
|
||||
import org.talend.core.model.properties.ContextItem;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
import org.talend.metadata.managment.ui.utils.ConnectionContextHelper;
|
||||
import org.talend.metadata.managment.ui.utils.ISwitchContext;
|
||||
import org.talend.repository.ProjectManager;
|
||||
import org.talend.repository.model.IProxyRepositoryFactory;
|
||||
|
||||
|
||||
public abstract class AbstractSwitchContextStrategy implements ISwitchContext {
|
||||
|
||||
private static Logger log = Logger.getLogger(AbstractSwitchContextStrategy.class);
|
||||
|
||||
@Override
|
||||
public boolean updateContextGroup(ConnectionItem connItem, String selectedContext) {
|
||||
return updateContextGroup(connItem, selectedContext, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateContextForConnectionItems(Map<String, String> contextGroupRanamedMap,
|
||||
ContextItem contextItem) {
|
||||
if (contextItem == null) {
|
||||
return false;
|
||||
}
|
||||
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
|
||||
try {
|
||||
List<IRepositoryViewObject> allConnectionItem =
|
||||
factory.getAll(ProjectManager.getInstance().getCurrentProject(),
|
||||
ERepositoryObjectType.METADATA_CONNECTIONS);
|
||||
|
||||
for (IRepositoryViewObject connectionItem : allConnectionItem) {
|
||||
Item item = connectionItem.getProperty().getItem();
|
||||
if (item instanceof ConnectionItem
|
||||
&& ConnectionContextHelper.checkContextMode((ConnectionItem) item) != null) {
|
||||
Connection con = ((ConnectionItem) item).getConnection();
|
||||
String contextId = con.getContextId();
|
||||
if (contextId != null && contextId.equals(contextItem.getProperty().getId())) {
|
||||
String oldContextGroup = con.getContextName();
|
||||
boolean modified = false;
|
||||
if (oldContextGroup != null && !"".equals(oldContextGroup)) { //$NON-NLS-1$
|
||||
String newContextGroup = contextGroupRanamedMap.get(oldContextGroup);
|
||||
if (newContextGroup != null) { // rename
|
||||
con.setContextName(newContextGroup);
|
||||
modified = true;
|
||||
}
|
||||
} else { // if not set, set default group
|
||||
ContextItem originalItem = ContextUtils.getContextItemById2(contextId);
|
||||
con.setContextName(originalItem.getDefaultContext());
|
||||
modified = true;
|
||||
}
|
||||
if (modified) {
|
||||
factory.save(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IHadoopClusterService hadoopClusterService = HadoopRepositoryUtil.getHadoopClusterService();
|
||||
if (hadoopClusterService != null) {
|
||||
hadoopClusterService.updateConfJarsByContextGroup(contextItem, contextGroupRanamedMap);
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void saveConnection(ConnectionItem connItem, boolean... isMigrationTask) {
|
||||
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
|
||||
try {
|
||||
factory.save(connItem, isMigrationTask);
|
||||
} catch (PersistenceException e) {
|
||||
log.error(e, e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,224 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// 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.metadata.managment.ui.convert.strategy;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.ITDQRepositoryService;
|
||||
import org.talend.core.database.EDatabaseTypeName;
|
||||
import org.talend.core.database.conn.DatabaseConnStrUtil;
|
||||
import org.talend.core.model.metadata.builder.connection.Connection;
|
||||
import org.talend.core.model.metadata.builder.connection.DatabaseConnection;
|
||||
import org.talend.core.model.metadata.builder.connection.FileConnection;
|
||||
import org.talend.core.model.properties.ConnectionItem;
|
||||
import org.talend.cwm.helper.CatalogHelper;
|
||||
import org.talend.cwm.helper.ConnectionHelper;
|
||||
import org.talend.cwm.helper.SchemaHelper;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ContextType;
|
||||
import org.talend.metadata.managment.ui.utils.ConnectionContextHelper;
|
||||
|
||||
import orgomg.cwm.resource.relational.Catalog;
|
||||
import orgomg.cwm.resource.relational.Schema;
|
||||
|
||||
/**
|
||||
* default strategy work for except generic jdbc
|
||||
*/
|
||||
public class SwitchContextWithReplace extends AbstractSwitchContextStrategy {
|
||||
|
||||
private static Logger log = Logger.getLogger(SwitchContextWithReplace.class);
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean updateContextGroup(ConnectionItem connItem, String selectedContext, String originalContext,
|
||||
boolean... isMigrationTask) {
|
||||
if (connItem == null) {
|
||||
return false;
|
||||
}
|
||||
Connection con = connItem.getConnection();
|
||||
// MOD msjian 2012-2-13 TDQ-4559: make it support file/mdm connection
|
||||
if (con != null) {
|
||||
// TDQ-4559~
|
||||
String oldContextName = originalContext == null ? con.getContextName() : originalContext;
|
||||
|
||||
String newContextName = selectedContext;
|
||||
if (newContextName == null) {
|
||||
ContextType newContextType =
|
||||
ConnectionContextHelper.getContextTypeForContextMode(con, selectedContext, false);
|
||||
newContextName = newContextType == null ? null : newContextType.getName();
|
||||
}
|
||||
|
||||
if (!isContextIsValid(newContextName, oldContextName, connItem) && hasDependency(connItem)) {
|
||||
// can not update connection when context is invalid(catalog or schema is null) and has dependecy
|
||||
return false;
|
||||
}
|
||||
con.setContextName(newContextName);
|
||||
if (con instanceof DatabaseConnection) {
|
||||
DatabaseConnection dbConn = (DatabaseConnection) connItem.getConnection();
|
||||
String newURL = getChangedURL(dbConn, newContextName);
|
||||
dbConn.setURL(newURL);
|
||||
// do nothing when schema or catalog is null
|
||||
updateConnectionForSidOrUiSchema(dbConn, oldContextName);
|
||||
}
|
||||
|
||||
saveConnection(connItem);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean hasDependency(ConnectionItem connItem) {
|
||||
// Added TDQ-18565
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITDQRepositoryService.class)) {
|
||||
ITDQRepositoryService tdqRepService =
|
||||
GlobalServiceRegister.getDefault().getService(ITDQRepositoryService.class);
|
||||
if (tdqRepService.hasClientDependences(connItem)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC talend Comment method "checkContextIsValid".
|
||||
*
|
||||
* @param selectedContext
|
||||
* @paramconn
|
||||
*/
|
||||
private boolean isContextIsValid(String selectedContext, String oldContextName, ConnectionItem connItem) {
|
||||
boolean retCode = false;
|
||||
Connection conn = connItem.getConnection();
|
||||
if (conn instanceof DatabaseConnection) {
|
||||
EDatabaseTypeName dbType =
|
||||
EDatabaseTypeName.getTypeFromDbType(((DatabaseConnection) conn).getDatabaseType());
|
||||
|
||||
if (dbType == EDatabaseTypeName.GODBC) {// for ODBC
|
||||
retCode = true;
|
||||
} else if (dbType == EDatabaseTypeName.GENERAL_JDBC) {
|
||||
retCode = true;
|
||||
} else {
|
||||
DatabaseConnection dbConn = (DatabaseConnection) conn;
|
||||
boolean hasCatalog = ConnectionHelper.hasCatalog(dbConn);
|
||||
boolean hasSchema = ConnectionHelper.hasSchema(dbConn);
|
||||
ContextType newContextType = ConnectionContextHelper.getContextTypeForContextMode(dbConn,
|
||||
selectedContext, false);
|
||||
ContextType oldContextType = ConnectionContextHelper.getContextTypeForContextMode(dbConn,
|
||||
oldContextName, false);
|
||||
String newSidOrDatabase = ConnectionContextHelper.getOriginalValue(newContextType, dbConn.getSID());
|
||||
String newUiShema = ConnectionContextHelper.getOriginalValue(newContextType, dbConn.getUiSchema());
|
||||
String oldSidOrDatabase = ConnectionContextHelper.getOriginalValue(oldContextType, dbConn.getSID());
|
||||
String oldUiShema = ConnectionContextHelper.getOriginalValue(oldContextType, dbConn.getUiSchema());
|
||||
if (hasCatalog) {// for example mysql
|
||||
retCode = checkEmpty(newSidOrDatabase, oldSidOrDatabase);
|
||||
if (hasSchema) {// for example mssql
|
||||
retCode &= checkEmpty(newUiShema, oldUiShema);
|
||||
}
|
||||
} else if (hasSchema) {// for example oracle
|
||||
retCode = checkEmpty(newUiShema, oldUiShema);
|
||||
} else {// some db didnot have catelog and schema
|
||||
retCode = true;
|
||||
}
|
||||
|
||||
}
|
||||
} else if (conn instanceof FileConnection) {
|
||||
retCode = true;
|
||||
}
|
||||
|
||||
return retCode;
|
||||
|
||||
}
|
||||
|
||||
private boolean checkEmpty(String newSidOrDatabase, String oldSidOrDatabase) {
|
||||
if (isEmptyString(oldSidOrDatabase) && isEmptyString(newSidOrDatabase)) {
|
||||
return true;
|
||||
}
|
||||
return !isEmptyString(oldSidOrDatabase) && !isEmptyString(newSidOrDatabase);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* check whether str is null or length is zero
|
||||
*
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
private boolean isEmptyString(final String str) {
|
||||
return str == null || str.length() == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* change the URL according to selected context Added yyin 20120918 TDQ-5668
|
||||
*
|
||||
* @param connItem
|
||||
* @param con
|
||||
* @param selectedContext
|
||||
*/
|
||||
private String getChangedURL(DatabaseConnection dbConn, String selectedContext) {
|
||||
ContextType contextType = ConnectionContextHelper.getContextTypeForContextMode(dbConn, selectedContext, false);
|
||||
String url = dbConn.getURL();
|
||||
if (url != null) {
|
||||
return url;
|
||||
}
|
||||
String server = ConnectionContextHelper.getOriginalValue(contextType, dbConn.getServerName());
|
||||
String username = ConnectionContextHelper.getOriginalValue(contextType, dbConn.getUsername());
|
||||
String password = ConnectionContextHelper.getOriginalValue(contextType, dbConn.getRawPassword());
|
||||
String port = ConnectionContextHelper.getOriginalValue(contextType, dbConn.getPort());
|
||||
String sidOrDatabase = ConnectionContextHelper.getOriginalValue(contextType, dbConn.getSID());
|
||||
String datasource = ConnectionContextHelper.getOriginalValue(contextType, dbConn.getDatasourceName());
|
||||
String filePath = ConnectionContextHelper.getOriginalValue(contextType, dbConn.getFileFieldName());
|
||||
String dbRootPath = ConnectionContextHelper.getOriginalValue(contextType, dbConn.getDBRootPath());
|
||||
String additionParam = ConnectionContextHelper.getOriginalValue(contextType, dbConn.getAdditionalParams());
|
||||
|
||||
return DatabaseConnStrUtil.getURLString(dbConn.getDatabaseType(), dbConn.getDbVersionString(), server, username,
|
||||
password, port, sidOrDatabase, filePath.toLowerCase(), datasource, dbRootPath, additionParam);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* change context Group need to synchronization name of catalog or schema
|
||||
*
|
||||
* @param dbConn
|
||||
* @param oldContextName
|
||||
*/
|
||||
private void updateConnectionForSidOrUiSchema(DatabaseConnection dbConn, String oldContextName) {
|
||||
String selectedContext = dbConn.getContextName();
|
||||
ContextType newContextType =
|
||||
ConnectionContextHelper.getContextTypeForContextMode(dbConn, selectedContext, false);
|
||||
ContextType oldContextType =
|
||||
ConnectionContextHelper.getContextTypeForContextMode(dbConn, oldContextName, false);
|
||||
String newSidOrDatabase = ConnectionContextHelper.getOriginalValue(newContextType, dbConn.getSID());
|
||||
String newUiShema = ConnectionContextHelper.getOriginalValue(newContextType, dbConn.getUiSchema());
|
||||
String oldSidOrDatabase = ConnectionContextHelper.getOriginalValue(oldContextType, dbConn.getSID());
|
||||
String oldUiShema = ConnectionContextHelper.getOriginalValue(oldContextType, dbConn.getUiSchema());
|
||||
if (!isEmptyString(newSidOrDatabase) && !isEmptyString(oldSidOrDatabase)) {// for example mysql or mssql
|
||||
Catalog catalog = CatalogHelper.getCatalog(dbConn, oldSidOrDatabase);
|
||||
if (catalog != null) {
|
||||
catalog.setName(newSidOrDatabase);
|
||||
|
||||
Schema schema = SchemaHelper.getSchemaByName(CatalogHelper.getSchemas(catalog), oldUiShema);// for
|
||||
// example
|
||||
// mssql
|
||||
if (schema != null) {
|
||||
schema.setName(newUiShema);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isEmptyString(newUiShema) && !isEmptyString(oldUiShema)) {// for example oracle
|
||||
Schema schema = SchemaHelper.getSchema(dbConn, oldUiShema);
|
||||
if (schema != null) {
|
||||
schema.setName(newUiShema);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,214 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// 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.metadata.managment.ui.convert.strategy;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.talend.core.model.metadata.builder.connection.DatabaseConnection;
|
||||
import org.talend.core.model.metadata.builder.database.jdbc.ExtractorFactory;
|
||||
import org.talend.core.model.metadata.builder.database.jdbc.IUrlDbNameExtractor;
|
||||
import org.talend.core.model.properties.ConnectionItem;
|
||||
import org.talend.core.model.properties.DatabaseConnectionItem;
|
||||
import org.talend.cwm.helper.TaggedValueHelper;
|
||||
|
||||
/**
|
||||
* generic jdbc connection will use this strategy
|
||||
*/
|
||||
public class SwitchContextWithTaggedValue extends AbstractSwitchContextStrategy {
|
||||
|
||||
private static Logger log = Logger.getLogger(SwitchContextWithTaggedValue.class);
|
||||
|
||||
@Override
|
||||
public boolean updateContextGroup(ConnectionItem connItem, String selectedContext, String originalContext,
|
||||
boolean... isMigrationTask) {
|
||||
// judge database type by dbMetadata
|
||||
|
||||
IUrlDbNameExtractor extractorInstance =
|
||||
ExtractorFactory.getExtractorInstance(connItem, selectedContext, originalContext);
|
||||
if (extractorInstance == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
extractorInstance.initUiSchemaOrSID();
|
||||
String sid = extractorInstance.getExtractResult().get(0);
|
||||
String uiSchema = extractorInstance.getExtractResult().get(1);
|
||||
DatabaseConnection dbConn = null;
|
||||
if (connItem instanceof DatabaseConnectionItem) {
|
||||
dbConn = (DatabaseConnection) connItem.getConnection();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
// catalog never be null
|
||||
if (extractorInstance.hasCatalog() && StringUtils.isEmpty(sid)) {
|
||||
return false;
|
||||
}
|
||||
// schema can be null only when there are catalog
|
||||
if (!extractorInstance.hasCatalog() && extractorInstance.hasSchema() && StringUtils.isEmpty(uiSchema)) {
|
||||
return false;
|
||||
}
|
||||
boolean hasChanged = false;
|
||||
|
||||
// extract sid by different url try to create class structor to handle default case and special case
|
||||
// setting sid or uischema by different databaseType
|
||||
boolean isOriginalChanged = recordOriginalValue(connItem, selectedContext, originalContext, sid, uiSchema);
|
||||
|
||||
if (extractorInstance.hasBothSturctor()) {
|
||||
if (sidIsValid(sid, dbConn) && uiSchemaIsValid(uiSchema, dbConn)) {
|
||||
// change catalog and schema with same time when both structor exist and no one is empty
|
||||
TaggedValueHelper.setTaggedValue(dbConn, TaggedValueHelper.TARGET_SID, sid);
|
||||
TaggedValueHelper.setTaggedValue(dbConn, TaggedValueHelper.TARGET_UISCHEMA, uiSchema);
|
||||
hasChanged = true;
|
||||
}
|
||||
} else {
|
||||
if (extractorInstance.hasCatalog() && sidIsValid(sid, dbConn)) {
|
||||
// only catalog case
|
||||
TaggedValueHelper.setTaggedValue(dbConn, TaggedValueHelper.TARGET_SID, sid);
|
||||
hasChanged = true;
|
||||
}
|
||||
if (extractorInstance.hasSchema() && uiSchemaIsValid(uiSchema, dbConn)) {
|
||||
// only schema case
|
||||
TaggedValueHelper.setTaggedValue(dbConn, TaggedValueHelper.TARGET_UISCHEMA, uiSchema);
|
||||
hasChanged = true;
|
||||
}
|
||||
}
|
||||
// special case when there are catalog and schema then schema can be set to null for switch between different
|
||||
// catalog same schema case
|
||||
if (isOriginalChanged && extractorInstance.hasBothSturctor() && StringUtils.isEmpty(uiSchema)) {
|
||||
TaggedValueHelper.setTaggedValue(dbConn, TaggedValueHelper.TARGET_UISCHEMA, uiSchema);
|
||||
TaggedValueHelper.setTaggedValue(dbConn, TaggedValueHelper.TARGET_SID, sid);
|
||||
hasChanged = true;
|
||||
}
|
||||
if (hasChanged) {
|
||||
dbConn.setContextName(selectedContext);
|
||||
saveConnection(connItem, isMigrationTask);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean recordOriginalValue(ConnectionItem connItem, String selectedContext, String originalContext,
|
||||
String targetSid, String targetUiSchema) {
|
||||
boolean hasChanged = false;
|
||||
IUrlDbNameExtractor extractorInstance =
|
||||
ExtractorFactory.getExtractorInstance(connItem, originalContext, selectedContext);
|
||||
if (extractorInstance == null) {
|
||||
return hasChanged;
|
||||
}
|
||||
extractorInstance.initUiSchemaOrSID();
|
||||
String originalSid = extractorInstance.getExtractResult().get(0);
|
||||
String originalUiSchema = extractorInstance.getExtractResult().get(1);
|
||||
DatabaseConnection dbConn = null;
|
||||
if (connItem instanceof DatabaseConnectionItem) {
|
||||
dbConn = (DatabaseConnection) connItem.getConnection();
|
||||
} else {
|
||||
return hasChanged;
|
||||
}
|
||||
// catalog never be empty when catalog exist
|
||||
if (extractorInstance.hasCatalog() && StringUtils.isEmpty(originalSid)) {
|
||||
return false;
|
||||
}
|
||||
// schema can be empty only when catalog is exist
|
||||
if (!extractorInstance.hasCatalog() && extractorInstance.hasSchema() && StringUtils.isEmpty(originalUiSchema)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String taggedOriSid = TaggedValueHelper.getValueString(TaggedValueHelper.ORIGINAL_SID, dbConn);
|
||||
String taggedOriUiShchema = TaggedValueHelper.getValueString(TaggedValueHelper.ORIGINAL_UISCHEMA, dbConn);
|
||||
// case1:catalog original value is empty then save original record(first time to switch)
|
||||
if (extractorInstance.hasCatalog() && StringUtils.isEmpty(taggedOriSid)) {
|
||||
if (!StringUtils.isEmpty(originalSid) && !StringUtils.isEmpty(targetSid)) {
|
||||
TaggedValueHelper.setTaggedValue(dbConn, TaggedValueHelper.ORIGINAL_SID, originalSid);
|
||||
hasChanged = true;
|
||||
|
||||
}
|
||||
}
|
||||
// case1:schema original value is empty then save original record(first time to switch)
|
||||
if (extractorInstance.hasSchema() && StringUtils.isEmpty(taggedOriUiShchema)) {
|
||||
if (!StringUtils.isEmpty(originalUiSchema) && !StringUtils.isEmpty(targetUiSchema)) {
|
||||
TaggedValueHelper.setTaggedValue(dbConn, TaggedValueHelper.ORIGINAL_UISCHEMA, originalUiSchema);
|
||||
hasChanged = true;
|
||||
}
|
||||
}
|
||||
// case2 original value is in the context group then do nothing
|
||||
|
||||
// case3 originalContext same with selectedContext(
|
||||
// .e.g. DQ->DQ2->DQ2 the second time switch will change original value to DQ2
|
||||
// DQ->DQ2->DQ the second time switch will keep original value to DQ and switch target value as
|
||||
// DQ
|
||||
|
||||
if (extractorInstance.hasCatalog() && !StringUtils.isEmpty(taggedOriSid) && originalContext.equals(selectedContext)) {
|
||||
// change original catalog need to judge schema is not empty with same time
|
||||
if (!StringUtils.isEmpty(originalSid)
|
||||
&& (!extractorInstance.hasSchema() || !StringUtils.isEmpty(originalUiSchema))) {
|
||||
TaggedValueHelper.setTaggedValue(dbConn, TaggedValueHelper.ORIGINAL_SID, originalSid);
|
||||
hasChanged = true;
|
||||
}
|
||||
}
|
||||
if (extractorInstance.hasSchema() && !StringUtils.isEmpty(taggedOriUiShchema)
|
||||
&& originalContext.equals(selectedContext)) {
|
||||
// change original schema need to judge catalog is not empty with same time
|
||||
if (!StringUtils.isEmpty(originalUiSchema)
|
||||
&& (!extractorInstance.hasCatalog()
|
||||
|| !StringUtils.isEmpty(originalSid) && !StringUtils.isEmpty(targetUiSchema))) {
|
||||
TaggedValueHelper.setTaggedValue(dbConn, TaggedValueHelper.ORIGINAL_UISCHEMA, originalUiSchema);
|
||||
hasChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
// 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)) {
|
||||
TaggedValueHelper.setTaggedValue(dbConn, TaggedValueHelper.ORIGINAL_SID, originalSid);
|
||||
TaggedValueHelper.setTaggedValue(dbConn, TaggedValueHelper.ORIGINAL_UISCHEMA, originalUiSchema);
|
||||
hasChanged = true;
|
||||
}
|
||||
return hasChanged;
|
||||
|
||||
}
|
||||
|
||||
protected boolean isSpecial4Case(String targetUiSchema, IUrlDbNameExtractor extractorInstance,
|
||||
String originalUiSchema, String taggedOriUiShchema) {
|
||||
return extractorInstance.hasBothSturctor()
|
||||
&& StringUtils.isEmpty(originalUiSchema) && StringUtils.isEmpty(targetUiSchema);
|
||||
}
|
||||
|
||||
private boolean originalValueExistInGroup(String taggedOriSid, String originalSid, String targetSid,
|
||||
String taggedOriUiShchema, String originalUiSchema, String targetUiSchema) {
|
||||
if (compareAllSameOrEmpty(taggedOriSid, originalSid)
|
||||
&& compareAllSameOrEmpty(taggedOriUiShchema, originalUiSchema)
|
||||
|| compareAllSameOrEmpty(taggedOriSid, targetSid)
|
||||
&& compareAllSameOrEmpty(taggedOriUiShchema, targetUiSchema)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean compareAllSameOrEmpty(String taggedOriSid, String originalSid) {
|
||||
return taggedOriSid == originalSid || StringUtils.isEmpty(taggedOriSid) && StringUtils.isEmpty(originalSid);
|
||||
}
|
||||
|
||||
private boolean originalValueIsEmpty(String taggedOriSid, String taggedOriUiShchema) {
|
||||
return StringUtils.isEmpty(taggedOriSid) || StringUtils.isEmpty(taggedOriUiShchema);
|
||||
}
|
||||
|
||||
private boolean uiSchemaIsValid(String uiSchema, DatabaseConnection dbConn) {
|
||||
return !StringUtils.isEmpty(uiSchema)
|
||||
&& !StringUtils.isEmpty(TaggedValueHelper.getValueString(TaggedValueHelper.ORIGINAL_UISCHEMA, dbConn));
|
||||
}
|
||||
|
||||
private boolean sidIsValid(String sid, DatabaseConnection dbConn) {
|
||||
return !StringUtils.isEmpty(sid)
|
||||
&& !StringUtils.isEmpty(TaggedValueHelper.getValueString(TaggedValueHelper.ORIGINAL_SID, dbConn));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -893,6 +893,7 @@ public final class DBConnectionContextUtils {
|
||||
managerConnection.setValue(0, dbType, urlConnection, server, username, password, sidOrDatabase, port, filePath,
|
||||
datasource, schemaOracle, additionParam, driverClassName, driverJarPath, dbVersionString);
|
||||
managerConnection.setDbRootPath(dbRootPath);
|
||||
managerConnection.setSupportNLS(dbConn.isSupportNLS());
|
||||
|
||||
return urlConnection;
|
||||
}
|
||||
@@ -1058,6 +1059,12 @@ public final class DBConnectionContextUtils {
|
||||
cloneConn.setSQLMode(true);
|
||||
}
|
||||
|
||||
if(dbConn.isSetSupportNLS()) {
|
||||
cloneConn.setSupportNLS(dbConn.isSupportNLS());
|
||||
} else {
|
||||
cloneConn.setSupportNLS(false);
|
||||
}
|
||||
|
||||
// cloneConn.setProperties(dbConn.getProperties());
|
||||
// cloneConn.setCdcConns(dbConn.getCdcConns());
|
||||
// cloneConn.setQueries(dbConn.getQueries());
|
||||
|
||||
@@ -162,6 +162,10 @@ public class ExtendedNodeConnectionContextUtils {
|
||||
DataBricksClusterId,
|
||||
DataBricksToken,
|
||||
DataBricksDBFSDepFolder,
|
||||
DataBricksClusterType,
|
||||
DataBricksRuntimeVersion,
|
||||
DataBricksDriverNodeType,
|
||||
DataBricksNodeType,
|
||||
|
||||
//Knox
|
||||
SparkMode,
|
||||
|
||||
@@ -31,6 +31,16 @@ public interface ISwitchContext {
|
||||
*/
|
||||
public boolean updateContextGroup(ConnectionItem connItem, String selectedContext);
|
||||
|
||||
/**
|
||||
* update Context Group for one Connection Item.
|
||||
*
|
||||
* @param connItem
|
||||
* @param selectedContext
|
||||
* @return
|
||||
*/
|
||||
public boolean updateContextGroup(ConnectionItem connItem, String selectedContext, String originalContext,
|
||||
boolean... isMigrationTask);
|
||||
|
||||
/**
|
||||
* update Context For all Connection Items.
|
||||
*
|
||||
|
||||
@@ -12,47 +12,26 @@
|
||||
// ============================================================================
|
||||
package org.talend.metadata.managment.ui.utils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.ITDQRepositoryService;
|
||||
import org.talend.core.database.EDatabaseTypeName;
|
||||
import org.talend.core.database.conn.DatabaseConnStrUtil;
|
||||
import org.talend.core.hadoop.IHadoopClusterService;
|
||||
import org.talend.core.hadoop.repository.HadoopRepositoryUtil;
|
||||
import org.talend.core.model.context.ContextUtils;
|
||||
import org.talend.core.model.metadata.builder.connection.Connection;
|
||||
import org.talend.core.model.metadata.builder.connection.DatabaseConnection;
|
||||
import org.talend.core.model.metadata.builder.connection.FileConnection;
|
||||
import org.talend.core.model.properties.ConnectionItem;
|
||||
import org.talend.core.model.properties.ContextItem;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
import org.talend.cwm.helper.CatalogHelper;
|
||||
import org.talend.cwm.helper.ConnectionHelper;
|
||||
import org.talend.cwm.helper.SchemaHelper;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ContextType;
|
||||
import org.talend.repository.ProjectManager;
|
||||
import org.talend.repository.model.IProxyRepositoryFactory;
|
||||
|
||||
import orgomg.cwm.resource.relational.Catalog;
|
||||
import orgomg.cwm.resource.relational.Schema;
|
||||
import org.talend.core.model.properties.DatabaseConnectionItem;
|
||||
import org.talend.metadata.managment.ui.convert.strategy.SwitchContextWithReplace;
|
||||
import org.talend.metadata.managment.ui.convert.strategy.SwitchContextWithTaggedValue;
|
||||
|
||||
/**
|
||||
* this class is used when switching context group name.
|
||||
*/
|
||||
public class SwitchContextGroupNameImpl implements ISwitchContext {
|
||||
|
||||
private static Logger log = Logger.getLogger(SwitchContextGroupNameImpl.class);
|
||||
|
||||
private static SwitchContextGroupNameImpl instance;
|
||||
|
||||
// default strategy is replace
|
||||
private ISwitchContext strategy = new SwitchContextWithReplace();
|
||||
|
||||
private SwitchContextGroupNameImpl() {
|
||||
}
|
||||
|
||||
@@ -68,6 +47,22 @@ public class SwitchContextGroupNameImpl implements ISwitchContext {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public boolean switchStrategy(ConnectionItem connItem) {
|
||||
if (connItem == null || !(connItem instanceof DatabaseConnectionItem)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
DatabaseConnection dbCon = (DatabaseConnection) connItem.getConnection();
|
||||
String databaseType = dbCon.getDatabaseType();
|
||||
if (EDatabaseTypeName.GENERAL_JDBC.getXMLType().equals(databaseType)) {
|
||||
strategy = new SwitchContextWithTaggedValue();
|
||||
} else {
|
||||
strategy = new SwitchContextWithReplace();
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
@@ -76,7 +71,10 @@ public class SwitchContextGroupNameImpl implements ISwitchContext {
|
||||
*/
|
||||
@Override
|
||||
public boolean updateContextGroup(ConnectionItem connItem, String selectedContext) {
|
||||
return updateContextGroup(connItem, selectedContext, null);
|
||||
if (connItem == null || connItem.getConnection() == null) {
|
||||
return false;
|
||||
}
|
||||
return updateContextGroup(connItem, selectedContext, connItem.getConnection().getContextName());
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -85,187 +83,15 @@ public class SwitchContextGroupNameImpl implements ISwitchContext {
|
||||
* @see org.talend.core.model.metadata.builder.database.ISwitchContext#updateContextGroup(org.talend.core.model.
|
||||
* properties .ContextItem, org.talend.core.model.metadata.builder.connection.Connection)
|
||||
*/
|
||||
public boolean updateContextGroup(ConnectionItem connItem, String selectedContext, String originalContext) {
|
||||
if (connItem == null) {
|
||||
return false;
|
||||
}
|
||||
Connection con = connItem.getConnection();
|
||||
// MOD msjian 2012-2-13 TDQ-4559: make it support file/mdm connection
|
||||
if (con != null) {
|
||||
// TDQ-4559~
|
||||
String oldContextName = originalContext == null ? con.getContextName() : originalContext;
|
||||
|
||||
String newContextName = selectedContext;
|
||||
if (newContextName == null) {
|
||||
ContextType newContextType =
|
||||
ConnectionContextHelper.getContextTypeForContextMode(con, selectedContext, false);
|
||||
newContextName = newContextType == null ? null : newContextType.getName();
|
||||
}
|
||||
|
||||
if (!isContextIsValid(newContextName, oldContextName, connItem) && hasDependency(connItem)) {
|
||||
// can not update connection when context is invalid(catalog or schema is null) and has dependecy
|
||||
return false;
|
||||
}
|
||||
con.setContextName(newContextName);
|
||||
if (con instanceof DatabaseConnection) {
|
||||
DatabaseConnection dbConn = (DatabaseConnection) connItem.getConnection();
|
||||
String newURL = getChangedURL(dbConn, newContextName);
|
||||
dbConn.setURL(newURL);
|
||||
// do nothing when schema or catalog is null
|
||||
updateConnectionForSidOrUiSchema(dbConn, oldContextName);
|
||||
}
|
||||
|
||||
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
|
||||
try {
|
||||
factory.save(connItem);
|
||||
} catch (PersistenceException e) {
|
||||
log.error(e, e);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean hasDependency(ConnectionItem connItem) {
|
||||
// Added TDQ-18565
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITDQRepositoryService.class)) {
|
||||
ITDQRepositoryService tdqRepService =
|
||||
GlobalServiceRegister.getDefault().getService(ITDQRepositoryService.class);
|
||||
if (tdqRepService.hasClientDependences(connItem)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC talend Comment method "checkContextIsValid".
|
||||
*
|
||||
* @param selectedContext
|
||||
* @paramconn
|
||||
*/
|
||||
private boolean isContextIsValid(String selectedContext, String oldContextName, ConnectionItem connItem) {
|
||||
boolean retCode = false;
|
||||
Connection conn = connItem.getConnection();
|
||||
if (conn instanceof DatabaseConnection) {
|
||||
EDatabaseTypeName dbType = EDatabaseTypeName.getTypeFromDbType(((DatabaseConnection) conn).getDatabaseType());
|
||||
|
||||
if (dbType == EDatabaseTypeName.GODBC) {// for ODBC
|
||||
retCode = true;
|
||||
} else if (dbType == EDatabaseTypeName.GENERAL_JDBC) {
|
||||
retCode = true;
|
||||
} else {
|
||||
DatabaseConnection dbConn = (DatabaseConnection) conn;
|
||||
boolean hasCatalog = ConnectionHelper.hasCatalog(dbConn);
|
||||
boolean hasSchema = ConnectionHelper.hasSchema(dbConn);
|
||||
ContextType newContextType = ConnectionContextHelper.getContextTypeForContextMode(dbConn,
|
||||
selectedContext, false);
|
||||
ContextType oldContextType = ConnectionContextHelper.getContextTypeForContextMode(dbConn,
|
||||
oldContextName, false);
|
||||
String newSidOrDatabase = ConnectionContextHelper.getOriginalValue(newContextType, dbConn.getSID());
|
||||
String newUiShema = ConnectionContextHelper.getOriginalValue(newContextType, dbConn.getUiSchema());
|
||||
String oldSidOrDatabase = ConnectionContextHelper.getOriginalValue(oldContextType, dbConn.getSID());
|
||||
String oldUiShema = ConnectionContextHelper.getOriginalValue(oldContextType, dbConn.getUiSchema());
|
||||
if (hasCatalog) {// for example mysql
|
||||
retCode = checkEmpty(newSidOrDatabase, oldSidOrDatabase);
|
||||
if (hasSchema) {// for example mssql
|
||||
retCode &= checkEmpty(newUiShema, oldUiShema);
|
||||
}
|
||||
} else if (hasSchema) {// for example oracle
|
||||
retCode = checkEmpty(newUiShema, oldUiShema);
|
||||
}else {//some db didnot have catelog and schema
|
||||
retCode = true;
|
||||
}
|
||||
|
||||
}
|
||||
} else if (conn instanceof FileConnection) {
|
||||
retCode = true;
|
||||
}
|
||||
|
||||
return retCode;
|
||||
@Override
|
||||
public boolean updateContextGroup(ConnectionItem connItem, String selectedContext, String originalContext,
|
||||
boolean... isMigrationTask) {
|
||||
switchStrategy(connItem);
|
||||
return strategy.updateContextGroup(connItem, selectedContext, originalContext, isMigrationTask);
|
||||
|
||||
}
|
||||
|
||||
private boolean checkEmpty(String newSidOrDatabase, String oldSidOrDatabase) {
|
||||
if (isEmptyString(oldSidOrDatabase) && isEmptyString(newSidOrDatabase)) {
|
||||
return true;
|
||||
}
|
||||
return !isEmptyString(oldSidOrDatabase) && !isEmptyString(newSidOrDatabase);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* change context Group need to synchronization name of catalog or schema
|
||||
*
|
||||
* @param dbConn
|
||||
* @param oldContextName
|
||||
*/
|
||||
private void updateConnectionForSidOrUiSchema(DatabaseConnection dbConn, String oldContextName) {
|
||||
String selectedContext = dbConn.getContextName();
|
||||
ContextType newContextType = ConnectionContextHelper.getContextTypeForContextMode(dbConn, selectedContext, false);
|
||||
ContextType oldContextType = ConnectionContextHelper.getContextTypeForContextMode(dbConn, oldContextName, false);
|
||||
String newSidOrDatabase = ConnectionContextHelper.getOriginalValue(newContextType, dbConn.getSID());
|
||||
String newUiShema = ConnectionContextHelper.getOriginalValue(newContextType, dbConn.getUiSchema());
|
||||
String oldSidOrDatabase = ConnectionContextHelper.getOriginalValue(oldContextType, dbConn.getSID());
|
||||
String oldUiShema = ConnectionContextHelper.getOriginalValue(oldContextType, dbConn.getUiSchema());
|
||||
if (!isEmptyString(newSidOrDatabase) && !isEmptyString(oldSidOrDatabase)) {// for example mysql or mssql
|
||||
Catalog catalog = CatalogHelper.getCatalog(dbConn, oldSidOrDatabase);
|
||||
if (catalog != null) {
|
||||
catalog.setName(newSidOrDatabase);
|
||||
|
||||
Schema schema = SchemaHelper.getSchemaByName(CatalogHelper.getSchemas(catalog), oldUiShema);// for
|
||||
// example
|
||||
// mssql
|
||||
if (schema != null) {
|
||||
schema.setName(newUiShema);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isEmptyString(newUiShema) && !isEmptyString(oldUiShema)) {// for example oracle
|
||||
Schema schema = SchemaHelper.getSchema(dbConn, oldUiShema);
|
||||
if (schema != null) {
|
||||
schema.setName(newUiShema);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* check whether str is null or length is zero
|
||||
*
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
private boolean isEmptyString(final String str) {
|
||||
return str == null || str.length() == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* change the URL according to selected context Added yyin 20120918 TDQ-5668
|
||||
*
|
||||
* @param connItem
|
||||
* @param con
|
||||
* @param selectedContext
|
||||
*/
|
||||
private String getChangedURL(DatabaseConnection dbConn, String selectedContext) {
|
||||
ContextType contextType = ConnectionContextHelper.getContextTypeForContextMode(dbConn, selectedContext, false);
|
||||
String url = dbConn.getURL();
|
||||
if(url != null){
|
||||
return url;
|
||||
}
|
||||
String server = ConnectionContextHelper.getOriginalValue(contextType, dbConn.getServerName());
|
||||
String username = ConnectionContextHelper.getOriginalValue(contextType, dbConn.getUsername());
|
||||
String password = ConnectionContextHelper.getOriginalValue(contextType, dbConn.getRawPassword());
|
||||
String port = ConnectionContextHelper.getOriginalValue(contextType, dbConn.getPort());
|
||||
String sidOrDatabase = ConnectionContextHelper.getOriginalValue(contextType, dbConn.getSID());
|
||||
String datasource = ConnectionContextHelper.getOriginalValue(contextType, dbConn.getDatasourceName());
|
||||
String filePath = ConnectionContextHelper.getOriginalValue(contextType, dbConn.getFileFieldName());
|
||||
String dbRootPath = ConnectionContextHelper.getOriginalValue(contextType, dbConn.getDBRootPath());
|
||||
String additionParam = ConnectionContextHelper.getOriginalValue(contextType, dbConn.getAdditionalParams());
|
||||
|
||||
return DatabaseConnStrUtil.getURLString(dbConn.getDatabaseType(), dbConn.getDbVersionString(), server, username,
|
||||
password, port, sidOrDatabase, filePath.toLowerCase(), datasource, dbRootPath, additionParam);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
@@ -275,49 +101,6 @@ public class SwitchContextGroupNameImpl implements ISwitchContext {
|
||||
*/
|
||||
@Override
|
||||
public boolean updateContextForConnectionItems(Map<String, String> contextGroupRanamedMap, ContextItem contextItem) {
|
||||
if (contextItem == null) {
|
||||
return false;
|
||||
}
|
||||
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
|
||||
try {
|
||||
List<IRepositoryViewObject> allConnectionItem = factory.getAll(ProjectManager.getInstance().getCurrentProject(),
|
||||
ERepositoryObjectType.METADATA_CONNECTIONS);
|
||||
|
||||
for (IRepositoryViewObject connectionItem : allConnectionItem) {
|
||||
Item item = connectionItem.getProperty().getItem();
|
||||
if (item instanceof ConnectionItem && ConnectionContextHelper.checkContextMode((ConnectionItem) item) != null) {
|
||||
Connection con = ((ConnectionItem) item).getConnection();
|
||||
String contextId = con.getContextId();
|
||||
if (contextId != null && contextId.equals(contextItem.getProperty().getId())) {
|
||||
String oldContextGroup = con.getContextName();
|
||||
boolean modified = false;
|
||||
if (oldContextGroup != null && !"".equals(oldContextGroup)) { //$NON-NLS-1$
|
||||
String newContextGroup = contextGroupRanamedMap.get(oldContextGroup);
|
||||
if (newContextGroup != null) { // rename
|
||||
con.setContextName(newContextGroup);
|
||||
modified = true;
|
||||
}
|
||||
} else { // if not set, set default group
|
||||
ContextItem originalItem = ContextUtils.getContextItemById2(contextId);
|
||||
con.setContextName(originalItem.getDefaultContext());
|
||||
modified = true;
|
||||
}
|
||||
if (modified) {
|
||||
factory.save(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IHadoopClusterService hadoopClusterService = HadoopRepositoryUtil.getHadoopClusterService();
|
||||
if (hadoopClusterService != null) {
|
||||
hadoopClusterService.updateConfJarsByContextGroup(contextItem, contextGroupRanamedMap);
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return false;
|
||||
return strategy.updateContextForConnectionItems(contextGroupRanamedMap, contextItem);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ Export-Package: metadata.managment.i18n,
|
||||
org.talend.core.model.metadata.builder.database,
|
||||
org.talend.core.model.metadata.builder.database.dburl,
|
||||
org.talend.core.model.metadata.builder.database.extractots,
|
||||
org.talend.core.model.metadata.builder.database.jdbc,
|
||||
org.talend.core.model.metadata.builder.database.manager,
|
||||
org.talend.core.model.metadata.builder.database.manager.dbs,
|
||||
org.talend.metadata.managment,
|
||||
@@ -33,6 +34,7 @@ Export-Package: metadata.managment.i18n,
|
||||
org.talend.metadata.managment.mdm,
|
||||
org.talend.metadata.managment.model,
|
||||
org.talend.metadata.managment.repository,
|
||||
org.talend.metadata.managment.ui.convert,
|
||||
org.talend.metadata.managment.utils
|
||||
Bundle-ClassPath: .
|
||||
Bundle-Vendor: .Talend SA.
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<!-- Seems those 3 are not useful -->
|
||||
<classloader
|
||||
index="HIVE:HORTONWORKS:HDP_1_0:EMBEDDED"
|
||||
libraries="hive-hbase-handler-0.9.0.jar;hbase-0.92.0.jar;hadoop-core-1.0.3.jar;commons-logging-1.0.4.jar;datanucleus-api-jdo-3.0.7.jar;datanucleus-core-3.0.9.jar;datanucleus-rdbms-3.0.8.jar;hive-builtins-0.9.0.jar;hive-exec-0.9.0_hdp.jar;hive-jdbc-0.9.0_hdp.jar;hive-metastore-0.9.0_hdp.jar;hive-service-0.9.0_hdp.jar;libfb303-0.7.0.jar;libthrift-0.7.0.jar;commons-lang-2.4.jar;antlr-runtime-3.0.1.jar;commons-dbcp-1.4.jar;commons-pool-1.5.4.jar;derby-10.4.2.0.jar;commons-configuration-1.6.jar;jdo2-api-2.3-ec.jar;reload4j-1.2.19.jar;slf4j-api-1.6.1.jar;slf4j-log4j12-1.6.1.jar;jackson-core-asl-1.8.8.jar;jackson-mapper-asl-1.8.8.jar">
|
||||
libraries="hive-hbase-handler-0.9.0.jar;hbase-0.92.0.jar;hadoop-core-1.0.3.jar;commons-logging-1.0.4.jar;datanucleus-api-jdo-3.0.7.jar;datanucleus-core-3.0.9.jar;datanucleus-rdbms-3.0.8.jar;hive-builtins-0.9.0.jar;hive-exec-0.9.0_hdp.jar;hive-jdbc-0.9.0_hdp.jar;hive-metastore-0.9.0_hdp.jar;hive-service-0.9.0_hdp.jar;libfb303-0.7.0.jar;libthrift-0.7.0.jar;commons-lang-2.4.jar;antlr-runtime-3.0.1.jar;commons-dbcp-1.4.jar;commons-pool-1.5.4.jar;derby-10.4.2.0.jar;commons-configuration2-2.8.0.jar;jdo2-api-2.3-ec.jar;reload4j-1.2.19.jar;slf4j-api-1.6.1.jar;slf4j-log4j12-1.6.1.jar;jackson-core-asl-1.8.8.jar;jackson-mapper-asl-1.8.8.jar">
|
||||
</classloader>
|
||||
<classloader
|
||||
index="HIVE:AMAZON_EMR:MapR_EMR:STANDALONE"
|
||||
@@ -86,6 +86,14 @@
|
||||
name="ojdbc6.jar"
|
||||
required="true">
|
||||
</libraryNeeded>
|
||||
<libraryNeeded
|
||||
context="plugin:org.talend.libraries.jdbc.oracle"
|
||||
language="java"
|
||||
message="Needed for Oracle jdbc plugin National Language Support (NLS)."
|
||||
mvn_uri="mvn:com.oracle.database.nls/orai18n/19.3.0.0/jar"
|
||||
name="orai18n-19.3.0.0.jar"
|
||||
required="true">
|
||||
</libraryNeeded>
|
||||
<libraryNeeded
|
||||
context="plugin:org.talend.libraries.jdbc.as400"
|
||||
language="java"
|
||||
@@ -104,8 +112,8 @@
|
||||
context="PostgresPlus wizard"
|
||||
language="java"
|
||||
message="wizard for PostgresPlus"
|
||||
mvn_uri="mvn:org.postgresql/postgresql/42.2.25"
|
||||
name="postgresql-42.2.25.jar"
|
||||
mvn_uri="mvn:org.postgresql/postgresql/42.2.26"
|
||||
name="postgresql-42.2.26.jar"
|
||||
required="true">
|
||||
</libraryNeeded>
|
||||
<libraryNeeded
|
||||
|
||||
@@ -291,6 +291,7 @@ public class ExtractMetaDataFromDataBase {
|
||||
* DOC cantoine. Method to test DataBaseConnection.
|
||||
*
|
||||
* @param dbVersionString
|
||||
* @param supportNLS
|
||||
*
|
||||
* @param String driverClass
|
||||
* @param String urlString pwd
|
||||
@@ -299,14 +300,14 @@ public class ExtractMetaDataFromDataBase {
|
||||
* @return ConnectionStatus : the result of connection(boolean Result, String messageException)
|
||||
*/
|
||||
public static ConnectionStatus testConnection(String dbType, String url, String username, String pwd, String schema,
|
||||
final String driverClassName, final String driverJarPath, String dbVersionString, String additionalParam) {
|
||||
final String driverClassName, final String driverJarPath, String dbVersionString, String additionalParam, boolean supportNLS) {
|
||||
return testConnection(dbType, url, username, pwd, schema, driverClassName, driverJarPath, dbVersionString,
|
||||
additionalParam, null, null);
|
||||
additionalParam, supportNLS, null, null);
|
||||
}
|
||||
|
||||
public static ConnectionStatus testConnection(String dbType, String url, String username, String pwd, String schema,
|
||||
final String driverClassName, final String driverJarPath, String dbVersionString, String additionalParam,
|
||||
StringBuffer retProposedSchema, String sidOrDatabase) {
|
||||
boolean supportNLS, StringBuffer retProposedSchema, String sidOrDatabase) {
|
||||
Connection connection = null;
|
||||
ConnectionStatus connectionStatus = new ConnectionStatus();
|
||||
connectionStatus.setResult(false);
|
||||
@@ -315,7 +316,7 @@ public class ExtractMetaDataFromDataBase {
|
||||
List list = new ArrayList();
|
||||
|
||||
list = ExtractMetaDataUtils.getInstance().connect(dbType, url, username, pwd, driverClassName, driverJarPath,
|
||||
dbVersionString, additionalParam);
|
||||
dbVersionString, additionalParam, supportNLS);
|
||||
if (list != null && list.size() > 0) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (list.get(i) instanceof Connection) {
|
||||
@@ -498,7 +499,7 @@ public class ExtractMetaDataFromDataBase {
|
||||
List list = metaData.getConnection(iMetadataConnection.getDbType(), url, iMetadataConnection.getUsername(),
|
||||
iMetadataConnection.getPassword(), iMetadataConnection.getDatabase(), iMetadataConnection.getSchema(),
|
||||
iMetadataConnection.getDriverClass(), iMetadataConnection.getDriverJarPath(),
|
||||
iMetadataConnection.getDbVersionString(), iMetadataConnection.getAdditionalParams());
|
||||
iMetadataConnection.getDbVersionString(), iMetadataConnection.getAdditionalParams(), iMetadataConnection.isSupportNLS());
|
||||
Connection conn = null;
|
||||
DriverShim wapperDriver = null;
|
||||
|
||||
@@ -582,7 +583,7 @@ public class ExtractMetaDataFromDataBase {
|
||||
List list = extractMeta.getConnection(iMetadataConnection.getDbType(), iMetadataConnection.getUrl(),
|
||||
iMetadataConnection.getUsername(), iMetadataConnection.getPassword(), iMetadataConnection.getDatabase(),
|
||||
iMetadataConnection.getSchema(), iMetadataConnection.getDriverClass(), iMetadataConnection.getDriverJarPath(),
|
||||
iMetadataConnection.getDbVersionString(), iMetadataConnection.getAdditionalParams());
|
||||
iMetadataConnection.getDbVersionString(), iMetadataConnection.getAdditionalParams(), iMetadataConnection.isSupportNLS());
|
||||
DriverShim wapperDriver = null;
|
||||
if (list != null && list.size() > 0) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
|
||||
@@ -121,6 +121,8 @@ public class ExtractMetaDataUtils {
|
||||
|
||||
private String[] ORACLE_SSL_JARS = new String[] { "oraclepki-12.2.0.1.jar", "osdt_cert-12.2.0.1.jar", //$NON-NLS-1$//$NON-NLS-2$
|
||||
"osdt_core-12.2.0.1.jar" }; //$NON-NLS-1$
|
||||
|
||||
private String ORACLE_NLS_JARS = "orai18n-19.3.0.0.jar";
|
||||
|
||||
public static final String SNOWFLAKE = "Snowflake"; //$NON-NLS-1$
|
||||
|
||||
@@ -829,6 +831,11 @@ public class ExtractMetaDataUtils {
|
||||
*/
|
||||
public List getConnection(String dbType, String url, String username, String pwd, String dataBase, String schemaBase,
|
||||
final String driverClassName, final String driverJarPath, String dbVersion, String additionalParams) {
|
||||
return getConnection(dbType, url, username, pwd, dataBase, schemaBase, driverClassName, driverJarPath, dbVersion, additionalParams, false);
|
||||
}
|
||||
|
||||
public List getConnection(String dbType, String url, String username, String pwd, String dataBase, String schemaBase,
|
||||
final String driverClassName, final String driverJarPath, String dbVersion, String additionalParams, boolean supportNLS) {
|
||||
boolean isColsed = false;
|
||||
List conList = new ArrayList();
|
||||
try {
|
||||
@@ -846,7 +853,7 @@ public class ExtractMetaDataUtils {
|
||||
closeConnection(true); // colse before connection.
|
||||
checkDBConnectionTimeout();
|
||||
|
||||
list = connect(dbType, url, username, pwd, driverClassName, driverJarPath, dbVersion, additionalParams);
|
||||
list = connect(dbType, url, username, pwd, driverClassName, driverJarPath, dbVersion, additionalParams, supportNLS);
|
||||
if (list != null && list.size() > 0) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (list.get(i) instanceof Connection) {
|
||||
@@ -938,7 +945,7 @@ public class ExtractMetaDataUtils {
|
||||
* @throws Exception
|
||||
*/
|
||||
public List connect(String dbType, String url, String username, String pwd, final String driverClassNameArg,
|
||||
final String driverJarPathArg, String dbVersion, String additionalParams) throws Exception {
|
||||
final String driverJarPathArg, String dbVersion, String additionalParams, boolean supportNLS) throws Exception {
|
||||
Connection connection = null;
|
||||
DriverShim wapperDriver = null;
|
||||
List conList = new ArrayList();
|
||||
@@ -953,11 +960,18 @@ public class ExtractMetaDataUtils {
|
||||
if ((driverJarPathArg == null || driverJarPathArg.equals(""))) { //$NON-NLS-1$
|
||||
List<String> driverNames = EDatabaseVersion4Drivers.getDrivers(dbType, dbVersion);
|
||||
if (driverNames != null) {
|
||||
if(EDatabaseTypeName.ORACLEFORSID.getProduct().equals(EDatabaseTypeName.getTypeFromDbType(dbType).getProduct())) {
|
||||
if(supportNLS){
|
||||
driverNames.add(ORACLE_NLS_JARS);
|
||||
}
|
||||
}
|
||||
|
||||
if (EDatabaseTypeName.ORACLE_CUSTOM.getDisplayName().equals(dbType)
|
||||
&& StringUtils.isNotEmpty(additionalParams)) {
|
||||
if (additionalParams.contains(SSLPreferenceConstants.TRUSTSTORE_TYPE)) {
|
||||
driverNames.addAll(Arrays.asList(ORACLE_SSL_JARS));
|
||||
}
|
||||
|
||||
} else if (SNOWFLAKE.equals(dbType)) { // $NON-NLS-1$
|
||||
// TDQ-17294 msjian Support of Snowflake for DQ Datamart
|
||||
driverNames.add(SNOWFLAKE_DRIVER_JAR);
|
||||
@@ -1281,7 +1295,7 @@ public class ExtractMetaDataUtils {
|
||||
List list = getConnection(metadataConnection.getDbType(), metadataConnection.getUrl(), metadataConnection.getUsername(),
|
||||
metadataConnection.getPassword(), metadataConnection.getDatabase(), metadataConnection.getSchema(),
|
||||
metadataConnection.getDriverClass(), metadataConnection.getDriverJarPath(),
|
||||
metadataConnection.getDbVersionString(), metadataConnection.getAdditionalParams());
|
||||
metadataConnection.getDbVersionString(), metadataConnection.getAdditionalParams(), metadataConnection.isSupportNLS());
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// 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.model.metadata.builder.database.jdbc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.talend.core.database.conn.DatabaseConnStrUtil;
|
||||
|
||||
public abstract class AbstractUrlDbNameExtractor implements IUrlDbNameExtractor {
|
||||
|
||||
private String url;
|
||||
|
||||
private String driverName;
|
||||
|
||||
private String version;
|
||||
|
||||
private String sid;
|
||||
|
||||
private String uiSchema;
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public String getSid() {
|
||||
return sid;
|
||||
}
|
||||
|
||||
public void setSid(String sid) {
|
||||
this.sid = sid;
|
||||
}
|
||||
|
||||
public String getUiSchema() {
|
||||
return uiSchema;
|
||||
}
|
||||
|
||||
public void setUiSchema(String uiSchema) {
|
||||
this.uiSchema = uiSchema;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the driverName.
|
||||
*
|
||||
* @param driverName the driverName to set
|
||||
*/
|
||||
public void setDriverName(String driverName) {
|
||||
this.driverName = driverName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for driverName.
|
||||
*
|
||||
* @return the driverName
|
||||
*/
|
||||
public String getDriverName() {
|
||||
return driverName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initUiSchemaOrSID() {
|
||||
String[] analyseURL = DatabaseConnStrUtil.analyseURL(getCurrentDbType(), getDbVersion(), url);
|
||||
if (analyseURL == null) {
|
||||
return;
|
||||
}
|
||||
analyseResult(analyseURL);
|
||||
}
|
||||
|
||||
protected abstract void analyseResult(String[] analyseURL);
|
||||
|
||||
@Override
|
||||
public List<String> getExtractResult() {
|
||||
List<String> result = new ArrayList<>();
|
||||
result.add(sid);
|
||||
result.add(uiSchema);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCatalog() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSchema() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasBothSturctor() {
|
||||
return hasCatalog() && hasSchema();
|
||||
}
|
||||
|
||||
protected abstract String getDbVersion();
|
||||
|
||||
protected abstract String getCurrentDbType();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// 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.model.metadata.builder.database.jdbc;
|
||||
|
||||
import org.talend.core.database.EDatabaseTypeName;
|
||||
|
||||
public enum EDBTypeProductNameMapping {
|
||||
|
||||
/**
|
||||
* mappingID reference from the id attribute of mapping file on the org.talend.core
|
||||
* ProductName.toUppercase reference EDatabaseTypeName.project and produce of mapping file
|
||||
*/
|
||||
// Mysql(EDatabaseTypeName.MYSQL, "Mysql", "mysql_id"),
|
||||
Snowflake(EDatabaseTypeName.SNOWFLAKE, "Snowflake", "snowflake_id");
|
||||
|
||||
EDatabaseTypeName type;
|
||||
|
||||
String productName;
|
||||
|
||||
String mappingID;
|
||||
|
||||
EDBTypeProductNameMapping(EDatabaseTypeName type, String productName, String mappingID) {
|
||||
this.type = type;
|
||||
this.productName = productName;
|
||||
this.mappingID = mappingID;
|
||||
}
|
||||
|
||||
public static EDBTypeProductNameMapping findTypeByProductName(String productName) {
|
||||
if (productName == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (EDBTypeProductNameMapping type : EDBTypeProductNameMapping.values()) {
|
||||
if (type.productName.equalsIgnoreCase(productName)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static EDBTypeProductNameMapping findTypeByMappingID(String mappingID) {
|
||||
if (mappingID == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (EDBTypeProductNameMapping type : EDBTypeProductNameMapping.values()) {
|
||||
if (type.mappingID.equalsIgnoreCase(mappingID)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// 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.model.metadata.builder.database.jdbc;
|
||||
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.talend.core.database.EDatabaseTypeName;
|
||||
import org.talend.core.model.metadata.IMetadataConnection;
|
||||
import org.talend.core.model.metadata.builder.ConvertionHelper;
|
||||
import org.talend.core.model.metadata.builder.connection.DatabaseConnection;
|
||||
import org.talend.core.model.properties.ConnectionItem;
|
||||
import org.talend.core.model.properties.DatabaseConnectionItem;
|
||||
import org.talend.cwm.helper.TaggedValueHelper;
|
||||
|
||||
public class ExtractorFactory {
|
||||
|
||||
public static IUrlDbNameExtractor getExtractorInstance(DatabaseMetaData dbMetadata,
|
||||
IMetadataConnection metadataConnection) {
|
||||
if (dbMetadata == null) {
|
||||
return null;
|
||||
}
|
||||
if (!checkIsGenericJDBCType(metadataConnection)) {
|
||||
return null;
|
||||
}
|
||||
IUrlDbNameExtractor theExtractor = null;
|
||||
String databaseProductName = null;
|
||||
try {
|
||||
databaseProductName = dbMetadata.getDatabaseProductName();
|
||||
theExtractor = createExtractorByDP(databaseProductName);
|
||||
initExtractor(theExtractor, dbMetadata, metadataConnection);
|
||||
return theExtractor;
|
||||
} catch (SQLException e) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static IUrlDbNameExtractor getExtractorInstance(ConnectionItem connItem, String selectedContext,
|
||||
String originalContext) {
|
||||
if (connItem == null) {
|
||||
return null;
|
||||
}
|
||||
DatabaseConnection dbConn=null;
|
||||
if(connItem instanceof DatabaseConnectionItem) {
|
||||
dbConn=(DatabaseConnection)connItem.getConnection();
|
||||
}
|
||||
|
||||
return getExtractorInstance(dbConn, selectedContext, originalContext);
|
||||
}
|
||||
|
||||
public static IUrlDbNameExtractor getExtractorInstance(DatabaseConnection dbconn, String selectedContext,
|
||||
String originalContext) {
|
||||
if (dbconn == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!checkIsGenericJDBCType(dbconn)) {
|
||||
return null;
|
||||
}
|
||||
IUrlDbNameExtractor theExtractor = null;
|
||||
String databaseProductName = TaggedValueHelper.getValueString(TaggedValueHelper.DB_PRODUCT_NAME, dbconn);
|
||||
theExtractor = createExtractorByDP(databaseProductName);
|
||||
IMetadataConnection metadataConnection = ConvertionHelper.convert(dbconn, false, selectedContext);
|
||||
initExtractor(theExtractor, metadataConnection);
|
||||
return theExtractor;
|
||||
}
|
||||
|
||||
private static boolean checkIsGenericJDBCType(DatabaseConnection dbConn) {
|
||||
if (dbConn == null) {
|
||||
return false;
|
||||
}
|
||||
return EDatabaseTypeName.GENERAL_JDBC.getXMLType().equals(dbConn.getDatabaseType());
|
||||
}
|
||||
|
||||
private static boolean checkIsGenericJDBCType(IMetadataConnection metadataConnection) {
|
||||
if (metadataConnection == null) {
|
||||
return false;
|
||||
}
|
||||
return EDatabaseTypeName.GENERAL_JDBC.getXMLType().equals(metadataConnection.getDbType());
|
||||
}
|
||||
|
||||
protected static void initExtractor(IUrlDbNameExtractor theExtractor, DatabaseMetaData dbMetadata,
|
||||
IMetadataConnection metadataConnection) {
|
||||
if (theExtractor != null) {
|
||||
initURL(theExtractor, dbMetadata, metadataConnection);
|
||||
initDriverName(theExtractor, dbMetadata, metadataConnection);
|
||||
initVersion(theExtractor, dbMetadata, metadataConnection);
|
||||
}
|
||||
}
|
||||
|
||||
protected static void initExtractor(IUrlDbNameExtractor theExtractor, IMetadataConnection metadataConnection) {
|
||||
if (theExtractor != null) {
|
||||
theExtractor.setUrl(metadataConnection.getUrl());
|
||||
theExtractor.setDriverName(metadataConnection.getDriverJarPath());
|
||||
theExtractor.setVersion(metadataConnection.getDbVersionString());
|
||||
}
|
||||
}
|
||||
|
||||
private static void initVersion(IUrlDbNameExtractor theExtractor, DatabaseMetaData dbMetadata,
|
||||
IMetadataConnection metadataConnection) {
|
||||
try {
|
||||
theExtractor.setVersion(dbMetadata.getDatabaseProductVersion());
|
||||
} catch (SQLException e) {
|
||||
}
|
||||
if (metadataConnection != null && theExtractor.getVersion() == null) {
|
||||
theExtractor.setVersion(metadataConnection.getDbVersionString());
|
||||
}
|
||||
}
|
||||
|
||||
private static void initDriverName(IUrlDbNameExtractor theExtractor, DatabaseMetaData dbMetadata,
|
||||
IMetadataConnection metadataConnection) {
|
||||
try {
|
||||
theExtractor.setDriverName(dbMetadata.getDriverName());
|
||||
} catch (SQLException e) {
|
||||
}
|
||||
if (metadataConnection != null
|
||||
&& (theExtractor.getDriverName() == null || !theExtractor.getDriverName().contains(".jar"))) {
|
||||
theExtractor.setDriverName(metadataConnection.getDriverJarPath());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected static void initURL(IUrlDbNameExtractor theExtractor, DatabaseMetaData dbMetadata,
|
||||
IMetadataConnection metadataConnection) {
|
||||
try {
|
||||
theExtractor.setUrl(dbMetadata.getURL());
|
||||
} catch (SQLException e) {
|
||||
}
|
||||
if (metadataConnection != null
|
||||
&& (theExtractor.getUrl() == null || metadataConnection.getUrl().contains(theExtractor.getUrl()))) {
|
||||
theExtractor.setUrl(metadataConnection.getUrl());
|
||||
}
|
||||
}
|
||||
|
||||
private static IUrlDbNameExtractor createExtractorByDP(String databaseProductName) {
|
||||
if (databaseProductName == null) {
|
||||
return null;
|
||||
}
|
||||
EDBTypeProductNameMapping dbType = EDBTypeProductNameMapping.findTypeByProductName(databaseProductName);
|
||||
return createExtractor(dbType);
|
||||
}
|
||||
|
||||
private static IUrlDbNameExtractor createExtractor(EDBTypeProductNameMapping dbType) {
|
||||
if (dbType == null) {
|
||||
return null;
|
||||
}
|
||||
switch (dbType) {
|
||||
// case Mysql:
|
||||
// return new MysqlExtractor();
|
||||
case Snowflake:
|
||||
return new SnowflakeExtractor();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isSupportDB(EDBTypeProductNameMapping dbType) {
|
||||
return createExtractor(dbType) != null;
|
||||
}
|
||||
|
||||
private static IUrlDbNameExtractor createExtractorByMappingID(IMetadataConnection metadataConnection) {
|
||||
if (metadataConnection == null) {
|
||||
return null;
|
||||
}
|
||||
String mappingID = metadataConnection.getMapping();
|
||||
if (mappingID == null) {
|
||||
return null;
|
||||
}
|
||||
EDBTypeProductNameMapping dbType = EDBTypeProductNameMapping.findTypeByMappingID(mappingID);
|
||||
return createExtractor(dbType);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// 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.model.metadata.builder.database.jdbc;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IUrlDbNameExtractor {
|
||||
|
||||
void setUrl(String url);
|
||||
|
||||
String getUrl();
|
||||
|
||||
void initUiSchemaOrSID();
|
||||
|
||||
void setDriverName(String driverName);
|
||||
|
||||
String getDriverName();
|
||||
|
||||
void setVersion(String version);
|
||||
|
||||
String getVersion();
|
||||
|
||||
/**
|
||||
* Return the result of url extract
|
||||
* 0 is sid null mean that can not found it
|
||||
* 1 is uiSchema null mean that can not found it
|
||||
*/
|
||||
List<String> getExtractResult();
|
||||
|
||||
boolean hasCatalog();
|
||||
|
||||
boolean hasSchema();
|
||||
|
||||
boolean hasBothSturctor();
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// 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.model.metadata.builder.database.jdbc;
|
||||
|
||||
import org.talend.core.database.EDatabaseTypeName;
|
||||
import org.talend.core.database.conn.version.EDatabaseVersion4Drivers;
|
||||
|
||||
public class MysqlExtractor extends AbstractUrlDbNameExtractor {
|
||||
|
||||
@Override
|
||||
protected String getDbVersion() {
|
||||
return EDatabaseVersion4Drivers.getDbVersionName(EDatabaseTypeName.MYSQL, getDriverName());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getCurrentDbType() {
|
||||
return EDatabaseTypeName.MYSQL.getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void analyseResult(String[] analyseURL) {
|
||||
// need to be implement later
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCatalog() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// 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.model.metadata.builder.database.jdbc;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.talend.core.database.EDatabaseTypeName;
|
||||
import org.talend.core.database.conn.DatabaseConnConstants;
|
||||
import org.talend.core.database.conn.version.EDatabaseVersion4Drivers;
|
||||
|
||||
public class SnowflakeExtractor extends AbstractUrlDbNameExtractor {
|
||||
|
||||
@Override
|
||||
protected String getDbVersion() {
|
||||
if (this.getVersion() != null) {
|
||||
return this.getVersion();
|
||||
}
|
||||
return EDatabaseVersion4Drivers.getDbVersionName(EDatabaseTypeName.SNOWFLAKE, getDriverName());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getCurrentDbType() {
|
||||
return EDatabaseTypeName.SNOWFLAKE.getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void analyseResult(String[] analyseURL) {
|
||||
if (analyseURL.length >= 5) {
|
||||
String line = analyseURL[3];
|
||||
String patternSid = "(.*)db=" + DatabaseConnConstants.PATTERN_SID + "(.*)";
|
||||
String patternUiSchema = "(.*)schema=" + DatabaseConnConstants.PATTERN_SID + "(.*)";
|
||||
|
||||
// create Pattern
|
||||
Pattern sidResult = Pattern.compile(patternSid);
|
||||
Pattern uischemaResult = Pattern.compile(patternUiSchema);
|
||||
|
||||
// create matcher
|
||||
Matcher mSid = sidResult.matcher(line);
|
||||
Matcher mUiSchema = uischemaResult.matcher(line);
|
||||
if (mSid.find()) {
|
||||
this.setSid(mSid.group(2));
|
||||
}
|
||||
if (mUiSchema.find()) {
|
||||
// set ui schema
|
||||
this.setUiSchema(mUiSchema.group(2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCatalog() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSchema() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -470,7 +470,7 @@ public class ExtractManager {
|
||||
metadataConnection.getUsername(), metadataConnection.getPassword(), metadataConnection.getDatabase(),
|
||||
metadataConnection.getSchema(), metadataConnection.getDriverClass(),
|
||||
metadataConnection.getDriverJarPath(), metadataConnection.getDbVersionString(),
|
||||
metadataConnection.getAdditionalParams());
|
||||
metadataConnection.getAdditionalParams(), metadataConnection.isSupportNLS());
|
||||
if (list != null && list.size() > 0) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (list.get(i) instanceof Driver) {
|
||||
@@ -574,7 +574,7 @@ public class ExtractManager {
|
||||
metadataConnection.getUsername(), metadataConnection.getPassword(), metadataConnection.getDatabase(),
|
||||
metadataConnection.getSchema(), metadataConnection.getDriverClass(),
|
||||
metadataConnection.getDriverJarPath(), metadataConnection.getDbVersionString(),
|
||||
metadataConnection.getAdditionalParams());
|
||||
metadataConnection.getAdditionalParams(), metadataConnection.isSupportNLS());
|
||||
if (list != null && list.size() > 0) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (list.get(i) instanceof DriverShim) {
|
||||
@@ -1064,7 +1064,7 @@ public class ExtractManager {
|
||||
List connList = extractMeta.getConnection(metadataConnection.getDbType(), metadataConnection.getUrl(),
|
||||
metadataConnection.getUsername(), metadataConnection.getPassword(), metadataConnection.getDatabase(),
|
||||
metadataConnection.getSchema(), metadataConnection.getDriverClass(), metadataConnection.getDriverJarPath(),
|
||||
metadataConnection.getDbVersionString(), metadataConnection.getAdditionalParams());
|
||||
metadataConnection.getDbVersionString(), metadataConnection.getAdditionalParams(), metadataConnection.isSupportNLS());
|
||||
try {
|
||||
if (!tableInfoParameters.isUsedName()) {
|
||||
if (tableInfoParameters.getSqlFiter() != null && !"".equals(tableInfoParameters.getSqlFiter())) { //$NON-NLS-1$
|
||||
|
||||
@@ -90,6 +90,8 @@ public class ManagerConnection {
|
||||
Integer id = null;
|
||||
|
||||
String additionalParams;
|
||||
|
||||
private boolean supportNLS;
|
||||
|
||||
private String schemaOracle;
|
||||
|
||||
@@ -289,7 +291,7 @@ public class ManagerConnection {
|
||||
|
||||
// test the connection
|
||||
testConnection = ExtractMetaDataFromDataBase.testConnection(dbTypeString, urlConnectionString, username, password,
|
||||
schemaName, driverClassName, driverJarPath, dbVersionString, additionalParams, retProposedSchema,
|
||||
schemaName, driverClassName, driverJarPath, dbVersionString, additionalParams, supportNLS, retProposedSchema,
|
||||
sidOrDatabase);
|
||||
isValide = testConnection.getResult();
|
||||
messageException = testConnection.getMessageException();
|
||||
@@ -389,7 +391,7 @@ public class ManagerConnection {
|
||||
metadataConnection.getUrl(), metadataConnection.getUsername(), metadataConnection.getPassword(),
|
||||
metadataConnection.getSchema(), metadataConnection.getDriverClass(),
|
||||
metadataConnection.getDriverJarPath(), metadataConnection.getDbVersionString(),
|
||||
metadataConnection.getAdditionalParams(), retProposedSchema, metadataConnection.getDatabase());
|
||||
metadataConnection.getAdditionalParams(), metadataConnection.isSupportNLS(), retProposedSchema, metadataConnection.getDatabase());
|
||||
}
|
||||
// qli
|
||||
// record this metadataConnection as old connection.
|
||||
@@ -480,4 +482,13 @@ public class ManagerConnection {
|
||||
this.isValide = isValide;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the supportNLS.
|
||||
* @param supportNLS the supportNLS to set
|
||||
*/
|
||||
public void setSupportNLS(boolean supportNLS) {
|
||||
this.supportNLS = supportNLS;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// 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.metadata.managment.ui.convert;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.talend.core.model.metadata.builder.connection.DatabaseConnection;
|
||||
import org.talend.cwm.helper.CatalogHelper;
|
||||
import org.talend.cwm.helper.TaggedValueHelper;
|
||||
|
||||
import orgomg.cwm.foundation.softwaredeployment.DataManager;
|
||||
import orgomg.cwm.resource.relational.Catalog;
|
||||
|
||||
public class CatalogAdapter {
|
||||
|
||||
Catalog originalCat;
|
||||
|
||||
public CatalogAdapter(Catalog cat) {
|
||||
originalCat = cat;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
if (originalCat == null) {
|
||||
return null;
|
||||
}
|
||||
String catalogName = originalCat.getName();
|
||||
EList<DataManager> dataManagerList = originalCat.getDataManager();
|
||||
if (StringUtils.isEmpty(catalogName) || dataManagerList == null || dataManagerList.isEmpty()) {
|
||||
return catalogName;
|
||||
}
|
||||
DataManager dataManager = dataManagerList.get(0);
|
||||
if (dataManager instanceof DatabaseConnection) {
|
||||
DatabaseConnection parentConnection = (DatabaseConnection) dataManager;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
return catalogName;
|
||||
}
|
||||
|
||||
public Catalog getCatalog() {
|
||||
if (originalCat == null) {
|
||||
return null;
|
||||
}
|
||||
String catalogName = originalCat.getName();
|
||||
if (StringUtils.isEmpty(catalogName)) {
|
||||
return originalCat;
|
||||
}
|
||||
DataManager dataManager = originalCat.getDataManager().get(0);
|
||||
if (dataManager instanceof DatabaseConnection) {
|
||||
DatabaseConnection parentConnection = (DatabaseConnection) dataManager;
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
return originalCat;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// 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.metadata.managment.ui.convert;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.talend.core.database.EDatabaseTypeName;
|
||||
import org.talend.core.model.context.ContextUtils;
|
||||
import org.talend.core.model.metadata.builder.connection.DatabaseConnection;
|
||||
import org.talend.core.model.metadata.builder.database.jdbc.EDBTypeProductNameMapping;
|
||||
import org.talend.core.model.metadata.builder.database.jdbc.ExtractorFactory;
|
||||
import org.talend.core.model.properties.ContextItem;
|
||||
import org.talend.cwm.helper.TaggedValueHelper;
|
||||
import org.talend.metadata.managment.utils.MetadataConnectionUtils;
|
||||
import org.talend.utils.sugars.TypedReturnCode;
|
||||
|
||||
public class DbConnectionAdapter {
|
||||
|
||||
private DatabaseConnection originalDB = null;
|
||||
|
||||
|
||||
public DbConnectionAdapter(DatabaseConnection originalDB) {
|
||||
this.originalDB = originalDB;
|
||||
}
|
||||
|
||||
|
||||
public String getSID(String defaultCatalog) {
|
||||
if (originalDB == null) {
|
||||
return null;
|
||||
}
|
||||
return extractedTargetValue(TaggedValueHelper.ORIGINAL_SID, TaggedValueHelper.TARGET_SID,
|
||||
defaultCatalog);
|
||||
}
|
||||
|
||||
public String getUISchema(String defaultSchema) {
|
||||
if (originalDB == null) {
|
||||
return null;
|
||||
}
|
||||
return extractedTargetValue(TaggedValueHelper.ORIGINAL_UISCHEMA, TaggedValueHelper.TARGET_UISCHEMA,
|
||||
defaultSchema);
|
||||
}
|
||||
|
||||
|
||||
private String extractedTargetValue(String originalTagName, String TargetTagName, String currentValue) {
|
||||
if (isSwitchWithTaggedValueMode()) {
|
||||
String taggedOriginalValue = TaggedValueHelper.getValueString(originalTagName, originalDB);
|
||||
String taggedTargetValue = TaggedValueHelper.getValueString(TargetTagName, originalDB);
|
||||
if (currentValue.equals(taggedOriginalValue)) {
|
||||
return taggedTargetValue;
|
||||
}
|
||||
}
|
||||
return currentValue;
|
||||
}
|
||||
|
||||
public boolean isSwitchWithTaggedValueMode() {
|
||||
String databaseType = originalDB.getDatabaseType();
|
||||
String taggedOriginalSID = TaggedValueHelper.getValueString(TaggedValueHelper.ORIGINAL_SID, originalDB);
|
||||
if (EDatabaseTypeName.GENERAL_JDBC.getXMLType().equals(databaseType) && originalDB.isContextMode()
|
||||
&& !StringUtils.isEmpty(taggedOriginalSID)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean needTobeMigration() {
|
||||
if (originalDB == null) {
|
||||
return false;
|
||||
}
|
||||
if (!originalDB.isContextMode()) {
|
||||
return false;
|
||||
}
|
||||
String contextId = originalDB.getContextId();
|
||||
ContextItem contextItem = ContextUtils.getContextItemById2(contextId);
|
||||
String databaseType = originalDB.getDatabaseType();
|
||||
String databaseProductName = getDPName();
|
||||
|
||||
String taggedOriginalSID = TaggedValueHelper.getValueString(TaggedValueHelper.ORIGINAL_SID, originalDB);
|
||||
// context
|
||||
// 1:group >1
|
||||
// 2:JDBC connection
|
||||
// 3:tagged value is not exist
|
||||
// 4:has been supported
|
||||
if (contextItem.getContext().size() > 1 && EDatabaseTypeName.GENERAL_JDBC.getXMLType().equals(databaseType)
|
||||
&& StringUtils.isEmpty(taggedOriginalSID)
|
||||
&& ExtractorFactory.isSupportDB(EDBTypeProductNameMapping.findTypeByProductName(databaseProductName))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private String getDPName() {
|
||||
String dpName = TaggedValueHelper.getValueString(TaggedValueHelper.DB_PRODUCT_NAME, originalDB);
|
||||
if (!StringUtils.isEmpty(dpName)) {
|
||||
return dpName;
|
||||
}
|
||||
TypedReturnCode<Connection> checkConnection = MetadataConnectionUtils.createConnection(originalDB);
|
||||
if (checkConnection.isOk()) {
|
||||
try (Connection sqlConn = checkConnection.getObject()) {
|
||||
DatabaseMetaData sqlMetaData = sqlConn.getMetaData();
|
||||
return sqlMetaData.getDatabaseProductName();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// 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.metadata.managment.ui.convert;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.talend.core.model.metadata.builder.connection.DatabaseConnection;
|
||||
import org.talend.cwm.helper.CatalogHelper;
|
||||
import org.talend.cwm.helper.SchemaHelper;
|
||||
import org.talend.cwm.helper.TaggedValueHelper;
|
||||
|
||||
import orgomg.cwm.foundation.softwaredeployment.DataManager;
|
||||
import orgomg.cwm.resource.relational.Catalog;
|
||||
import orgomg.cwm.resource.relational.Schema;
|
||||
|
||||
public class SchemaAdapter {
|
||||
|
||||
Schema originalSch;
|
||||
|
||||
public SchemaAdapter(Schema sch) {
|
||||
originalSch = sch;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
if (originalSch == null) {
|
||||
return null;
|
||||
}
|
||||
String schemaName = originalSch.getName();
|
||||
if (StringUtils.isEmpty(schemaName)) {
|
||||
return schemaName;
|
||||
}
|
||||
DataManager dataManager = findConnection(originalSch);
|
||||
if (dataManager != null && 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)) {
|
||||
return targetUISchema;
|
||||
}
|
||||
}
|
||||
}
|
||||
return schemaName;
|
||||
}
|
||||
|
||||
protected static DataManager findConnection(Schema originalSch) {
|
||||
Catalog originalParentCatalog = CatalogHelper.getParentCatalog(originalSch);
|
||||
|
||||
EList<DataManager> dataManagerList = null;
|
||||
|
||||
if (originalParentCatalog != null) {
|
||||
// has catalog case
|
||||
dataManagerList = originalParentCatalog.getDataManager();
|
||||
} else {
|
||||
dataManagerList = originalSch.getDataManager();
|
||||
}
|
||||
if (dataManagerList == null || dataManagerList.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
return dataManagerList.get(0);
|
||||
}
|
||||
|
||||
public Schema getSchema() {
|
||||
if (originalSch == null) {
|
||||
return null;
|
||||
}
|
||||
String schemaName = originalSch.getName();
|
||||
if (StringUtils.isEmpty(schemaName)) {
|
||||
return originalSch;
|
||||
}
|
||||
Catalog originalParentCatalog = CatalogHelper.getParentCatalog(originalSch);
|
||||
Catalog newParentCatalog = null;
|
||||
DataManager dataManager = null;
|
||||
if (originalParentCatalog != null) {
|
||||
// has catalog case
|
||||
newParentCatalog = new CatalogAdapter(originalParentCatalog).getCatalog();
|
||||
dataManager = originalParentCatalog.getDataManager().get(0);
|
||||
|
||||
}else {
|
||||
// no catalog case
|
||||
dataManager = originalSch.getDataManager().get(0);
|
||||
}
|
||||
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
|
||||
if (originalParentCatalog != null) {
|
||||
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
|
||||
if (originalParentCatalog != null) {
|
||||
return SchemaHelper.getSchemaByName(CatalogHelper.getSchemas(newParentCatalog), schemaName);
|
||||
}else {
|
||||
return SchemaHelper.getSchema(parentConnection, schemaName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return originalSch;
|
||||
}
|
||||
|
||||
public static List<Schema> findSchemas(List<Schema> inputSchemas) {
|
||||
if(inputSchemas==null||inputSchemas.size()==0) {
|
||||
return inputSchemas;
|
||||
}
|
||||
Schema firstSchema=inputSchemas.get(0);
|
||||
DataManager dataManager = findConnection(firstSchema);
|
||||
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 (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;
|
||||
}
|
||||
}
|
||||
@@ -202,7 +202,7 @@ public class MetadataConnectionUtils {
|
||||
}
|
||||
list = ExtractMetaDataUtils.getInstance().connect(metadataBean.getDbType(), metadataBean.getUrl(),
|
||||
metadataBean.getUsername(), metadataBean.getPassword(), metadataBean.getDriverClass(),
|
||||
metadataBean.getDriverJarPath(), metadataBean.getDbVersionString(), metadataBean.getAdditionalParams());
|
||||
metadataBean.getDriverJarPath(), metadataBean.getDbVersionString(), metadataBean.getAdditionalParams(), metadataBean.isSupportNLS());
|
||||
} catch (Exception e) {
|
||||
rc.setMessage("fail to connect database!"); //$NON-NLS-1$
|
||||
CommonExceptionHandler.process(e);
|
||||
@@ -1326,7 +1326,7 @@ public class MetadataConnectionUtils {
|
||||
return ExtractMetaDataUtils.getInstance().getConnection(metadataBean.getDbType(), metadataBean.getUrl(),
|
||||
metadataBean.getUsername(), metadataBean.getPassword(), metadataBean.getDatabase(), metadataBean.getSchema(),
|
||||
metadataBean.getDriverClass(), metadataBean.getDriverJarPath(), metadataBean.getDbVersionString(),
|
||||
metadataBean.getAdditionalParams());
|
||||
metadataBean.getAdditionalParams(), metadataBean.isSupportNLS());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -80,6 +80,7 @@ public class DatabaseConnectionItemProvider extends ConnectionItemProvider imple
|
||||
addCdcTypeModePropertyDescriptor(object);
|
||||
addSQLModePropertyDescriptor(object);
|
||||
addUiSchemaPropertyDescriptor(object);
|
||||
addSupportNLSPropertyDescriptor(object);
|
||||
}
|
||||
return itemPropertyDescriptors;
|
||||
}
|
||||
@@ -468,6 +469,22 @@ public class DatabaseConnectionItemProvider extends ConnectionItemProvider imple
|
||||
false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* This adds a property descriptor for the Support NLS feature.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
protected void addSupportNLSPropertyDescriptor(Object object) {
|
||||
itemPropertyDescriptors
|
||||
.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
|
||||
getResourceLocator(), getString("_UI_DatabaseConnection_supportNLS_feature"),
|
||||
getString("_UI_PropertyDescriptor_description", "_UI_DatabaseConnection_supportNLS_feature",
|
||||
"_UI_DatabaseConnection_type"),
|
||||
ConnectionPackage.Literals.DATABASE_CONNECTION__SUPPORT_NLS, true, false, false,
|
||||
ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
|
||||
* {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
|
||||
@@ -558,6 +575,7 @@ public class DatabaseConnectionItemProvider extends ConnectionItemProvider imple
|
||||
case ConnectionPackage.DATABASE_CONNECTION__CDC_TYPE_MODE:
|
||||
case ConnectionPackage.DATABASE_CONNECTION__SQL_MODE:
|
||||
case ConnectionPackage.DATABASE_CONNECTION__UI_SCHEMA:
|
||||
case ConnectionPackage.DATABASE_CONNECTION__SUPPORT_NLS:
|
||||
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
|
||||
return;
|
||||
case ConnectionPackage.DATABASE_CONNECTION__CDC_CONNS:
|
||||
|
||||
@@ -348,6 +348,8 @@
|
||||
<eStructuralFeatures xsi:type="ecore:EAttribute" name="UiSchema" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
|
||||
<eStructuralFeatures xsi:type="ecore:EReference" name="parameters" upperBound="-1"
|
||||
eType="#//AdditionalProperties" containment="true"/>
|
||||
<eStructuralFeatures xsi:type="ecore:EAttribute" name="supportNLS" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
|
||||
defaultValueLiteral="false" unsettable="true"/>
|
||||
</eClassifiers>
|
||||
<eClassifiers xsi:type="ecore:EClass" name="SAPConnection" eSuperTypes="#//Connection">
|
||||
<eStructuralFeatures xsi:type="ecore:EAttribute" name="Host" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
|
||||
|
||||
@@ -187,6 +187,7 @@
|
||||
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute metadata.ecore#//DatabaseConnection/SQLMode"/>
|
||||
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute metadata.ecore#//DatabaseConnection/UiSchema"/>
|
||||
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference metadata.ecore#//DatabaseConnection/parameters"/>
|
||||
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute metadata.ecore#//DatabaseConnection/supportNLS"/>
|
||||
</genClasses>
|
||||
<genClasses ecoreClass="metadata.ecore#//SAPConnection">
|
||||
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute metadata.ecore#//SAPConnection/Host"/>
|
||||
|
||||
@@ -5238,6 +5238,15 @@ public interface ConnectionPackage extends EPackage {
|
||||
*/
|
||||
int DATABASE_CONNECTION__PARAMETERS = CONNECTION_FEATURE_COUNT + 25;
|
||||
|
||||
/**
|
||||
* The feature id for the '<em><b>Support NLS</b></em>' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
int DATABASE_CONNECTION__SUPPORT_NLS = CONNECTION_FEATURE_COUNT + 26;
|
||||
|
||||
/**
|
||||
* The number of structural features of the '<em>Database Connection</em>' class.
|
||||
* <!-- begin-user-doc --> <!--
|
||||
@@ -5245,7 +5254,7 @@ public interface ConnectionPackage extends EPackage {
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
int DATABASE_CONNECTION_FEATURE_COUNT = CONNECTION_FEATURE_COUNT + 26;
|
||||
int DATABASE_CONNECTION_FEATURE_COUNT = CONNECTION_FEATURE_COUNT + 27;
|
||||
|
||||
/**
|
||||
* The meta object id for the '{@link org.talend.core.model.metadata.builder.connection.impl.SAPConnectionImpl <em>SAP Connection</em>}' class.
|
||||
@@ -21896,6 +21905,17 @@ public interface ConnectionPackage extends EPackage {
|
||||
*/
|
||||
EReference getDatabaseConnection_Parameters();
|
||||
|
||||
/**
|
||||
* Returns the meta object for the attribute '{@link org.talend.core.model.metadata.builder.connection.DatabaseConnection#isSupportNLS <em>Support NLS</em>}'.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return the meta object for the attribute '<em>Support NLS</em>'.
|
||||
* @see org.talend.core.model.metadata.builder.connection.DatabaseConnection#isSupportNLS()
|
||||
* @see #getDatabaseConnection()
|
||||
* @generated
|
||||
*/
|
||||
EAttribute getDatabaseConnection_SupportNLS();
|
||||
|
||||
/**
|
||||
* Returns the meta object for class '{@link org.talend.core.model.metadata.builder.connection.SAPConnection <em>SAP Connection</em>}'.
|
||||
* <!-- begin-user-doc --> <!-- end-user-doc -->
|
||||
@@ -26459,6 +26479,14 @@ public interface ConnectionPackage extends EPackage {
|
||||
*/
|
||||
EReference DATABASE_CONNECTION__PARAMETERS = eINSTANCE.getDatabaseConnection_Parameters();
|
||||
|
||||
/**
|
||||
* The meta object literal for the '<em><b>Support NLS</b></em>' attribute feature.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
EAttribute DATABASE_CONNECTION__SUPPORT_NLS = eINSTANCE.getDatabaseConnection_SupportNLS();
|
||||
|
||||
/**
|
||||
* The meta object literal for the '{@link org.talend.core.model.metadata.builder.connection.impl.SAPConnectionImpl <em>SAP Connection</em>}' class.
|
||||
* <!-- begin-user-doc --> <!-- end-user-doc -->
|
||||
|
||||
@@ -755,4 +755,54 @@ public interface DatabaseConnection extends Connection {
|
||||
*/
|
||||
EMap<String, String> getParameters();
|
||||
|
||||
/**
|
||||
* Returns the value of the '<em><b>Support NLS</b></em>' attribute.
|
||||
* The default value is <code>"false"</code>.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return the value of the '<em>Support NLS</em>' attribute.
|
||||
* @see #isSetSupportNLS()
|
||||
* @see #unsetSupportNLS()
|
||||
* @see #setSupportNLS(boolean)
|
||||
* @see org.talend.core.model.metadata.builder.connection.ConnectionPackage#getDatabaseConnection_SupportNLS()
|
||||
* @model default="false" unsettable="true"
|
||||
* @generated
|
||||
*/
|
||||
boolean isSupportNLS();
|
||||
|
||||
/**
|
||||
* Sets the value of the '{@link org.talend.core.model.metadata.builder.connection.DatabaseConnection#isSupportNLS <em>Support NLS</em>}' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @param value the new value of the '<em>Support NLS</em>' attribute.
|
||||
* @see #isSetSupportNLS()
|
||||
* @see #unsetSupportNLS()
|
||||
* @see #isSupportNLS()
|
||||
* @generated
|
||||
*/
|
||||
void setSupportNLS(boolean value);
|
||||
|
||||
/**
|
||||
* Unsets the value of the '{@link org.talend.core.model.metadata.builder.connection.DatabaseConnection#isSupportNLS <em>Support NLS</em>}' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see #isSetSupportNLS()
|
||||
* @see #isSupportNLS()
|
||||
* @see #setSupportNLS(boolean)
|
||||
* @generated
|
||||
*/
|
||||
void unsetSupportNLS();
|
||||
|
||||
/**
|
||||
* Returns whether the value of the '{@link org.talend.core.model.metadata.builder.connection.DatabaseConnection#isSupportNLS <em>Support NLS</em>}' attribute is set.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return whether the value of the '<em>Support NLS</em>' attribute is set.
|
||||
* @see #unsetSupportNLS()
|
||||
* @see #isSupportNLS()
|
||||
* @see #setSupportNLS(boolean)
|
||||
* @generated
|
||||
*/
|
||||
boolean isSetSupportNLS();
|
||||
|
||||
} // DatabaseConnection
|
||||
|
||||
@@ -1562,6 +1562,15 @@ public class ConnectionPackageImpl extends EPackageImpl implements ConnectionPac
|
||||
return (EReference) databaseConnectionEClass.getEStructuralFeatures().get(25);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public EAttribute getDatabaseConnection_SupportNLS() {
|
||||
return (EAttribute) databaseConnectionEClass.getEStructuralFeatures().get(26);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc --> <!-- end-user-doc -->
|
||||
* @generated
|
||||
@@ -4525,6 +4534,7 @@ public class ConnectionPackageImpl extends EPackageImpl implements ConnectionPac
|
||||
createEAttribute(databaseConnectionEClass, DATABASE_CONNECTION__SQL_MODE);
|
||||
createEAttribute(databaseConnectionEClass, DATABASE_CONNECTION__UI_SCHEMA);
|
||||
createEReference(databaseConnectionEClass, DATABASE_CONNECTION__PARAMETERS);
|
||||
createEAttribute(databaseConnectionEClass, DATABASE_CONNECTION__SUPPORT_NLS);
|
||||
|
||||
sapConnectionEClass = createEClass(SAP_CONNECTION);
|
||||
createEAttribute(sapConnectionEClass, SAP_CONNECTION__HOST);
|
||||
@@ -5304,6 +5314,9 @@ public class ConnectionPackageImpl extends EPackageImpl implements ConnectionPac
|
||||
initEReference(getDatabaseConnection_Parameters(), this.getAdditionalProperties(), null, "parameters", null, 0, -1,
|
||||
DatabaseConnection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES,
|
||||
!IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
|
||||
initEAttribute(getDatabaseConnection_SupportNLS(), ecorePackage.getEBoolean(), "supportNLS", "false", 0, 1,
|
||||
DatabaseConnection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE,
|
||||
!IS_DERIVED, IS_ORDERED);
|
||||
|
||||
initEClass(sapConnectionEClass, SAPConnection.class, "SAPConnection", !IS_ABSTRACT, !IS_INTERFACE,
|
||||
IS_GENERATED_INSTANCE_CLASS);
|
||||
|
||||
@@ -51,6 +51,7 @@ import org.talend.core.model.metadata.builder.connection.DatabaseConnection;
|
||||
* <li>{@link org.talend.core.model.metadata.builder.connection.impl.DatabaseConnectionImpl#isSQLMode <em>SQL Mode</em>}</li>
|
||||
* <li>{@link org.talend.core.model.metadata.builder.connection.impl.DatabaseConnectionImpl#getUiSchema <em>Ui Schema</em>}</li>
|
||||
* <li>{@link org.talend.core.model.metadata.builder.connection.impl.DatabaseConnectionImpl#getParameters <em>Parameters</em>}</li>
|
||||
* <li>{@link org.talend.core.model.metadata.builder.connection.impl.DatabaseConnectionImpl#isSupportNLS <em>Support NLS</em>}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @generated
|
||||
@@ -563,6 +564,35 @@ public class DatabaseConnectionImpl extends ConnectionImpl implements DatabaseCo
|
||||
*/
|
||||
protected EMap<String, String> parameters;
|
||||
|
||||
/**
|
||||
* The default value of the '{@link #isSupportNLS() <em>Support NLS</em>}' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see #isSupportNLS()
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
protected static final boolean SUPPORT_NLS_EDEFAULT = false;
|
||||
|
||||
/**
|
||||
* The cached value of the '{@link #isSupportNLS() <em>Support NLS</em>}' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see #isSupportNLS()
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
protected boolean supportNLS = SUPPORT_NLS_EDEFAULT;
|
||||
|
||||
/**
|
||||
* This is true if the Support NLS attribute has been set.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
protected boolean supportNLSESet = true;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc --> <!-- end-user-doc -->
|
||||
* @generated
|
||||
@@ -1173,6 +1203,54 @@ public class DatabaseConnectionImpl extends ConnectionImpl implements DatabaseCo
|
||||
return parameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public boolean isSupportNLS() {
|
||||
return supportNLS;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public void setSupportNLS(boolean newSupportNLS) {
|
||||
boolean oldSupportNLS = supportNLS;
|
||||
supportNLS = newSupportNLS;
|
||||
boolean oldSupportNLSESet = supportNLSESet;
|
||||
supportNLSESet = true;
|
||||
if (eNotificationRequired())
|
||||
eNotify(new ENotificationImpl(this, Notification.SET, ConnectionPackage.DATABASE_CONNECTION__SUPPORT_NLS,
|
||||
oldSupportNLS, supportNLS, !oldSupportNLSESet));
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public void unsetSupportNLS() {
|
||||
boolean oldSupportNLS = supportNLS;
|
||||
boolean oldSupportNLSESet = supportNLSESet;
|
||||
supportNLS = SUPPORT_NLS_EDEFAULT;
|
||||
supportNLSESet = false;
|
||||
if (eNotificationRequired())
|
||||
eNotify(new ENotificationImpl(this, Notification.UNSET, ConnectionPackage.DATABASE_CONNECTION__SUPPORT_NLS,
|
||||
oldSupportNLS, SUPPORT_NLS_EDEFAULT, oldSupportNLSESet));
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public boolean isSetSupportNLS() {
|
||||
return supportNLSESet;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc --> <!-- end-user-doc -->
|
||||
* @generated
|
||||
@@ -1267,6 +1345,8 @@ public class DatabaseConnectionImpl extends ConnectionImpl implements DatabaseCo
|
||||
return getParameters();
|
||||
else
|
||||
return getParameters().map();
|
||||
case ConnectionPackage.DATABASE_CONNECTION__SUPPORT_NLS:
|
||||
return isSupportNLS();
|
||||
}
|
||||
return super.eGet(featureID, resolve, coreType);
|
||||
}
|
||||
@@ -1335,6 +1415,8 @@ public class DatabaseConnectionImpl extends ConnectionImpl implements DatabaseCo
|
||||
return getParameters();
|
||||
else
|
||||
return getParameters().map();
|
||||
case ConnectionPackage.DATABASE_CONNECTION__SUPPORT_NLS:
|
||||
return isSupportNLS();
|
||||
}
|
||||
return super.eGet(featureID, resolve, coreType);
|
||||
}
|
||||
@@ -1424,6 +1506,9 @@ public class DatabaseConnectionImpl extends ConnectionImpl implements DatabaseCo
|
||||
case ConnectionPackage.DATABASE_CONNECTION__PARAMETERS:
|
||||
((EStructuralFeature.Setting) getParameters()).set(newValue);
|
||||
return;
|
||||
case ConnectionPackage.DATABASE_CONNECTION__SUPPORT_NLS:
|
||||
setSupportNLS((Boolean) newValue);
|
||||
return;
|
||||
}
|
||||
super.eSet(featureID, newValue);
|
||||
}
|
||||
@@ -1513,6 +1598,9 @@ public class DatabaseConnectionImpl extends ConnectionImpl implements DatabaseCo
|
||||
case ConnectionPackage.DATABASE_CONNECTION__PARAMETERS:
|
||||
getParameters().clear();
|
||||
return;
|
||||
case ConnectionPackage.DATABASE_CONNECTION__SUPPORT_NLS:
|
||||
unsetSupportNLS();
|
||||
return;
|
||||
}
|
||||
super.eUnset(featureID);
|
||||
}
|
||||
@@ -1578,6 +1666,8 @@ public class DatabaseConnectionImpl extends ConnectionImpl implements DatabaseCo
|
||||
return UI_SCHEMA_EDEFAULT == null ? uiSchema != null : !UI_SCHEMA_EDEFAULT.equals(uiSchema);
|
||||
case ConnectionPackage.DATABASE_CONNECTION__PARAMETERS:
|
||||
return parameters != null && !parameters.isEmpty();
|
||||
case ConnectionPackage.DATABASE_CONNECTION__SUPPORT_NLS:
|
||||
return isSetSupportNLS();
|
||||
}
|
||||
return super.eIsSet(featureID);
|
||||
}
|
||||
@@ -1643,6 +1733,11 @@ public class DatabaseConnectionImpl extends ConnectionImpl implements DatabaseCo
|
||||
result.append("<unset>");
|
||||
result.append(", UiSchema: ");
|
||||
result.append(uiSchema);
|
||||
result.append(", supportNLS: ");
|
||||
if (supportNLSESet)
|
||||
result.append(supportNLS);
|
||||
else
|
||||
result.append("<unset>");
|
||||
result.append(')');
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
@@ -92,6 +92,14 @@ public final class TaggedValueHelper {
|
||||
|
||||
public static final String DB_IDENTIFIER_QUOTE_STRING = "DB IdentifierQuoteString"; //$NON-NLS-1$
|
||||
|
||||
public static final String TARGET_SID = "targetsid"; //$NON-NLS-1$
|
||||
|
||||
public static final String ORIGINAL_SID = "originalsid"; //$NON-NLS-1$
|
||||
|
||||
public static final String TARGET_UISCHEMA = "targetuischema"; //$NON-NLS-1$
|
||||
|
||||
public static final String ORIGINAL_UISCHEMA = "originaluischema"; //$NON-NLS-1$
|
||||
|
||||
// ADD sizhaoliu TDQ-6316 add 2 tagged values to replace software system
|
||||
public static final String DB_PRODUCT_NAME = "DB ProductName";//$NON-NLS-1$
|
||||
|
||||
|
||||
@@ -130,6 +130,8 @@ public class Application implements IApplication {
|
||||
|
||||
StudioKeysFileCheck.check(ConfigurationScope.INSTANCE.getLocation().toFile());
|
||||
|
||||
deleteM2();
|
||||
|
||||
Display display = PlatformUI.createDisplay();
|
||||
|
||||
if (LOGGER.isInfoEnabled()) {
|
||||
@@ -340,6 +342,21 @@ public class Application implements IApplication {
|
||||
|
||||
}
|
||||
|
||||
private void deleteM2() {
|
||||
try {
|
||||
String v = EclipseCommandLine.getEclipseArgument(EclipseCommandLine.TALEND_CLEAN_M2);
|
||||
if (v == null) {
|
||||
return;
|
||||
}
|
||||
if (Boolean.parseBoolean(v) && IStudioLiteP2Service.get() != null) {
|
||||
IStudioLiteP2Service.get().cleanM2(null);
|
||||
EclipseCommandLine.updateOrCreateExitDataPropertyWithCommand(EclipseCommandLine.TALEND_CLEAN_M2, Boolean.TRUE.toString(), true);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void cleanupNonExistingProjects() {
|
||||
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
|
||||
for (IProject project : projects) {
|
||||
|
||||
@@ -132,7 +132,7 @@ public class FileResourcesUnityManager extends FilesManager {
|
||||
TarFile tarFile = new TarFile(originalFile);
|
||||
importProvider = new TarLeveledStructureProvider(tarFile);
|
||||
archiveProviderManager = ResourcesManagerFactory.getInstance().createResourcesManager(importProvider);
|
||||
} else if (ArchiveFileManipulations.isZipFile(absolutePath)) {
|
||||
} else if (isZipFile(absolutePath)) {
|
||||
// if is not real zip file, will throw exception.
|
||||
ZipFile zipFile = new ZipFile(originalFile);
|
||||
importProvider = new TalendZipLeveledStructureProvider(zipFile);
|
||||
@@ -151,12 +151,39 @@ public class FileResourcesUnityManager extends FilesManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
this.getEmptyFolders().addAll(archiveProviderManager.getEmptyFolders());
|
||||
if (archiveProviderManager != null) {
|
||||
|
||||
this.getEmptyFolders().addAll(archiveProviderManager.getEmptyFolders());
|
||||
}
|
||||
}
|
||||
collectPath2Object(originalFile, tmpWorkFolder, tmpWorkFolder, interruptable);
|
||||
return this;
|
||||
}
|
||||
|
||||
private static boolean isZipFile(String fileName) throws IOException {
|
||||
|
||||
if (fileName.length() == 0) {
|
||||
return false;
|
||||
}
|
||||
ZipFile zipFile = null;
|
||||
try {
|
||||
zipFile = new ZipFile(fileName);
|
||||
} catch (IOException ioException) {
|
||||
throw ioException;
|
||||
|
||||
} finally {
|
||||
if (zipFile != null) {
|
||||
try {
|
||||
zipFile.close();
|
||||
} catch (IOException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void decompress(ResourcesManager srcManager, File destRootFolder, boolean interrupable) throws IOException {
|
||||
Set<IPath> paths = srcManager.getPaths();
|
||||
Thread currentThread = Thread.currentThread();
|
||||
|
||||
@@ -1207,6 +1207,7 @@ public class ImportItemsWizardPage extends WizardPage {
|
||||
public boolean performFinish() {
|
||||
final List<ImportItem> checkedItemRecords = getCheckedElements();
|
||||
final IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
|
||||
importManager.getPendoImportManager().cacheItemProperty(checkedItemRecords);
|
||||
|
||||
/*
|
||||
* ?? prepare to do import, unlock the existed one, and make sure the overwrite to work well.
|
||||
@@ -1260,11 +1261,12 @@ public class ImportItemsWizardPage extends WizardPage {
|
||||
final ResourceOption importOption = ResourceOption.ITEM_IMPORTATION;
|
||||
try {
|
||||
EmfResourcesFactoryReader.INSTANCE.addOption(importOption, false);
|
||||
|
||||
importManager.getPendoImportManager().setStudioImport(true);
|
||||
importManager.importItemRecords(monitor, resManager, checkedItemRecords, overwrite,
|
||||
nodesBuilder.getAllImportItemRecords(), destinationPath, alwaysRegenId);
|
||||
} finally {
|
||||
EmfResourcesFactoryReader.INSTANCE.removOption(importOption, false);
|
||||
importManager.getPendoImportManager().sendTrackToPendo();
|
||||
}
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user