Compare commits
23 Commits
release/7.
...
bugfix/mas
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1e665f76ae | ||
|
|
040cf2dee6 | ||
|
|
cde7238840 | ||
|
|
b281dcef45 | ||
|
|
50f87d7d92 | ||
|
|
5668a651b2 | ||
|
|
0ec10cc9c3 | ||
|
|
cf74274d63 | ||
|
|
eb33120cac | ||
|
|
003a31b361 | ||
|
|
fda3573d7c | ||
|
|
eecc481d67 | ||
|
|
113db9246f | ||
|
|
bfcdd968ed | ||
|
|
f542ab5779 | ||
|
|
2a0d494f49 | ||
|
|
fe0eab22bd | ||
|
|
12b9a4eee9 | ||
|
|
f0e07897a5 | ||
|
|
bb001061e8 | ||
|
|
bdd9a601b9 | ||
|
|
3646a1bcd9 | ||
|
|
9125f27236 |
@@ -10,7 +10,7 @@
|
||||
<requires>
|
||||
<import feature="org.talend.model.migration.feature" version="0.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.bouncycastle.bcprov" version="0.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="com.fasterxml.jackson.core.jackson-databind" version="2.9.5" match="greaterOrEqual"/>
|
||||
<import plugin="com.fasterxml.jackson.core.jackson-databind" version="2.9.8" match="greaterOrEqual"/>
|
||||
<import plugin="jackson-core-asl" version="0.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="jackson-mapper-asl" version="0.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.apache.xalan" version="0.0.0" match="greaterOrEqual"/>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<import plugin="org.bouncycastle.bcprov" version="0.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="com.cedarsoftware.json-io" version="0.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="com.fasterxml.jackson.core.jackson-annotations" version="2.9.0" match="greaterOrEqual"/>
|
||||
<import plugin="com.fasterxml.jackson.core.jackson-core" version="2.9.5" match="greaterOrEqual"/>
|
||||
<import plugin="com.fasterxml.jackson.core.jackson-core" version="2.9.8" match="greaterOrEqual"/>
|
||||
<import plugin="com.thoughtworks.paranamer" version="0.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="jackson-core-asl" version="0.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="jackson-mapper-asl" version="0.0.0" match="greaterOrEqual"/>
|
||||
@@ -22,5 +22,6 @@
|
||||
<import plugin="org.slf4j.api" version="0.0.0" match="greaterOrEqual"/>
|
||||
</requires>
|
||||
<plugin id="org.talend.daikon" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
|
||||
<plugin id="org.talend.daikon.exception" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
|
||||
<plugin id="org.talend.utils" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
|
||||
</feature>
|
||||
|
||||
@@ -0,0 +1,175 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// 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.commons.ui.runtime.utils;
|
||||
|
||||
/**
|
||||
* DOC Administrator class global comment. Detailled comment
|
||||
*/
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Enumeration;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarOutputStream;
|
||||
|
||||
import org.apache.tools.zip.ZipEntry;
|
||||
import org.apache.tools.zip.ZipFile;
|
||||
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
|
||||
public class ZipFileUtils {
|
||||
|
||||
private static int bufSize = 2048; // size of bytes
|
||||
|
||||
public static String zip(String zipDirectory) {
|
||||
File zipDir = new File(zipDirectory);
|
||||
return zip(zipDirectory, zipDir.getPath(), false);
|
||||
}
|
||||
|
||||
public static String zip(String zipDirectory, String zipFileName, boolean includeSelfDir) {
|
||||
File zipDir = new File(zipDirectory);
|
||||
File[] willZipFileArr;
|
||||
if (includeSelfDir || zipDir.isFile()) {
|
||||
willZipFileArr = new File[] { zipDir };
|
||||
} else {
|
||||
willZipFileArr = zipDir.listFiles();
|
||||
}
|
||||
return zip(willZipFileArr, zipFileName);
|
||||
}
|
||||
|
||||
public static String zip(File[] files, String zipFileName) {
|
||||
|
||||
JarOutputStream jarOutput = null;
|
||||
try {
|
||||
jarOutput = new JarOutputStream(new FileOutputStream(zipFileName));
|
||||
|
||||
for (File file : files) {
|
||||
zipFiles(file, jarOutput, "");
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
} finally {
|
||||
if (jarOutput != null) {
|
||||
try {
|
||||
jarOutput.close();
|
||||
} catch (IOException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static void zipFiles(File file, JarOutputStream jos, String pathName) throws Exception {
|
||||
String fileName = pathName + file.getName();
|
||||
if (file.isDirectory()) {
|
||||
fileName = fileName + "/";
|
||||
jos.putNextEntry(new JarEntry(fileName));
|
||||
String fileNames[] = file.list();
|
||||
if (fileNames != null) {
|
||||
for (int i = 0; i < fileNames.length; i++) {
|
||||
zipFiles(new File(file, fileNames[i]), jos, fileName);
|
||||
}
|
||||
jos.closeEntry();
|
||||
}
|
||||
} else {
|
||||
JarEntry jarEntry = new JarEntry(fileName);
|
||||
BufferedInputStream in = new BufferedInputStream(new FileInputStream(file));
|
||||
jos.putNextEntry(jarEntry);
|
||||
|
||||
byte[] buf = new byte[bufSize];
|
||||
int len;
|
||||
while ((len = in.read(buf)) >= 0) {
|
||||
jos.write(buf, 0, len);
|
||||
}
|
||||
in.close();
|
||||
jos.closeEntry();
|
||||
}
|
||||
}
|
||||
|
||||
public static String unZip(File unZipFile) {
|
||||
return unZip(unZipFile.getPath(), null);
|
||||
}
|
||||
|
||||
public static String unZip(File unZipFile, String destFileName) {
|
||||
return unZip(unZipFile.getPath(), destFileName);
|
||||
}
|
||||
|
||||
public static String unZip(String unZipFileName) {
|
||||
return unZip(unZipFileName, null);
|
||||
}
|
||||
|
||||
public static String unZip(String unZipFileName, String destFileName) {
|
||||
File unzipFile = new File(unZipFileName);
|
||||
|
||||
if (destFileName == null || destFileName.trim().length() == 0) {
|
||||
destFileName = unzipFile.getParent();
|
||||
}
|
||||
|
||||
File destFile;
|
||||
ZipFile zipFile = null;
|
||||
try {
|
||||
zipFile = new ZipFile(unzipFile, "GBK");
|
||||
for (Enumeration entries = zipFile.getEntries(); entries.hasMoreElements();) {
|
||||
ZipEntry entry = (ZipEntry) entries.nextElement();
|
||||
destFile = new File(destFileName, entry.getName());
|
||||
|
||||
unZipFile(destFile, zipFile, entry);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
return e.getMessage();
|
||||
} finally {
|
||||
try {
|
||||
assert zipFile != null;
|
||||
zipFile.close();
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static void unZipFile(File destFile, ZipFile zipFile, ZipEntry entry) throws IOException {
|
||||
InputStream inputStream;
|
||||
FileOutputStream fileOut;
|
||||
if (entry.isDirectory()) {
|
||||
destFile.mkdirs();
|
||||
} else {
|
||||
File parent = destFile.getParentFile();
|
||||
if (parent != null && !parent.exists()) {
|
||||
parent.mkdirs();
|
||||
}
|
||||
|
||||
inputStream = zipFile.getInputStream(entry);
|
||||
|
||||
fileOut = new FileOutputStream(destFile);
|
||||
byte[] buf = new byte[bufSize];
|
||||
int readedBytes;
|
||||
while ((readedBytes = inputStream.read(buf)) > 0) {
|
||||
fileOut.write(buf, 0, readedBytes);
|
||||
}
|
||||
fileOut.close();
|
||||
|
||||
inputStream.close();
|
||||
}
|
||||
}
|
||||
|
||||
public void setBufSize(int bufSize) {
|
||||
ZipFileUtils.bufSize = bufSize;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,280 @@
|
||||
<?xml version="1.0"?>
|
||||
<mapping>
|
||||
<dbms product="AMAZON_AURORA" id="amazon_aurora_id" label="Mapping AMAZON_AURORA"
|
||||
default="true">
|
||||
<dbTypes>
|
||||
<dbType type="BIGINT" ignorePre="true"/>
|
||||
<dbType type="BIGINT UNSIGNED" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="BINARY" ignorePre="true"/>
|
||||
<dbType type="BIT" ignorePre="true" />
|
||||
<dbType type="BLOB" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="CHAR" defaultLength="200" ignorePre="true"/>
|
||||
<dbType type="DATE" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="DATETIME" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="DECIMAL" defaultLength="20" defaultPrecision="10" preBeforelen="false"/>
|
||||
<dbType type="DOUBLE" defaultLength="20" defaultPrecision="10"/>
|
||||
<dbType type="DOUBLE UNSIGNED" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="ENUM" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="FLOAT" defaultPrecision="2"/>
|
||||
<dbType type="FLOAT UNSIGNED" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="GEOMETRY" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="GEOMETRYCOLLECTION" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="INT" ignorePre="true" />
|
||||
<dbType type="INT UNSIGNED" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="LINESTRING" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="LONGTEXT" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="LONGBLOB" ignoreLen="true" ignorePre="true"/>
|
||||
<dbType type="MEDIUMBLOB" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="MEDIUMINT" ignorePre="true" />
|
||||
<dbType type="MEDIUMINT UNSIGNED" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="MEDIUMTEXT" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="MULTILINESTRING" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="MULTIPOINT" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="MULTIPOLYGON" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="POINT" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="POLYGON" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="SMALLINT" ignorePre="true" />
|
||||
<dbType type="SMALLINT UNSIGNED" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="SET" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="TEXT" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="TIME" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="TIMESTAMP" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="TINYBLOB" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="TINYINT" ignorePre="true" />
|
||||
<dbType type="TINYINT UNSIGNED" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="TINYTEXT" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="VARBINARY" ignorePre="true" />
|
||||
<dbType type="VARCHAR" default="true" defaultLength="100" ignorePre="true"/>
|
||||
<dbType type="YEAR" ignorePre="true"/>
|
||||
</dbTypes>
|
||||
|
||||
<language name="java">
|
||||
<talendToDbTypes><!-- Adviced mappings -->
|
||||
<talendType type="id_List"/>
|
||||
<talendType type="id_Boolean">
|
||||
<dbType type="BIT" default="true" />
|
||||
</talendType>
|
||||
<talendType type="id_Byte">
|
||||
<dbType type="TINYINT" default="true" />
|
||||
<dbType type="BIGINT" />
|
||||
<dbType type="INT" />
|
||||
<dbType type="MEDIUMINT" />
|
||||
<dbType type="SMALLINT" />
|
||||
</talendType>
|
||||
<talendType type="id_byte[]">
|
||||
</talendType>
|
||||
<talendType type="id_Character">
|
||||
<dbType type="CHAR" default="true" />
|
||||
<dbType type="VARCHAR"/>
|
||||
</talendType>
|
||||
<talendType type="id_Date">
|
||||
<dbType type="DATE" />
|
||||
<dbType type="DATETIME" default="true" />
|
||||
<dbType type="TIME" />
|
||||
<dbType type="YEAR" />
|
||||
<dbType type="TIMESTAMP" />
|
||||
</talendType>
|
||||
<talendType type="id_BigDecimal">
|
||||
<dbType type="DECIMAL" default="true" />
|
||||
<dbType type="FLOAT"/>
|
||||
<dbType type="DOUBLE" />
|
||||
</talendType>
|
||||
<talendType type="id_Double">
|
||||
<dbType type="DOUBLE" default="true" />
|
||||
<dbType type="FLOAT"/>
|
||||
<dbType type="DECIMAL" />
|
||||
</talendType>
|
||||
<talendType type="id_Float">
|
||||
<dbType type="FLOAT" default="true" />
|
||||
<dbType type="DOUBLE"/>
|
||||
<dbType type="DECIMAL" />
|
||||
</talendType>
|
||||
<talendType type="id_Integer">
|
||||
<dbType type="INT" default="true" />
|
||||
<dbType type="BIGINT" />
|
||||
</talendType>
|
||||
<talendType type="id_Long">
|
||||
<dbType type="BIGINT" default="true" />
|
||||
</talendType>
|
||||
<talendType type="id_Object">
|
||||
<dbType type="BLOB" default="true"/>
|
||||
<dbType type="ENUM" />
|
||||
<dbType type="GEOMETRY" />
|
||||
<dbType type="GEOMETRYCOLLECTION" />
|
||||
<dbType type="MEDIUMINT" />
|
||||
<dbType type="LONGBLOB" />
|
||||
<dbType type="MEDIUMBLOB" />
|
||||
<dbType type="MULTIPOINT" />
|
||||
<dbType type="MULTIPOLYGON" />
|
||||
<dbType type="POINT" />
|
||||
<dbType type="POLYGON" />
|
||||
<dbType type="SET" />
|
||||
<dbType type="TINYBLOB" />
|
||||
</talendType>
|
||||
<talendType type="id_Short">
|
||||
<dbType type="SMALLINT" default="true" />
|
||||
<dbType type="INT" />
|
||||
<dbType type="BIGINT"/>
|
||||
<dbType type="MEDIUMINT" />
|
||||
</talendType>
|
||||
<talendType type="id_String">
|
||||
<dbType type="VARCHAR" default="true" />
|
||||
<dbType type="LINESTRING" />
|
||||
<dbType type="LONGTEXT"/>
|
||||
<dbType type="MEDIUMTEXT" />
|
||||
<dbType type="MULTILINESTRING" />
|
||||
<dbType type="TEXT" />
|
||||
<dbType type="TINYTEXT" />
|
||||
</talendType>
|
||||
</talendToDbTypes>
|
||||
<dbToTalendTypes>
|
||||
<dbType type="BIGINT">
|
||||
<talendType type="id_Long" default="true" />
|
||||
</dbType>
|
||||
<dbType type="BINARY">
|
||||
<talendType type="id_Boolean" default="true" />
|
||||
</dbType>
|
||||
<dbType type="BIT">
|
||||
<talendType type="id_Boolean" default="true" />
|
||||
</dbType>
|
||||
<dbType type="BLOB">
|
||||
<talendType type="id_Object" default="true" />
|
||||
</dbType>
|
||||
<dbType type="CHAR">
|
||||
<talendType type="id_String" default="true" />
|
||||
</dbType>
|
||||
<dbType type="DATE">
|
||||
<talendType type="id_Date" default="true" />
|
||||
</dbType>
|
||||
<dbType type="DATETIME">
|
||||
<talendType type="id_Date" default="true" />
|
||||
</dbType>
|
||||
<dbType type="DECIMAL">
|
||||
<talendType type="id_Float"/>
|
||||
<talendType type="id_Double"/>
|
||||
<talendType type="id_BigDecimal" default="true"/>
|
||||
</dbType>
|
||||
<dbType type="DOUBLE">
|
||||
<talendType type="id_Double" default="true" />
|
||||
<talendType type="id_BigDecimal"/>
|
||||
</dbType>
|
||||
<dbType type="ENUM">
|
||||
<talendType type="id_Object" default="true" />
|
||||
</dbType>
|
||||
<dbType type="FLOAT">
|
||||
<talendType type="id_Float" default="true" />
|
||||
<talendType type="id_Double"/>
|
||||
<talendType type="id_BigDecimal"/>
|
||||
</dbType>
|
||||
<dbType type="GEOMETRY">
|
||||
<talendType type="id_Object" default="true" />
|
||||
</dbType>
|
||||
<dbType type="GEOMETRYCOLLECTION">
|
||||
<talendType type="id_Object" default="true" />
|
||||
</dbType>
|
||||
<dbType type="INT">
|
||||
<talendType type="id_Integer" default="true" />
|
||||
<talendType type="id_Long"/>
|
||||
</dbType>
|
||||
<dbType type="LINESTRING">
|
||||
<talendType type="id_String" default="true" />
|
||||
</dbType>
|
||||
<dbType type="LONGTEXT">
|
||||
<talendType type="id_String" default="true" />
|
||||
</dbType>
|
||||
<dbType type="LONGBLOB">
|
||||
<talendType type="id_Object" default="true" />
|
||||
</dbType>
|
||||
<dbType type="MEDIUMBLOB">
|
||||
<talendType type="id_Object" default="true" />
|
||||
</dbType>
|
||||
<dbType type="MEDIUMINT">
|
||||
<talendType type="id_Integer" default="true" />
|
||||
<talendType type="id_Long"/>
|
||||
</dbType>
|
||||
<dbType type="MEDIUMTEXT">
|
||||
<talendType type="id_String" default="true" />
|
||||
</dbType>
|
||||
<dbType type="MULTILINESTRING">
|
||||
<talendType type="id_String" default="true" />
|
||||
</dbType>
|
||||
<dbType type="MULTIPOINT">
|
||||
<talendType type="id_Object" default="true" />
|
||||
</dbType>
|
||||
<dbType type="MULTIPOLYGON">
|
||||
<talendType type="id_Object" default="true" />
|
||||
</dbType>
|
||||
<dbType type="POINT">
|
||||
<talendType type="id_Object" default="true" />
|
||||
</dbType>
|
||||
<dbType type="POLYGON">
|
||||
<talendType type="id_Object" default="true" />
|
||||
</dbType>
|
||||
<dbType type="SMALLINT">
|
||||
<talendType type="id_Short" default="true" />
|
||||
<talendType type="id_Long"/>
|
||||
<talendType type="id_Integer"/>
|
||||
</dbType>
|
||||
<dbType type="SET">
|
||||
<talendType type="id_Object" default="true" />
|
||||
</dbType>
|
||||
<dbType type="TEXT">
|
||||
<talendType type="id_String" default="true" />
|
||||
</dbType>
|
||||
<dbType type="TIME">
|
||||
<talendType type="id_Date" default="true" />
|
||||
</dbType>
|
||||
<dbType type="TIMESTAMP">
|
||||
<talendType type="id_Date" default="true" />
|
||||
</dbType>
|
||||
<dbType type="TINYBLOB">
|
||||
<talendType type="id_Object" default="true" />
|
||||
</dbType>
|
||||
<dbType type="TINYINT">
|
||||
<talendType type="id_Byte" default="true" />
|
||||
<talendType type="id_Integer"/>
|
||||
<talendType type="id_Long"/>
|
||||
<talendType type="id_Short"/>
|
||||
</dbType>
|
||||
<dbType type="TINYTEXT">
|
||||
<talendType type="id_String" default="true" />
|
||||
</dbType>
|
||||
<dbType type="VARBINARY">
|
||||
</dbType>
|
||||
<dbType type="VARCHAR">
|
||||
<talendType type="id_String" default="true" />
|
||||
</dbType>
|
||||
<dbType type="YEAR">
|
||||
<talendType type="id_Date" default="true" />
|
||||
</dbType>
|
||||
<dbType type="BIGINT UNSIGNED" >
|
||||
</dbType>
|
||||
<dbType type="DOUBLE UNSIGNED" >
|
||||
<talendType type="id_Double" default="true" />
|
||||
<talendType type="id_BigDecimal"/>
|
||||
</dbType>
|
||||
<dbType type="FLOAT UNSIGNED" >
|
||||
<talendType type="id_Double" default="true" />
|
||||
<talendType type="id_BigDecimal"/>
|
||||
</dbType>
|
||||
<dbType type="INT UNSIGNED" >
|
||||
<talendType type="id_Long" default="true" />
|
||||
</dbType>
|
||||
<dbType type="MEDIUMINT UNSIGNED" >
|
||||
<talendType type="id_Integer" default="true" />
|
||||
<talendType type="id_Long" />
|
||||
</dbType>
|
||||
<dbType type="SMALLINT UNSIGNED" >
|
||||
<talendType type="id_Integer" default="true" />
|
||||
<talendType type="id_Long" />
|
||||
</dbType>
|
||||
<dbType type="TINYINT UNSIGNED" >
|
||||
<talendType type="id_Short" default="true" />
|
||||
<talendType type="id_Integer" />
|
||||
<talendType type="id_Long" />
|
||||
</dbType>
|
||||
</dbToTalendTypes>
|
||||
</language>
|
||||
</dbms>
|
||||
|
||||
</mapping>
|
||||
@@ -88,10 +88,8 @@
|
||||
<talendType type="id_BigDecimal" default="true"/>
|
||||
</dbType>
|
||||
<dbType type="BIGINT">
|
||||
<talendType type="id_BigDecimal" default="true"/>
|
||||
<talendType type="id_Byte"/>
|
||||
<talendType type="id_Long" default="true"/>
|
||||
<talendType type="id_Integer"/>
|
||||
<talendType type="id_Long"/>
|
||||
</dbType>
|
||||
<dbType type="INT">
|
||||
<talendType type="id_Integer" default="true"/>
|
||||
|
||||
@@ -22,98 +22,105 @@ import org.talend.core.runtime.projectsetting.IProjectSettingPreferenceConstants
|
||||
*/
|
||||
public enum EDatabaseTypeName {
|
||||
MYSQL(
|
||||
"MySQL", "MySQL", Boolean.FALSE, "MYSQL", "MYSQL", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
"MySQL", "MySQL", Boolean.FALSE, "MYSQL", "MYSQL", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
AMAZON_AURORA(
|
||||
"Amazon Aurora", "Amazon Aurora", Boolean.FALSE, "AMAZON_AURORA", "AMAZON_AURORA", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
"Amazon Aurora", "Amazon Aurora", Boolean.FALSE, "AMAZON_AURORA", "AMAZON_AURORA", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
PSQL(
|
||||
"PostgreSQL", "PostgreSQL", Boolean.TRUE, "POSTGRESQL", "POSTGRE", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
"PostgreSQL", "PostgreSQL", Boolean.TRUE, "POSTGRESQL", "POSTGRE", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
PLUSPSQL(
|
||||
"PostgresPlus", "PostgresPlus", Boolean.TRUE, "POSTGRESPLUS", "POSTGREPLUS", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
"PostgresPlus", "PostgresPlus", Boolean.TRUE, "POSTGRESPLUS", "POSTGREPLUS", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
ORACLEFORSID(
|
||||
"ORACLE_SID", "Oracle with SID", Boolean.TRUE, "ORACLE", "DBORACLE", EDatabaseSchemaOrCatalogMapping.None, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
"ORACLE_SID", "Oracle with SID", Boolean.TRUE, "ORACLE", "DBORACLE", EDatabaseSchemaOrCatalogMapping.None, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
ORACLESN(
|
||||
"ORACLE_SERVICE_NAME", "Oracle with service name", Boolean.TRUE, "ORACLE", "DBORACLE", EDatabaseSchemaOrCatalogMapping.None, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
"ORACLE_SERVICE_NAME", "Oracle with service name", Boolean.TRUE, "ORACLE", "DBORACLE", EDatabaseSchemaOrCatalogMapping.None, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
ORACLE_OCI(
|
||||
"ORACLE_OCI", "Oracle OCI", Boolean.TRUE, "ORACLE", "DBORACLE", EDatabaseSchemaOrCatalogMapping.None, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
"ORACLE_OCI", "Oracle OCI", Boolean.TRUE, "ORACLE", "DBORACLE", EDatabaseSchemaOrCatalogMapping.None, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
ORACLE_CUSTOM(
|
||||
"ORACLE_CUSTOM", "Oracle Custom", Boolean.TRUE, "ORACLE", "DBORACLE", EDatabaseSchemaOrCatalogMapping.None, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
"ORACLE_CUSTOM", "Oracle Custom", Boolean.TRUE, "ORACLE", "DBORACLE", EDatabaseSchemaOrCatalogMapping.None, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
/**
|
||||
* @deprecated odbc is not supported in java8
|
||||
*/
|
||||
GODBC(
|
||||
"Generic ODBC", "Generic ODBC (Unsupported)", Boolean.FALSE, "ODBC", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"Generic ODBC", "Generic ODBC (Unsupported)", Boolean.FALSE, "ODBC", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
/**
|
||||
* @deprecated odbc is not supported in java8
|
||||
*/
|
||||
MSODBC(
|
||||
"Microsoft SQL (Odbc driver)", "Microsoft SQL Server (Odbc driver, Unsupported)", Boolean.FALSE, "ODBC", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"Microsoft SQL (Odbc driver)", "Microsoft SQL Server (Odbc driver, Unsupported)", Boolean.FALSE, "ODBC", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
IBMDB2(
|
||||
"IBM DB2", "IBM DB2", Boolean.TRUE, "IBM_DB2", "DB2", EDatabaseSchemaOrCatalogMapping.None, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
"IBM DB2", "IBM DB2", Boolean.TRUE, "IBM_DB2", "DB2", EDatabaseSchemaOrCatalogMapping.None, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
IBMDB2ZOS(
|
||||
"IBM DB2 ZOS", "IBM DB2 ZOS", Boolean.TRUE, "IBM_DB2", "DB2", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
"IBM DB2 ZOS", "IBM DB2 ZOS", Boolean.TRUE, "IBM_DB2", "DB2", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
SYBASEASE(
|
||||
"SybaseASE", "Sybase (ASE and IQ)", Boolean.TRUE, "SYBASE", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"SybaseASE", "Sybase (ASE and IQ)", Boolean.TRUE, "SYBASE", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
|
||||
// this Sybase IQ not used.
|
||||
SYBASEIQ(
|
||||
"Sybase IQ", "Sybase IQ", Boolean.TRUE, "SYBASE", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"Sybase IQ", "Sybase IQ", Boolean.TRUE, "SYBASE", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
MSSQL(
|
||||
"MSSQL", "Microsoft SQL Server", Boolean.TRUE, "SQL_SERVER", "MSSQL", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
"MSSQL", "Microsoft SQL Server", Boolean.TRUE, "SQL_SERVER", "MSSQL", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
MSSQL05_08(
|
||||
"MSSQL", "Microsoft SQL Server 2005/2008", Boolean.TRUE, "SQL_SERVER", "MSSQL", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
"MSSQL", "Microsoft SQL Server 2005/2008", Boolean.TRUE, "SQL_SERVER", "MSSQL", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
// this don't use in Branch 2.0
|
||||
HSQLDB("HSQLDB", "HSQLDB", Boolean.FALSE, "HSQLDB", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
HSQLDB(
|
||||
"HSQLDB", "HSQLDB", Boolean.FALSE, "HSQLDB", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
HSQLDB_SERVER(
|
||||
"HSQLDB Server", "HSQLDB Server", Boolean.FALSE, "HSQLDB", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"HSQLDB Server", "HSQLDB Server", Boolean.FALSE, "HSQLDB", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
HSQLDB_WEBSERVER(
|
||||
"HSQLDB WebServer", "HSQLDB WebServer", Boolean.FALSE, "HSQLDB", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"HSQLDB WebServer", "HSQLDB WebServer", Boolean.FALSE, "HSQLDB", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
HSQLDB_IN_PROGRESS(
|
||||
"HSQLDB In-Process", "HSQLDB In-Process", Boolean.FALSE, "HSQLDB", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"HSQLDB In-Process", "HSQLDB In-Process", Boolean.FALSE, "HSQLDB", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
|
||||
JAVADB("JavaDB", "JavaDB", Boolean.FALSE, "JAVADB", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
JAVADB(
|
||||
"JavaDB", "JavaDB", Boolean.FALSE, "JAVADB", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
INGRES(
|
||||
"Ingres", "Ingres", Boolean.FALSE, "INGRES", EDatabaseSchemaOrCatalogMapping.None, EDatabaseSchemaOrCatalogMapping.Schema), // "INGRES"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"Ingres", "Ingres", Boolean.FALSE, "INGRES", EDatabaseSchemaOrCatalogMapping.None, EDatabaseSchemaOrCatalogMapping.Schema), // "INGRES"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
INTERBASE(
|
||||
"Interbase", "Interbase", Boolean.FALSE, "INTERBASE", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), // "INTERBASE"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
SQLITE("SQLite", "SQLite", Boolean.FALSE, "SQLITE", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), // "SQLITE"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"Interbase", "Interbase", Boolean.FALSE, "INTERBASE", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), // "INTERBASE"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
SQLITE(
|
||||
"SQLite", "SQLite", Boolean.FALSE, "SQLITE", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), // "SQLITE"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
FIREBIRD(
|
||||
"FireBird", "FireBird", Boolean.FALSE, "FIREBIRD", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), // "FIREBIRD"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"FireBird", "FireBird", Boolean.FALSE, "FIREBIRD", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), // "FIREBIRD"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
INFORMIX(
|
||||
"Informix", "Informix", Boolean.TRUE, "INFORMIX", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), // "INFORMIX"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"Informix", "Informix", Boolean.TRUE, "INFORMIX", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), // "INFORMIX"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
VECTORWISE(
|
||||
"VectorWise", "VectorWise", Boolean.FALSE, "VECTORWISE", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"VectorWise", "VectorWise", Boolean.FALSE, "VECTORWISE", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
|
||||
ACCESS(
|
||||
"Access", "Access", Boolean.FALSE, "ACCESS", EDatabaseSchemaOrCatalogMapping.None, EDatabaseSchemaOrCatalogMapping.Default_Name), // "ACCESS"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"Access", "Access", Boolean.FALSE, "ACCESS", EDatabaseSchemaOrCatalogMapping.None, EDatabaseSchemaOrCatalogMapping.Default_Name), // "ACCESS"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
TERADATA(
|
||||
"Teradata", "Teradata", Boolean.TRUE, "TERADATA", EDatabaseSchemaOrCatalogMapping.None, EDatabaseSchemaOrCatalogMapping.Schema), // "TERADATA"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
AS400("AS400", "AS400", Boolean.FALSE, "AS400", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.Login), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"Teradata", "Teradata", Boolean.TRUE, "TERADATA", EDatabaseSchemaOrCatalogMapping.None, EDatabaseSchemaOrCatalogMapping.Schema), // "TERADATA"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
AS400(
|
||||
"AS400", "AS400", Boolean.FALSE, "AS400", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.Login), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
|
||||
JAVADB_EMBEDED(
|
||||
"JavaDB Embeded", "JavaDB Embeded", Boolean.FALSE, "JAVADB", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"JavaDB Embeded", "JavaDB Embeded", Boolean.FALSE, "JAVADB", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
JAVADB_JCCJDBC(
|
||||
"JavaDB JCCJDBC", "JavaDB JCCJDBC", Boolean.FALSE, "JAVADB", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"JavaDB JCCJDBC", "JavaDB JCCJDBC", Boolean.FALSE, "JAVADB", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
JAVADB_DERBYCLIENT(
|
||||
"JavaDB DerbyClient", "JavaDB DerbyClient", Boolean.FALSE, "JAVADB", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"JavaDB DerbyClient", "JavaDB DerbyClient", Boolean.FALSE, "JAVADB", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
|
||||
VERTICA(
|
||||
"Vertica", "Vertica", Boolean.TRUE, "VERTICA", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
|
||||
MAXDB("MAXDB", "MaxDB", Boolean.FALSE, "MAXDB", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
MAXDB(
|
||||
"MAXDB", "MaxDB", Boolean.FALSE, "MAXDB", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
|
||||
GREENPLUM(
|
||||
"Greenplum", "Greenplum", Boolean.TRUE, "GREENPLUM", "GREENPLUM", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
"Greenplum", "Greenplum", Boolean.TRUE, "GREENPLUM", "GREENPLUM", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
PARACCEL(
|
||||
"ParAccel", "ParAccel", Boolean.TRUE, "PARACCEL", "PARACCEL", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
"ParAccel", "ParAccel", Boolean.TRUE, "PARACCEL", "PARACCEL", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
NETEZZA(
|
||||
"Netezza", "Netezza", Boolean.FALSE, "NETEZZA", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
SAS("SAS", "SAS", Boolean.TRUE, "SAS", EDatabaseSchemaOrCatalogMapping.None, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
// General JDBC not support schema defalut
|
||||
GENERAL_JDBC(
|
||||
"General JDBC", "General JDBC", Boolean.FALSE, "JDBC", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
EXASOL("Exasol", "Exasol", Boolean.TRUE, "Exasol", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"General JDBC", "General JDBC", Boolean.FALSE, "JDBC", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
EXASOL(
|
||||
"Exasol", "Exasol", Boolean.TRUE, "Exasol", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
|
||||
HIVE("Hive", "Hive", Boolean.FALSE, "HIVE", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
HIVE(
|
||||
"Hive", "Hive", Boolean.FALSE, "HIVE", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
|
||||
SAPHana(
|
||||
"SAPHana", "SAPHana", Boolean.TRUE, "SAPHANA", EDatabaseSchemaOrCatalogMapping.None, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
@@ -121,24 +128,23 @@ public enum EDatabaseTypeName {
|
||||
H2("H2", "H2", Boolean.FALSE, "H2", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
|
||||
REDSHIFT(
|
||||
"Redshift", "Redshift", Boolean.TRUE, "REDSHIFT", "REDSHIFT", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
REDSHIFT_SSO(
|
||||
"Redshift SSO", //$NON-NLS-1$
|
||||
"Redshift SSO", //$NON-NLS-1$
|
||||
Boolean.TRUE,
|
||||
"REDSHIFT", //$NON-NLS-1$
|
||||
"REDSHIFT SSO", //$NON-NLS-1$
|
||||
EDatabaseSchemaOrCatalogMapping.Sid,
|
||||
EDatabaseSchemaOrCatalogMapping.Schema),
|
||||
"Redshift", "Redshift", Boolean.TRUE, "REDSHIFT", "REDSHIFT", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
REDSHIFT_SSO("Redshift SSO", //$NON-NLS-1$
|
||||
"Redshift SSO", //$NON-NLS-1$
|
||||
Boolean.TRUE,
|
||||
"REDSHIFT", //$NON-NLS-1$
|
||||
"REDSHIFT SSO", //$NON-NLS-1$
|
||||
EDatabaseSchemaOrCatalogMapping.Sid,
|
||||
EDatabaseSchemaOrCatalogMapping.Schema),
|
||||
|
||||
IMPALA(
|
||||
"IMPALA", "Impala", Boolean.TRUE, "IMPALA", EDatabaseSchemaOrCatalogMapping.None, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"IMPALA", "Impala", Boolean.TRUE, "IMPALA", EDatabaseSchemaOrCatalogMapping.None, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
|
||||
HBASE(
|
||||
"HBase", "HBase", Boolean.FALSE, "HBASE", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.Column_Family, true), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"HBase", "HBase", Boolean.FALSE, "HBASE", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.Column_Family, true), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
|
||||
MAPRDB(
|
||||
"MapRDB", "MapRDB", Boolean.FALSE, "MAPRDB", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.Column_Family, true);//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"MapRDB", "MapRDB", Boolean.FALSE, "MAPRDB", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.Column_Family, true);//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
|
||||
// displayName is used in Java code.
|
||||
private String displayName;
|
||||
@@ -322,11 +328,24 @@ public enum EDatabaseTypeName {
|
||||
boolean isSupport = true;
|
||||
|
||||
if (EDatabaseTypeName.GODBC == this || EDatabaseTypeName.MSODBC == this) {
|
||||
boolean isSupportODBC = CoreRuntimePlugin.getInstance().getProjectPreferenceManager()
|
||||
.getBoolean(IProjectSettingPreferenceConstants.METADATA_DBCONNECTION_ODBC_ENABLE);
|
||||
boolean isSupportODBC =
|
||||
CoreRuntimePlugin
|
||||
.getInstance()
|
||||
.getProjectPreferenceManager()
|
||||
.getBoolean(IProjectSettingPreferenceConstants.METADATA_DBCONNECTION_ODBC_ENABLE);
|
||||
isSupport = isSupportODBC;
|
||||
}
|
||||
|
||||
return isSupport;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for dbType.
|
||||
*
|
||||
* @return the dbType
|
||||
*/
|
||||
public String getDbType() {
|
||||
return this.dbType;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -96,11 +96,11 @@ public enum EDatabaseConnTemplate {
|
||||
"jdbc:sqlanywhere:Host=<host>:<port>;DatabaseName=<sid>;<property>", //$NON-NLS-1$
|
||||
"2638")), //$NON-NLS-1$
|
||||
IBMDB2(new DbConnStr(EDatabaseTypeName.IBMDB2, //
|
||||
"jdbc:db2://<host>:<port>/<sid>", //$NON-NLS-1$
|
||||
"jdbc:db2://<host>:<port>/<sid>:<property>", //$NON-NLS-1$
|
||||
"50000")), //$NON-NLS-1$
|
||||
|
||||
IBMDB2_ZOS(new DbConnStr(EDatabaseTypeName.IBMDB2ZOS, //
|
||||
"jdbc:db2://<host>:<port>/<sid>", //$NON-NLS-1$
|
||||
"jdbc:db2://<host>:<port>/<sid>:<property>", //$NON-NLS-1$
|
||||
"557")), //$NON-NLS-1$
|
||||
|
||||
SQLITE(new DbConnStr(EDatabaseTypeName.SQLITE, //
|
||||
@@ -145,11 +145,11 @@ public enum EDatabaseConnTemplate {
|
||||
"1527")), //$NON-NLS-1$
|
||||
|
||||
HSQLDB_SERVER(new DbConnStr(EDatabaseTypeName.HSQLDB_SERVER, //
|
||||
"jdbc:hsqldb:hsql://<host>:<port>/<sid>", //$NON-NLS-1$
|
||||
"jdbc:hsqldb:hsql://<host>:<port>/<sid>;<property>", //$NON-NLS-1$
|
||||
"9001")), //$NON-NLS-1$
|
||||
|
||||
HSQLDB_WEBSERVER(new DbConnStr(EDatabaseTypeName.HSQLDB_WEBSERVER, //
|
||||
"jdbc:hsqldb:http://<host>:<port>/<sid>", //$NON-NLS-1$
|
||||
"jdbc:hsqldb:http://<host>:<port>/<sid>;<property>", //$NON-NLS-1$
|
||||
"9001")), //$NON-NLS-1$
|
||||
|
||||
HSQLDB_IN_PROGRESS(new DbConnStr(EDatabaseTypeName.HSQLDB_IN_PROGRESS, //
|
||||
@@ -182,7 +182,7 @@ public enum EDatabaseConnTemplate {
|
||||
"5439",//$NON-NLS-1$
|
||||
"")), //$NON-NLS-1$
|
||||
NETEZZA(new DbConnStr(EDatabaseTypeName.NETEZZA, //
|
||||
"jdbc:netezza://<host>:<port>/<sid>", //$NON-NLS-1$
|
||||
"jdbc:netezza://<host>:<port>/<sid>;<property>", //$NON-NLS-1$
|
||||
"5480")), //$NON-NLS-1$
|
||||
|
||||
VERTICA(new DbConnStr(EDatabaseTypeName.VERTICA, //
|
||||
@@ -306,7 +306,7 @@ public enum EDatabaseConnTemplate {
|
||||
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){
|
||||
@@ -420,6 +420,11 @@ public enum EDatabaseConnTemplate {
|
||||
case JAVADB_JCCJDBC:
|
||||
case JAVADB_DERBYCLIENT:
|
||||
case MAXDB:
|
||||
case IBMDB2:
|
||||
case IBMDB2_ZOS:
|
||||
case HSQLDB_SERVER:
|
||||
case HSQLDB_WEBSERVER:
|
||||
case NETEZZA:
|
||||
return true;
|
||||
default:
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public enum EDatabaseVersion4Drivers {
|
||||
SQLITE(new DbVersion4Drivers(EDatabaseTypeName.SQLITE, "sqlitejdbc-v056.jar")), //$NON-NLS-1$
|
||||
FIREBIRD(new DbVersion4Drivers(EDatabaseTypeName.FIREBIRD, "jaybird-full-2.1.1.jar")), //$NON-NLS-1$
|
||||
TERADATA(new DbVersion4Drivers(EDatabaseTypeName.TERADATA,
|
||||
new String[] { "terajdbc4-15.10.00.14.jar", "tdgssconfig-15.10.00.14.jar" })), //$NON-NLS-1$ //$NON-NLS-2$
|
||||
new String[] { "terajdbc4-16.20.00.02.jar", "tdgssconfig-16.20.00.02.jar" })), //$NON-NLS-1$ //$NON-NLS-2$
|
||||
JAVADB_DERBYCLIENT(new DbVersion4Drivers(EDatabaseTypeName.JAVADB_DERBYCLIENT, "derbyclient.jar")), //$NON-NLS-1$
|
||||
NETEZZA(new DbVersion4Drivers(EDatabaseTypeName.NETEZZA, "nzjdbc.jar")), //$NON-NLS-1$
|
||||
INFORMIX(new DbVersion4Drivers(EDatabaseTypeName.INFORMIX, "ifxjdbc.jar")), //$NON-NLS-1$
|
||||
|
||||
@@ -153,7 +153,7 @@ public class MetadataTable implements IMetadataTable, Cloneable {
|
||||
List<IMetadataColumn> temp = new ArrayList<IMetadataColumn>();
|
||||
temp.addAll(this.listColumns);
|
||||
temp.addAll(this.unusedColumns);
|
||||
if (isRepository && originalColumns != null) {
|
||||
if (originalColumns != null) {
|
||||
Collections.sort(temp, new Comparator<IMetadataColumn>() {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -213,6 +213,7 @@ public final class MetadataToolAvroHelper {
|
||||
//ignore it now as we can't process the complex expression for the default value, and the default value is not useful for runtime like the old javajet tjdbcxxx
|
||||
//TODO support the expression calculate, not sure it's necessary and sometimes, more complex like globalMap.get(xxx) which only have meaning after running the job.
|
||||
ExceptionHandler.process(e, Level.WARN);
|
||||
defaultValue = null;
|
||||
}
|
||||
|
||||
// Types with Document/Unknown elements, store as binary
|
||||
|
||||
@@ -614,7 +614,12 @@ public final class MetadataToolHelper {
|
||||
target.getListColumns().addAll(columnsTAdd);
|
||||
target.sortCustomColumns();
|
||||
target.setLabel(source.getLabel());
|
||||
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()) {
|
||||
|
||||
@@ -79,6 +79,11 @@ public class ArtifactRepositoryBean implements Cloneable {
|
||||
if (index > 0) {
|
||||
nexusUrl = url.substring(0, index + ARTIFACT_MIDDLE_PATH.length());
|
||||
repoId = StringUtilities.removeEndingString(url.substring(index + ARTIFACT_MIDDLE_PATH.length()), "/");
|
||||
} else {
|
||||
// can be non-default contextpath or root
|
||||
String tempurl = StringUtilities.removeEndingString(url, "/");
|
||||
repoId = tempurl.substring(tempurl.lastIndexOf("/") + 1);
|
||||
nexusUrl = url.substring(0, url.indexOf(repoId));
|
||||
}
|
||||
}
|
||||
return new String[] { nexusUrl, repoId };
|
||||
|
||||
@@ -44,7 +44,7 @@ public/* final */class BuildExportManager {
|
||||
return instance;
|
||||
}
|
||||
|
||||
IBuildExportDependenciesProvider[] getDependenciesProviders() {
|
||||
public IBuildExportDependenciesProvider[] getDependenciesProviders() {
|
||||
return reader.getDependenciesProviders();
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,9 @@ Require-Bundle: org.apache.commons.lang,
|
||||
org.eclipse.e4.ui.services,
|
||||
org.eclipse.ui.workbench,
|
||||
org.talend.themes.core,
|
||||
ca.odell.glazedlists
|
||||
ca.odell.glazedlists,
|
||||
org.talend.core,
|
||||
org.apache.commons.io
|
||||
Import-Package: org.eclipse.jdt.internal.ui.workingsets
|
||||
Export-Package: org.talend.core.ui,
|
||||
org.talend.core.ui.actions,
|
||||
|
||||
@@ -613,3 +613,10 @@ WorkspaceDlg.browse.folder.title=Select a workspace folder
|
||||
WorkspaceDlg.use.this.as.default.cb.message=&Use this workspace as the default and do not ask again
|
||||
PerspectiveMenuManager.dummy=Dummy
|
||||
PerspectiveMenuManager.perspectiveLabel=&Perspective
|
||||
I18nPreferencePage.needRestart=Local Language(need restart)
|
||||
I18nPreferencePage.translationInformation=Test translation with Babili (works only for current language,other language selection needs restart)
|
||||
I18nPreferencePage.importBabili=Import Translation from Babili
|
||||
I18nPreferencePage.restart=Restart
|
||||
I18nPreferencePage.restartButton=Need to restart to take effect.
|
||||
I18nPreferencePage.restoreDefault=Restore default
|
||||
I18nPreferencePage.wait_process=Process will hold on several minutes, please wait...
|
||||
@@ -142,6 +142,8 @@ public class ContextTreeTable {
|
||||
|
||||
private final static int fixedTypeWidth = 90;
|
||||
|
||||
private final static int fixedHidePromptWidth = 1;
|
||||
|
||||
public ContextTreeTable(IContextModelManager manager) {
|
||||
this.manager = manager;
|
||||
}
|
||||
@@ -320,7 +322,7 @@ public class ContextTreeTable {
|
||||
GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);
|
||||
|
||||
// add selection listener for the context NatTable
|
||||
addNatTableListener(bodyDataProvider, selectionProvider, bodyDataLayer);
|
||||
addNatTableListener(bodyDataProvider, selectionProvider);
|
||||
|
||||
GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);
|
||||
|
||||
@@ -371,7 +373,7 @@ public class ContextTreeTable {
|
||||
}
|
||||
|
||||
private void addNatTableListener(final GlazedListsDataProvider<ContextTreeNode> bodyDataProvider,
|
||||
ISelectionProvider selectionProvider, DataLayer bodyDataLayer) {
|
||||
ISelectionProvider selectionProvider) {
|
||||
this.natTable.addMouseListener(new MouseListener() {
|
||||
|
||||
@Override
|
||||
@@ -454,7 +456,8 @@ public class ContextTreeTable {
|
||||
} else {
|
||||
int typeColumnPos = dataLayer.getColumnPositionByIndex(1);
|
||||
|
||||
int leftWidth = maxWidth - fixedTypeWidth - fixedCheckBoxWidth * checkColumnsPos.size() - cornerWidth * 2;
|
||||
int leftWidth = maxWidth - fixedTypeWidth - fixedCheckBoxWidth * checkColumnsPos.size() - cornerWidth * 2
|
||||
- fixedHidePromptWidth;
|
||||
|
||||
int currentColumnsCount = dataColumnsCount - hideColumnsPos.size() - checkColumnsPos.size() - 1;
|
||||
int averageWidth = leftWidth / currentColumnsCount;
|
||||
@@ -469,7 +472,7 @@ public class ContextTreeTable {
|
||||
for (int hidePos : hideColumnsPos) {
|
||||
if (hidePos == i) {
|
||||
findHide = true;
|
||||
dataLayer.setColumnWidthByPosition(i, 0);
|
||||
dataLayer.setColumnWidthByPosition(i, fixedHidePromptWidth);
|
||||
}
|
||||
}
|
||||
for (int checkPos : checkColumnsPos) {
|
||||
|
||||
@@ -725,6 +725,8 @@ public class MetadataDialog extends Dialog {
|
||||
}
|
||||
|
||||
IDesignerCoreService designerCoreService = CoreUIPlugin.getDefault().getDesignerCoreService();
|
||||
updateTableOriginalColumns(outputTable);
|
||||
updateTableOriginalColumns(inputTable);
|
||||
designerCoreService.setTraceFilterParameters(outputNode, outputTable, preOutputColumnSet, changedNameColumnsForOutput);
|
||||
designerCoreService.setTraceFilterParameters(inputNode, inputTable, preInputColumnSet, changedNameColumnsForInput);
|
||||
if (outputTable != null && inputTable != null) {
|
||||
@@ -745,6 +747,16 @@ public class MetadataDialog extends Dialog {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateTableOriginalColumns(IMetadataTable table) {
|
||||
if (table != null && table.getListColumns() != null) {
|
||||
List<String> columnNames = new ArrayList<String>();
|
||||
for (IMetadataColumn column : table.getListColumns()) {
|
||||
columnNames.add(column.getLabel());
|
||||
}
|
||||
table.setOriginalColumns(columnNames);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC wzhang Comment method "getPreColumnsSet".
|
||||
|
||||
@@ -0,0 +1,652 @@
|
||||
package org.talend.core.ui.preference;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.URL;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.log4j.Level;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.adaptor.EclipseStarter;
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
|
||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||
import org.eclipse.jface.preference.FieldEditor;
|
||||
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.events.SelectionListener;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.FileDialog;
|
||||
import org.eclipse.ui.IWorkbench;
|
||||
import org.eclipse.ui.IWorkbenchPreferencePage;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.commons.ui.runtime.utils.ZipFileUtils;
|
||||
import org.talend.commons.ui.swt.advanced.dataeditor.LabelFieldEditor;
|
||||
import org.talend.commons.ui.utils.workbench.preferences.OneLineComboFieldEditor;
|
||||
import org.talend.commons.utils.VersionUtils;
|
||||
import org.talend.core.CorePlugin;
|
||||
import org.talend.core.model.genhtml.FileCopyUtils;
|
||||
import org.talend.core.prefs.ITalendCorePrefConstants;
|
||||
import org.talend.core.ui.i18n.Messages;
|
||||
|
||||
public abstract class I18nPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
|
||||
|
||||
private OneLineComboFieldEditor languageSelectionEditor;
|
||||
|
||||
private String fs = System.getProperties().getProperty("file.separator"); //$NON-NLS-1$
|
||||
|
||||
private List<FieldEditor> fields = new ArrayList<FieldEditor>();
|
||||
|
||||
private static Logger log = Logger.getLogger(I18nPreferencePage.class);
|
||||
|
||||
private static final Pattern VERSION_PATTERN = Pattern.compile("(\\d+)\\.(\\d+)\\.(\\d+)(\\.(RC|M)\\d+)?_r\\d+"); //$NON-NLS-1$
|
||||
|
||||
private static final Pattern DEFAULT_PATTERN = Pattern.compile("(\\d+)\\.(\\d+)\\.*(\\d*)"); //$NON-NLS-1$
|
||||
|
||||
private boolean updateCompleted;
|
||||
|
||||
private boolean isBabiliButtonClicked = false;
|
||||
|
||||
/**
|
||||
* Construct a new I18nPreferencePage.
|
||||
*/
|
||||
public I18nPreferencePage() {
|
||||
super(GRID);
|
||||
|
||||
// Set the preference store for the preference page.
|
||||
IPreferenceStore store = CorePlugin.getDefault().getPreferenceStore();
|
||||
setPreferenceStore(store);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(IWorkbench workbench) {
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
|
||||
*/
|
||||
@Override
|
||||
protected void createFieldEditors() {
|
||||
// Adds a combo for language selection.
|
||||
|
||||
String spanish = "Espa\u00F1ol"; //$NON-NLS-1$
|
||||
byte[] utf8Bytes;
|
||||
try {
|
||||
utf8Bytes = spanish.getBytes("UTF8"); //$NON-NLS-1$
|
||||
spanish = new String(utf8Bytes, "UTF8"); //$NON-NLS-1$
|
||||
} catch (UnsupportedEncodingException e1) {
|
||||
// could be translated, but it's only in case of error when change UTF8 characters.
|
||||
spanish = "Spanish"; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
String russian = "\u0420\u0443\u0441\u0441\u043A\u0438\u0439"; //$NON-NLS-1$
|
||||
try {
|
||||
utf8Bytes = russian.getBytes("UTF8"); //$NON-NLS-1$
|
||||
russian = new String(utf8Bytes, "UTF8"); //$NON-NLS-1$
|
||||
} catch (UnsupportedEncodingException e1) {
|
||||
// could be translated, but it's only in case of error when change UTF8 characters.
|
||||
russian = "Russian"; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
String greek = "\u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac"; //$NON-NLS-1$
|
||||
try {
|
||||
utf8Bytes = greek.getBytes("UTF8"); //$NON-NLS-1$
|
||||
greek = new String(utf8Bytes, "UTF8"); //$NON-NLS-1$
|
||||
} catch (UnsupportedEncodingException e1) {
|
||||
// could be translated, but it's only in case of error when change UTF8 characters.
|
||||
greek = "Greek"; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
String arabic = "\u0627\u0644\u0639\u0631\u0628\u064a\u0647"; //$NON-NLS-1$
|
||||
try {
|
||||
utf8Bytes = arabic.getBytes("UTF8"); //$NON-NLS-1$
|
||||
arabic = new String(utf8Bytes, "UTF8"); //$NON-NLS-1$
|
||||
} catch (UnsupportedEncodingException e1) {
|
||||
// could be translated, but it's only in case of error when change UTF8 characters.
|
||||
arabic = "Arabic"; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
String serbian = "\u0421\u0440\u043f\u0441\u043a\u0438"; //$NON-NLS-1$
|
||||
try {
|
||||
utf8Bytes = serbian.getBytes("UTF8"); //$NON-NLS-1$
|
||||
serbian = new String(utf8Bytes, "UTF8"); //$NON-NLS-1$
|
||||
} catch (UnsupportedEncodingException e1) {
|
||||
// could be translated, but it's only in case of error when change UTF8 characters.
|
||||
serbian = "Serbian"; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
String[][] entryNamesAndValues =
|
||||
{ { Locale.ENGLISH.getDisplayLanguage(Locale.ENGLISH), Locale.ENGLISH.getLanguage() },
|
||||
{ Locale.FRENCH.getDisplayLanguage(Locale.FRENCH), Locale.FRENCH.getLanguage() },
|
||||
{ Locale.CHINESE.getDisplayLanguage(Locale.CHINESE), "zh_CN" },
|
||||
{ Locale.GERMAN.getDisplayLanguage(Locale.GERMAN), Locale.GERMAN.getLanguage() },
|
||||
{ Locale.JAPANESE.getDisplayLanguage(Locale.JAPANESE), Locale.JAPANESE.getLanguage() },
|
||||
{ Locale.ITALIAN.getDisplayLanguage(Locale.ITALIAN), Locale.ITALIAN.getLanguage() },
|
||||
{ "Brasil", "pt_BR" }, //$NON-NLS-1$ //$NON-NLS-2$
|
||||
{ spanish, "es" }, { russian, "ru" }, //$NON-NLS-1$ //$NON-NLS-2$
|
||||
{ Locale.KOREA.getDisplayLanguage(Locale.KOREA), "kr" }, { "Turkish", "tr" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
{ greek, "el" }, { "Hrvatski", "hr" }, { arabic, "ar" }, { serbian, "sr" }, { "Polski", "pl" },
|
||||
{ "Romanian", "ro" }, { "Netherlands", "nl" } }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
// // /$NON-NLS-7$
|
||||
languageSelectionEditor = new OneLineComboFieldEditor(ITalendCorePrefConstants.LANGUAGE_SELECTOR,
|
||||
Messages.getString("I18nPreferencePage.needRestart"), entryNamesAndValues, getFieldEditorParent()); //$NON-NLS-1$
|
||||
addField(languageSelectionEditor);
|
||||
|
||||
Composite composite = getFieldEditorParent();
|
||||
LabelFieldEditor importAll =
|
||||
new LabelFieldEditor(Messages.getString("I18nPreferencePage.translationInformation"), //$NON-NLS-1$
|
||||
composite);
|
||||
addField(importAll);
|
||||
|
||||
Button allUpdate = new Button(composite, SWT.FLAT);
|
||||
allUpdate.setText(Messages.getString("I18nPreferencePage.importBabili")); //$NON-NLS-1$
|
||||
allUpdate.setLayoutData(new GridData());
|
||||
|
||||
allUpdate.addSelectionListener(new SelectionListener() {
|
||||
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
// import all update from Babili
|
||||
// select the .zip file
|
||||
FileDialog fd =
|
||||
new FileDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.OPEN);
|
||||
fd.setText("Open"); //$NON-NLS-1$
|
||||
fd.setFilterPath("C:" + fs); //$NON-NLS-1$
|
||||
String[] filterExtensions = { "*.zip" }; //$NON-NLS-1$
|
||||
fd.setFilterExtensions(filterExtensions);
|
||||
String selected = fd.open();
|
||||
if (selected != null) {
|
||||
isBabiliButtonClicked = true;
|
||||
runProgressMonitorDialog(selected);
|
||||
if (MessageDialog
|
||||
.openConfirm(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
|
||||
Messages.getString("I18nPreferencePage.restart"), //$NON-NLS-1$
|
||||
Messages.getString("I18nPreferencePage.restartButton"))) {
|
||||
PlatformUI.getWorkbench().restart();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void widgetDefaultSelected(SelectionEvent e) {
|
||||
// Nothing to do
|
||||
}
|
||||
});
|
||||
|
||||
// added by nma
|
||||
Button restoredefault = new Button(composite, SWT.FLAT);
|
||||
restoredefault.setText("Restore Defaults"); //$NON-NLS-1$
|
||||
restoredefault.setLayoutData(new GridData());
|
||||
restoredefault.addSelectionListener(new SelectionListener() {
|
||||
|
||||
@Override
|
||||
public void widgetDefaultSelected(SelectionEvent e) {
|
||||
// Nothing to do
|
||||
}
|
||||
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
isBabiliButtonClicked = true;
|
||||
runProgressMonitorDialog(Messages.getString("I18nPreferencePage.restoreDefault")); //$NON-NLS-1$
|
||||
if (MessageDialog
|
||||
.openConfirm(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
|
||||
Messages.getString("I18nPreferencePage.restart"),
|
||||
Messages.getString("I18nPreferencePage.restartButton"))) {
|
||||
PlatformUI.getWorkbench().restart();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void applyBabiliResource(String zipFileName) {
|
||||
String jarFolderPath = System.getProperty("user.dir") + fs + "jarTemp"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
String zipFolderPath = System.getProperty("user.dir") + fs + "zipTemp"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
File jarFolderPathFile = new File(jarFolderPath);
|
||||
File zipFolderPathFile = new File(zipFolderPath);
|
||||
if (!jarFolderPathFile.exists()) {
|
||||
jarFolderPathFile.mkdir();
|
||||
}
|
||||
if (!zipFolderPathFile.exists()) {
|
||||
zipFolderPathFile.mkdir();
|
||||
}
|
||||
String pluginPath = System.getProperty("user.dir") + fs + "plugins"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
HashMap jarFileMap = new HashMap();
|
||||
File file = new File(pluginPath);
|
||||
if (file.isDirectory()) {
|
||||
String[] fileNameList = file.list();
|
||||
final int length = fileNameList.length;
|
||||
File[] fileList = file.listFiles();
|
||||
final int length2 = fileList.length;
|
||||
for (File f : fileList) {
|
||||
if (f.getName().startsWith("net.sourceforge.sqlexplorer.nl")) { //$NON-NLS-1$
|
||||
jarFileMap.put("net.sourceforge.sqlexplorer.nl", f); //$NON-NLS-1$
|
||||
}
|
||||
if (f.getName().startsWith("org.talend.designer.components.localprovider")) { //$NON-NLS-1$
|
||||
jarFileMap.put("org.talend.designer.components.localprovider", f); //$NON-NLS-1$
|
||||
}
|
||||
if (f.getName().startsWith("org.talend.designer.components.tdqprovider")) { //$NON-NLS-1$
|
||||
jarFileMap.put("org.talend.designer.components.tdqprovider", f); //$NON-NLS-1$
|
||||
}
|
||||
if (f.getName().startsWith("org.talend.designer.components.tisprovider")) { //$NON-NLS-1$
|
||||
jarFileMap.put("org.talend.designer.components.tisprovider", f); //$NON-NLS-1$
|
||||
}
|
||||
if (f.getName().startsWith("org.talend.designer.components.tispeprovider")) { //$NON-NLS-1$
|
||||
jarFileMap.put("org.talend.designer.components.tispeprovider", f); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
if (f.getName().endsWith(".jar") && f.getName().indexOf("nl") != -1 //$NON-NLS-1$ //$NON-NLS-2$
|
||||
&& f.getName().indexOf("talend") != -1) { //$NON-NLS-1$
|
||||
String[] fileNameArr = f.getName().split("_"); //$NON-NLS-1$
|
||||
jarFileMap.put(fileNameArr[0], f);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (zipFileName.equals("Restore default")) { //$NON-NLS-1$
|
||||
Iterator iter = jarFileMap.entrySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
Map.Entry entry = (Map.Entry) iter.next();
|
||||
Object key = entry.getKey();
|
||||
File currentFileToBak = (File) entry.getValue();
|
||||
if (key.toString().endsWith(".nl") //$NON-NLS-1$
|
||||
|| key.toString().startsWith("org.talend.designer.components.localprovider") //$NON-NLS-1$
|
||||
|| key.toString().startsWith("org.talend.designer.components.tdqprovider") //$NON-NLS-1$
|
||||
|| key.toString().startsWith("org.talend.designer.components.tisprovider") //$NON-NLS-1$
|
||||
|| key.toString().startsWith("org.talend.designer.components.tispeprovider") //$NON-NLS-1$
|
||||
|| key.toString().startsWith("net.sourceforge.sqlexplorer.nl")) { //$NON-NLS-1$
|
||||
if (currentFileToBak.toString().endsWith(".jar")) { //$NON-NLS-1$
|
||||
ZipFileUtils.unZip(currentFileToBak, jarFolderPath + fs + currentFileToBak.getName());
|
||||
} else {
|
||||
FileCopyUtils
|
||||
.copyFolder(currentFileToBak.getAbsolutePath(),
|
||||
jarFolderPath + fs + currentFileToBak.getName());
|
||||
}
|
||||
File jarFiles = new File(jarFolderPath + fs + currentFileToBak.getName());
|
||||
File[] jarSubFiles = jarFiles.listFiles();
|
||||
for (File subJarf : jarSubFiles) {
|
||||
if (subJarf.isFile()) {
|
||||
if (subJarf.getName().endsWith(".original")) { //$NON-NLS-1$
|
||||
String subjarfPath = subJarf
|
||||
.getAbsolutePath()
|
||||
.substring(0, subJarf.getAbsolutePath().indexOf(".original")); //$NON-NLS-1$
|
||||
File subjarfPathFile = new File(subjarfPath);
|
||||
if (subjarfPathFile.exists()) {
|
||||
subjarfPathFile.delete();
|
||||
}
|
||||
subJarf.renameTo(subjarfPathFile);
|
||||
}
|
||||
} else {
|
||||
if (subJarf.getName().equals("components")) { //$NON-NLS-1$
|
||||
File[] componentFiles = subJarf.listFiles();
|
||||
for (File componentFile : componentFiles) {
|
||||
if (componentFile.isDirectory()) {
|
||||
File[] comFiles = componentFile.listFiles();
|
||||
if (comFiles != null) {
|
||||
for (File com : comFiles) {
|
||||
if (com.isFile() && com.getName().endsWith(".original")) { //$NON-NLS-1$
|
||||
String comPath = com
|
||||
.getAbsolutePath()
|
||||
.substring(0, com.getAbsolutePath().indexOf(".original")); //$NON-NLS-1$
|
||||
File comPathFile = new File(comPath);
|
||||
if (comPathFile.exists()) {
|
||||
comPathFile.delete();
|
||||
}
|
||||
com.renameTo(comPathFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
String writeJarFileName = jarFolderPath + fs + currentFileToBak.getName();
|
||||
if (currentFileToBak.exists()) {
|
||||
if (currentFileToBak.isDirectory()) {
|
||||
try {
|
||||
org.apache.commons.io.FileUtils.deleteDirectory(currentFileToBak);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
currentFileToBak.delete();
|
||||
}
|
||||
}
|
||||
if (currentFileToBak.toString().endsWith(".jar")) { //$NON-NLS-1$
|
||||
ZipFileUtils.zip(writeJarFileName, currentFileToBak.getAbsolutePath(), false);
|
||||
} else {
|
||||
FileCopyUtils.copyFolder(writeJarFileName, currentFileToBak.getAbsolutePath());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ZipFileUtils.unZip(zipFileName, zipFolderPath);
|
||||
File zipFile = new File(zipFolderPath);
|
||||
File[] zipFiles = zipFile.listFiles()[0].listFiles();
|
||||
for (File f : zipFiles) {
|
||||
if (f.getName().endsWith(".nl") //$NON-NLS-1$
|
||||
|| f.getName().startsWith("org.talend.designer.components.localprovider") //$NON-NLS-1$
|
||||
|| f.getName().startsWith("org.talend.designer.components.tdqprovider") //$NON-NLS-1$
|
||||
|| f.getName().startsWith("org.talend.designer.components.tisprovider") //$NON-NLS-1$
|
||||
|| f.getName().startsWith("org.talend.designer.components.tispeprovider") //$NON-NLS-1$
|
||||
|| f.getName().startsWith("net.sourceforge.sqlexplorer.nl")) { //$NON-NLS-1$
|
||||
|
||||
File writeJarFile = (File) jarFileMap.get(f.getName());
|
||||
if (writeJarFile == null) {
|
||||
continue;
|
||||
}
|
||||
String jarFilePath = writeJarFile.getAbsolutePath();
|
||||
// for bug 13620
|
||||
if (writeJarFile.toString().endsWith(".jar")) {//$NON-NLS-1$
|
||||
ZipFileUtils.unZip(writeJarFile, jarFolderPath + fs + writeJarFile.getName());
|
||||
} else {
|
||||
FileCopyUtils.copyFolder(jarFilePath, jarFolderPath + fs + writeJarFile.getName());
|
||||
}
|
||||
File[] zipSubFiles = f.listFiles();
|
||||
File jarFiles = new File(jarFolderPath + fs + writeJarFile.getName());
|
||||
File[] jarSubFiles = jarFiles.listFiles();
|
||||
boolean flag = false;
|
||||
boolean componentFlag = false;
|
||||
for (File subJarf : jarSubFiles) {
|
||||
if (subJarf.isFile()) {
|
||||
if (subJarf.getName().endsWith(".original")) { //$NON-NLS-1$
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
|
||||
} // specific bug if .properties for components, since structure of babili resource is different
|
||||
// with local plugin
|
||||
else {
|
||||
if (subJarf.getName().equals("components")) { //$NON-NLS-1$
|
||||
File[] componentFiles = subJarf.listFiles();
|
||||
if (componentFiles != null) {
|
||||
for (File componentFile : componentFiles) {
|
||||
if (componentFile.isDirectory()) {
|
||||
File[] comFiles = componentFile.listFiles();
|
||||
if (comFiles != null) {
|
||||
for (File com : comFiles) {
|
||||
if (com.getName().endsWith(".original")) { //$NON-NLS-1$
|
||||
componentFlag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (File subf : zipSubFiles) {
|
||||
boolean subfNotExistBool = true;
|
||||
for (File subJarf : jarSubFiles) {
|
||||
if (subJarf.isDirectory() && subJarf.getName().equals("components")) { //$NON-NLS-1$
|
||||
if (subf.getName().startsWith("t") && subf.getName().endsWith(".properties")) { //$NON-NLS-1$ //$NON-NLS-2$
|
||||
File[] componentFiles = subJarf.listFiles();
|
||||
for (File componentFile : componentFiles) {
|
||||
if (componentFile
|
||||
.getName()
|
||||
.equals(subf.getName().substring(0, subf.getName().indexOf("_")))) { //$NON-NLS-1$
|
||||
File[] comFiles = componentFile.listFiles();
|
||||
if (comFiles != null) {
|
||||
for (File com : comFiles) {
|
||||
if (subf.getName().equals(com.getName())) {
|
||||
transferFile(subf, com, componentFlag);
|
||||
subfNotExistBool = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (subf.getName().equals(subJarf.getName())) {
|
||||
transferFile(subf, subJarf, flag);
|
||||
subfNotExistBool = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
String writeJarFileName = jarFolderPath + fs + writeJarFile.getName();
|
||||
writeJarFile.delete();
|
||||
if (writeJarFileName.endsWith(".jar")) {//$NON-NLS-1$
|
||||
ZipFileUtils.zip(writeJarFileName, jarFilePath, false);
|
||||
} else {
|
||||
FileCopyUtils.copyFolder(writeJarFileName, jarFilePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
updateCompleted = true;
|
||||
try {
|
||||
if (zipFolderPathFile.exists()) {
|
||||
org.apache.commons.io.FileUtils.deleteDirectory(zipFolderPathFile);
|
||||
}
|
||||
if (jarFolderPathFile.exists()) {
|
||||
org.apache.commons.io.FileUtils.deleteDirectory(jarFolderPathFile);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void transferFile(File sourceFile, File targetFile, boolean changed) {
|
||||
String targetPath = targetFile.getAbsolutePath();
|
||||
File newTargetFile = new File(targetPath + ".original"); //$NON-NLS-1$
|
||||
if (!newTargetFile.exists() && changed == false) {
|
||||
targetFile.renameTo(newTargetFile);
|
||||
}
|
||||
transferStream(sourceFile, targetFile);
|
||||
}
|
||||
|
||||
private void transferStream(File sourceFile, File targetFile) {
|
||||
if (!sourceFile.exists()) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
FileChannel sourceChannel = new FileInputStream(sourceFile.getAbsoluteFile()).getChannel();
|
||||
FileChannel targetChannel = new FileOutputStream(targetFile.getAbsoluteFile()).getChannel();
|
||||
targetChannel.transferFrom(sourceChannel, 0, sourceChannel.size());
|
||||
sourceChannel.close();
|
||||
targetChannel.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* DOC wzhang Comment method "runProgressMonitorDialog".
|
||||
*
|
||||
* @param validated
|
||||
*/
|
||||
public void runProgressMonitorDialog(final String zipFileName) {
|
||||
updateCompleted = false;
|
||||
ProgressMonitorDialog progressDialog = new ProgressMonitorDialog(getFieldEditorParent().getShell());
|
||||
IRunnableWithProgress runnable = new IRunnableWithProgress() {
|
||||
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) {
|
||||
try {
|
||||
monitor.beginTask(Messages.getString("I18nPreferencePage.wait_process"), IProgressMonitor.UNKNOWN); //$NON-NLS-1$
|
||||
applyBabiliResource(zipFileName);
|
||||
} catch (Exception e1) {
|
||||
ExceptionHandler.process(e1);
|
||||
} finally {
|
||||
monitor.done();
|
||||
}
|
||||
}
|
||||
};
|
||||
try {
|
||||
progressDialog.run(true, true, runnable);
|
||||
} catch (InvocationTargetException e1) {
|
||||
ExceptionHandler.process(e1);
|
||||
} catch (InterruptedException e1) {
|
||||
ExceptionHandler.process(e1);
|
||||
}
|
||||
|
||||
if (updateCompleted) {
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#performOk()
|
||||
*/
|
||||
@Override
|
||||
public boolean performOk() {
|
||||
boolean ok = super.performOk();
|
||||
saveLanguageType();
|
||||
CorePlugin.getDefault().savePluginPreferences();
|
||||
if (isBabiliButtonClicked) {
|
||||
refreshAll();
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
abstract protected void refreshAll();
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.preference.PreferencePage#performApply()
|
||||
*/
|
||||
@Override
|
||||
protected void performApply() {
|
||||
saveLanguageType();
|
||||
CorePlugin.getDefault().savePluginPreferences();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* DOC wzhang Comment method "saveLanguageType".
|
||||
*/
|
||||
private void saveLanguageType() {
|
||||
FileInputStream fin = null;
|
||||
FileOutputStream fout = null;
|
||||
try {
|
||||
URL url = Platform.getConfigurationLocation().getURL();
|
||||
log(url.getFile());
|
||||
Properties p = new Properties();
|
||||
// load the file configuration/config.ini
|
||||
File iniFile = new File(url.getFile(), "config.ini"); //$NON-NLS-1$
|
||||
fin = new FileInputStream(iniFile);
|
||||
p.load(fin);
|
||||
|
||||
String languageType = CorePlugin
|
||||
.getDefault()
|
||||
.getPluginPreferences()
|
||||
.getString(ITalendCorePrefConstants.LANGUAGE_SELECTOR);
|
||||
|
||||
if (languageType.equals(p.getProperty(EclipseStarter.PROP_NL))) {
|
||||
return;
|
||||
}
|
||||
|
||||
p.setProperty(EclipseStarter.PROP_NL, languageType);
|
||||
fout = new FileOutputStream(iniFile);
|
||||
p.store(fout, "#Configuration File"); //$NON-NLS-1$
|
||||
fout.flush();
|
||||
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
} finally {
|
||||
if (fin != null) {
|
||||
try {
|
||||
fin.close();
|
||||
} catch (Exception e) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
}
|
||||
if (fout != null) {
|
||||
try {
|
||||
fout.close();
|
||||
} catch (Exception e) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* DOC wzhang Comment method "getCurrentTosVersion".
|
||||
*
|
||||
* @param normalize
|
||||
* @return
|
||||
*/
|
||||
public static String getCurrentTosVersion(boolean normalize) {
|
||||
String version = VersionUtils.getVersion();
|
||||
if (normalize) {
|
||||
version = normalizeVersion(version);
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* DOC wzhang Comment method "normalizeVersion".
|
||||
*
|
||||
* @param version
|
||||
* @return
|
||||
*/
|
||||
public static String normalizeVersion(String version) {
|
||||
Matcher matcher = VERSION_PATTERN.matcher(version);
|
||||
if (matcher.matches()) {
|
||||
String str = version.substring(0, version.indexOf("_r")); //$NON-NLS-1$
|
||||
return str.replaceAll("\\.RC", "RC").replaceAll("\\.M", "M"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
} else {
|
||||
// try again, ignore M, RC
|
||||
matcher = DEFAULT_PATTERN.matcher(version);
|
||||
matcher.find();
|
||||
return matcher.group();
|
||||
}
|
||||
}
|
||||
|
||||
private void log(String s) {
|
||||
log.log(Level.INFO, s);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#addField(org.eclipse.jface.preference.FieldEditor)
|
||||
*/
|
||||
@Override
|
||||
protected void addField(FieldEditor editor) {
|
||||
super.addField(editor);
|
||||
fields.add(editor);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -167,6 +167,8 @@ public class ProcessorUtilities {
|
||||
|
||||
private static boolean isDebug = false;
|
||||
|
||||
private static JobInfo mainJobInfo;
|
||||
|
||||
public static void addOpenEditor(IEditorPart editor) {
|
||||
openedEditors.add(editor);
|
||||
}
|
||||
@@ -435,6 +437,7 @@ public class ProcessorUtilities {
|
||||
|
||||
isMainJob = true;
|
||||
codeModified = false;
|
||||
mainJobInfo = jobInfo;
|
||||
|
||||
// this cache only keep the last main job's generation, so clear it since we regenerate a new job.
|
||||
LastGenerationInfo.getInstance().getLastGeneratedjobs().clear();
|
||||
@@ -960,6 +963,7 @@ public class ProcessorUtilities {
|
||||
if (jobInfo.getFatherJobInfo() == null) {
|
||||
isMainJob = true;
|
||||
codeModified = false;
|
||||
mainJobInfo = jobInfo;
|
||||
|
||||
// this cache only keep the last main job's generation, so clear it since we regenerate a new job.
|
||||
LastGenerationInfo.getInstance().getLastGeneratedjobs().clear();
|
||||
@@ -1627,10 +1631,12 @@ public class ProcessorUtilities {
|
||||
jobList.clear();
|
||||
esbJobs.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
JobInfo jobInfo = new JobInfo(processName, contextName, version);
|
||||
IProcessor process = generateCode(jobInfo, contextName, statistics, trace, true, GENERATE_ALL_CHILDS, monitor);
|
||||
jobList.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
return process;
|
||||
}
|
||||
|
||||
@@ -1653,9 +1659,11 @@ public class ProcessorUtilities {
|
||||
jobList.clear();
|
||||
esbJobs.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
IProcessor process = generateCode(jobInfo, contextName, statistics, trace, true, GENERATE_ALL_CHILDS, monitor);
|
||||
jobList.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
return process;
|
||||
}
|
||||
|
||||
@@ -1673,9 +1681,11 @@ public class ProcessorUtilities {
|
||||
jobList.clear();
|
||||
esbJobs.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
IProcessor result = generateCode(jobInfo, contextName, statistics, trace, true, GENERATE_ALL_CHILDS, monitor);
|
||||
jobList.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1693,10 +1703,12 @@ public class ProcessorUtilities {
|
||||
jobList.clear();
|
||||
esbJobs.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
IProcessor result =
|
||||
generateCode(jobInfo, contextName, statistics, trace, needContext, GENERATE_ALL_CHILDS, monitor);
|
||||
jobList.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1723,9 +1735,11 @@ public class ProcessorUtilities {
|
||||
jobList.clear();
|
||||
esbJobs.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
IProcessor result = generateCode(jobInfo, contextName, statistics, trace, needContext, option, monitor);
|
||||
jobList.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1746,9 +1760,11 @@ public class ProcessorUtilities {
|
||||
jobList.clear();
|
||||
esbJobs.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
result = generateCode(jobInfo, contextName, statistics, trace, true, GENERATE_ALL_CHILDS, monitor);
|
||||
jobList.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -1758,9 +1774,11 @@ public class ProcessorUtilities {
|
||||
jobList.clear();
|
||||
esbJobs.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
IProcessor returnValue = generateCode(process, contextName, statistics, trace, false);
|
||||
jobList.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
@@ -1792,10 +1810,12 @@ public class ProcessorUtilities {
|
||||
jobList.clear();
|
||||
esbJobs.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
IProcessor genCode = generateCode(jobInfo, context.getName(), statistics, trace, contextProperties,
|
||||
GENERATE_ALL_CHILDS, new NullProgressMonitor());
|
||||
jobList.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
return genCode;
|
||||
}
|
||||
|
||||
@@ -1804,10 +1824,12 @@ public class ProcessorUtilities {
|
||||
jobList.clear();
|
||||
esbJobs.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
IProcessor returnValue =
|
||||
generateCode(process, context, statistics, trace, properties, new NullProgressMonitor());
|
||||
jobList.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
@@ -1839,10 +1861,12 @@ public class ProcessorUtilities {
|
||||
jobList.clear();
|
||||
esbJobs.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
IProcessor genCode = generateCode(jobInfo, context.getName(), statistics, trace, properties,
|
||||
GENERATE_ALL_CHILDS, progressMonitor);
|
||||
jobList.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
return genCode;
|
||||
}
|
||||
|
||||
@@ -1888,10 +1912,12 @@ public class ProcessorUtilities {
|
||||
jobList.clear();
|
||||
esbJobs.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
IProcessor genCode = generateCode(processor, jobInfo, context.getName(), statistics, trace, properties,
|
||||
GENERATE_ALL_CHILDS, progressMonitor);
|
||||
jobList.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
|
||||
TimeMeasure.end(timeMeasureGenerateCodesId);
|
||||
// if active before, not disable and active still.
|
||||
@@ -1918,10 +1944,12 @@ public class ProcessorUtilities {
|
||||
jobList.clear();
|
||||
esbJobs.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
IProcessor genCode = generateCode(jobInfo, context.getName(), statistics, trace, properties, option,
|
||||
new NullProgressMonitor());
|
||||
jobList.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
return genCode;
|
||||
}
|
||||
|
||||
@@ -2468,6 +2496,15 @@ public class ProcessorUtilities {
|
||||
return hasLoopDependency;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for mainJobInfo. <font color="red">Need to check null</font>
|
||||
*
|
||||
* @return the mainJobInfo
|
||||
*/
|
||||
public static JobInfo getMainJobInfo() {
|
||||
return mainJobInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* The dynamic loading of the hadoop configuration library is supported in DI, MapReduce and Spark (batch and
|
||||
* streaming).
|
||||
|
||||
@@ -64,12 +64,6 @@
|
||||
<version>${project.version}</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.talend.studio</groupId>
|
||||
<artifactId>spring-boot-maven-plugin-1-5-9-RELEASE-tos</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.talend.studio</groupId>
|
||||
<artifactId>studio-maven-repository-zip</artifactId>
|
||||
|
||||
@@ -1,115 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.talend.studio</groupId>
|
||||
<artifactId>studio-maven-repository-tos</artifactId>
|
||||
<version>7.2.1-SNAPSHOT</version>
|
||||
<relativePath>../../../</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-boot-maven-plugin-1-5-9-RELEASE-tos</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<properties>
|
||||
<!-- Dependency versions -->
|
||||
<features-maven-plugin.version>2.2.9</features-maven-plugin.version>
|
||||
<maven-install-plugin.version>2.5.1</maven-install-plugin.version>
|
||||
<plexus-utils.version>2.1</plexus-utils.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
|
||||
<!-- Required by MS packaging for Jobs -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>1.5.9.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson</groupId>
|
||||
<artifactId>jackson-bom</artifactId>
|
||||
<version>2.8.10</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-framework-bom</artifactId>
|
||||
<version>4.3.13.RELEASE </version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-releasetrain</artifactId>
|
||||
<version>Ingalls-SR9</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-bom</artifactId>
|
||||
<version>4.3.12.RELEASE</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<version>1.5.9.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
<version>1.5.9.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-1.2-api</artifactId>
|
||||
<version>2.7</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-log4j2</artifactId>
|
||||
<version>1.5.9.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Required for MS packaging for Routes -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.camel</groupId>
|
||||
<artifactId>camel-spring-boot</artifactId>
|
||||
<version>2.20.1</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,7 +14,6 @@
|
||||
<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/spring-boot-maven-plugin-1-5-9-RELEASE</module>
|
||||
</modules>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@@ -52,6 +52,13 @@
|
||||
<artifactId>jackson-dataformat-cbor</artifactId>
|
||||
<version>2.9.5</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>
|
||||
<!-- 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 -->
|
||||
@@ -154,10 +161,11 @@
|
||||
</dependency>
|
||||
<!-- Dependencies in provided scope should be explicitly added as dependency in this module,
|
||||
because provided scope is not transitive -->
|
||||
<dependency>
|
||||
<groupId>biz.aQute.bnd</groupId>
|
||||
<artifactId>annotation</artifactId>
|
||||
<version>2.4.0</version>
|
||||
<dependency>
|
||||
<groupId>org.osgi</groupId>
|
||||
<artifactId>org.osgi.service.component.annotations</artifactId>
|
||||
<version>1.3.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.sisu</groupId>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<properties>
|
||||
<tcomp.version>1.1.4</tcomp.version>
|
||||
<tcomp.version>1.1.9-SNAPSHOT</tcomp.version>
|
||||
<slf4j.version>1.7.25</slf4j.version>
|
||||
</properties>
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@ import org.talend.designer.maven.template.ETalendMavenVariables;
|
||||
import org.talend.designer.maven.template.MavenTemplateManager;
|
||||
import org.talend.designer.maven.utils.PomIdsHelper;
|
||||
import org.talend.designer.maven.utils.PomUtil;
|
||||
import org.talend.designer.maven.utils.SortableDependency;
|
||||
import org.talend.designer.runprocess.IProcessor;
|
||||
import org.talend.designer.runprocess.IRunProcessService;
|
||||
import org.talend.repository.ProjectManager;
|
||||
@@ -650,7 +651,7 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
|
||||
}
|
||||
|
||||
protected void updateDependencySet(IFile assemblyFile) {
|
||||
Set<String> jobCoordinate = new HashSet<>();
|
||||
Map<String, Dependency> jobCoordinateMap = new HashMap<String, Dependency>();
|
||||
Set<JobInfo> childrenJobInfo = new HashSet<>();
|
||||
if (!hasLoopDependency()) {
|
||||
childrenJobInfo = getJobProcessor().getBuildChildrenJobs();
|
||||
@@ -662,7 +663,9 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
|
||||
String coordinate =
|
||||
getCoordinate(PomIdsHelper.getJobGroupId(property), PomIdsHelper.getJobArtifactId(jobInfo),
|
||||
MavenConstants.PACKAGING_JAR, PomIdsHelper.getJobVersion(property));
|
||||
jobCoordinate.add(coordinate);
|
||||
Dependency dependency = getDependencyObject(PomIdsHelper.getJobGroupId(property), PomIdsHelper.getJobArtifactId(jobInfo), PomIdsHelper.getJobVersion(property),
|
||||
MavenConstants.PACKAGING_JAR, null);
|
||||
jobCoordinateMap.put(coordinate, dependency);
|
||||
}
|
||||
|
||||
// add parent job
|
||||
@@ -670,10 +673,12 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
|
||||
String parentCoordinate =
|
||||
getCoordinate(PomIdsHelper.getJobGroupId(parentProperty), PomIdsHelper.getJobArtifactId(parentProperty),
|
||||
MavenConstants.PACKAGING_JAR, PomIdsHelper.getJobVersion(parentProperty));
|
||||
jobCoordinate.add(parentCoordinate);
|
||||
Dependency parentDependency = getDependencyObject(PomIdsHelper.getJobGroupId(parentProperty), PomIdsHelper.getJobArtifactId(parentProperty), PomIdsHelper.getJobVersion(parentProperty),
|
||||
MavenConstants.PACKAGING_JAR, null);
|
||||
jobCoordinateMap.put(parentCoordinate, parentDependency);
|
||||
|
||||
// add talend libraries and codes
|
||||
Set<String> talendLibCoordinate = new HashSet<>();
|
||||
Map<String, Dependency> talendLibCoordinateMap = new HashMap<String, Dependency>();
|
||||
String projectTechName = ProjectManager.getInstance().getProject(parentProperty).getTechnicalLabel();
|
||||
String projectGroupId = PomIdsHelper.getProjectGroupId(projectTechName);
|
||||
|
||||
@@ -681,7 +686,7 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
|
||||
List<Dependency> dependencies = new ArrayList<>();
|
||||
addCodesDependencies(dependencies);
|
||||
for (Dependency dependency : dependencies) {
|
||||
talendLibCoordinate.add(getCoordinate(dependency));
|
||||
talendLibCoordinateMap.put(getCoordinate(dependency), dependency);
|
||||
}
|
||||
|
||||
// libraries
|
||||
@@ -700,23 +705,23 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
|
||||
}
|
||||
String dependencyGroupId = dependency.getGroupId();
|
||||
String coordinate = getCoordinate(dependency);
|
||||
if (!jobCoordinate.contains(coordinate)) {
|
||||
if (!jobCoordinateMap.containsKey(coordinate)) {
|
||||
if (MavenConstants.DEFAULT_LIB_GROUP_ID.equals(dependencyGroupId)) {
|
||||
talendLibCoordinate.add(coordinate);
|
||||
talendLibCoordinateMap.put(coordinate, dependency);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add 3rd party libraries
|
||||
Set<String> _3rdDepLib = new HashSet<>();
|
||||
Map<String, Dependency> _3rdDepLibMap = new HashMap<String, Dependency>();
|
||||
Map<String, Set<Dependency>> duplicateLibs = new HashMap<>();
|
||||
for (Dependency dependency : dependencies) {
|
||||
if (MavenConstants.PACKAGING_POM.equals(dependency.getType())) {
|
||||
continue;
|
||||
}
|
||||
String coordinate = getCoordinate(dependency);
|
||||
if (!jobCoordinate.contains(coordinate) && !talendLibCoordinate.contains(coordinate)) {
|
||||
_3rdDepLib.add(coordinate);
|
||||
if (!jobCoordinateMap.containsKey(coordinate) && !talendLibCoordinateMap.containsKey(coordinate)) {
|
||||
_3rdDepLibMap.put(coordinate, dependency);
|
||||
addToDuplicateLibs(duplicateLibs, dependency);
|
||||
}
|
||||
}
|
||||
@@ -736,13 +741,14 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
|
||||
MavenArtifact artifact = MavenUrlHelper.parseMvnUrl(moduleNeeded.getMavenUri());
|
||||
String coordinate = getCoordinate(artifact.getGroupId(), artifact.getArtifactId(), artifact.getType(),
|
||||
artifact.getVersion());
|
||||
if (!jobCoordinate.contains(coordinate) && !talendLibCoordinate.contains(coordinate)
|
||||
&& !_3rdDepLib.contains(coordinate)) {
|
||||
if (!jobCoordinateMap.containsKey(coordinate) && !talendLibCoordinateMap.containsKey(coordinate)
|
||||
&& !_3rdDepLibMap.containsKey(coordinate)) {
|
||||
Dependency dependencyObject = getDependencyObject(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(), artifact.getClassifier());
|
||||
if (MavenConstants.DEFAULT_LIB_GROUP_ID.equals(artifact.getGroupId())
|
||||
|| artifact.getGroupId().startsWith(projectGroupId)) {
|
||||
talendLibCoordinate.add(coordinate);
|
||||
talendLibCoordinateMap.put(coordinate, dependencyObject);
|
||||
} else {
|
||||
_3rdDepLib.add(coordinate);
|
||||
_3rdDepLibMap.put(coordinate, dependencyObject);
|
||||
Dependency dependency = PomUtil
|
||||
.createDependency(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(),
|
||||
artifact.getType(), artifact.getClassifier());
|
||||
@@ -761,7 +767,7 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
|
||||
} else {
|
||||
// remove duplicated dependencies from 3rd lib list
|
||||
for (Dependency dependency : dupDependencies) {
|
||||
_3rdDepLib.remove(getCoordinate(dependency));
|
||||
_3rdDepLibMap.remove(getCoordinate(dependency));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -769,12 +775,12 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
|
||||
try {
|
||||
Document document = PomUtil.loadAssemblyFile(null, assemblyFile);
|
||||
// add talend libs & codes
|
||||
setupDependencySetNode(document, talendLibCoordinate, "lib", "${artifact.artifactId}.${artifact.extension}",
|
||||
setupDependencySetNode(document, talendLibCoordinateMap, "lib", "${artifact.artifactId}.${artifact.extension}",
|
||||
false);
|
||||
// add 3rd party libs <dependencySet>
|
||||
setupDependencySetNode(document, _3rdDepLib, "lib", null, false);
|
||||
setupDependencySetNode(document, _3rdDepLibMap, "lib", null, false);
|
||||
// add jobs
|
||||
setupDependencySetNode(document, jobCoordinate, "${talend.job.name}",
|
||||
setupDependencySetNode(document, jobCoordinateMap, "${talend.job.name}",
|
||||
"${artifact.build.finalName}.${artifact.extension}", true);
|
||||
// add duplicate dependencies if exists
|
||||
setupFileNode(document, duplicateLibs);
|
||||
@@ -797,11 +803,41 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
|
||||
if (type != null) {
|
||||
coordinate += type;
|
||||
}
|
||||
|
||||
if (version != null) {
|
||||
coordinate += separator + version;
|
||||
}
|
||||
|
||||
return coordinate;
|
||||
}
|
||||
|
||||
protected String getAssemblyCoordinate(Dependency dependency) {
|
||||
String separator = ":"; //$NON-NLS-1$
|
||||
String coordinate = dependency.getGroupId() + separator;
|
||||
coordinate += dependency.getArtifactId() + separator;
|
||||
if (dependency.getType() != null) {
|
||||
coordinate += dependency.getType();
|
||||
}
|
||||
if (dependency.getClassifier() != null) {
|
||||
coordinate += separator + "*";
|
||||
}
|
||||
if (dependency.getVersion() != null) {
|
||||
coordinate += separator + dependency.getVersion();
|
||||
}
|
||||
|
||||
return coordinate;
|
||||
}
|
||||
|
||||
protected Dependency getDependencyObject(String groupId, String artifactId, String version, String type, String classifier) {
|
||||
Dependency object = new SortableDependency();
|
||||
object.setGroupId(groupId);
|
||||
object.setArtifactId(artifactId);
|
||||
object.setVersion(version);
|
||||
object.setType(type);
|
||||
object.setClassifier(classifier);
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
private void addToDuplicateLibs(Map<String, Set<Dependency>> map, Dependency dependency) {
|
||||
String coordinate =
|
||||
@@ -813,7 +849,7 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
|
||||
map.get(coordinate).add(dependency);
|
||||
}
|
||||
|
||||
protected void setupDependencySetNode(Document document, Set<String> libIncludes, String outputDir,
|
||||
protected void setupDependencySetNode(Document document, Map<String, Dependency> libIncludes, String outputDir,
|
||||
String fileNameMapping, boolean useProjectArtifact) {
|
||||
if (libIncludes.isEmpty()) {
|
||||
return;
|
||||
@@ -832,9 +868,9 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
|
||||
Node includesNode = document.createElement("includes");
|
||||
dependencySetNode.appendChild(includesNode);
|
||||
|
||||
for (String include : libIncludes) {
|
||||
for (Dependency dependency : libIncludes.values()) {
|
||||
Node includeNode = document.createElement("include");
|
||||
includeNode.setTextContent(include);
|
||||
includeNode.setTextContent(getAssemblyCoordinate(dependency));
|
||||
includesNode.appendChild(includeNode);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,12 +18,12 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.maven.model.Build;
|
||||
import org.apache.maven.model.Dependency;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.Plugin;
|
||||
import org.apache.maven.model.PluginExecution;
|
||||
@@ -203,7 +203,7 @@ public class CreateMavenStandardJobOSGiPom extends CreateMavenJobPom {
|
||||
|
||||
@Override
|
||||
protected void updateDependencySet(IFile assemblyFile) {
|
||||
Set<String> jobCoordinate = new HashSet<>();
|
||||
Map<String, Dependency> jobCoordinateMap = new HashMap<String, Dependency>();
|
||||
if (!hasLoopDependency()) {
|
||||
// add children jobs
|
||||
Set<JobInfo> childrenJobInfo = getJobProcessor().getBuildChildrenJobs();
|
||||
@@ -211,7 +211,9 @@ public class CreateMavenStandardJobOSGiPom extends CreateMavenJobPom {
|
||||
Property property = jobInfo.getProcessItem().getProperty();
|
||||
String coordinate = getCoordinate(PomIdsHelper.getJobGroupId(property), PomIdsHelper.getJobArtifactId(jobInfo),
|
||||
MavenConstants.PACKAGING_JAR, PomIdsHelper.getJobVersion(property));
|
||||
jobCoordinate.add(coordinate);
|
||||
Dependency dependency = getDependencyObject(PomIdsHelper.getJobGroupId(property), PomIdsHelper.getJobArtifactId(jobInfo), PomIdsHelper.getJobVersion(property),
|
||||
MavenConstants.PACKAGING_JAR, null);
|
||||
jobCoordinateMap.put(coordinate, dependency);
|
||||
}
|
||||
}
|
||||
// add parent job
|
||||
@@ -219,11 +221,13 @@ public class CreateMavenStandardJobOSGiPom extends CreateMavenJobPom {
|
||||
String parentCoordinate = getCoordinate(PomIdsHelper.getJobGroupId(parentProperty),
|
||||
PomIdsHelper.getJobArtifactId(parentProperty), MavenConstants.PACKAGING_JAR,
|
||||
PomIdsHelper.getJobVersion(parentProperty));
|
||||
jobCoordinate.add(parentCoordinate);
|
||||
Dependency parentDependency = getDependencyObject(PomIdsHelper.getJobGroupId(parentProperty), PomIdsHelper.getJobArtifactId(parentProperty), PomIdsHelper.getJobVersion(parentProperty),
|
||||
MavenConstants.PACKAGING_JAR, null);
|
||||
jobCoordinateMap.put(parentCoordinate, parentDependency);
|
||||
try {
|
||||
Document document = PomUtil.loadAssemblyFile(null, assemblyFile);
|
||||
// add jobs
|
||||
setupDependencySetNode(document, jobCoordinate, "${talend.job.name}",
|
||||
setupDependencySetNode(document, jobCoordinateMap, "${talend.job.name}",
|
||||
"${artifact.build.finalName}.${artifact.extension}", true);
|
||||
PomUtil.saveAssemblyFile(assemblyFile, document);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -2,7 +2,5 @@
|
||||
<classpath>
|
||||
<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/terajdbc4-15.10.00.14.jar" sourcepath="org.talend.libraries.jdbc.teradatasrc.zip"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/tdgssconfig-15.10.00.14.jar" sourcepath="org.talend.libraries.jdbc.teradatasrc.zip"/>
|
||||
<classpathentry kind="output" path="class"/>
|
||||
</classpath>
|
||||
|
||||
@@ -4,32 +4,5 @@ Bundle-Name: Teradata Plug-in
|
||||
Bundle-SymbolicName: org.talend.libraries.jdbc.teradata;singleton:=true
|
||||
Bundle-Version: 7.2.1.qualifier
|
||||
Bundle-Vendor: .Talend SA.
|
||||
Bundle-ClassPath: lib/terajdbc4-15.10.00.14.jar,
|
||||
lib/tdgssconfig-15.10.00.14.jar,
|
||||
.
|
||||
Export-Package: com.ncr.teradata,
|
||||
com.teradata.jdbc,
|
||||
com.teradata.jdbc.jdbc,
|
||||
com.teradata.jdbc.jdbc.console,
|
||||
com.teradata.jdbc.jdbc.fastexport,
|
||||
com.teradata.jdbc.jdbc.fastload,
|
||||
com.teradata.jdbc.jdbc.monitor,
|
||||
com.teradata.jdbc.jdbc.raw,
|
||||
com.teradata.jdbc.jdbc_3.dbmetadata,
|
||||
com.teradata.jdbc.jdbc_4,
|
||||
com.teradata.jdbc.jdbc_4.ifsupport,
|
||||
com.teradata.jdbc.jdbc_4.io,
|
||||
com.teradata.jdbc.jdbc_4.logging,
|
||||
com.teradata.jdbc.jdbc_4.parcel,
|
||||
com.teradata.jdbc.jdbc_4.statemachine,
|
||||
com.teradata.jdbc.jdbc_4.util,
|
||||
com.teradata.jdbc.resource,
|
||||
com.teradata.tdgss.jalgapi,
|
||||
com.teradata.tdgss.jgssp2gss,
|
||||
com.teradata.tdgss.jgssp2ldap,
|
||||
com.teradata.tdgss.jgssp2td1,
|
||||
com.teradata.tdgss.jgssp2td2,
|
||||
com.teradata.tdgss.jgssspi,
|
||||
com.teradata.tdgss.jtdgss
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Eclipse-BundleShape: dir
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
output.. = class/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
plugin.xml
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -6,14 +6,14 @@
|
||||
context="plugin:org.talend.libraries.jdbc.teradata"
|
||||
language="java"
|
||||
message="Needed for Teradata jdbc plugin"
|
||||
name="terajdbc4-15.10.00.14.jar" mvn_uri="mvn:org.talend.libraries/terajdbc4-15.10.00.14/6.0.0"
|
||||
name="terajdbc4-16.20.00.02.jar" mvn_uri="mvn:com.teradata/terajdbc4/16.20.00.02"
|
||||
required="true">
|
||||
</libraryNeeded>
|
||||
<libraryNeeded
|
||||
context="plugin:org.talend.libraries.jdbc.teradata"
|
||||
language="java"
|
||||
message="Needed for Teradata jdbc plugin"
|
||||
name="tdgssconfig-15.10.00.14.jar" mvn_uri="mvn:org.talend.libraries/tdgssconfig-15.10.00.14/6.0.0"
|
||||
name="tdgssconfig-16.20.00.02.jar" mvn_uri="mvn:com.teradata/tdgssconfig/16.20.00.02"
|
||||
required="true">
|
||||
</libraryNeeded>
|
||||
</extension>
|
||||
|
||||
@@ -166,12 +166,16 @@ public class StringUtils {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int resultSize = substrings.size();
|
||||
String[] result = substrings.toArray(new String[resultSize]);
|
||||
|
||||
while (resultSize > 0 && substrings.get(resultSize - 1).equals("")) {
|
||||
resultSize--;
|
||||
resultSize--;
|
||||
// Setting data to null for empty string in last columns to keep original behavior
|
||||
result[resultSize] = null;
|
||||
}
|
||||
String[] result = new String[resultSize];
|
||||
return substrings.subList(0, resultSize).toArray(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,7 +14,6 @@ package org.talend.librariesmanager.nexus;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -22,21 +21,20 @@ import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.http.Header;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.ClientProtocolException;
|
||||
import org.apache.http.client.fluent.Request;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.entity.ContentType;
|
||||
import org.apache.http.impl.client.DefaultHttpClient;
|
||||
import org.apache.http.message.BasicHeader;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.eclipse.m2e.core.MavenPlugin;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.core.nexus.IRepositoryArtifactHandler;
|
||||
import org.talend.core.runtime.maven.MavenArtifact;
|
||||
import org.talend.core.runtime.maven.MavenUrlHelper;
|
||||
import org.talend.designer.maven.aether.RepositorySystemFactory;
|
||||
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.talend.librariesmanager.nexus.nexus3.handler.INexus3SearchHandler;
|
||||
import org.talend.librariesmanager.nexus.nexus3.handler.Nexus3BetaSearchHandler;
|
||||
import org.talend.librariesmanager.nexus.nexus3.handler.Nexus3ScriptSearchHandler;
|
||||
import org.talend.librariesmanager.nexus.nexus3.handler.Nexus3V1SearchHandler;
|
||||
|
||||
/**
|
||||
* created by wchen on Aug 2, 2017 Detailled comment
|
||||
@@ -44,10 +42,14 @@ import net.sf.json.JSONObject;
|
||||
*/
|
||||
public class Nexus3RepositoryHandler extends AbstractArtifactRepositoryHandler {
|
||||
|
||||
private String SEARCH_SERVICE = "service/rest/v1/script/search/run";
|
||||
private static Logger LOGGER = Logger.getLogger(Nexus3RepositoryHandler.class);
|
||||
|
||||
private String REP_PREFIX_PATH = "/repository/";
|
||||
|
||||
private INexus3SearchHandler currentQueryHandler = null;
|
||||
|
||||
private static List<INexus3SearchHandler> queryHandlerList = new ArrayList<INexus3SearchHandler>();
|
||||
|
||||
@Override
|
||||
public IRepositoryArtifactHandler clone() {
|
||||
return new Nexus3RepositoryHandler();
|
||||
@@ -108,75 +110,50 @@ public class Nexus3RepositoryHandler extends AbstractArtifactRepositoryHandler {
|
||||
@Override
|
||||
public List<MavenArtifact> search(String groupIdToSearch, String artifactId, String versionToSearch, boolean fromRelease,
|
||||
boolean fromSnapshot) throws Exception {
|
||||
String serverUrl = serverBean.getServer();
|
||||
if (!serverUrl.endsWith("/")) {
|
||||
serverUrl = serverUrl + "/";
|
||||
}
|
||||
String searchUrl = serverUrl + SEARCH_SERVICE;
|
||||
Request request = Request.Post(searchUrl);
|
||||
String userPass = serverBean.getUserName() + ":" + serverBean.getPassword();
|
||||
String basicAuth = "Basic " + new String(new Base64().encode(userPass.getBytes()));
|
||||
Header authority = new BasicHeader("Authorization", basicAuth);
|
||||
Header contentType = new BasicHeader("Content-Type", "text/plain");
|
||||
request.addHeader(contentType);
|
||||
request.addHeader(authority);
|
||||
|
||||
List<MavenArtifact> resultList = new ArrayList<MavenArtifact>();
|
||||
if (fromRelease) {
|
||||
resultList.addAll(doSearch(request, serverBean.getRepositoryId(), groupIdToSearch, artifactId, versionToSearch));
|
||||
resultList.addAll(doSearch(serverBean.getRepositoryId(), groupIdToSearch, artifactId, versionToSearch));
|
||||
}
|
||||
if (fromSnapshot) {
|
||||
resultList.addAll(doSearch(request, serverBean.getSnapshotRepId(), groupIdToSearch, artifactId, versionToSearch));
|
||||
resultList.addAll(doSearch(serverBean.getSnapshotRepId(), groupIdToSearch, artifactId, versionToSearch));
|
||||
}
|
||||
|
||||
return resultList;
|
||||
}
|
||||
|
||||
private List<MavenArtifact> doSearch(Request request, String repositoryId, String groupIdToSearch, String artifactId,
|
||||
String versionToSearch) throws Exception {
|
||||
List<MavenArtifact> resultList = new ArrayList<MavenArtifact>();
|
||||
JSONObject body = new JSONObject();
|
||||
body.put("repositoryId", repositoryId);
|
||||
if (groupIdToSearch != null) {
|
||||
body.put("g", groupIdToSearch);
|
||||
private List<MavenArtifact> doSearch(String repositoryId, String groupIdToSearch, String artifactId, String versionToSearch)
|
||||
throws Exception {
|
||||
if (currentQueryHandler == null) {
|
||||
currentQueryHandler = getQueryHandler();
|
||||
}
|
||||
if (artifactId != null) {
|
||||
body.put("a", artifactId);
|
||||
}
|
||||
if (versionToSearch != null) {
|
||||
body.put("v", versionToSearch);
|
||||
}
|
||||
request.bodyString(body.toString(),
|
||||
ContentType.create(ContentType.APPLICATION_JSON.getMimeType(), StandardCharsets.UTF_8));
|
||||
HttpResponse response = request.execute().returnResponse();
|
||||
String content = EntityUtils.toString(response.getEntity());
|
||||
if (content.isEmpty()) {
|
||||
return resultList;
|
||||
}
|
||||
JSONObject responseObject = new JSONObject().fromObject(content);
|
||||
String resultStr = responseObject.getString("result");
|
||||
JSONArray resultArray = null;
|
||||
List<MavenArtifact> result = new ArrayList<MavenArtifact>();
|
||||
try {
|
||||
resultArray = new JSONArray().fromObject(resultStr);
|
||||
} catch (Exception e) {
|
||||
throw new Exception(resultStr);
|
||||
}
|
||||
if (resultArray != null) {
|
||||
for (int i = 0; i < resultArray.size(); i++) {
|
||||
JSONObject jsonObject = resultArray.getJSONObject(i);
|
||||
MavenArtifact artifact = new MavenArtifact();
|
||||
artifact.setGroupId(jsonObject.getString("groupId"));
|
||||
artifact.setArtifactId(jsonObject.getString("artifactId"));
|
||||
artifact.setVersion(jsonObject.getString("version"));
|
||||
artifact.setType(jsonObject.getString("extension"));
|
||||
artifact.setDescription(jsonObject.getString("description"));
|
||||
artifact.setLastUpdated(jsonObject.getString("last_updated"));
|
||||
// artifact.setLicense(jsonObject.getString("license"));
|
||||
// artifact.setLicenseUrl(jsonObject.getString("licenseUrl"));
|
||||
// artifact.setUrl(jsonObject.getString("url"));
|
||||
resultList.add(artifact);
|
||||
result = currentQueryHandler.search(repositoryId, groupIdToSearch, artifactId, versionToSearch);
|
||||
} catch (Exception ex) {
|
||||
for (int i = 0; i < queryHandlerList.size(); i++) {// Try to other version
|
||||
INexus3SearchHandler handler = queryHandlerList.get(i);
|
||||
if (handler != currentQueryHandler) {
|
||||
try {
|
||||
result = handler.search(repositoryId, groupIdToSearch, artifactId, versionToSearch);
|
||||
currentQueryHandler = handler;
|
||||
LOGGER.info("Switch to new search handler,the handler version is:" + currentQueryHandler.getHandlerVersion());
|
||||
} catch (Exception e) {
|
||||
LOGGER.info("Try to switch search handler failed" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return resultList;
|
||||
return result;
|
||||
}
|
||||
|
||||
private INexus3SearchHandler getQueryHandler() {
|
||||
if (queryHandlerList.size() == 0) {
|
||||
queryHandlerList.add(new Nexus3ScriptSearchHandler(serverBean));
|
||||
queryHandlerList.add(new Nexus3BetaSearchHandler(serverBean));
|
||||
queryHandlerList.add(new Nexus3V1SearchHandler(serverBean));
|
||||
}
|
||||
return queryHandlerList.get(0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -0,0 +1,186 @@
|
||||
package org.talend.librariesmanager.nexus.nexus3.handler;
|
||||
|
||||
// ============================================================================
|
||||
//
|
||||
// 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 java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.HttpStatus;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.impl.client.DefaultHttpClient;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.talend.core.nexus.ArtifactRepositoryBean;
|
||||
import org.talend.core.nexus.HttpClientTransport;
|
||||
import org.talend.core.runtime.maven.MavenArtifact;
|
||||
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
public abstract class AbsNexus3SearchHandler implements INexus3SearchHandler {
|
||||
|
||||
protected ArtifactRepositoryBean serverBean;
|
||||
|
||||
public AbsNexus3SearchHandler(ArtifactRepositoryBean serverBean) {
|
||||
this.serverBean = serverBean;
|
||||
}
|
||||
|
||||
protected String getServerUrl() {
|
||||
String serverUrl = serverBean.getServer();
|
||||
if (!serverUrl.endsWith("/")) { //$NON-NLS-1$
|
||||
serverUrl = serverUrl + "/"; //$NON-NLS-1$
|
||||
}
|
||||
return serverUrl;
|
||||
}
|
||||
|
||||
protected abstract String getSearchUrl();
|
||||
|
||||
public List<MavenArtifact> search(String repositoryId, String groupIdToSearch, String artifactId, String versionToSearch)
|
||||
throws Exception {
|
||||
List<MavenArtifact> resultList = new ArrayList<MavenArtifact>();
|
||||
String searchUrl = getSearchUrl();
|
||||
String continuationToken = null;
|
||||
while (true) {
|
||||
String query = getQueryParameter(repositoryId, groupIdToSearch, artifactId, versionToSearch, continuationToken);
|
||||
String content = doRequest(searchUrl + query);
|
||||
continuationToken = parseResult(content, resultList);
|
||||
if (continuationToken == null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
protected String doRequest(final String url) throws URISyntaxException, Exception {
|
||||
final StringBuffer sb = new StringBuffer();
|
||||
new HttpClientTransport(url, serverBean.getUserName(), serverBean.getPassword()) {
|
||||
|
||||
@Override
|
||||
protected HttpResponse execute(IProgressMonitor monitor, DefaultHttpClient httpClient, URI targetURI)
|
||||
throws Exception {
|
||||
HttpGet httpGet = new HttpGet(targetURI);
|
||||
HttpResponse response = httpClient.execute(httpGet);
|
||||
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
|
||||
sb.append(EntityUtils.toString(response.getEntity()));
|
||||
} else {
|
||||
throw new Exception(response.toString());
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
}.doRequest(null, new URI(url));
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
protected String parseResult(String content, List<MavenArtifact> resultList) throws Exception {
|
||||
if (StringUtils.isEmpty(content)) {
|
||||
return null;
|
||||
}
|
||||
JSONObject responseObject = JSONObject.fromObject(content);
|
||||
String resultStr = responseObject.getString("items"); //$NON-NLS-1$
|
||||
String continuationToken = responseObject.getString("continuationToken");
|
||||
if (StringUtils.isEmpty(continuationToken) || "null".equalsIgnoreCase(continuationToken)) {
|
||||
continuationToken = null;
|
||||
}
|
||||
JSONArray resultArray = null;
|
||||
try {
|
||||
resultArray = JSONArray.fromObject(resultStr);
|
||||
} catch (Exception e) {
|
||||
throw new Exception(resultStr);
|
||||
}
|
||||
if (resultArray != null) {
|
||||
for (int i = 0; i < resultArray.size(); i++) {
|
||||
JSONObject jsonObject = resultArray.getJSONObject(i);
|
||||
MavenArtifact artifact = new MavenArtifact();
|
||||
artifact.setGroupId(jsonObject.getString("group")); //$NON-NLS-1$
|
||||
artifact.setArtifactId(jsonObject.getString("name")); //$NON-NLS-1$
|
||||
artifact.setVersion(jsonObject.getString("version")); //$NON-NLS-1$
|
||||
JSONArray assertsArray = jsonObject.getJSONArray("assets"); //$NON-NLS-1$
|
||||
artifact.setType(getPackageType(assertsArray));
|
||||
resultList.add(artifact);
|
||||
}
|
||||
}
|
||||
|
||||
return continuationToken;
|
||||
}
|
||||
|
||||
protected String getPackageType(JSONArray assertsArray) {
|
||||
String type = null;
|
||||
if (assertsArray != null) {
|
||||
for (int i = 0; i < assertsArray.size(); i++) {
|
||||
JSONObject jsonObject = assertsArray.getJSONObject(i);
|
||||
String path = jsonObject.getString("path"); //$NON-NLS-1$
|
||||
if (path != null && path.endsWith(".zip")) { //$NON-NLS-1$
|
||||
return "zip"; //$NON-NLS-1$
|
||||
}
|
||||
if (path != null && path.endsWith(".jar")) { //$NON-NLS-1$
|
||||
return "jar"; //$NON-NLS-1$
|
||||
}
|
||||
if (path != null && path.endsWith(".pom")) { //$NON-NLS-1$
|
||||
type = "pom"; //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
protected String getQueryParameter(String repositoryId, String groupIdToSearch, String artifactId, String versionToSearch,
|
||||
String continuationToken) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
boolean hasParameter = false;
|
||||
if (StringUtils.isNoneEmpty(repositoryId)) {
|
||||
sb.append("repository=").append(repositoryId); //$NON-NLS-1$
|
||||
hasParameter = true;
|
||||
}
|
||||
if (StringUtils.isNoneEmpty(groupIdToSearch)) {
|
||||
if (hasParameter) {
|
||||
sb.append("&"); //$NON-NLS-1$
|
||||
}
|
||||
sb.append("group=").append(groupIdToSearch); //$NON-NLS-1$
|
||||
hasParameter = true;
|
||||
}
|
||||
if (StringUtils.isNoneEmpty(artifactId)) {
|
||||
if (hasParameter) {
|
||||
sb.append("&"); //$NON-NLS-1$
|
||||
}
|
||||
sb.append("name=").append(artifactId); //$NON-NLS-1$
|
||||
hasParameter = true;
|
||||
}
|
||||
if (StringUtils.isNoneEmpty(versionToSearch)) {
|
||||
if (hasParameter) {
|
||||
sb.append("&"); //$NON-NLS-1$
|
||||
}
|
||||
sb.append("version=").append(versionToSearch); //$NON-NLS-1$
|
||||
hasParameter = true;
|
||||
}
|
||||
if (StringUtils.isNoneEmpty(continuationToken)) {
|
||||
if (hasParameter) {
|
||||
sb.append("&"); //$NON-NLS-1$
|
||||
}
|
||||
sb.append("continuationToken=").append(continuationToken); //$NON-NLS-1$
|
||||
hasParameter = true;
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
protected String getAuthenticationItem() {
|
||||
String userPass = serverBean.getUserName() + ":" + serverBean.getPassword(); //$NON-NLS-1$
|
||||
String basicAuth = "Basic " + new String(new Base64().encode(userPass.getBytes())); //$NON-NLS-1$
|
||||
return basicAuth;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.talend.librariesmanager.nexus.nexus3.handler;
|
||||
|
||||
// ============================================================================
|
||||
//
|
||||
// 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 java.util.List;
|
||||
|
||||
import org.talend.core.runtime.maven.MavenArtifact;
|
||||
|
||||
public interface INexus3SearchHandler {
|
||||
|
||||
public List<MavenArtifact> search(String repositoryId, String groupIdToSearch, String artifactId, String versionToSearch)
|
||||
throws Exception;
|
||||
|
||||
public String getHandlerVersion();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.talend.librariesmanager.nexus.nexus3.handler;
|
||||
|
||||
import org.talend.core.nexus.ArtifactRepositoryBean;
|
||||
|
||||
public class Nexus3BetaSearchHandler extends AbsNexus3SearchHandler {
|
||||
|
||||
private String SEARCH_SERVICE = "service/rest/beta/search?"; //$NON-NLS-1$
|
||||
|
||||
public Nexus3BetaSearchHandler(ArtifactRepositoryBean serverBean) {
|
||||
super(serverBean);
|
||||
}
|
||||
|
||||
protected String getSearchUrl() {
|
||||
return this.getServerUrl() + SEARCH_SERVICE;
|
||||
}
|
||||
|
||||
public String getHandlerVersion() {
|
||||
return "Nexus3.beta"; //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package org.talend.librariesmanager.nexus.nexus3.handler;
|
||||
|
||||
// ============================================================================
|
||||
//
|
||||
// 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 java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.http.Header;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.HttpStatus;
|
||||
import org.apache.http.client.fluent.Request;
|
||||
import org.apache.http.entity.ContentType;
|
||||
import org.apache.http.message.BasicHeader;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.talend.core.nexus.ArtifactRepositoryBean;
|
||||
import org.talend.core.runtime.maven.MavenArtifact;
|
||||
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
public class Nexus3ScriptSearchHandler extends AbsNexus3SearchHandler {
|
||||
|
||||
private String SEARCH_SERVICE = "service/rest/v1/script/search/run"; //$NON-NLS-1$
|
||||
|
||||
public Nexus3ScriptSearchHandler(ArtifactRepositoryBean serverBean) {
|
||||
super(serverBean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MavenArtifact> search(String repositoryId, String groupIdToSearch, String artifactId, String versionToSearch)
|
||||
throws Exception {
|
||||
String searchUrl = getSearchUrl();
|
||||
Request request = this.getRequest(searchUrl);
|
||||
List<MavenArtifact> resultList = new ArrayList<MavenArtifact>();
|
||||
JSONObject body = new JSONObject();
|
||||
body.put("repositoryId", repositoryId); //$NON-NLS-1$
|
||||
if (groupIdToSearch != null) {
|
||||
body.put("g", groupIdToSearch); //$NON-NLS-1$
|
||||
}
|
||||
if (artifactId != null) {
|
||||
body.put("a", artifactId); //$NON-NLS-1$
|
||||
}
|
||||
if (versionToSearch != null) {
|
||||
body.put("v", versionToSearch); //$NON-NLS-1$
|
||||
}
|
||||
request.bodyString(body.toString(),
|
||||
ContentType.create(ContentType.APPLICATION_JSON.getMimeType(), StandardCharsets.UTF_8));
|
||||
HttpResponse response = request.execute().returnResponse();
|
||||
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
|
||||
String content = EntityUtils.toString(response.getEntity());
|
||||
if (content.isEmpty()) {
|
||||
return resultList;
|
||||
}
|
||||
JSONObject responseObject = JSONObject.fromObject(content);
|
||||
String resultStr = responseObject.getString("result"); //$NON-NLS-1$
|
||||
JSONArray resultArray = null;
|
||||
try {
|
||||
resultArray = JSONArray.fromObject(resultStr);
|
||||
} catch (Exception e) {
|
||||
throw new Exception(resultStr);
|
||||
}
|
||||
if (resultArray != null) {
|
||||
for (int i = 0; i < resultArray.size(); i++) {
|
||||
JSONObject jsonObject = resultArray.getJSONObject(i);
|
||||
MavenArtifact artifact = new MavenArtifact();
|
||||
artifact.setGroupId(jsonObject.getString("groupId")); //$NON-NLS-1$
|
||||
artifact.setArtifactId(jsonObject.getString("artifactId")); //$NON-NLS-1$
|
||||
artifact.setVersion(jsonObject.getString("version")); //$NON-NLS-1$
|
||||
artifact.setType(jsonObject.getString("extension")); //$NON-NLS-1$
|
||||
artifact.setDescription(jsonObject.getString("description")); //$NON-NLS-1$
|
||||
artifact.setLastUpdated(jsonObject.getString("last_updated")); //$NON-NLS-1$
|
||||
resultList.add(artifact);
|
||||
}
|
||||
}
|
||||
return resultList;
|
||||
} else {
|
||||
throw new Exception(response.toString());
|
||||
}
|
||||
}
|
||||
|
||||
protected Request getRequest(String searchUrl) {
|
||||
Request request = Request.Post(searchUrl);
|
||||
Header authority = new BasicHeader("Authorization", getAuthenticationItem()); //$NON-NLS-1$
|
||||
Header contentType = new BasicHeader("Content-Type", "text/plain"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
request.addHeader(contentType);
|
||||
request.addHeader(authority);
|
||||
return request;
|
||||
}
|
||||
|
||||
protected String getSearchUrl() {
|
||||
return this.getServerUrl() + SEARCH_SERVICE;
|
||||
}
|
||||
|
||||
public String getHandlerVersion() {
|
||||
return "Nexus3.script"; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.talend.librariesmanager.nexus.nexus3.handler;
|
||||
|
||||
import org.talend.core.nexus.ArtifactRepositoryBean;
|
||||
|
||||
public class Nexus3V1SearchHandler extends AbsNexus3SearchHandler {
|
||||
|
||||
private String SEARCH_SERVICE = "service/rest/v1/search?";
|
||||
|
||||
public Nexus3V1SearchHandler(ArtifactRepositoryBean serverBean) {
|
||||
super(serverBean);
|
||||
}
|
||||
|
||||
protected String getSearchUrl() {
|
||||
return this.getServerUrl() + SEARCH_SERVICE;
|
||||
}
|
||||
|
||||
public String getHandlerVersion() {
|
||||
return "Nexus3.V1"; //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
@@ -146,6 +146,7 @@ EMetadataEncoding.UTF8=Unicode 2.0 UTF-8
|
||||
ERepositoryObjectType.FolderNotFound=Folder for type {0} cannot be found.
|
||||
ERepositoryObjectType.NotImplemented=not implemented
|
||||
ExtractMetaDataFromDataBase.SchemaNoPresent=Schema not present in Database
|
||||
ExtractMetaDataFromDataBase.DatabaseNoPresent=The database '{0}' not exist
|
||||
ExtractMetaDataFromDataBase.connectionSuccessful=Connection successful
|
||||
ExtractMetaDataFromDataBase.dbTypeNotFound=dbType '{0}' not found
|
||||
ExtractMetaDataUtils.1=Impossible to initialize the connection \!
|
||||
|
||||
@@ -299,12 +299,12 @@ public class ExtractMetaDataFromDataBase {
|
||||
public static ConnectionStatus testConnection(String dbType, String url, String username, String pwd, String schema,
|
||||
final String driverClassName, final String driverJarPath, String dbVersionString, String additionalParam) {
|
||||
return testConnection(dbType, url, username, pwd, schema, driverClassName, driverJarPath, dbVersionString,
|
||||
additionalParam, null);
|
||||
additionalParam, null, null);
|
||||
}
|
||||
|
||||
public static ConnectionStatus testConnection(String dbType, String url, String username, String pwd, String schema,
|
||||
final String driverClassName, final String driverJarPath, String dbVersionString, String additionalParam,
|
||||
StringBuffer retProposedSchema) {
|
||||
StringBuffer retProposedSchema, String sidOrDatabase) {
|
||||
Connection connection = null;
|
||||
ConnectionStatus connectionStatus = new ConnectionStatus();
|
||||
connectionStatus.setResult(false);
|
||||
@@ -334,6 +334,14 @@ public class ExtractMetaDataFromDataBase {
|
||||
return connectionStatus;
|
||||
}
|
||||
}
|
||||
if (EDatabaseTypeName.SYBASEASE == EDatabaseTypeName.getTypeFromDisplayName(dbType)) {
|
||||
boolean exsitedSybaseDB = checkSybaseDB(connection, sidOrDatabase);
|
||||
if (!exsitedSybaseDB) {
|
||||
connectionStatus.setMessageException(
|
||||
Messages.getString("ExtractMetaDataFromDataBase.DatabaseNoPresent", sidOrDatabase)); //$NON-NLS-1$
|
||||
return connectionStatus;
|
||||
}
|
||||
}
|
||||
|
||||
connectionStatus.setResult(true);
|
||||
connectionStatus.setMessageException(Messages.getString("ExtractMetaDataFromDataBase.connectionSuccessful")); //$NON-NLS-1$
|
||||
@@ -371,6 +379,35 @@ public class ExtractMetaDataFromDataBase {
|
||||
return checkSchemaConnection(schema, connection, notCaseSensitive, dbType, null);
|
||||
}
|
||||
|
||||
private static boolean checkSybaseDB(Connection connection, String database) {
|
||||
ExtractMetaDataUtils extractMeta = ExtractMetaDataUtils.getInstance();
|
||||
if (extractMeta != null) {
|
||||
Statement stmt = null;
|
||||
ResultSet resultSet = null;
|
||||
try {
|
||||
stmt = connection.createStatement();
|
||||
extractMeta.setQueryStatementTimeout(stmt);
|
||||
resultSet = stmt.executeQuery("sp_helpdb " + database);
|
||||
return true;
|
||||
} catch (SQLException e) {
|
||||
ExceptionHandler.process(e);
|
||||
return false;
|
||||
} finally {
|
||||
try {
|
||||
if (resultSet != null) {
|
||||
resultSet.close();
|
||||
}
|
||||
if (stmt != null) {
|
||||
stmt.close();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean checkSchemaConnection(final String schema, Connection connection, boolean notCaseSensitive,
|
||||
String dbType, final StringBuffer retPropsedSchema) throws SQLException {
|
||||
ExtractMetaDataUtils extractMeta = ExtractMetaDataUtils.getInstance();
|
||||
|
||||
@@ -70,11 +70,13 @@ public final class SupportDBUrlStore {
|
||||
// PTODO scorreia choose here which Database types to enable
|
||||
// supportDBUrlMap.put(SupportDBUrlType.ODBCDEFAULTURL.getDBKey(), SupportDBUrlType.ODBCDEFAULTURL);
|
||||
supportDBUrlMap.put(SupportDBUrlType.MYSQLDEFAULTURL.getDBKey(), SupportDBUrlType.MYSQLDEFAULTURL);
|
||||
supportDBUrlMap.put(SupportDBUrlType.ORACLEWITHSIDDEFAULTURL.getDBKey(), SupportDBUrlType.ORACLEWITHSIDDEFAULTURL);
|
||||
supportDBUrlMap.put(SupportDBUrlType.ORACLEWITHSIDDEFAULTURL.getDBKey(),
|
||||
SupportDBUrlType.ORACLEWITHSIDDEFAULTURL);
|
||||
supportDBUrlMap.put(SupportDBUrlType.ORACLEWITHSERVICENAMEDEFAULTURL.getDBKey(),
|
||||
SupportDBUrlType.ORACLEWITHSERVICENAMEDEFAULTURL);
|
||||
supportDBUrlMap.put(SupportDBUrlType.ORACLEOCIDEFAULTURL.getDBKey(), SupportDBUrlType.ORACLEOCIDEFAULTURL);
|
||||
supportDBUrlMap.put(SupportDBUrlType.ORACLECUSTOMDEFAULTURL.getDBKey(), SupportDBUrlType.ORACLECUSTOMDEFAULTURL);
|
||||
supportDBUrlMap
|
||||
.put(SupportDBUrlType.ORACLECUSTOMDEFAULTURL.getDBKey(), SupportDBUrlType.ORACLECUSTOMDEFAULTURL);
|
||||
supportDBUrlMap.put(SupportDBUrlType.MSSQLDEFAULTURL.getDBKey(), SupportDBUrlType.MSSQLDEFAULTURL);
|
||||
supportDBUrlMap.put(SupportDBUrlType.MSSQL2008URL.getDBKey(), SupportDBUrlType.MSSQL2008URL);
|
||||
supportDBUrlMap.put(SupportDBUrlType.DB2DEFAULTURL.getDBKey(), SupportDBUrlType.DB2DEFAULTURL);
|
||||
@@ -100,6 +102,7 @@ public final class SupportDBUrlStore {
|
||||
supportDBUrlMap.put(SupportDBUrlType.REDSHIFT.getDBKey(), SupportDBUrlType.REDSHIFT);
|
||||
supportDBUrlMap.put(SupportDBUrlType.REDSHIFT_SSO.getDBKey(), SupportDBUrlType.REDSHIFT_SSO);
|
||||
supportDBUrlMap.put(SupportDBUrlType.EXASOL.getDBKey(), SupportDBUrlType.EXASOL);
|
||||
supportDBUrlMap.put(SupportDBUrlType.AMAZONAURORA.getDBKey(), SupportDBUrlType.AMAZONAURORA);
|
||||
|
||||
// MOD mzhao bug 12313, 2010-04-02 There is not dbType in prv files before 4.0 release, here use driver class
|
||||
// name
|
||||
@@ -113,30 +116,39 @@ public final class SupportDBUrlStore {
|
||||
supportDiverNameDBUrlMap.put(SupportDBUrlType.MSSQLDEFAULTURL.getDbDriver(), SupportDBUrlType.MSSQLDEFAULTURL);
|
||||
supportDiverNameDBUrlMap.put(SupportDBUrlType.MSSQL2008URL.getDbDriver(), SupportDBUrlType.MSSQL2008URL);
|
||||
supportDiverNameDBUrlMap.put(SupportDBUrlType.DB2DEFAULTURL.getDbDriver(), SupportDBUrlType.DB2DEFAULTURL);
|
||||
supportDiverNameDBUrlMap.put(SupportDBUrlType.DB2ZOSDEFAULTURL.getDbDriver(), SupportDBUrlType.DB2ZOSDEFAULTURL);
|
||||
supportDiverNameDBUrlMap.put(SupportDBUrlType.POSTGRESQLEFAULTURL.getDbDriver(), SupportDBUrlType.POSTGRESQLEFAULTURL);
|
||||
supportDiverNameDBUrlMap
|
||||
.put(SupportDBUrlType.DB2ZOSDEFAULTURL.getDbDriver(), SupportDBUrlType.DB2ZOSDEFAULTURL);
|
||||
supportDiverNameDBUrlMap.put(SupportDBUrlType.POSTGRESQLEFAULTURL.getDbDriver(),
|
||||
SupportDBUrlType.POSTGRESQLEFAULTURL);
|
||||
// supportDiverNameDBUrlMap.put(SupportDBUrlType.INTERBASEDEFAULTURL.getDbDriver(),
|
||||
// SupportDBUrlType.INTERBASEDEFAULTURL);
|
||||
supportDiverNameDBUrlMap.put(SupportDBUrlType.SYBASEDEFAULTURL.getDbDriver(), SupportDBUrlType.SYBASEDEFAULTURL);
|
||||
supportDiverNameDBUrlMap
|
||||
.put(SupportDBUrlType.SYBASEDEFAULTURL.getDbDriver(), SupportDBUrlType.SYBASEDEFAULTURL);
|
||||
// supportDiverNameDBUrlMap.put(SupportDBUrlType.INFORMIXDEFAULTURL.getDbDriver(),
|
||||
// SupportDBUrlType.INFORMIXDEFAULTURL);
|
||||
// supportDiverNameDBUrlMap.put(SupportDBUrlType.FIREBIRDDEFAULTURL.getDbDriver(),
|
||||
// SupportDBUrlType.FIREBIRDDEFAULTURL);
|
||||
supportDiverNameDBUrlMap.put(SupportDBUrlType.INGRESDEFAULTURL.getDbDriver(), SupportDBUrlType.INGRESDEFAULTURL);
|
||||
supportDiverNameDBUrlMap.put(SupportDBUrlType.INFORMIXDEFAULTURL.getDbDriver(), SupportDBUrlType.INFORMIXDEFAULTURL);
|
||||
supportDiverNameDBUrlMap.put(SupportDBUrlType.SQLITE3DEFAULTURL.getDbDriver(), SupportDBUrlType.SQLITE3DEFAULTURL);
|
||||
supportDiverNameDBUrlMap
|
||||
.put(SupportDBUrlType.GENERICJDBCDEFAULTURL.getDbDriver(), SupportDBUrlType.GENERICJDBCDEFAULTURL);
|
||||
supportDiverNameDBUrlMap.put(SupportDBUrlType.TERADATADEFAULTURL.getDbDriver(), SupportDBUrlType.TERADATADEFAULTURL);
|
||||
.put(SupportDBUrlType.INGRESDEFAULTURL.getDbDriver(), SupportDBUrlType.INGRESDEFAULTURL);
|
||||
supportDiverNameDBUrlMap.put(SupportDBUrlType.INFORMIXDEFAULTURL.getDbDriver(),
|
||||
SupportDBUrlType.INFORMIXDEFAULTURL);
|
||||
supportDiverNameDBUrlMap.put(SupportDBUrlType.SQLITE3DEFAULTURL.getDbDriver(),
|
||||
SupportDBUrlType.SQLITE3DEFAULTURL);
|
||||
supportDiverNameDBUrlMap.put(SupportDBUrlType.GENERICJDBCDEFAULTURL.getDbDriver(),
|
||||
SupportDBUrlType.GENERICJDBCDEFAULTURL);
|
||||
supportDiverNameDBUrlMap.put(SupportDBUrlType.TERADATADEFAULTURL.getDbDriver(),
|
||||
SupportDBUrlType.TERADATADEFAULTURL);
|
||||
supportDiverNameDBUrlMap.put(SupportDBUrlType.AS400DEFAULTURL.getDbDriver(), SupportDBUrlType.AS400DEFAULTURL);
|
||||
// supportDiverNameDBUrlMap.put(SupportDBUrlType.XML_eXist.getDbDriver(), SupportDBUrlType.XML_eXist);
|
||||
supportDiverNameDBUrlMap.put(SupportDBUrlType.MDM.getDbDriver(), SupportDBUrlType.MDM);
|
||||
supportDiverNameDBUrlMap.put(SupportDBUrlType.NETEZZADEFAULTURL.getDbDriver(), SupportDBUrlType.NETEZZADEFAULTURL);
|
||||
supportDiverNameDBUrlMap.put(SupportDBUrlType.NETEZZADEFAULTURL.getDbDriver(),
|
||||
SupportDBUrlType.NETEZZADEFAULTURL);
|
||||
supportDiverNameDBUrlMap.put(SupportDBUrlType.HIVEDEFAULTURL.getDbDriver(), SupportDBUrlType.HIVEDEFAULTURL);
|
||||
supportDiverNameDBUrlMap.put(SupportDBUrlType.VERTICA.getDbDriver(), SupportDBUrlType.VERTICA);
|
||||
supportDiverNameDBUrlMap.put(SupportDBUrlType.VERTICA2.getDbDriver(), SupportDBUrlType.VERTICA2);
|
||||
supportDiverNameDBUrlMap.put(SupportDBUrlType.REDSHIFT.getDbDriver(), SupportDBUrlType.REDSHIFT);
|
||||
supportDiverNameDBUrlMap.put(SupportDBUrlType.EXASOL.getDbDriver(), SupportDBUrlType.EXASOL);
|
||||
|
||||
// ~12313
|
||||
}
|
||||
|
||||
@@ -175,8 +187,9 @@ public final class SupportDBUrlStore {
|
||||
}
|
||||
|
||||
public String getDBUrl(SupportDBUrlType dbType) {
|
||||
return getDBUrl(dbType.getDBKey(), dbType.getHostName(), dbType.getPort(), dbType.getDBName(), dbType.getDataSource(),
|
||||
dbType.getParamSeprator() != null ? PluginConstant.DEFAULT_PARAMETERS : PluginConstant.EMPTY_STRING);
|
||||
return getDBUrl(dbType.getDBKey(), dbType.getHostName(), dbType.getPort(), dbType.getDBName(),
|
||||
dbType.getDataSource(), dbType.getParamSeprator() != null ? PluginConstant.DEFAULT_PARAMETERS
|
||||
: PluginConstant.EMPTY_STRING);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -200,7 +213,8 @@ public final class SupportDBUrlStore {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get dburl which content are replaced by parameter value.(note: for mssql, this method result is wrong, so i deprecated this
|
||||
* Get dburl which content are replaced by parameter value.(note: for mssql, this method result is wrong, so i
|
||||
* deprecated this
|
||||
* method)
|
||||
*
|
||||
* @param dbType
|
||||
@@ -214,7 +228,8 @@ public final class SupportDBUrlStore {
|
||||
* {@link #getDBUrl(String dbType, String Version, String host, String username, String password, String port, String dbName, String dataSource, String paramString)}
|
||||
*/
|
||||
@Deprecated
|
||||
public String getDBUrl(String dbType, String host, String port, String dbName, String dataSource, String paramString) {
|
||||
public String
|
||||
getDBUrl(String dbType, String host, String port, String dbName, String dataSource, String paramString) {
|
||||
String propUrlValue = PROP.getProperty(dbType);
|
||||
SupportDBUrlType defaultUrlType = supportDBUrlMap.get(dbType);
|
||||
// defaultUrlType = defaultUrlType == null ? SupportDBUrlType.ODBCDEFAULTURL : defaultUrlType;
|
||||
@@ -250,8 +265,9 @@ public final class SupportDBUrlStore {
|
||||
if (propUrlValue == null) {
|
||||
return PluginConstant.EMPTY_STRING;
|
||||
}
|
||||
Object[] args = { defaultUrlType.getHostName(), defaultUrlType.getPort(), defaultUrlType.getDBName(),
|
||||
defaultUrlType.getDataSource() };
|
||||
Object[] args =
|
||||
{ defaultUrlType.getHostName(), defaultUrlType.getPort(), defaultUrlType.getDBName(),
|
||||
defaultUrlType.getDataSource() };
|
||||
return MessageFormat.format(propUrlValue, args);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
package org.talend.core.model.metadata.builder.database.dburl;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.talend.core.database.EDatabaseTypeName;
|
||||
|
||||
/**
|
||||
* DOC rli class global comment. Detailled comment <br/>
|
||||
@@ -29,6 +30,14 @@ public enum SupportDBUrlType {
|
||||
null,
|
||||
"sun.jdbc.odbc.JdbcOdbcDriver", //$NON-NLS-1$
|
||||
"datasourceName", "ODBC"), //$NON-NLS-1$ //$NON-NLS-2$
|
||||
AMAZONAURORA(EDatabaseTypeName.AMAZON_AURORA.getDbType(), "localhost", //$NON-NLS-1$
|
||||
"3306", //$NON-NLS-1$
|
||||
"dbname", //$NON-NLS-1$
|
||||
"?", //$NON-NLS-1$
|
||||
"org.gjt.mm.mysql.Driver", //$NON-NLS-1$
|
||||
null,
|
||||
EDatabaseTypeName.AMAZON_AURORA.getDbType()),
|
||||
|
||||
MYSQLDEFAULTURL("MySQL", //$NON-NLS-1$
|
||||
"localhost", //$NON-NLS-1$
|
||||
"3306", //$NON-NLS-1$
|
||||
@@ -352,7 +361,8 @@ public enum SupportDBUrlType {
|
||||
|
||||
public static boolean isOracle(String dbKey) {
|
||||
SupportDBUrlType dbTypeByKey = getDBTypeByKey(dbKey);
|
||||
return dbTypeByKey != null && (dbTypeByKey == ORACLEWITHSIDDEFAULTURL || dbTypeByKey == ORACLEWITHSERVICENAMEDEFAULTURL);
|
||||
return dbTypeByKey != null
|
||||
&& (dbTypeByKey == ORACLEWITHSIDDEFAULTURL || dbTypeByKey == ORACLEWITHSERVICENAMEDEFAULTURL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -288,7 +288,8 @@ public class ManagerConnection {
|
||||
}
|
||||
// test the connection
|
||||
testConnection = ExtractMetaDataFromDataBase.testConnection(dbTypeString, urlConnectionString, username, password,
|
||||
schemaName, driverClassName, driverJarPath, dbVersionString, additionalParams, retProposedSchema);
|
||||
schemaName, driverClassName, driverJarPath, dbVersionString, additionalParams, retProposedSchema,
|
||||
sidOrDatabase);
|
||||
isValide = testConnection.getResult();
|
||||
messageException = testConnection.getMessageException();
|
||||
} catch (Exception e) {
|
||||
@@ -387,7 +388,7 @@ public class ManagerConnection {
|
||||
metadataConnection.getUrl(), metadataConnection.getUsername(), metadataConnection.getPassword(),
|
||||
metadataConnection.getSchema(), metadataConnection.getDriverClass(),
|
||||
metadataConnection.getDriverJarPath(), metadataConnection.getDbVersionString(),
|
||||
metadataConnection.getAdditionalParams(), retProposedSchema);
|
||||
metadataConnection.getAdditionalParams(), retProposedSchema, metadataConnection.getDatabase());
|
||||
}
|
||||
// qli
|
||||
// record this metadataConnection as old connection.
|
||||
|
||||
@@ -1456,4 +1456,5 @@ DatabaseForm.ZnodeParent.checkBtn=Set Zookeeper znode parent
|
||||
|
||||
DatabaseForm.maprdb.tableInfo.tableNSMapping.label=Table Namespace mappings
|
||||
DatabaseForm.set_table_ns_mapping.checkBtn=Set table Namespace mappings
|
||||
BrowerDialog.empryUrl=the url can not be empty
|
||||
BrowerDialog.empryUrl=the url can not be empty
|
||||
DatabaseForm.canNotUsableInDataProfiler=some database types are not usable in the Data Profiler perspective.
|
||||
@@ -15,43 +15,232 @@ package org.talend.utils.ssl;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.security.KeyStore;
|
||||
import java.security.KeyStoreException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.UnrecoverableKeyException;
|
||||
import java.security.cert.Certificate;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.CertificateParsingException;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import javax.net.ssl.KeyManager;
|
||||
import javax.net.ssl.KeyManagerFactory;
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.SSLException;
|
||||
import javax.net.ssl.SSLSession;
|
||||
import javax.net.ssl.SSLSocketFactory;
|
||||
import javax.net.ssl.TrustManager;
|
||||
import javax.net.ssl.TrustManagerFactory;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
|
||||
/**
|
||||
* DOC hcyi class global comment. Detailled comment
|
||||
* DOC hcyi class global comment. Detailled comment
|
||||
* This class have 3 duplicate in studio, If you fix some bugs in this class, please synchronize others.
|
||||
*/
|
||||
public class SSLUtils {
|
||||
|
||||
private static SSLContext sslcontext;
|
||||
|
||||
/**
|
||||
* {@value}
|
||||
* <p>
|
||||
* The default client keystore file name.
|
||||
*/
|
||||
public static final String TAC_SSL_KEYSTORE = "clientKeystore.jks"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* {@value}
|
||||
* <p>
|
||||
* The default truststore file name.
|
||||
*/
|
||||
public static final String TAC_SSL_TRUSTSTORE = "clientTruststore.jks"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* {@value}
|
||||
* <p>
|
||||
* System property key of client keystore file path.
|
||||
*/
|
||||
public static final String TAC_SSL_CLIENT_KEY = "tac.net.ssl.ClientKeyStore"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* {@value}
|
||||
* <p>
|
||||
* System property key of client truststore file path.
|
||||
*/
|
||||
public static final String TAC_SSL_CLIENT_TRUST_KEY = "tac.net.ssl.ClientTrustStore"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* {@value}
|
||||
* <p>
|
||||
* System property of client keystore password.
|
||||
*/
|
||||
public static final String TAC_SSL_KEYSTORE_PASS = "tac.net.ssl.KeyStorePass"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* {@value}
|
||||
* <p>
|
||||
* System property of client truststore password.
|
||||
*/
|
||||
public static final String TAC_SSL_TRUSTSTORE_PASS = "tac.net.ssl.TrustStorePass"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* {@value}
|
||||
* <p>
|
||||
* Enable host name verification, the default value is <b>true</b>.
|
||||
*/
|
||||
public static final String TAC_SSL_ENABLE_HOST_NAME_VERIFICATION = "tac.net.ssl.EnableHostNameVerification"; //$NON-NLS-1$
|
||||
|
||||
public static final String TAC_SSL_FAIL_IF_NO_TRUSTSTORE = "tac.net.ssl.FailIfNoTruststore"; //$NON-NLS-1$
|
||||
/**
|
||||
* {@value}
|
||||
* <p>
|
||||
* Accept all certificates if don't setup tac.net.ssl.ClientTrustStore, the default value is <b>false</b>.
|
||||
*/
|
||||
public static final String TAC_SSL_ACCEPT_ALL_CERTS_IF_NO_TRUSTSTORE = "tac.net.ssl.AcceptAllCertsIfNoTruststore"; //$NON-NLS-1$
|
||||
|
||||
private HostnameVerifier hostnameVerifier;
|
||||
|
||||
private KeyManager[] keystoreManagers;
|
||||
|
||||
private TrustManager[] truststoreManagers;
|
||||
|
||||
private static Map<String, SSLUtils> userDirToInstanceMap = new HashMap<String, SSLUtils>();
|
||||
|
||||
/**
|
||||
* Get SSLUtils instance
|
||||
*
|
||||
* @param userDir- The default keystore file folder, Once SSLUtils initialized, we should not use different value
|
||||
* @return SSLUtils instance
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @throws KeyStoreException
|
||||
* @throws UnrecoverableKeyException
|
||||
* @throws CertificateException
|
||||
* @throws FileNotFoundException
|
||||
* @throws IOException
|
||||
*/
|
||||
public static synchronized SSLUtils getInstance(String userDir) throws NoSuchAlgorithmException, KeyStoreException,
|
||||
UnrecoverableKeyException, CertificateException, FileNotFoundException, IOException {
|
||||
if (userDir == null) {
|
||||
userDir = "";
|
||||
}
|
||||
if (userDirToInstanceMap.containsKey(userDir)) {
|
||||
return userDirToInstanceMap.get(userDir);
|
||||
}
|
||||
SSLUtils newInstance = new SSLUtils(userDir);
|
||||
userDirToInstanceMap.put(userDir, newInstance);
|
||||
return newInstance;
|
||||
}
|
||||
|
||||
private SSLUtils(String userDir) throws NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException,
|
||||
CertificateException, FileNotFoundException, IOException {
|
||||
Init(userDir);
|
||||
}
|
||||
|
||||
private void Init(String userDir) throws NoSuchAlgorithmException, KeyStoreException, CertificateException,
|
||||
FileNotFoundException, IOException, UnrecoverableKeyException {
|
||||
String keystorePath = System.getProperty(TAC_SSL_CLIENT_KEY);
|
||||
String trustStorePath = System.getProperty(TAC_SSL_CLIENT_TRUST_KEY);
|
||||
String keystorePass = System.getProperty(TAC_SSL_KEYSTORE_PASS);
|
||||
String truststorePass = System.getProperty(TAC_SSL_TRUSTSTORE_PASS);
|
||||
boolean acceptAllCertsIfNoTrustStore = Boolean
|
||||
.parseBoolean(System.getProperty(TAC_SSL_ACCEPT_ALL_CERTS_IF_NO_TRUSTSTORE));
|
||||
|
||||
if (keystorePath == null) {
|
||||
// if user does not set the keystore path in the .ini,we need to look for the
|
||||
// keystore file under
|
||||
// the root dir of product
|
||||
File keystorePathFile = new File(userDir + TAC_SSL_KEYSTORE);
|
||||
if (keystorePathFile.exists()) {
|
||||
keystorePath = keystorePathFile.getAbsolutePath();
|
||||
}
|
||||
}
|
||||
if (trustStorePath == null) {
|
||||
File trustStorePathFile = new File(userDir + TAC_SSL_TRUSTSTORE);
|
||||
if (trustStorePathFile.exists()) {
|
||||
trustStorePath = trustStorePathFile.getAbsolutePath();
|
||||
}
|
||||
}
|
||||
if (keystorePass == null) {
|
||||
// if user does not set the password in the talend.ini,we only can make it empty
|
||||
// by
|
||||
// default,but not sure the ssl can connect
|
||||
keystorePass = ""; //$NON-NLS-1$
|
||||
}
|
||||
if (truststorePass == null) {
|
||||
// if user does not set the password in the talend.ini,we only can make it empty
|
||||
// by
|
||||
// default,but not sure the ssl can connect
|
||||
truststorePass = ""; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
if (keystorePath != null) {
|
||||
KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); //$NON-NLS-1$
|
||||
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||
ks.load(new FileInputStream(keystorePath), keystorePass == null ? null : keystorePass.toCharArray());
|
||||
kmf.init(ks, keystorePass == null ? null : keystorePass.toCharArray());
|
||||
keystoreManagers = kmf.getKeyManagers();
|
||||
}
|
||||
|
||||
if (trustStorePath != null) {
|
||||
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); //$NON-NLS-1$
|
||||
KeyStore tks = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||
tks.load(new FileInputStream(trustStorePath), truststorePass.toCharArray());
|
||||
tmf.init(tks);
|
||||
truststoreManagers = tmf.getTrustManagers();
|
||||
}
|
||||
|
||||
if (truststoreManagers == null) {
|
||||
if (acceptAllCertsIfNoTrustStore) {
|
||||
truststoreManagers = new TrustManager[] { new TrustAnyTrustManager() };
|
||||
} else {
|
||||
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); //$NON-NLS-1$
|
||||
tmf.init((KeyStore) null);
|
||||
truststoreManagers = tmf.getTrustManagers();
|
||||
}
|
||||
}
|
||||
|
||||
boolean enableHostnameVerification = Boolean
|
||||
.parseBoolean(System.getProperty(TAC_SSL_ENABLE_HOST_NAME_VERIFICATION, Boolean.TRUE.toString()));
|
||||
if (enableHostnameVerification) {
|
||||
hostnameVerifier = new BrowserCompatibleHostnameVerifier();
|
||||
} else {
|
||||
hostnameVerifier = new AllowAllHostnameVerifier();
|
||||
}
|
||||
}
|
||||
|
||||
public SSLContext getSSLContext() throws Exception {
|
||||
SSLContext sslcontext = SSLContext.getInstance("TLS"); //$NON-NLS-1$
|
||||
sslcontext.init(keystoreManagers, truststoreManagers, null);
|
||||
return sslcontext;
|
||||
}
|
||||
|
||||
public static SSLContext getSSLContext(String userDir) throws Exception {
|
||||
SSLUtils instance = SSLUtils.getInstance(userDir);
|
||||
return instance.getSSLContext();
|
||||
}
|
||||
|
||||
public static String getContent(StringBuffer buffer, URL url, String userDir) throws Exception {
|
||||
SSLUtils instance = SSLUtils.getInstance(userDir);
|
||||
return instance.getContent(buffer, url);
|
||||
}
|
||||
|
||||
public HostnameVerifier getHostnameVerifier() {
|
||||
return hostnameVerifier;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -63,19 +252,13 @@ public class SSLUtils {
|
||||
* @return
|
||||
* @throws AMCPluginException
|
||||
*/
|
||||
public static String getContent(StringBuffer buffer, URL url, String userDir) throws Exception {
|
||||
public String getContent(StringBuffer buffer, URL url) throws Exception {
|
||||
BufferedReader in = null;
|
||||
if (("https").equals(url.getProtocol())) {
|
||||
boolean openHttpHostNameVerification = Boolean
|
||||
.parseBoolean(System.getProperty(TAC_SSL_ENABLE_HOST_NAME_VERIFICATION));
|
||||
final SSLSocketFactory socketFactory = getSSLContext(userDir).getSocketFactory();
|
||||
final SSLSocketFactory socketFactory = getSSLContext().getSocketFactory();
|
||||
HttpsURLConnection httpsCon = (HttpsURLConnection) url.openConnection();
|
||||
httpsCon.setSSLSocketFactory(socketFactory);
|
||||
if (openHttpHostNameVerification) {
|
||||
httpsCon.setHostnameVerifier(org.apache.http.conn.ssl.SSLSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);
|
||||
} else {
|
||||
httpsCon.setHostnameVerifier(org.apache.http.conn.ssl.SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
|
||||
}
|
||||
httpsCon.setHostnameVerifier(hostnameVerifier);
|
||||
httpsCon.connect();
|
||||
in = new BufferedReader(new InputStreamReader(httpsCon.getInputStream()));
|
||||
} else {
|
||||
@@ -89,71 +272,8 @@ public class SSLUtils {
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
public static SSLContext getSSLContext(String userDir) throws Exception {
|
||||
if (sslcontext == null) {
|
||||
String keystorePath = System.getProperty(TAC_SSL_CLIENT_KEY);
|
||||
String trustStorePath = System.getProperty(TAC_SSL_CLIENT_TRUST_KEY);
|
||||
String keystorePass = System.getProperty(TAC_SSL_KEYSTORE_PASS);
|
||||
String truststorePass = System.getProperty(TAC_SSL_TRUSTSTORE_PASS);
|
||||
boolean failIfNoTrustStore = Boolean.parseBoolean(System.getProperty(TAC_SSL_FAIL_IF_NO_TRUSTSTORE));
|
||||
if (keystorePath == null) {
|
||||
// if user does not set the keystore path in the .ini,we need to look for the keystore file under
|
||||
// the root dir of product
|
||||
File keystorePathFile = new File(userDir + TAC_SSL_KEYSTORE);
|
||||
if (keystorePathFile.exists()) {
|
||||
keystorePath = keystorePathFile.getAbsolutePath();
|
||||
}
|
||||
}
|
||||
if (trustStorePath == null) {
|
||||
File trustStorePathFile = new File(userDir + TAC_SSL_TRUSTSTORE);
|
||||
if (trustStorePathFile.exists()) {
|
||||
trustStorePath = trustStorePathFile.getAbsolutePath();
|
||||
}
|
||||
}
|
||||
if (keystorePass == null) {
|
||||
// if user does not set the password in the talend.ini,we only can make it empty by
|
||||
// default,but not sure the ssl can connect
|
||||
keystorePass = ""; //$NON-NLS-1$
|
||||
}
|
||||
if (truststorePass == null) {
|
||||
// if user does not set the password in the talend.ini,we only can make it empty by
|
||||
// default,but not sure the ssl can connect
|
||||
truststorePass = ""; //$NON-NLS-1$
|
||||
}
|
||||
sslcontext = getSSLContext(keystorePath, keystorePass, trustStorePath, truststorePass, failIfNoTrustStore);
|
||||
}
|
||||
return sslcontext;
|
||||
}
|
||||
|
||||
public static SSLContext getSSLContext(String keystorePath, String keystorePass, String trustStorePath, String truststorePass,
|
||||
boolean failIfNoTrustStore) throws Exception {
|
||||
SSLContext sslcontext = SSLContext.getInstance("SSL"); //$NON-NLS-1$
|
||||
KeyManager[] keystoreManagers = null;
|
||||
if (keystorePath != null) {
|
||||
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509"); //$NON-NLS-1$
|
||||
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||
ks.load(new FileInputStream(keystorePath), keystorePass == null ? null : keystorePass.toCharArray());
|
||||
kmf.init(ks, keystorePass == null ? null : keystorePass.toCharArray());
|
||||
keystoreManagers = kmf.getKeyManagers();
|
||||
}
|
||||
|
||||
TrustManager[] truststoreManagers = null;
|
||||
if (trustStorePath != null) {
|
||||
TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509"); //$NON-NLS-1$
|
||||
KeyStore tks = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||
tks.load(new FileInputStream(trustStorePath), truststorePass.toCharArray());
|
||||
tmf.init(tks);
|
||||
truststoreManagers = tmf.getTrustManagers();
|
||||
}
|
||||
if (truststoreManagers == null && !failIfNoTrustStore) {
|
||||
truststoreManagers = new TrustManager[] { new TrustAnyTrustManager() };
|
||||
}
|
||||
sslcontext.init(keystoreManagers, truststoreManagers, null);
|
||||
return sslcontext;
|
||||
}
|
||||
|
||||
// accept all certificate
|
||||
private static class TrustAnyTrustManager implements X509TrustManager {
|
||||
// accept all certificates
|
||||
private class TrustAnyTrustManager implements X509TrustManager {
|
||||
|
||||
@Override
|
||||
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
|
||||
@@ -168,4 +288,211 @@ public class SSLUtils {
|
||||
return new X509Certificate[] {};
|
||||
}
|
||||
}
|
||||
|
||||
private class AllowAllHostnameVerifier implements HostnameVerifier {
|
||||
|
||||
public boolean verify(String hostname, SSLSession session) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private static class BrowserCompatibleHostnameVerifier implements HostnameVerifier {
|
||||
|
||||
private static final String[] BAD_COUNTRY_2LDS = { "ac", "co", "com", "ed", "edu", "go", "gouv", "gov", "info", "lg",
|
||||
"ne", "net", "or", "org" };
|
||||
|
||||
private static final Pattern IPV4_PATTERN = Pattern.compile(
|
||||
"^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$");
|
||||
|
||||
private static final Pattern IPV6_STD_PATTERN = Pattern.compile("^(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$");
|
||||
|
||||
private static final Pattern IPV6_HEX_COMPRESSED_PATTERN = Pattern
|
||||
.compile("^((?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4})*)?)::((?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4})*)?)$");
|
||||
|
||||
private static final char COLON_CHAR = ':';
|
||||
|
||||
// Must not have more than 7 colons (i.e. 8 fields)
|
||||
private static final int MAX_COLON_COUNT = 7;
|
||||
|
||||
public boolean verify(String host, SSLSession session) {
|
||||
try {
|
||||
Certificate[] certs = session.getPeerCertificates();
|
||||
X509Certificate x509 = (X509Certificate) certs[0];
|
||||
verify(host, x509);
|
||||
return true;
|
||||
} catch (SSLException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void verify(String host, X509Certificate cert) throws SSLException {
|
||||
String[] cns = getCNs(cert);
|
||||
String[] subjectAlts = getSubjectAlts(cert, host);
|
||||
verify(host, cns, subjectAlts);
|
||||
}
|
||||
|
||||
private void verify(final String host, final String[] cns, final String[] subjectAlts) throws SSLException {
|
||||
verify(host, cns, subjectAlts, false);
|
||||
}
|
||||
|
||||
private void verify(final String host, final String[] cns, final String[] subjectAlts, final boolean strictWithSubDomains)
|
||||
throws SSLException {
|
||||
LinkedList<String> names = new LinkedList<String>();
|
||||
if (cns != null && cns.length > 0 && cns[0] != null) {
|
||||
names.add(cns[0]);
|
||||
}
|
||||
if (subjectAlts != null) {
|
||||
for (String subjectAlt : subjectAlts) {
|
||||
if (subjectAlt != null) {
|
||||
names.add(subjectAlt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (names.isEmpty()) {
|
||||
String msg = "Certificate for <" + host + "> doesn't contain CN or DNS subjectAlt";
|
||||
throw new SSLException(msg);
|
||||
}
|
||||
|
||||
StringBuilder buf = new StringBuilder();
|
||||
String hostName = host.trim().toLowerCase(Locale.US);
|
||||
boolean match = false;
|
||||
for (Iterator<String> it = names.iterator(); it.hasNext();) {
|
||||
|
||||
String cn = it.next();
|
||||
cn = cn.toLowerCase(Locale.US);
|
||||
buf.append(" <");
|
||||
buf.append(cn);
|
||||
buf.append('>');
|
||||
if (it.hasNext()) {
|
||||
buf.append(" OR");
|
||||
}
|
||||
|
||||
String parts[] = cn.split("\\.");
|
||||
boolean doWildcard = parts.length >= 3 && parts[0].endsWith("*") && acceptableCountryWildcard(cn)
|
||||
&& !isIPAddress(host);
|
||||
|
||||
if (doWildcard) {
|
||||
String firstpart = parts[0];
|
||||
if (firstpart.length() > 1) { // e.g. server*
|
||||
String prefix = firstpart.substring(0, firstpart.length() - 1); // e.g. server
|
||||
String suffix = cn.substring(firstpart.length()); // skip wildcard part from cn
|
||||
String hostSuffix = hostName.substring(prefix.length()); // skip wildcard part from host
|
||||
match = hostName.startsWith(prefix) && hostSuffix.endsWith(suffix);
|
||||
} else {
|
||||
match = hostName.endsWith(cn.substring(1));
|
||||
}
|
||||
if (match && strictWithSubDomains) {
|
||||
match = countDots(hostName) == countDots(cn);
|
||||
}
|
||||
} else {
|
||||
match = hostName.equals(cn);
|
||||
}
|
||||
if (match) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!match) {
|
||||
throw new SSLException("hostname in certificate didn't match: <" + host + "> !=" + buf);
|
||||
}
|
||||
}
|
||||
|
||||
private String[] getCNs(X509Certificate cert) {
|
||||
LinkedList<String> cnList = new LinkedList<String>();
|
||||
String subjectPrincipal = cert.getSubjectX500Principal().toString();
|
||||
StringTokenizer st = new StringTokenizer(subjectPrincipal, ",+");
|
||||
while (st.hasMoreTokens()) {
|
||||
String tok = st.nextToken().trim();
|
||||
if (tok.length() > 3) {
|
||||
if (tok.substring(0, 3).equalsIgnoreCase("CN=")) {
|
||||
cnList.add(tok.substring(3));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!cnList.isEmpty()) {
|
||||
String[] cns = new String[cnList.size()];
|
||||
cnList.toArray(cns);
|
||||
return cns;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean acceptableCountryWildcard(String cn) {
|
||||
String parts[] = cn.split("\\.");
|
||||
if (parts.length != 3 || parts[2].length() != 2) {
|
||||
return true;
|
||||
}
|
||||
return Arrays.binarySearch(BAD_COUNTRY_2LDS, parts[1]) < 0;
|
||||
}
|
||||
|
||||
private boolean isIPAddress(final String hostname) {
|
||||
return hostname != null && (isIPv4Address(hostname) || isIPv6Address(hostname));
|
||||
}
|
||||
|
||||
private boolean isIPv4Address(final String input) {
|
||||
return IPV4_PATTERN.matcher(input).matches();
|
||||
}
|
||||
|
||||
private boolean isIPv6Address(final String input) {
|
||||
return isIPv6StdAddress(input) || isIPv6HexCompressedAddress(input);
|
||||
}
|
||||
|
||||
private boolean isIPv6StdAddress(final String input) {
|
||||
return IPV6_STD_PATTERN.matcher(input).matches();
|
||||
}
|
||||
|
||||
private boolean isIPv6HexCompressedAddress(final String input) {
|
||||
int colonCount = 0;
|
||||
for (int i = 0; i < input.length(); i++) {
|
||||
if (input.charAt(i) == COLON_CHAR) {
|
||||
colonCount++;
|
||||
}
|
||||
}
|
||||
return colonCount <= MAX_COLON_COUNT && IPV6_HEX_COMPRESSED_PATTERN.matcher(input).matches();
|
||||
}
|
||||
|
||||
private int countDots(final String s) {
|
||||
int count = 0;
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
if (s.charAt(i) == '.') {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
private String[] getSubjectAlts(final X509Certificate cert, final String hostname) {
|
||||
int subjectType;
|
||||
if (isIPAddress(hostname)) {
|
||||
subjectType = 7;
|
||||
} else {
|
||||
subjectType = 2;
|
||||
}
|
||||
|
||||
LinkedList<String> subjectAltList = new LinkedList<String>();
|
||||
Collection<List<?>> c = null;
|
||||
try {
|
||||
c = cert.getSubjectAlternativeNames();
|
||||
} catch (CertificateParsingException cpe) {
|
||||
}
|
||||
if (c != null) {
|
||||
for (List<?> aC : c) {
|
||||
List<?> list = aC;
|
||||
int type = ((Integer) list.get(0)).intValue();
|
||||
if (type == subjectType) {
|
||||
String s = (String) list.get(1);
|
||||
subjectAltList.add(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!subjectAltList.isEmpty()) {
|
||||
String[] subjectAlts = new String[subjectAltList.size()];
|
||||
subjectAltList.toArray(subjectAlts);
|
||||
return subjectAlts;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.nexus;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.talend.core.nexus.ArtifactRepositoryBean.NexusType;
|
||||
|
||||
/**
|
||||
* DOC jding class global comment. Detailled comment
|
||||
*/
|
||||
public class ArtifactRepositoryBeanTest {
|
||||
|
||||
@Test
|
||||
public void testSplitRepositoryUrl() {
|
||||
String repositoryType = ArtifactRepositoryBean.NexusType.ARTIFACTORY.name();
|
||||
// default contextpath artifactory
|
||||
String urlCase = "http://localhost:8081/artifactory/Releases/";
|
||||
// non-default contextpath
|
||||
String urlCase1 = "http://localhost:8081/artifacts/Releases/";
|
||||
// root contextpath
|
||||
String urlCase2 = "http://localhost:8081/Releases/";
|
||||
|
||||
String[] splitedUrl = NexusType.splitRepositoryUrl(urlCase, repositoryType);
|
||||
Assert.assertEquals("http://localhost:8081/artifactory/", splitedUrl[0]);
|
||||
Assert.assertEquals("Releases", splitedUrl[1]);
|
||||
|
||||
String[] splitedUrl_1 = NexusType.splitRepositoryUrl(urlCase1, repositoryType);
|
||||
Assert.assertEquals("http://localhost:8081/artifacts/", splitedUrl_1[0]);
|
||||
Assert.assertEquals("Releases", splitedUrl_1[1]);
|
||||
|
||||
String[] splitedUrl_2 = NexusType.splitRepositoryUrl(urlCase2, repositoryType);
|
||||
Assert.assertEquals("http://localhost:8081/", splitedUrl_2[0]);
|
||||
Assert.assertEquals("Releases", splitedUrl_2[1]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -164,9 +164,7 @@ public class ProjectPreferenceManagerTest {
|
||||
// if reload must set isCurrentProject
|
||||
ProjectPreferenceManager projectPrefManager = new ProjectPreferenceManager(testQualifier);
|
||||
IPreferenceStore originalStore = projectPrefManager.getPreferenceStore();
|
||||
ProjectScope originalScope = projectPrefManager.getProjectScope();
|
||||
projectPrefManager.reload();
|
||||
assertNotEquals(projectPrefManager.getProjectScope(), originalScope);
|
||||
assertNotEquals(projectPrefManager.getPreferenceStore(), originalStore);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ Bundle-Version: 7.2.1.qualifier
|
||||
Fragment-Host: org.talend.metadata.managment
|
||||
Require-Bundle: org.talend.testutils,
|
||||
org.talend.libraries.jdbc.mysql,
|
||||
org.talend.libraries.jdbc.teradata,
|
||||
org.eclipse.osgi.services
|
||||
Bundle-ClassPath: .
|
||||
Bundle-Vendor: .Talend SA.
|
||||
|
||||
Reference in New Issue
Block a user