Compare commits
59 Commits
bugfix/mas
...
bugfix/mas
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4687a7ffec | ||
|
|
65b467f574 | ||
|
|
e0199336ef | ||
|
|
f807ca1839 | ||
|
|
8a8d5eeb0a | ||
|
|
c968ed321c | ||
|
|
394a29cca2 | ||
|
|
c6696371b2 | ||
|
|
3b582b21fc | ||
|
|
fa88cc5613 | ||
|
|
da2413c87c | ||
|
|
a1ea92865b | ||
|
|
acce4c5e8f | ||
|
|
7ce62fc066 | ||
|
|
7f26a779bc | ||
|
|
70bfd5623b | ||
|
|
97dd532fdd | ||
|
|
c9de20238c | ||
|
|
857f5459b6 | ||
|
|
76aa39dbd8 | ||
|
|
e68d27d598 | ||
|
|
4abb63f274 | ||
|
|
4ad69a33d9 | ||
|
|
dd1853cf85 | ||
|
|
20656380ab | ||
|
|
43021956a4 | ||
|
|
8bafc9ace7 | ||
|
|
63f5588fec | ||
|
|
737e502767 | ||
|
|
da191288c5 | ||
|
|
f45a5ce571 | ||
|
|
b427e62f6e | ||
|
|
667ceea4de | ||
|
|
a6afca4ea5 | ||
|
|
02302f1116 | ||
|
|
136ca086a6 | ||
|
|
38070a87f8 | ||
|
|
8668bd963b | ||
|
|
1e232d2d40 | ||
|
|
a9b2e15695 | ||
|
|
44b583ab0e | ||
|
|
79b2e0ecb8 | ||
|
|
c699fb6e6d | ||
|
|
bec94deb0e | ||
|
|
b224b59c54 | ||
|
|
e485c1860e | ||
|
|
feb0bd5ef7 | ||
|
|
09cfffc544 | ||
|
|
a6ee4c28fb | ||
|
|
f0aa480e42 | ||
|
|
993a5b0460 | ||
|
|
6206252ef6 | ||
|
|
fab28a3af2 | ||
|
|
c3ff8e3891 | ||
|
|
bd69786c4f | ||
|
|
b6bb7ffe65 | ||
|
|
9aa2c69eb4 | ||
|
|
e75cba9a34 | ||
|
|
5d2f8fe2c0 |
@@ -18,6 +18,7 @@ import org.eclipse.jface.util.Assert;
|
||||
import org.eclipse.jface.viewers.CellEditor;
|
||||
import org.eclipse.jface.viewers.ComboBoxCellEditor;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.CCombo;
|
||||
import org.eclipse.swt.events.FocusAdapter;
|
||||
import org.eclipse.swt.events.FocusEvent;
|
||||
import org.eclipse.swt.events.KeyAdapter;
|
||||
@@ -27,7 +28,6 @@ import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.events.TraverseEvent;
|
||||
import org.eclipse.swt.events.TraverseListener;
|
||||
import org.eclipse.swt.graphics.GC;
|
||||
import org.eclipse.swt.widgets.Combo;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
|
||||
@@ -53,7 +53,7 @@ public class ComboxCellEditorImproved extends CellEditor {
|
||||
/**
|
||||
* The custom combo box control.
|
||||
*/
|
||||
Combo comboBox;
|
||||
CCombo comboBox;
|
||||
|
||||
/**
|
||||
* Default ComboBoxCellEditor style
|
||||
@@ -125,7 +125,7 @@ public class ComboxCellEditorImproved extends CellEditor {
|
||||
*/
|
||||
protected Control createControl(Composite parent) {
|
||||
|
||||
comboBox = new Combo(parent, getStyle());
|
||||
comboBox = new CCombo(parent, getStyle());
|
||||
comboBox.setFont(parent.getFont());
|
||||
|
||||
comboBox.addKeyListener(new KeyAdapter() {
|
||||
|
||||
@@ -21,6 +21,7 @@ import javax.crypto.SecretKeyFactory;
|
||||
import javax.crypto.spec.DESKeySpec;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.talend.utils.security.AESEncryption;
|
||||
|
||||
/**
|
||||
* DOC chuang class global comment. Detailled comment
|
||||
@@ -85,20 +86,6 @@ public class PasswordEncryptUtil {
|
||||
return new String(clearByte);
|
||||
}
|
||||
|
||||
private static SecretKey passwordKey = null;
|
||||
|
||||
private static String CHARSET = "UTF-8";
|
||||
|
||||
private static SecretKey getSecretKeyUTF8() throws Exception {
|
||||
if (passwordKey == null) {
|
||||
byte rawKeyData[] = rawKey.getBytes(CHARSET);
|
||||
DESKeySpec dks = new DESKeySpec(rawKeyData);
|
||||
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES"); //$NON-NLS-1$
|
||||
passwordKey = keyFactory.generateSecret(dks);
|
||||
}
|
||||
return passwordKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Work for codegen only. and must be same as the routine
|
||||
* "routines.system.PasswordEncryptUtil.encryptPassword(input)".
|
||||
@@ -108,12 +95,7 @@ public class PasswordEncryptUtil {
|
||||
if (input == null) {
|
||||
return input;
|
||||
}
|
||||
SecretKey key = getSecretKeyUTF8();
|
||||
Cipher c = Cipher.getInstance("DES"); //$NON-NLS-1$
|
||||
c.init(Cipher.ENCRYPT_MODE, key, secureRandom);
|
||||
byte[] cipherByte = c.doFinal(input.getBytes(CHARSET));
|
||||
String dec = Hex.encodeHexString(cipherByte);
|
||||
return dec;
|
||||
return AESEncryption.encryptPassword(input);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -159,5 +141,4 @@ public class PasswordEncryptUtil {
|
||||
return value.replaceAll(".", "*"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,10 +15,13 @@ package org.talend.commons.utils;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.util.Properties;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.eclipse.core.runtime.FileLocator;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
@@ -26,6 +29,8 @@ import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.URIUtil;
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.osgi.framework.FrameworkUtil;
|
||||
import org.talend.commons.CommonsPlugin;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.i18n.internal.Messages;
|
||||
|
||||
/**
|
||||
@@ -213,6 +218,40 @@ public class VersionUtils {
|
||||
return version;
|
||||
}
|
||||
|
||||
public static String getMojoVersion(String mojoKey) {
|
||||
String version = null;
|
||||
String talendVersion = getTalendVersion();
|
||||
Properties properties = new Properties();
|
||||
File file = new Path(Platform.getConfigurationLocation().getURL().getPath()).append("mojo_version.properties").toFile(); //$NON-NLS-1$
|
||||
if (file.exists()) {
|
||||
try (InputStream inStream = new FileInputStream(file)) {
|
||||
properties.load(inStream);
|
||||
version = properties.getProperty(mojoKey);
|
||||
} catch (IOException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
if (version != null && !version.startsWith(talendVersion)) {
|
||||
ExceptionHandler
|
||||
.process(new Exception(
|
||||
"Incompatible Mojo version:" + mojoKey + "[" + version + "], use default version.")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
version = null;
|
||||
}
|
||||
}
|
||||
// default version
|
||||
if (StringUtils.isBlank(version)) {
|
||||
version = talendVersion;
|
||||
if (CommonsPlugin.isJUnitTest()) {
|
||||
productVersion = null;
|
||||
}
|
||||
String productVersion = getInternalVersion();
|
||||
String revision = StringUtils.substringAfterLast(productVersion, "-"); //$NON-NLS-1$
|
||||
if (("SNAPSHOT").equals(revision) || Pattern.matches("M\\d{1}", revision)) { //$NON-NLS-1$ //$NON-NLS-2$
|
||||
version += "-" + revision; //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
public static void clearCache() {
|
||||
synchronized (VersionUtils.class) {
|
||||
productVersion = null;
|
||||
|
||||
@@ -42,13 +42,15 @@ public class NetworkUtil {
|
||||
|
||||
private static final String TALEND_DISABLE_INTERNET = "talend.disable.internet";//$NON-NLS-1$
|
||||
|
||||
private static final String HTTP_NETWORK_URL = "https://talend-update.talend.com";
|
||||
|
||||
public static boolean isNetworkValid() {
|
||||
String disableInternet = System.getProperty(TALEND_DISABLE_INTERNET);
|
||||
if ("true".equals(disableInternet)) { //$NON-NLS-1$
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
URL url = new URL("https://www.talend.com"); //$NON-NLS-1$
|
||||
URL url = new URL(HTTP_NETWORK_URL);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setConnectTimeout(4000);
|
||||
conn.setReadTimeout(4000);
|
||||
|
||||
@@ -154,7 +154,7 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
|
||||
/**
|
||||
* DOC nrousseau ProjectRepositoryNode constructor comment.
|
||||
*
|
||||
*
|
||||
* @param object
|
||||
* @param parent
|
||||
* @param type
|
||||
@@ -277,7 +277,7 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
private void deleteHiddenNodes(List<IRepositoryNode> nodes) {
|
||||
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IBrandingService.class)) {
|
||||
IBrandingService service = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
|
||||
IBrandingService service = GlobalServiceRegister.getDefault().getService(IBrandingService.class);
|
||||
List<IRepositoryNode> hiddens = service.getBrandingConfiguration().getHiddenRepositoryCategory(this, "DI");
|
||||
for (IRepositoryNode node : hiddens) {
|
||||
Iterator<IRepositoryNode> it = nodes.iterator();
|
||||
@@ -384,7 +384,7 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
private void initNodesFromComponentSerivice(RepositoryNode curParentNode) {
|
||||
IGenericWizardService wizardService = null;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericWizardService.class)) {
|
||||
wizardService = (IGenericWizardService) GlobalServiceRegister.getDefault().getService(IGenericWizardService.class);
|
||||
wizardService = GlobalServiceRegister.getDefault().getService(IGenericWizardService.class);
|
||||
}
|
||||
if (wizardService != null) {
|
||||
List<RepositoryNode> nodes = wizardService.createNodesFromComponentService(curParentNode);
|
||||
@@ -453,7 +453,7 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
|
||||
/**
|
||||
* DOC nrousseau Comment method "initializeChildren".
|
||||
*
|
||||
*
|
||||
* @param parent
|
||||
*/
|
||||
public void initializeChildren(Object parent) {
|
||||
@@ -547,8 +547,8 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
RuntimeExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void addExtraChildren(ERepositoryObjectType contentType, org.talend.core.model.general.Project newProject,
|
||||
|
||||
private void addExtraChildren(ERepositoryObjectType contentType, org.talend.core.model.general.Project newProject,
|
||||
RepositoryNode repositoryNode) throws PersistenceException{
|
||||
if(contentType != ERepositoryObjectType.METADATA_CONNECTIONS){
|
||||
return;
|
||||
@@ -556,7 +556,7 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
List<ERepositoryObjectType> extraTypes = new ArrayList<ERepositoryObjectType>();
|
||||
IGenericDBService dbService = null;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericDBService.class)) {
|
||||
dbService = (IGenericDBService) GlobalServiceRegister.getDefault().getService(
|
||||
dbService = GlobalServiceRegister.getDefault().getService(
|
||||
IGenericDBService.class);
|
||||
}
|
||||
if(dbService != null){
|
||||
@@ -645,7 +645,7 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
|
||||
/**
|
||||
* DOC nrousseau Comment method "addDeletedElements".
|
||||
*
|
||||
*
|
||||
* @param project2
|
||||
* @param nodes
|
||||
*/
|
||||
@@ -654,7 +654,7 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
List<IRepositoryViewObject> elements = new ArrayList<IRepositoryViewObject>();
|
||||
ITestContainerProviderService testContainerService = null;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
|
||||
testContainerService = (ITestContainerProviderService) GlobalServiceRegister.getDefault()
|
||||
testContainerService = GlobalServiceRegister.getDefault()
|
||||
.getService(ITestContainerProviderService.class);
|
||||
}
|
||||
for (IRepositoryViewObject currentObject : objects) {
|
||||
@@ -687,7 +687,7 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
|
||||
/**
|
||||
* DOC nrousseau Comment method "addDeletedElements".
|
||||
*
|
||||
*
|
||||
* @param project2
|
||||
* @param nodes
|
||||
*/
|
||||
@@ -695,7 +695,7 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
List<IRepositoryNode> rootNodes = rootNode.getChildren();
|
||||
ITestContainerProviderService testContainerService = null;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
|
||||
testContainerService = (ITestContainerProviderService) GlobalServiceRegister.getDefault()
|
||||
testContainerService = GlobalServiceRegister.getDefault()
|
||||
.getService(ITestContainerProviderService.class);
|
||||
}
|
||||
for (IRepositoryViewObject currentObject : elements) {
|
||||
@@ -726,7 +726,7 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
|
||||
/**
|
||||
* DOC hwang Comment method "getTestCaseParent".
|
||||
*
|
||||
*
|
||||
* @param repositoryObjectType
|
||||
* @param path
|
||||
* @return
|
||||
@@ -750,7 +750,7 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
|
||||
/**
|
||||
* DOC nrousseau Comment method "getFolder".
|
||||
*
|
||||
*
|
||||
* @param repositoryObjectType
|
||||
* @param path
|
||||
* @return
|
||||
@@ -804,7 +804,7 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
|
||||
/**
|
||||
* DOC nrousseau Comment method "buildFolders".
|
||||
*
|
||||
*
|
||||
* @param currentType
|
||||
* @param path
|
||||
* @param nodes
|
||||
@@ -912,7 +912,7 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
|
||||
/**
|
||||
* DOC nrousseau Comment method "addDeletedSubItems".
|
||||
*
|
||||
*
|
||||
* @param item
|
||||
* @param currentParentNode
|
||||
*/
|
||||
@@ -962,7 +962,7 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
Set<MetadataTable> tables = null;
|
||||
IGenericWizardService wizardService = null;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericWizardService.class)) {
|
||||
wizardService = (IGenericWizardService) GlobalServiceRegister.getDefault()
|
||||
wizardService = GlobalServiceRegister.getDefault()
|
||||
.getService(IGenericWizardService.class);
|
||||
}
|
||||
if (wizardService != null && wizardService.isGenericItem(item)) {
|
||||
@@ -997,9 +997,9 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* ggu Comment method "isGeneratedJobItem".
|
||||
*
|
||||
*
|
||||
* feature 4393
|
||||
*/
|
||||
private boolean isGeneratedJobItem(Item item) {
|
||||
@@ -1062,7 +1062,7 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void convert(org.talend.core.model.general.Project newProject, Container fromModel, RepositoryNode parent,
|
||||
ERepositoryObjectType type) {
|
||||
convert(newProject, fromModel, parent, type, false);
|
||||
@@ -1128,7 +1128,7 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
break;
|
||||
}
|
||||
}
|
||||
IBrandingService breaningService = (IBrandingService) GlobalServiceRegister.getDefault()
|
||||
IBrandingService breaningService = GlobalServiceRegister.getDefault()
|
||||
.getService(IBrandingService.class);
|
||||
|
||||
if (!existSystemFolder && !breaningService.isPoweredOnlyCamel()) {
|
||||
@@ -1167,7 +1167,7 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
folder = new RepositoryNode(oFolder, parent, ENodeType.SIMPLE_FOLDER);
|
||||
if (factory.getStatus(oFolder) != ERepositoryStatus.DELETED) {
|
||||
parent.getChildren().add(folder);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -1176,9 +1176,9 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
folder = new RepositoryNode(oFolder, parent, ENodeType.SIMPLE_FOLDER);
|
||||
if (factory.getStatus(oFolder) != ERepositoryStatus.DELETED) {
|
||||
parent.getChildren().add(folder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1211,7 +1211,7 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private RepositoryNode avoidReCreateFolder(RepositoryNode parent, Folder oFolder, boolean extra){
|
||||
RepositoryNode folder = null;
|
||||
if(extra){
|
||||
@@ -1325,7 +1325,7 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
// node.setParent(recBinNode);
|
||||
} else {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerCoreService.class)) {
|
||||
IDesignerCoreService designerCoreService = (IDesignerCoreService) GlobalServiceRegister.getDefault()
|
||||
IDesignerCoreService designerCoreService = GlobalServiceRegister.getDefault()
|
||||
.getService(IDesignerCoreService.class);
|
||||
if (designerCoreService != null) {
|
||||
for (IRepositoryNode repositoryNode : parent.getChildren()) {
|
||||
@@ -1377,7 +1377,7 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
|
||||
/**
|
||||
* DOC tguiu Comment method "createTables".
|
||||
*
|
||||
*
|
||||
* @param node
|
||||
* @param repositoryObjectType TODO
|
||||
* @param iMetadataConnection
|
||||
@@ -1417,7 +1417,7 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
|
||||
/**
|
||||
* DOC cantoine Comment method "createTable".
|
||||
*
|
||||
*
|
||||
* @param node
|
||||
* @param metadataTable
|
||||
* @param repositoryObjectType TODO
|
||||
@@ -1635,7 +1635,7 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
DatabaseConnectionItem connectionItem = (DatabaseConnectionItem) item;
|
||||
DatabaseConnection connection = (DatabaseConnection) connectionItem.getConnection();
|
||||
if (PluginChecker.isCDCPluginLoaded()) {
|
||||
ICDCProviderService service = (ICDCProviderService) GlobalServiceRegister.getDefault()
|
||||
ICDCProviderService service = GlobalServiceRegister.getDefault()
|
||||
.getService(ICDCProviderService.class);
|
||||
if (service != null && service.canCreateCDCConnection(connection)) {
|
||||
RepositoryNode cdcNode = new StableRepositoryNode(node,
|
||||
@@ -1886,7 +1886,7 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
|
||||
/**
|
||||
* DOC YeXiaowei Comment method "createSAPFunctionNodes".
|
||||
*
|
||||
*
|
||||
* @param metadataConnection
|
||||
* @param functionNode
|
||||
*/
|
||||
@@ -1926,7 +1926,7 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
|
||||
/**
|
||||
* DOC zli Comment method "createSAPIDocNodes".
|
||||
*
|
||||
*
|
||||
* @param recBin
|
||||
* @param rebObj
|
||||
* @param metadataConnection
|
||||
@@ -1961,7 +1961,7 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
|
||||
/**
|
||||
* DOC YeXiaowei Comment method "createSAPNode".
|
||||
*
|
||||
*
|
||||
* @param rebObj
|
||||
* @param functionNode
|
||||
* @param unit
|
||||
@@ -1987,7 +1987,7 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
|
||||
/**
|
||||
* DOC tguiu Comment method "createMetatable".
|
||||
*
|
||||
*
|
||||
* @param node
|
||||
* @param table
|
||||
* @param repositoryObjectType TODO
|
||||
@@ -2016,7 +2016,7 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
|
||||
/**
|
||||
* DOC cantoine Comment method "createQueryNode".
|
||||
*
|
||||
*
|
||||
* @param node
|
||||
* @param repObj
|
||||
* @param query
|
||||
@@ -2032,7 +2032,7 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.talend.repository.model.IProjectRepositoryNode#getProject()
|
||||
*/
|
||||
@Override
|
||||
@@ -2101,7 +2101,7 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.talend.repository.model.nodes.IProjectRepositoryNode#getRecBinNode()
|
||||
*/
|
||||
@Override
|
||||
@@ -2124,8 +2124,7 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
String branch = ProjectManager.getInstance().getMainProjectBranch(project);
|
||||
if ("".equals(branch) || branch == null) { //$NON-NLS-1$
|
||||
branch = null;
|
||||
}
|
||||
if (!branch.contains(SVNConstant.NAME_TRUNK) && !branch.contains(SVNConstant.NAME_BRANCHES)
|
||||
} else if (!branch.contains(SVNConstant.NAME_TRUNK) && !branch.contains(SVNConstant.NAME_BRANCHES)
|
||||
&& !branch.contains(SVNConstant.NAME_TAGS)) {
|
||||
branch = null;
|
||||
}
|
||||
@@ -2295,9 +2294,9 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
public IRepositoryNode removeCache(String key) {
|
||||
return nodeCache.removeCache(key);
|
||||
}
|
||||
|
||||
|
||||
public void setOptions(int options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -68,10 +68,8 @@ import org.talend.commons.exception.SystemException;
|
||||
import org.talend.commons.runtime.model.repository.ERepositoryStatus;
|
||||
import org.talend.commons.runtime.service.ITaCoKitService;
|
||||
import org.talend.commons.ui.gmf.util.DisplayUtils;
|
||||
import org.talend.commons.ui.runtime.CommonUIPlugin;
|
||||
import org.talend.commons.ui.runtime.exception.MessageBoxExceptionHandler;
|
||||
import org.talend.commons.utils.data.container.RootContainer;
|
||||
import org.talend.commons.utils.generation.JavaUtils;
|
||||
import org.talend.commons.utils.time.TimeMeasure;
|
||||
import org.talend.commons.utils.workbench.resources.ResourceUtils;
|
||||
import org.talend.core.AbstractDQModelService;
|
||||
@@ -130,7 +128,6 @@ import org.talend.core.runtime.CoreRuntimePlugin;
|
||||
import org.talend.core.runtime.repository.item.ItemProductKeys;
|
||||
import org.talend.core.runtime.services.IMavenUIService;
|
||||
import org.talend.core.runtime.util.ItemDateParser;
|
||||
import org.talend.core.runtime.util.JavaHomeUtil;
|
||||
import org.talend.core.service.ICoreUIService;
|
||||
import org.talend.cwm.helper.SubItemHelper;
|
||||
import org.talend.cwm.helper.TableHelper;
|
||||
@@ -213,14 +210,14 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
|
||||
private ICoreService getCoreService() {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreService.class)) {
|
||||
return (ICoreService) GlobalServiceRegister.getDefault().getService(ICoreService.class);
|
||||
return GlobalServiceRegister.getDefault().getService(ICoreService.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private IRunProcessService getRunProcessService() {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
|
||||
return (IRunProcessService) GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
|
||||
return GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -317,7 +314,7 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
* @throws LoginException
|
||||
*/
|
||||
private void checkProjectCompatibility(Project project) throws LoginException {
|
||||
IMigrationToolService migrationToolService = (IMigrationToolService) GlobalServiceRegister.getDefault().getService(
|
||||
IMigrationToolService migrationToolService = GlobalServiceRegister.getDefault().getService(
|
||||
IMigrationToolService.class);
|
||||
// update migration system.
|
||||
migrationToolService.updateMigrationSystem(project.getEmfProject(), false);
|
||||
@@ -386,7 +383,7 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
ITDQRepositoryService tdqRepService = null;
|
||||
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITDQRepositoryService.class)) {
|
||||
tdqRepService = (ITDQRepositoryService) GlobalServiceRegister.getDefault().getService(
|
||||
tdqRepService = GlobalServiceRegister.getDefault().getService(
|
||||
ITDQRepositoryService.class);
|
||||
}
|
||||
|
||||
@@ -523,7 +520,7 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
checkFileName(projectInfor.getLabel(), RepositoryConstants.PROJECT_PATTERN);
|
||||
Project toReturn = this.repositoryFactoryFromProvider.createProject(authUser, authPassword, projectInfor);
|
||||
if (toReturn.isLocal()) {
|
||||
IMigrationToolService service = (IMigrationToolService) GlobalServiceRegister.getDefault().getService(
|
||||
IMigrationToolService service = GlobalServiceRegister.getDefault().getService(
|
||||
IMigrationToolService.class);
|
||||
service.initNewProjectTasks(toReturn);
|
||||
}
|
||||
@@ -853,7 +850,7 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
|
||||
if (repositoryObjectType == ERepositoryObjectType.PROCESS && isFullLogonFinished()) {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IESBService.class)) {
|
||||
IESBService service = (IESBService) GlobalServiceRegister.getDefault().getService(IESBService.class);
|
||||
IESBService service = GlobalServiceRegister.getDefault().getService(IESBService.class);
|
||||
if (service != null) {
|
||||
service.refreshOperationLabel(object.getProperty().getId());
|
||||
}
|
||||
@@ -920,7 +917,7 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
|
||||
if (repositoryObjectType == ERepositoryObjectType.PROCESS && isFullLogonFinished()) {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IESBService.class)) {
|
||||
IESBService service = (IESBService) GlobalServiceRegister.getDefault().getService(IESBService.class);
|
||||
IESBService service = GlobalServiceRegister.getDefault().getService(IESBService.class);
|
||||
if (service != null) {
|
||||
service.refreshOperationLabel(object.getProperty().getId());
|
||||
}
|
||||
@@ -931,7 +928,7 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
}
|
||||
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
|
||||
IRunProcessService service = (IRunProcessService) GlobalServiceRegister.getDefault()
|
||||
IRunProcessService service = GlobalServiceRegister.getDefault()
|
||||
.getService(IRunProcessService.class);
|
||||
service.batchDeleteAllVersionTalendJobProject(idList);
|
||||
}
|
||||
@@ -2034,6 +2031,7 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
workspace.setDescription(description);
|
||||
} catch (CoreException e) {
|
||||
// do nothing
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
isCancelled = false;
|
||||
@@ -2074,7 +2072,7 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
checkProjectCompatibility(project);
|
||||
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IMavenUIService.class)) {
|
||||
IMavenUIService mavenUIService = (IMavenUIService) GlobalServiceRegister.getDefault().getService(
|
||||
IMavenUIService mavenUIService = GlobalServiceRegister.getDefault().getService(
|
||||
IMavenUIService.class);
|
||||
if (mavenUIService != null) {
|
||||
mavenUIService.updateMavenResolver(true);
|
||||
@@ -2111,7 +2109,7 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
currentMonitor.beginTask(Messages.getString("ProxyRepositoryFactory.load.componnents"), 1); //$NON-NLS-1$
|
||||
ICoreUIService coreUiService = null;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreUIService.class)) {
|
||||
coreUiService = (ICoreUIService) GlobalServiceRegister.getDefault().getService(ICoreUIService.class);
|
||||
coreUiService = GlobalServiceRegister.getDefault().getService(ICoreUIService.class);
|
||||
}
|
||||
if (coreUiService != null) {
|
||||
coreUiService.componentsReset();
|
||||
@@ -2144,20 +2142,6 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
if (coreService != null) {
|
||||
// clean workspace
|
||||
currentMonitor.beginTask(Messages.getString("ProxyRepositoryFactory.cleanWorkspace"), 1); //$NON-NLS-1$
|
||||
|
||||
String specifiedVersion = null;
|
||||
String currentVersion = JavaUtils.getProjectJavaVersion();
|
||||
String newVersion = null;
|
||||
if (CommonUIPlugin.isFullyHeadless()) {
|
||||
specifiedVersion = JavaHomeUtil.getSpecifiedJavaVersion();
|
||||
}
|
||||
if (specifiedVersion == null) {
|
||||
newVersion = currentVersion != null ? currentVersion : JavaUtils.DEFAULT_VERSION;
|
||||
} else {
|
||||
newVersion = specifiedVersion;
|
||||
}
|
||||
|
||||
JavaUtils.updateProjectJavaVersion(newVersion);
|
||||
|
||||
TimeMeasure.step("logOnProject", "clean Java project"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
@@ -2176,6 +2160,7 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
coreService.syncAllBeans();
|
||||
} catch (SystemException e1) {
|
||||
//
|
||||
ExceptionHandler.process(e1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2205,6 +2190,7 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
}
|
||||
} catch (SystemException e) {
|
||||
// ignore
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
|
||||
if (runProcessService != null && !isCommandLineLocalRefProject) {
|
||||
@@ -2213,7 +2199,7 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
TimeMeasure.step("logOnProject", "install / setup root poms"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITDQRepositoryService.class)) {
|
||||
ITDQRepositoryService tdqRepositoryService = (ITDQRepositoryService) GlobalServiceRegister.getDefault()
|
||||
ITDQRepositoryService tdqRepositoryService = GlobalServiceRegister.getDefault()
|
||||
.getService(ITDQRepositoryService.class);
|
||||
if (tdqRepositoryService != null) {
|
||||
tdqRepositoryService.initProxyRepository();
|
||||
|
||||
@@ -22,15 +22,15 @@ import java.security.Security;
|
||||
import java.util.Hashtable;
|
||||
|
||||
import javax.net.SocketFactory;
|
||||
import javax.net.ssl.KeyManager;
|
||||
import javax.net.ssl.KeyManagerFactory;
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.SSLSocketFactory;
|
||||
import javax.net.ssl.TrustManager;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.talend.core.repository.i18n.Messages;
|
||||
|
||||
import javax.net.ssl.KeyManagerFactory;
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.TrustManager;
|
||||
|
||||
/**
|
||||
* This class is used for LDAP. <br/>
|
||||
*
|
||||
@@ -218,12 +218,12 @@ public class AdvancedSocketFactory extends SSLSocketFactory {
|
||||
*/
|
||||
private void init(KeyStore ks, char password[]) {
|
||||
SSLContext ctx = null;
|
||||
javax.net.ssl.KeyManager keyManagers[] = null;
|
||||
KeyManager keyManagers[] = null;
|
||||
TrustManager trustManagers[] = null;
|
||||
try {
|
||||
if (ks != null) {
|
||||
KeyManagerFactory kmf = null;
|
||||
kmf = KeyManagerFactory.getInstance("SunX509"); //$NON-NLS-1$
|
||||
kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); //$NON-NLS-1$
|
||||
kmf.init(ks, password);
|
||||
keyManagers = kmf.getKeyManagers();
|
||||
}
|
||||
@@ -236,7 +236,4 @@ public class AdvancedSocketFactory extends SSLSocketFactory {
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
Security.addProvider(java.security.Security.getProvider("SUN"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,13 +27,13 @@ import java.security.NoSuchAlgorithmException;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.X509Certificate;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.core.repository.i18n.Messages;
|
||||
|
||||
import javax.net.ssl.TrustManager;
|
||||
import javax.net.ssl.TrustManagerFactory;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.talend.core.repository.i18n.Messages;
|
||||
|
||||
/**
|
||||
* This class is used for verifying CA for LDAP connection.
|
||||
*
|
||||
@@ -76,6 +76,26 @@ public class LDAPCATruster implements X509TrustManager {
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Comment method "deleteCert".
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
private boolean deleteCert(String id) {
|
||||
try {
|
||||
ks.deleteEntry(id);
|
||||
} catch (KeyStoreException ex) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.sun.net.ssl.X509TrustManager#getAcceptedIssuers()
|
||||
*/
|
||||
public X509Certificate[] getAcceptedIssuers() {
|
||||
if (trustManager == null)
|
||||
return null;
|
||||
@@ -157,9 +177,9 @@ public class LDAPCATruster implements X509TrustManager {
|
||||
*/
|
||||
private X509TrustManager initTrustManager(KeyStore ks) throws NoSuchAlgorithmException, KeyStoreException {
|
||||
TrustManagerFactory trustManagerFactory = null;
|
||||
trustManagerFactory = TrustManagerFactory.getInstance("SunX509"); //$NON-NLS-1$
|
||||
trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); //$NON-NLS-1$
|
||||
trustManagerFactory.init(ks);
|
||||
javax.net.ssl.TrustManager trusts[] = trustManagerFactory.getTrustManagers();
|
||||
TrustManager trusts[] = trustManagerFactory.getTrustManagers();
|
||||
return (X509TrustManager) trusts[0];
|
||||
}
|
||||
|
||||
@@ -174,29 +194,28 @@ public class LDAPCATruster implements X509TrustManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.sun.net.ssl.X509TrustManager#isServerTrusted(java.security.cert.X509Certificate[])
|
||||
*/
|
||||
public boolean isServerTrusted(X509Certificate chain[], String authType) {
|
||||
boolean isTrusted = false;
|
||||
if (trustManager != null) {
|
||||
try {
|
||||
trustManager.checkServerTrusted(chain, authType);
|
||||
isTrusted = true;
|
||||
}catch (CertificateException e) {
|
||||
ExceptionHandler.process(e);
|
||||
@Override
|
||||
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
|
||||
if (trustManager == null)
|
||||
throw new CertificateException("Trust manager is not initialized");
|
||||
else
|
||||
trustManager.checkClientTrusted(chain, authType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
|
||||
if (trustManager != null) {
|
||||
try {
|
||||
trustManager.checkServerTrusted(chain, authType);
|
||||
return;
|
||||
} catch(Exception e) {
|
||||
}
|
||||
}
|
||||
if (isTrusted) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
X509Certificate ca = getCACert(chain);
|
||||
if (ca != null) {
|
||||
if (isAccepted(ca)) {
|
||||
log.error(Messages.getString("LDAPCATruster.sslError1")); //$NON-NLS-1$
|
||||
return false;
|
||||
if (!isAccepted(ca)) {
|
||||
System.err.println("SSL Error:Server certificate chain verification failed.");
|
||||
throw new CertificateException("Server certificate chain verification failed.");
|
||||
}
|
||||
String id = String.valueOf(System.currentTimeMillis());
|
||||
X509TrustManager tmpTrustManager = null;
|
||||
@@ -204,34 +223,26 @@ public class LDAPCATruster implements X509TrustManager {
|
||||
ks.setCertificateEntry(id, ca);
|
||||
tmpTrustManager = initTrustManager(ks);
|
||||
} catch (Exception e) {
|
||||
log.error(Messages.getString("LDAPCATruster.failedCreateTmp") + e.getMessage()); //$NON-NLS-1$
|
||||
return false;
|
||||
System.err.println("ASF Truster: Failed to create tmp trust store : " + e.getMessage());
|
||||
throw new CertificateException(e);
|
||||
}
|
||||
boolean isTmpTrusted = false;
|
||||
if (tmpTrustManager != null) {
|
||||
try {
|
||||
tmpTrustManager.checkServerTrusted(chain, authType);
|
||||
isTmpTrusted = true;
|
||||
}catch (CertificateException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
if (isTmpTrusted) {
|
||||
try{
|
||||
tmpTrustManager.checkServerTrusted(chain, authType);
|
||||
if (this.isSaveCA) {
|
||||
saveStore();
|
||||
trustManager = tmpTrustManager;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
log.error(Messages.getString("LDAPCATruster.sslError2")); //$NON-NLS-1$
|
||||
return false;
|
||||
return;
|
||||
} catch(CertificateException e) {
|
||||
System.err.println("SSL Error:Server certificate chain verification failed and \\nthe CA is missing.");
|
||||
throw e;
|
||||
}
|
||||
} else {
|
||||
log.error(Messages.getString("LDAPCATruster.sslError3") //$NON-NLS-1$
|
||||
+ Messages.getString("LDAPCATruster.noCertificate")); //$NON-NLS-1$
|
||||
return false;
|
||||
System.err
|
||||
.println("SSL Error:CA certificate is not in the server certificate chain.\nPlease use the keytool command to import the server certificate.");
|
||||
throw new CertificateException("CA certificate is not in the server certificate chain.\\nPlease use the keytool command to import the server certificate.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Comment method "saveStore".
|
||||
@@ -266,18 +277,4 @@ public class LDAPCATruster implements X509TrustManager {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
|
||||
if (trustManager == null) {
|
||||
throw new CertificateException(Messages.getString("LDAPCATruster.failedInitialTrust"));
|
||||
}
|
||||
trustManager.checkClientTrusted(chain, authType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
|
||||
if (!isServerTrusted(chain, authType)) {
|
||||
throw new CertificateException(Messages.getString("LDAPCATruster.sslError1"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,8 +21,11 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
@@ -274,20 +277,37 @@ public class ProjectDataJsonProvider {
|
||||
|
||||
public static void loadMigrationTaskSetting(Project project, InputStream input) throws PersistenceException {
|
||||
try {
|
||||
project.eSetDeliver(false);
|
||||
MigrationTaskSetting migrationTaskSetting = null;
|
||||
if (input != null) {
|
||||
migrationTaskSetting = new ObjectMapper().readValue(input, MigrationTaskSetting.class);
|
||||
}
|
||||
if (migrationTaskSetting != null) {
|
||||
MigrationTask fakeTask = createFakeMigrationTask();
|
||||
List<MigrationTask> allRealTask = new ArrayList<MigrationTask>();
|
||||
MigrationTask existingFakeTask = null;
|
||||
for (int i = 0; i < project.getMigrationTask().size(); i++) {
|
||||
MigrationTask task = (MigrationTask) project.getMigrationTask().get(i);
|
||||
if (!StringUtils.equals(fakeTask.getId(), task.getId())) {
|
||||
allRealTask.add(task);
|
||||
if (StringUtils.equals(fakeTask.getId(), task.getId())) {
|
||||
existingFakeTask = task;
|
||||
break;
|
||||
}
|
||||
}
|
||||
project.getMigrationTask().removeAll(allRealTask);
|
||||
// remove all the migrations from the project
|
||||
project.getMigrationTask().clear();
|
||||
if (existingFakeTask != null) {
|
||||
// keep only the fake migration task of 7.1.1 with new migration index
|
||||
// re-use the same instance to make sure we keep the same emf id.
|
||||
project.getMigrationTask().add(existingFakeTask);
|
||||
}
|
||||
Set<String> tasksIds = new HashSet<>();
|
||||
Iterator<MigrationTaskJson> it = migrationTaskSetting.getMigrationTaskList().iterator();
|
||||
while (it.hasNext()) { // remove duplicates to fix issues found in TUP-22735
|
||||
MigrationTaskJson task = it.next();
|
||||
if (tasksIds.contains(task.getId())) {
|
||||
it.remove();
|
||||
}
|
||||
tasksIds.add(task.getId());
|
||||
}
|
||||
project.getMigrationTasks().clear();
|
||||
if (migrationTaskSetting.getMigrationTaskList() != null) {
|
||||
for (MigrationTaskJson json : migrationTaskSetting.getMigrationTaskList()) {
|
||||
@@ -305,6 +325,7 @@ public class ProjectDataJsonProvider {
|
||||
} catch (Exception e) {
|
||||
throw new PersistenceException(e);
|
||||
} finally {
|
||||
project.eSetDeliver(true);
|
||||
closeInputStream(input);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
<dbType type="DOUBLE PRECISION" ignoreLen="true" ignorePre="true"/>
|
||||
<dbType type="DATE" ignoreLen="true" ignorePre="true"/>
|
||||
<dbType type="TIMESTAMP" ignoreLen="true" ignorePre="true"/>
|
||||
<dbType type="INTERVAL DAY TO SECOND" ignoreLen="true" ignorePre="true"/>
|
||||
<dbType type="INTERVAL YEAR TO MONTH" ignoreLen="true" ignorePre="true"/>
|
||||
<dbType type="BINARY" ignorePre="true"/>
|
||||
<dbType type="VARBINARY" ignorePre="true" />
|
||||
<dbType type="NUMERIC" defaultLength="10" defaultPrecision="5"/>
|
||||
@@ -46,6 +48,8 @@
|
||||
<talendType type="id_Date">
|
||||
<dbType type="DATE" default="true" />
|
||||
<dbType type="TIMESTAMP"/>
|
||||
<dbType type="INTERVAL DAY TO SECOND"/>
|
||||
<dbType type="INTERVAL YEAR TO MONTH"/>
|
||||
</talendType>
|
||||
<talendType type="id_Double">
|
||||
<dbType type="DOUBLE PRECISION" default="true" />
|
||||
@@ -121,6 +125,12 @@
|
||||
<dbType type="TIMESTAMP">
|
||||
<talendType type="id_Date" default="true" />
|
||||
</dbType>
|
||||
<dbType type="INTERVAL DAY TO SECOND">
|
||||
<talendType type="id_Date" default="true" />
|
||||
</dbType>
|
||||
<dbType type="INTERVAL YEAR TO MONTH">
|
||||
<talendType type="id_Date" default="true" />
|
||||
</dbType>
|
||||
<dbType type="BINARY">
|
||||
<talendType type="id_byte[]" default="true" />
|
||||
</dbType>
|
||||
|
||||
@@ -163,9 +163,9 @@ public enum EDatabaseVersion4Drivers {
|
||||
MAPRDB(new DbVersion4Drivers(EDatabaseTypeName.MAPRDB, new String[] {})),
|
||||
|
||||
REDSHIFT(new DbVersion4Drivers(EDatabaseTypeName.REDSHIFT, "redshift", "REDSHIFT", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"redshiftJDBC42-no-awssdk-1.2.16.1027.jar")), //$NON-NLS-1$
|
||||
"redshift-jdbc42-no-awssdk-1.2.20.1043.jar")), //$NON-NLS-1$
|
||||
REDSHIFT_SSO(new DbVersion4Drivers(EDatabaseTypeName.REDSHIFT_SSO, "redshift sso", "REDSHIFT_SSO", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
new String[] { "redshiftJDBC42-no-awssdk-1.2.16.1027.jar", "aws-java-sdk-1.11.406.jar", "jackson-core-2.9.5.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
new String[] { "redshift-jdbc42-no-awssdk-1.2.20.1043.jar", "aws-java-sdk-1.11.406.jar", "jackson-core-2.9.5.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"jackson-databind-2.9.5.jar", "jackson-annotations-2.9.0.jar", "httpcore-4.4.9.jar", "httpclient-4.5.5.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$//$NON-NLS-4$
|
||||
"joda-time-2.8.1.jar", "commons-logging-1.1.3.jar" })), //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
|
||||
@@ -55,6 +55,8 @@ public interface IComponentsFactory {
|
||||
*/
|
||||
public Set<IComponent> getComponents();
|
||||
|
||||
public boolean isInitialising();
|
||||
|
||||
/**
|
||||
* Get a readonly components collection to avoid ConcurrentModificationException caused by multiple thread
|
||||
* access;<br/>
|
||||
|
||||
@@ -162,7 +162,8 @@ public final class MetadataToolHelper {
|
||||
if (itemId == null || itemId.equals("")) { //$NON-NLS-1$
|
||||
return null;
|
||||
}
|
||||
final IProxyRepositoryFactory proxyRepositoryFactory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
|
||||
final IProxyRepositoryFactory proxyRepositoryFactory =
|
||||
CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
|
||||
try {
|
||||
final IRepositoryViewObject lastVersion = proxyRepositoryFactory.getLastVersion(itemId);
|
||||
if (lastVersion != null) {
|
||||
@@ -280,7 +281,8 @@ public final class MetadataToolHelper {
|
||||
|
||||
private static boolean isAllowSpecificCharacters() {
|
||||
IEclipsePreferences coreUIPluginNode = new InstanceScope().getNode(ITalendCorePrefConstants.CoreUIPlugin_ID);
|
||||
return coreUIPluginNode.getBoolean(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS, false);
|
||||
return coreUIPluginNode
|
||||
.getBoolean(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -317,8 +319,8 @@ public final class MetadataToolHelper {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isKeyword
|
||||
|| org.apache.commons.lang.StringUtils.countMatches(returnedColumnName, underLine) > (originalColumnName.length() / 2)) {
|
||||
if (isKeyword || org.apache.commons.lang.StringUtils
|
||||
.countMatches(returnedColumnName, underLine) > (originalColumnName.length() / 2)) {
|
||||
returnedColumnName = "Column" + index; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
@@ -440,9 +442,9 @@ public final class MetadataToolHelper {
|
||||
*
|
||||
*
|
||||
*/
|
||||
private static String mapSpecialChar(String columnName) {
|
||||
private static String mapSpecialChar(String columnName) {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRoutinesService.class)) {
|
||||
IRoutinesService service = (IRoutinesService) GlobalServiceRegister.getDefault().getService(IRoutinesService.class);
|
||||
IRoutinesService service = GlobalServiceRegister.getDefault().getService(IRoutinesService.class);
|
||||
if (service != null) {
|
||||
Vector map = service.getAccents();
|
||||
map.setElementAt("AE", 4);//$NON-NLS-1$
|
||||
@@ -491,13 +493,15 @@ public final class MetadataToolHelper {
|
||||
*/
|
||||
public static void validateSchema(String value) {
|
||||
if (value == null) {
|
||||
MessageDialog.openError(Display.getCurrent().getActiveShell(),
|
||||
Messages.getString("MetadataTool.nullValue"), Messages.getString("MetadataTool.nameNull")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
MessageDialog
|
||||
.openError(Display.getCurrent().getActiveShell(), Messages.getString("MetadataTool.nullValue"), //$NON-NLS-1$
|
||||
Messages.getString("MetadataTool.nameNull")); //$NON-NLS-1$
|
||||
return;
|
||||
}
|
||||
if (!isValidSchemaName(value)) {
|
||||
MessageDialog.openError(Display.getCurrent().getActiveShell(),
|
||||
Messages.getString("MetadataTool.invalid"), Messages.getString("MetadataTool.schemaInvalid")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
MessageDialog
|
||||
.openError(Display.getCurrent().getActiveShell(), Messages.getString("MetadataTool.invalid"), //$NON-NLS-1$
|
||||
Messages.getString("MetadataTool.schemaInvalid")); //$NON-NLS-1$
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -533,8 +537,9 @@ public final class MetadataToolHelper {
|
||||
public static void checkSchema(Shell shell, KeyEvent event) {
|
||||
if ((!Character.isIdentifierIgnorable(event.character)) && (event.character == ' ')) {
|
||||
event.doit = false;
|
||||
MessageDialog.openError(shell,
|
||||
Messages.getString("MetadataTool.invalidChar"), Messages.getString("MetadataTool.errorMessage")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
MessageDialog
|
||||
.openError(shell, Messages.getString("MetadataTool.invalidChar"), //$NON-NLS-1$
|
||||
Messages.getString("MetadataTool.errorMessage")); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
@@ -579,6 +584,11 @@ public final class MetadataToolHelper {
|
||||
|
||||
public static void copyTable(IMetadataTable source, IMetadataTable target, String targetDbms,
|
||||
boolean avoidUsedColumnsFromInput) {
|
||||
copyTable(source, target, targetDbms, avoidUsedColumnsFromInput, false);
|
||||
}
|
||||
|
||||
public static void copyTable(IMetadataTable source, IMetadataTable target, String targetDbms,
|
||||
boolean avoidUsedColumnsFromInput, boolean withCustoms) {
|
||||
if (source == null || target == null) {
|
||||
return;
|
||||
}
|
||||
@@ -598,10 +608,11 @@ public final class MetadataToolHelper {
|
||||
List<IMetadataColumn> columnsTAdd = new ArrayList<IMetadataColumn>();
|
||||
for (IMetadataColumn column : source.getListColumns(!avoidUsedColumnsFromInput)) {
|
||||
IMetadataColumn targetColumn = target.getColumn(column.getLabel());
|
||||
IMetadataColumn newTargetColumn = column.clone();
|
||||
IMetadataColumn newTargetColumn = column.clone(withCustoms);
|
||||
if (targetColumn == null) {
|
||||
columnsTAdd.add(newTargetColumn);
|
||||
newTargetColumn.setReadOnly(target.isReadOnly() || readOnlycolumns.contains(newTargetColumn.getLabel()));
|
||||
newTargetColumn
|
||||
.setReadOnly(target.isReadOnly() || readOnlycolumns.contains(newTargetColumn.getLabel()));
|
||||
} else {
|
||||
if (!targetColumn.isReadOnly()) {
|
||||
target.getListColumns().remove(targetColumn);
|
||||
@@ -614,12 +625,13 @@ public final class MetadataToolHelper {
|
||||
target.getListColumns().addAll(columnsTAdd);
|
||||
target.sortCustomColumns();
|
||||
target.setLabel(source.getLabel());
|
||||
List<String> originalColumnsList = null;
|
||||
if (source.getOriginalColumns() != null) {
|
||||
originalColumnsList = new ArrayList<String>();
|
||||
originalColumnsList.addAll(source.getOriginalColumns());
|
||||
}
|
||||
target.setOriginalColumns(originalColumnsList);
|
||||
target.setOriginalColumns(source.getOriginalColumns());
|
||||
// List<String> originalColumnsList = null;
|
||||
// if (source.getOriginalColumns() != null) {
|
||||
// originalColumnsList = new ArrayList<String>();
|
||||
// originalColumnsList.addAll(source.getOriginalColumns());
|
||||
// }
|
||||
// target.setOriginalColumns(originalColumnsList);
|
||||
Map<String, String> targetProperties = target.getAdditionalProperties();
|
||||
Map<String, String> sourceProperties = source.getAdditionalProperties();
|
||||
for (Entry<String, String> entry : sourceProperties.entrySet()) {
|
||||
@@ -627,7 +639,8 @@ public final class MetadataToolHelper {
|
||||
}
|
||||
}
|
||||
|
||||
public static void copyTable(List<IMetadataColumn> sourceColumns, IMetadataTable target, List<IMetadataColumn> targetColumns) {
|
||||
public static void copyTable(List<IMetadataColumn> sourceColumns, IMetadataTable target,
|
||||
List<IMetadataColumn> targetColumns) {
|
||||
if (sourceColumns == null || target == null || targetColumns == null) {
|
||||
return;
|
||||
}
|
||||
@@ -649,7 +662,8 @@ public final class MetadataToolHelper {
|
||||
IMetadataColumn newTargetColumn = column.clone();
|
||||
if (targetColumn == null) {
|
||||
columnsTAdd.add(newTargetColumn);
|
||||
newTargetColumn.setReadOnly(target.isReadOnly() || readOnlycolumns.contains(newTargetColumn.getLabel()));
|
||||
newTargetColumn
|
||||
.setReadOnly(target.isReadOnly() || readOnlycolumns.contains(newTargetColumn.getLabel()));
|
||||
} else {
|
||||
if (!targetColumn.isReadOnly()) {
|
||||
target.getListColumns().remove(targetColumn);
|
||||
@@ -704,7 +718,8 @@ public final class MetadataToolHelper {
|
||||
IMetadataColumn newTargetColumn = column.clone();
|
||||
if (targetColumn == null) {
|
||||
columnsTAdd.add(newTargetColumn);
|
||||
newTargetColumn.setReadOnly(target.isReadOnly() || readOnlycolumns.contains(newTargetColumn.getLabel()));
|
||||
newTargetColumn
|
||||
.setReadOnly(target.isReadOnly() || readOnlycolumns.contains(newTargetColumn.getLabel()));
|
||||
} else {
|
||||
if (!targetColumn.isReadOnly()) {
|
||||
target.getListColumns().remove(targetColumn);
|
||||
@@ -750,9 +765,9 @@ public final class MetadataToolHelper {
|
||||
}
|
||||
Set<MetadataTable> tables = null;
|
||||
IGenericWizardService wizardService = null;
|
||||
if (!CommonsPlugin.isHeadless() && GlobalServiceRegister.getDefault().isServiceRegistered(IGenericWizardService.class)) {
|
||||
wizardService = (IGenericWizardService) GlobalServiceRegister.getDefault()
|
||||
.getService(IGenericWizardService.class);
|
||||
if (!CommonsPlugin.isHeadless()
|
||||
&& GlobalServiceRegister.getDefault().isServiceRegistered(IGenericWizardService.class)) {
|
||||
wizardService = GlobalServiceRegister.getDefault().getService(IGenericWizardService.class);
|
||||
}
|
||||
if (wizardService != null && wizardService.isGenericConnection(connection)) {
|
||||
List<MetadataTable> metadataTables = wizardService.getMetadataTables(connection);
|
||||
@@ -778,7 +793,8 @@ public final class MetadataToolHelper {
|
||||
* @param tableName
|
||||
* @return
|
||||
*/
|
||||
public static MetadataTable getMetadataTableFromSAPFunction(String connectionId, String functionId, String tableName) {
|
||||
public static MetadataTable getMetadataTableFromSAPFunction(String connectionId, String functionId,
|
||||
String tableName) {
|
||||
org.talend.core.model.metadata.builder.connection.Connection connection;
|
||||
if (connectionId != null) {
|
||||
connection = getConnectionFromRepository(connectionId);
|
||||
@@ -850,7 +866,8 @@ public final class MetadataToolHelper {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static org.talend.core.model.metadata.builder.connection.Connection getConnectionFromRepository(String metaRepositoryid) {
|
||||
public static org.talend.core.model.metadata.builder.connection.Connection
|
||||
getConnectionFromRepository(String metaRepositoryid) {
|
||||
ConnectionItem connItem = getConnectionItemFromRepository(metaRepositoryid);
|
||||
if (connItem != null) {
|
||||
return connItem.getConnection();
|
||||
@@ -916,9 +933,9 @@ public final class MetadataToolHelper {
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// private static final String VALIDATE_PATTERN_NAME = "^[a-zA-Z_][a-zA-Z_0-9]*$"; //$NON-NLS-1$
|
||||
// private static final String VALIDATE_PATTERN_NAME = "^[a-zA-Z_][a-zA-Z_0-9]*$"; //$NON-NLS-1$
|
||||
|
||||
// private static final String VALIDATE_PATTERN_SCHEMA_NAME = "^[a-zA-Z_0-9][a-zA-Z_0-9]*$"; //$NON-NLS-1$
|
||||
// private static final String VALIDATE_PATTERN_SCHEMA_NAME = "^[a-zA-Z_0-9][a-zA-Z_0-9]*$"; //$NON-NLS-1$
|
||||
|
||||
public static List<ColumnNameChanged> getColumnNameChanged(IMetadataTable oldTable, IMetadataTable newTable) {
|
||||
List<ColumnNameChanged> columnNameChanged = new ArrayList<ColumnNameChanged>();
|
||||
@@ -949,8 +966,9 @@ public final class MetadataToolHelper {
|
||||
IMetadataColumn clonedColumn = getColumn(newTable, originalColumn, oldIndex);
|
||||
if (clonedColumn != null) {
|
||||
if (!originalColumn.getLabel().equals(clonedColumn.getLabel())) {
|
||||
columnNameChanged.add(new ColumnNameChangedExt(changedNode, originalColumn.getLabel(), clonedColumn
|
||||
.getLabel()));
|
||||
columnNameChanged
|
||||
.add(new ColumnNameChangedExt(changedNode, originalColumn.getLabel(),
|
||||
clonedColumn.getLabel()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1099,8 +1117,8 @@ public final class MetadataToolHelper {
|
||||
initilializeNewSchema(metadataTable, mappingParameter, param);
|
||||
if (!param.getDefaultValues().isEmpty()) {
|
||||
Schema schema = (Schema) param.getDefaultValues().get(0).getDefaultValue();
|
||||
org.talend.core.model.metadata.builder.connection.MetadataTable defaultEmfTable = MetadataToolAvroHelper
|
||||
.convertFromAvro(schema);
|
||||
org.talend.core.model.metadata.builder.connection.MetadataTable defaultEmfTable =
|
||||
MetadataToolAvroHelper.convertFromAvro(schema);
|
||||
IMetadataTable defaultTable = MetadataToolHelper.convert(defaultEmfTable);
|
||||
for (IMetadataColumn currentColumn : metadataTable.getListColumns()) {
|
||||
IMetadataColumn defaultColumn = defaultTable.getColumn(currentColumn.getLabel());
|
||||
@@ -1130,8 +1148,8 @@ public final class MetadataToolHelper {
|
||||
Object schemaObj = properties.getValuedProperty(param.getName()).getValue();
|
||||
if (schemaObj instanceof Schema) {
|
||||
Schema schema = (Schema) schemaObj;
|
||||
org.talend.core.model.metadata.builder.connection.MetadataTable emfTable = MetadataToolAvroHelper
|
||||
.convertFromAvro(schema);
|
||||
org.talend.core.model.metadata.builder.connection.MetadataTable emfTable =
|
||||
MetadataToolAvroHelper.convertFromAvro(schema);
|
||||
IMetadataTable newTable = MetadataToolHelper.convert(emfTable);
|
||||
initilializeSchema(metadataTable, newTable, mappingParameter, node);
|
||||
}
|
||||
@@ -1291,8 +1309,8 @@ public final class MetadataToolHelper {
|
||||
if (connection != null) {
|
||||
IRepositoryViewObject lastVersion = null;
|
||||
if (connection.getContextId() != null) {
|
||||
IRepositoryService service = (IRepositoryService) GlobalServiceRegister.getDefault().getService(
|
||||
IRepositoryService.class);
|
||||
IRepositoryService service =
|
||||
GlobalServiceRegister.getDefault().getService(IRepositoryService.class);
|
||||
lastVersion = service.getProxyRepositoryFactory().getLastVersion(connection.getContextId());
|
||||
}
|
||||
if (lastVersion != null) {
|
||||
@@ -1386,7 +1404,7 @@ public final class MetadataToolHelper {
|
||||
}
|
||||
|
||||
public static IMetadataTable convert(MetadataTable old) {
|
||||
ICoreService coreService = (ICoreService) GlobalServiceRegister.getDefault().getService(ICoreService.class);
|
||||
ICoreService coreService = GlobalServiceRegister.getDefault().getService(ICoreService.class);
|
||||
IMetadataTable result = new org.talend.core.model.metadata.MetadataTable();
|
||||
result.setComment(old.getComment());
|
||||
result.setId(old.getId());
|
||||
@@ -1406,7 +1424,8 @@ public final class MetadataToolHelper {
|
||||
}
|
||||
|
||||
for (Object o : old.getColumns()) {
|
||||
org.talend.core.model.metadata.builder.connection.MetadataColumn column = (org.talend.core.model.metadata.builder.connection.MetadataColumn) o;
|
||||
org.talend.core.model.metadata.builder.connection.MetadataColumn column =
|
||||
(org.talend.core.model.metadata.builder.connection.MetadataColumn) o;
|
||||
IMetadataColumn newColumn = new org.talend.core.model.metadata.MetadataColumn();
|
||||
columns.add(newColumn);
|
||||
newColumn.setComment(column.getComment());
|
||||
@@ -1420,7 +1439,7 @@ public final class MetadataToolHelper {
|
||||
}
|
||||
newColumn.setLabel(label2);
|
||||
newColumn.setPattern(column.getPattern());
|
||||
|
||||
|
||||
if (column.getLength() < 0) {
|
||||
newColumn.setLength(null);
|
||||
} else {
|
||||
@@ -1443,12 +1462,12 @@ public final class MetadataToolHelper {
|
||||
newColumn.setCustom(Boolean.valueOf(tv.getValue()));
|
||||
} else if (DiSchemaConstants.TALEND6_IS_READ_ONLY.equals(additionalTag)) {
|
||||
newColumn.setReadOnly(Boolean.valueOf(tv.getValue()));
|
||||
}else {
|
||||
} else {
|
||||
newColumn.getAdditionalField().put(additionalTag, tv.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
newColumn.setNullable(column.isNullable());
|
||||
if (column.getPrecision() < 0) {
|
||||
newColumn.setPrecision(null);
|
||||
|
||||
@@ -308,8 +308,19 @@ public abstract class AbstractNode implements INode {
|
||||
return mapMerge.keySet().iterator().next().getSubProcessStartNode(withConditions);
|
||||
}
|
||||
}
|
||||
if ((getCurrentActiveLinksNbInput(EConnectionType.MAIN) == 0)
|
||||
&& !checkIfCurrentActiveLinksIsLookup()) {
|
||||
if (getCurrentActiveLinksNbInput(EConnectionType.MAIN) == 0) {
|
||||
IConnection aheadConnection = null;
|
||||
for (IConnection inConnection : getIncomingConnections()) {
|
||||
// refer to DataProcess.checkFlowRefLink() added RUN_AFTER for incoming connection
|
||||
if (inConnection.isActivate()
|
||||
&& inConnection.getLineStyle().getId() == EConnectionType.RUN_AFTER.getId()) {
|
||||
aheadConnection = inConnection;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (aheadConnection != null) {
|
||||
return aheadConnection.getSource().getDesignSubjobStartNode();
|
||||
}
|
||||
return this; // main branch here, so we got the correct sub
|
||||
// process start.
|
||||
}
|
||||
@@ -348,27 +359,6 @@ public abstract class AbstractNode implements INode {
|
||||
return nb;
|
||||
}
|
||||
|
||||
private boolean checkIfCurrentActiveLinksIsLookup() {
|
||||
boolean flag = false;
|
||||
int input = 0;
|
||||
for (IConnection inConnection : getIncomingConnections()) {
|
||||
// refer to DataProcess.checkFlowRefLink() added RUN_AFTER for incoming connection
|
||||
if (inConnection.isActivate() && inConnection.getLineStyle().getId() == EConnectionType.RUN_AFTER.getId()) {
|
||||
input++;
|
||||
}
|
||||
}
|
||||
// check if run_after is for lookup
|
||||
if (input > 0) {
|
||||
for (IConnection outConnection : getOutgoingConnections()) {
|
||||
if (outConnection.isActivate() && outConnection.getLineStyle().getId() == EConnectionType.FLOW_REF.getId()) {
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
||||
@@ -115,6 +115,8 @@ public enum EParameterFieldType {
|
||||
PATTERN_PROPERTY, // yyin, added TDQ-13437
|
||||
|
||||
UNIFIED_COMPONENTS,
|
||||
|
||||
LANGUAGE_CLOSED_LIST,
|
||||
|
||||
TACOKIT_INPUT_SCHEMA,
|
||||
TACOKIT_GUESS_SCHEMA,
|
||||
|
||||
@@ -1238,6 +1238,9 @@ public class RelationshipItemBuilder {
|
||||
}
|
||||
|
||||
public void removeItemRelations(Relation relation, boolean save) {
|
||||
if (!loaded) {
|
||||
loadRelations();
|
||||
}
|
||||
Map<Relation, Set<Relation>> itemRelations = getCurrentProjectItemsRelations();
|
||||
relation = findPossibleKeyObject(itemRelations.keySet(), relation);
|
||||
if (itemRelations != null && itemRelations.containsKey(relation)) {
|
||||
|
||||
@@ -62,6 +62,8 @@ public interface TalendProcessArgumentConstant {
|
||||
|
||||
static final String ARG_LAUNCHER_NAME = "LAUNCHER_NAME";
|
||||
|
||||
static final String ARG_AVOID_BRANCH_NAME = "AVOID_BRANCH_NAME";
|
||||
|
||||
static final String CMD_ARG_STATS_PORT_PARAM = "stat_port";
|
||||
|
||||
static final String CMD_ARG_TRACE_PORT_PARAM = "trace_port";
|
||||
|
||||
@@ -35,7 +35,7 @@ import org.talend.repository.model.IRepositoryService;
|
||||
/**
|
||||
* DOC ggu class global comment. Detailled comment
|
||||
*/
|
||||
public final class ProjectPreferenceManager {
|
||||
public class ProjectPreferenceManager {
|
||||
|
||||
/**
|
||||
* copied from EclipsePreferences.
|
||||
@@ -61,11 +61,11 @@ public final class ProjectPreferenceManager {
|
||||
static {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
|
||||
runProcessService =
|
||||
(IRunProcessService) GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
|
||||
GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
|
||||
}
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRepositoryService.class)) {
|
||||
repositoryService =
|
||||
(IRepositoryService) GlobalServiceRegister.getDefault().getService(IRepositoryService.class);
|
||||
GlobalServiceRegister.getDefault().getService(IRepositoryService.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ public final class ProjectPreferenceManager {
|
||||
}
|
||||
}
|
||||
|
||||
private void init(IProject project, String fileName) {
|
||||
protected void init(IProject project, String fileName) {
|
||||
Assert.isNotNull(fileName);
|
||||
Assert.isNotNull(project);
|
||||
this.qualifier = fileName;
|
||||
@@ -148,6 +148,7 @@ public final class ProjectPreferenceManager {
|
||||
/**
|
||||
* @deprecated because don't support the default value setting, so use store directly.
|
||||
*/
|
||||
@Deprecated
|
||||
private IEclipsePreferences getQulifierPreference() {
|
||||
return getProjectScope().getNode(getQualifier());
|
||||
}
|
||||
|
||||
@@ -1,185 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2018 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.runtime.util;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
||||
import org.eclipse.core.runtime.preferences.InstanceScope;
|
||||
import org.eclipse.jdt.launching.IVMInstall;
|
||||
import org.eclipse.jdt.launching.IVMInstall2;
|
||||
import org.eclipse.jdt.launching.JavaRuntime;
|
||||
import org.eclipse.jdt.launching.environments.IExecutionEnvironment;
|
||||
import org.eclipse.jdt.launching.environments.IExecutionEnvironmentsManager;
|
||||
import org.talend.commons.utils.generation.JavaUtils;
|
||||
|
||||
/**
|
||||
* created by nrousseau on Jun 13, 2015 Detailled comment
|
||||
*
|
||||
*/
|
||||
public class JavaHomeUtil {
|
||||
|
||||
/**
|
||||
* Initialize Java Home to the preferences if needed only.<br>
|
||||
* This will take take first JDK8 if existing.<br>
|
||||
* If not, take JDK7.<br>
|
||||
* If no any JDK found, it will let eclipse set the default one.
|
||||
*
|
||||
* @throws CoreException
|
||||
*/
|
||||
public static void initializeJavaHome() throws CoreException {
|
||||
IEclipsePreferences pref = InstanceScope.INSTANCE.getNode("org.eclipse.jdt.launching"); //$NON-NLS-1$
|
||||
String defaultVM = pref.get("org.eclipse.jdt.launching.PREF_DEFAULT_ENVIRONMENTS_XML", ""); //$NON-NLS-1$//$NON-NLS-2$
|
||||
boolean needSetupJVM = false;
|
||||
if (!"".equals(defaultVM)) { //$NON-NLS-1$
|
||||
if (!isJDKSetup()) {
|
||||
// current JVM is not a JDK, means need to change the current setup
|
||||
needSetupJVM = true;
|
||||
} else if (isSetJdkHomeVariable() && !getJDKHomeVariable().equals(getCurrentJavaHomeString())) {
|
||||
needSetupJVM = true;
|
||||
}
|
||||
} else {
|
||||
needSetupJVM = true;
|
||||
}
|
||||
if (needSetupJVM) {
|
||||
IVMInstall currentVM = JavaRuntime.getDefaultVMInstall();
|
||||
if (isSetJdkHomeVariable()) {
|
||||
if (currentVM != null) {
|
||||
File installLocation = new File(getJDKHomeVariable());
|
||||
currentVM.setInstallLocation(installLocation);
|
||||
currentVM.setName(installLocation.getName());
|
||||
}
|
||||
} else {
|
||||
boolean jkd8 = installJDKForEnvironment("JavaSE-1.8");//$NON-NLS-1$
|
||||
if (!jkd8) {
|
||||
boolean jdk7 = installJDKForEnvironment("JavaSE-1.7"); //$NON-NLS-1$
|
||||
if (!jdk7) {
|
||||
if (isSetJavaHomeVariable()) {
|
||||
if (currentVM != null) {
|
||||
File installLocation = new File(getJavaHomeVariable());
|
||||
currentVM.setInstallLocation(installLocation);
|
||||
currentVM.setName(installLocation.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Only for TUJ to setup JDK version
|
||||
* Should invoke after initializeJavaHome()
|
||||
*/
|
||||
public static String getSpecifiedJavaVersion() {
|
||||
if (isSetJdkHomeVariable()) {
|
||||
IVMInstall currentVM = JavaRuntime.getDefaultVMInstall();
|
||||
if (currentVM instanceof IVMInstall2) {
|
||||
return JavaUtils.getCompilerCompliance((IVMInstall2) currentVM, null);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isSetJdkHomeVariable() {
|
||||
String jdkHomeValue = getJDKHomeVariable();
|
||||
return jdkHomeValue != null && !"".equals(jdkHomeValue); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public static String getJDKHomeVariable() {
|
||||
String jdkHome = System.getProperty("jdk.home"); //$NON-NLS-1$
|
||||
|
||||
if (jdkHome == null || "".equals(jdkHome)) { //$NON-NLS-1$
|
||||
jdkHome = getJDKHomeFromEclipseVm();
|
||||
}
|
||||
|
||||
if (jdkHome == null || "".equals(jdkHome)) { //$NON-NLS-1$
|
||||
jdkHome = System.getenv("JDK_HOME"); //$NON-NLS-1$
|
||||
}
|
||||
return jdkHome;
|
||||
}
|
||||
|
||||
private static String getJDKHomeFromEclipseVm() {
|
||||
String eclipseVm = System.getProperty("eclipse.vm"); //$NON-NLS-1$
|
||||
if (eclipseVm != null && !"".equals(eclipseVm)) {
|
||||
File javaexe = new File(eclipseVm);
|
||||
if (javaexe.exists()) {
|
||||
String jdk = getJDKPath(javaexe);
|
||||
if (jdk != null && new File(jdk, "lib/tools.jar").exists()) {//$NON-NLS-1$
|
||||
return jdk;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static String getJDKPath(File file) {
|
||||
if (file == null) {
|
||||
return null;
|
||||
}
|
||||
if ("bin".equals(file.getName())) {//$NON-NLS-1$
|
||||
return file.getParent();
|
||||
} else {
|
||||
return getJDKPath(file.getParentFile());
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isSetJavaHomeVariable() {
|
||||
String javaHomeValue = getJavaHomeVariable();
|
||||
return javaHomeValue != null && !"".equals(javaHomeValue); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public static String getJavaHomeVariable() {
|
||||
return System.getenv("JAVA_HOME"); //$NON-NLS-1$
|
||||
|
||||
}
|
||||
|
||||
public static boolean isJDKSetup() {
|
||||
if (getCurrentJavaHomeFile() == null) {
|
||||
return false;
|
||||
}
|
||||
return new File(getCurrentJavaHomeFile(), "lib/tools.jar").exists(); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public static File getCurrentJavaHomeFile() {
|
||||
IVMInstall currentVM = JavaRuntime.getDefaultVMInstall();
|
||||
if (currentVM == null) {
|
||||
return null;
|
||||
}
|
||||
return currentVM.getInstallLocation();
|
||||
}
|
||||
|
||||
public static String getCurrentJavaHomeString() {
|
||||
IVMInstall currentVM = JavaRuntime.getDefaultVMInstall();
|
||||
if (currentVM == null) {
|
||||
return null;
|
||||
}
|
||||
return currentVM.getInstallLocation().getAbsolutePath();
|
||||
}
|
||||
|
||||
private static boolean installJDKForEnvironment(String environmentName) throws CoreException {
|
||||
IExecutionEnvironmentsManager manager = JavaRuntime.getExecutionEnvironmentsManager();
|
||||
IExecutionEnvironment environment = manager.getEnvironment(environmentName);
|
||||
for (IVMInstall install : environment.getCompatibleVMs()) {
|
||||
if (new File(install.getInstallLocation(), "lib/tools.jar").exists()) {
|
||||
// JDK found, install it !;
|
||||
JavaRuntime.setDefaultVMInstall(install, new NullProgressMonitor());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -36,6 +36,7 @@ import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.IRepositoryEditorInput;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.NodeType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ProcessType;
|
||||
import org.talend.repository.model.RepositoryNode;
|
||||
|
||||
@@ -131,5 +132,7 @@ public interface ITestContainerProviderService extends IService {
|
||||
Set<ModuleNeeded> getAllJobTestcaseModules(ProcessItem item) throws PersistenceException;
|
||||
|
||||
public void deleteDataFiles(Object deleteObj);
|
||||
|
||||
public List<NodeType> getOriginalNodes(ProcessType process);
|
||||
|
||||
}
|
||||
|
||||
@@ -52,10 +52,6 @@ public class ContextAutoResizeTextPainter extends TextPainter {
|
||||
changeBackgroundColor = isChange;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean performRowResize(int contentHeight, Rectangle rectangle) {
|
||||
return (contentHeight != rectangle.height) && (this.calculateByTextHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setNewMinLength(ILayerCell cell, int contentWidth) {
|
||||
|
||||
@@ -72,10 +72,20 @@ public class JavaSimpleDateFormatProposalProvider implements IContentProposalPro
|
||||
"\"dd/MM/yyyy\" : common format", "dd/MM/yyyy", "Date\n Examples : \n 01/01/2007\n 31/12/2007"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
new DateFormatContentProposal(
|
||||
"\"MM/dd/yyyy\" : common format", "MM/dd/yyyy", "Date\n Examples : \n 01/01/2007\n 12/31/2007"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
new DateFormatContentProposal("\"yyyy-MM-dd'T'HH:mm:ss\" : common format", "yyyy-MM-dd'T'HH:mm:ss", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
new DateFormatContentProposal(
|
||||
"\"yyyy-MM-dd\" : common format", "yyyy-MM-dd", "Date\n Examples : \n 2007-01-01\n 2007-12-31"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
new DateFormatContentProposal("\"yyyy-MM-dd HH:mm:ss\" : common format", "yyyy-MM-dd HH:mm:ss",
|
||||
"Date\n Examples : \n 2014-08-19 07:41:35\n 2014-12-31 07:41:35"),//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
new DateFormatContentProposal("\"yyyy-MM-dd'T'HH:mm:ss\" : common format", "yyyy-MM-dd'T'HH:mm:ss",
|
||||
"Date\n Examples : \n 2007-01-01T00:00:00\n 2007-12-31T23:59:59"), // hywang //$NON-NLS-1$
|
||||
new DateFormatContentProposal("\"yyyy-MM-dd'T'HH:mm:ss'000Z'\" : common format", "yyyy-MM-dd'T'HH:mm:ss'000Z'", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"Date\n Examples : \n 2007-01-01T00:00:00000Z\n 2007-12-31T23:59:59000Z"), // hywang //$NON-NLS-1$
|
||||
new DateFormatContentProposal("\"yyyy-MM-dd'T'HH:mm:ss.SSSSSS\" : common format", "yyyy-MM-dd'T'HH:mm:ss.SSSSSS",
|
||||
"Date\n Examples : \n 2019-04-18T09:47:49.568095"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
new DateFormatContentProposal("\"yyyy-MM-dd HH:mm:ss zzz\" : common format", "yyyy-MM-dd HH:mm:ss zzz", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"Date\n Examples : \n 2008-01-01 00:00:00 UTC\n 2008-12-31 04:08:00 PDT"),
|
||||
new DateFormatContentProposal("\"yyyy-MM-dd HH:mm:ss.SSSXXX\" : common format", "yyyy-MM-dd HH:mm:ss.SSSXXX", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"Date\n Examples : \n 2014-08-19 07:41:35.220 -05:00"),
|
||||
new DateFormatContentProposal(
|
||||
"\"HH:mm:ss\" : common format", "HH:mm:ss", "Date\n Examples : \n 00:00:00 \n 23:59:59"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
new DateFormatContentProposal("\"yy\" : Year (00-99)", "yy", "Year \nExamples : \n 98\n 07"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
|
||||
@@ -21,7 +21,8 @@ Require-Bundle: org.eclipse.debug.core,
|
||||
org.talend.core.repository,
|
||||
org.talend.libraries.apache,
|
||||
org.talend.core.runtime,
|
||||
org.talend.utils
|
||||
org.talend.utils,
|
||||
org.talend.libraries.dom4j-jaxen
|
||||
Bundle-Vendor: .Talend SA.
|
||||
Export-Package: org.talend.core,
|
||||
org.talend.core.branding,
|
||||
@@ -53,6 +54,4 @@ Export-Package: org.talend.core,
|
||||
org.talend.core.services.resource,
|
||||
org.talend.core.views,
|
||||
org.talend.designer.runprocess
|
||||
Import-Package: org.apache.commons.collections4.map,
|
||||
org.dom4j,
|
||||
org.dom4j.io
|
||||
Import-Package: org.apache.commons.collections4.map
|
||||
|
||||
@@ -15,10 +15,11 @@ package org.talend.core.services;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.IService;
|
||||
import org.talend.core.model.general.Project;
|
||||
|
||||
@@ -47,4 +48,11 @@ public interface IGITProviderService extends IService {
|
||||
|
||||
void createOrUpdateGitIgnoreFile(IProject eclipseProject) throws CoreException;
|
||||
|
||||
public static IGITProviderService get() {
|
||||
GlobalServiceRegister register = GlobalServiceRegister.getDefault();
|
||||
if (!register.isServiceRegistered(IGITProviderService.class)) {
|
||||
return null;
|
||||
}
|
||||
return register.getService(IGITProviderService.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,6 +96,7 @@ import org.talend.core.runtime.process.TalendProcessArgumentConstant;
|
||||
import org.talend.core.runtime.process.TalendProcessOptionConstants;
|
||||
import org.talend.core.runtime.repository.build.BuildExportManager;
|
||||
import org.talend.core.service.IResourcesDependenciesService;
|
||||
import org.talend.core.services.ICoreTisService;
|
||||
import org.talend.core.services.ISVNProviderService;
|
||||
import org.talend.core.ui.IJobletProviderService;
|
||||
import org.talend.core.ui.ITestContainerProviderService;
|
||||
@@ -763,32 +764,26 @@ public class ProcessorUtilities {
|
||||
}
|
||||
}
|
||||
|
||||
out: for (INode node : (List<? extends INode>) currentProcess.getGeneratingNodes()) {
|
||||
ICoreTisService service = null;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreTisService.class)) {
|
||||
service = (ICoreTisService) GlobalServiceRegister.getDefault().getService(ICoreTisService.class);
|
||||
}
|
||||
for (INode node : (List<? extends INode>) currentProcess.getGeneratingNodes()) {
|
||||
if (node.getComponent() != null && node.getComponent().getComponentType() == EComponentType.GENERIC) {
|
||||
// generic component, true always
|
||||
return true;
|
||||
}
|
||||
// to check if node is db component , maybe need modification
|
||||
boolean isDbNode = false;
|
||||
for (IElementParameter param : (List<? extends IElementParameter>) node.getElementParameters()) {
|
||||
if (EParameterFieldType.TEXT == param.getFieldType() && param.getValue() != null) {
|
||||
if (("TYPE".equals(param.getName()) && !"".equals(param.getValue()))
|
||||
|| ("FAMILY".equals(param.getName())
|
||||
&& param.getValue().toString().startsWith("Database"))) {
|
||||
isDbNode = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isDbNode) {
|
||||
for (IMetadataTable metadataTable : node.getMetadataList()) {
|
||||
for (IMetadataColumn column : metadataTable.getListColumns()) {
|
||||
if ("id_Dynamic".equals(column.getTalendType())) {
|
||||
hasDynamicMetadata = true;
|
||||
break out;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (service != null && service.isSupportDynamicType(node)) {
|
||||
IElementParameter mappingParam = node.getElementParameterFromField(EParameterFieldType.MAPPING_TYPE);
|
||||
if (mappingParam != null) {
|
||||
for (IMetadataTable metadataTable : node.getMetadataList()) {
|
||||
for (IMetadataColumn column : metadataTable.getListColumns()) {
|
||||
if ("id_Dynamic".equals(column.getTalendType())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return hasDynamicMetadata;
|
||||
@@ -2207,6 +2202,47 @@ public class ProcessorUtilities {
|
||||
}
|
||||
// trunjob component
|
||||
EList<NodeType> nodes = ptype.getNode();
|
||||
getSubjobInfo(nodes, ptype, parentJobInfo, jobInfos,firstChildOnly);
|
||||
|
||||
if (parentJobInfo.isTestContainer()
|
||||
&& GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
|
||||
ITestContainerProviderService testContainerService =
|
||||
(ITestContainerProviderService) GlobalServiceRegister.getDefault().getService(
|
||||
ITestContainerProviderService.class);
|
||||
if (testContainerService != null) {
|
||||
getSubjobInfo(testContainerService.getOriginalNodes(ptype), ptype, parentJobInfo, jobInfos,firstChildOnly);
|
||||
}
|
||||
}
|
||||
|
||||
if (!parentJobInfo.isTestContainer() && !parentJobInfo.isJoblet()
|
||||
&& GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
|
||||
ITestContainerProviderService testContainerService =
|
||||
(ITestContainerProviderService) GlobalServiceRegister.getDefault().getService(
|
||||
ITestContainerProviderService.class);
|
||||
if (testContainerService != null) {
|
||||
List<ProcessItem> testsItems =
|
||||
testContainerService.getTestContainersByVersion(parentJobInfo.getProcessItem());
|
||||
for (ProcessItem testItem : testsItems) {
|
||||
ProcessType testProcess = testContainerService.getTestContainerProcess(testItem);
|
||||
if (testItem.getProcess() == null) {
|
||||
testItem.setProcess(testProcess);
|
||||
}
|
||||
if (testProcess == null) {
|
||||
log.warn(Messages.getString("ProcessorUtilities.nullProcess")); //$NON-NLS-1$
|
||||
continue;
|
||||
}
|
||||
JobInfo jobInfo = new JobInfo(testItem, testProcess.getDefaultContext());
|
||||
jobInfo.setTestContainer(true);
|
||||
jobInfos.add(jobInfo);
|
||||
jobInfo.setFatherJobInfo(parentJobInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
return jobInfos;
|
||||
}
|
||||
|
||||
private static Set<JobInfo> getSubjobInfo(List<NodeType> nodes, ProcessType ptype, JobInfo parentJobInfo, Set<JobInfo> jobInfos,
|
||||
boolean firstChildOnly) {
|
||||
String jobletPaletteType = null;
|
||||
String frameWork = ptype.getFramework();
|
||||
if (StringUtils.isBlank(frameWork)) {
|
||||
@@ -2216,7 +2252,7 @@ public class ProcessorUtilities {
|
||||
} else if (frameWork.equals(HadoopConstants.FRAMEWORK_SPARK_STREAMING)) {
|
||||
jobletPaletteType = ComponentCategory.CATEGORY_4_SPARKSTREAMING.getName();
|
||||
}
|
||||
for (NodeType node : nodes) {
|
||||
for (NodeType node : nodes) {
|
||||
boolean activate = true;
|
||||
// check if node is active at least.
|
||||
for (Object o : node.getElementParameter()) {
|
||||
@@ -2314,31 +2350,7 @@ public class ProcessorUtilities {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!parentJobInfo.isTestContainer() && !parentJobInfo.isJoblet()
|
||||
&& GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
|
||||
ITestContainerProviderService testContainerService =
|
||||
(ITestContainerProviderService) GlobalServiceRegister.getDefault().getService(
|
||||
ITestContainerProviderService.class);
|
||||
if (testContainerService != null) {
|
||||
List<ProcessItem> testsItems =
|
||||
testContainerService.getTestContainersByVersion(parentJobInfo.getProcessItem());
|
||||
for (ProcessItem testItem : testsItems) {
|
||||
ProcessType testProcess = testContainerService.getTestContainerProcess(testItem);
|
||||
if (testItem.getProcess() == null) {
|
||||
testItem.setProcess(testProcess);
|
||||
}
|
||||
if (testProcess == null) {
|
||||
log.warn(Messages.getString("ProcessorUtilities.nullProcess")); //$NON-NLS-1$
|
||||
continue;
|
||||
}
|
||||
JobInfo jobInfo = new JobInfo(testItem, testProcess.getDefaultContext());
|
||||
jobInfo.setTestContainer(true);
|
||||
jobInfos.add(jobInfo);
|
||||
jobInfo.setFatherJobInfo(parentJobInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
return jobInfos;
|
||||
return jobInfos;
|
||||
}
|
||||
|
||||
private static boolean isRouteletNode(NodeType node) {
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry exported="true" kind="lib" path="lib/commons-codec.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/httpclient.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/httpcore.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jcl-over-slf4j.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-api.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-connector-basic.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-impl.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-spi.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-transport-classpath.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-transport-file.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-transport-http.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-transport-wagon.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-util.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/plexus-utils.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/slf4j-api.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/wagon-provider-api.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-aether-provider-3.2.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-model-3.2.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-model-builder-3.2.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-repository-metadata-3.2.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/plexus-interpolation-1.19.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/plexus-utils-3.0.17.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry exported="true" kind="lib" path="lib/commons-codec.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/httpclient.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/httpcore.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jcl-over-slf4j.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-api.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-connector-basic.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-impl.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-spi.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-transport-classpath.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-transport-file.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-transport-http.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-transport-wagon.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-util.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/plexus-utils.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/slf4j-api.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/wagon-provider-api.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-aether-provider-3.2.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-model-3.2.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-model-builder-3.2.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-repository-metadata-3.2.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/plexus-interpolation-1.19.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/plexus-utils-3.0.17.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
||||
@@ -6,7 +6,9 @@ Bundle-Version: 7.2.1.qualifier
|
||||
Bundle-Activator: org.talend.designer.maven.aether.Activator
|
||||
Require-Bundle: org.eclipse.core.runtime,
|
||||
org.talend.libraries.jackson,
|
||||
org.talend.core.runtime
|
||||
org.talend.core.runtime,
|
||||
org.eclipse.m2e.core,
|
||||
org.eclipse.m2e.maven.runtime
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-ClassPath: .,
|
||||
lib/maven-aether-provider-3.2.1.jar,
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,185 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2018 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.designer.maven.aether.util;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.maven.model.License;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.building.DefaultModelBuilderFactory;
|
||||
import org.apache.maven.model.building.DefaultModelBuildingRequest;
|
||||
import org.apache.maven.model.building.ModelBuildingResult;
|
||||
import org.apache.maven.repository.internal.MavenRepositorySystemUtils;
|
||||
import org.eclipse.aether.DefaultRepositorySystemSession;
|
||||
import org.eclipse.aether.RepositorySystem;
|
||||
import org.eclipse.aether.RepositorySystemSession;
|
||||
import org.eclipse.aether.artifact.Artifact;
|
||||
import org.eclipse.aether.artifact.DefaultArtifact;
|
||||
import org.eclipse.aether.connector.basic.BasicRepositoryConnectorFactory;
|
||||
import org.eclipse.aether.impl.DefaultServiceLocator;
|
||||
import org.eclipse.aether.repository.Authentication;
|
||||
import org.eclipse.aether.repository.LocalRepository;
|
||||
import org.eclipse.aether.repository.RemoteRepository;
|
||||
import org.eclipse.aether.resolution.ArtifactRequest;
|
||||
import org.eclipse.aether.resolution.ArtifactResult;
|
||||
import org.eclipse.aether.spi.connector.RepositoryConnectorFactory;
|
||||
import org.eclipse.aether.spi.connector.transport.TransporterFactory;
|
||||
import org.eclipse.aether.transport.file.FileTransporterFactory;
|
||||
import org.eclipse.aether.transport.http.HttpTransporterFactory;
|
||||
import org.eclipse.aether.util.repository.AuthenticationBuilder;
|
||||
import org.eclipse.m2e.core.MavenPlugin;
|
||||
import org.talend.core.nexus.ArtifactRepositoryBean;
|
||||
import org.talend.core.nexus.TalendLibsServerManager;
|
||||
import org.talend.core.runtime.maven.MavenArtifact;
|
||||
|
||||
public class MavenLibraryResolverProvider {
|
||||
|
||||
public static final String KEY_LOCAL_MVN_REPOSITORY = "talend.mvn.repository"; //$NON-NLS-1$
|
||||
|
||||
private static Map<String, RemoteRepository> urlToRepositoryMap = new HashMap<String, RemoteRepository>();
|
||||
|
||||
private RepositorySystem defaultRepoSystem;
|
||||
|
||||
private RepositorySystemSession defaultRepoSystemSession;
|
||||
|
||||
private RemoteRepository defaultRemoteRepository = null;
|
||||
|
||||
private static MavenLibraryResolverProvider instance;
|
||||
|
||||
public static MavenLibraryResolverProvider getInstance() {
|
||||
if (instance == null) {
|
||||
synchronized (MavenLibraryResolverProvider.class) {
|
||||
if (instance == null) {
|
||||
try {
|
||||
instance = new MavenLibraryResolverProvider();
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
private MavenLibraryResolverProvider() {
|
||||
defaultRepoSystem = newRepositorySystem();
|
||||
defaultRepoSystemSession = newSession(defaultRepoSystem, getLocalMVNRepository());
|
||||
ArtifactRepositoryBean talendServer = TalendLibsServerManager.getInstance().getTalentArtifactServer();
|
||||
if (talendServer.getUserName() == null && talendServer.getPassword() == null) {
|
||||
defaultRemoteRepository = new RemoteRepository.Builder("talend", "default", talendServer.getRepositoryURL()).build(); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
} else {
|
||||
Authentication authentication = new AuthenticationBuilder().addUsername(talendServer.getUserName())
|
||||
.addPassword(talendServer.getPassword()).build();
|
||||
defaultRemoteRepository = new RemoteRepository.Builder("talend", "default", talendServer.getRepositoryURL()) //$NON-NLS-1$ //$NON-NLS-2$
|
||||
.setAuthentication(authentication).build();
|
||||
}
|
||||
}
|
||||
|
||||
public ArtifactResult resolveArtifact(MavenArtifact aritfact) throws Exception {
|
||||
RemoteRepository remoteRepo = getRemoteRepositroy(aritfact);
|
||||
Artifact artifact = new DefaultArtifact(aritfact.getGroupId(), aritfact.getArtifactId(), aritfact.getClassifier(),
|
||||
aritfact.getType(), aritfact.getVersion());
|
||||
ArtifactRequest artifactRequest = new ArtifactRequest();
|
||||
artifactRequest.addRepository(remoteRepo);
|
||||
artifactRequest.setArtifact(artifact);
|
||||
ArtifactResult result = defaultRepoSystem.resolveArtifact(defaultRepoSystemSession, artifactRequest);
|
||||
return result;
|
||||
}
|
||||
|
||||
public Map<String, Object> resolveDescProperties(MavenArtifact aritfact) throws Exception {
|
||||
MavenArtifact clonedArtifact = aritfact.clone();
|
||||
clonedArtifact.setType("pom"); //$NON-NLS-1$
|
||||
Map<String, Object> properties = new HashMap<String, Object>();
|
||||
ArtifactResult result = resolveArtifact(clonedArtifact);
|
||||
if (result != null && result.isResolved()) {
|
||||
DefaultModelBuilderFactory factory = new DefaultModelBuilderFactory();
|
||||
DefaultModelBuildingRequest request = new DefaultModelBuildingRequest();
|
||||
request.setPomFile(result.getArtifact().getFile());
|
||||
ModelBuildingResult modelResult = factory.newInstance().build(request);
|
||||
Model model = modelResult.getEffectiveModel();
|
||||
if (model != null) {
|
||||
properties.put("type", model.getPackaging()); //$NON-NLS-1$
|
||||
properties.put("license.count", model.getLicenses().size()); //$NON-NLS-1$
|
||||
if (model.getLicenses() != null) {
|
||||
for (int i = 0; i < model.getLicenses().size(); i++) {
|
||||
License license = model.getLicenses().get(i);
|
||||
properties.put("license." + i + ".name", license.getName()); //$NON-NLS-1$//$NON-NLS-2$
|
||||
properties.put("license." + i + ".url", license.getUrl()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
properties.put("license." + i + ".comments", license.getComments()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
properties.put("license." + i + ".distribution", license.getDistribution()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return properties;
|
||||
}
|
||||
|
||||
public RemoteRepository getRemoteRepositroy(MavenArtifact aritfact) {
|
||||
if (aritfact != null && aritfact.getRepositoryUrl() != null) {
|
||||
if (urlToRepositoryMap.containsKey(aritfact.getRepositoryUrl())) {
|
||||
return urlToRepositoryMap.get(aritfact.getRepositoryUrl());
|
||||
}
|
||||
|
||||
RemoteRepository repository = buildRemoteRepository(aritfact);
|
||||
urlToRepositoryMap.put(aritfact.getRepositoryUrl(), repository);
|
||||
return repository;
|
||||
}
|
||||
return defaultRemoteRepository;
|
||||
}
|
||||
|
||||
private RemoteRepository buildRemoteRepository(MavenArtifact aritfact) {
|
||||
RemoteRepository repository = null;
|
||||
if (aritfact.getUsername() == null && aritfact.getPassword() == null) {
|
||||
repository = new RemoteRepository.Builder("talend", "default", aritfact.getRepositoryUrl()).build(); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
} else {
|
||||
Authentication authentication = new AuthenticationBuilder().addUsername(aritfact.getUsername())
|
||||
.addPassword(aritfact.getPassword()).build();
|
||||
repository = new RemoteRepository.Builder("talend", "default", aritfact.getRepositoryUrl()) //$NON-NLS-1$ //$NON-NLS-2$
|
||||
.setAuthentication(authentication).build();
|
||||
}
|
||||
return repository;
|
||||
}
|
||||
|
||||
private RepositorySystem newRepositorySystem() {
|
||||
DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
|
||||
locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class);
|
||||
locator.addService(TransporterFactory.class, FileTransporterFactory.class);
|
||||
locator.addService(TransporterFactory.class, HttpTransporterFactory.class);
|
||||
|
||||
return locator.getService(RepositorySystem.class);
|
||||
}
|
||||
|
||||
private RepositorySystemSession newSession(RepositorySystem system, String target) {
|
||||
DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
|
||||
|
||||
LocalRepository localRepo = new LocalRepository( /* "target/local-repo" */target);
|
||||
session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, localRepo));
|
||||
|
||||
return session;
|
||||
}
|
||||
|
||||
private String getLocalMVNRepository() {
|
||||
String repository = null;
|
||||
try {
|
||||
repository = MavenPlugin.getMaven().getLocalRepositoryPath();
|
||||
} catch (Exception ex) {
|
||||
// Ignore here
|
||||
}
|
||||
if (repository == null) {
|
||||
repository = System.getProperty(KEY_LOCAL_MVN_REPOSITORY);
|
||||
}
|
||||
return repository;
|
||||
}
|
||||
}
|
||||
@@ -64,12 +64,24 @@
|
||||
<version>${project.version}</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.talend.studio</groupId>
|
||||
<artifactId>talend-compiler-plugin-tos</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.talend.studio</groupId>
|
||||
<artifactId>studio-maven-repository-zip</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.talend.studio</groupId>
|
||||
<artifactId>build-helper-maven-plugin-3-0-0-tos</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<profiles>
|
||||
<profile>
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.talend.studio</groupId>
|
||||
<artifactId>studio-maven-repository-tos</artifactId>
|
||||
<version>7.2.1-SNAPSHOT</version>
|
||||
<relativePath>../../../</relativePath>
|
||||
</parent>
|
||||
<artifactId>build-helper-maven-plugin-3-0-0-tos</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>2.8</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-dependencies</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<addParentPoms>true</addParentPoms>
|
||||
<copyPom>true</copyPom>
|
||||
<includeScope>compile</includeScope>
|
||||
<outputDirectory>${basedir}/../../../tmp/repository</outputDirectory>
|
||||
<useRepositoryLayout>true</useRepositoryLayout>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -35,6 +35,13 @@
|
||||
<version>3.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Required by commons-lang-2.6.pom -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-parent</artifactId>
|
||||
<version>17</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.talend.studio</groupId>
|
||||
<artifactId>studio-maven-repository-tos</artifactId>
|
||||
<version>7.2.1-SNAPSHOT</version>
|
||||
<relativePath>../../../</relativePath>
|
||||
</parent>
|
||||
<artifactId>talend-compiler-plugin-tos</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.tycho</groupId>
|
||||
<artifactId>tycho-compiler-jdt</artifactId>
|
||||
<version>1.4.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>2.8</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-dependencies</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<addParentPoms>true</addParentPoms>
|
||||
<copyPom>true</copyPom>
|
||||
<includeScope>compile</includeScope>
|
||||
<outputDirectory>${basedir}/../../../tmp/repository</outputDirectory>
|
||||
<useRepositoryLayout>true</useRepositoryLayout>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -14,6 +14,8 @@
|
||||
<module>plugins/maven-bundle-plugin-2-3-7</module>
|
||||
<module>plugins/maven-bundle-plugin-2-5-3</module>
|
||||
<module>plugins/maven-install-plugin-2-5-1</module>
|
||||
<module>plugins/talend-compiler-plugin</module>
|
||||
<module>plugins/build-helper-maven-plugin-3-0-0</module>
|
||||
</modules>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<artifactId>studio-components-dependencies</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<properties>
|
||||
<components.version>0.26.0-SNAPSHOT</components.version>
|
||||
<components.version>0.27.0-SNAPSHOT</components.version>
|
||||
</properties>
|
||||
<repositories>
|
||||
<repository>
|
||||
@@ -52,15 +52,22 @@
|
||||
<artifactId>jackson-dataformat-cbor</artifactId>
|
||||
<version>2.9.5</version>
|
||||
</dependency>
|
||||
<!-- It fixes provided dependency scope to compile, because maven-dependency-plugin is setup to include
|
||||
only compile and runtime scopes, but provided is also required. It's not possible to setup plugin to
|
||||
include all: compile, runtime and provided dependencies -->
|
||||
<dependency>
|
||||
<groupId>biz.aQute.bnd</groupId>
|
||||
<artifactId>annotation</artifactId>
|
||||
<version>2.4.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- Required by commons-lang-2.6.pom -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-parent</artifactId>
|
||||
<version>17</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
<!-- It fixes provided dependency scope to compile, because maven-dependency-plugin is setup to include
|
||||
only compile and runtime scopes, but provided is also required. It's not possible to setup plugin to
|
||||
include all: compile, runtime and provided dependencies -->
|
||||
<dependency>
|
||||
<groupId>biz.aQute.bnd</groupId>
|
||||
<artifactId>annotation</artifactId>
|
||||
<version>2.4.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.talend.components</groupId>
|
||||
<artifactId>components-bom</artifactId>
|
||||
@@ -152,8 +159,8 @@
|
||||
<artifactId>components-api</artifactId>
|
||||
<version>${components.version}</version>
|
||||
</dependency>
|
||||
<!-- Dependencies in provided scope should be explicitly added as dependency in this module,
|
||||
because provided scope is not transitive -->
|
||||
<!-- Dependencies in provided scope should be explicitly added as dependency in this module,
|
||||
because provided scope is not transitive -->
|
||||
<dependency>
|
||||
<groupId>org.osgi</groupId>
|
||||
<artifactId>org.osgi.service.component.annotations</artifactId>
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.4</version>
|
||||
<version>3.8.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
||||
@@ -25,7 +25,10 @@ import java.util.GregorianCalendar;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.maven.cli.MavenCli;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.maven.cli.configuration.SettingsXmlConfigurationProcessor;
|
||||
import org.apache.maven.settings.Profile;
|
||||
import org.apache.maven.settings.Proxy;
|
||||
@@ -53,6 +56,8 @@ import org.talend.designer.maven.template.MavenTemplateManager;
|
||||
import org.talend.designer.maven.ui.DesignerMavenUiPlugin;
|
||||
import org.talend.login.AbstractLoginTask;
|
||||
import org.talend.utils.io.FilesUtils;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
/**
|
||||
* DOC ggu class global comment. Detailled comment
|
||||
@@ -286,10 +291,34 @@ public class M2eUserSettingForTalendLoginTask extends AbstractLoginTask {
|
||||
return false;
|
||||
}
|
||||
final String m2Repo = ".m2/repository"; //$NON-NLS-1$
|
||||
// default one
|
||||
IPath localRepoPath = new Path(System.getProperty("user.home")).append(m2Repo); //$NON-NLS-1$
|
||||
boolean isLocal = isLocalRepository();
|
||||
IPath localRepoPath = null;
|
||||
if (!isLocal) {
|
||||
String mvnHome = System.getenv("M2_HOME"); //$NON-NLS-1$
|
||||
if (mvnHome == null) {
|
||||
mvnHome = System.getenv("MAVEN_HOME"); //$NON-NLS-1$
|
||||
}
|
||||
if (StringUtils.isNotBlank(mvnHome)) {
|
||||
File globalSettings = new File(mvnHome).toPath().resolve("conf").resolve("settings.xml").toFile(); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
if (globalSettings.exists()) {
|
||||
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
||||
Document document = builder.parse(globalSettings);
|
||||
Node node = document.getElementsByTagName("localRepository").item(0); //$NON-NLS-1$
|
||||
if (node != null) {
|
||||
String repoPath = node.getTextContent();
|
||||
if (StringUtils.isNotBlank(repoPath)) {
|
||||
localRepoPath = new Path(repoPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (localRepoPath == null) {
|
||||
// set default
|
||||
localRepoPath = new Path(System.getProperty("user.home")).append(m2Repo); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
// if local, always use config one
|
||||
if (isLocalRepository() || !enableAccessM2Repository(monitor, localRepoPath.toString())) {
|
||||
if (isLocal || !enableAccessM2Repository(monitor, localRepoPath.toString())) {
|
||||
// need change the repo setting
|
||||
localRepoPath = configPath.append(m2Repo);
|
||||
File studioDefaultRepoFolder = localRepoPath.toFile();
|
||||
@@ -394,7 +423,7 @@ public class M2eUserSettingForTalendLoginTask extends AbstractLoginTask {
|
||||
|
||||
String nonProxyHosts = p.getNonProxyHosts();
|
||||
if (nonProxyHosts != null && nonProxyHosts.trim().length() > 0) {
|
||||
List<String> bypassHosts = new ArrayList<String>();
|
||||
List<String> bypassHosts = new ArrayList<>();
|
||||
String[] nonProxiedHosts = proxyService.getNonProxiedHosts();
|
||||
if (nonProxiedHosts != null) {
|
||||
bypassHosts.addAll(Arrays.asList(nonProxiedHosts));
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<dependency>
|
||||
<groupId>org.eclipse.tycho</groupId>
|
||||
<artifactId>tycho-compiler-jdt</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>1.4.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
@@ -63,28 +63,6 @@
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.20</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>fabric8-maven-plugin</artifactId>
|
||||
<version>3.5.37</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>2.9.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>2.9.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.9.5</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
|
||||
@@ -43,6 +43,8 @@ public class MavenSystemFolders {
|
||||
|
||||
public static final ProjectSystemFolder TEMP = new ProjectSystemFolder("temp");
|
||||
|
||||
public static final ProjectSystemFolder SRC = new ProjectSystemFolder("src");
|
||||
|
||||
public static final ProjectSystemFolder[] SIMPLE_DIRS = { JAVA, RESOURCES };
|
||||
|
||||
public static final ProjectSystemFolder[] TEST_DIRS = { JAVA_TEST, RESOURCES_TEST };
|
||||
|
||||
@@ -62,7 +62,7 @@ public final class DefaultMavenRepositoryProvider {
|
||||
if (!zipFile.exists()) {
|
||||
return;
|
||||
}
|
||||
FilesUtils.unzip(zipFile.getAbsolutePath(), dest.getAbsolutePath());
|
||||
FilesUtils.unzip(zipFile.getAbsolutePath(), dest.getAbsolutePath(), false);
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.m2e.core.MavenPlugin;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.utils.VersionUtils;
|
||||
import org.talend.commons.utils.generation.JavaUtils;
|
||||
import org.talend.core.runtime.projectsetting.IProjectSettingPreferenceConstants;
|
||||
import org.talend.core.runtime.projectsetting.IProjectSettingTemplateConstants;
|
||||
@@ -247,7 +246,6 @@ public class MavenTemplateManager {
|
||||
|
||||
Properties properties = model.getProperties();
|
||||
properties.put("talend.project.name", projectTechName); //$NON-NLS-1$
|
||||
properties.put("talend.version", VersionUtils.getTalendVersion()); //$NON-NLS-1$
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,13 @@
|
||||
// ============================================================================
|
||||
package org.talend.designer.maven.tools;
|
||||
|
||||
import static org.talend.designer.maven.model.TalendJavaProjectConstants.*;
|
||||
import static org.talend.designer.maven.model.TalendJavaProjectConstants.DIR_AGGREGATORS;
|
||||
import static org.talend.designer.maven.model.TalendJavaProjectConstants.DIR_BEANS;
|
||||
import static org.talend.designer.maven.model.TalendJavaProjectConstants.DIR_CODES;
|
||||
import static org.talend.designer.maven.model.TalendJavaProjectConstants.DIR_JOBS;
|
||||
import static org.talend.designer.maven.model.TalendJavaProjectConstants.DIR_PIGUDFS;
|
||||
import static org.talend.designer.maven.model.TalendJavaProjectConstants.DIR_POMS;
|
||||
import static org.talend.designer.maven.model.TalendJavaProjectConstants.DIR_ROUTINES;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
@@ -21,6 +27,7 @@ import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.apache.maven.model.Model;
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
@@ -517,9 +524,10 @@ public class AggregatorPomsHelper {
|
||||
}
|
||||
|
||||
/**
|
||||
* without create/open project
|
||||
* without create/open project<br/>
|
||||
* Use Function to get the relativePath from property at realtime, since the property may be changed
|
||||
*/
|
||||
public static IFolder getItemPomFolder(Property property, String realVersion) {
|
||||
public static IFolder getItemPomFolder(Property property, String realVersion, Function<Property, IPath> getItemRelativePath) {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
|
||||
ITestContainerProviderService testContainerService =
|
||||
(ITestContainerProviderService) GlobalServiceRegister.getDefault().getService(
|
||||
@@ -535,9 +543,10 @@ public class AggregatorPomsHelper {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String projectTechName = ProjectManager.getInstance().getProject(property).getTechnicalLabel();
|
||||
AggregatorPomsHelper helper = new AggregatorPomsHelper(projectTechName);
|
||||
IPath itemRelativePath = ItemResourceUtil.getItemRelativePath(property);
|
||||
IPath itemRelativePath = getItemRelativePath.apply(property);
|
||||
String version = realVersion == null ? property.getVersion() : realVersion;
|
||||
String jobFolderName = getJobProjectFolderName(property.getLabel(), version);
|
||||
ERepositoryObjectType type = ERepositoryObjectType.getItemType(property.getItem());
|
||||
@@ -546,6 +555,10 @@ public class AggregatorPomsHelper {
|
||||
return jobFolder;
|
||||
}
|
||||
|
||||
public static IFolder getItemPomFolder(Property property, String realVersion) {
|
||||
return getItemPomFolder(property, realVersion, p -> ItemResourceUtil.getItemRelativePath(p));
|
||||
}
|
||||
|
||||
private static void createFoldersIfNeeded(IFolder folder) {
|
||||
if (!folder.exists()) {
|
||||
if (folder.getParent() instanceof IFolder) {
|
||||
|
||||
@@ -601,7 +601,10 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
|
||||
mainProjectBranch = "";
|
||||
}
|
||||
}
|
||||
jobInfoContent = StringUtils.replace(jobInfoContent, "${talend.project.branch}", mainProjectBranch);
|
||||
|
||||
if (!isOptionChecked(TalendProcessArgumentConstant.ARG_AVOID_BRANCH_NAME)) {
|
||||
jobInfoContent = StringUtils.replace(jobInfoContent, "${talend.project.branch}", mainProjectBranch);
|
||||
}
|
||||
|
||||
IFolder templateFolder = codeProject.getTemplatesFolder();
|
||||
IFile shFile = templateFolder.getFile(IProjectSettingTemplateConstants.JOB_RUN_SH_TEMPLATE_FILE_NAME);
|
||||
|
||||
@@ -699,7 +699,7 @@ public class ExternalModulesInstallDialogWithProgress extends ExternalModulesIns
|
||||
// remove duplicated
|
||||
List<ModuleNeeded> required = new ArrayList<ModuleNeeded>(requiredModules);
|
||||
IRunnableWithProgress notInstalledModulesRunnable = RemoteModulesHelper.getInstance().getNotInstalledModulesRunnable(
|
||||
required, inputList, true);
|
||||
required, inputList, true, false);
|
||||
setBlockOnOpen(block);
|
||||
setInitialRunnable(notInstalledModulesRunnable);
|
||||
open();
|
||||
|
||||
@@ -14,6 +14,7 @@ package org.talend.librariesmanager.ui.startup;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -53,10 +54,16 @@ public class ShareMavenArtifactsOnStartup extends ShareLibrareisHelper {
|
||||
if (monitor.isCanceled()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final String jarPathFromMaven = librariesService.getJarPathFromMaven(module.getMavenUri());
|
||||
String jarPathFromMaven = librariesService.getJarPathFromMaven(module.getMavenUri());
|
||||
if (jarPathFromMaven == null) {
|
||||
continue;
|
||||
String moduleLocation = module.getModuleLocaion();
|
||||
if (moduleLocation != null && librariesService.checkJarInstalledFromPlatform(moduleLocation)) {
|
||||
librariesService.installModules(Arrays.asList(module), monitor);
|
||||
jarPathFromMaven = librariesService.getJarPathFromMaven(module.getMavenUri());
|
||||
}
|
||||
if (jarPathFromMaven == null) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
File jarFile = new File(jarPathFromMaven);
|
||||
if (jarFile.exists()) {
|
||||
|
||||
@@ -55,6 +55,7 @@ import org.talend.core.nexus.TalendLibsServerManager;
|
||||
import org.talend.core.runtime.maven.MavenArtifact;
|
||||
import org.talend.core.runtime.maven.MavenConstants;
|
||||
import org.talend.core.runtime.maven.MavenUrlHelper;
|
||||
import org.talend.librariesmanager.librarydata.LibraryDataService;
|
||||
import org.talend.librariesmanager.model.service.DynamicDistibutionLicenseUtil;
|
||||
import org.talend.librariesmanager.ui.i18n.Messages;
|
||||
|
||||
@@ -68,8 +69,6 @@ import us.monoid.json.JSONObject;
|
||||
*/
|
||||
public class RemoteModulesHelper {
|
||||
|
||||
private static final String SLASH = "/"; //$NON-NLS-1$
|
||||
|
||||
// TODO to be removed after nexus server available
|
||||
public static final boolean nexus_available = true;
|
||||
|
||||
@@ -81,9 +80,10 @@ public class RemoteModulesHelper {
|
||||
*
|
||||
*/
|
||||
private final class RemoteModulesFetchRunnable implements IRunnableWithProgress {
|
||||
|
||||
private final boolean collectModulesWithJarName;
|
||||
|
||||
private volatile boolean useLocalLicenseData;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -102,15 +102,19 @@ public class RemoteModulesHelper {
|
||||
* @param toInstall
|
||||
*/
|
||||
private RemoteModulesFetchRunnable(Map<String, List<ModuleNeeded>> requiredModules, List<ModuleToInstall> toInstall,
|
||||
boolean collectModulesWithJarName) {
|
||||
boolean collectModulesWithJarName, boolean useLocalLicenseData) {
|
||||
this.toInstall = toInstall;
|
||||
this.contextMap = requiredModules;
|
||||
this.collectModulesWithJarName = collectModulesWithJarName;
|
||||
this.useLocalLicenseData = useLocalLicenseData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
||||
final Set<String> mavenUrisTofetch = new HashSet<String>(contextMap.keySet());
|
||||
if (LibraryDataService.getInstance().isBuildLibrariesData()) {
|
||||
LibraryDataService.getInstance().buildLibraryLicenseData(mavenUrisTofetch);
|
||||
}
|
||||
monitor.beginTask(Messages.getString("RemoteModulesHelper.fetch.module.info"), mavenUrisTofetch.size() * 10 + 10);//$NON-NLS-1$
|
||||
// fetch modules from local nexus first
|
||||
if (addCachedModulesToToBeInstallModules(toInstall, mavenUrisTofetch, contextMap, localCache)) {
|
||||
@@ -131,7 +135,7 @@ public class RemoteModulesHelper {
|
||||
return;
|
||||
}
|
||||
|
||||
if (addCachedModulesToToBeInstallModules(toInstall, mavenUrisTofetch, contextMap, remoteCache)) {
|
||||
if (addCachedModulesToToBeInstallModules(toInstall, mavenUrisTofetch, contextMap, getRemoteCache())) {
|
||||
if (collectModulesWithJarName) {
|
||||
collectModulesWithJarName(toInstall);
|
||||
}
|
||||
@@ -148,8 +152,12 @@ public class RemoteModulesHelper {
|
||||
alreadyWarnedAboutConnectionIssue = true;
|
||||
} // else already warned so do nothing
|
||||
} else {
|
||||
searchFromRemoteNexus(mavenUrisTofetch, monitor);
|
||||
addCachedModulesToToBeInstallModules(toInstall, mavenUrisTofetch, contextMap, remoteCache);
|
||||
if (useLocalLicenseData) {
|
||||
searchFromLocalDataFile(mavenUrisTofetch, monitor);
|
||||
} else {
|
||||
searchFromRemoteNexus(mavenUrisTofetch, monitor);
|
||||
}
|
||||
addCachedModulesToToBeInstallModules(toInstall, mavenUrisTofetch, contextMap, getRemoteCache());
|
||||
}
|
||||
|
||||
unavailableModules.addAll(mavenUrisTofetch);
|
||||
@@ -168,25 +176,32 @@ public class RemoteModulesHelper {
|
||||
monitor.done();
|
||||
}
|
||||
|
||||
private Map<String, ModuleToInstall> getRemoteCache() {
|
||||
if (useLocalLicenseData) {
|
||||
return localLicenseDataCache;
|
||||
}
|
||||
return remoteCache;
|
||||
}
|
||||
|
||||
private void searchFromLocalNexus(Set<String> mavenUristoSearch, IProgressMonitor monitor) {
|
||||
try {
|
||||
ArtifactRepositoryBean customNexusServer = TalendLibsServerManager.getInstance().getCustomNexusServer();
|
||||
IRepositoryArtifactHandler customerRepHandler = RepositoryArtifactHandlerManager
|
||||
.getRepositoryHandler(customNexusServer);
|
||||
if (customerRepHandler != null) {
|
||||
// collect the groupIds to check
|
||||
Set<String> groupIds = new HashSet<String>();
|
||||
Set<String> snapshotgroupIds = new HashSet<String>();
|
||||
for (String mvnUri : mavenUristoSearch) {
|
||||
final MavenArtifact parseMvnUrl = MavenUrlHelper.parseMvnUrl(mvnUri);
|
||||
if (parseMvnUrl != null) {
|
||||
if (parseMvnUrl.getVersion() != null && parseMvnUrl.getVersion().endsWith(MavenConstants.SNAPSHOT)) {
|
||||
snapshotgroupIds.add(parseMvnUrl.getGroupId());
|
||||
} else {
|
||||
groupIds.add(parseMvnUrl.getGroupId());
|
||||
// collect the groupIds to check
|
||||
Set<String> groupIds = new HashSet<String>();
|
||||
Set<String> snapshotgroupIds = new HashSet<String>();
|
||||
for (String mvnUri : mavenUristoSearch) {
|
||||
final MavenArtifact parseMvnUrl = MavenUrlHelper.parseMvnUrl(mvnUri);
|
||||
if (parseMvnUrl != null) {
|
||||
if (parseMvnUrl.getVersion() != null && parseMvnUrl.getVersion().endsWith(MavenConstants.SNAPSHOT)) {
|
||||
snapshotgroupIds.add(parseMvnUrl.getGroupId());
|
||||
} else {
|
||||
groupIds.add(parseMvnUrl.getGroupId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (String groupId : groupIds) {
|
||||
List<MavenArtifact> searchResults = customerRepHandler.search(groupId, null, null, true, false);
|
||||
@@ -205,66 +220,51 @@ public class RemoteModulesHelper {
|
||||
}
|
||||
}
|
||||
|
||||
private void searchFromRemoteNexus(Set<String> mavenUristoSearch, IProgressMonitor monitor) {
|
||||
try {
|
||||
ArtifactRepositoryBean talendServer = TalendLibsServerManager.getInstance().getTalentArtifactServer();
|
||||
IRepositoryArtifactHandler talendRepositoryHander = RepositoryArtifactHandlerManager
|
||||
.getRepositoryHandler(talendServer);
|
||||
if (talendRepositoryHander != null) {
|
||||
final Iterator<String> iterator = mavenUristoSearch.iterator();
|
||||
Map<String, List<StringBuffer>> groupIdAndJarsToCheck = new HashMap<>();
|
||||
while (iterator.hasNext()) {
|
||||
if (monitor.isCanceled()) {
|
||||
break;
|
||||
}
|
||||
String uriToCheck = iterator.next();
|
||||
final MavenArtifact parseMvnUrl = MavenUrlHelper.parseMvnUrl(uriToCheck);
|
||||
if (parseMvnUrl != null) {
|
||||
//
|
||||
if (StringUtils.isNotEmpty(parseMvnUrl.getRepositoryUrl())) {
|
||||
continue;
|
||||
}
|
||||
StringBuffer jarsToCheck = null;
|
||||
List<StringBuffer> buffers = groupIdAndJarsToCheck.get(parseMvnUrl.getGroupId());
|
||||
if (buffers == null) {
|
||||
buffers = new ArrayList<>();
|
||||
groupIdAndJarsToCheck.put(parseMvnUrl.getGroupId(), buffers);
|
||||
}
|
||||
if (buffers.isEmpty() || buffers.get(buffers.size() - 1).length() > 2000) {
|
||||
jarsToCheck = new StringBuffer();
|
||||
buffers.add(jarsToCheck);
|
||||
} else {
|
||||
jarsToCheck = buffers.get(buffers.size() - 1);
|
||||
}
|
||||
if (parseMvnUrl.getArtifactId() != null && !parseMvnUrl.getArtifactId().contains("$")) { //$NON-NLS-1$
|
||||
jarsToCheck.append(parseMvnUrl.getArtifactId());
|
||||
jarsToCheck.append(","); //$NON-NLS-1$
|
||||
} else {
|
||||
ExceptionHandler.log("wrong setup of artifact, cf:" + parseMvnUrl.getArtifactId()); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
for (String groupId : groupIdAndJarsToCheck.keySet()) {
|
||||
List<StringBuffer> buffers = groupIdAndJarsToCheck.get(groupId);
|
||||
for (StringBuffer toCheck : buffers) {
|
||||
String jarsToCheck = toCheck.toString();
|
||||
if (jarsToCheck.endsWith(",")) {
|
||||
jarsToCheck = jarsToCheck.substring(0, jarsToCheck.length() - 1);
|
||||
}
|
||||
List<MavenArtifact> searchResults = talendRepositoryHander.search(groupId, jarsToCheck, null, true,
|
||||
false);
|
||||
monitor.worked(10);
|
||||
addModulesToCache(mavenUristoSearch, searchResults, remoteCache);
|
||||
|
||||
}
|
||||
}
|
||||
private void searchFromLocalDataFile(Set<String> mavenUristoSearch, IProgressMonitor monitor) {
|
||||
LibraryDataService service = LibraryDataService.getInstance();
|
||||
List<MavenArtifact> artifactList = new ArrayList<MavenArtifact>();
|
||||
final Iterator<String> iterator = mavenUristoSearch.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
if (monitor.isCanceled()) {
|
||||
break;
|
||||
}
|
||||
String uriToCheck = iterator.next();
|
||||
final MavenArtifact parseMvnUrl = MavenUrlHelper.parseMvnUrl(uriToCheck);
|
||||
boolean isExist = false;
|
||||
if (parseMvnUrl != null) {
|
||||
isExist = service.fillLibraryData(uriToCheck, parseMvnUrl);
|
||||
}
|
||||
if (isExist) {
|
||||
artifactList.add(parseMvnUrl);
|
||||
}
|
||||
|
||||
} catch (Exception e1) {
|
||||
ExceptionHandler.process(e1);
|
||||
}
|
||||
addModulesToCache(mavenUristoSearch, artifactList, getRemoteCache());
|
||||
}
|
||||
|
||||
private void searchFromRemoteNexus(Set<String> mavenUristoSearch, IProgressMonitor monitor) {
|
||||
LibraryDataService service = LibraryDataService.getInstance();
|
||||
List<MavenArtifact> artifactList = new ArrayList<MavenArtifact>();
|
||||
final Iterator<String> iterator = mavenUristoSearch.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
if (monitor.isCanceled()) {
|
||||
break;
|
||||
}
|
||||
String uriToCheck = iterator.next();
|
||||
final MavenArtifact parseMvnUrl = MavenUrlHelper.parseMvnUrl(uriToCheck);
|
||||
Map<String, Object> properties;
|
||||
try {
|
||||
properties = service.resolveDescProperties(parseMvnUrl);
|
||||
if (properties != null && properties.size() > 0) {
|
||||
service.fillArtifactPropertyData(properties, parseMvnUrl);
|
||||
if (!MavenConstants.DOWNLOAD_MANUAL.equals(parseMvnUrl.getDistribution())) {
|
||||
artifactList.add(parseMvnUrl);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
addModulesToCache(mavenUristoSearch, artifactList, getRemoteCache());
|
||||
}
|
||||
|
||||
private void addModulesToCache(Set<String> mavenUristoSearch, List<MavenArtifact> searchResults,
|
||||
@@ -509,13 +509,11 @@ public class RemoteModulesHelper {
|
||||
|
||||
private static final String SEPARATOR_DISPLAY = " | "; //$NON-NLS-1$
|
||||
|
||||
private static final String SEPARATOR = "|"; //$NON-NLS-1$
|
||||
|
||||
private static final String SEPARATOR_SLIP = "\\|"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* key : mvnuri(without SANPSHOT in version) value : ModuleToInstall
|
||||
*/
|
||||
private Map<String, ModuleToInstall> localLicenseDataCache = new HashMap<String, ModuleToInstall>();
|
||||
|
||||
private Map<String, ModuleToInstall> remoteCache = new HashMap<String, ModuleToInstall>();
|
||||
|
||||
private Map<String, ModuleToInstall> localCache = new HashMap<String, ModuleToInstall>();
|
||||
@@ -531,8 +529,8 @@ public class RemoteModulesHelper {
|
||||
}
|
||||
|
||||
public RemoteModulesFetchRunnable createRemoteModuleFetchRunnable(final Map<String, List<ModuleNeeded>> requiredModules,
|
||||
final List<ModuleToInstall> toInstall, boolean collectModulesWithJarName) {
|
||||
return new RemoteModulesFetchRunnable(requiredModules, toInstall, collectModulesWithJarName);
|
||||
final List<ModuleToInstall> toInstall, boolean collectModulesWithJarName, boolean useLocalLicenseData) {
|
||||
return new RemoteModulesFetchRunnable(requiredModules, toInstall, collectModulesWithJarName, useLocalLicenseData);
|
||||
}
|
||||
|
||||
private JSONObject readJsonFromUrl(String url) throws IOException {
|
||||
@@ -628,7 +626,7 @@ public class RemoteModulesHelper {
|
||||
* ModuleToInstall.mavenUris set to download all needed versions
|
||||
*/
|
||||
public RemoteModulesFetchRunnable getNotInstalledModulesRunnable(List<ModuleNeeded> neededModules,
|
||||
List<ModuleToInstall> toInstall, boolean collectModulesWithJarName) {
|
||||
List<ModuleToInstall> toInstall, boolean collectModulesWithJarName, boolean useLocalLicenseData) {
|
||||
Map<String, List<ModuleNeeded>> contextMap = new HashMap<String, List<ModuleNeeded>>();
|
||||
ILibraryManagerService librairesManagerService = (ILibraryManagerService) GlobalServiceRegister.getDefault()
|
||||
.getService(ILibraryManagerService.class);
|
||||
@@ -679,13 +677,13 @@ public class RemoteModulesHelper {
|
||||
}
|
||||
}
|
||||
// fetch the jars which are not in cache.
|
||||
return createRemoteModuleFetchRunnable(contextMap, toInstall, collectModulesWithJarName);
|
||||
return createRemoteModuleFetchRunnable(contextMap, toInstall, collectModulesWithJarName, useLocalLicenseData);
|
||||
|
||||
}
|
||||
|
||||
public RemoteModulesFetchRunnable getNotInstalledModulesRunnable(List<ModuleNeeded> neededModules,
|
||||
List<ModuleToInstall> toInstall) {
|
||||
return getNotInstalledModulesRunnable(neededModules, toInstall, false);
|
||||
return getNotInstalledModulesRunnable(neededModules, toInstall, false, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -755,6 +753,6 @@ public class RemoteModulesHelper {
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry kind="src" path="resources/java"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry kind="src" path="resources/java"/>
|
||||
<classpathentry kind="lib" path="lib/crypto-utils.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"/>
|
||||
</classpath>
|
||||
|
||||
@@ -25,8 +25,10 @@ Require-Bundle: org.eclipse.core.runtime,
|
||||
javax.xml.bind,
|
||||
org.talend.model
|
||||
Eclipse-LazyStart: true
|
||||
Bundle-ClassPath: .
|
||||
Bundle-ClassPath: .,
|
||||
lib/crypto-utils.jar
|
||||
Export-Package: org.talend.librariesmanager.emf.librariesindex,
|
||||
org.talend.librariesmanager.librarydata,
|
||||
org.talend.librariesmanager.maven,
|
||||
org.talend.librariesmanager.model,
|
||||
org.talend.librariesmanager.model.service,
|
||||
|
||||
@@ -7,4 +7,6 @@ bin.includes = META-INF/,\
|
||||
resources/,\
|
||||
plugin.properties,\
|
||||
model/,\
|
||||
templates/
|
||||
templates/,\
|
||||
distribution/license.json,\
|
||||
lib/crypto-utils.jar
|
||||
|
||||
BIN
main/plugins/org.talend.librariesmanager/lib/crypto-utils.jar
Normal file
BIN
main/plugins/org.talend.librariesmanager/lib/crypto-utils.jar
Normal file
Binary file not shown.
@@ -41,6 +41,27 @@
|
||||
bundleId="">
|
||||
</bundleId>
|
||||
</library>
|
||||
</systemRoutine>
|
||||
<systemRoutine
|
||||
name="PasswordEncryptUtil">
|
||||
<library
|
||||
name="crypto-utils.jar">
|
||||
<bundleId
|
||||
bundleId="">
|
||||
</bundleId>
|
||||
</library>
|
||||
<library
|
||||
name="slf4j-api-1.7.10.jar">
|
||||
<bundleId
|
||||
bundleId="org.talend.libraries.slf4j">
|
||||
</bundleId>
|
||||
</library>
|
||||
<library
|
||||
name="slf4j-log4j12-1.7.10.jar">
|
||||
<bundleId
|
||||
bundleId="org.talend.libraries.slf4j">
|
||||
</bundleId>
|
||||
</library>
|
||||
</systemRoutine>
|
||||
</extension>
|
||||
<extension
|
||||
|
||||
@@ -9,4 +9,34 @@
|
||||
</parent>
|
||||
<artifactId>org.talend.librariesmanager</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>2.8</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<!-- same as org.talend.libraries.excel -->
|
||||
<id>copy-maven-repository</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.basedir}/lib</outputDirectory>
|
||||
<destFileName>crypto-utils.jar</destFileName>
|
||||
<artifactItems>
|
||||
<dependency>
|
||||
<groupId>org.talend.daikon</groupId>
|
||||
<artifactId>crypto-utils</artifactId>
|
||||
<version>${org.talend.daikon.crypto-utils.version}</version>
|
||||
</dependency>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -12,12 +12,9 @@
|
||||
// ============================================================================
|
||||
package routines.system;
|
||||
|
||||
import java.security.SecureRandom;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.SecretKeyFactory;
|
||||
import javax.crypto.spec.DESKeySpec;
|
||||
import org.talend.daikon.crypto.CipherSources;
|
||||
import org.talend.daikon.crypto.Encryption;
|
||||
import org.talend.daikon.crypto.KeySources;
|
||||
|
||||
/**
|
||||
* DOC chuang class global comment. Detailled comment
|
||||
@@ -26,36 +23,15 @@ public class PasswordEncryptUtil {
|
||||
|
||||
public static String ENCRYPT_KEY = "Encrypt"; //$NON-NLS-1$
|
||||
|
||||
private static String rawKey = "Talend-Key"; //$NON-NLS-1$
|
||||
private static final String ENCRYPTION_KEY = "Talend_TalendKey";
|
||||
|
||||
private static SecretKey key = null;
|
||||
|
||||
private static SecureRandom secureRandom = new SecureRandom();
|
||||
|
||||
private static String CHARSET = "UTF-8";
|
||||
|
||||
private static SecretKey getSecretKey() throws Exception {
|
||||
if (key == null) {
|
||||
|
||||
byte rawKeyData[] = rawKey.getBytes(CHARSET);
|
||||
DESKeySpec dks = new DESKeySpec(rawKeyData);
|
||||
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES"); //$NON-NLS-1$
|
||||
key = keyFactory.generateSecret(dks);
|
||||
}
|
||||
return key;
|
||||
}
|
||||
private static Encryption defaultEncryption;
|
||||
|
||||
public static String encryptPassword(String input) throws Exception {
|
||||
if (input == null) {
|
||||
return input;
|
||||
}
|
||||
|
||||
SecretKey key = getSecretKey();
|
||||
Cipher c = Cipher.getInstance("DES"); //$NON-NLS-1$
|
||||
c.init(Cipher.ENCRYPT_MODE, key, secureRandom);
|
||||
byte[] cipherByte = c.doFinal(input.getBytes(CHARSET));
|
||||
String dec = Hex.encodeHexString(cipherByte);
|
||||
return dec;
|
||||
return getEncryption().encrypt(input);
|
||||
}
|
||||
|
||||
public static String decryptPassword(String input) {
|
||||
@@ -63,18 +39,20 @@ public class PasswordEncryptUtil {
|
||||
return input;
|
||||
}
|
||||
try {
|
||||
byte[] dec = Hex.decodeHex(input.toCharArray());
|
||||
SecretKey key = getSecretKey();
|
||||
Cipher c = Cipher.getInstance("DES"); //$NON-NLS-1$
|
||||
c.init(Cipher.DECRYPT_MODE, key, secureRandom);
|
||||
byte[] clearByte = c.doFinal(dec);
|
||||
return new String(clearByte, CHARSET);
|
||||
return getEncryption().decrypt(input);
|
||||
} catch (Exception e) {
|
||||
//do nothing
|
||||
// do nothing
|
||||
}
|
||||
return input;
|
||||
}
|
||||
|
||||
private static Encryption getEncryption() {
|
||||
if (defaultEncryption == null) {
|
||||
defaultEncryption = new Encryption(KeySources.fixedKey(ENCRYPTION_KEY), CipherSources.aes());
|
||||
}
|
||||
return defaultEncryption;
|
||||
}
|
||||
|
||||
public static final String PASSWORD_FOR_LOGS_VALUE = "...";
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,299 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2018 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.librariesmanager.librarydata;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
public class LibraryDataJsonProvider {
|
||||
|
||||
private static Logger log = Logger.getLogger(LibraryDataJsonProvider.class);
|
||||
|
||||
private File dataFile;
|
||||
|
||||
public LibraryDataJsonProvider(File dataFile) {
|
||||
this.dataFile = dataFile;
|
||||
}
|
||||
|
||||
public Map<String, Library> loadLicenseData() {
|
||||
Map<String, Library> mvnToLibraryMap = new HashMap<String, Library>();
|
||||
TypeReference<Libraries> typeReference = new TypeReference<Libraries>() {
|
||||
// no need to overwrite
|
||||
};
|
||||
if (dataFile.exists()) {
|
||||
try {
|
||||
Libraries libraries = new ObjectMapper().readValue(dataFile, typeReference);
|
||||
mvnToLibraryMap.clear();
|
||||
for (Library obj : libraries.getLibraryList()) {
|
||||
mvnToLibraryMap.put(obj.getMvnUrl(), obj);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
} else {
|
||||
log.error("Can't find license data file:" + dataFile.getAbsolutePath());
|
||||
}
|
||||
|
||||
return mvnToLibraryMap;
|
||||
}
|
||||
|
||||
public synchronized void saveLicenseData(Map<String, Library> mvnToLibraryMap) {
|
||||
Libraries libraries = new Libraries();
|
||||
for (String mvnUrl : mvnToLibraryMap.keySet()) {
|
||||
Library library = mvnToLibraryMap.get(mvnUrl);
|
||||
libraries.getLibraryList().add(library);
|
||||
}
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
if (!dataFile.exists()) {
|
||||
dataFile.createNewFile();
|
||||
}
|
||||
objectMapper.writerWithDefaultPrettyPrinter().writeValue(dataFile, libraries);
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Libraries {
|
||||
|
||||
@JsonProperty("library")
|
||||
private List<Library> libraryList = new ArrayList<Library>();
|
||||
|
||||
public List<Library> getLibraryList() {
|
||||
return libraryList;
|
||||
}
|
||||
|
||||
public void setLibraryList(List<Library> libraryList) {
|
||||
this.libraryList = libraryList;
|
||||
}
|
||||
}
|
||||
|
||||
class Library {
|
||||
|
||||
@JsonProperty("mvnUrl")
|
||||
private String mvnUrl;
|
||||
|
||||
@JsonProperty("groupId")
|
||||
private String groupId;
|
||||
|
||||
@JsonProperty("artifactId")
|
||||
private String artifactId;
|
||||
|
||||
@JsonProperty("version")
|
||||
private String version;
|
||||
|
||||
@JsonProperty("type")
|
||||
private String type;
|
||||
|
||||
@JsonInclude(Include.NON_DEFAULT)
|
||||
@JsonProperty("classifier")
|
||||
private String classifier;
|
||||
|
||||
@JsonInclude(Include.NON_DEFAULT)
|
||||
@JsonProperty("url")
|
||||
private String url;
|
||||
|
||||
@JsonProperty("licenseMissing")
|
||||
@JsonInclude(Include.NON_DEFAULT)
|
||||
private boolean licenseMissing = false;
|
||||
|
||||
@JsonProperty("pomMissing")
|
||||
@JsonInclude(Include.NON_DEFAULT)
|
||||
private boolean pomMissing = false;
|
||||
|
||||
@JsonProperty("jarMissing")
|
||||
@JsonInclude(Include.NON_DEFAULT)
|
||||
private boolean jarMissing = false;
|
||||
|
||||
@JsonProperty("licenses")
|
||||
List<LibraryLicense> licenses = new ArrayList<LibraryLicense>();
|
||||
|
||||
public Library() {
|
||||
}
|
||||
|
||||
public String getMvnUrl() {
|
||||
return mvnUrl;
|
||||
}
|
||||
|
||||
public void setMvnUrl(String mvnUrl) {
|
||||
this.mvnUrl = mvnUrl;
|
||||
}
|
||||
|
||||
public List<LibraryLicense> getLicenses() {
|
||||
return licenses;
|
||||
}
|
||||
|
||||
public void setLicenses(List<LibraryLicense> licenses) {
|
||||
this.licenses = licenses;
|
||||
}
|
||||
|
||||
public String getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
public void setGroupId(String groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
public String getArtifactId() {
|
||||
return artifactId;
|
||||
}
|
||||
|
||||
public void setArtifactId(String artifactId) {
|
||||
this.artifactId = artifactId;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getClassifier() {
|
||||
return classifier;
|
||||
}
|
||||
|
||||
public void setClassifier(String classifier) {
|
||||
this.classifier = classifier;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public boolean isLicenseMissing() {
|
||||
return licenseMissing;
|
||||
}
|
||||
|
||||
public void setLicenseMissing(boolean licenseMissing) {
|
||||
this.licenseMissing = licenseMissing;
|
||||
}
|
||||
|
||||
public boolean isJarMissing() {
|
||||
return jarMissing;
|
||||
}
|
||||
|
||||
public void setJarMissing(boolean jarMissing) {
|
||||
this.jarMissing = jarMissing;
|
||||
}
|
||||
|
||||
public boolean isPomMissing() {
|
||||
return pomMissing;
|
||||
}
|
||||
|
||||
public void setPomMissing(boolean pomMissing) {
|
||||
this.pomMissing = pomMissing;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("mvnUrl: ").append(mvnUrl);
|
||||
sb.append("groupId: ").append(groupId);
|
||||
sb.append("artifactId: ").append(artifactId);
|
||||
sb.append("version: ").append(version);
|
||||
sb.append("type: ").append(type);
|
||||
for (int i = 0; i < licenses.size(); i++) {
|
||||
sb.append("License " + i + ": " + licenses.get(i).toString());
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
class LibraryLicense {
|
||||
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
|
||||
@JsonInclude(Include.NON_DEFAULT)
|
||||
@JsonProperty("url")
|
||||
private String url;
|
||||
|
||||
@JsonInclude(Include.NON_DEFAULT)
|
||||
@JsonProperty("distribution")
|
||||
private String distribution;
|
||||
|
||||
@JsonInclude(Include.NON_DEFAULT)
|
||||
@JsonProperty("comments")
|
||||
private String comments;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getDistribution() {
|
||||
return distribution;
|
||||
}
|
||||
|
||||
public void setDistribution(String distribution) {
|
||||
this.distribution = distribution;
|
||||
}
|
||||
|
||||
public String getComments() {
|
||||
return comments;
|
||||
}
|
||||
|
||||
public void setComments(String comments) {
|
||||
this.comments = comments;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("name: ").append(name == null ? "" : name);
|
||||
sb.append("name: ").append(url == null ? "" : url);
|
||||
sb.append("distribution: ").append(distribution == null ? "" : distribution);
|
||||
sb.append("comments: ").append(comments == null ? "" : comments);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,331 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2018 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.librariesmanager.librarydata;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.talend.core.runtime.maven.MavenArtifact;
|
||||
import org.talend.core.runtime.maven.MavenConstants;
|
||||
import org.talend.core.runtime.maven.MavenUrlHelper;
|
||||
import org.talend.designer.maven.aether.util.MavenLibraryResolverProvider;
|
||||
|
||||
public class LibraryDataService {
|
||||
|
||||
private static Logger logger = Logger.getLogger(LibraryDataService.class);
|
||||
|
||||
/**
|
||||
* {@value}
|
||||
* <p>
|
||||
* System property of build studio library license file, the default value is <b>false</b>.
|
||||
*/
|
||||
public static final String KEY_LIBRARIES_BUILD_LICENSE = "talend.libraries.buildLicense"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* {@value}
|
||||
* <p>
|
||||
* System property of build studio library file, the default value is <b>false</b>.
|
||||
*/
|
||||
public static final String KEY_LIBRARIES_BUILD_JAR = "talend.libraries.buildJar"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* {@value}
|
||||
* <p>
|
||||
* System property of studio library data file folder path, the default value is Studio install
|
||||
* folder/configuration.
|
||||
*/
|
||||
public static final String KEY_LIBRARIES_DATA_FOLDER = "talend.libraries.folder"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* {@value}
|
||||
* <p>
|
||||
* System property of retrieve library data, the default value is <b>true</b>.
|
||||
*/
|
||||
public static final String KEY_BUILD_LIBRARY_IF_MISSING = "talend.libraries.buildIfMissing"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* {@value}
|
||||
* <p>
|
||||
* System property of retrieve library data, the default value is <b>false</b>.
|
||||
*/
|
||||
public static final String KEY_BUILD_LIBRARY_IF_LICENSE_MISSING = "talend.libraries.buildIfLicenseMissing"; //$NON-NLS-1$
|
||||
|
||||
private static final String LIBRARIES_DATA_FILE_NAME = "library_data.index"; //$NON-NLS-1$
|
||||
|
||||
private static final String UNRESOLVED_LICENSE_NAME = "UNKNOW"; //$NON-NLS-1$
|
||||
|
||||
private static boolean buildLibraryIfFileMissing = true;
|
||||
|
||||
private boolean buildLibraryLicense = false;
|
||||
|
||||
private boolean buildLibraryIfLibraryMissing = true;
|
||||
|
||||
private boolean buildLibraryIfLicenseMissing = false;
|
||||
|
||||
private boolean buildLibraryJarFile = false;
|
||||
|
||||
private static final Map<String, Library> mvnToLibraryMap = new ConcurrentHashMap<String, Library>();
|
||||
|
||||
private static LibraryDataService instance;
|
||||
|
||||
private LibraryDataJsonProvider dataProvider;
|
||||
|
||||
private Set<String> retievedMissingSet = new HashSet<String>();
|
||||
|
||||
private int repeatTime = 3;
|
||||
|
||||
private LibraryLicense unknownLicense;;
|
||||
|
||||
private LibraryDataService() {
|
||||
buildLibraryLicense = Boolean.valueOf(System.getProperty(KEY_LIBRARIES_BUILD_LICENSE, Boolean.FALSE.toString()));
|
||||
buildLibraryIfLibraryMissing = Boolean.valueOf(System.getProperty(KEY_BUILD_LIBRARY_IF_MISSING, Boolean.TRUE.toString()));
|
||||
buildLibraryIfLicenseMissing = Boolean
|
||||
.valueOf(System.getProperty(KEY_BUILD_LIBRARY_IF_LICENSE_MISSING, Boolean.FALSE.toString()));
|
||||
buildLibraryJarFile = Boolean.valueOf(System.getProperty(KEY_LIBRARIES_BUILD_JAR, Boolean.FALSE.toString()));
|
||||
File libraryDataFile = getLibraryDataFile();
|
||||
if (buildLibraryLicense) {
|
||||
if (libraryDataFile.exists()) {
|
||||
libraryDataFile.delete();
|
||||
}
|
||||
}
|
||||
unknownLicense = new LibraryLicense();
|
||||
unknownLicense.setName(UNRESOLVED_LICENSE_NAME);
|
||||
dataProvider = new LibraryDataJsonProvider(libraryDataFile);
|
||||
mvnToLibraryMap.putAll(dataProvider.loadLicenseData());
|
||||
}
|
||||
|
||||
public static LibraryDataService getInstance() {
|
||||
if (instance == null) {
|
||||
synchronized (LibraryDataService.class) {
|
||||
if (instance == null) {
|
||||
instance = new LibraryDataService();
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void buildLibraryLicenseData(Set<String> mvnUrlList) {
|
||||
for (String mvnUrl : mvnUrlList) {
|
||||
Library libraryObj = resolve(mvnUrl);
|
||||
mvnToLibraryMap.put(getShortMvnUrl(mvnUrl), libraryObj);
|
||||
|
||||
}
|
||||
dataProvider.saveLicenseData(mvnToLibraryMap);
|
||||
}
|
||||
|
||||
private Library resolve(String mvnUrl) {
|
||||
MavenArtifact artifact = MavenUrlHelper.parseMvnUrl(mvnUrl);
|
||||
Library libraryObj = new Library();
|
||||
libraryObj.setGroupId(artifact.getGroupId());
|
||||
libraryObj.setArtifactId(artifact.getArtifactId());
|
||||
libraryObj.setVersion(artifact.getVersion());
|
||||
libraryObj.setMvnUrl(getShortMvnUrl(mvnUrl));
|
||||
libraryObj.setType(artifact.getType());
|
||||
libraryObj.setClassifier(artifact.getClassifier());
|
||||
boolean hasError = false;
|
||||
logger.debug("Resolving artifact descriptor:" + getShortMvnUrl(mvnUrl)); //$NON-NLS-1$
|
||||
for (int repeated = 0; repeated < repeatTime; repeated++) {
|
||||
try {
|
||||
if (repeated > 0) {
|
||||
Thread.sleep(1000); // To avoid server connection pool shut down
|
||||
}
|
||||
Map<String, Object> properties = resolveDescProperties(artifact);
|
||||
parseDescriptorResult(libraryObj, properties);
|
||||
hasError = false;
|
||||
} catch (Exception e) {
|
||||
hasError = true;
|
||||
}
|
||||
if (!hasError) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
logger.debug("Resolved artifact descriptor:" + getShortMvnUrl(mvnUrl)); //$NON-NLS-1$
|
||||
if (buildLibraryJarFile) {
|
||||
boolean jarMissing = false;
|
||||
try {
|
||||
MavenLibraryResolverProvider.getInstance().resolveArtifact(artifact);
|
||||
} catch (Exception ex) {
|
||||
jarMissing = true;
|
||||
} finally {
|
||||
libraryObj.setJarMissing(jarMissing);
|
||||
}
|
||||
}
|
||||
|
||||
return libraryObj;
|
||||
}
|
||||
|
||||
public Map<String, Object> resolveDescProperties(MavenArtifact artifact) throws Exception {
|
||||
Map<String, Object> properties = MavenLibraryResolverProvider.getInstance().resolveDescProperties(artifact);
|
||||
return properties;
|
||||
}
|
||||
|
||||
public void fillArtifactPropertyData(Map<String, Object> properties, MavenArtifact artifact) {
|
||||
Library libraryObj = new Library();
|
||||
libraryObj.setGroupId(artifact.getGroupId());
|
||||
libraryObj.setArtifactId(artifact.getArtifactId());
|
||||
libraryObj.setVersion(artifact.getVersion());
|
||||
libraryObj.setMvnUrl(artifact.getUrl());
|
||||
libraryObj.setType(artifact.getType());
|
||||
libraryObj.setClassifier(artifact.getClassifier());
|
||||
|
||||
parseDescriptorResult(libraryObj, properties);
|
||||
fillLibraryData(libraryObj, artifact);
|
||||
}
|
||||
|
||||
private boolean isPackagePom(Library libraryObj) {
|
||||
if (libraryObj != null) {
|
||||
if ("pom".equalsIgnoreCase(libraryObj.getType())) {
|
||||
return true;
|
||||
}
|
||||
for (LibraryLicense license : libraryObj.getLicenses()) {
|
||||
if (MavenConstants.DOWNLOAD_MANUAL.equalsIgnoreCase(license.getDistribution())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void parseDescriptorResult(Library libraryObj, Map<String, Object> properties) {
|
||||
if (properties.size() == 0) {
|
||||
libraryObj.setPomMissing(true);
|
||||
}
|
||||
libraryObj.setType(String.valueOf(properties.get("type"))); //$NON-NLS-1$
|
||||
int licenseCount = 0;
|
||||
if (properties.containsKey("license.count")) { //$NON-NLS-1$
|
||||
licenseCount = (int) properties.get("license.count"); //$NON-NLS-1$
|
||||
}
|
||||
for (int i = 0; i < licenseCount; i++) {
|
||||
String name = getStringValue(properties.get("license." + i + ".name")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
String url = getStringValue(properties.get("license." + i + ".url")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
String comments = getStringValue(properties.get("license." + i + ".comments")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
String distribution = getStringValue(properties.get("license." + i + ".distribution")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
LibraryLicense license = new LibraryLicense();
|
||||
license.setName(name);
|
||||
license.setUrl(url);
|
||||
license.setComments(comments);
|
||||
license.setDistribution(distribution);
|
||||
libraryObj.getLicenses().add(license);
|
||||
}
|
||||
|
||||
if (libraryObj.getLicenses().size() == 0) {
|
||||
libraryObj.setLicenseMissing(true);
|
||||
libraryObj.getLicenses().add(unknownLicense);
|
||||
}
|
||||
}
|
||||
|
||||
private String getStringValue(Object value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
public boolean isBuildLibrariesData() {
|
||||
if (buildLibraryLicense) {
|
||||
return true;
|
||||
}
|
||||
if (buildLibraryIfFileMissing && !getLibraryDataFile().exists()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private File getLibraryDataFile() {
|
||||
String folder = System.getProperty(KEY_LIBRARIES_DATA_FOLDER);
|
||||
if (folder == null) {
|
||||
folder = new File(Platform.getInstallLocation().getURL().getPath(), "configuration").getAbsolutePath(); //$NON-NLS-1$
|
||||
}
|
||||
return new File(folder, LIBRARIES_DATA_FILE_NAME);
|
||||
}
|
||||
|
||||
public boolean fillLibraryData(String mvnUrl, MavenArtifact artifact) {
|
||||
boolean isExist = false;
|
||||
String shortMvnUrl = getShortMvnUrl(mvnUrl);
|
||||
Library object = mvnToLibraryMap.get(shortMvnUrl);
|
||||
if (!retievedMissingSet.contains(mvnUrl) && ((object == null && buildLibraryIfLibraryMissing)
|
||||
|| (object.isLicenseMissing() && buildLibraryIfLicenseMissing))) {
|
||||
Library newObject = null;
|
||||
retievedMissingSet.add(mvnUrl);
|
||||
try {
|
||||
newObject = resolve(mvnUrl);
|
||||
} catch (Exception e) {
|
||||
logger.warn("Resolve pom failed:" + shortMvnUrl); //$NON-NLS-1$
|
||||
}
|
||||
if (newObject != null && (evaluateLibrary(newObject) > evaluateLibrary(object))) {
|
||||
object = newObject;
|
||||
mvnToLibraryMap.put(shortMvnUrl, object);
|
||||
dataProvider.saveLicenseData(mvnToLibraryMap);
|
||||
}
|
||||
}
|
||||
if (object != null) {
|
||||
if ("jar".equalsIgnoreCase(object.getType()) && !object.isJarMissing() && !object.isPomMissing()) {
|
||||
isExist = true;
|
||||
}
|
||||
fillLibraryData(object, artifact);
|
||||
}
|
||||
return isExist;
|
||||
}
|
||||
|
||||
public void fillLibraryData(Library object, MavenArtifact artifact) {
|
||||
if (object != null && artifact != null) {
|
||||
List<LibraryLicense> objLicenseList = object.getLicenses();
|
||||
LibraryLicense bestLicense = null;
|
||||
if (objLicenseList.size() >= 1) {
|
||||
bestLicense = objLicenseList.get(0);
|
||||
}
|
||||
if (bestLicense != null) {
|
||||
artifact.setLicense(bestLicense.getName());
|
||||
artifact.setLicenseUrl(bestLicense.getUrl());
|
||||
}
|
||||
|
||||
// URL
|
||||
if (StringUtils.isEmpty(artifact.getUrl()) && StringUtils.isNotEmpty(object.getUrl())) {
|
||||
artifact.setUrl(object.getUrl());
|
||||
}
|
||||
if (isPackagePom(object)) {
|
||||
artifact.setDistribution(MavenConstants.DOWNLOAD_MANUAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getShortMvnUrl(String mvnUrl) {
|
||||
if (mvnUrl.indexOf("@") > 0 && mvnUrl.indexOf("!") > 0) {
|
||||
mvnUrl = "mvn:" + mvnUrl.substring(mvnUrl.indexOf("!") + 1);
|
||||
}
|
||||
return mvnUrl;
|
||||
}
|
||||
|
||||
private int evaluateLibrary(Library obj1) {
|
||||
int score = -1;
|
||||
if (obj1 != null) {
|
||||
score++;
|
||||
if (!obj1.isJarMissing()) {
|
||||
score++;
|
||||
}
|
||||
if (!obj1.isLicenseMissing()) {
|
||||
score += 2;
|
||||
}
|
||||
}
|
||||
return score;
|
||||
}
|
||||
}
|
||||
@@ -837,9 +837,12 @@ public final class DBConnectionContextUtils {
|
||||
if (dbConn.getDatabaseType().equals(EDatabaseConnTemplate.GENERAL_JDBC.getDBDisplayName())) {
|
||||
urlConnection = ConnectionContextHelper.getOriginalValue(contextType, dbConn.getURL());
|
||||
} else {
|
||||
if (!StringUtils.equals(dbConn.getDatabaseType(), EDatabaseTypeName.FIREBIRD.getXmlName())) {
|
||||
filePath = filePath.toLowerCase();
|
||||
}
|
||||
urlConnection =
|
||||
DatabaseConnStrUtil.getURLString(dbConn.getDatabaseType(), dbConn.getDbVersionString(), server,
|
||||
username, password, port, sidOrDatabase, filePath.toLowerCase(), datasource, dbRootPath,
|
||||
username, password, port, sidOrDatabase, filePath, datasource, dbRootPath,
|
||||
additionParam);
|
||||
}
|
||||
|
||||
@@ -1267,12 +1270,12 @@ public final class DBConnectionContextUtils {
|
||||
|
||||
// TDI-28124:tdb2input can't guess schema from join sql on system table
|
||||
if (EDatabaseTypeName.IBMDB2.equals(EDatabaseTypeName.getTypeFromDbType(dbConn.getDatabaseType()))) {
|
||||
String cursorForDb2 = ":cursorSensitivity=2;";
|
||||
String database = sidOrDatabase + cursorForDb2;
|
||||
String cursorForDb2 = "cursorSensitivity=2;";
|
||||
String database = sidOrDatabase;
|
||||
String newURL =
|
||||
DatabaseConnStrUtil.getURLString(cloneConn.getDatabaseType(), dbConn.getDbVersionString(), server,
|
||||
username, password, port, database, filePath.toLowerCase(), datasource, dbRootPath,
|
||||
additionParam);
|
||||
additionParam) + cursorForDb2;
|
||||
cloneConn.setURL(newURL);
|
||||
return cloneConn;
|
||||
}
|
||||
|
||||
@@ -344,7 +344,11 @@ public final class XsdMetadataUtils {
|
||||
xmlNode.setRelatedColumn(uniqueName);
|
||||
metadataTable.getColumns().add(column);
|
||||
} else {
|
||||
xmlNode.setAttribute("main"); //$NON-NLS-1$
|
||||
if(loopElementFound) {
|
||||
xmlNode.setAttribute("branch");//$NON-NLS-1$
|
||||
}else {
|
||||
xmlNode.setAttribute("main"); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ATreeNode.NAMESPACE_TYPE:
|
||||
@@ -357,13 +361,14 @@ public final class XsdMetadataUtils {
|
||||
case ATreeNode.OTHER_TYPE:
|
||||
break;
|
||||
}
|
||||
|
||||
boolean subElementsInLoop = inLoop;
|
||||
// will try to get the first element (branch or main), and set it as loop.
|
||||
if ((!loopElementFound && path.split("/").length == 2 && node.getType() == ATreeNode.ELEMENT_TYPE) || subElementsInLoop) { //$NON-NLS-1$
|
||||
connection.getLoop().add(xmlNode);
|
||||
loopElementFound = true;
|
||||
subElementsInLoop = true;
|
||||
} else {
|
||||
}else {
|
||||
connection.getRoot().add(xmlNode);
|
||||
}
|
||||
if (node.getChildren().length > 0) {
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.commons.collections.map.MultiKeyMap;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.talend.commons.utils.encoding.CharsetToolkit;
|
||||
import org.talend.core.database.EDatabaseTypeName;
|
||||
import org.talend.core.database.conn.version.EDatabaseVersion4Drivers;
|
||||
@@ -154,8 +155,12 @@ public class JDBCDriverLoader {
|
||||
// to avoid NPE
|
||||
username = username != null ? username : "";
|
||||
password = password != null ? password : "";
|
||||
info.put("user", username); //$NON-NLS-1$
|
||||
info.put("password", password); //$NON-NLS-1$
|
||||
if (StringUtils.isNotEmpty(username)) {
|
||||
info.put("user", username); //$NON-NLS-1$
|
||||
}
|
||||
if (StringUtils.isNotEmpty(password)) {
|
||||
info.put("password", password); //$NON-NLS-1$
|
||||
}
|
||||
if (dbType.equals(EDatabaseTypeName.ACCESS.getXmlName()) || dbType.equals(EDatabaseTypeName.GODBC.getXmlName())) {
|
||||
Charset systemCharset = CharsetToolkit.getInternalSystemCharset();
|
||||
if (systemCharset != null && systemCharset.displayName() != null) {
|
||||
|
||||
@@ -144,6 +144,8 @@ public class DBConnectionFillerImpl extends MetadataFillerImpl<DatabaseConnectio
|
||||
}
|
||||
}
|
||||
java.sql.Connection sqlConnection = null;
|
||||
Statement stmt = null;
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
// MetadataConnectionUtils.setMetadataCon(metadataBean);
|
||||
// fill some base parameter
|
||||
@@ -167,13 +169,22 @@ public class DBConnectionFillerImpl extends MetadataFillerImpl<DatabaseConnectio
|
||||
: dbMetadata.getDatabaseProductName();
|
||||
String productVersion = dbMetadata.getDatabaseProductVersion() == null ? PluginConstant.EMPTY_STRING
|
||||
: dbMetadata.getDatabaseProductVersion();
|
||||
String databaseType = dbconn.getDatabaseType();
|
||||
// TDQ-16331 Azure Mysql must use 'select version()' to get correct version
|
||||
if (EDatabaseTypeName.MYSQL.getDisplayName().equals(databaseType)) {
|
||||
stmt = sqlConnection.createStatement();
|
||||
rs = stmt.executeQuery("select version()"); //$NON-NLS-1$
|
||||
while (rs.next()) {
|
||||
productVersion = rs.getString(1);
|
||||
}
|
||||
}
|
||||
// TDI-35419 TDQ-11853: make sure the redshift connection save the productName is redshift, not use the
|
||||
// postgresql.becauses we use this value to create dbmslauguage
|
||||
boolean isRedshift = dbconn.getDatabaseType().equals(EDatabaseTypeName.REDSHIFT.getDisplayName());
|
||||
boolean isRedshift = EDatabaseTypeName.REDSHIFT.getDisplayName().equals(databaseType);
|
||||
if (isRedshift) {
|
||||
productName = EDatabaseTypeName.REDSHIFT.getDisplayName();
|
||||
}
|
||||
boolean isRedshift_SSO = dbconn.getDatabaseType().equals(EDatabaseTypeName.REDSHIFT_SSO.getDisplayName());
|
||||
boolean isRedshift_SSO = EDatabaseTypeName.REDSHIFT_SSO.getDisplayName().equals(databaseType);
|
||||
if (isRedshift_SSO) {
|
||||
productName = EDatabaseTypeName.REDSHIFT_SSO.getDisplayName();
|
||||
}
|
||||
@@ -181,14 +192,12 @@ public class DBConnectionFillerImpl extends MetadataFillerImpl<DatabaseConnectio
|
||||
TaggedValueHelper.setTaggedValue(dbconn, TaggedValueHelper.DB_PRODUCT_NAME, productName);
|
||||
TaggedValueHelper.setTaggedValue(dbconn, TaggedValueHelper.DB_PRODUCT_VERSION, productVersion);
|
||||
|
||||
boolean isHive = dbconn.getDatabaseType().equals(EDatabaseTypeName.HIVE.getDisplayName());
|
||||
boolean isHiveJdbc = dbconn.getDatabaseType().equals(EDatabaseTypeName.GENERAL_JDBC.getDisplayName())
|
||||
&& dbconn.getDriverClass() != null
|
||||
&& dbconn.getDriverClass().equals(EDatabase4DriverClassName.HIVE.getDriverClass());
|
||||
boolean isImpala = dbconn.getDatabaseType().equals(EDatabaseTypeName.IMPALA.getDisplayName());
|
||||
boolean isImpalaJdbc = dbconn.getDatabaseType().equals(EDatabaseTypeName.IMPALA.getDisplayName())
|
||||
&& dbconn.getDriverClass() != null
|
||||
&& dbconn.getDriverClass().equals(EDatabase4DriverClassName.IMPALA.getDriverClass());
|
||||
boolean isHive = EDatabaseTypeName.HIVE.getDisplayName().equals(databaseType);
|
||||
boolean isHiveJdbc = EDatabaseTypeName.GENERAL_JDBC.getDisplayName().equals(databaseType)
|
||||
&& EDatabase4DriverClassName.HIVE.getDriverClass().equals(dbconn.getDriverClass());
|
||||
boolean isImpala = EDatabaseTypeName.IMPALA.getDisplayName().equals(databaseType);
|
||||
boolean isImpalaJdbc = EDatabaseTypeName.IMPALA.getDisplayName().equals(databaseType)
|
||||
&& EDatabase4DriverClassName.IMPALA.getDriverClass().equals(dbconn.getDriverClass());
|
||||
if (!isHive && !isHiveJdbc && !isImpala && !isImpalaJdbc) {
|
||||
String identifierQuote = dbMetadata.getIdentifierQuoteString();
|
||||
ConnectionHelper.setIdentifierQuoteString(identifierQuote == null ? "" : identifierQuote, dbconn); //$NON-NLS-1$
|
||||
@@ -206,13 +215,19 @@ public class DBConnectionFillerImpl extends MetadataFillerImpl<DatabaseConnectio
|
||||
if (sqlConnection != null) {
|
||||
ConnectionUtils.closeConnection(sqlConnection);
|
||||
}
|
||||
if (driver != null
|
||||
&& MetadataConnectionUtils.isDerbyRelatedDb(metadataBean.getDriverClass(), metadataBean.getDbType())) {
|
||||
try {
|
||||
try {
|
||||
if (driver != null && MetadataConnectionUtils
|
||||
.isDerbyRelatedDb(metadataBean.getDriverClass(), metadataBean.getDbType())) {
|
||||
driver.connect("jdbc:derby:;shutdown=true", null); //$NON-NLS-1$
|
||||
} catch (SQLException e) {
|
||||
// exception of shutdown success. no need to catch.
|
||||
}
|
||||
if (stmt != null) {
|
||||
stmt.close();
|
||||
}
|
||||
if (rs != null) {
|
||||
rs.close();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
// exception of shutdown success. no need to catch.
|
||||
}
|
||||
}
|
||||
if (newConnection != null) {
|
||||
|
||||
@@ -1088,6 +1088,11 @@ public class ConnectionHelper {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* TUP-21510, should only work for old migration task.
|
||||
*/
|
||||
@Deprecated
|
||||
public static String getCleanPassword(String password) {
|
||||
if (StringUtils.isBlank(password)) {
|
||||
return password;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
package org.talend.cwm.relational;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import orgomg.cwm.objectmodel.core.Expression;
|
||||
|
||||
/**
|
||||
@@ -16,10 +17,10 @@ import orgomg.cwm.objectmodel.core.Expression;
|
||||
* <p>
|
||||
* The following features are supported:
|
||||
* <ul>
|
||||
* <li>{@link org.talend.cwm.relational.TdExpression#getVersion <em>Version</em>}</li>
|
||||
* <li>{@link org.talend.cwm.relational.TdExpression#getModificationDate <em>Modification Date</em>}</li>
|
||||
* <li>{@link org.talend.cwm.relational.TdExpression#getName <em>Name</em>}</li>
|
||||
* <li>{@link org.talend.cwm.relational.TdExpression#getExpressionVariableMap <em>Expression Variable Map</em>}</li>
|
||||
* <li>{@link org.talend.cwm.relational.TdExpression#getVersion <em>Version</em>}</li>
|
||||
* <li>{@link org.talend.cwm.relational.TdExpression#getModificationDate <em>Modification Date</em>}</li>
|
||||
* <li>{@link org.talend.cwm.relational.TdExpression#getName <em>Name</em>}</li>
|
||||
* <li>{@link org.talend.cwm.relational.TdExpression#getExpressionVariableMap <em>Expression Variable Map</em>}</li>
|
||||
* </ul>
|
||||
* </p>
|
||||
*
|
||||
@@ -37,6 +38,7 @@ public interface TdExpression extends Expression {
|
||||
* there really should be more of a description here...
|
||||
* </p>
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* @return the value of the '<em>Version</em>' attribute.
|
||||
* @see #setVersion(String)
|
||||
* @see org.talend.cwm.relational.RelationalPackage#getTdExpression_Version()
|
||||
@@ -49,6 +51,7 @@ public interface TdExpression extends Expression {
|
||||
* Sets the value of the '{@link org.talend.cwm.relational.TdExpression#getVersion <em>Version</em>}' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* @param value the new value of the '<em>Version</em>' attribute.
|
||||
* @see #getVersion()
|
||||
* @generated
|
||||
@@ -63,6 +66,7 @@ public interface TdExpression extends Expression {
|
||||
* there really should be more of a description here...
|
||||
* </p>
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* @return the value of the '<em>Modification Date</em>' attribute.
|
||||
* @see #setModificationDate(String)
|
||||
* @see org.talend.cwm.relational.RelationalPackage#getTdExpression_ModificationDate()
|
||||
@@ -72,9 +76,11 @@ public interface TdExpression extends Expression {
|
||||
String getModificationDate();
|
||||
|
||||
/**
|
||||
* Sets the value of the '{@link org.talend.cwm.relational.TdExpression#getModificationDate <em>Modification Date</em>}' attribute.
|
||||
* Sets the value of the '{@link org.talend.cwm.relational.TdExpression#getModificationDate <em>Modification
|
||||
* Date</em>}' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* @param value the new value of the '<em>Modification Date</em>' attribute.
|
||||
* @see #getModificationDate()
|
||||
* @generated
|
||||
@@ -89,6 +95,7 @@ public interface TdExpression extends Expression {
|
||||
* there really should be more of a description here...
|
||||
* </p>
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* @return the value of the '<em>Name</em>' attribute.
|
||||
* @see #setName(String)
|
||||
* @see org.talend.cwm.relational.RelationalPackage#getTdExpression_Name()
|
||||
@@ -101,6 +108,7 @@ public interface TdExpression extends Expression {
|
||||
* Sets the value of the '{@link org.talend.cwm.relational.TdExpression#getName <em>Name</em>}' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* @param value the new value of the '<em>Name</em>' attribute.
|
||||
* @see #getName()
|
||||
* @generated
|
||||
@@ -115,6 +123,7 @@ public interface TdExpression extends Expression {
|
||||
* there really should be more of a description here...
|
||||
* </p>
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* @return the value of the '<em>Expression Variable Map</em>' attribute.
|
||||
* @see #setExpressionVariableMap(HashMap)
|
||||
* @see org.talend.cwm.relational.RelationalPackage#getTdExpression_ExpressionVariableMap()
|
||||
@@ -124,13 +133,22 @@ public interface TdExpression extends Expression {
|
||||
HashMap<String, String> getExpressionVariableMap();
|
||||
|
||||
/**
|
||||
* Sets the value of the '{@link org.talend.cwm.relational.TdExpression#getExpressionVariableMap <em>Expression Variable Map</em>}' attribute.
|
||||
* Sets the value of the '{@link org.talend.cwm.relational.TdExpression#getExpressionVariableMap <em>Expression
|
||||
* Variable Map</em>}' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* @param value the new value of the '<em>Expression Variable Map</em>' attribute.
|
||||
* @see #getExpressionVariableMap()
|
||||
* @generated
|
||||
*/
|
||||
void setExpressionVariableMap(HashMap<String, String> value);
|
||||
|
||||
/**
|
||||
* Judge whether two expression take same database type and same version
|
||||
*
|
||||
* @generated not
|
||||
*/
|
||||
boolean sameVersionAndType(TdExpression targetEx);
|
||||
|
||||
} // TdExpression
|
||||
|
||||
@@ -6,12 +6,10 @@
|
||||
package org.talend.cwm.relational.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.eclipse.emf.common.notify.Notification;
|
||||
|
||||
import org.eclipse.emf.ecore.EClass;
|
||||
|
||||
import org.eclipse.emf.ecore.impl.ENotificationImpl;
|
||||
|
||||
import org.talend.cwm.relational.RelationalPackage;
|
||||
import org.talend.cwm.relational.TdExpression;
|
||||
|
||||
@@ -24,10 +22,11 @@ import orgomg.cwm.objectmodel.core.impl.ExpressionImpl;
|
||||
* <p>
|
||||
* The following features are implemented:
|
||||
* <ul>
|
||||
* <li>{@link org.talend.cwm.relational.impl.TdExpressionImpl#getVersion <em>Version</em>}</li>
|
||||
* <li>{@link org.talend.cwm.relational.impl.TdExpressionImpl#getModificationDate <em>Modification Date</em>}</li>
|
||||
* <li>{@link org.talend.cwm.relational.impl.TdExpressionImpl#getName <em>Name</em>}</li>
|
||||
* <li>{@link org.talend.cwm.relational.impl.TdExpressionImpl#getExpressionVariableMap <em>Expression Variable Map</em>}</li>
|
||||
* <li>{@link org.talend.cwm.relational.impl.TdExpressionImpl#getVersion <em>Version</em>}</li>
|
||||
* <li>{@link org.talend.cwm.relational.impl.TdExpressionImpl#getModificationDate <em>Modification Date</em>}</li>
|
||||
* <li>{@link org.talend.cwm.relational.impl.TdExpressionImpl#getName <em>Name</em>}</li>
|
||||
* <li>{@link org.talend.cwm.relational.impl.TdExpressionImpl#getExpressionVariableMap <em>Expression Variable
|
||||
* Map</em>}</li>
|
||||
* </ul>
|
||||
* </p>
|
||||
*
|
||||
@@ -39,6 +38,7 @@ public class TdExpressionImpl extends ExpressionImpl implements TdExpression {
|
||||
* The default value of the '{@link #getVersion() <em>Version</em>}' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* @see #getVersion()
|
||||
* @generated
|
||||
* @ordered
|
||||
@@ -49,6 +49,7 @@ public class TdExpressionImpl extends ExpressionImpl implements TdExpression {
|
||||
* The cached value of the '{@link #getVersion() <em>Version</em>}' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* @see #getVersion()
|
||||
* @generated
|
||||
* @ordered
|
||||
@@ -59,6 +60,7 @@ public class TdExpressionImpl extends ExpressionImpl implements TdExpression {
|
||||
* The default value of the '{@link #getModificationDate() <em>Modification Date</em>}' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* @see #getModificationDate()
|
||||
* @generated
|
||||
* @ordered
|
||||
@@ -69,6 +71,7 @@ public class TdExpressionImpl extends ExpressionImpl implements TdExpression {
|
||||
* The cached value of the '{@link #getModificationDate() <em>Modification Date</em>}' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* @see #getModificationDate()
|
||||
* @generated
|
||||
* @ordered
|
||||
@@ -79,6 +82,7 @@ public class TdExpressionImpl extends ExpressionImpl implements TdExpression {
|
||||
* The default value of the '{@link #getName() <em>Name</em>}' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* @see #getName()
|
||||
* @generated
|
||||
* @ordered
|
||||
@@ -89,6 +93,7 @@ public class TdExpressionImpl extends ExpressionImpl implements TdExpression {
|
||||
* The cached value of the '{@link #getName() <em>Name</em>}' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* @see #getName()
|
||||
* @generated
|
||||
* @ordered
|
||||
@@ -99,6 +104,7 @@ public class TdExpressionImpl extends ExpressionImpl implements TdExpression {
|
||||
* The cached value of the '{@link #getExpressionVariableMap() <em>Expression Variable Map</em>}' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* @see #getExpressionVariableMap()
|
||||
* @generated
|
||||
* @ordered
|
||||
@@ -108,6 +114,7 @@ public class TdExpressionImpl extends ExpressionImpl implements TdExpression {
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
protected TdExpressionImpl() {
|
||||
@@ -117,6 +124,7 @@ public class TdExpressionImpl extends ExpressionImpl implements TdExpression {
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
@@ -127,8 +135,10 @@ public class TdExpressionImpl extends ExpressionImpl implements TdExpression {
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
@@ -136,20 +146,26 @@ public class TdExpressionImpl extends ExpressionImpl implements TdExpression {
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public void setVersion(String newVersion) {
|
||||
String oldVersion = version;
|
||||
version = newVersion;
|
||||
if (eNotificationRequired())
|
||||
eNotify(new ENotificationImpl(this, Notification.SET, RelationalPackage.TD_EXPRESSION__VERSION, oldVersion, version));
|
||||
if (eNotificationRequired()) {
|
||||
eNotify(new ENotificationImpl(this, Notification.SET, RelationalPackage.TD_EXPRESSION__VERSION, oldVersion,
|
||||
version));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public String getModificationDate() {
|
||||
return modificationDate;
|
||||
}
|
||||
@@ -157,21 +173,26 @@ public class TdExpressionImpl extends ExpressionImpl implements TdExpression {
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public void setModificationDate(String newModificationDate) {
|
||||
String oldModificationDate = modificationDate;
|
||||
modificationDate = newModificationDate;
|
||||
if (eNotificationRequired())
|
||||
if (eNotificationRequired()) {
|
||||
eNotify(new ENotificationImpl(this, Notification.SET, RelationalPackage.TD_EXPRESSION__MODIFICATION_DATE,
|
||||
oldModificationDate, modificationDate));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
@@ -179,20 +200,26 @@ public class TdExpressionImpl extends ExpressionImpl implements TdExpression {
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public void setName(String newName) {
|
||||
String oldName = name;
|
||||
name = newName;
|
||||
if (eNotificationRequired())
|
||||
eNotify(new ENotificationImpl(this, Notification.SET, RelationalPackage.TD_EXPRESSION__NAME, oldName, name));
|
||||
if (eNotificationRequired()) {
|
||||
eNotify(new ENotificationImpl(this, Notification.SET, RelationalPackage.TD_EXPRESSION__NAME, oldName,
|
||||
name));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public HashMap<String, String> getExpressionVariableMap() {
|
||||
return expressionVariableMap;
|
||||
}
|
||||
@@ -200,19 +227,24 @@ public class TdExpressionImpl extends ExpressionImpl implements TdExpression {
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public void setExpressionVariableMap(HashMap<String, String> newExpressionVariableMap) {
|
||||
HashMap<String, String> oldExpressionVariableMap = expressionVariableMap;
|
||||
expressionVariableMap = newExpressionVariableMap;
|
||||
if (eNotificationRequired())
|
||||
eNotify(new ENotificationImpl(this, Notification.SET, RelationalPackage.TD_EXPRESSION__EXPRESSION_VARIABLE_MAP,
|
||||
oldExpressionVariableMap, expressionVariableMap));
|
||||
if (eNotificationRequired()) {
|
||||
eNotify(new ENotificationImpl(this, Notification.SET,
|
||||
RelationalPackage.TD_EXPRESSION__EXPRESSION_VARIABLE_MAP, oldExpressionVariableMap,
|
||||
expressionVariableMap));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
@@ -233,6 +265,7 @@ public class TdExpressionImpl extends ExpressionImpl implements TdExpression {
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -258,6 +291,7 @@ public class TdExpressionImpl extends ExpressionImpl implements TdExpression {
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
@@ -282,6 +316,7 @@ public class TdExpressionImpl extends ExpressionImpl implements TdExpression {
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
@@ -290,8 +325,8 @@ public class TdExpressionImpl extends ExpressionImpl implements TdExpression {
|
||||
case RelationalPackage.TD_EXPRESSION__VERSION:
|
||||
return VERSION_EDEFAULT == null ? version != null : !VERSION_EDEFAULT.equals(version);
|
||||
case RelationalPackage.TD_EXPRESSION__MODIFICATION_DATE:
|
||||
return MODIFICATION_DATE_EDEFAULT == null ? modificationDate != null : !MODIFICATION_DATE_EDEFAULT
|
||||
.equals(modificationDate);
|
||||
return MODIFICATION_DATE_EDEFAULT == null ? modificationDate != null
|
||||
: !MODIFICATION_DATE_EDEFAULT.equals(modificationDate);
|
||||
case RelationalPackage.TD_EXPRESSION__NAME:
|
||||
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
|
||||
case RelationalPackage.TD_EXPRESSION__EXPRESSION_VARIABLE_MAP:
|
||||
@@ -303,12 +338,14 @@ public class TdExpressionImpl extends ExpressionImpl implements TdExpression {
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
if (eIsProxy())
|
||||
if (eIsProxy()) {
|
||||
return super.toString();
|
||||
}
|
||||
|
||||
StringBuffer result = new StringBuffer(super.toString());
|
||||
result.append(" (version: ");
|
||||
@@ -323,4 +360,19 @@ public class TdExpressionImpl extends ExpressionImpl implements TdExpression {
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
} //TdExpressionImpl
|
||||
/**
|
||||
* Judge whether two expression take same database type and same version
|
||||
*
|
||||
* @generated not
|
||||
*/
|
||||
@Override
|
||||
public boolean sameVersionAndType(TdExpression targetEx) {
|
||||
boolean sameLanguage = this.getLanguage().equals(targetEx.getLanguage());
|
||||
String currentVersion = this.getVersion();
|
||||
String targetVersion = targetEx.getVersion();
|
||||
boolean sameVersion = currentVersion != null && currentVersion.equals(targetVersion);
|
||||
sameVersion = sameVersion || currentVersion == null && targetVersion == null;
|
||||
return sameLanguage && sameVersion;
|
||||
}
|
||||
|
||||
} // TdExpressionImpl
|
||||
|
||||
@@ -24,7 +24,6 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.core.commands.IHandler;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
@@ -69,13 +68,11 @@ import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
|
||||
import org.eclipse.ui.internal.util.PrefUtil;
|
||||
import org.eclipse.ui.preferences.ScopedPreferenceStore;
|
||||
import org.osgi.service.prefs.BackingStoreException;
|
||||
import org.talend.commons.exception.CommonExceptionHandler;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.exception.LoginException;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.commons.ui.utils.CheatSheetPerspectiveAdapter;
|
||||
import org.talend.commons.utils.VersionUtils;
|
||||
import org.talend.commons.utils.generation.JavaUtils;
|
||||
import org.talend.commons.utils.workbench.extensions.ExtensionImplementationProvider;
|
||||
import org.talend.commons.utils.workbench.extensions.ExtensionPointLimiterImpl;
|
||||
import org.talend.commons.utils.workbench.extensions.IExtensionPointLimiter;
|
||||
@@ -93,7 +90,6 @@ import org.talend.core.model.utils.TalendPropertiesUtil;
|
||||
import org.talend.core.prefs.IDEInternalPreferences;
|
||||
import org.talend.core.prefs.ITalendCorePrefConstants;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
import org.talend.core.runtime.util.JavaHomeUtil;
|
||||
import org.talend.core.ui.CoreUIPlugin;
|
||||
import org.talend.core.ui.branding.IBrandingConfiguration;
|
||||
import org.talend.core.ui.branding.IBrandingService;
|
||||
@@ -264,24 +260,6 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
|
||||
myJob.schedule();
|
||||
}
|
||||
|
||||
try {
|
||||
JavaHomeUtil.initializeJavaHome();
|
||||
if (JavaHomeUtil.isSetJdkHomeVariable()) {
|
||||
String specifiedVersion = JavaHomeUtil.getSpecifiedJavaVersion();
|
||||
if (specifiedVersion != null && !specifiedVersion.equals(JavaUtils.getProjectJavaVersion())) {
|
||||
JavaUtils.updateProjectJavaVersion(specifiedVersion);
|
||||
}
|
||||
}
|
||||
} catch (CoreException e1) {
|
||||
CommonExceptionHandler.process(e1);
|
||||
}
|
||||
|
||||
// if (!JavaHomeUtil.isJDKSetup()) {
|
||||
// MessageDialog.openWarning(DisplayUtils.getDefaultShell(),
|
||||
// Messages.getString("ApplicationWorkbenchWindowAdvisor.wrongJavaSetup"), //$NON-NLS-1$
|
||||
// Messages.getString("ApplicationWorkbenchWindowAdvisor.jdkRequired")); //$NON-NLS-1$
|
||||
// }
|
||||
|
||||
createActions();
|
||||
registerActions();
|
||||
adviser.getHelper().postWindowOpen();
|
||||
|
||||
@@ -583,7 +583,7 @@ public class DatabaseForm extends AbstractForm {
|
||||
|
||||
private IHadoopDistributionService getHadoopDistributionService() {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IHadoopDistributionService.class)) {
|
||||
return (IHadoopDistributionService) GlobalServiceRegister.getDefault().getService(IHadoopDistributionService.class);
|
||||
return GlobalServiceRegister.getDefault().getService(IHadoopDistributionService.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -928,7 +928,7 @@ public class DatabaseForm extends AbstractForm {
|
||||
*/
|
||||
@Override
|
||||
protected void addHelpInfoFields() {
|
||||
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(
|
||||
IBrandingService brandingService = GlobalServiceRegister.getDefault().getService(
|
||||
IBrandingService.class);
|
||||
if (!brandingService.isPoweredbyTalend()) {
|
||||
return;
|
||||
@@ -4458,9 +4458,6 @@ public class DatabaseForm extends AbstractForm {
|
||||
|| selection.equals(EDatabaseConnTemplate.HSQLDB_IN_PROGRESS.getDBDisplayName())) {
|
||||
sidOrDatabaseText.setText(s[index]);
|
||||
getConnection().setSID(s[index]);
|
||||
} else if (selection.equals(EDatabaseConnTemplate.FIREBIRD.getDBDisplayName())) {
|
||||
fileField.setText(s[index]);
|
||||
getConnection().setFileFieldName(s[index]);
|
||||
} else {
|
||||
portText.setText(s[index]);
|
||||
getConnection().setPort(s[index]);
|
||||
@@ -4476,6 +4473,10 @@ public class DatabaseForm extends AbstractForm {
|
||||
|| selection.equals(EDatabaseConnTemplate.REDSHIFT.getDBDisplayName())|| selection.equals(EDatabaseConnTemplate.REDSHIFT_SSO.getDBDisplayName())) {
|
||||
sidOrDatabaseText.setText(s[index]);
|
||||
getConnection().setSID(s[index]);
|
||||
} else if (selection.equals(EDatabaseConnTemplate.FIREBIRD.getDBDisplayName())) {
|
||||
fileField.setText(s[index]);
|
||||
getConnection().setFileFieldName(s[index]);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5707,7 +5708,7 @@ public class DatabaseForm extends AbstractForm {
|
||||
}
|
||||
List<String> asList = new ArrayList<String>(Arrays.asList(values));
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ILibraryManagerUIService.class)) {
|
||||
ILibraryManagerUIService libUiService = (ILibraryManagerUIService) GlobalServiceRegister.getDefault()
|
||||
ILibraryManagerUIService libUiService = GlobalServiceRegister.getDefault()
|
||||
.getService(ILibraryManagerUIService.class);
|
||||
IConfigModuleDialog dialog = libUiService.getConfigModuleDialog(getShell(), null);
|
||||
if (dialog.open() == IDialogConstants.OK_ID) {
|
||||
@@ -5927,7 +5928,8 @@ public class DatabaseForm extends AbstractForm {
|
||||
// Added yyin 20121219 TDQ-6485, check if the url is changed, if yes ,need reload
|
||||
private void checkURLIsChanged() {
|
||||
if (originalURL != null) {
|
||||
String url = isGeneralJdbc() ? generalJdbcUrlText.getText() : urlConnectionStringText.getText();
|
||||
IMetadataConnection convert = ConvertionHelper.convert(getConnection());
|
||||
String url = isGeneralJdbc() ? generalJdbcUrlText.getText() : convert.getUrl();
|
||||
if (!originalURL.equalsIgnoreCase(url)) {
|
||||
ConnectionHelper.setIsConnNeedReload(getConnection(), Boolean.TRUE);
|
||||
} else if (!originalUischema.equalsIgnoreCase(schemaText.getText())) {
|
||||
@@ -8629,7 +8631,7 @@ public class DatabaseForm extends AbstractForm {
|
||||
}
|
||||
String selecteModulePath = null;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ILibraryManagerService.class)) {
|
||||
ILibraryManagerService librairesService = (ILibraryManagerService) GlobalServiceRegister.getDefault().getService(
|
||||
ILibraryManagerService librairesService = GlobalServiceRegister.getDefault().getService(
|
||||
ILibraryManagerService.class);
|
||||
if (librairesService != null) {
|
||||
selecteModulePath = librairesService.getJarPath(selecteModule);
|
||||
|
||||
@@ -63,9 +63,9 @@ import org.talend.repository.viewer.ui.provider.INavigatorContentServiceProvider
|
||||
|
||||
/**
|
||||
* DOC sgandon class global comment. Detailled comment <br/>
|
||||
*
|
||||
*
|
||||
* $Id: talend.epf 55206 2011-02-15 17:32:14Z mhirt $
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class RepoViewCommonViewer extends CommonViewer implements INavigatorContentServiceProvider {
|
||||
|
||||
@@ -81,7 +81,7 @@ public class RepoViewCommonViewer extends CommonViewer implements INavigatorCont
|
||||
|
||||
/**
|
||||
* Getter for repViewCommonNavigator.
|
||||
*
|
||||
*
|
||||
* @return the repViewCommonNavigator
|
||||
*/
|
||||
public RepoViewCommonNavigator getRepViewCommonNavigator() {
|
||||
@@ -95,7 +95,7 @@ public class RepoViewCommonViewer extends CommonViewer implements INavigatorCont
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.ui.navigator.CommonViewer#init()
|
||||
*/
|
||||
@Override
|
||||
@@ -142,7 +142,7 @@ public class RepoViewCommonViewer extends CommonViewer implements INavigatorCont
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.swt.dnd.DragSourceAdapter#dragSetData(org.eclipse.swt.dnd.DragSourceEvent)
|
||||
*/
|
||||
@Override
|
||||
@@ -153,7 +153,7 @@ public class RepoViewCommonViewer extends CommonViewer implements INavigatorCont
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.swt.dnd.DragSourceAdapter#dragStart(org.eclipse.swt.dnd.DragSourceEvent)
|
||||
*/
|
||||
@Override
|
||||
@@ -175,7 +175,7 @@ public class RepoViewCommonViewer extends CommonViewer implements INavigatorCont
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.swt.dnd.DragSourceAdapter#dragFinished(org.eclipse.swt.dnd.DragSourceEvent)
|
||||
*/
|
||||
@Override
|
||||
@@ -231,7 +231,7 @@ public class RepoViewCommonViewer extends CommonViewer implements INavigatorCont
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.jface.viewers.AbstractTreeViewer#getSortedChildren(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
@@ -277,7 +277,7 @@ public class RepoViewCommonViewer extends CommonViewer implements INavigatorCont
|
||||
|
||||
/**
|
||||
* DOC sgandon Comment method "refreshContentIfNecessary".
|
||||
*
|
||||
*
|
||||
* @param item
|
||||
*/
|
||||
private void refreshContentIfNecessary(org.talend.core.model.properties.Item item) {
|
||||
@@ -410,35 +410,29 @@ public class RepoViewCommonViewer extends CommonViewer implements INavigatorCont
|
||||
}
|
||||
|
||||
protected void refreshContentIfNecessary(Collection<String> fileList) {
|
||||
Display.getDefault().asyncExec(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
RepoViewRefreshHelper helper = new RepoViewRefreshHelper();
|
||||
for (String fileUpdated : fileList) {
|
||||
XmiResourceManager xrm = new XmiResourceManager();
|
||||
if (xrm.isPropertyFile(fileUpdated)) {
|
||||
IFile file = helper.getValidResourceFile(fileUpdated);
|
||||
if (file != null) {
|
||||
try {
|
||||
Property property = xrm.loadProperty(file);
|
||||
if (property != null) {
|
||||
refreshNodeFromProperty(property);
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
// if have error still, just log it
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
RepoViewRefreshHelper helper = new RepoViewRefreshHelper();
|
||||
for (String fileUpdated : fileList) {
|
||||
XmiResourceManager xrm = new XmiResourceManager();
|
||||
if (xrm.isPropertyFile(fileUpdated)) {
|
||||
IFile file = helper.getValidResourceFile(fileUpdated);
|
||||
if (file != null) {
|
||||
try {
|
||||
Property property = xrm.loadProperty(file);
|
||||
if (property != null) {
|
||||
Display.getDefault().asyncExec(() -> refreshNodeFromProperty(property));
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
// if have error still, just log it
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.ui.navigator.CommonViewer#dispose()
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -229,8 +229,6 @@ public class RepoDoubleClickAction extends Action {
|
||||
});
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
} finally {
|
||||
shell.dispose();
|
||||
}
|
||||
}
|
||||
}, deviceData);
|
||||
@@ -552,7 +550,7 @@ public class RepoDoubleClickAction extends Action {
|
||||
|
||||
IGenericWizardService wizardService = null;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericWizardService.class)) {
|
||||
wizardService = (IGenericWizardService) GlobalServiceRegister.getDefault().getService(IGenericWizardService.class);
|
||||
wizardService = GlobalServiceRegister.getDefault().getService(IGenericWizardService.class);
|
||||
}
|
||||
if (wizardService != null) {
|
||||
ITreeContextualAction defaultAction = wizardService.getDefaultAction(obj);
|
||||
|
||||
@@ -639,6 +639,9 @@ CTabFolder.org-talend-rcp-abstractMultiPageEditor-footer CTabItem:selected {
|
||||
.SynonymIndexView Text{
|
||||
background-color: white;
|
||||
}
|
||||
.TalendStagingView StyledText {
|
||||
background-color: COLOR-LIST-BACKGROUND;
|
||||
}
|
||||
|
||||
/**************************************************
|
||||
* Palette
|
||||
|
||||
@@ -28,7 +28,11 @@ import org.talend.updates.runtime.model.ExtraFeature;
|
||||
public class ExtraFeaturesUpdatesFactory {
|
||||
|
||||
private final static ExtraFeaturesUpdatesReader updatesFactoryReader = new ExtraFeaturesUpdatesReader();
|
||||
|
||||
private boolean isCheckUpdateOnLine = false;
|
||||
|
||||
public ExtraFeaturesUpdatesFactory(boolean isCheckUpdateOnLine) {
|
||||
this.isCheckUpdateOnLine = isCheckUpdateOnLine;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* DOC ggu Comment method "retrieveUninstalledExtraFeatures".
|
||||
@@ -53,6 +57,7 @@ public class ExtraFeaturesUpdatesFactory {
|
||||
}
|
||||
}
|
||||
try {
|
||||
factory.setCheckUpdateOnLine(isCheckUpdateOnLine);
|
||||
factory.retrieveUninstalledExtraFeatures(monitor, uninstalledExtraFeatures);
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
@@ -68,6 +73,7 @@ public class ExtraFeaturesUpdatesFactory {
|
||||
for (AbstractExtraUpdatesFactory factory : updatesFactories) {
|
||||
if (factory instanceof IComponentUpdatesFactory) {
|
||||
try {
|
||||
factory.setCheckUpdateOnLine(isCheckUpdateOnLine);
|
||||
factory.retrieveAllExtraFeatures(monitor, allFeatures);
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
|
||||
@@ -36,7 +36,7 @@ import org.talend.updates.runtime.utils.PathUtils;
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractExtraUpdatesFactory implements IUpdatesFactory {
|
||||
|
||||
protected boolean isCheckUpdateOnLine = true;
|
||||
protected String getAcronym() {
|
||||
String acronym = "";
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IBrandingService.class)) {
|
||||
@@ -157,4 +157,13 @@ public abstract class AbstractExtraUpdatesFactory implements IUpdatesFactory {
|
||||
return new PlainZipFeature(b);
|
||||
}
|
||||
|
||||
public boolean isCheckUpdateOnLine() {
|
||||
return isCheckUpdateOnLine;
|
||||
}
|
||||
|
||||
|
||||
public void setCheckUpdateOnLine(boolean isCheckUpdateOnLine) {
|
||||
this.isCheckUpdateOnLine = isCheckUpdateOnLine;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class PluginOptionalMissingJarsExtraUpdatesFactory extends AbstractExtraU
|
||||
// jface because it adds graphical
|
||||
// dependencies.
|
||||
IRunnableWithProgress notInstalledModulesRunnable = RemoteModulesHelper.getInstance().getNotInstalledModulesRunnable(
|
||||
unistalledModulesNeeded, modulesRequiredToBeInstalled, true);
|
||||
unistalledModulesNeeded, modulesRequiredToBeInstalled, true, true);
|
||||
if (notInstalledModulesRunnable != null) {// some data need to be fetched
|
||||
try {
|
||||
notInstalledModulesRunnable.run(mainSubMonitor.newChild(1));
|
||||
|
||||
@@ -59,7 +59,7 @@ public class PluginRequiredMissingJarsExtraUpdatesFactory extends AbstractExtraU
|
||||
// fetch missing jar information from remote web site.
|
||||
ArrayList<ModuleToInstall> modulesRequiredToBeInstalled = new ArrayList<ModuleToInstall>();
|
||||
IRunnableWithProgress notInstalledModulesRunnable = RemoteModulesHelper.getInstance().getNotInstalledModulesRunnable(
|
||||
allUninstalledModules, modulesRequiredToBeInstalled, true);// IRunnableWithProgress should not be part
|
||||
allUninstalledModules, modulesRequiredToBeInstalled, true, !isCheckUpdateOnLine);// IRunnableWithProgress should not be part
|
||||
// of
|
||||
// jface because it adds graphical
|
||||
// dependencies.
|
||||
|
||||
@@ -78,34 +78,36 @@ public class TOSDynamicExtraFeaturesFactory extends AbstractExtraUpdatesFactory
|
||||
@Override
|
||||
public void retrieveUninstalledExtraFeatures(IProgressMonitor progress, Set<ExtraFeature> uninstalledExtraFeatures)
|
||||
throws Exception {
|
||||
SubMonitor mainSubMonitor = SubMonitor.convert(progress, 5);
|
||||
mainSubMonitor.setTaskName(Messages.getString("ExtraFeaturesFactory.checking..feature.to.install")); //$NON-NLS-1$
|
||||
mainSubMonitor.worked(1);
|
||||
Set<P2ExtraFeature> allExtraFeatures = getAllExtraFeatures(mainSubMonitor);
|
||||
mainSubMonitor.worked(1);
|
||||
if (mainSubMonitor.isCanceled()) {
|
||||
return;
|
||||
}
|
||||
SubMonitor checkSubMonitor = SubMonitor.convert(mainSubMonitor.newChild(1), allExtraFeatures.size() * 2);
|
||||
for (P2ExtraFeature extraF : allExtraFeatures) {
|
||||
try {
|
||||
if (!extraF.isInstalled(checkSubMonitor.newChild(1))) {
|
||||
if (checkSubMonitor.isCanceled()) {
|
||||
return;
|
||||
}
|
||||
addToSet(uninstalledExtraFeatures, extraF);
|
||||
checkSubMonitor.worked(1);
|
||||
} else {// else already installed so try to find updates
|
||||
ExtraFeature updateFeature = extraF.createFeatureIfUpdates(checkSubMonitor.newChild(1));
|
||||
if (updateFeature != null) {
|
||||
addToSet(uninstalledExtraFeatures, updateFeature);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// could not determine if feature is already installed so do not consider it all
|
||||
log.error(e);
|
||||
if (isCheckUpdateOnLine) {
|
||||
SubMonitor mainSubMonitor = SubMonitor.convert(progress, 5);
|
||||
mainSubMonitor.setTaskName(Messages.getString("ExtraFeaturesFactory.checking..feature.to.install")); //$NON-NLS-1$
|
||||
mainSubMonitor.worked(1);
|
||||
Set<P2ExtraFeature> allExtraFeatures = getAllExtraFeatures(mainSubMonitor);
|
||||
mainSubMonitor.worked(1);
|
||||
if (mainSubMonitor.isCanceled()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
SubMonitor checkSubMonitor = SubMonitor.convert(mainSubMonitor.newChild(1), allExtraFeatures.size() * 2);
|
||||
for (P2ExtraFeature extraF : allExtraFeatures) {
|
||||
try {
|
||||
if (!extraF.isInstalled(checkSubMonitor.newChild(1))) {
|
||||
if (checkSubMonitor.isCanceled()) {
|
||||
return;
|
||||
}
|
||||
addToSet(uninstalledExtraFeatures, extraF);
|
||||
checkSubMonitor.worked(1);
|
||||
} else {// else already installed so try to find updates
|
||||
ExtraFeature updateFeature = extraF.createFeatureIfUpdates(checkSubMonitor.newChild(1));
|
||||
if (updateFeature != null) {
|
||||
addToSet(uninstalledExtraFeatures, updateFeature);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// could not determine if feature is already installed so do not consider it all
|
||||
log.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -73,7 +73,7 @@ public class FeaturesManager {
|
||||
private ProjectPreferenceManager projectPreferenceManager;
|
||||
|
||||
public FeaturesManager() {
|
||||
extraFeaturesFactory = new ExtraFeaturesUpdatesFactory();
|
||||
extraFeaturesFactory = new ExtraFeaturesUpdatesFactory(true);
|
||||
featuresCache = new ArrayList<>();
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ import org.talend.updates.runtime.model.ExtraFeature;
|
||||
*
|
||||
*/
|
||||
public class CheckExtraFeaturesToInstallJob extends Job {
|
||||
|
||||
protected boolean isCheckUpdateOnLine = false;
|
||||
/**
|
||||
* DOC sgandon CheckExtraFeaturesToUpdateJob constructor comment.
|
||||
*
|
||||
@@ -63,7 +63,7 @@ public class CheckExtraFeaturesToInstallJob extends Job {
|
||||
return Status.OK_STATUS;
|
||||
}// else look for updates and show the wizard if necessary.
|
||||
// check if there are features to update
|
||||
ExtraFeaturesUpdatesFactory extraFeaturesFactory = new ExtraFeaturesUpdatesFactory();
|
||||
ExtraFeaturesUpdatesFactory extraFeaturesFactory = new ExtraFeaturesUpdatesFactory(isCheckUpdateOnLine);
|
||||
final Set<ExtraFeature> uninstalledExtraFeatures = new HashSet<ExtraFeature>();
|
||||
extraFeaturesFactory.retrieveUninstalledExtraFeatures(monitor, uninstalledExtraFeatures, false);
|
||||
// if feature to update are available then show the update wizard
|
||||
@@ -93,5 +93,12 @@ public class CheckExtraFeaturesToInstallJob extends Job {
|
||||
}// else not feature to install
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
|
||||
|
||||
public boolean isCheckUpdateOnLine() {
|
||||
return isCheckUpdateOnLine;
|
||||
}
|
||||
|
||||
public void setCheckUpdateOnLine(boolean isCheckUpdateOnLine) {
|
||||
this.isCheckUpdateOnLine = isCheckUpdateOnLine;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ public class UpdateStudioWizard extends Wizard {
|
||||
@Override
|
||||
public void run(IProgressMonitor iprogressmonitor)
|
||||
throws InvocationTargetException, InterruptedException {
|
||||
ExtraFeaturesUpdatesFactory extraFeaturesFactory = new ExtraFeaturesUpdatesFactory();
|
||||
ExtraFeaturesUpdatesFactory extraFeaturesFactory = new ExtraFeaturesUpdatesFactory(true);
|
||||
extraFeaturesFactory.retrieveUninstalledExtraFeatures(iprogressmonitor,
|
||||
updateWizardModel.availableExtraFeatures, false);
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="lib" path="lib/crypto-utils.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
||||
@@ -28,13 +28,15 @@ Export-Package:
|
||||
org.talend.utils.time;uses:="org.apache.log4j",
|
||||
org.talend.utils.wsdl,
|
||||
org.talend.utils.xml
|
||||
Bundle-ClassPath: .
|
||||
Bundle-ClassPath: .,
|
||||
lib/crypto-utils.jar
|
||||
Require-Bundle: org.apache.commons.lang,
|
||||
org.talend.libraries.apache;visibility:=reexport,
|
||||
org.apache.log4j,
|
||||
org.apache.commons.io,
|
||||
org.talend.daikon;visibility:=reexport,
|
||||
org.bouncycastle.bcprov,
|
||||
org.apache.httpcomponents.httpclient
|
||||
org.apache.httpcomponents.httpclient,
|
||||
org.slf4j.api
|
||||
Eclipse-BuddyPolicy: registered
|
||||
Eclipse-RegisterBuddy: org.apache.log4j, org.talend.testutils
|
||||
|
||||
@@ -4,6 +4,7 @@ source.dist/org.talend.utils.jar = src/main/java/
|
||||
output.dist/org.talend.utils.jar = class/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
dist/
|
||||
dist/,\
|
||||
lib/crypto-utils.jar
|
||||
jars.compile.order = .,\
|
||||
dist/org.talend.utils.jar
|
||||
|
||||
BIN
main/plugins/org.talend.utils/lib/crypto-utils.jar
Normal file
BIN
main/plugins/org.talend.utils/lib/crypto-utils.jar
Normal file
Binary file not shown.
@@ -1,64 +1,91 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.talend.studio</groupId>
|
||||
<artifactId>tcommon-studio-se</artifactId>
|
||||
<version>7.2.1-SNAPSHOT</version>
|
||||
<relativePath>../../../</relativePath>
|
||||
</parent>
|
||||
<artifactId>org.talend.utils</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.talend.studio</groupId>
|
||||
<artifactId>tcommon-studio-se</artifactId>
|
||||
<version>7.2.1-SNAPSHOT</version>
|
||||
<relativePath>../../../</relativePath>
|
||||
</parent>
|
||||
<artifactId>org.talend.utils</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>1.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.ant</groupId>
|
||||
<artifactId>ant</artifactId>
|
||||
<version>1.7.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk15on</artifactId>
|
||||
<version>1.51</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.talend.daikon</groupId>
|
||||
<artifactId>daikon</artifactId>
|
||||
<version>0.2.0.RELEASE</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.8.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-deploy</id>
|
||||
<phase>deploy</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>1.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.ant</groupId>
|
||||
<artifactId>ant</artifactId>
|
||||
<version>1.7.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk15on</artifactId>
|
||||
<version>1.51</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.talend.daikon</groupId>
|
||||
<artifactId>daikon</artifactId>
|
||||
<version>0.2.0.RELEASE</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.10</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>1.7.10</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>2.8</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<!-- same as org.talend.libraries.excel -->
|
||||
<id>copy-maven-repository</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.basedir}/lib</outputDirectory>
|
||||
<destFileName>crypto-utils.jar</destFileName>
|
||||
<artifactItems>
|
||||
<dependency>
|
||||
<groupId>org.talend.daikon</groupId>
|
||||
<artifactId>crypto-utils</artifactId>
|
||||
<version>${org.talend.daikon.crypto-utils.version}</version>
|
||||
</dependency>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<!--
|
||||
Copyright (C) 2010 Talend Inc. - www.talend.com
|
||||
<!--
|
||||
Copyright (C) 2010 Talend Inc. - www.talend.com
|
||||
-->
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -16,6 +16,10 @@
|
||||
<relativePath>../pom_server.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<org.talend.daikon.crypto-utils.version>1.2.0</org.talend.daikon.crypto-utils.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
@@ -58,6 +62,16 @@
|
||||
<artifactId>commons-text</artifactId>
|
||||
<version>1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.10</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>1.7.10</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
@@ -87,6 +101,32 @@
|
||||
</instructions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>2.8</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<!-- same as org.talend.libraries.excel -->
|
||||
<id>copy-maven-repository</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.basedir}/lib</outputDirectory>
|
||||
<destFileName>crypto-utils.jar</destFileName>
|
||||
<artifactItems>
|
||||
<dependency>
|
||||
<groupId>org.talend.daikon</groupId>
|
||||
<artifactId>crypto-utils</artifactId>
|
||||
<version>${org.talend.daikon.crypto-utils.version}</version>
|
||||
</dependency>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<!--
|
||||
Copyright (C) 2010 Talend Inc. - www.talend.com
|
||||
<!--
|
||||
Copyright (C) 2010 Talend Inc. - www.talend.com
|
||||
-->
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -16,6 +16,10 @@
|
||||
<relativePath>../pom_server.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<org.talend.daikon.crypto-utils.version>1.2.0</org.talend.daikon.crypto-utils.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
@@ -30,7 +34,7 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.5</version>
|
||||
<version>3.8.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.ant</groupId>
|
||||
@@ -63,6 +67,16 @@
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.10</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>1.7.10</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
@@ -87,6 +101,32 @@
|
||||
</instructions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>2.8</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<!-- same as org.talend.libraries.excel -->
|
||||
<id>copy-maven-repository</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.basedir}/lib</outputDirectory>
|
||||
<destFileName>crypto-utils.jar</destFileName>
|
||||
<artifactItems>
|
||||
<dependency>
|
||||
<groupId>org.talend.daikon</groupId>
|
||||
<artifactId>crypto-utils</artifactId>
|
||||
<version>${org.talend.daikon.crypto-utils.version}</version>
|
||||
</dependency>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
@@ -301,7 +301,7 @@ public final class FilesUtils {
|
||||
*/
|
||||
public static List<String> getContentLines(String filePath) throws IOException {
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(filePath)));
|
||||
List<String> lines = new ArrayList<String>();
|
||||
List<String> lines = new ArrayList<>();
|
||||
try {
|
||||
String line;
|
||||
while ((line = in.readLine()) != null) {
|
||||
@@ -490,8 +490,9 @@ public final class FilesUtils {
|
||||
MessageDigest messageDigest = MessageDigest.getInstance("MD5"); //$NON-NLS-1$
|
||||
digestInputStream = new DigestInputStream(inputStream, messageDigest);
|
||||
byte[] buffer = new byte[bufferSize];
|
||||
while (digestInputStream.read(buffer) > 0)
|
||||
while (digestInputStream.read(buffer) > 0) {
|
||||
;
|
||||
}
|
||||
messageDigest = digestInputStream.getMessageDigest();
|
||||
return new String(Hex.encodeHex(messageDigest.digest()));
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
@@ -741,18 +742,23 @@ public final class FilesUtils {
|
||||
zip(sourceFileName, zippedFileName, fileFilter);
|
||||
}
|
||||
|
||||
public static void unzip(String zipFile, String targetFolder, String... fileSuffixes) throws Exception {
|
||||
unzip(zipFile, targetFolder, true, fileSuffixes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unzip the component file to the user folder.
|
||||
*
|
||||
* @param zipFile The component zip file
|
||||
* @param targetFolder The user folder
|
||||
* @param overwrite if overwrite existing files
|
||||
* @param fileSuffixes Case-insensitive Suffixes , if these parameter are set, only the files named with these
|
||||
* suffixes will be extracted
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void unzip(String zipFile, String targetFolder, String... fileSuffixes) throws Exception {
|
||||
public static void unzip(String zipFile, String targetFolder, boolean overwrite, String... fileSuffixes) throws Exception {
|
||||
Exception exception = null;
|
||||
ZipFile zip = new ZipFile(zipFile);
|
||||
byte[] buf = new byte[8192];
|
||||
@@ -764,12 +770,15 @@ public final class FilesUtils {
|
||||
|
||||
File file = new File(targetFolder, entry.getName());
|
||||
|
||||
boolean exist = file.exists();
|
||||
if (entry.isDirectory()) {
|
||||
if (!file.exists()) {
|
||||
if (!exist) {
|
||||
file.mkdir();
|
||||
}
|
||||
} else {
|
||||
|
||||
if (!overwrite && exist) {
|
||||
continue;
|
||||
}
|
||||
if (fileSuffixes.length > 0 && !isReservedFile(file.getName(), fileSuffixes)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package org.talend.utils.security;
|
||||
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2018 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
|
||||
//
|
||||
// ============================================================================
|
||||
import org.talend.daikon.crypto.CipherSources;
|
||||
import org.talend.daikon.crypto.Encryption;
|
||||
import org.talend.daikon.crypto.KeySources;
|
||||
|
||||
public class AESEncryption {
|
||||
|
||||
//TODO We should remove default key after implements master key encryption algorithm
|
||||
private static final String ENCRYPTION_KEY = "Talend_TalendKey";// The length of key should be 16, 24 or 32.
|
||||
|
||||
private static Encryption defaultEncryption;
|
||||
|
||||
public static String encryptPassword(String input, String key) throws Exception {
|
||||
Encryption encryption = getEncryption(key);
|
||||
return encryption.encrypt(input);
|
||||
}
|
||||
|
||||
public static String encryptPassword(String input) throws Exception {
|
||||
Encryption encryption = getEncryption();
|
||||
return encryption.encrypt(input);
|
||||
}
|
||||
|
||||
public static String decryptPassword(String input, String key) throws Exception {
|
||||
Encryption encryption = getEncryption(key);
|
||||
return encryption.decrypt(input);
|
||||
}
|
||||
|
||||
public static String decryptPassword(String input) throws Exception {
|
||||
Encryption encryption = getEncryption();
|
||||
return encryption.decrypt(input);
|
||||
}
|
||||
|
||||
private static Encryption getEncryption() {
|
||||
if (defaultEncryption == null) {
|
||||
defaultEncryption = getEncryption(ENCRYPTION_KEY);
|
||||
}
|
||||
return defaultEncryption;
|
||||
}
|
||||
|
||||
private static Encryption getEncryption(String key) {
|
||||
return new Encryption(KeySources.fixedKey(key), CipherSources.aes());
|
||||
}
|
||||
}
|
||||
@@ -422,6 +422,23 @@ public final class ConnectionUtils {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC msjian Comment method "isSnowflake".
|
||||
*
|
||||
* @param metadata
|
||||
* @return
|
||||
* @throws SQLException
|
||||
*/
|
||||
public static boolean isSnowflake(DatabaseMetaData metadata) throws SQLException {
|
||||
if (metadata != null && metadata.getDriverName() != null
|
||||
&& metadata.getDriverName().toLowerCase().startsWith("snowflake") //$NON-NLS-1$
|
||||
&& metadata.getDatabaseProductName() != null
|
||||
&& metadata.getDatabaseProductName().toLowerCase().startsWith("snowflake")) { //$NON-NLS-1$
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* DOC Comment method "isExasol".
|
||||
|
||||
3
pom.xml
3
pom.xml
@@ -9,6 +9,9 @@
|
||||
</parent>
|
||||
<artifactId>tcommon-studio-se</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<properties>
|
||||
<org.talend.daikon.crypto-utils.version>1.2.0</org.talend.daikon.crypto-utils.version>
|
||||
</properties>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>talend_open</id>
|
||||
|
||||
@@ -12,16 +12,38 @@
|
||||
// ============================================================================
|
||||
package org.talend.commons.utils;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.URIUtil;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.talend.utils.ProductVersion;
|
||||
import org.talend.utils.io.FilesUtils;
|
||||
|
||||
/**
|
||||
* DOC ycbai class global comment. Detailled comment
|
||||
*/
|
||||
public class VersionUtilsTest {
|
||||
|
||||
private File mojo_properties;
|
||||
|
||||
private File eclipseproductFile;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
mojo_properties = new Path(Platform.getConfigurationLocation().getURL().getPath()).append("mojo_version.properties") //$NON-NLS-1$
|
||||
.toFile();
|
||||
backupEcilpseproductFile();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.talend.commons.utils.VersionUtils#getTalendVersion()}.
|
||||
*/
|
||||
@@ -31,4 +53,77 @@ public class VersionUtilsTest {
|
||||
ProductVersion studioVersion = ProductVersion.fromString(VersionUtils.getDisplayVersion());
|
||||
assertEquals(studioVersion, talendVersion);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetPluginVersion__Eclipseproduct() throws Exception {
|
||||
String talendVersion = VersionUtils.getTalendVersion();
|
||||
setPropertiesValue(eclipseproductFile, "version", talendVersion + ".20190500_1200-SNAPSHOT");
|
||||
assertEquals(talendVersion + "-SNAPSHOT", VersionUtils.getMojoVersion("ci.builder.version"));
|
||||
|
||||
setPropertiesValue(eclipseproductFile, "version", talendVersion + ".20190500_1200-M5");
|
||||
assertEquals(talendVersion + "-M5", VersionUtils.getMojoVersion("ci.builder.version"));
|
||||
|
||||
setPropertiesValue(eclipseproductFile, "version", talendVersion + ".20190500_1200");
|
||||
assertEquals(talendVersion, VersionUtils.getMojoVersion("ci.builder.version"));
|
||||
|
||||
// for other revision, use release version as default.
|
||||
setPropertiesValue(eclipseproductFile, "version", talendVersion + ".20190500_1200-RC1");
|
||||
assertEquals(talendVersion, VersionUtils.getMojoVersion("ci.builder.version"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetPluginVersion__MojoProperties() throws Exception {
|
||||
String talendVersion = VersionUtils.getTalendVersion();
|
||||
assertEquals(talendVersion + "-SNAPSHOT", VersionUtils.getMojoVersion("ci.builder.version"));
|
||||
if (mojo_properties.exists()) {
|
||||
mojo_properties.delete();
|
||||
}
|
||||
mojo_properties.createNewFile();
|
||||
setPropertiesValue(mojo_properties, "ci.builder.version", talendVersion + "-patch1");
|
||||
assertEquals(talendVersion + "-patch1", VersionUtils.getMojoVersion("ci.builder.version"));
|
||||
|
||||
setPropertiesValue(mojo_properties, "ci.builder.version", "6.0.0");
|
||||
assertEquals(talendVersion + "-SNAPSHOT", VersionUtils.getMojoVersion("ci.builder.version"));
|
||||
}
|
||||
|
||||
private void setPropertiesValue(File propertiesFile, String key, String value) throws Exception {
|
||||
Properties properties = new Properties();
|
||||
properties.setProperty(key, value);
|
||||
try (OutputStream out = new FileOutputStream(propertiesFile)) {
|
||||
properties.store(out, "From junit");
|
||||
}
|
||||
}
|
||||
|
||||
private void backupEcilpseproductFile() throws Exception {
|
||||
File installFolder = URIUtil.toFile(URIUtil.toURI(Platform.getInstallLocation().getURL()));
|
||||
eclipseproductFile = new File(installFolder, ".eclipseproduct");//$NON-NLS-1$
|
||||
File targetFile = new File(installFolder, "bak.eclipseproduct");//$NON-NLS-1$
|
||||
if (targetFile.exists()) {
|
||||
targetFile.delete();
|
||||
}
|
||||
FilesUtils.copyFile(eclipseproductFile, targetFile);
|
||||
}
|
||||
|
||||
private void restoreEclipseproductFile() throws Exception {
|
||||
File installFolder = URIUtil.toFile(URIUtil.toURI(Platform.getInstallLocation().getURL()));
|
||||
File backupFile = new File(installFolder, "bak.eclipseproduct");//$NON-NLS-1$
|
||||
File targetFile = eclipseproductFile;
|
||||
try {
|
||||
if (targetFile.exists()) {
|
||||
targetFile.delete();
|
||||
}
|
||||
FilesUtils.copyFile(backupFile, targetFile);
|
||||
} finally {
|
||||
backupFile.delete();
|
||||
}
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
if (mojo_properties != null && mojo_properties.exists()) {
|
||||
mojo_properties.delete();
|
||||
}
|
||||
restoreEclipseproductFile();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,11 +25,11 @@ import javax.xml.soap.Node;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.core.classloader.annotations.PowerMockIgnore;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.rule.PowerMockRule;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.NodeList;
|
||||
@@ -37,13 +37,11 @@ import org.w3c.dom.NodeList;
|
||||
/**
|
||||
* DOC xqliu class global comment. Detailled comment
|
||||
*/
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PrepareForTest({ FilesUtils.class })
|
||||
@PowerMockIgnore({"org.w3c.*", "javax.xml.*", "com.sun.*"})
|
||||
public class FilesUtilsTest {
|
||||
|
||||
@Rule
|
||||
public PowerMockRule powerMockRule = new PowerMockRule();
|
||||
|
||||
/**
|
||||
* Test method for {@link org.talend.commons.utils.io.FilesUtils#getUUID(java.lang.String)}
|
||||
*/
|
||||
|
||||
@@ -78,16 +78,16 @@ public class ElementParameterParserTest {
|
||||
|
||||
// "ab"
|
||||
when(parameter.getValue()).thenReturn("\"ab\"");
|
||||
assertEquals("\"b2ffaf80bd12fbe9\"", ElementParameterParser.getEncryptedValue(node, paramName));
|
||||
assertEquals("\"mhTO5ftbNXqfUMNXo3nHmg==\"", ElementParameterParser.getEncryptedValue(node, paramName));
|
||||
// "a\"b"
|
||||
when(parameter.getValue()).thenReturn("\"a\\\"b\"");
|
||||
assertEquals("\"81f12ffeb5daed01\"", ElementParameterParser.getEncryptedValue(node, paramName));
|
||||
assertEquals("\"5mxyOpkHaSqOq8z2V2INkQ==\"", ElementParameterParser.getEncryptedValue(node, paramName));
|
||||
// "a\\b"
|
||||
when(parameter.getValue()).thenReturn("\"a\\\\b\"");
|
||||
assertEquals("\"a745923703c42ed8\"", ElementParameterParser.getEncryptedValue(node, paramName));
|
||||
assertEquals("\"7GBfp1sX6vnzVV/sa7za6A==\"", ElementParameterParser.getEncryptedValue(node, paramName));
|
||||
// "a\\\\b"
|
||||
when(parameter.getValue()).thenReturn("\"a\\\\\\\\b\"");
|
||||
assertEquals("\"d0e9b75c43bbc953\"", ElementParameterParser.getEncryptedValue(node, paramName));
|
||||
assertEquals("\"3x1Wn/yy2UiJwaPAMCJUOQ==\"", ElementParameterParser.getEncryptedValue(node, paramName));
|
||||
// "test"+context.mypassword + "a"
|
||||
when(parameter.getValue()).thenReturn("\"test\"+context.mypassword + \"a\"");
|
||||
assertEquals("\"test\"+context.mypassword + \"a\"", ElementParameterParser.getEncryptedValue(node, paramName));
|
||||
@@ -96,9 +96,9 @@ public class ElementParameterParserTest {
|
||||
assertEquals("\"a\" + \"b\"", ElementParameterParser.getEncryptedValue(node, paramName));
|
||||
// \\123456/
|
||||
when(parameter.getValue()).thenReturn("\"\\\\123456/\"");
|
||||
assertEquals("\"4bd6e9847da74e5d8c3ef1db4cd6aed6\"", ElementParameterParser.getEncryptedValue(node, paramName));
|
||||
assertEquals("\"B7HIZB1mu4mrbvTqJk84XQ==\"", ElementParameterParser.getEncryptedValue(node, paramName));
|
||||
// \123456/
|
||||
when(parameter.getValue()).thenReturn("\"\\123456/\"");
|
||||
assertEquals("\"71ba460575307d5af4f7aba1746784ea\"", ElementParameterParser.getEncryptedValue(node, paramName));
|
||||
assertEquals("\"bzSVFVjd9z6nk8jyKYi3iw==\"", ElementParameterParser.getEncryptedValue(node, paramName));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,11 +37,10 @@ public class PasswordEncryptUtilTest {
|
||||
@Test
|
||||
public void testEncryptPasswordHex() throws Exception {
|
||||
Assert.assertNull(PasswordEncryptUtil.encryptPasswordHex(null));
|
||||
Assert.assertEquals("f4f7aba1746784ea", PasswordEncryptUtil.encryptPasswordHex(""));
|
||||
|
||||
Assert.assertEquals("910351e7b8926e62", PasswordEncryptUtil.encryptPasswordHex("Talend"));
|
||||
Assert.assertEquals("4d6073c4a9734e61", PasswordEncryptUtil.encryptPasswordHex("toor"));
|
||||
Assert.assertEquals("00104aa786b8cf2a6c5b4f14a2e00b07", PasswordEncryptUtil.encryptPasswordHex("Talend123"));
|
||||
Assert.assertEquals("Po/9NgcqCzP4IajGQh6BNA==", PasswordEncryptUtil.encryptPasswordHex(""));
|
||||
Assert.assertEquals("LyQOjBhSDr9RkpZzwK3aTQ==", PasswordEncryptUtil.encryptPasswordHex("Talend"));
|
||||
Assert.assertEquals("3Tns/4xk6/iPgnKGUTte2g==", PasswordEncryptUtil.encryptPasswordHex("toor"));
|
||||
Assert.assertEquals("4o7ak6AT0N1GCHazzWLyoQ==", PasswordEncryptUtil.encryptPasswordHex("Talend123"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -12,8 +12,12 @@
|
||||
// ============================================================================
|
||||
package org.talend.designer.runprocess;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.anyObject;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -406,16 +410,11 @@ public class ProcessorUtilitiesTest {
|
||||
IComponent comp = mock(IComponent.class);
|
||||
when(dbNode.getComponent()).thenReturn(comp);
|
||||
when(comp.getComponentType()).thenReturn(EComponentType.EMF);
|
||||
|
||||
List params = new ArrayList();
|
||||
when(dbNode.getElementParameters()).thenReturn(params);
|
||||
when(comp.getName()).thenReturn("tSAPTableInput");
|
||||
|
||||
// TYPE parameter
|
||||
IElementParameter typeParam = mock(IElementParameter.class);
|
||||
params.add(typeParam);
|
||||
when(typeParam.getName()).thenReturn("TYPE");
|
||||
when(typeParam.getFieldType()).thenReturn(EParameterFieldType.TEXT);
|
||||
when(typeParam.getValue()).thenReturn("MySQL");
|
||||
when(dbNode.getElementParameterFromField(anyObject())).thenReturn(typeParam);
|
||||
|
||||
List metadataList = new ArrayList<>();
|
||||
when(dbNode.getMetadataList()).thenReturn(metadataList);
|
||||
|
||||
@@ -60,7 +60,7 @@ public class RemoteModulesHelperTest {
|
||||
neededModules.add(m5);
|
||||
List<ModuleToInstall> toInstall1 = new ArrayList<ModuleToInstall>();
|
||||
IRunnableWithProgress notInstalledModulesRunnable = RemoteModulesHelper.getInstance()
|
||||
.getNotInstalledModulesRunnable(neededModules, toInstall1, false);
|
||||
.getNotInstalledModulesRunnable(neededModules, toInstall1, false, false);
|
||||
notInstalledModulesRunnable.run(new NullProgressMonitor());
|
||||
assertEquals(4, toInstall1.size());
|
||||
|
||||
@@ -74,7 +74,7 @@ public class RemoteModulesHelperTest {
|
||||
neededModules.add(m1);
|
||||
List<ModuleToInstall> toInstall1 = new ArrayList<ModuleToInstall>();
|
||||
IRunnableWithProgress notInstalledModulesRunnable = RemoteModulesHelper.getInstance()
|
||||
.getNotInstalledModulesRunnable(neededModules, toInstall1, false);
|
||||
.getNotInstalledModulesRunnable(neededModules, toInstall1, false, false);
|
||||
notInstalledModulesRunnable.run(new NullProgressMonitor());
|
||||
assertEquals(1, toInstall1.size());
|
||||
Assert.assertEquals("protobuf-java-2.6.1.jar", toInstall1.get(0).getName());
|
||||
@@ -86,7 +86,7 @@ public class RemoteModulesHelperTest {
|
||||
neededModules.add(m2);
|
||||
toInstall1 = new ArrayList<ModuleToInstall>();
|
||||
notInstalledModulesRunnable = RemoteModulesHelper.getInstance().getNotInstalledModulesRunnable(neededModules, toInstall1,
|
||||
false);
|
||||
false, false);
|
||||
notInstalledModulesRunnable.run(new NullProgressMonitor());
|
||||
assertEquals(1, toInstall1.size());
|
||||
Assert.assertEquals("protobuf-java.jar", toInstall1.get(0).getName());
|
||||
|
||||
@@ -12,38 +12,30 @@
|
||||
// ============================================================================
|
||||
package org.talend.core.model.metadata;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.rule.PowerMockRule;
|
||||
import org.talend.core.database.EDatabaseTypeName;
|
||||
import org.talend.core.database.conn.template.EDatabaseConnTemplate;
|
||||
import org.talend.cwm.helper.TaggedValueHelper;
|
||||
import org.talend.metadata.managment.model.MetadataFillFactory;
|
||||
import org.talend.metadata.managment.model.SybaseConnectionFillerImpl;
|
||||
import org.talend.model.bridge.ReponsitoryContextBridge;
|
||||
import org.talend.utils.properties.PropertiesLoader;
|
||||
import org.talend.utils.properties.TypedProperties;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
/**
|
||||
* DOC zshen class global comment. Detailled comment
|
||||
*/
|
||||
@PrepareForTest({ ReponsitoryContextBridge.class, MetadataTalendType.class })
|
||||
public class MetadataFillFactoryTest {
|
||||
|
||||
@Rule
|
||||
public PowerMockRule powerMockRule = new PowerMockRule();
|
||||
|
||||
private Map<String, String> initParameterMap() {
|
||||
Map<String, String> returnMap = new HashMap<String, String>();
|
||||
TypedProperties connectionParams = PropertiesLoader.getProperties(MetadataFillFactoryTest.class,
|
||||
@@ -101,7 +93,7 @@ public class MetadataFillFactoryTest {
|
||||
|| Boolean.toString(metadataConnection.isRetrieveAllMetadata()).equals(parameterMap.get("retrieveAllMetadata")));
|
||||
assertSame(metadataConnection.getUrl(), parameterMap.get("jdbcUrl"));
|
||||
assertNotNull("Product is not null", metadataConnection.getProduct());
|
||||
assertNull("Mapping is null", metadataConnection.getMapping());
|
||||
assertEquals("Mapping is mysql_id", "mysql_id", metadataConnection.getMapping());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -14,10 +14,8 @@ package org.talend.core.model.metadata.builder.database.dburl;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.rule.PowerMockRule;
|
||||
|
||||
/**
|
||||
* DOC msjian class global comment. Detailled comment
|
||||
@@ -25,9 +23,6 @@ import org.powermock.modules.junit4.rule.PowerMockRule;
|
||||
@PrepareForTest({ SupportDBUrlType.class })
|
||||
public class SupportDBUrlTypeTest {
|
||||
|
||||
@Rule
|
||||
public PowerMockRule powerMockRule = new PowerMockRule();
|
||||
|
||||
/**
|
||||
* Test method for {@link org.talend.core.model.metadata.builder.database.dburl.SupportDBUrlType#isMssql(String)} .
|
||||
*/
|
||||
|
||||
@@ -51,8 +51,7 @@ public class AS400ExtractManagerTest extends AbstractTest4ExtractManager {
|
||||
@Override
|
||||
protected void verify4ExtractTablesFromDB(DatabaseMetaData mockedDBMetadata, ResultSet mockedGetTablesResultSet)
|
||||
throws SQLException {
|
||||
verify(mockedDBMetadata).getTables(anyString(), anyString(), anyString(), any(String[].class));
|
||||
verify(mockedDBMetadata).getTables((String) isNull(), anyString(), (String) isNull(), any(String[].class));
|
||||
verify(mockedDBMetadata).getTables(isNull(), anyString(), isNull(), any(String[].class));
|
||||
// special
|
||||
verify(mockedDBMetadata, times(2)).supportsSchemasInTableDefinitions();
|
||||
// because limit is 1, so will call twince
|
||||
|
||||
@@ -43,11 +43,9 @@ import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mockito;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.rule.PowerMockRule;
|
||||
import org.talend.core.database.EDatabase4DriverClassName;
|
||||
import org.talend.core.database.EDatabaseTypeName;
|
||||
import org.talend.core.model.metadata.IMetadataConnection;
|
||||
@@ -72,9 +70,6 @@ import orgomg.cwm.objectmodel.core.Feature;
|
||||
@Ignore
|
||||
public class AbstractTest4ExtractManager {
|
||||
|
||||
@Rule
|
||||
public PowerMockRule powerMockRule = new PowerMockRule();
|
||||
|
||||
private ExtractManager extractManger;
|
||||
|
||||
private ExtractMetaDataUtils extractMeta;
|
||||
@@ -224,7 +219,7 @@ public class AbstractTest4ExtractManager {
|
||||
when(mockedDBMetadata.getTableTypes()).thenReturn(mockedTableTypeResultSet);
|
||||
// tables
|
||||
ResultSet mockedGetTablesResultSet = mockGetTablesResultSet4ExtractTablesFromDB();
|
||||
when(mockedDBMetadata.getTables(anyString(), anyString(), anyString(), any(String[].class))).thenReturn(
|
||||
when(mockedDBMetadata.getTables(isNull(), anyString(), isNull(), any(String[].class))).thenReturn(
|
||||
mockedGetTablesResultSet);
|
||||
|
||||
// because only test one table, so limit 1 to make sure "break" the "while"
|
||||
@@ -255,9 +250,8 @@ public class AbstractTest4ExtractManager {
|
||||
// verify(mockedTableTypeResultSet).next();
|
||||
// verify(mockedTableTypeResultSet).close();
|
||||
|
||||
verify(mockedDBMetadata).getTables(anyString(), anyString(), anyString(), any(String[].class));
|
||||
// same
|
||||
verify(mockedDBMetadata).getTables((String) isNull(), anyString(), (String) isNull(), any(String[].class));
|
||||
verify(mockedDBMetadata).getTables(isNull(), anyString(), isNull(), any(String[].class));
|
||||
|
||||
verify(mockedDBMetadata).supportsSchemasInTableDefinitions();
|
||||
// because limit is 1, so will call twince
|
||||
@@ -742,11 +736,6 @@ public class AbstractTest4ExtractManager {
|
||||
protected TdTable mockTable4ReturnColumns4reCreateConnection() throws Exception {
|
||||
TdTable tdTable = mock(TdTable.class);
|
||||
when(tdTable.getName()).thenReturn("TestTable2");
|
||||
ResourceSet resourceSet = new ResourceSetImpl();
|
||||
Resource resource = resourceSet.createResource(URI.createFileURI("tdtable.xml")); //$NON-NLS-1$
|
||||
if (resource != null) {
|
||||
resource.getContents().add(tdTable);
|
||||
}
|
||||
when(tdTable.getFeature()).thenReturn(new BasicEList<Feature>());
|
||||
return tdTable;
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public class HSQLDBExtractManagerTest extends AbstractTest4ExtractManager {
|
||||
when(driver.connect(anyString(), any(Properties.class))).thenReturn(any(Connection.class));
|
||||
|
||||
Assert.assertTrue(getExtractManger().closeConnectionForDerby(driverShim));
|
||||
verify(driver).connect(anyString(), any(Properties.class));
|
||||
verify(driver).connect(anyString(), isNull());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -87,7 +87,7 @@ public class JavaDBExtractManagerTest extends AbstractTest4ExtractManager {
|
||||
@Override
|
||||
protected void testCloseConnect_Verify(IMetadataConnection metadataConn, DriverShim wapperDriver) throws Exception {
|
||||
Assert.assertTrue(getExtractManger().closeConnection(metadataConn, wapperDriver));
|
||||
verify(wapperDriver).connect(anyString(), any(Properties.class));
|
||||
verify(wapperDriver).connect(anyString(), isNull());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -16,8 +16,12 @@ import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.talend.core.database.EDatabaseTypeName;
|
||||
import org.talend.core.database.conn.ConnParameterKeys;
|
||||
import org.talend.core.model.metadata.builder.connection.ConnectionFactory;
|
||||
import org.talend.core.model.metadata.builder.connection.DatabaseConnection;
|
||||
import org.talend.core.model.metadata.builder.connection.impl.ConnectionFactoryImpl;
|
||||
import org.talend.core.model.properties.ConnectionItem;
|
||||
import org.talend.core.model.properties.PropertiesFactory;
|
||||
import org.talend.metadata.managment.repository.ManagerConnection;
|
||||
|
||||
|
||||
/**
|
||||
@@ -39,6 +43,37 @@ public class DBConnectionContextUtilsTest {
|
||||
"impala/tal-qa146.talend.lan@CDH.ONE");
|
||||
DatabaseConnection clonedConn = DBConnectionContextUtils.cloneOriginalValueConnection(originalConn, false, null);
|
||||
Assert.assertEquals(EXPECT_URL, clonedConn.getURL());
|
||||
|
||||
final String EXPECT_DB2_URL = "jdbc:db2://192.168.31.20:50000/mydb2:cursorSensitivity=2;";
|
||||
DatabaseConnection DB2OriginalConn = ConnectionFactoryImpl.eINSTANCE.createDatabaseConnection();
|
||||
DB2OriginalConn.setDatabaseType(EDatabaseTypeName.IBMDB2.getXmlName());
|
||||
DB2OriginalConn.setServerName("192.168.31.20");
|
||||
DB2OriginalConn.setPort("50000");
|
||||
DB2OriginalConn.setSID("mydb2");
|
||||
DatabaseConnection cloneOriginalValueConnection = DBConnectionContextUtils.cloneOriginalValueConnection(DB2OriginalConn,
|
||||
false, null);
|
||||
Assert.assertEquals(EXPECT_DB2_URL, cloneOriginalValueConnection.getURL());
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("nls")
|
||||
@Test
|
||||
public void testSetManagerConnectionValues() {
|
||||
final String EXPECT_URL = "jdbc:firebirdsql:tal-rd169.talend.lan/3050:/databases/TUJ?";
|
||||
final ManagerConnection managerConnection = new ManagerConnection();
|
||||
ConnectionItem connectionItem = PropertiesFactory.eINSTANCE.createConnectionItem();
|
||||
DatabaseConnection conn = ConnectionFactory.eINSTANCE.createDatabaseConnection();
|
||||
conn.setDatabaseType(EDatabaseTypeName.FIREBIRD.getXmlName());
|
||||
conn.setProductId(EDatabaseTypeName.FIREBIRD.getProduct());
|
||||
conn.setServerName("tal-rd169.talend.lan");
|
||||
conn.setUsername("username");
|
||||
conn.setPassword("pwd");
|
||||
conn.setPort("3050");
|
||||
conn.setFileFieldName("/databases/TUJ");
|
||||
connectionItem.setConnection(conn);
|
||||
String setManagerConnectionValues = DBConnectionContextUtils.setManagerConnectionValues(managerConnection, connectionItem,
|
||||
null, conn.getDatabaseType());
|
||||
Assert.assertEquals(EXPECT_URL, setManagerConnectionValues);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/assertj-core-3.0.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/xpp3-1.1.4c.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cglib-nodep-2.2.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/javassist-3.20.0-GA.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/mockito-core-1.10.19.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/objenesis-2.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/powermock-mockito-1.6.5-full.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/powermock-api-mockito-common-1.6.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/powermock-module-junit4-rule-1.6.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/classmexer-0.0.3.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/powermock-classloading-base-1.6.5.jar"/>
|
||||
<classpathentry kind="lib" path="lib/powermock-classloading-xstream-1.6.5.jar"/>
|
||||
<classpathentry kind="lib" path="lib/xstream-1.4.9.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/assertj-core-3.5.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/byte-buddy-1.9.10.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/byte-buddy-agent-1.9.10.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/classmexer-0.0.3.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/javassist-3.24.0-GA.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/mockito-core-2.23.4.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/objenesis-2.6.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/powermock-api-mockito2-2.0.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/powermock-api-support-2.0.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/powermock-core-2.0.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/powermock-module-junit4-2.0.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/powermock-module-junit4-common-2.0.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/powermock-reflect-2.0.0.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"/>
|
||||
</classpath>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user