Compare commits
37 Commits
patch/7.3.
...
patch/7.3.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3293b8f359 | ||
|
|
7527dda149 | ||
|
|
ddf653b4ea | ||
|
|
af3def7767 | ||
|
|
e7db5386c9 | ||
|
|
0b8f214c38 | ||
|
|
3c9684f993 | ||
|
|
de29a9fee4 | ||
|
|
e346460a75 | ||
|
|
294bb6a9c9 | ||
|
|
cb76ce50a7 | ||
|
|
e8e197e81c | ||
|
|
a5d5c0ef55 | ||
|
|
82b425506a | ||
|
|
932e8d61e3 | ||
|
|
6baf2b82be | ||
|
|
1331c1d70b | ||
|
|
e719944af0 | ||
|
|
333f9ad538 | ||
|
|
eede5c3bc2 | ||
|
|
cafb7db6b8 | ||
|
|
b042f20e49 | ||
|
|
c0fde38133 | ||
|
|
5efc4dd8c4 | ||
|
|
f5833bb365 | ||
|
|
548f6a97fd | ||
|
|
864ba43149 | ||
|
|
d0d955546b | ||
|
|
51cb13c619 | ||
|
|
e9d7c4a43c | ||
|
|
67d44985fa | ||
|
|
41f5d459f6 | ||
|
|
b38b96fedc | ||
|
|
df53ee1a1f | ||
|
|
035bc4a39c | ||
|
|
1105d9c65c | ||
|
|
488e7aaedb |
BIN
main/plugins/org.talend.common.ui.runtime/icons/lowercase.jpg
Normal file
BIN
main/plugins/org.talend.common.ui.runtime/icons/lowercase.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
BIN
main/plugins/org.talend.common.ui.runtime/icons/uppercase.jpg
Normal file
BIN
main/plugins/org.talend.common.ui.runtime/icons/uppercase.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
@@ -132,3 +132,8 @@ GlobalServiceRegister.ServiceNotRegistered=The service {0} has not been register
|
||||
MessageBoxExceptionHandler.showMessageForSchemaImportXml.unParseXML.title=The xml can't parse.
|
||||
MessageBoxExceptionHandler.showMessageForSchemaImportXml.unParseXML.msg=The xml can't parse in this format.
|
||||
HibernateUtils.auditDBIsNotUsable=The audit database must be empty or only contains tables related to audit.
|
||||
CasePushButton.CaseButton.Tip=Uppercase/Lowercase Db column
|
||||
QuotePushButton.QuoteButton.Tip=Add/Remove Quote on Db column
|
||||
QuoteManipulateDialog.title=Add/Remove quote on Db column
|
||||
QuoteManipulateDialog.addQuote=Add quote
|
||||
QuoteManipulateDialog.removeQuote=Remove quote
|
||||
|
||||
@@ -88,6 +88,8 @@ public enum EImage implements IImage {
|
||||
LEFTX_ICON("/icons/leftx.png"), //$NON-NLS-1$
|
||||
RIGHT_ICON("/icons/right.gif"), //$NON-NLS-1$
|
||||
RIGHTX_ICON("/icons/rightx.png"), //$NON-NLS-1$
|
||||
LOWERCASE_ICON("/icons/lowercase.jpg"), //$NON-NLS-1$
|
||||
UPPERCASE_ICON("/icons/uppercase.jpg"), //$NON-NLS-1$
|
||||
|
||||
KEY_ICON("/icons/key.gif"), //$NON-NLS-1$
|
||||
HIERARCHY_ICON("/icons/hierarchicalLayout.gif"), //$NON-NLS-1$
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package org.talend.commons.runtime.service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.FrameworkUtil;
|
||||
import org.osgi.framework.InvalidSyntaxException;
|
||||
import org.osgi.framework.ServiceReference;
|
||||
import org.talend.commons.exception.CommonExceptionHandler;
|
||||
|
||||
public interface ICollectDataService {
|
||||
|
||||
final String KEY_SOURCE = "source";
|
||||
|
||||
//
|
||||
final String AMC_FILE_TYPE_USED = "FILE_TYPE_USED";
|
||||
|
||||
final String AMC_DATABASE_TYPE_USED = "DATABASE_TYPE_USED";
|
||||
|
||||
final String AMC_PREVIEW_KEY = "amc.datasource";
|
||||
|
||||
final String AMC_PREVIEW_FILEVALUE = "File";
|
||||
|
||||
final String AMC_PREVIEW_DATABASEVALUE = "Database";
|
||||
|
||||
/**
|
||||
* @return json string
|
||||
*/
|
||||
String getCollectedDataJSON();
|
||||
|
||||
Properties getCollectedData();
|
||||
|
||||
public static ICollectDataService getInstance(String from) throws Exception {
|
||||
BundleContext bc = FrameworkUtil.getBundle(ICollectDataService.class).getBundleContext();
|
||||
Collection<ServiceReference<ICollectDataService>> tacokitServices = Collections.emptyList();
|
||||
try {
|
||||
tacokitServices = bc.getServiceReferences(ICollectDataService.class, null);
|
||||
} catch (InvalidSyntaxException e) {
|
||||
CommonExceptionHandler.process(e);
|
||||
}
|
||||
|
||||
if (tacokitServices != null) {
|
||||
for (ServiceReference<ICollectDataService> sr : tacokitServices) {
|
||||
if (from == null || from.equals(sr.getProperty(KEY_SOURCE))) {
|
||||
ICollectDataService tacokitService = bc.getService(sr);
|
||||
if (tacokitService != null) {
|
||||
return tacokitService;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,8 @@
|
||||
// ============================================================================
|
||||
package org.talend.commons.runtime.service;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
|
||||
/**
|
||||
* DOC ggu class global comment. Detailled comment
|
||||
*/
|
||||
@@ -19,6 +21,10 @@ public interface P2InstallComponent {
|
||||
|
||||
boolean install();
|
||||
|
||||
default boolean install(IProgressMonitor monitor) {
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean needRelaunch();
|
||||
|
||||
String getInstalledMessages();
|
||||
|
||||
@@ -29,6 +29,8 @@ public interface IExtendedList<T> extends List<T> {
|
||||
public void swapElements(List<Integer> indicesOrigin, List<Integer> indicesTarget);
|
||||
|
||||
public void swapElement(T object1, T object2);
|
||||
|
||||
public void replaceElement(int index, T object2);
|
||||
|
||||
/**
|
||||
* Getter for useEquals.
|
||||
|
||||
@@ -537,6 +537,11 @@ public class ListenableList<T> implements IExtendedList<T> {
|
||||
fireReplacedEvent(index, replacedObject, element, false);
|
||||
return replacedObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void replaceElement(int index, T element) {
|
||||
this.list.set(index, element);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
|
||||
@@ -16,7 +16,6 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -109,11 +108,11 @@ public class DB2ForZosDataBaseMetadata extends PackageFakeDatabaseMetadata {
|
||||
// MOD yyin 2012-05-15 TDQ-5190
|
||||
String sql = "SELECT DISTINCT CREATOR FROM SYSIBM.SYSTABLES"; //$NON-NLS-1$
|
||||
ResultSet rs = null;
|
||||
Statement stmt = null;
|
||||
PreparedStatement stmt = null;
|
||||
List<String[]> list = new ArrayList<String[]>();
|
||||
try {
|
||||
stmt = connection.createStatement();
|
||||
rs = stmt.executeQuery(sql);
|
||||
stmt = connection.prepareStatement(sql);
|
||||
rs = stmt.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
String creator = rs.getString("CREATOR"); //$NON-NLS-1$
|
||||
@@ -331,18 +330,20 @@ public class DB2ForZosDataBaseMetadata extends PackageFakeDatabaseMetadata {
|
||||
public ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern)
|
||||
throws SQLException {
|
||||
// for real
|
||||
String sql = "SELECT * FROM SYSIBM.SYSCOLUMNS where TBNAME='" + tableNamePattern + "' AND TBCREATOR = '" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ schemaPattern + "' ORDER BY TBCREATOR, TBNAME, COLNO"; //$NON-NLS-1$
|
||||
String sql = "SELECT * FROM SYSIBM.SYSCOLUMNS where TBNAME=? AND TBCREATOR = ? ORDER BY TBCREATOR, TBNAME, COLNO"; //$NON-NLS-1$
|
||||
|
||||
// for test
|
||||
// String sql = "SELECT * FROM SYSIBM.SYSCOLUMNS where NAME='NAME'";
|
||||
|
||||
ResultSet rs = null;
|
||||
Statement stmt = null;
|
||||
PreparedStatement stmt = null;
|
||||
List<String[]> list = new ArrayList<String[]>();
|
||||
try {
|
||||
stmt = connection.createStatement();
|
||||
rs = stmt.executeQuery(sql);
|
||||
stmt = connection.prepareStatement(sql);
|
||||
stmt.setString(1, tableNamePattern);
|
||||
stmt.setString(2, schemaPattern);
|
||||
|
||||
rs = stmt.executeQuery();
|
||||
while (rs.next()) {
|
||||
|
||||
// For real db2 for zos, should use these code.
|
||||
|
||||
@@ -25,7 +25,6 @@ public class JtdsDatabaseMetadata extends PackageFakeDatabaseMetadata {
|
||||
|
||||
@Override
|
||||
public ResultSet getSchemas() throws SQLException {
|
||||
java.sql.Statement statement = connection.createStatement();
|
||||
String sql;
|
||||
if (((PackageFakeDatabaseMetadata) connection).getDatabaseMajorVersion() >= 9) {
|
||||
sql = JDBC3 ? "SELECT name AS TABLE_SCHEM, NULL as TABLE_CATALOG FROM " + connection.getCatalog() + ".sys.schemas"
|
||||
@@ -36,6 +35,7 @@ public class JtdsDatabaseMetadata extends PackageFakeDatabaseMetadata {
|
||||
}
|
||||
|
||||
sql += " ORDER BY TABLE_SCHEM";
|
||||
return statement.executeQuery(sql);
|
||||
java.sql.PreparedStatement statement = connection.prepareStatement(sql);
|
||||
return statement.executeQuery();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
package org.talend.commons.utils.database;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -152,15 +152,19 @@ public class SAPHanaDataBaseMetadata extends FakeDatabaseMetaData {
|
||||
// check if the type is contained is in the types needed.
|
||||
String sqlcv = "SELECT OBJECT_NAME,PACKAGE_ID FROM _SYS_REPO.ACTIVE_OBJECT WHERE OBJECT_SUFFIX = 'calculationview'"; //$NON-NLS-1$
|
||||
if (tableNamePattern != null && !tableNamePattern.equals("%")) { //$NON-NLS-1$
|
||||
sqlcv += " AND (OBJECT_NAME LIKE '" + tableNamePattern + "'"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
sqlcv += " OR PACKAGE_ID LIKE '" + tableNamePattern + "')"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
sqlcv += " AND (OBJECT_NAME LIKE ?"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
sqlcv += " OR PACKAGE_ID LIKE ? )"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
ResultSet rscv = null;
|
||||
Statement stmtcv = null;
|
||||
PreparedStatement stmtcv = null;
|
||||
List<String[]> listcv = new ArrayList<String[]>();
|
||||
try {
|
||||
stmtcv = connection.createStatement();
|
||||
rscv = stmtcv.executeQuery(sqlcv);
|
||||
stmtcv = connection.prepareStatement(sqlcv);
|
||||
if (tableNamePattern != null && !tableNamePattern.equals("%")) {
|
||||
stmtcv.setString(1, tableNamePattern);
|
||||
stmtcv.setString(2, tableNamePattern);
|
||||
}
|
||||
rscv = stmtcv.executeQuery();
|
||||
while (rscv.next()) {
|
||||
String objectName = rscv.getString("OBJECT_NAME"); //$NON-NLS-1$
|
||||
if (objectName != null) {
|
||||
@@ -303,11 +307,11 @@ public class SAPHanaDataBaseMetadata extends FakeDatabaseMetaData {
|
||||
if (!load) {
|
||||
String sqlcv = "SELECT * from \"" + schemaPattern + "\".\"" + tableNamePattern + "\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
ResultSet rscv = null;
|
||||
Statement stmtcv = null;
|
||||
PreparedStatement stmtcv = null;
|
||||
List<String[]> listcv = new ArrayList<String[]>();
|
||||
try {
|
||||
stmtcv = connection.createStatement();
|
||||
rscv = stmtcv.executeQuery(sqlcv);
|
||||
stmtcv = connection.prepareStatement(sqlcv);
|
||||
rscv = stmtcv.executeQuery();
|
||||
int i = 1;
|
||||
while (rscv.next()) {
|
||||
String tableName = tableNamePattern;
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
package org.talend.commons.utils.database;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -62,11 +62,11 @@ public class SASDataBaseMetadata extends FakeDatabaseMetaData {
|
||||
// see the feature 5827
|
||||
String sql = "SELECT DISTINCT LIBNAME FROM SASHELP.VTABLE"; //$NON-NLS-1$
|
||||
ResultSet rs = null;
|
||||
Statement stmt = null;
|
||||
PreparedStatement stmt = null;
|
||||
List<String[]> list = new ArrayList<String[]>();
|
||||
try {
|
||||
stmt = connection.createStatement();
|
||||
rs = stmt.executeQuery(sql);
|
||||
stmt = connection.prepareStatement(sql);
|
||||
rs = stmt.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
String creator = rs.getString("LIBNAME"); //$NON-NLS-1$
|
||||
@@ -147,17 +147,21 @@ public class SASDataBaseMetadata extends FakeDatabaseMetaData {
|
||||
public ResultSet getTables(String catalog, String schema, String tableNamePattern, String[] types) throws SQLException {
|
||||
String sql;
|
||||
if (schema != null) {
|
||||
sql = "SELECT * FROM SASHELP.VTABLE where LIBNAME = '" + schema + "'"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
sql = "SELECT * FROM SASHELP.VTABLE where LIBNAME = ?"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
} else {
|
||||
sql = "SELECT * FROM SASHELP.VTABLE"; //$NON-NLS-1$
|
||||
}
|
||||
ResultSet rs = null;
|
||||
Statement stmt = null;
|
||||
PreparedStatement stmt = null;
|
||||
List<String[]> list = new ArrayList<String[]>();
|
||||
try {
|
||||
stmt = connection.createStatement();
|
||||
rs = stmt.executeQuery(sql);
|
||||
stmt = connection.prepareStatement(sql);
|
||||
if (schema != null) {
|
||||
stmt.setString(1, schema);
|
||||
}
|
||||
|
||||
rs = stmt.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
String name = rs.getString("MEMNAME"); //$NON-NLS-1$
|
||||
@@ -229,18 +233,20 @@ public class SASDataBaseMetadata extends FakeDatabaseMetaData {
|
||||
public ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern)
|
||||
throws SQLException {
|
||||
// for real
|
||||
String sql = "SELECT * FROM SASHELP.VCOLUMN where MEMNAME='" + tableNamePattern + "' AND LIBNAME = '" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ schemaPattern + "' ORDER BY LIBNAME, MEMNAME, VARNUM"; //$NON-NLS-1$
|
||||
String sql = "SELECT * FROM SASHELP.VCOLUMN where MEMNAME=? AND LIBNAME = ? ORDER BY LIBNAME, MEMNAME, VARNUM"; //$NON-NLS-1$
|
||||
|
||||
// for test
|
||||
// String sql = "SELECT * FROM SYSIBM.SYSCOLUMNS where NAME='NAME'";
|
||||
|
||||
ResultSet rs = null;
|
||||
Statement stmt = null;
|
||||
PreparedStatement stmt = null;
|
||||
List<String[]> list = new ArrayList<String[]>();
|
||||
try {
|
||||
stmt = connection.createStatement();
|
||||
rs = stmt.executeQuery(sql);
|
||||
stmt = connection.prepareStatement(sql);
|
||||
stmt.setString(1, tableNamePattern);
|
||||
stmt.setString(2, schemaPattern);
|
||||
|
||||
rs = stmt.executeQuery();
|
||||
while (rs.next()) {
|
||||
String tableName = rs.getString("MEMNAME"); //$NON-NLS-1$
|
||||
if (tableName != null) {
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
package org.talend.commons.utils.database;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -52,10 +52,12 @@ public class Sybase16SADatabaseMetaData extends SybaseDatabaseMetaData {
|
||||
for (String catalogName : catList) {
|
||||
String sql = createSqlByLoginAndCatalog(login, catalogName);
|
||||
ResultSet rs = null;
|
||||
Statement stmt = null;
|
||||
PreparedStatement stmt = null;
|
||||
try {
|
||||
stmt = connection.createStatement();
|
||||
rs = stmt.executeQuery(sql);
|
||||
stmt = connection.prepareStatement(sql);
|
||||
stmt.setString(1, login);
|
||||
|
||||
rs = stmt.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
int temp = rs.getInt(1);
|
||||
@@ -113,8 +115,7 @@ public class Sybase16SADatabaseMetaData extends SybaseDatabaseMetaData {
|
||||
*/
|
||||
protected String createSqlByLoginAndCatalog(String loginName, String catalogName) {
|
||||
String sql = "select count(*) from " + catalogName
|
||||
+ ".dbo.sysusers where suid in (select suid from "+catalogName+".dbo.syslogins where name = '" + loginName
|
||||
+ "')";
|
||||
+ ".dbo.sysusers where suid in (select suid from " + catalogName + ".dbo.syslogins where name = ? )";
|
||||
return sql;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
package org.talend.commons.utils.database;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -54,10 +54,13 @@ public class SybaseDatabaseMetaData extends PackageFakeDatabaseMetadata {
|
||||
for (String catalogName : catList) {
|
||||
String sql = createSqlByLoginAndCatalog(login, catalogName);
|
||||
ResultSet rs = null;
|
||||
Statement stmt = null;
|
||||
PreparedStatement stmt = null;
|
||||
try {
|
||||
stmt = connection.createStatement();
|
||||
rs = stmt.executeQuery(sql);
|
||||
stmt = connection.prepareStatement(sql);
|
||||
stmt.setString(1, login);
|
||||
stmt.setString(2, login);
|
||||
|
||||
rs = stmt.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
int temp = rs.getInt(1);
|
||||
@@ -92,11 +95,11 @@ public class SybaseDatabaseMetaData extends PackageFakeDatabaseMetadata {
|
||||
public ResultSet getSchemas(String catalog, String schemaPattern) throws SQLException {
|
||||
String sql = "SELECT DISTINCT name FROM " + catalog + ".dbo.sysusers where suid > 0"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
ResultSet rs = null;
|
||||
Statement stmt = null;
|
||||
PreparedStatement stmt = null;
|
||||
List<String[]> list = new ArrayList<String[]>();
|
||||
try {
|
||||
stmt = connection.createStatement();
|
||||
rs = stmt.executeQuery(sql);
|
||||
stmt = connection.prepareStatement(sql);
|
||||
rs = stmt.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
String name = rs.getString("name"); //$NON-NLS-1$
|
||||
@@ -136,9 +139,9 @@ public class SybaseDatabaseMetaData extends PackageFakeDatabaseMetadata {
|
||||
*/
|
||||
protected String createSqlByLoginAndCatalog(String loginName, String catalogName) {
|
||||
return "select count(*) from " + catalogName //$NON-NLS-1$
|
||||
+ ".dbo.sysusers where suid in (select suid from master.dbo.syslogins where name = '" + loginName //$NON-NLS-1$
|
||||
+ "') or suid in (select altsuid from " + catalogName //$NON-NLS-1$
|
||||
+ ".dbo.sysalternates a, master.dbo.syslogins b where b.name = '" + loginName + "' and a.suid = b.suid)"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ ".dbo.sysusers where suid in (select suid from master.dbo.syslogins where name = ?"
|
||||
+ ") or suid in (select altsuid from " + catalogName //$NON-NLS-1$
|
||||
+ ".dbo.sysalternates a, master.dbo.syslogins b where b.name = ? and a.suid = b.suid)"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
package org.talend.commons.utils.database;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -97,13 +97,12 @@ public class TeradataDataBaseMetadata extends FakeDatabaseMetaData {
|
||||
int dbMajorVersion = connection.getMetaData().getDatabaseMajorVersion();
|
||||
String sql = "HELP COLUMN \"" + schema + "\".\"" + table + "\".* ";//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
|
||||
ResultSet rs = null;
|
||||
Statement stmt = null;
|
||||
PreparedStatement stmt = null;
|
||||
String columnName = null;
|
||||
List<String[]> list = new ArrayList<String[]>();
|
||||
try {
|
||||
if (dbMajorVersion > 12) {
|
||||
sql = "SELECT * from DBC.INDICESV WHERE UPPER(databasename) = UPPER('" + schema //$NON-NLS-1$
|
||||
+ "') AND UPPER(tablename) = UPPER('" + table + "') AND UPPER(UniqueFlag) = UPPER('Y')"; //$NON-NLS-1$//$NON-NLS-2$
|
||||
sql = "SELECT * from DBC.INDICESV WHERE UPPER(databasename) = UPPER(?) AND UPPER(tablename) = UPPER(?) AND UPPER(UniqueFlag) = UPPER('Y')"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
rs = getResultSet(catalog, schema, table, sql);
|
||||
while (rs.next()) {
|
||||
columnName = rs.getString("ColumnName").trim(); //$NON-NLS-1$
|
||||
@@ -112,8 +111,11 @@ public class TeradataDataBaseMetadata extends FakeDatabaseMetaData {
|
||||
list.add(r);
|
||||
}
|
||||
} else {
|
||||
stmt = connection.createStatement();
|
||||
rs = stmt.executeQuery(sql);
|
||||
stmt = connection.prepareStatement(sql);
|
||||
stmt.setString(1, schema);
|
||||
stmt.setString(2, table);
|
||||
|
||||
rs = stmt.executeQuery();
|
||||
while (rs.next()) {
|
||||
columnName = rs.getString("Column Name").trim(); //$NON-NLS-1$
|
||||
String pk = rs.getString("Primary?");//$NON-NLS-1$
|
||||
@@ -138,10 +140,10 @@ public class TeradataDataBaseMetadata extends FakeDatabaseMetaData {
|
||||
|
||||
public ResultSet getResultSet(String catalog, String schema, String table, String sql) throws SQLException {
|
||||
ResultSet rs = null;
|
||||
Statement stmt = null;
|
||||
PreparedStatement stmt = null;
|
||||
try {
|
||||
stmt = connection.createStatement();
|
||||
rs = stmt.executeQuery(sql);
|
||||
stmt = connection.prepareStatement(sql);
|
||||
rs = stmt.executeQuery();
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@@ -203,17 +205,15 @@ public class TeradataDataBaseMetadata extends FakeDatabaseMetaData {
|
||||
sysTable = "DBC.TABLESV";//$NON-NLS-1$
|
||||
}
|
||||
if (types != null && types.length > 0) {
|
||||
sql = "SELECT * from " + sysTable + " WHERE UPPER(databasename) = UPPER('" + database //$NON-NLS-1$//$NON-NLS-2$
|
||||
+ "') AND tablekind " + addTypesToSql(types); //$NON-NLS-1$
|
||||
sql = "SELECT * from " + sysTable + " WHERE UPPER(databasename) = UPPER(?) AND tablekind " + addTypesToSql(types); //$NON-NLS-1$
|
||||
} else {
|
||||
// When the types is empty, all the tables and views will be retrieved.
|
||||
sql = "SELECT * from " + sysTable + " WHERE UPPER(databasename) = UPPER('" + database //$NON-NLS-1$//$NON-NLS-2$
|
||||
+ "') AND (tablekind = 'T' or tablekind = 'V')"; //$NON-NLS-1$
|
||||
sql = "SELECT * from " + sysTable + " WHERE UPPER(databasename) = UPPER(?) AND (tablekind = 'T' or tablekind = 'V')"; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
// add the filter for table/views
|
||||
if (!StringUtils.isEmpty(tableNamePattern)) {
|
||||
sql = sql + " AND tablename LIKE '" + tableNamePattern + "'";//$NON-NLS-1$//$NON-NLS-2$
|
||||
sql = sql + " AND tablename LIKE ?";//$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
|
||||
if (types != null && types.length > 0) {
|
||||
@@ -223,11 +223,18 @@ public class TeradataDataBaseMetadata extends FakeDatabaseMetaData {
|
||||
}
|
||||
|
||||
ResultSet rs = null;
|
||||
Statement stmt = null;
|
||||
PreparedStatement stmt = null;
|
||||
List<String[]> list = new ArrayList<String[]>();
|
||||
try {
|
||||
stmt = connection.createStatement();
|
||||
rs = stmt.executeQuery(sql);
|
||||
stmt = connection.prepareStatement(sql);
|
||||
stmt.setString(1, database);
|
||||
|
||||
// add the filter for table/views
|
||||
if (!StringUtils.isEmpty(tableNamePattern)) {
|
||||
stmt.setString(2, tableNamePattern);
|
||||
}
|
||||
|
||||
rs = stmt.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
String name = rs.getString("TableName").trim(); //$NON-NLS-1$
|
||||
@@ -326,21 +333,33 @@ public class TeradataDataBaseMetadata extends FakeDatabaseMetaData {
|
||||
if (!StringUtils.isEmpty(database)) {
|
||||
sql = "HELP COLUMN \"" + database + "\".\"" + tableNamePattern + "\".* ";//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
|
||||
if (dbMajorVersion > 12) {
|
||||
sql = "SELECT * from DBC.COLUMNSV WHERE UPPER(databasename) = UPPER('" + database //$NON-NLS-1$
|
||||
+ "') AND UPPER(tablename) = UPPER('" + tableNamePattern + "')" + " Order by tablename "; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
|
||||
sql = "SELECT * from DBC.COLUMNSV WHERE UPPER(databasename) = UPPER(?) AND UPPER(tablename) = UPPER(?)" //$NON-NLS-1$
|
||||
+ " Order by tablename "; //$NON-NLS-1$ //$NON-NLS-3$
|
||||
}
|
||||
} else {
|
||||
sql = "HELP COLUMN \"" + tableNamePattern + "\".* ";//$NON-NLS-1$//$NON-NLS-2$
|
||||
if (dbMajorVersion > 12) {
|
||||
sql = "SELECT * from DBC.COLUMNSV WHERE UPPER(tablename) = UPPER('" + tableNamePattern + "')" + " Order by tablename "; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
|
||||
sql = "SELECT * from DBC.COLUMNSV WHERE UPPER(tablename) = UPPER(?)" + " Order by tablename "; //$NON-NLS-1$//$NON-NLS-2$
|
||||
// //$NON-NLS-3$
|
||||
}
|
||||
}
|
||||
ResultSet rs = null;
|
||||
Statement stmt = null;
|
||||
PreparedStatement stmt = null;
|
||||
List<String[]> list = new ArrayList<String[]>();
|
||||
try {
|
||||
stmt = connection.createStatement();
|
||||
rs = stmt.executeQuery(sql);
|
||||
stmt = connection.prepareStatement(sql);
|
||||
if (!StringUtils.isEmpty(database)) {
|
||||
if (dbMajorVersion > 12) {
|
||||
stmt.setString(1, database);
|
||||
stmt.setString(2, tableNamePattern);
|
||||
}
|
||||
} else {
|
||||
if (dbMajorVersion > 12) {
|
||||
stmt.setString(1, tableNamePattern);
|
||||
}
|
||||
}
|
||||
|
||||
rs = stmt.executeQuery();
|
||||
while (rs.next()) {
|
||||
String tableName = tableNamePattern;
|
||||
String columnName = null;
|
||||
|
||||
@@ -76,6 +76,8 @@ ExtendedTableMoveCommand.MoveLabel=Move up or down, one or more table entries
|
||||
ExtendedTablePasteCommand.Paste.Label=Paste data from the internal clipoard
|
||||
ExtendedTableRemoveCommand.Romve.Label=Remove table entries
|
||||
ExtendedTableResetDBTypesCommand.ResetDBTypes.Label=Reset all DB Types to get the defaults
|
||||
ExtendedTableCaseCommand.case.Label=Change selected DB columns to uppercase/lowercase
|
||||
ExtendedTableQuoteCommand.Quote.Label=Quote selected DB columns
|
||||
ImportPushButton.ImportButton.Tip=Replace all rows by import from xml file
|
||||
ImportPushButtonForExtendedTable.ErrorMsg.Text=Error occurred
|
||||
LabelledFileField.BrowseButton.Text=Browse...
|
||||
|
||||
@@ -27,11 +27,13 @@ import org.talend.commons.ui.swt.advanced.dataeditor.button.MoveDownPushButtonFo
|
||||
import org.talend.commons.ui.swt.advanced.dataeditor.button.MoveUpPushButton;
|
||||
import org.talend.commons.ui.swt.advanced.dataeditor.button.MoveUpPushButtonForExtendedTable;
|
||||
import org.talend.commons.ui.swt.advanced.dataeditor.button.PastePushButton;
|
||||
import org.talend.commons.ui.swt.advanced.dataeditor.button.QuotePushButton;
|
||||
import org.talend.commons.ui.swt.advanced.dataeditor.button.RemovePushButton;
|
||||
import org.talend.commons.ui.swt.advanced.dataeditor.button.RemovePushButtonForExtendedTable;
|
||||
import org.talend.commons.ui.swt.advanced.dataeditor.button.ResetDBTypesPushButton;
|
||||
import org.talend.commons.ui.swt.advanced.dataeditor.button.SaveAsGenericSchemaPushButton;
|
||||
import org.talend.commons.ui.swt.advanced.dataeditor.button.SelectContextVariablesPushButton;
|
||||
import org.talend.commons.ui.swt.advanced.dataeditor.button.CasePushButton;
|
||||
import org.talend.commons.ui.swt.advanced.dataeditor.control.ExtendedPushButton;
|
||||
import org.talend.commons.ui.swt.extended.table.AbstractExtendedTableViewer;
|
||||
|
||||
@@ -67,7 +69,11 @@ public class ExtendedToolbarView extends AbstractExtendedToolbar {
|
||||
protected ResetDBTypesPushButton resetDBTypesButton;
|
||||
|
||||
protected SelectContextVariablesPushButton selectContextVariablesButton;
|
||||
|
||||
protected CasePushButton caseButton;
|
||||
|
||||
protected QuotePushButton quoteButton;
|
||||
|
||||
/**
|
||||
* DOC amaumont MatadataToolbarEditor constructor comment.
|
||||
*
|
||||
@@ -103,7 +109,11 @@ public class ExtendedToolbarView extends AbstractExtendedToolbar {
|
||||
pasteButton = createPastePushButton();
|
||||
|
||||
addallButton = createAddAllPushButton();
|
||||
|
||||
|
||||
caseButton = createCasePushButton();
|
||||
|
||||
quoteButton = createQuotePushButton();
|
||||
|
||||
exportButton = createExportPushButton();
|
||||
|
||||
importButton = createImportPushButton();
|
||||
@@ -169,6 +179,14 @@ public class ExtendedToolbarView extends AbstractExtendedToolbar {
|
||||
protected SelectContextVariablesPushButton createSelectContextVariablesPushButton() {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected CasePushButton createCasePushButton() {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected QuotePushButton createQuotePushButton() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for addButton.
|
||||
@@ -327,6 +345,14 @@ public class ExtendedToolbarView extends AbstractExtendedToolbar {
|
||||
if (getAddallButton() != null) {
|
||||
list.add(getAddallButton());
|
||||
}
|
||||
|
||||
if (getCaseButton() != null) {
|
||||
list.add(getCaseButton());
|
||||
}
|
||||
|
||||
if (getQuoteButton() != null) {
|
||||
list.add(getQuoteButton());
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
@@ -348,6 +374,26 @@ public class ExtendedToolbarView extends AbstractExtendedToolbar {
|
||||
public AddAllPushButton getAddallButton() {
|
||||
return this.addallButton;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for caseButton.
|
||||
*
|
||||
* @return the caseButton
|
||||
*/
|
||||
public CasePushButton getCaseButton() {
|
||||
return this.caseButton;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Getter for quoteButton.
|
||||
*
|
||||
* @return the quoteButton
|
||||
*/
|
||||
public QuotePushButton getQuoteButton() {
|
||||
return this.quoteButton;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.commons.ui.swt.advanced.dataeditor.button;
|
||||
|
||||
import org.eclipse.gef.commands.Command;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.talend.commons.ui.runtime.i18n.Messages;
|
||||
import org.talend.commons.ui.runtime.image.EImage;
|
||||
import org.talend.commons.ui.runtime.image.ImageProvider;
|
||||
import org.talend.commons.ui.swt.advanced.dataeditor.control.ExtendedPushButton;
|
||||
import org.talend.commons.ui.swt.extended.table.AbstractExtendedControlViewer;
|
||||
|
||||
public abstract class CasePushButton extends ExtendedPushButton {
|
||||
|
||||
/**
|
||||
* DOC CasePushButton constructor comment.
|
||||
*
|
||||
* @param parent
|
||||
* @param extendedControlViewer
|
||||
*/
|
||||
public CasePushButton(Composite parent, AbstractExtendedControlViewer extendedControlViewer) {
|
||||
super(parent, extendedControlViewer,
|
||||
Messages.getString("CasePushButton.CaseButton.Tip"), ImageProvider.getImage(EImage.UPPERCASE_ICON)); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
protected abstract Command getCommandToExecute();
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.commons.ui.swt.advanced.dataeditor.control.ExtendedPushButton#getEnabledState()
|
||||
*/
|
||||
@Override
|
||||
public boolean getEnabledState() {
|
||||
return super.getEnabledState() && !getExtendedControlViewer().isReadOnly();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.commons.ui.swt.advanced.dataeditor.button;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.gef.commands.Command;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.jface.viewers.TableViewer;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.talend.commons.ui.runtime.i18n.Messages;
|
||||
import org.talend.commons.ui.runtime.image.EImage;
|
||||
import org.talend.commons.ui.runtime.image.ImageProvider;
|
||||
import org.talend.commons.ui.swt.extended.table.AbstractExtendedTableViewer;
|
||||
import org.talend.commons.ui.swt.extended.table.ExtendedTableModel;
|
||||
|
||||
public abstract class CasePushButtonForExtendedTable extends CasePushButton implements IExtendedTablePushButton {
|
||||
|
||||
private EnableStateListenerForTableButton enableStateHandler;
|
||||
private boolean isUpperCase = true;
|
||||
|
||||
/**
|
||||
* DOC CasePushButtonForExtendedTable constructor comment.
|
||||
*
|
||||
* @param parent
|
||||
* @param extendedControlViewer
|
||||
*/
|
||||
public CasePushButtonForExtendedTable(Composite parent, AbstractExtendedTableViewer extendedTableViewer) {
|
||||
super(parent, extendedTableViewer);
|
||||
this.enableStateHandler = new EnableStateListenerForTableButton(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void afterCommandExecution(Command executedCommand) {
|
||||
super.afterCommandExecution(executedCommand);
|
||||
if (isUpperCase) {
|
||||
this.getButton().setToolTipText( Messages.getString("CasePushButton.CaseButton.Tip"));
|
||||
this.getButton().setImage(ImageProvider.getImage(EImage.LOWERCASE_ICON));
|
||||
this.isUpperCase = false;
|
||||
} else {
|
||||
this.getButton().setToolTipText( Messages.getString("CasePushButton.CaseButton.Tip"));
|
||||
this.getButton().setImage(ImageProvider.getImage(EImage.UPPERCASE_ICON));
|
||||
this.isUpperCase = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Command getCommandToExecute() {
|
||||
AbstractExtendedTableViewer extendedTableViewer = (AbstractExtendedTableViewer) extendedControlViewer;
|
||||
ExtendedTableModel extendedTableModel = extendedTableViewer.getExtendedTableModel();
|
||||
TableViewer tableViewer = extendedTableViewer.getTableViewerCreator().getTableViewer();
|
||||
ISelection selection = tableViewer.getSelection();
|
||||
StructuredSelection structuredSelection = (StructuredSelection) selection;
|
||||
Object[] objects = structuredSelection.toArray();
|
||||
int[] selectionIndices = extendedTableViewer.getTableViewerCreator().getTable().getSelectionIndices();
|
||||
return getCommandToExecute(extendedTableModel, Arrays.asList(objects), selectionIndices, isUpperCase);
|
||||
}
|
||||
|
||||
protected abstract Command getCommandToExecute(ExtendedTableModel extendedTable, List beansToUppercase, int[] selectionIndices, boolean isUpperCase);
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.core.ui.extended.button.IExtendedTablePushButton#getExtendedTableViewer()
|
||||
*/
|
||||
public AbstractExtendedTableViewer getExtendedTableViewer() {
|
||||
return (AbstractExtendedTableViewer) getExtendedControlViewer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getEnabledState() {
|
||||
return super.getEnabledState() && this.enableStateHandler.getEnabledState();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.commons.ui.swt.advanced.dataeditor.button;
|
||||
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.talend.commons.ui.runtime.i18n.Messages;
|
||||
import org.talend.commons.ui.runtime.image.EImage;
|
||||
import org.talend.commons.ui.runtime.image.ImageProvider;
|
||||
import org.talend.commons.ui.swt.advanced.dataeditor.control.ExtendedPushButton;
|
||||
import org.talend.commons.ui.swt.extended.table.AbstractExtendedControlViewer;
|
||||
|
||||
public abstract class QuotePushButton extends ExtendedPushButton {
|
||||
|
||||
private String dbmsId = null;
|
||||
|
||||
/**
|
||||
* DOC QuotePushButton constructor comment.
|
||||
*
|
||||
* @param parent
|
||||
* @param extendedControlViewer
|
||||
*/
|
||||
public QuotePushButton(Composite parent, AbstractExtendedControlViewer extendedControlViewer) {
|
||||
super(parent, extendedControlViewer,
|
||||
Messages.getString("QuotePushButton.QuoteButton.Tip"), ImageProvider.getImage(EImage.EDIT_ICON)); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.commons.ui.swt.advanced.dataeditor.control.ExtendedPushButton#getEnabledState()
|
||||
*/
|
||||
@Override
|
||||
public boolean getEnabledState() {
|
||||
return super.getEnabledState() && !getExtendedControlViewer().isReadOnly();
|
||||
}
|
||||
|
||||
|
||||
public String getDbmsId() {
|
||||
return dbmsId;
|
||||
}
|
||||
|
||||
|
||||
public void setDbmsId(String dbmsId) {
|
||||
this.dbmsId = dbmsId;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.commons.ui.swt.advanced.dataeditor.button;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.gef.commands.Command;
|
||||
import org.eclipse.jface.dialogs.Dialog;
|
||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.jface.viewers.TableViewer;
|
||||
import org.eclipse.jface.window.Window;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.ModifyEvent;
|
||||
import org.eclipse.swt.events.ModifyListener;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
import org.talend.commons.ui.runtime.i18n.Messages;
|
||||
import org.talend.commons.ui.swt.extended.table.AbstractExtendedTableViewer;
|
||||
import org.talend.commons.ui.swt.extended.table.ExtendedTableModel;
|
||||
|
||||
public abstract class QuotePushButtonForExtendedTable extends QuotePushButton implements IExtendedTablePushButton {
|
||||
|
||||
private String quote = null;
|
||||
private boolean isAddingQuote = true;
|
||||
private EnableStateListenerForTableButton enableStateHandler;
|
||||
|
||||
/**
|
||||
* DOC SchemaTargetAddPushButton constructor comment.
|
||||
*
|
||||
* @param parent
|
||||
* @param extendedControlViewer
|
||||
*/
|
||||
public QuotePushButtonForExtendedTable(Composite parent, AbstractExtendedTableViewer extendedTableViewer) {
|
||||
super(parent, extendedTableViewer);
|
||||
this.enableStateHandler = new EnableStateListenerForTableButton(this);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.commons.ui.swt.advanced.dataeditor.control.ExtendedPushButton#beforeCommandExecution()
|
||||
*/
|
||||
@Override
|
||||
protected void beforeCommandExecution() {
|
||||
QuoteManipulateDialog dlg = new QuoteManipulateDialog(getButton().getShell());
|
||||
if (dlg.open() == Window.OK) {
|
||||
this.quote = dlg.getQuote();
|
||||
this.isAddingQuote = dlg.isAddingQuote();
|
||||
}
|
||||
}
|
||||
|
||||
protected Command getCommandToExecute() {
|
||||
if (quote == null) return null;
|
||||
AbstractExtendedTableViewer extendedTableViewer = (AbstractExtendedTableViewer) extendedControlViewer;
|
||||
ExtendedTableModel extendedTableModel = extendedTableViewer.getExtendedTableModel();
|
||||
TableViewer tableViewer = extendedTableViewer.getTableViewerCreator().getTableViewer();
|
||||
ISelection selection = tableViewer.getSelection();
|
||||
StructuredSelection structuredSelection = (StructuredSelection) selection;
|
||||
Object[] objects = structuredSelection.toArray();
|
||||
int[] selectionIndices = extendedTableViewer.getTableViewerCreator().getTable().getSelectionIndices();
|
||||
return getCommandToExecute(extendedTableModel, Arrays.asList(objects), selectionIndices, quote, isAddingQuote );
|
||||
}
|
||||
|
||||
protected abstract Command getCommandToExecute(ExtendedTableModel extendedTable, List beansToUppercase, int[] selectionIndices, String quote, boolean isAddingQuote);
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.core.ui.extended.button.IExtendedTablePushButton#getExtendedTableViewer()
|
||||
*/
|
||||
public AbstractExtendedTableViewer getExtendedTableViewer() {
|
||||
return (AbstractExtendedTableViewer) getExtendedControlViewer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getEnabledState() {
|
||||
return super.getEnabledState() && this.enableStateHandler.getEnabledState();
|
||||
}
|
||||
|
||||
class QuoteManipulateDialog extends Dialog {
|
||||
|
||||
private Button addBtn;
|
||||
private Button removeBtn;
|
||||
private Text quoteTxt;
|
||||
private Button okBtn;
|
||||
boolean isAddingQuote = true;
|
||||
String quote = "";
|
||||
|
||||
public QuoteManipulateDialog(Shell parentShel) {
|
||||
super(parentShel);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
|
||||
*/
|
||||
protected void configureShell(Shell shell) {
|
||||
super.configureShell(shell);
|
||||
shell.setText(Messages.getString("QuoteManipulateDialog.title"));
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
|
||||
*/
|
||||
protected void createButtonsForButtonBar(Composite parent) {
|
||||
// create OK and Cancel buttons by default
|
||||
okBtn = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
|
||||
createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
|
||||
okBtn.setEnabled(false);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc) Method declared on Dialog.
|
||||
*/
|
||||
protected Control createDialogArea(Composite parent) {
|
||||
Composite composite = new Composite(parent, SWT.NONE);
|
||||
GridLayout layout = new GridLayout();
|
||||
layout.numColumns = 4;
|
||||
composite.setLayout(layout);
|
||||
GridData layoutData = new GridData(GridData.FILL_BOTH);
|
||||
layoutData.widthHint = 400;
|
||||
composite.setLayoutData(layoutData);
|
||||
addBtn = new Button(composite, SWT.RADIO);
|
||||
addBtn.setSelection(true);
|
||||
Label label = new Label(composite, SWT.WRAP);
|
||||
label.setText(Messages.getString("QuoteManipulateDialog.addQuote")); //$NON-NLS-1$
|
||||
|
||||
removeBtn = new Button(composite, SWT.RADIO);
|
||||
Label label1 = new Label(composite, SWT.WRAP);
|
||||
label1.setText(Messages.getString("QuoteManipulateDialog.removeQuote")); //$NON-NLS-1$
|
||||
|
||||
quoteTxt = new Text(composite, SWT.SINGLE | SWT.BORDER);
|
||||
layoutData = new GridData(GridData.FILL_HORIZONTAL);
|
||||
layoutData.horizontalSpan = 4;
|
||||
quoteTxt.setLayoutData(layoutData);
|
||||
quoteTxt.setText("");
|
||||
quoteTxt.setFocus();
|
||||
|
||||
addBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
isAddingQuote = true;
|
||||
quoteTxt.setFocus();
|
||||
quote = quoteTxt.getText();
|
||||
}
|
||||
});
|
||||
|
||||
removeBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
isAddingQuote = false;
|
||||
quoteTxt.setFocus();
|
||||
quote = quoteTxt.getText();
|
||||
}
|
||||
});
|
||||
|
||||
quoteTxt.addModifyListener(new ModifyListener() {
|
||||
|
||||
public void modifyText(ModifyEvent e) {
|
||||
quote = quoteTxt.getText();
|
||||
if ( quote != null && quote.length() > 0) {
|
||||
okBtn.setEnabled(true);
|
||||
} else {
|
||||
okBtn.setEnabled(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return composite;
|
||||
}
|
||||
|
||||
public boolean isAddingQuote() {
|
||||
return this.isAddingQuote;
|
||||
}
|
||||
|
||||
public String getQuote() {
|
||||
return this.quote;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.commons.ui.swt.advanced.dataeditor.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.gef.commands.Command;
|
||||
import org.talend.commons.ui.runtime.i18n.Messages;
|
||||
import org.talend.commons.ui.swt.extended.table.ExtendedTableModel;
|
||||
|
||||
public abstract class ExtendedTableCaseCommand extends Command implements IExtendedTableCommand {
|
||||
|
||||
private ExtendedTableModel extendedTable;
|
||||
|
||||
private List beansToCovertCase;
|
||||
|
||||
private int[] selectionIndices;
|
||||
|
||||
private boolean isUpperCase;
|
||||
|
||||
|
||||
public static final String LABEL = Messages.getString("ExtendedTableCaseCommand.case.Label"); //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* DOC ExtendedTableCaseCommand constructor comment.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")//$NON-NLS-1$
|
||||
public ExtendedTableCaseCommand(ExtendedTableModel extendedTable, List beansToCovertCase, int[] selectionIndices, boolean isUpperCase) {
|
||||
super(LABEL);
|
||||
this.extendedTable = extendedTable;
|
||||
this.beansToCovertCase = new ArrayList(beansToCovertCase);
|
||||
this.selectionIndices = selectionIndices;
|
||||
this.isUpperCase = isUpperCase;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.gef.commands.Command#execute()
|
||||
*/
|
||||
@Override
|
||||
public void execute() {
|
||||
convertCase(extendedTable, beansToCovertCase, selectionIndices, isUpperCase);
|
||||
|
||||
}
|
||||
|
||||
public abstract void convertCase(ExtendedTableModel extendedTable, List copiedObjectsList, int[] selectionIndices, boolean isUpperCase);
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.commons.ui.command.CommonCommand#canUndo()
|
||||
*/
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.commons.ui.command.CommonCommand#redo()
|
||||
*/
|
||||
@Override
|
||||
public void redo() {
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.commons.ui.command.CommonCommand#undo()
|
||||
*/
|
||||
@Override
|
||||
public void undo() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.commons.ui.swt.advanced.dataeditor.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.eclipse.gef.commands.Command;
|
||||
import org.talend.commons.ui.runtime.i18n.Messages;
|
||||
import org.talend.commons.ui.swt.extended.table.ExtendedTableModel;
|
||||
|
||||
public abstract class ExtendedTableQuoteCommand extends Command implements IExtendedTableCommand {
|
||||
|
||||
private ExtendedTableModel extendedTable;
|
||||
|
||||
private List beansToQuote;
|
||||
|
||||
private int[] selectionIndices;
|
||||
|
||||
private String quote;
|
||||
|
||||
boolean isAddingQuote;
|
||||
|
||||
|
||||
public static final String LABEL = Messages.getString("ExtendedTableQuoteCommand.Quote.Label"); //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* DOC ExtendedTableQuoteCommand constructor comment.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")//$NON-NLS-1$
|
||||
public ExtendedTableQuoteCommand(ExtendedTableModel extendedTable, List beansToQuote, int[] selectionIndices, String quote, boolean isAddingQuote) {
|
||||
super(LABEL);
|
||||
this.extendedTable = extendedTable;
|
||||
this.beansToQuote = new ArrayList(beansToQuote);
|
||||
this.selectionIndices = selectionIndices;
|
||||
this.quote = quote;
|
||||
this.isAddingQuote = isAddingQuote;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.gef.commands.Command#execute()
|
||||
*/
|
||||
@Override
|
||||
public void execute() {
|
||||
toQuote(extendedTable, beansToQuote, selectionIndices, quote, isAddingQuote);
|
||||
|
||||
}
|
||||
|
||||
public abstract void toQuote(ExtendedTableModel extendedTable, List copiedObjectsList, int[] selectionIndices, String quote, boolean isAddingQuote);
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.commons.ui.command.CommonCommand#canUndo()
|
||||
*/
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.commons.ui.command.CommonCommand#redo()
|
||||
*/
|
||||
@Override
|
||||
public void redo() {
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.commons.ui.command.CommonCommand#undo()
|
||||
*/
|
||||
@Override
|
||||
public void undo() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -178,6 +178,23 @@ public class ExtendedTableModel<B> extends AbstractExtendedControlModel {
|
||||
public void setUseEquals(boolean useEquals) {
|
||||
beansList.setUseEquals(useEquals);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Replace bean.
|
||||
*
|
||||
* @param bean
|
||||
* @param index can be null
|
||||
*/
|
||||
public void replace(B bean, Integer index) {
|
||||
|
||||
if (tableViewer != null && !tableViewer.getTable().isDisposed()) {
|
||||
tableViewer.replace(bean, index);
|
||||
tableViewer.refresh(bean, true, true);
|
||||
}
|
||||
this.beansList.replaceElement(index, bean);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* DOC amaumont Comment method "remove".
|
||||
|
||||
@@ -12,11 +12,14 @@
|
||||
// ============================================================================
|
||||
package org.talend.core.repository.model;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -623,8 +626,7 @@ public abstract class AbstractEMFRepositoryFactory extends AbstractRepositoryFac
|
||||
stream.close();
|
||||
|
||||
byte[] currentContent = item.getContent().getInnerContent();
|
||||
|
||||
if (!Arrays.equals(innerContent, currentContent)) {
|
||||
if (!isSameStringContent(innerContent, currentContent)) {
|
||||
item.getContent().setInnerContent(innerContent);
|
||||
Project project = getRepositoryContext().getProject();
|
||||
save(project, item);
|
||||
@@ -641,6 +643,44 @@ public abstract class AbstractEMFRepositoryFactory extends AbstractRepositoryFac
|
||||
throw new PersistenceException(ioe);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isSameStringContent(byte[] data1, byte[] data2) throws IOException {
|
||||
boolean isSame = true;
|
||||
BufferedReader br1 = null, br2 = null;
|
||||
try {
|
||||
br1 = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(data1), StandardCharsets.UTF_8.toString()));
|
||||
br2 = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(data2), StandardCharsets.UTF_8.toString()));
|
||||
String line1 = null, line2 = null;
|
||||
while (isSame) {
|
||||
line1 = br1.readLine();
|
||||
line2 = br2.readLine();
|
||||
if ((line1 == null && line2 == null)) {
|
||||
break;
|
||||
}
|
||||
if (!StringUtils.equals(line1, line2)) {
|
||||
isSame = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
if (br1 != null) {
|
||||
try {
|
||||
br1.close();
|
||||
} catch (IOException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
if (br2 != null) {
|
||||
try {
|
||||
br2.close();
|
||||
} catch (IOException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return isSame;
|
||||
}
|
||||
|
||||
private void createSQLPattern(URL url, String sqlPatternLabel, String categoryName) throws PersistenceException {
|
||||
if (url == null) {
|
||||
@@ -693,8 +733,7 @@ public abstract class AbstractEMFRepositoryFactory extends AbstractRepositoryFac
|
||||
stream.close();
|
||||
|
||||
byte[] currentContent = item.getContent().getInnerContent();
|
||||
|
||||
if (!Arrays.equals(innerContent, currentContent)) {
|
||||
if (!isSameStringContent(innerContent, currentContent)) {
|
||||
item.getContent().setInnerContent(innerContent);
|
||||
Project project = getRepositoryContext().getProject();
|
||||
save(project, item);
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/resty-0.3.2.jar" />
|
||||
<classpathentry exported="true" kind="lib" path="lib/delight-rhino-sandbox-0.0.15.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/rhino-1.7.13.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/resty-0.3.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/json_simple-1.1.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
|
||||
@@ -129,5 +129,7 @@ Bundle-Activator: org.talend.core.runtime.CoreRuntimePlugin
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-ClassPath: .,
|
||||
lib/resty-0.3.2.jar,
|
||||
lib/json_simple-1.1.jar
|
||||
lib/json_simple-1.1.jar,
|
||||
lib/delight-rhino-sandbox-0.0.15.jar,
|
||||
lib/rhino-1.7.13.jar
|
||||
Eclipse-RegisterBuddy: org.talend.testutils
|
||||
|
||||
@@ -12,7 +12,9 @@ bin.includes = META-INF/,\
|
||||
lib/,\
|
||||
talend_metadata_columns_schema.xsd,\
|
||||
talend_targetschema_columns_schema.xsd,\
|
||||
dist/
|
||||
dist/,\
|
||||
lib/delight-rhino-sandbox-0.0.15.jar,\
|
||||
lib/rhino-1.7.13.jar
|
||||
src.includes = META-INF/,\
|
||||
mappingMetadataTypes.xml,\
|
||||
mappings/,\
|
||||
|
||||
@@ -9,19 +9,61 @@
|
||||
</parent>
|
||||
<artifactId>org.talend.core.runtime</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
<dependencies>
|
||||
<!-- https://mvnrepository.com/artifact/org.javadelight/delight-rhino-sandbox -->
|
||||
<dependency>
|
||||
<groupId>org.javadelight</groupId>
|
||||
<artifactId>delight-rhino-sandbox</artifactId>
|
||||
<version>0.0.15</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.mozilla/rhino -->
|
||||
<dependency>
|
||||
<groupId>org.mozilla</groupId>
|
||||
<artifactId>rhino</artifactId>
|
||||
<version>1.7.13</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.8.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-deploy</id>
|
||||
<phase>deploy</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-dependencies</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.basedir}/lib</outputDirectory>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>org.javadelight</groupId>
|
||||
<artifactId>delight-rhino-sandbox</artifactId>
|
||||
<version>0.0.15</version>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>org.mozilla</groupId>
|
||||
<artifactId>rhino</artifactId>
|
||||
<version>1.7.13</version>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.8.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-deploy</id>
|
||||
<phase>deploy</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -84,7 +84,11 @@ public enum EDatabaseVersion4Drivers {
|
||||
MSSQL_2012(new DbVersion4Drivers(EDatabaseTypeName.MSSQL,
|
||||
"Microsoft SQL Server 2012", "Microsoft SQL Server 2012", "jtds-1.3.1-patch-20190523.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
MSSQL_PROP(new DbVersion4Drivers(EDatabaseTypeName.MSSQL,
|
||||
"Microsoft", "MSSQL_PROP", "mssql-jdbc.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"Microsoft", "MSSQL_PROP", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
new String[] { "mssql-jdbc.jar", "slf4j-api-1.7.25.jar", "slf4j-log4j12-1.7.25.jar", "adal4j-1.6.5.jar", //$NON-NLS-1$
|
||||
"commons-lang3-3.10.jar", "commons-codec-1.14.jar", "gson-2.8.6.jar", "oauth2-oidc-sdk-6.5.jar",
|
||||
"json-smart-2.4.2.jar", "nimbus-jose-jwt-8.11.jar", "javax.mail-1.6.2.jar", "log4j-1.2.17.jar",
|
||||
"accessors-smart-1.1.jar", "asm-5.0.3.jar" })),
|
||||
|
||||
VERTICA_9(new DbVersion4Drivers(EDatabaseTypeName.VERTICA, "VERTICA 9.X", "VERTICA_9_0", "vertica-jdbc-9.3.1-0.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
VERTICA_7_1_X(new DbVersion4Drivers(EDatabaseTypeName.VERTICA, "VERTICA 7.1.X (Deprecated)", "VERTICA_7_1_X", "vertica-jdbc-7.1.2-0.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
|
||||
@@ -26,11 +26,6 @@ public enum ECustomVersionGroup {
|
||||
|
||||
MAPRDB,
|
||||
|
||||
PIG,
|
||||
|
||||
PIG_HBASE,
|
||||
PIG_HCATALOG,
|
||||
|
||||
MAP_REDUCE,
|
||||
|
||||
SPARK,
|
||||
|
||||
@@ -18,12 +18,6 @@ public enum ECustomVersionType {
|
||||
|
||||
MAPRDB("Maprdb", ECustomVersionGroup.MAPRDB), //$NON-NLS-1$
|
||||
|
||||
PIG("Pig", ECustomVersionGroup.PIG), //$NON-NLS-1$
|
||||
|
||||
PIG_HBASE("Pig for HBase", ECustomVersionGroup.PIG_HBASE), //$NON-NLS-1$
|
||||
|
||||
PIG_HCATALOG("Pig for Hcatalog", ECustomVersionGroup.PIG_HCATALOG), //$NON-NLS-1$
|
||||
|
||||
MAP_REDUCE("Map Reduce", ECustomVersionGroup.MAP_REDUCE), //$NON-NLS-1$
|
||||
|
||||
SPARK("Spark", ECustomVersionGroup.SPARK), //$NON-NLS-1$
|
||||
|
||||
@@ -483,7 +483,7 @@ public class HadoopCustomVersionDefineDialog extends TitleAreaDialog {
|
||||
|
||||
private boolean isSupportHadoop() {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IHadoopService.class)) {
|
||||
hadoopService = (IHadoopService) GlobalServiceRegister.getDefault().getService(IHadoopService.class);
|
||||
hadoopService = GlobalServiceRegister.getDefault().getService(IHadoopService.class);
|
||||
}
|
||||
|
||||
return hadoopService != null;
|
||||
@@ -503,11 +503,7 @@ public class HadoopCustomVersionDefineDialog extends TitleAreaDialog {
|
||||
private ECustomVersionType[] filterTypes(Object[] types) {
|
||||
Object[] filteredTypes = ArrayUtils.removeElement(types, ECustomVersionType.ALL);
|
||||
IDesignerCoreService designerCoreService = CoreRuntimePlugin.getInstance().getDesignerCoreService();
|
||||
INode node = designerCoreService.getRefrenceNode("tPigLoad"); //$NON-NLS-1$
|
||||
if (node == null) {
|
||||
filteredTypes = ArrayUtils.removeElement(filteredTypes, ECustomVersionType.PIG);
|
||||
}
|
||||
node = designerCoreService.getRefrenceNode("tMRConfiguration", ComponentCategory.CATEGORY_4_MAPREDUCE.getName());//$NON-NLS-1$
|
||||
INode node = designerCoreService.getRefrenceNode("tMRConfiguration", ComponentCategory.CATEGORY_4_MAPREDUCE.getName());//$NON-NLS-1$
|
||||
if (node == null) {
|
||||
filteredTypes = ArrayUtils.removeElement(filteredTypes, ECustomVersionType.MAP_REDUCE);
|
||||
}
|
||||
|
||||
@@ -425,7 +425,7 @@ public class HadoopVersionDialog extends TitleAreaDialog {
|
||||
if (isFromExistVersion) {
|
||||
IHadoopService hadoopService = null;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IHadoopService.class)) {
|
||||
hadoopService = (IHadoopService) GlobalServiceRegister.getDefault().getService(IHadoopService.class);
|
||||
hadoopService = GlobalServiceRegister.getDefault().getService(IHadoopService.class);
|
||||
}
|
||||
if (hadoopService != null) {
|
||||
for (ECustomVersionGroup group : existVersionSelectionMap.keySet()) {
|
||||
@@ -437,10 +437,7 @@ public class HadoopVersionDialog extends TitleAreaDialog {
|
||||
for (ECustomVersionType type : types) {
|
||||
if (type.getGroup() == group) {
|
||||
Set<String> hadoopLibraries = new HashSet<String>();
|
||||
if (ECustomVersionType.PIG == type || ECustomVersionType.PIG_HBASE == type
|
||||
|| ECustomVersionType.PIG_HCATALOG == type) {
|
||||
hadoopLibraries = getLibrariesForPig(type);
|
||||
} else if (ECustomVersionType.MAP_REDUCE == type) {
|
||||
if (ECustomVersionType.MAP_REDUCE == type) {
|
||||
hadoopLibraries = getLibrariesForMapReduce(type);
|
||||
} else if (ECustomVersionType.SPARK == type || ECustomVersionType.SPARK_STREAMING == type) {
|
||||
hadoopLibraries = getLibrariesForSpark(type);
|
||||
@@ -542,42 +539,6 @@ public class HadoopVersionDialog extends TitleAreaDialog {
|
||||
return neededLibraries;
|
||||
}
|
||||
|
||||
private Set<String> getLibrariesForPig(ECustomVersionType type) {
|
||||
Set<String> neededLibraries = new HashSet<String>();
|
||||
INode node = CoreRuntimePlugin.getInstance().getDesignerCoreService().getRefrenceNode("tPigLoad");//$NON-NLS-1$
|
||||
|
||||
IElementParameter elementParameter = node.getElementParameter("MAPREDUCE");//$NON-NLS-1$
|
||||
if (elementParameter != null) {
|
||||
elementParameter.setValue(true);
|
||||
}
|
||||
elementParameter = node.getElementParameter("DISTRIBUTION");//$NON-NLS-1$
|
||||
if (elementParameter != null) {
|
||||
elementParameter.setValue(distribution);
|
||||
}
|
||||
|
||||
elementParameter = node.getElementParameter("PIG_VERSION");//$NON-NLS-1$
|
||||
if (elementParameter != null) {
|
||||
elementParameter.setValue(version);
|
||||
}
|
||||
|
||||
elementParameter = node.getElementParameter("LOAD");//$NON-NLS-1$
|
||||
if (elementParameter != null) {
|
||||
if (ECustomVersionType.PIG_HBASE == type) {
|
||||
elementParameter.setValue("HBASESTORAGE");//$NON-NLS-1$
|
||||
} else if (ECustomVersionType.PIG_HCATALOG == type) {
|
||||
elementParameter.setValue("HCATLOADER");//$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
List<ModuleNeeded> modulesNeeded = node.getModulesNeeded();
|
||||
for (ModuleNeeded module : modulesNeeded) {
|
||||
if (module.isRequired(node.getElementParameters())) {
|
||||
neededLibraries.add(module.getModuleName());
|
||||
}
|
||||
}
|
||||
return neededLibraries;
|
||||
}
|
||||
|
||||
public Map<ECustomVersionType, Map<String, Object>> getTypeConfigurations() {
|
||||
return this.typeConfigurations;
|
||||
}
|
||||
|
||||
@@ -106,4 +106,6 @@ public interface ISAPConstant {
|
||||
public static final String PROP_DB_USERNAME = "db.username";//$NON-NLS-1$
|
||||
|
||||
public static final String PROP_DB_PASSWORD = "db.password";//$NON-NLS-1$
|
||||
}
|
||||
|
||||
public static final String PROP_DB_ADDITIONAL_PROPERTIES = "db.additionalProperties";//$NON-NLS-1$
|
||||
}
|
||||
@@ -32,9 +32,7 @@ import org.talend.core.database.EDatabaseTypeName;
|
||||
import org.talend.core.database.conn.ConnParameterKeys;
|
||||
import org.talend.core.database.conn.template.EDatabaseConnTemplate;
|
||||
import org.talend.core.database.conn.version.EDatabaseVersion4Drivers;
|
||||
import org.talend.core.hadoop.IHadoopClusterService;
|
||||
import org.talend.core.hadoop.repository.HadoopRepositoryUtil;
|
||||
import org.talend.core.hadoop.version.custom.ECustomVersionGroup;
|
||||
import org.talend.core.language.ECodeLanguage;
|
||||
import org.talend.core.language.LanguageManager;
|
||||
import org.talend.core.model.metadata.EMetadataEncoding;
|
||||
@@ -443,6 +441,13 @@ public class RepositoryToComponentProperty {
|
||||
} else {
|
||||
return TalendQuoteUtils.addQuotes(connection.getValue(dbPassword, false));
|
||||
}
|
||||
} else if ("SAPHANA_PROPERTIES_STRING".equals(value)) { //$NON-NLS-1$
|
||||
String dbParameters = TaggedValueHelper.getValueString(ISAPConstant.PROP_DB_ADDITIONAL_PROPERTIES, connection);
|
||||
if (isContextMode(connection, dbParameters)) {
|
||||
return dbParameters;
|
||||
} else {
|
||||
return TalendQuoteUtils.addQuotes(dbParameters);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -1536,22 +1541,6 @@ public class RepositoryToComponentProperty {
|
||||
}
|
||||
|
||||
if (value.equals("HADOOP_CUSTOM_JARS")) {
|
||||
if (targetComponent != null && targetComponent.startsWith("tPig")) {
|
||||
// for pig component
|
||||
String clusterID = connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HADOOP_CLUSTER_ID);
|
||||
if (clusterID != null) {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IHadoopClusterService.class)) {
|
||||
IHadoopClusterService hadoopClusterService = GlobalServiceRegister.getDefault()
|
||||
.getService(IHadoopClusterService.class);
|
||||
Map<String, String> hadoopCustomLibraries = hadoopClusterService.getHadoopCustomLibraries(clusterID);
|
||||
|
||||
if (EDatabaseTypeName.HBASE.getDisplayName().equals(connection.getDatabaseType())) {
|
||||
return hadoopCustomLibraries.get(ECustomVersionGroup.PIG_HBASE.getName()) == null ? ""
|
||||
: hadoopCustomLibraries.get(ECustomVersionGroup.PIG_HBASE.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HADOOP_CUSTOM_JARS);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
// ============================================================================
|
||||
package org.talend.core.model.process;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -133,4 +134,8 @@ public interface IProcess extends IElement {
|
||||
public String getComponentsType();
|
||||
|
||||
public INode getNodeByUniqueName(String uniqueName);
|
||||
|
||||
default List<? extends INode> getProcessNodes() {
|
||||
return new ArrayList<INode>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,6 +67,8 @@ public class JobInfo {
|
||||
|
||||
private boolean needUnloadProcessor;
|
||||
|
||||
private int includeESBFlag = 0;
|
||||
|
||||
public JobInfo(String jobId, String contextName, String version) {
|
||||
this.jobId = jobId;
|
||||
this.contextName = contextName;
|
||||
@@ -572,4 +574,13 @@ public class JobInfo {
|
||||
public boolean isNeedUnloadProcessor() {
|
||||
return this.needUnloadProcessor;
|
||||
}
|
||||
|
||||
public int getIncludeESBFlag() {
|
||||
return includeESBFlag;
|
||||
}
|
||||
|
||||
public void setIncludeESBFlag(int includeESBFlag) {
|
||||
this.includeESBFlag = includeESBFlag;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -52,4 +52,6 @@ public interface IRepositoryPrefConstants {
|
||||
public static final String ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS = "allow_specific_characters_for_schema_columns";
|
||||
|
||||
public static final String REF_PROJECT_BRANCH_SETTING = "ref_project_branch_setting";
|
||||
|
||||
public static final String ITEM_EXPORT_DEPENDENCIES = "item_export_dependencies";
|
||||
}
|
||||
|
||||
@@ -21,14 +21,13 @@ import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.locks.ReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.script.Bindings;
|
||||
import javax.script.ScriptContext;
|
||||
import javax.script.ScriptEngine;
|
||||
import javax.script.ScriptEngineManager;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.oro.text.regex.MalformedPatternException;
|
||||
import org.apache.oro.text.regex.PatternCompiler;
|
||||
@@ -36,6 +35,7 @@ import org.apache.oro.text.regex.Perl5Compiler;
|
||||
import org.apache.oro.text.regex.Perl5Matcher;
|
||||
import org.apache.oro.text.regex.Perl5Substitution;
|
||||
import org.apache.oro.text.regex.Util;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.talend.commons.utils.PasswordEncryptUtil;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.language.ECodeLanguage;
|
||||
@@ -55,6 +55,9 @@ import org.talend.designer.core.model.utils.emf.talendfile.ContextParameterType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ContextType;
|
||||
import org.talend.repository.model.RepositoryConstants;
|
||||
|
||||
import delight.rhinosandox.RhinoSandbox;
|
||||
import delight.rhinosandox.RhinoSandboxes;
|
||||
|
||||
/**
|
||||
* Utilities to work with IContextParamet objects. <br/>
|
||||
*
|
||||
@@ -81,6 +84,12 @@ public final class ContextParameterUtils {
|
||||
|
||||
private static final String NON_CONTEXT_PATTERN = "[^a-zA-Z0-9_]"; //$NON-NLS-1$
|
||||
|
||||
private static final RhinoSandbox SANDBOX = RhinoSandboxes.create();
|
||||
|
||||
private static final Map<String, Object> CTX_VARS_LAST = new HashMap<String, Object>();
|
||||
|
||||
private static ReadWriteLock CTX_VARS_LOCK = new ReentrantReadWriteLock();
|
||||
|
||||
/**
|
||||
* Constructs a new ContextParameterUtils.
|
||||
*/
|
||||
@@ -203,10 +212,37 @@ public final class ContextParameterUtils {
|
||||
}
|
||||
}
|
||||
|
||||
private static ScriptEngine engine = new ScriptEngineManager().getEngineByName("JavaScript");
|
||||
|
||||
public static ScriptEngine getScriptEngine() {
|
||||
return engine;
|
||||
private static String preProcessScript(String script) {
|
||||
String newCode = script;
|
||||
CTX_VARS_LOCK.readLock().lock();
|
||||
try {
|
||||
Set<Entry<String, Object>> entries = CTX_VARS_LAST.entrySet();
|
||||
|
||||
for (Entry<String, Object> entry : entries) {
|
||||
String val = entry.getValue().toString();
|
||||
if (entry.getValue() instanceof String) {
|
||||
val = "\"" + val.replace("\"", "\\\"") + "\"";
|
||||
}
|
||||
|
||||
newCode = newCode.replace(JAVA_NEW_CONTEXT_PREFIX + entry.getKey(), val);
|
||||
}
|
||||
} finally {
|
||||
CTX_VARS_LOCK.readLock().unlock();
|
||||
}
|
||||
|
||||
return newCode;
|
||||
}
|
||||
|
||||
public static boolean isValidLiteralValue(String value) {
|
||||
String newCode = preProcessScript(value);
|
||||
try {
|
||||
SANDBOX.eval(null, newCode);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static String convertContext2Literal4AnyVar(final String code, final IContext context) {
|
||||
@@ -220,23 +256,22 @@ public final class ContextParameterUtils {
|
||||
|
||||
Object result = code;
|
||||
|
||||
if (engine == null) {
|
||||
engine = new ScriptEngineManager().getEngineByName("JavaScript");
|
||||
Map<String, Object> varMap = getVarMapForScriptEngine(context);
|
||||
|
||||
CTX_VARS_LOCK.writeLock().lock();
|
||||
try {
|
||||
CTX_VARS_LAST.clear();
|
||||
CTX_VARS_LAST.putAll(varMap);
|
||||
} finally {
|
||||
CTX_VARS_LOCK.writeLock().unlock();
|
||||
}
|
||||
|
||||
if (engine == null) {
|
||||
throw new RuntimeException("can't find the script engine");
|
||||
}
|
||||
String newCode = preProcessScript(code);
|
||||
|
||||
Bindings binding = engine.getBindings(ScriptContext.ENGINE_SCOPE);
|
||||
if (binding != null) {
|
||||
binding.clear();
|
||||
Map<String, Object> varMap = getVarMapForScriptEngine(context);
|
||||
binding.put("context", varMap);
|
||||
}
|
||||
try {
|
||||
String replacement = " ";
|
||||
result = engine.eval(code.replace("\r\n", replacement).replace("\n", replacement).replace("\r", replacement));
|
||||
result = SANDBOX.eval(null,
|
||||
newCode.replace("\r\n", replacement).replace("\n", replacement).replace("\r", replacement));
|
||||
} catch (Exception e) {
|
||||
// ignore the exception
|
||||
}
|
||||
@@ -293,7 +328,7 @@ public final class ContextParameterUtils {
|
||||
List<String> mvnValues = new ArrayList<>();
|
||||
IGenericDBService dbService = null;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericDBService.class)) {
|
||||
dbService = (IGenericDBService) GlobalServiceRegister.getDefault().getService(IGenericDBService.class);
|
||||
dbService = GlobalServiceRegister.getDefault().getService(IGenericDBService.class);
|
||||
}
|
||||
for (String value : values) {
|
||||
try {
|
||||
@@ -614,7 +649,11 @@ public final class ContextParameterUtils {
|
||||
}
|
||||
|
||||
private static boolean isAllowSpecificCharacters() {
|
||||
return CoreRuntimePlugin.getInstance().getProjectPreferenceManager().isAllowSpecificCharacters();
|
||||
if (Platform.isRunning()) {
|
||||
return CoreRuntimePlugin.getInstance().getProjectPreferenceManager().isAllowSpecificCharacters();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isEmptyParameter(String source) {
|
||||
|
||||
@@ -27,9 +27,6 @@ import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.script.ScriptEngine;
|
||||
import javax.script.ScriptException;
|
||||
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.model.components.ComponentCategory;
|
||||
import org.talend.core.model.components.IComponent;
|
||||
@@ -1086,14 +1083,7 @@ public class NodeUtil {
|
||||
}
|
||||
|
||||
private static boolean isValidLiteralValue(String value) {
|
||||
ScriptEngine se = ContextParameterUtils.getScriptEngine();
|
||||
if(se==null) return true;
|
||||
try {
|
||||
se.eval(value);
|
||||
return true;
|
||||
} catch (ScriptException e) {
|
||||
return false;
|
||||
}
|
||||
return ContextParameterUtils.isValidLiteralValue(value);
|
||||
}
|
||||
|
||||
private static String checkStringQuotationMarks(String str) {
|
||||
|
||||
@@ -46,6 +46,8 @@ public interface MavenConstants {
|
||||
|
||||
static final String EXCLUDE_DELETED_ITEMS = "EXCLUDE_DELETED_ITEMS";
|
||||
|
||||
static final String SKIP_LOOP_DEPENDENCY_CHECK = "SKIP_LOOP_DEPENDENCY_CHECK";
|
||||
|
||||
static final String SKIP_FOLDERS = "SKIP_FOLDERS";
|
||||
|
||||
/*
|
||||
|
||||
@@ -80,4 +80,13 @@ public interface TalendProcessOptionConstants {
|
||||
*/
|
||||
public static final int MODULES_WITH_CODESJAR = 1 << 6;
|
||||
|
||||
/**
|
||||
* flag for check if is ESB job
|
||||
*/
|
||||
public static final int ISESB_CHECKED = 1;
|
||||
|
||||
public static final int ISESB_CHILDREN_INCLUDE = 1 << 1;
|
||||
|
||||
public static final int ISESB_CURRENT_INCLUDE = 1 << 2;
|
||||
|
||||
}
|
||||
|
||||
@@ -150,6 +150,8 @@ public interface IGenericWizardService extends IService {
|
||||
*/
|
||||
public ITreeContextualAction getDefaultAction(RepositoryNode node);
|
||||
|
||||
public ITreeContextualAction getGenericAction(String typeName, String location);
|
||||
|
||||
public void loadAdditionalJDBC();
|
||||
|
||||
public List<String> getAllAdditionalJDBCTypes();
|
||||
|
||||
@@ -147,4 +147,6 @@ public interface IJobletProviderService extends IService {
|
||||
|
||||
public void updateJobleModifiedRelated(Item item, String oldName, String newName);
|
||||
|
||||
public IProcess getJobletGEFProcessFromNode(INode node);
|
||||
|
||||
}
|
||||
|
||||
@@ -258,6 +258,8 @@ public interface IRunProcessService extends IService {
|
||||
|
||||
public boolean isExcludeDeletedItems(Property property);
|
||||
|
||||
public boolean getMavenPrefOptionStatus(String prefName);
|
||||
|
||||
public static IRunProcessService get() {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
|
||||
return GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
|
||||
|
||||
@@ -103,6 +103,8 @@ public class RepositoryConstants {
|
||||
public static final String REPOSITORY_CLOUD_APAC_ID = "cloud_apac"; //$NON-NLS-1$
|
||||
|
||||
public static final String REPOSITORY_CLOUD_US_WEST_ID = "cloud_us_west"; //$NON-NLS-1$
|
||||
|
||||
public static final String REPOSITORY_CLOUD_AUS_ID = "cloud_aus"; //$NON-NLS-1$
|
||||
|
||||
public static final String REPOSITORY_CLOUD_CUSTOM_ID = "cloud_custom"; //$NON-NLS-1$
|
||||
|
||||
|
||||
@@ -42,6 +42,10 @@
|
||||
id="org.talend.core.ui.token.AdditionalPackageTokenCollector"
|
||||
name="addtional package">
|
||||
</provider>
|
||||
<provider
|
||||
collector="org.talend.core.ui.token.AMCUsageTokenCollector"
|
||||
id="AMCUsageTokenCollector">
|
||||
</provider>
|
||||
</extension>
|
||||
|
||||
<extension
|
||||
|
||||
@@ -24,6 +24,8 @@ import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
import org.talend.commons.ui.runtime.swt.tableviewer.TableViewerCreatorColumnNotModifiable;
|
||||
import org.talend.commons.ui.runtime.swt.tableviewer.behavior.DefaultTableLabelProvider;
|
||||
import org.talend.commons.ui.swt.advanced.dataeditor.button.CasePushButton;
|
||||
import org.talend.commons.ui.swt.advanced.dataeditor.button.QuotePushButton;
|
||||
import org.talend.commons.ui.swt.advanced.dataeditor.button.ResetDBTypesPushButton;
|
||||
import org.talend.commons.ui.swt.advanced.dataeditor.control.ExtendedPushButton;
|
||||
import org.talend.commons.ui.swt.tableviewer.TableViewerCreator;
|
||||
@@ -88,6 +90,14 @@ public class CustomTableManager {
|
||||
if (resetDBTypesButton != null) {
|
||||
resetDBTypesButton.getButton().setEnabled(false);
|
||||
}
|
||||
CasePushButton caseButton = tableEditorView.getExtendedToolbar().getCaseButton();
|
||||
if (caseButton != null) {
|
||||
caseButton.getButton().setEnabled(false);
|
||||
}
|
||||
QuotePushButton quoteButton = tableEditorView.getExtendedToolbar().getQuoteButton();
|
||||
if (quoteButton != null) {
|
||||
quoteButton.getButton().setEnabled(false);
|
||||
}
|
||||
} else {
|
||||
tableEditorView.getToolBar().getAddButton().getButton().addSelectionListener(new SelectionListener() {
|
||||
|
||||
@@ -170,6 +180,14 @@ public class CustomTableManager {
|
||||
if (resetDBTypesButton != null) {
|
||||
resetDBTypesButton.getButton().setEnabled(false);
|
||||
}
|
||||
CasePushButton caseButton = tableEditorView.getExtendedToolbar().getCaseButton();
|
||||
if (caseButton != null) {
|
||||
caseButton.getButton().setEnabled(false);
|
||||
}
|
||||
QuotePushButton quoteButton = tableEditorView.getExtendedToolbar().getQuoteButton();
|
||||
if (quoteButton != null) {
|
||||
quoteButton.getButton().setEnabled(false);
|
||||
}
|
||||
}
|
||||
if (linkedTable != null) {
|
||||
if (linkedTable.isReadOnly() && linkedTableEditorView != null) {
|
||||
|
||||
@@ -43,6 +43,7 @@ import org.talend.commons.ui.command.CommandStackForComposite;
|
||||
import org.talend.commons.ui.runtime.image.EImage;
|
||||
import org.talend.commons.ui.runtime.image.ImageProvider;
|
||||
import org.talend.commons.ui.swt.advanced.composite.ThreeCompositesSashForm;
|
||||
import org.talend.commons.ui.swt.advanced.dataeditor.ExtendedToolbarView;
|
||||
import org.talend.commons.ui.swt.extended.table.ExtendedTableModel;
|
||||
import org.talend.commons.ui.swt.tableviewer.IModifiedBeanListener;
|
||||
import org.talend.commons.ui.swt.tableviewer.ModifiedBeanEvent;
|
||||
@@ -67,6 +68,7 @@ import org.talend.core.model.utils.NodeUtil;
|
||||
import org.talend.core.ui.CoreUIPlugin;
|
||||
import org.talend.core.ui.i18n.Messages;
|
||||
import org.talend.core.ui.metadata.editor.AbstractMetadataTableEditorView;
|
||||
import org.talend.core.ui.metadata.editor.MetadataQuoteToolbarEditorView;
|
||||
import org.talend.core.ui.metadata.editor.MetadataTableEditor;
|
||||
import org.talend.core.ui.metadata.editor.MetadataTableEditorView;
|
||||
import org.talend.core.utils.TalendQuoteUtils;
|
||||
@@ -376,8 +378,19 @@ public class MetadataDialog extends Dialog {
|
||||
} else {
|
||||
metadataTableEditor = new MetadataTableEditor(outputMetaTable, titleOutput);
|
||||
}
|
||||
outputMetaView = new DialogMetadataTableEditorView(composite, SWT.NONE, metadataTableEditor, outputReadOnly, true,
|
||||
true, false);
|
||||
//enable dbcolumn manipulate feature only on Database output component
|
||||
String nodeFamily = "", rootFamily = "";
|
||||
if ( outputNode != null && outputNode.getComponent() != null ) {
|
||||
nodeFamily = outputNode.getComponent().getOriginalFamilyName();
|
||||
rootFamily = nodeFamily != null ? nodeFamily.split("/")[0] : "";
|
||||
}
|
||||
if (rootFamily.equals("Databases")) {
|
||||
outputMetaView = new DialogMetadataDBOutputTableEditorView(composite, SWT.NONE, metadataTableEditor, outputReadOnly, true,
|
||||
true, false);
|
||||
} else {
|
||||
outputMetaView = new DialogMetadataTableEditorView(composite, SWT.NONE, metadataTableEditor, outputReadOnly, true,
|
||||
true, false);
|
||||
}
|
||||
outputMetaView.setMetadataTalendTypeFilter(NodeUtil.createMetadataTalendTypeFilter(outputNode));
|
||||
outputMetaView.setIsRepository(isRepository(outputNode, outputMetaTable));
|
||||
initializeMetadataTableView(outputMetaView, outputNode, outputMetaTable);
|
||||
@@ -544,8 +557,21 @@ public class MetadataDialog extends Dialog {
|
||||
} else {
|
||||
metadataTableEditorForOutput = new MetadataTableEditor(outputMetaTable, titleOutput + " (Output)");
|
||||
}
|
||||
outputMetaView = new DialogMetadataTableEditorView(compositesSachForm.getRightComposite(), SWT.NONE,
|
||||
metadataTableEditorForOutput, outputReadOnly, true, true, false);
|
||||
//Enable dbcolumn manipulate feature only on Database output component
|
||||
String nodeFamily = "", rootFamily = "";
|
||||
if ( outputNode != null && outputNode.getComponent() != null ) {
|
||||
nodeFamily = outputNode.getComponent().getOriginalFamilyName();
|
||||
rootFamily = nodeFamily != null ? nodeFamily.split("/")[0] : "";
|
||||
}
|
||||
if (rootFamily.equals("Databases")) {
|
||||
outputMetaView = new DialogMetadataDBOutputTableEditorView(compositesSachForm.getRightComposite(), SWT.NONE,
|
||||
metadataTableEditorForOutput, outputReadOnly, true, true, false);
|
||||
} else {
|
||||
outputMetaView = new DialogMetadataTableEditorView(compositesSachForm.getRightComposite(), SWT.NONE,
|
||||
metadataTableEditorForOutput, outputReadOnly, true, true, false);
|
||||
}
|
||||
|
||||
|
||||
outputMetaView.setMetadataTalendTypeFilter(NodeUtil.createMetadataTalendTypeFilter(outputNode));
|
||||
outputMetaView.setIsRepository(isRepository(outputNode, outputMetaTable));
|
||||
initializeMetadataTableView(outputMetaView, outputNode, outputMetaTable);
|
||||
@@ -799,7 +825,22 @@ public class MetadataDialog extends Dialog {
|
||||
newTableViewerCreator.setLazyLoad(TableViewerCreator.getRecommandLazyLoad());
|
||||
}
|
||||
}
|
||||
|
||||
class DialogMetadataDBOutputTableEditorView extends MetadataTableEditorView {
|
||||
|
||||
public DialogMetadataDBOutputTableEditorView(Composite parentComposite, int mainCompositeStyle,
|
||||
ExtendedTableModel<IMetadataColumn> extendedTableModel, boolean readOnly, boolean toolbarVisible,
|
||||
boolean labelVisible, boolean initGraphicsComponents) {
|
||||
super(parentComposite, mainCompositeStyle, extendedTableModel, readOnly, toolbarVisible, labelVisible,
|
||||
initGraphicsComponents);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ExtendedToolbarView initToolBar() {
|
||||
return new MetadataQuoteToolbarEditorView(getMainComposite(), SWT.NONE, this.getExtendedTableViewer(), this.getCurrentDbms());
|
||||
}
|
||||
}
|
||||
|
||||
public static void setSingleAndStruct(boolean isSingle) {
|
||||
isSingleAndStruct = isSingle;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.ui.metadata.editor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.gef.commands.Command;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.talend.commons.ui.swt.advanced.dataeditor.button.QuotePushButton;
|
||||
import org.talend.commons.ui.swt.advanced.dataeditor.button.QuotePushButtonForExtendedTable;
|
||||
import org.talend.commons.ui.swt.advanced.dataeditor.button.CasePushButton;
|
||||
import org.talend.commons.ui.swt.advanced.dataeditor.button.CasePushButtonForExtendedTable;
|
||||
import org.talend.commons.ui.swt.extended.table.AbstractExtendedTableViewer;
|
||||
import org.talend.commons.ui.swt.extended.table.ExtendedTableModel;
|
||||
import org.talend.core.ui.metadata.extended.command.MetadataCaseCommand;
|
||||
import org.talend.core.ui.metadata.extended.command.MetadataQuoteCommand;
|
||||
|
||||
|
||||
public class MetadataQuoteToolbarEditorView extends MetadataToolbarEditorView {
|
||||
|
||||
|
||||
public MetadataQuoteToolbarEditorView(Composite parent, int style, AbstractExtendedTableViewer extendedTableViewer) {
|
||||
super(parent, style, extendedTableViewer);
|
||||
}
|
||||
|
||||
public MetadataQuoteToolbarEditorView(Composite parent, int style, AbstractExtendedTableViewer extendedTableViewer, String dbmsId) {
|
||||
super(parent, style, extendedTableViewer, dbmsId);
|
||||
this.getQuoteButton().setDbmsId(dbmsId);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public CasePushButton createCasePushButton() {
|
||||
return new CasePushButtonForExtendedTable(toolbar, extendedTableViewer) {
|
||||
|
||||
@Override
|
||||
protected Command getCommandToExecute(ExtendedTableModel extendedTable, List beansToConvertCase, int[] selectionIndices, boolean isUpperCase) {
|
||||
return new MetadataCaseCommand(extendedTable, beansToConvertCase, selectionIndices, isUpperCase);
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected QuotePushButton createQuotePushButton() {
|
||||
return new QuotePushButtonForExtendedTable(toolbar, extendedTableViewer) {
|
||||
|
||||
@Override
|
||||
protected Command getCommandToExecute(ExtendedTableModel extendedTable, List beansToQuote, int[] selectionIndices, String quote, boolean isAddingQuote) {
|
||||
return new MetadataQuoteCommand(extendedTable, beansToQuote, selectionIndices, quote, isAddingQuote);
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.ui.metadata.extended.command;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.talend.commons.ui.swt.advanced.dataeditor.commands.ExtendedTableCaseCommand;
|
||||
import org.talend.commons.ui.swt.extended.table.ExtendedTableModel;
|
||||
import org.talend.core.model.metadata.IMetadataColumn;
|
||||
import org.talend.core.model.metadata.builder.ConvertionHelper;
|
||||
import org.talend.core.model.metadata.builder.connection.MetadataColumn;
|
||||
import org.talend.core.model.metadata.builder.connection.impl.ConnectionFactoryImpl;
|
||||
import org.talend.core.ui.metadata.editor.MetadataTableEditor;
|
||||
|
||||
public class MetadataCaseCommand extends ExtendedTableCaseCommand {
|
||||
|
||||
|
||||
/**
|
||||
* DOC MetadataCaseCommand constructor comment.
|
||||
*
|
||||
* @param extendedTableModel
|
||||
* @param beansToUppercase
|
||||
* @param selectionIndices
|
||||
* @param isUpperCase
|
||||
*/
|
||||
public MetadataCaseCommand(ExtendedTableModel extendedTable, List beansToUppercase, int[] selectionIndices, boolean isUpperCase) {
|
||||
super(extendedTable, beansToUppercase, selectionIndices, isUpperCase);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void convertCase(ExtendedTableModel extendedTable, List copiedObjectsList, int[] selectionIndices, boolean isUpperCase) {
|
||||
int index = 0;
|
||||
for (Object current : copiedObjectsList) {
|
||||
//get refreshed element
|
||||
current = extendedTable.getTableViewer().getElementAt(selectionIndices[index]);
|
||||
if (current instanceof IMetadataColumn) {
|
||||
IMetadataColumn copy = ((IMetadataColumn) current).clone();
|
||||
copy.setUsefulColumn(true);
|
||||
if (copy.getOriginalDbColumnName() != null && !StringUtils.isEmpty(copy.getOriginalDbColumnName())) {
|
||||
copy.setOriginalDbColumnName(isUpperCase ? copy.getOriginalDbColumnName().toUpperCase() : copy.getOriginalDbColumnName().toLowerCase());
|
||||
}
|
||||
extendedTable.replace(copy, selectionIndices[index]);
|
||||
}
|
||||
// Add a new statement to fix the MetadataColumn type.
|
||||
else if (current instanceof MetadataColumn) {
|
||||
MetadataTableEditor tableEditor = (MetadataTableEditor) extendedTable;
|
||||
MetadataColumn metadataColumn = (MetadataColumn) current;
|
||||
MetadataColumn newColumnCopy = new ConnectionFactoryImpl().copy(metadataColumn,
|
||||
isUpperCase ? StringUtils.upperCase(metadataColumn.getName()) : StringUtils.lowerCase(metadataColumn.getName()));
|
||||
IMetadataColumn copy = (ConvertionHelper.convertToIMetaDataColumn(newColumnCopy)).clone();
|
||||
extendedTable.replace(copy, selectionIndices[index]);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
extendedTable.getTableViewer().getTable().select(selectionIndices);
|
||||
extendedTable.getTableViewer().getTable().notifyListeners(SWT.Selection, new Event());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.ui.metadata.extended.command;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.talend.commons.ui.swt.advanced.dataeditor.commands.ExtendedTableQuoteCommand;
|
||||
import org.talend.commons.ui.swt.extended.table.ExtendedTableModel;
|
||||
import org.talend.core.model.metadata.IMetadataColumn;
|
||||
import org.talend.core.model.metadata.builder.ConvertionHelper;
|
||||
import org.talend.core.model.metadata.builder.connection.MetadataColumn;
|
||||
import org.talend.core.model.metadata.builder.connection.impl.ConnectionFactoryImpl;
|
||||
import org.talend.core.ui.metadata.editor.MetadataTableEditor;
|
||||
|
||||
public class MetadataQuoteCommand extends ExtendedTableQuoteCommand {
|
||||
|
||||
|
||||
/**
|
||||
* DOC MetadataQuoteCommand constructor comment.
|
||||
*
|
||||
* @param extendedTableModel
|
||||
* @param beansToQuote
|
||||
* @param selectionIndices
|
||||
*/
|
||||
public MetadataQuoteCommand(ExtendedTableModel extendedTable, List beansToQuote, int[] selectionIndices, String quote, boolean isAddingQuote) {
|
||||
super(extendedTable, beansToQuote, selectionIndices, quote, isAddingQuote);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toQuote(ExtendedTableModel extendedTable, List copiedObjectsList, int[] selectionIndices, String quote, boolean isAddingQuote) {
|
||||
int index = 0;
|
||||
for (Object current : copiedObjectsList) {
|
||||
//get refreshed element
|
||||
current = extendedTable.getTableViewer().getElementAt(selectionIndices[index]);
|
||||
if (current instanceof IMetadataColumn) {
|
||||
IMetadataColumn copy = ((IMetadataColumn) current).clone();
|
||||
copy.setUsefulColumn(true);
|
||||
String oldDbColumnName = copy.getOriginalDbColumnName();
|
||||
if (oldDbColumnName != null) {
|
||||
String newDbColumnName = oldDbColumnName;
|
||||
if (isAddingQuote) {
|
||||
newDbColumnName = quote + newDbColumnName + quote;
|
||||
} else {
|
||||
newDbColumnName = StringUtils.removeStart(oldDbColumnName, quote);
|
||||
newDbColumnName = StringUtils.removeEnd(newDbColumnName, quote);
|
||||
}
|
||||
copy.setOriginalDbColumnName(newDbColumnName);
|
||||
extendedTable.replace(copy, selectionIndices[index]);
|
||||
}
|
||||
}
|
||||
// Add a new statement to fix the MetadataColumn type.
|
||||
else if (current instanceof MetadataColumn) {
|
||||
MetadataTableEditor tableEditor = (MetadataTableEditor) extendedTable;
|
||||
MetadataColumn metadataColumn = (MetadataColumn) current;
|
||||
String oldName = metadataColumn.getName();
|
||||
if (oldName != null) {
|
||||
String newName = oldName;
|
||||
if (isAddingQuote) {
|
||||
newName = quote + oldName + quote;
|
||||
} else {
|
||||
newName = StringUtils.removeStart(oldName, quote);
|
||||
newName = StringUtils.removeEnd(newName, quote);
|
||||
}
|
||||
MetadataColumn newColumnCopy = new ConnectionFactoryImpl().copy(metadataColumn, newName);
|
||||
IMetadataColumn copy = (ConvertionHelper.convertToIMetaDataColumn(newColumnCopy)).clone();
|
||||
extendedTable.replace(copy, selectionIndices[index]);
|
||||
}
|
||||
}
|
||||
index++;
|
||||
}
|
||||
extendedTable.getTableViewer().getTable().select(selectionIndices);
|
||||
extendedTable.getTableViewer().getTable().notifyListeners(SWT.Selection, new Event());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.ui.token;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.eclipse.core.runtime.preferences.ConfigurationScope;
|
||||
import org.eclipse.core.runtime.preferences.DefaultScope;
|
||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
||||
import org.eclipse.core.runtime.preferences.IScopeContext;
|
||||
import org.eclipse.core.runtime.preferences.InstanceScope;
|
||||
import org.talend.commons.runtime.service.ICollectDataService;
|
||||
|
||||
import us.monoid.json.JSONObject;
|
||||
|
||||
public class AMCUsageTokenCollector extends AbstractTokenCollector {
|
||||
|
||||
@Override
|
||||
public JSONObject collect() throws Exception {
|
||||
Properties props = new Properties();
|
||||
ICollectDataService instance = ICollectDataService.getInstance("amc");
|
||||
if (instance != null) {
|
||||
props = instance.getCollectedData();
|
||||
} else {
|
||||
IScopeContext[] contexts = new IScopeContext[] { InstanceScope.INSTANCE, ConfigurationScope.INSTANCE,
|
||||
DefaultScope.INSTANCE };
|
||||
String plugin = "org.talend.amc";
|
||||
for (IScopeContext context : contexts) {
|
||||
IEclipsePreferences amc = context.getNode(plugin);
|
||||
if (amc != null) {
|
||||
if (amc.getBoolean(ICollectDataService.AMC_FILE_TYPE_USED, false)) {
|
||||
props.setProperty(ICollectDataService.AMC_PREVIEW_KEY, ICollectDataService.AMC_PREVIEW_FILEVALUE);
|
||||
} else if (amc.getBoolean(ICollectDataService.AMC_DATABASE_TYPE_USED, false)) {
|
||||
props.setProperty(ICollectDataService.AMC_PREVIEW_KEY, ICollectDataService.AMC_PREVIEW_DATABASEVALUE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
JSONObject finalToken = new JSONObject();
|
||||
finalToken.put(ICollectDataService.AMC_PREVIEW_KEY, "<Empty>");
|
||||
for (Object key : props.keySet()) {
|
||||
finalToken.put((String) key, props.get(key));
|
||||
}
|
||||
return finalToken;
|
||||
}
|
||||
}
|
||||
@@ -25,8 +25,10 @@ import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarOutputStream;
|
||||
@@ -78,8 +80,6 @@ import org.talend.core.language.LanguageManager;
|
||||
import org.talend.core.model.components.ComponentCategory;
|
||||
import org.talend.core.model.components.EComponentType;
|
||||
import org.talend.core.model.components.IComponent;
|
||||
import org.talend.core.model.components.IComponentsFactory;
|
||||
import org.talend.core.model.components.IComponentsService;
|
||||
import org.talend.core.model.context.ContextUtils;
|
||||
import org.talend.core.model.general.ModuleNeeded;
|
||||
import org.talend.core.model.general.Project;
|
||||
@@ -98,10 +98,8 @@ import org.talend.core.model.process.JobInfo;
|
||||
import org.talend.core.model.process.ProcessUtils;
|
||||
import org.talend.core.model.process.ReplaceNodesInProcessProvider;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.JobletProcessItem;
|
||||
import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.relationship.Relation;
|
||||
import org.talend.core.model.relationship.RelationshipItemBuilder;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.IRepositoryObject;
|
||||
@@ -114,6 +112,7 @@ import org.talend.core.model.routines.RoutinesUtil;
|
||||
import org.talend.core.model.utils.JavaResourcesHelper;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||
import org.talend.core.runtime.maven.MavenConstants;
|
||||
import org.talend.core.runtime.process.ITalendProcessJavaProject;
|
||||
import org.talend.core.runtime.process.LastGenerationInfo;
|
||||
import org.talend.core.runtime.process.TalendProcessArgumentConstant;
|
||||
@@ -192,7 +191,7 @@ public class ProcessorUtilities {
|
||||
|
||||
private static final Set<ModuleNeeded> retrievedJarsForCurrentBuild = new HashSet<ModuleNeeded>();
|
||||
|
||||
private static final Set<String> esbJobs = new HashSet<String>();
|
||||
private static final Map<String, Integer> esbJobs = new HashMap<String, Integer>();
|
||||
|
||||
private static boolean isDebug = false;
|
||||
|
||||
@@ -439,6 +438,81 @@ public class ProcessorUtilities {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean checkProcessLoopDependencies(IProcess mainProcess, String id, String version,
|
||||
LinkedList<String> pathlink, Map<String, String> idToLatestVersion) {
|
||||
if (ItemCacheManager.LATEST_VERSION.contains(version)) {
|
||||
if (idToLatestVersion.get(id) == null) {
|
||||
ProcessItem processItem = ItemCacheManager.getProcessItem(id);
|
||||
version = processItem.getProperty().getVersion();
|
||||
idToLatestVersion.put(id, version);
|
||||
} else {
|
||||
version = idToLatestVersion.get(id);
|
||||
}
|
||||
}
|
||||
String pathNode = id + "-" + version;
|
||||
if (pathlink.contains(pathNode)) {
|
||||
return true;
|
||||
}
|
||||
pathlink.add(pathNode);
|
||||
|
||||
boolean hasLoop = false;
|
||||
List<? extends INode> processNodes = mainProcess.getProcessNodes();
|
||||
for (INode node : processNodes) {
|
||||
if (!node.isActivate()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
IElementParameter processIdParam = node.getElementParameter("PROCESS_TYPE_PROCESS");
|
||||
if (processIdParam != null && StringUtils.isNotBlank((String) processIdParam.getValue())) {
|
||||
String jobIds = (String) processIdParam.getValue();
|
||||
String subNodeversion = (String) node.getElementParameter("PROCESS_TYPE_VERSION").getValue();
|
||||
for (String jobId : jobIds.split(ProcessorUtilities.COMMA)) {
|
||||
if (StringUtils.isBlank(jobId)) {
|
||||
continue;
|
||||
}
|
||||
ProcessItem processItem = ItemCacheManager.getProcessItem(jobId, subNodeversion);
|
||||
if (processItem != null) {
|
||||
IDesignerCoreService service = CorePlugin.getDefault().getDesignerCoreService();
|
||||
IProcess subProcess = service.getProcessFromProcessItem(processItem);
|
||||
if (subProcess != null) {
|
||||
hasLoop = checkProcessLoopDependencies(subProcess, jobId, subNodeversion, pathlink,
|
||||
idToLatestVersion);
|
||||
}
|
||||
}
|
||||
if (hasLoop) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IJobletProviderService.class)) {
|
||||
IJobletProviderService jobletService = GlobalServiceRegister.getDefault()
|
||||
.getService(IJobletProviderService.class);
|
||||
if (jobletService != null) {
|
||||
IProcess jobletProcess = jobletService.getJobletGEFProcessFromNode(node);
|
||||
if (jobletProcess != null) {
|
||||
String jobletId = jobletProcess.getId();
|
||||
IElementParameter projectTecNameParam = jobletProcess.getElementParameter("PROJECT_TECHNICAL_NAME");
|
||||
if (projectTecNameParam != null && StringUtils.isNotBlank((String) projectTecNameParam.getValue())) {
|
||||
jobletId = projectTecNameParam.getValue() + ":" + jobletId;
|
||||
}
|
||||
hasLoop = checkProcessLoopDependencies(jobletProcess, jobletId, jobletProcess.getVersion(), pathlink,
|
||||
idToLatestVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (hasLoop) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasLoop) {
|
||||
pathlink.removeLast();
|
||||
}
|
||||
|
||||
return hasLoop;
|
||||
}
|
||||
|
||||
private static IProcessor generateCode(IProcessor processor2, JobInfo jobInfo, String selectedContextName,
|
||||
boolean statistics, boolean trace, boolean needContext, int option, IProgressMonitor progressMonitor)
|
||||
throws ProcessorException {
|
||||
@@ -538,11 +612,12 @@ public class ProcessorUtilities {
|
||||
jobInfo.setProcessor(processor);
|
||||
|
||||
if (isMainJob && selectedProcessItem != null) {
|
||||
Relation mainRelation = new Relation();
|
||||
mainRelation.setId(jobInfo.getJobId());
|
||||
mainRelation.setVersion(jobInfo.getJobVersion());
|
||||
mainRelation.setType(RelationshipItemBuilder.JOB_RELATION);
|
||||
hasLoopDependency = checkLoopDependencies(mainRelation, new HashMap<String, String>());
|
||||
if (!IRunProcessService.get().getMavenPrefOptionStatus(MavenConstants.SKIP_LOOP_DEPENDENCY_CHECK)) {
|
||||
Property property = selectedProcessItem.getProperty();
|
||||
String jobId = ProjectManager.getInstance().getCurrentProject().getTechnicalLabel() + ":" + property.getId();
|
||||
hasLoopDependency = checkProcessLoopDependencies(currentProcess, jobId, property.getVersion(),
|
||||
new LinkedList<String>(), new HashMap<String, String>());
|
||||
}
|
||||
// clean the previous code in case it has deleted subjob
|
||||
cleanSourceFolder(progressMonitor, currentProcess, processor);
|
||||
}
|
||||
@@ -645,233 +720,6 @@ public class ProcessorUtilities {
|
||||
return processor;
|
||||
}
|
||||
|
||||
public static boolean checkLoopDependencies(Relation mainJobInfo, Map<String, String> idToLastestVersionMap)
|
||||
throws ProcessorException {
|
||||
List<Relation> itemsJobRelatedTo = getItemsRelation(mainJobInfo, idToLastestVersionMap);
|
||||
List<Relation> relationChecked = new ArrayList<>();
|
||||
relationChecked.add(mainJobInfo);
|
||||
return checkLoopDependencies(mainJobInfo, mainJobInfo, itemsJobRelatedTo, relationChecked, idToLastestVersionMap);
|
||||
}
|
||||
|
||||
private static boolean checkLoopDependencies(Relation mainRelation, Relation currentRelation,
|
||||
List<Relation> itemsJobRelatedTo,
|
||||
List<Relation> relationChecked, Map<String, String> idToLastestVersionMap) throws ProcessorException {
|
||||
boolean hasDependency = false;
|
||||
for (Relation relation : itemsJobRelatedTo) {
|
||||
try {
|
||||
// means the tRunjob deactivate, or one of the specific version tRunjon deactivate, skip
|
||||
Map<String, Set<String>> actTrunjobHM = getActivateTRunjobMap(currentRelation.getId(),
|
||||
currentRelation.getVersion());
|
||||
if (actTrunjobHM.get(relation.getId()) == null
|
||||
|| !actTrunjobHM.get(relation.getId()).contains(relation.getVersion())) {
|
||||
continue;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new ProcessorException(e);
|
||||
}
|
||||
|
||||
hasDependency = relation.getId().equals(mainRelation.getId())
|
||||
&& relation.getVersion().equals(mainRelation.getVersion());
|
||||
if (!hasDependency) {
|
||||
List<Relation> itemsChildJob = getItemsRelation(relation, idToLastestVersionMap);
|
||||
if (!relationChecked.contains(relation)) {
|
||||
relationChecked.add(relation);
|
||||
hasDependency = checkLoopDependencies(mainRelation, relation, itemsChildJob, relationChecked,
|
||||
idToLastestVersionMap);
|
||||
}
|
||||
if (!hasDependency) {
|
||||
for (Relation childRelation : itemsChildJob) {
|
||||
|
||||
try {
|
||||
// means the tRunjob deactivate, or one of the specific version tRunjon deactivate, skip
|
||||
Map<String, Set<String>> activateTRunjobMap = getActivateTRunjobMap(relation.getId(),
|
||||
relation.getVersion());
|
||||
if (activateTRunjobMap.get(childRelation.getId()) == null
|
||||
|| !activateTRunjobMap.get(childRelation.getId()).contains(childRelation.getVersion())) {
|
||||
continue;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new ProcessorException(e);
|
||||
}
|
||||
|
||||
hasDependency = checkLoopDependencies(childRelation, idToLastestVersionMap);
|
||||
if (hasDependency) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (hasDependency) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return hasDependency;
|
||||
}
|
||||
|
||||
private static Map<String, Set<String>> getActivateTRunjobMap(String id, String version) throws PersistenceException {
|
||||
Map<String, Set<String>> actTrunjobHM = new HashMap<String, Set<String>>();
|
||||
ProcessType processType = null;
|
||||
try {
|
||||
IRepositoryViewObject currentJobObject = ProxyRepositoryFactory.getInstance().getSpecificVersion(id, version, true);
|
||||
if (currentJobObject != null) {
|
||||
Item item = currentJobObject.getProperty().getItem();
|
||||
if (item instanceof ProcessItem) {
|
||||
processType = ((ProcessItem) item).getProcess();
|
||||
} else if (item instanceof JobletProcessItem) {
|
||||
processType = ((JobletProcessItem) item).getJobletProcess();
|
||||
}
|
||||
}
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
if (processType != null) {
|
||||
List<Project> allProjects = new ArrayList<Project>();
|
||||
allProjects.add(ProjectManager.getInstance().getCurrentProject());
|
||||
allProjects.addAll(ProjectManager.getInstance().getAllReferencedProjects());
|
||||
|
||||
List<String> jobletsComponentsList = new ArrayList<String>();
|
||||
IComponentsFactory componentsFactory = null;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IComponentsService.class)) {
|
||||
IComponentsService compService = GlobalServiceRegister.getDefault()
|
||||
.getService(IComponentsService.class);
|
||||
if (compService != null) {
|
||||
componentsFactory = compService.getComponentsFactory();
|
||||
for (IComponent component : componentsFactory.readComponents()) {
|
||||
if (component.getComponentType() == EComponentType.JOBLET) {
|
||||
jobletsComponentsList.add(component.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String jobletPaletteType = null;
|
||||
String frameWork = processType.getFramework();
|
||||
if (StringUtils.isBlank(frameWork)) {
|
||||
jobletPaletteType = ComponentCategory.CATEGORY_4_DI.getName();
|
||||
} else if (frameWork.equals(HadoopConstants.FRAMEWORK_SPARK)) {
|
||||
jobletPaletteType = ComponentCategory.CATEGORY_4_SPARK.getName();
|
||||
} else if (frameWork.equals(HadoopConstants.FRAMEWORK_SPARK_STREAMING)) {
|
||||
jobletPaletteType = ComponentCategory.CATEGORY_4_SPARKSTREAMING.getName();
|
||||
}
|
||||
|
||||
for (Object nodeObject : processType.getNode()) {
|
||||
NodeType node = (NodeType) nodeObject;
|
||||
// not tRunjob && not joblet then continue
|
||||
if (!node.getComponentName().equals("tRunJob") && !jobletsComponentsList.contains(node.getComponentName())) { // $NON-NLS-1$
|
||||
continue;
|
||||
}
|
||||
boolean nodeActivate = true;
|
||||
String processIds = null;
|
||||
String processVersion = null;
|
||||
for (Object elementParam : node.getElementParameter()) {
|
||||
ElementParameterType elemParamType = (ElementParameterType) elementParam;
|
||||
if ("PROCESS:PROCESS_TYPE_PROCESS".equals(elemParamType.getName())) { // $NON-NLS-1$
|
||||
processIds = elemParamType.getValue();
|
||||
if (StringUtils.isNotBlank(processIds)) {
|
||||
for (String jobId : processIds.split(ProcessorUtilities.COMMA)) {
|
||||
if (actTrunjobHM.get(jobId) == null) {
|
||||
actTrunjobHM.put(jobId, new HashSet<String>());
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if ("PROCESS:PROCESS_TYPE_VERSION".equals(elemParamType.getName()) // $NON-NLS-1$
|
||||
|| "PROCESS_TYPE_VERSION".equals(elemParamType.getName())) { // $NON-NLS-1$
|
||||
processVersion = elemParamType.getValue();
|
||||
} else if ("ACTIVATE".equals(elemParamType.getName())) { // $NON-NLS-1$
|
||||
nodeActivate = Boolean.parseBoolean(elemParamType.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
if (nodeActivate) {
|
||||
if (StringUtils.isNotBlank(processIds)) {
|
||||
for (String jobId : processIds.split(ProcessorUtilities.COMMA)) {
|
||||
String actualVersion = processVersion;
|
||||
if (RelationshipItemBuilder.LATEST_VERSION.equals(processVersion)) {
|
||||
for (Project project : allProjects) {
|
||||
IRepositoryViewObject lastVersion = null;
|
||||
lastVersion = ProxyRepositoryFactory.getInstance().getLastVersion(project, jobId);
|
||||
if (lastVersion != null) {
|
||||
actualVersion = lastVersion.getVersion();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (actTrunjobHM.get(jobId) != null) {
|
||||
actTrunjobHM.get(jobId).add(actualVersion);
|
||||
}
|
||||
|
||||
}
|
||||
} else if (componentsFactory != null && jobletPaletteType != null) {
|
||||
// for joblet
|
||||
IComponent cc = componentsFactory.get(node.getComponentName(), jobletPaletteType);
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IJobletProviderService.class)) {
|
||||
IJobletProviderService jobletService = GlobalServiceRegister.getDefault()
|
||||
.getService(IJobletProviderService.class);
|
||||
Property property = jobletService.getJobletComponentItem(cc);
|
||||
if (property != null && StringUtils.isNotBlank(property.getId())) {
|
||||
String jobletId = property.getId();
|
||||
if (actTrunjobHM.get(jobletId) == null) {
|
||||
actTrunjobHM.put(jobletId, new HashSet<String>());
|
||||
}
|
||||
String actualVersion = processVersion;
|
||||
if (RelationshipItemBuilder.LATEST_VERSION.equals(processVersion)) {
|
||||
for (Project project : allProjects) {
|
||||
IRepositoryViewObject lastVersion = null;
|
||||
lastVersion = ProxyRepositoryFactory.getInstance().getLastVersion(project, jobletId);
|
||||
if (lastVersion != null) {
|
||||
actualVersion = lastVersion.getVersion();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
actTrunjobHM.get(jobletId).add(actualVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return actTrunjobHM;
|
||||
}
|
||||
|
||||
private static List<Relation> getItemsRelation(Relation mainJobInfo, Map<String, String> idToLastestVersionMap) throws ProcessorException {
|
||||
List<Relation> itemsJobRelatedTo = new ArrayList<Relation>();
|
||||
try {
|
||||
List<Project> allProjects = new ArrayList<Project>();
|
||||
allProjects.add(ProjectManager.getInstance().getCurrentProject());
|
||||
allProjects.addAll(ProjectManager.getInstance().getAllReferencedProjects());
|
||||
RelationshipItemBuilder instance = RelationshipItemBuilder.getInstance();
|
||||
if (instance != null) {
|
||||
itemsJobRelatedTo.addAll(instance.getItemsChildRelatedTo(mainJobInfo.getId(), mainJobInfo.getVersion(),
|
||||
mainJobInfo.getType(), RelationshipItemBuilder.JOB_RELATION));
|
||||
itemsJobRelatedTo.addAll(instance.getItemsChildRelatedTo(mainJobInfo.getId(), mainJobInfo.getVersion(),
|
||||
mainJobInfo.getType(), RelationshipItemBuilder.JOBLET_RELATION));
|
||||
for (Relation relation : itemsJobRelatedTo) {
|
||||
if (relation.getVersion().equals(RelationshipItemBuilder.LATEST_VERSION)) {
|
||||
if (idToLastestVersionMap.containsKey(relation.getId())) {
|
||||
relation.setVersion(idToLastestVersionMap.get(relation.getId()));
|
||||
} else {
|
||||
for (Project project : allProjects) {
|
||||
IRepositoryViewObject lastVersion =
|
||||
ProxyRepositoryFactory.getInstance().getLastVersion(project, relation.getId());
|
||||
if (lastVersion != null) {
|
||||
relation.setVersion(lastVersion.getVersion());
|
||||
idToLastestVersionMap.put(relation.getId(), relation.getVersion());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (PersistenceException e) {
|
||||
throw new ProcessorException(e);
|
||||
}
|
||||
|
||||
return itemsJobRelatedTo;
|
||||
}
|
||||
|
||||
private static void setNeededResources(final Map<String, Object> argumentsMap, JobInfo jobInfo) {
|
||||
argumentsMap.put(TalendProcessArgumentConstant.ARG_NEED_XMLMAPPINGS,
|
||||
@@ -1265,11 +1113,11 @@ public class ProcessorUtilities {
|
||||
}
|
||||
|
||||
if (isMainJob && selectedProcessItem != null) {
|
||||
Relation mainRelation = new Relation();
|
||||
mainRelation.setId(jobInfo.getJobId());
|
||||
mainRelation.setVersion(jobInfo.getJobVersion());
|
||||
mainRelation.setType(RelationshipItemBuilder.JOB_RELATION);
|
||||
hasLoopDependency = checkLoopDependencies(mainRelation, new HashMap<String, String>());
|
||||
if (!IRunProcessService.get().getMavenPrefOptionStatus(MavenConstants.SKIP_LOOP_DEPENDENCY_CHECK)) {
|
||||
Property property = selectedProcessItem.getProperty();
|
||||
hasLoopDependency = checkProcessLoopDependencies(currentProcess, property.getId(), property.getVersion(),
|
||||
new LinkedList<String>(), new HashMap<String, String>());
|
||||
}
|
||||
// clean the previous code in case it has deleted subjob
|
||||
cleanSourceFolder(progressMonitor, currentProcess, processor);
|
||||
}
|
||||
@@ -1800,13 +1648,16 @@ public class ProcessorUtilities {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isEsbComponentName(componentName)) {
|
||||
addEsbJob(jobInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void recordESBIncludingFlag(JobInfo jobInfo, int esbIncludingOption) {
|
||||
int includeESBFlag = jobInfo.getIncludeESBFlag();
|
||||
includeESBFlag |= esbIncludingOption;
|
||||
jobInfo.setIncludeESBFlag(includeESBFlag);
|
||||
}
|
||||
|
||||
static void setGenerationInfoWithChildrenJob(INode node, JobInfo jobInfo, final JobInfo subJobInfo) {
|
||||
final LastGenerationInfo generationInfo = LastGenerationInfo.getInstance();
|
||||
|
||||
@@ -1915,6 +1766,13 @@ public class ProcessorUtilities {
|
||||
|
||||
static boolean hasLoopDependency = false;
|
||||
|
||||
private static void resetBuildFlagsAndCaches() {
|
||||
jobList.clear();
|
||||
esbJobs.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will generate the code of the process and all of this sub process.
|
||||
*
|
||||
@@ -1929,15 +1787,10 @@ public class ProcessorUtilities {
|
||||
if (monitors == null) {
|
||||
monitor = new NullProgressMonitor();
|
||||
}
|
||||
jobList.clear();
|
||||
esbJobs.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
resetBuildFlagsAndCaches();
|
||||
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;
|
||||
resetBuildFlagsAndCaches();
|
||||
return process;
|
||||
}
|
||||
|
||||
@@ -1957,14 +1810,9 @@ public class ProcessorUtilities {
|
||||
}
|
||||
JobInfo jobInfo = new JobInfo(processId, contextName, version);
|
||||
jobInfo.setApplyContextToChildren(applyContextToChildren);
|
||||
jobList.clear();
|
||||
esbJobs.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
resetBuildFlagsAndCaches();
|
||||
IProcessor process = generateCode(jobInfo, contextName, statistics, trace, true, GENERATE_ALL_CHILDS, monitor);
|
||||
jobList.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
resetBuildFlagsAndCaches();
|
||||
return process;
|
||||
}
|
||||
|
||||
@@ -1979,14 +1827,9 @@ public class ProcessorUtilities {
|
||||
}
|
||||
JobInfo jobInfo = new JobInfo(process, contextName);
|
||||
jobInfo.setApplyContextToChildren(applyContextToChildren);
|
||||
jobList.clear();
|
||||
esbJobs.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
resetBuildFlagsAndCaches();
|
||||
IProcessor result = generateCode(jobInfo, contextName, statistics, trace, true, GENERATE_ALL_CHILDS, monitor);
|
||||
jobList.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
resetBuildFlagsAndCaches();
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2001,15 +1844,10 @@ public class ProcessorUtilities {
|
||||
}
|
||||
JobInfo jobInfo = new JobInfo(process, contextName, version);
|
||||
jobInfo.setApplyContextToChildren(applyContextToChildren);
|
||||
jobList.clear();
|
||||
esbJobs.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
resetBuildFlagsAndCaches();
|
||||
IProcessor result =
|
||||
generateCode(jobInfo, contextName, statistics, trace, needContext, GENERATE_ALL_CHILDS, monitor);
|
||||
jobList.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
resetBuildFlagsAndCaches();
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2033,14 +1871,9 @@ public class ProcessorUtilities {
|
||||
ProcessUtils.isOptionChecked(argumentsMap, TalendProcessArgumentConstant.ARG_NEED_CONTEXT);
|
||||
int option = ProcessUtils.getOptionValue(argumentsMap, TalendProcessArgumentConstant.ARG_GENERATE_OPTION, 0);
|
||||
|
||||
jobList.clear();
|
||||
esbJobs.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
resetBuildFlagsAndCaches();
|
||||
IProcessor result = generateCode(jobInfo, contextName, statistics, trace, needContext, option, monitor);
|
||||
jobList.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
resetBuildFlagsAndCaches();
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2058,28 +1891,18 @@ public class ProcessorUtilities {
|
||||
JobInfo jobInfo = new JobInfo(process, contextName, version);
|
||||
jobInfo.setContext(context);
|
||||
jobInfo.setApplyContextToChildren(applyContextToChildren);
|
||||
jobList.clear();
|
||||
esbJobs.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
resetBuildFlagsAndCaches();
|
||||
result = generateCode(jobInfo, contextName, statistics, trace, true, GENERATE_ALL_CHILDS, monitor);
|
||||
jobList.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
resetBuildFlagsAndCaches();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static IProcessor generateCode(ProcessItem process, String contextName, boolean statistics, boolean trace)
|
||||
throws ProcessorException {
|
||||
jobList.clear();
|
||||
esbJobs.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
resetBuildFlagsAndCaches();
|
||||
IProcessor returnValue = generateCode(process, contextName, statistics, trace, false);
|
||||
jobList.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
resetBuildFlagsAndCaches();
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
@@ -2107,29 +1930,19 @@ public class ProcessorUtilities {
|
||||
jobInfo = new JobInfo(process, context);
|
||||
}
|
||||
jobInfo.setApplyContextToChildren(applyToChildren);
|
||||
jobList.clear();
|
||||
esbJobs.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
resetBuildFlagsAndCaches();
|
||||
IProcessor genCode = generateCode(jobInfo, context.getName(), statistics, trace, contextProperties,
|
||||
GENERATE_ALL_CHILDS, new NullProgressMonitor());
|
||||
jobList.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
resetBuildFlagsAndCaches();
|
||||
return genCode;
|
||||
}
|
||||
|
||||
public static IProcessor generateCode(IProcess process, IContext context, boolean statistics, boolean trace,
|
||||
boolean properties) throws ProcessorException {
|
||||
jobList.clear();
|
||||
esbJobs.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
resetBuildFlagsAndCaches();
|
||||
IProcessor returnValue =
|
||||
generateCode(process, context, statistics, trace, properties, new NullProgressMonitor());
|
||||
jobList.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
resetBuildFlagsAndCaches();
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
@@ -2157,15 +1970,10 @@ public class ProcessorUtilities {
|
||||
} else {
|
||||
jobInfo = new JobInfo(process, context);
|
||||
}
|
||||
jobList.clear();
|
||||
esbJobs.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
resetBuildFlagsAndCaches();
|
||||
IProcessor genCode = generateCode(jobInfo, context.getName(), statistics, trace, properties,
|
||||
GENERATE_ALL_CHILDS, progressMonitor);
|
||||
jobList.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
resetBuildFlagsAndCaches();
|
||||
return genCode;
|
||||
}
|
||||
|
||||
@@ -2208,15 +2016,10 @@ public class ProcessorUtilities {
|
||||
+ (jobInfo.getJobName() != null ? jobInfo.getJobName() : jobInfo.getJobId());
|
||||
TimeMeasure.begin(timeMeasureGenerateCodesId);
|
||||
|
||||
jobList.clear();
|
||||
esbJobs.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
resetBuildFlagsAndCaches();
|
||||
IProcessor genCode = generateCode(processor, jobInfo, context.getName(), statistics, trace, properties,
|
||||
GENERATE_ALL_CHILDS, progressMonitor);
|
||||
jobList.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
resetBuildFlagsAndCaches();
|
||||
|
||||
TimeMeasure.end(timeMeasureGenerateCodesId);
|
||||
// if active before, not disable and active still.
|
||||
@@ -2239,15 +2042,10 @@ public class ProcessorUtilities {
|
||||
}
|
||||
// achen modify to fix 0006107
|
||||
JobInfo jobInfo = new JobInfo(process, context);
|
||||
jobList.clear();
|
||||
esbJobs.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
resetBuildFlagsAndCaches();
|
||||
IProcessor genCode = generateCode(jobInfo, context.getName(), statistics, trace, properties, option,
|
||||
new NullProgressMonitor());
|
||||
jobList.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
resetBuildFlagsAndCaches();
|
||||
return genCode;
|
||||
}
|
||||
|
||||
@@ -2262,14 +2060,9 @@ public class ProcessorUtilities {
|
||||
}
|
||||
JobInfo jobInfo = new JobInfo(process, contextName);
|
||||
jobInfo.setApplyContextToChildren(applyContextToChildren);
|
||||
jobList.clear();
|
||||
esbJobs.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
resetBuildFlagsAndCaches();
|
||||
IProcessor result = generateCode(jobInfo, contextName, statistics, trace, true, option, monitor);
|
||||
jobList.clear();
|
||||
hasLoopDependency = false;
|
||||
mainJobInfo = null;
|
||||
resetBuildFlagsAndCaches();
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2611,6 +2404,8 @@ public class ProcessorUtilities {
|
||||
} else if (frameWork.equals(HadoopConstants.FRAMEWORK_SPARK_STREAMING)) {
|
||||
jobletPaletteType = ComponentCategory.CATEGORY_4_SPARKSTREAMING.getName();
|
||||
}
|
||||
|
||||
boolean hasChildrenIncludeESB = false;
|
||||
for (NodeType node : nodes) {
|
||||
boolean activate = true;
|
||||
// check if node is active at least.
|
||||
@@ -2625,8 +2420,8 @@ public class ProcessorUtilities {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isEsbComponentName(node.getComponentName())) {
|
||||
addEsbJob(parentJobInfo);
|
||||
if (!firstChildOnly && isEsbComponentName(node.getComponentName())) {
|
||||
recordESBIncludingFlag(parentJobInfo, TalendProcessOptionConstants.ISESB_CURRENT_INCLUDE);
|
||||
}
|
||||
|
||||
boolean isCTalendJob = "cTalendJob".equalsIgnoreCase(node.getComponentName());
|
||||
@@ -2655,6 +2450,18 @@ public class ProcessorUtilities {
|
||||
jobInfo.setFatherJobInfo(parentJobInfo);
|
||||
if (!firstChildOnly) {
|
||||
getAllJobInfo(processItem.getProcess(), jobInfo, jobInfos, firstChildOnly, includeJoblet);
|
||||
if (jobInfo.getIncludeESBFlag() >= 2) {
|
||||
hasChildrenIncludeESB = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Optional<JobInfo> infoOptional = jobInfos.stream().filter(info -> info.equals(jobInfo))
|
||||
.findFirst();
|
||||
if (infoOptional.isPresent()) {
|
||||
JobInfo matchJobInfo = infoOptional.get();
|
||||
if (matchJobInfo.getIncludeESBFlag() >= 2) {
|
||||
hasChildrenIncludeESB = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2706,6 +2513,16 @@ public class ProcessorUtilities {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// checked done set the esb including option
|
||||
if (!firstChildOnly) {
|
||||
recordESBIncludingFlag(parentJobInfo, TalendProcessOptionConstants.ISESB_CHECKED);
|
||||
if (hasChildrenIncludeESB) {
|
||||
recordESBIncludingFlag(parentJobInfo, TalendProcessOptionConstants.ISESB_CHILDREN_INCLUDE);
|
||||
}
|
||||
esbJobs.put(esbJobKey(parentJobInfo.getJobId(), parentJobInfo.getJobVersion()), parentJobInfo.getIncludeESBFlag());
|
||||
}
|
||||
|
||||
return jobInfos;
|
||||
}
|
||||
|
||||
@@ -2922,9 +2739,21 @@ public class ProcessorUtilities {
|
||||
}
|
||||
|
||||
public static boolean isEsbJob(IProcess process, boolean checkCurrentProcess) {
|
||||
// get includeESBFlag from cache
|
||||
if (process instanceof IProcess2) {
|
||||
Property property = ((IProcess2) process).getProperty();
|
||||
String esbJobKey = esbJobKey(property.getId(), property.getVersion());
|
||||
if (esbJobs.get(esbJobKey) != null) {
|
||||
Integer esbOptions = esbJobs.get(esbJobKey);
|
||||
if (BitwiseOptionUtils.containOption(esbOptions, TalendProcessOptionConstants.ISESB_CHECKED)) {
|
||||
return checkCurrentProcess
|
||||
? BitwiseOptionUtils.containOption(esbOptions, TalendProcessOptionConstants.ISESB_CURRENT_INCLUDE)
|
||||
: esbOptions > 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (process instanceof IProcess2) {
|
||||
|
||||
if (checkCurrentProcess) {
|
||||
for (INode n : process.getGraphicalNodes()) {
|
||||
if (isEsbComponentName(n.getComponent().getName())) {
|
||||
@@ -2950,17 +2779,6 @@ public class ProcessorUtilities {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void addEsbJob(JobInfo jobInfo) {
|
||||
if (esbJobs.contains(esbJobKey(jobInfo.getJobId(), jobInfo.getJobVersion()))) {
|
||||
return;
|
||||
}
|
||||
|
||||
esbJobs.add(esbJobKey(jobInfo.getJobId(), jobInfo.getJobVersion()));
|
||||
if (jobInfo.getFatherJobInfo() != null) {
|
||||
addEsbJob(jobInfo.getFatherJobInfo());
|
||||
}
|
||||
}
|
||||
|
||||
private static String esbJobKey(String processId, String version) {
|
||||
return processId + "_" + version;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-model-builder-3.2.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/maven-repository-metadata-3.2.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/plexus-interpolation-1.19.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/plexus-utils-3.0.17.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
|
||||
@@ -16,7 +16,6 @@ Bundle-ClassPath: .,
|
||||
lib/maven-model-builder-3.2.1.jar,
|
||||
lib/maven-repository-metadata-3.2.1.jar,
|
||||
lib/plexus-interpolation-1.19.jar,
|
||||
lib/plexus-utils-3.0.17.jar,
|
||||
lib/commons-codec.jar,
|
||||
lib/httpclient.jar,
|
||||
lib/httpcore.jar,
|
||||
|
||||
Binary file not shown.
@@ -26,6 +26,11 @@
|
||||
<artifactId>maven-shared-utils</artifactId>
|
||||
<version>3.3.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.8.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
@@ -62,6 +62,11 @@
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>1.15</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.8.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<!-- 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>
|
||||
<plexus-utils.version>3.0.24</plexus-utils.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
<version>1.1</version>
|
||||
<version>3.0.24</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<artifactId>studio-tacokit-dependencies</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<properties>
|
||||
<tacokit.components.version>1.21.0</tacokit.components.version>
|
||||
<tacokit.components.version>1.22.0</tacokit.components.version>
|
||||
</properties>
|
||||
<repositories>
|
||||
<repository>
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<properties>
|
||||
<tcomp.version>1.32.0</tcomp.version>
|
||||
<slf4j.version>1.7.25</slf4j.version>
|
||||
<tcomp.version>1.33.1</tcomp.version>
|
||||
<slf4j.version>1.7.28</slf4j.version>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<artifactItem>
|
||||
<groupId>org.talend.studio</groupId>
|
||||
<artifactId>studio-maven-repository</artifactId>
|
||||
<version>7.2.1.v20190226</version>
|
||||
<version>7.3.1.v20210520</version>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>${project.basedir}/../repository</outputDirectory>
|
||||
|
||||
@@ -15,4 +15,5 @@ MavenProjectSettingPage.filterExampleMessage=Filter examples:\nlabel=myJob
|
||||
MavenProjectSettingPage.refModuleText=Set reference project modules in profile
|
||||
MavenProjectSettingPage.excludeDeletedItems=Exclude deleted items
|
||||
MavenProjectSettingPage.syncAllPomsWarning=Click the Force full re-synchronize poms button to apply the new settings.
|
||||
MavenProjectSettingPage.skipFolders=Skip folders
|
||||
MavenProjectSettingPage.skipFolders=Skip folders
|
||||
BuildProjectSettingPage.allowRecursiveJobs=Allow recursive jobs (Not recommended)
|
||||
@@ -12,15 +12,50 @@
|
||||
// ============================================================================
|
||||
package org.talend.designer.maven.ui.setting.project.page;
|
||||
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.talend.core.runtime.maven.MavenConstants;
|
||||
import org.talend.core.runtime.projectsetting.EmptyProjectSettingPage;
|
||||
import org.talend.designer.maven.DesignerMavenPlugin;
|
||||
import org.talend.designer.maven.ui.i18n.Messages;
|
||||
|
||||
/**
|
||||
* DOC ggu class global comment. Detailled comment
|
||||
*/
|
||||
public class BuildProjectSettingPage extends EmptyProjectSettingPage {
|
||||
|
||||
private IPreferenceStore preferenceStore;
|
||||
|
||||
private Button allowRecursiveJobsCheckbox;
|
||||
|
||||
public BuildProjectSettingPage() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getPreferenceName() {
|
||||
return DesignerMavenPlugin.PLUGIN_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createFieldEditors() {
|
||||
Composite parent = getFieldEditorParent();
|
||||
parent.setLayout(new GridLayout());
|
||||
preferenceStore = getPreferenceStore();
|
||||
allowRecursiveJobsCheckbox = new Button(parent, SWT.CHECK);
|
||||
allowRecursiveJobsCheckbox.setText(Messages.getString("BuildProjectSettingPage.allowRecursiveJobs")); //$NON-NLS-1$
|
||||
allowRecursiveJobsCheckbox.setSelection(!preferenceStore.getBoolean(MavenConstants.SKIP_LOOP_DEPENDENCY_CHECK));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean performOk() {
|
||||
boolean performOk = super.performOk();
|
||||
if (preferenceStore != null) {
|
||||
preferenceStore.setValue(MavenConstants.SKIP_LOOP_DEPENDENCY_CHECK, !allowRecursiveJobsCheckbox.getSelection());
|
||||
}
|
||||
return performOk;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -891,16 +891,31 @@ public class AggregatorPomsHelper {
|
||||
} else {
|
||||
model.getModules().addAll(collectRefProjectModules(null));
|
||||
}
|
||||
boolean isCIMode = false;
|
||||
if (IRunProcessService.get() != null) {
|
||||
isCIMode = IRunProcessService.get().isCIMode();
|
||||
}
|
||||
|
||||
createRootPom(model, true, monitor);
|
||||
installRootPom(true);
|
||||
monitor.worked(1);
|
||||
if (monitor.isCanceled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// codes pom
|
||||
monitor.subTask("Synchronize code poms"); //$NON-NLS-1$
|
||||
updateCodeProjects(monitor, true, true);
|
||||
|
||||
if (isCIMode) {
|
||||
System.setProperty("ignore.ci.mode", Boolean.TRUE.toString());
|
||||
updateCodeProjects(monitor, true, true);
|
||||
System.setProperty("ignore.ci.mode", Boolean.FALSE.toString());
|
||||
} else {
|
||||
updateCodeProjects(monitor, true, true);
|
||||
}
|
||||
|
||||
CodesJarM2CacheManager.updateCodesJarProject(monitor, true, true, true);
|
||||
|
||||
monitor.worked(1);
|
||||
if (monitor.isCanceled()) {
|
||||
return;
|
||||
@@ -956,6 +971,15 @@ public class AggregatorPomsHelper {
|
||||
if (monitor.isCanceled()) {
|
||||
return;
|
||||
}
|
||||
if (isCIMode) {
|
||||
for (ERepositoryObjectType codeType : ERepositoryObjectType.getAllTypesOfCodes()) {
|
||||
ITalendProcessJavaProject codeProject = getCodesProject(codeType);
|
||||
if (codeProject != null) {
|
||||
updateCodeProjectPom(monitor, codeType, codeProject.getProjectPom());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
monitor.done();
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.runtime.projectsetting.IProjectSettingTemplateConstants;
|
||||
import org.talend.designer.maven.template.MavenTemplateManager;
|
||||
import org.talend.designer.maven.utils.PomUtil;
|
||||
import org.talend.designer.runprocess.IRunProcessService;
|
||||
|
||||
/**
|
||||
* DOC ggu class global comment. Detailled comment
|
||||
@@ -101,7 +102,11 @@ public abstract class AbstractMavenCodesTemplatePom extends AbstractMavenGeneral
|
||||
existedDependencies = new ArrayList<Dependency>();
|
||||
model.setDependencies(existedDependencies);
|
||||
}
|
||||
|
||||
boolean isCIMode = false;
|
||||
if (IRunProcessService.get() != null) {
|
||||
isCIMode = IRunProcessService.get().isCIMode();
|
||||
}
|
||||
boolean ignoreCIMode = Boolean.getBoolean("ignore.ci.mode");
|
||||
for (ModuleNeeded module : needModules) {
|
||||
Dependency dependency = null;
|
||||
// TDI-37032 add dependency only if jar available in maven
|
||||
@@ -116,7 +121,10 @@ public abstract class AbstractMavenCodesTemplatePom extends AbstractMavenGeneral
|
||||
} else {
|
||||
isDeployed = true;
|
||||
}
|
||||
if (ignoreModuleInstallationStatus() || isDeployed) {
|
||||
if (!isDeployed && ignoreCIMode) {
|
||||
continue;
|
||||
}
|
||||
if (isCIMode || ignoreModuleInstallationStatus() || isDeployed) {
|
||||
dependency = PomUtil.createModuleDependency(module.getMavenUri());
|
||||
if (module.isExcluded())
|
||||
dependency.setScope("provided");
|
||||
|
||||
@@ -659,7 +659,7 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
|
||||
// current job
|
||||
Property currentJobProperty = processor.getProperty();
|
||||
jobCoordinate.add(getJobCoordinate(currentJobProperty));
|
||||
|
||||
|
||||
// children jobs without test cases
|
||||
Set<JobInfo> childrenJobInfo = processor.getBuildChildrenJobs().stream().filter(j -> !j.isTestContainer())
|
||||
.collect(Collectors.toSet());
|
||||
@@ -669,16 +669,15 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
|
||||
|
||||
// talend libraries and codes
|
||||
List<Dependency> dependencies = new ArrayList<>();
|
||||
// codes
|
||||
List<Dependency> codeDependencies = new ArrayList<>();
|
||||
// codes
|
||||
addCodesDependencies(codeDependencies);
|
||||
// codesjar
|
||||
codeDependencies.addAll(getCodesJarDependenciesFromChildren());
|
||||
dependencies.addAll(codeDependencies);
|
||||
|
||||
// codes dependencies (optional)
|
||||
ERepositoryObjectType.getAllTypesOfCodes().forEach(t -> dependencies.addAll(PomUtil.getCodesDependencies(t)));
|
||||
|
||||
dependencies.addAll(codeDependencies);
|
||||
// libraries of talend/3rd party
|
||||
Set<Dependency> parentJobDependencies = processor
|
||||
.getNeededModules(
|
||||
|
||||
@@ -315,6 +315,12 @@ public class PomIdsHelper {
|
||||
return manager.getBoolean(MavenConstants.EXCLUDE_DELETED_ITEMS);
|
||||
}
|
||||
|
||||
public static boolean getMavenPrefOptionStatus(String prefName) {
|
||||
String projectTechName = ProjectManager.getInstance().getCurrentProject().getTechnicalLabel();
|
||||
ProjectPreferenceManager manager = getPreferenceManager(projectTechName);
|
||||
return manager.getBoolean(prefName);
|
||||
}
|
||||
|
||||
private static String getGroupId(String projectTechName, String baseName, Property property) {
|
||||
if (projectTechName == null) {
|
||||
projectTechName = ProjectManager.getInstance().getCurrentProject().getTechnicalLabel();
|
||||
@@ -393,6 +399,7 @@ public class PomIdsHelper {
|
||||
if (PluginChecker.isTIS()) {
|
||||
preferenceStore.setValue(MavenConstants.EXCLUDE_DELETED_ITEMS, true);
|
||||
}
|
||||
preferenceStore.setValue(MavenConstants.SKIP_LOOP_DEPENDENCY_CHECK, true);
|
||||
}
|
||||
preferenceManager.save();
|
||||
preferenceManagers.put(projectTechName, preferenceManager);
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry exported="true" kind="lib" path="lib/axis2-adb-codegen-1.6.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/XmlSchema-1.4.7.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/axis2-metadata-1.6.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/axis2-java2wsdl-1.6.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/axis2-codegen-1.6.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/woden-api-1.0M9.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/axiom-api-1.2.13.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/axiom-impl-1.2.13.jar"/>
|
||||
@@ -11,7 +16,6 @@
|
||||
<classpathentry exported="true" kind="lib" path="lib/httpcore-4.0.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/neethi-3.0.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/wstx-asl-3.2.9.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/xmlschema-core-2.0.1.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="output" path="class"/>
|
||||
|
||||
@@ -14,6 +14,7 @@ Bundle-ClassPath: lib/activation-1.1.jar,
|
||||
lib/axiom-api-1.2.13.jar,
|
||||
lib/axiom-impl-1.2.13.jar,
|
||||
lib/axis2-adb-1.6.2.jar,
|
||||
lib/axis2-adb-codegen-1.6.2.jar,
|
||||
lib/axis2-kernel-1.6.2.jar,
|
||||
lib/axis2-transport-http-1.6.2.jar,
|
||||
lib/axis2-transport-local-1.6.2.jar,
|
||||
@@ -22,8 +23,11 @@ Bundle-ClassPath: lib/activation-1.1.jar,
|
||||
lib/mail-1.4.jar,
|
||||
lib/neethi-3.0.1.jar,
|
||||
lib/wstx-asl-3.2.9.jar,
|
||||
lib/xmlschema-core-2.0.1.jar,
|
||||
lib/woden-api-1.0M9.jar,
|
||||
lib/axis2-codegen-1.6.2.jar,
|
||||
lib/axis2-java2wsdl-1.6.2.jar,
|
||||
lib/axis2-metadata-1.6.2.jar,
|
||||
lib/XmlSchema-1.4.7.jar,
|
||||
.
|
||||
Export-Package: com.ctc.wstx.api,
|
||||
com.ctc.wstx.cfg,
|
||||
@@ -129,6 +133,7 @@ Export-Package: com.ctc.wstx.api,
|
||||
org.apache.axis2.i18n,
|
||||
org.apache.axis2.java.security,
|
||||
org.apache.axis2.jaxrs,
|
||||
org.apache.axis2.jaxws.description,
|
||||
org.apache.axis2.jsr181,
|
||||
org.apache.axis2.modules,
|
||||
org.apache.axis2.namespace,
|
||||
@@ -167,9 +172,10 @@ Export-Package: com.ctc.wstx.api,
|
||||
org.apache.ws.commons.schema,
|
||||
org.apache.ws.commons.schema.constants,
|
||||
org.apache.ws.commons.schema.extensions,
|
||||
org.apache.ws.commons.schema.internal,
|
||||
org.apache.ws.commons.schema.resolver,
|
||||
org.apache.ws.commons.schema.utils,
|
||||
org.apache.ws.java2wsdl,
|
||||
org.apache.ws.java2wsdl.utils,
|
||||
org.codehaus.stax2,
|
||||
org.codehaus.stax2.evt,
|
||||
org.codehaus.stax2.io,
|
||||
|
||||
@@ -1,12 +1,82 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.talend.studio</groupId>
|
||||
<artifactId>tcommon-studio-se</artifactId>
|
||||
<version>7.3.1-PATCH</version>
|
||||
<relativePath>../../../</relativePath>
|
||||
</parent>
|
||||
<artifactId>org.talend.libraries.apache.axis2</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.talend.studio</groupId>
|
||||
<artifactId>tcommon-studio-se</artifactId>
|
||||
<version>7.3.1-PATCH</version>
|
||||
<relativePath>../../../</relativePath>
|
||||
</parent>
|
||||
<artifactId>org.talend.libraries.apache.axis2</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
||||
<properties>
|
||||
<axis2.version>1.6.2</axis2.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.axis2</groupId>
|
||||
<artifactId>axis2-codegen</artifactId>
|
||||
<version>${axis2.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.axis2</groupId>
|
||||
<artifactId>axis2-metadata</artifactId>
|
||||
<version>${axis2.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.axis2</groupId>
|
||||
<artifactId>axis2-java2wsdl</artifactId>
|
||||
<version>${axis2.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.axis2</groupId>
|
||||
<artifactId>axis2-adb-codegen</artifactId>
|
||||
<version>${axis2.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.ws.commons.schema</groupId>
|
||||
<artifactId>XmlSchema</artifactId>
|
||||
<version>1.4.7</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.eclipse.tycho</groupId>
|
||||
<artifactId>target-platform-configuration</artifactId>
|
||||
<version>${tycho.version}</version>
|
||||
<configuration>
|
||||
<dependency-resolution>
|
||||
<optionalDependencies>ignore</optionalDependencies>
|
||||
</dependency-resolution>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>2.8</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-dependencies</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<excludeTypes>pom</excludeTypes>
|
||||
<excludeTransitive>true</excludeTransitive>
|
||||
<outputDirectory>${project.basedir}/lib</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<classpathentry exported="true" kind="lib" path="lib/lucene-memory-4.10.4.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/lucene-misc-4.10.4.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/lucene-queries-4.10.4.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/lucene-queryparser-4.10.4.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/lucene-queryparser-5.5.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/lucene-sandbox-4.10.4.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/lucene-spatial-4.10.4.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/lucene-suggest-4.10.4.jar"/>
|
||||
|
||||
@@ -92,32 +92,32 @@ Export-Package: org.apache.lucene;version="4.10.4",
|
||||
org.apache.lucene.queries.function.docvalues;version="4.10.4",
|
||||
org.apache.lucene.queries.function.valuesource;version="4.10.4",
|
||||
org.apache.lucene.queries.mlt;version="4.10.4",
|
||||
org.apache.lucene.queryparser.analyzing;version="4.10.4",
|
||||
org.apache.lucene.queryparser.classic;version="4.10.4",
|
||||
org.apache.lucene.queryparser.complexPhrase;version="4.10.4",
|
||||
org.apache.lucene.queryparser.ext;version="4.10.4",
|
||||
org.apache.lucene.queryparser.flexible.core;version="4.10.4",
|
||||
org.apache.lucene.queryparser.flexible.core.builders;version="4.10.4",
|
||||
org.apache.lucene.queryparser.flexible.core.config;version="4.10.4",
|
||||
org.apache.lucene.queryparser.flexible.core.messages;version="4.10.4",
|
||||
org.apache.lucene.queryparser.flexible.core.nodes;version="4.10.4",
|
||||
org.apache.lucene.queryparser.flexible.core.parser;version="4.10.4",
|
||||
org.apache.lucene.queryparser.flexible.core.processors;version="4.10.4",
|
||||
org.apache.lucene.queryparser.flexible.core.util;version="4.10.4",
|
||||
org.apache.lucene.queryparser.flexible.messages;version="4.10.4",
|
||||
org.apache.lucene.queryparser.flexible.precedence;version="4.10.4",
|
||||
org.apache.lucene.queryparser.flexible.precedence.processors;version="4.10.4",
|
||||
org.apache.lucene.queryparser.flexible.standard;version="4.10.4",
|
||||
org.apache.lucene.queryparser.flexible.standard.builders;version="4.10.4",
|
||||
org.apache.lucene.queryparser.flexible.standard.config;version="4.10.4",
|
||||
org.apache.lucene.queryparser.flexible.standard.nodes;version="4.10.4",
|
||||
org.apache.lucene.queryparser.flexible.standard.parser;version="4.10.4",
|
||||
org.apache.lucene.queryparser.flexible.standard.processors;version="4.10.4",
|
||||
org.apache.lucene.queryparser.simple;version="4.10.4",
|
||||
org.apache.lucene.queryparser.surround.parser;version="4.10.4",
|
||||
org.apache.lucene.queryparser.surround.query;version="4.10.4",
|
||||
org.apache.lucene.queryparser.xml;version="4.10.4",
|
||||
org.apache.lucene.queryparser.xml.builders;version="4.10.4",
|
||||
org.apache.lucene.queryparser.analyzing;version="5.5.5",
|
||||
org.apache.lucene.queryparser.classic;version="5.5.5",
|
||||
org.apache.lucene.queryparser.complexPhrase;version="5.5.5",
|
||||
org.apache.lucene.queryparser.ext;version="5.5.5",
|
||||
org.apache.lucene.queryparser.flexible.core;version="5.5.5",
|
||||
org.apache.lucene.queryparser.flexible.core.builders;version="5.5.5",
|
||||
org.apache.lucene.queryparser.flexible.core.config;version="5.5.5",
|
||||
org.apache.lucene.queryparser.flexible.core.messages;version="5.5.5",
|
||||
org.apache.lucene.queryparser.flexible.core.nodes;version="5.5.5",
|
||||
org.apache.lucene.queryparser.flexible.core.parser;version="5.5.5",
|
||||
org.apache.lucene.queryparser.flexible.core.processors;version="5.5.5",
|
||||
org.apache.lucene.queryparser.flexible.core.util;version="5.5.5",
|
||||
org.apache.lucene.queryparser.flexible.messages;version="5.5.5",
|
||||
org.apache.lucene.queryparser.flexible.precedence;version="5.5.5",
|
||||
org.apache.lucene.queryparser.flexible.precedence.processors;version="5.5.5",
|
||||
org.apache.lucene.queryparser.flexible.standard;version="5.5.5",
|
||||
org.apache.lucene.queryparser.flexible.standard.builders;version="5.5.5",
|
||||
org.apache.lucene.queryparser.flexible.standard.config;version="5.5.5",
|
||||
org.apache.lucene.queryparser.flexible.standard.nodes;version="5.5.5",
|
||||
org.apache.lucene.queryparser.flexible.standard.parser;version="5.5.5",
|
||||
org.apache.lucene.queryparser.flexible.standard.processors;version="5.5.5",
|
||||
org.apache.lucene.queryparser.simple;version="5.5.5",
|
||||
org.apache.lucene.queryparser.surround.parser;version="5.5.5",
|
||||
org.apache.lucene.queryparser.surround.query;version="5.5.5",
|
||||
org.apache.lucene.queryparser.xml;version="5.5.5",
|
||||
org.apache.lucene.queryparser.xml.builders;version="5.5.5",
|
||||
org.apache.lucene.sandbox.queries;version="4.10.4",
|
||||
org.apache.lucene.sandbox.queries.regex;version="4.10.4",
|
||||
org.apache.lucene.search;version="4.10.4",
|
||||
@@ -163,7 +163,7 @@ Bundle-ClassPath: .,
|
||||
lib/lucene-memory-4.10.4.jar,
|
||||
lib/lucene-misc-4.10.4.jar,
|
||||
lib/lucene-queries-4.10.4.jar,
|
||||
lib/lucene-queryparser-4.10.4.jar,
|
||||
lib/lucene-queryparser-5.5.5.jar,
|
||||
lib/lucene-sandbox-4.10.4.jar,
|
||||
lib/lucene-spatial-4.10.4.jar,
|
||||
lib/lucene-suggest-4.10.4.jar
|
||||
|
||||
@@ -9,7 +9,7 @@ bin.includes = META-INF/,\
|
||||
lib/lucene-memory-4.10.4.jar,\
|
||||
lib/lucene-misc-4.10.4.jar,\
|
||||
lib/lucene-queries-4.10.4.jar,\
|
||||
lib/lucene-queryparser-4.10.4.jar,\
|
||||
lib/lucene-queryparser-5.5.5.jar,\
|
||||
lib/lucene-sandbox-4.10.4.jar,\
|
||||
lib/lucene-spatial-4.10.4.jar,\
|
||||
lib/lucene-suggest-4.10.4.jar
|
||||
|
||||
Binary file not shown.
@@ -9,4 +9,31 @@
|
||||
</parent>
|
||||
<artifactId>org.talend.libraries.apache.lucene4</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-queryparser</artifactId>
|
||||
<version>5.5.5</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-dependencies</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.basedir}/lib</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -69,6 +69,7 @@ import org.talend.core.model.general.ModuleNeeded;
|
||||
import org.talend.core.model.general.ModuleNeeded.ELibraryInstallStatus;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.process.IProcess;
|
||||
import org.talend.core.model.process.ProcessUtils;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.JobletProcessItem;
|
||||
import org.talend.core.model.properties.ProcessItem;
|
||||
|
||||
@@ -15,6 +15,8 @@ package org.talend.librariesmanager.nexus;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@@ -22,14 +24,17 @@ import java.util.List;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.Header;
|
||||
import org.apache.http.HttpHeaders;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.HttpStatus;
|
||||
import org.apache.http.client.ClientProtocolException;
|
||||
import org.apache.http.client.fluent.Request;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.impl.client.DefaultHttpClient;
|
||||
import org.apache.http.message.BasicHeader;
|
||||
import org.apache.http.params.CoreConnectionPNames;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.talend.commons.CommonsPlugin;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.utils.network.IProxySelectorProvider;
|
||||
@@ -53,6 +58,8 @@ import net.sf.json.JSONObject;
|
||||
*/
|
||||
public class ArtifacoryRepositoryHandler extends AbstractArtifactRepositoryHandler {
|
||||
|
||||
private static Logger LOGGER = Logger.getLogger(ArtifacoryRepositoryHandler.class);
|
||||
|
||||
private String SEARCH_SERVICE = "api/search/gavc?"; //$NON-NLS-1$
|
||||
|
||||
private static final String SEARCH_NAME = "api/search/artifact?";
|
||||
@@ -194,18 +201,9 @@ public class ArtifacoryRepositoryHandler extends AbstractArtifactRepositoryHandl
|
||||
}
|
||||
query = query + "v=" + versionToSearch;//$NON-NLS-1$
|
||||
}
|
||||
searchUrl = searchUrl + query;
|
||||
Request request = Request.Get(searchUrl);
|
||||
String userPass = serverBean.getUserName() + ":" + serverBean.getPassword(); //$NON-NLS-1$
|
||||
String basicAuth = "Basic " + new String(new Base64().encode(userPass.getBytes())); //$NON-NLS-1$
|
||||
Header authority = new BasicHeader("Authorization", basicAuth); //$NON-NLS-1$
|
||||
request.addHeader(authority);
|
||||
Header resultDetailHeader = new BasicHeader("X-Result-Detail", "info"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
request.addHeader(resultDetailHeader);
|
||||
List<MavenArtifact> resultList = new ArrayList<MavenArtifact>();
|
||||
|
||||
HttpResponse response = request.execute().returnResponse();
|
||||
String content = EntityUtils.toString(response.getEntity());
|
||||
searchUrl = searchUrl + query;
|
||||
String content = doRequest(searchUrl);//
|
||||
if (content.isEmpty()) {
|
||||
return resultList;
|
||||
}
|
||||
@@ -302,19 +300,9 @@ public class ArtifacoryRepositoryHandler extends AbstractArtifactRepositoryHandl
|
||||
}
|
||||
q += "repos=" + repositoryId;//$NON-NLS-1$
|
||||
}
|
||||
|
||||
searchUrl = searchUrl + q;
|
||||
Request request = Request.Get(searchUrl);
|
||||
String userPass = serverBean.getUserName() + ":" + serverBean.getPassword(); //$NON-NLS-1$
|
||||
String basicAuth = "Basic " + new String(new Base64().encode(userPass.getBytes())); //$NON-NLS-1$
|
||||
Header authority = new BasicHeader("Authorization", basicAuth); //$NON-NLS-1$
|
||||
request.addHeader(authority);
|
||||
Header resultDetailHeader = new BasicHeader("X-Result-Detail", "info"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
request.addHeader(resultDetailHeader);
|
||||
List<MavenArtifact> resultList = new ArrayList<MavenArtifact>();
|
||||
|
||||
HttpResponse response = request.execute().returnResponse();
|
||||
String content = EntityUtils.toString(response.getEntity());
|
||||
searchUrl = searchUrl + q;
|
||||
String content = doRequest(searchUrl);//
|
||||
if (content.isEmpty()) {
|
||||
return resultList;
|
||||
}
|
||||
@@ -493,4 +481,34 @@ public class ArtifacoryRepositoryHandler extends AbstractArtifactRepositoryHandl
|
||||
return doSearch(query, SEARCH_NAME, true, fromSnapshot);
|
||||
}
|
||||
|
||||
public 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);
|
||||
String userName = serverBean.getUserName();
|
||||
if (StringUtils.isNotBlank(userName) && !Boolean.getBoolean("talend.studio.search.nexus3.disableBasicAuth")) {
|
||||
String auth = userName + ":" + serverBean.getPassword();
|
||||
String authHeader = "Basic " + new String(Base64.encodeBase64(auth.getBytes(StandardCharsets.UTF_8)));
|
||||
httpGet.setHeader(HttpHeaders.AUTHORIZATION, authHeader);
|
||||
Header resultDetailHeader = new BasicHeader("X-Result-Detail", "info"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
httpGet.addHeader(resultDetailHeader);
|
||||
httpClient.setCredentialsProvider(null);
|
||||
}
|
||||
HttpResponse response = httpClient.execute(httpGet);
|
||||
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
|
||||
sb.append(EntityUtils.toString(response.getEntity()));
|
||||
} else {
|
||||
LOGGER.info("Try to search " + url + " failed!");
|
||||
throw new Exception(response.toString());
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
}.doRequest(null, new URI(url));
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,28 +150,32 @@ public class ShareLibrariesUtil {
|
||||
*/
|
||||
public static void seachArtifacts(IProgressMonitor monitor, IRepositoryArtifactHandler artifactHandler,
|
||||
Map<String, List<MavenArtifact>> snapshotArtifactMap, Map<String, List<MavenArtifact>> releaseArtifactMap,
|
||||
Set<String> snapshotGroupIdSet, Set<String> releaseGroupIdSet) throws Exception {
|
||||
Set<String> snapshotGroupIdSet, Set<String> releaseGroupIdSet) {
|
||||
if (artifactHandler != null) {
|
||||
checkCancel(monitor);
|
||||
List<MavenArtifact> searchResults = new ArrayList<MavenArtifact>();
|
||||
for (String groupId : releaseGroupIdSet) {
|
||||
searchResults = artifactHandler.search(groupId, null, null, true, false);
|
||||
if (searchResults != null) {
|
||||
for (MavenArtifact result : searchResults) {
|
||||
checkCancel(monitor);
|
||||
ShareLibrariesUtil.putArtifactToMap(result, releaseArtifactMap, false);
|
||||
try {
|
||||
checkCancel(monitor);
|
||||
List<MavenArtifact> searchResults = new ArrayList<MavenArtifact>();
|
||||
for (String groupId : releaseGroupIdSet) {
|
||||
searchResults = artifactHandler.search(groupId, null, null, true, false);
|
||||
if (searchResults != null) {
|
||||
for (MavenArtifact result : searchResults) {
|
||||
checkCancel(monitor);
|
||||
ShareLibrariesUtil.putArtifactToMap(result, releaseArtifactMap, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
checkCancel(monitor);
|
||||
for (String groupId : snapshotGroupIdSet) {
|
||||
searchResults = artifactHandler.search(groupId, null, null, false, true);
|
||||
if (searchResults != null) {
|
||||
for (MavenArtifact result : searchResults) {
|
||||
checkCancel(monitor);
|
||||
ShareLibrariesUtil.putArtifactToMap(result, snapshotArtifactMap, true);
|
||||
checkCancel(monitor);
|
||||
for (String groupId : snapshotGroupIdSet) {
|
||||
searchResults = artifactHandler.search(groupId, null, null, false, true);
|
||||
if (searchResults != null) {
|
||||
for (MavenArtifact result : searchResults) {
|
||||
checkCancel(monitor);
|
||||
ShareLibrariesUtil.putArtifactToMap(result, snapshotArtifactMap, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
import org.talend.commons.ui.runtime.swt.tableviewer.TableViewerCreatorColumnNotModifiable;
|
||||
import org.talend.commons.ui.runtime.swt.tableviewer.behavior.DefaultTableLabelProvider;
|
||||
import org.talend.commons.ui.swt.advanced.dataeditor.button.CasePushButton;
|
||||
import org.talend.commons.ui.swt.advanced.dataeditor.button.QuotePushButton;
|
||||
import org.talend.commons.ui.swt.advanced.dataeditor.button.ResetDBTypesPushButton;
|
||||
import org.talend.commons.ui.swt.advanced.dataeditor.control.ExtendedPushButton;
|
||||
import org.talend.commons.ui.swt.tableviewer.TableViewerCreator;
|
||||
@@ -89,6 +91,14 @@ public class CustomTableManagerOnlyForGenericSchema {
|
||||
if (resetDBTypesButton != null) {
|
||||
resetDBTypesButton.getButton().setEnabled(false);
|
||||
}
|
||||
CasePushButton caseButton = tableEditorView.getExtendedToolbar().getCaseButton();
|
||||
if (caseButton != null) {
|
||||
caseButton.getButton().setEnabled(false);
|
||||
}
|
||||
QuotePushButton quoteButton = tableEditorView.getExtendedToolbar().getQuoteButton();
|
||||
if (quoteButton != null) {
|
||||
quoteButton.getButton().setEnabled(false);
|
||||
}
|
||||
} else {
|
||||
tableEditorView.getExtendedToolbar().getAddButton().getButton().addSelectionListener(new SelectionListener() {
|
||||
|
||||
@@ -169,6 +179,14 @@ public class CustomTableManagerOnlyForGenericSchema {
|
||||
if (resetDBTypesButton != null) {
|
||||
resetDBTypesButton.getButton().setEnabled(false);
|
||||
}
|
||||
CasePushButton caseButton = tableEditorView.getExtendedToolbar().getCaseButton();
|
||||
if (caseButton != null) {
|
||||
caseButton.getButton().setEnabled(false);
|
||||
}
|
||||
QuotePushButton quoteButton = tableEditorView.getExtendedToolbar().getQuoteButton();
|
||||
if (quoteButton != null) {
|
||||
quoteButton.getButton().setEnabled(false);
|
||||
}
|
||||
}
|
||||
if (linkedTable != null) {
|
||||
if (linkedTable.isReadOnly()) {
|
||||
|
||||
@@ -139,6 +139,7 @@ public final class OtherConnectionContextUtils {
|
||||
DbSchema,
|
||||
DbUsername,
|
||||
DbPassword,
|
||||
DbParameters,
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -611,6 +612,10 @@ public final class OtherConnectionContextUtils {
|
||||
conn.getValue(TaggedValueHelper.getValueString(ISAPConstant.PROP_DB_PASSWORD, conn), false),
|
||||
JavaTypesManager.PASSWORD);
|
||||
break;
|
||||
case DbParameters:
|
||||
ConnectionContextHelper.createParameters(varList, paramName,
|
||||
TaggedValueHelper.getValueString(ISAPConstant.PROP_DB_ADDITIONAL_PROPERTIES, conn));
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
@@ -722,6 +727,10 @@ public final class OtherConnectionContextUtils {
|
||||
TaggedValueHelper.setTaggedValue(sapConn, ISAPConstant.PROP_DB_PASSWORD,
|
||||
ContextParameterUtils.getNewScriptCode(sapBasicVarName, LANGUAGE));
|
||||
break;
|
||||
case DbParameters:
|
||||
TaggedValueHelper.setTaggedValue(sapConn, ISAPConstant.PROP_DB_ADDITIONAL_PROPERTIES,
|
||||
ContextParameterUtils.getNewScriptCode(sapBasicVarName, LANGUAGE));
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
@@ -768,11 +777,14 @@ public final class OtherConnectionContextUtils {
|
||||
TaggedValueHelper.getValueString(ISAPConstant.PROP_DB_USERNAME, conn)));
|
||||
String dbPassword = TalendQuoteUtils.removeQuotes(ConnectionContextHelper.getOriginalValue(contextType,
|
||||
conn.getValue(TaggedValueHelper.getValueString(ISAPConstant.PROP_DB_PASSWORD, conn), false)));
|
||||
String dbParameters = TalendQuoteUtils.removeQuotes(ConnectionContextHelper.getOriginalValue(contextType,
|
||||
TaggedValueHelper.getValueString(ISAPConstant.PROP_DB_ADDITIONAL_PROPERTIES, conn)));
|
||||
TaggedValueHelper.setTaggedValue(conn, ISAPConstant.PROP_DB_HOST, dbHost);
|
||||
TaggedValueHelper.setTaggedValue(conn, ISAPConstant.PROP_DB_PORT, dbPort);
|
||||
TaggedValueHelper.setTaggedValue(conn, ISAPConstant.PROP_DB_SCHEMA, dbSchema);
|
||||
TaggedValueHelper.setTaggedValue(conn, ISAPConstant.PROP_DB_USERNAME, dbUsername);
|
||||
TaggedValueHelper.setTaggedValue(conn, ISAPConstant.PROP_DB_PASSWORD, conn.getValue(dbPassword, true));
|
||||
TaggedValueHelper.setTaggedValue(conn, ISAPConstant.PROP_DB_ADDITIONAL_PROPERTIES, dbParameters);
|
||||
}
|
||||
|
||||
public static SAPConnection cloneOriginalValueSAPConnection(SAPConnection fileConn, ContextType contextType) {
|
||||
@@ -813,11 +825,14 @@ public final class OtherConnectionContextUtils {
|
||||
TaggedValueHelper.getValueString(ISAPConstant.PROP_DB_USERNAME, fileConn));
|
||||
String dbPassword = ConnectionContextHelper.getOriginalValue(contextType,
|
||||
fileConn.getValue(TaggedValueHelper.getValueString(ISAPConstant.PROP_DB_PASSWORD, fileConn), false));
|
||||
String dbParameters = ConnectionContextHelper.getOriginalValue(contextType,
|
||||
TaggedValueHelper.getValueString(ISAPConstant.PROP_DB_ADDITIONAL_PROPERTIES, fileConn));
|
||||
TaggedValueHelper.setTaggedValue(cloneConn, ISAPConstant.PROP_DB_HOST, dbHost);
|
||||
TaggedValueHelper.setTaggedValue(cloneConn, ISAPConstant.PROP_DB_PORT, dbPort);
|
||||
TaggedValueHelper.setTaggedValue(cloneConn, ISAPConstant.PROP_DB_SCHEMA, dbSchema);
|
||||
TaggedValueHelper.setTaggedValue(cloneConn, ISAPConstant.PROP_DB_USERNAME, dbUsername);
|
||||
TaggedValueHelper.setTaggedValue(cloneConn, ISAPConstant.PROP_DB_PASSWORD, dbPassword);
|
||||
TaggedValueHelper.setTaggedValue(cloneConn, ISAPConstant.PROP_DB_ADDITIONAL_PROPERTIES, dbParameters);
|
||||
|
||||
ConnectionContextHelper.cloneConnectionProperties(fileConn, cloneConn);
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ Require-Bundle: org.eclipse.ui,
|
||||
org.apache.commons.logging,
|
||||
org.apache.commons.collections,
|
||||
org.apache.commons.lang,
|
||||
org.apache.axis,
|
||||
org.talend.libraries.mdm;resolution:=optional,
|
||||
org.talend.common.ui.runtime,
|
||||
org.talend.core.runtime,
|
||||
@@ -17,7 +16,8 @@ Require-Bundle: org.eclipse.ui,
|
||||
org.apache.log4j,
|
||||
javax.xml.rpc,
|
||||
org.eclipse.xsd,
|
||||
javax.xml.ws
|
||||
javax.xml.ws,
|
||||
org.talend.libraries.apache.axis2
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Eclipse-RegisterBuddy: org.talend.testutils
|
||||
Export-Package: metadata.managment.i18n,
|
||||
|
||||
@@ -14,6 +14,7 @@ package org.talend.core.model.metadata.builder.database;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
@@ -387,12 +388,12 @@ public class ExtractMetaDataFromDataBase {
|
||||
private static boolean checkSybaseDB(Connection connection, String database) {
|
||||
ExtractMetaDataUtils extractMeta = ExtractMetaDataUtils.getInstance();
|
||||
if (extractMeta != null) {
|
||||
Statement stmt = null;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet resultSet = null;
|
||||
try {
|
||||
stmt = connection.createStatement();
|
||||
stmt = connection.prepareStatement("sp_helpdb " + database);
|
||||
extractMeta.setQueryStatementTimeout(stmt);
|
||||
resultSet = stmt.executeQuery("sp_helpdb " + database);
|
||||
resultSet = stmt.executeQuery();
|
||||
return true;
|
||||
} catch (SQLException e) {
|
||||
ExceptionHandler.process(e);
|
||||
@@ -705,25 +706,23 @@ public class ExtractMetaDataFromDataBase {
|
||||
tableComment = tablesSet.getString(GetTable.REMARKS.name());
|
||||
}
|
||||
if (StringUtils.isBlank(tableComment)) {
|
||||
String selectRemarkOnTable = getSelectRemarkOnTable(tableName);
|
||||
if (selectRemarkOnTable != null && connection != null) {
|
||||
tableComment = executeGetCommentStatement(selectRemarkOnTable, connection);
|
||||
if (connection != null) {
|
||||
tableComment = executeGetCommentStatement(connection, tableName);
|
||||
}
|
||||
}
|
||||
return tableComment;
|
||||
}
|
||||
|
||||
private static String getSelectRemarkOnTable(String tableName) {
|
||||
return "SELECT TABLE_COMMENT FROM information_schema.TABLES WHERE TABLE_NAME='" + tableName + "'"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
private static String executeGetCommentStatement(Connection connection, String tableName) {
|
||||
String sql = "SELECT TABLE_COMMENT FROM information_schema.TABLES WHERE TABLE_NAME=?";
|
||||
|
||||
private static String executeGetCommentStatement(String queryStmt, Connection connection) {
|
||||
String comment = null;
|
||||
Statement statement = null;
|
||||
PreparedStatement statement = null;
|
||||
ResultSet resultSet = null;
|
||||
try {
|
||||
statement = connection.createStatement();
|
||||
statement.execute(queryStmt);
|
||||
statement = connection.prepareStatement(sql);
|
||||
statement.setString(1, tableName);
|
||||
statement.execute();
|
||||
|
||||
// get the results
|
||||
resultSet = statement.getResultSet();
|
||||
|
||||
@@ -15,6 +15,7 @@ package org.talend.core.model.metadata.builder.database.manager;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.Driver;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
@@ -1067,9 +1068,9 @@ public class ExtractManager {
|
||||
try {
|
||||
if (!tableInfoParameters.isUsedName()) {
|
||||
if (tableInfoParameters.getSqlFiter() != null && !"".equals(tableInfoParameters.getSqlFiter())) { //$NON-NLS-1$
|
||||
Statement stmt = extractMeta.getConn().createStatement();
|
||||
PreparedStatement stmt = extractMeta.getConn().prepareStatement(tableInfoParameters.getSqlFiter());
|
||||
extractMeta.setQueryStatementTimeout(stmt);
|
||||
ResultSet rsTables = stmt.executeQuery(tableInfoParameters.getSqlFiter());
|
||||
ResultSet rsTables = stmt.executeQuery();
|
||||
itemTablesName = ExtractMetaDataFromDataBase.getTableNamesFromQuery(rsTables, extractMeta.getConn());
|
||||
rsTables.close();
|
||||
stmt.close();
|
||||
|
||||
@@ -14,9 +14,9 @@ package org.talend.core.model.metadata.builder.database.manager.dbs;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -68,15 +68,17 @@ public class IBMDB2ExtractManager extends ExtractManager {
|
||||
|
||||
@Override
|
||||
public String getTableNameBySynonyms(Connection conn, String tableName) {
|
||||
Statement sta = null;
|
||||
PreparedStatement sta = null;
|
||||
ResultSet resultSet = null;
|
||||
|
||||
try {
|
||||
if (conn != null && conn.getMetaData().getDatabaseProductName().startsWith(DATABASE_PRODUCT_NAME)) {
|
||||
String sql = "SELECT NAME,BASE_NAME FROM SYSIBM.SYSTABLES where TYPE='A' and name ='" + tableName + "'";
|
||||
sta = conn.createStatement();
|
||||
String sql = "SELECT NAME,BASE_NAME FROM SYSIBM.SYSTABLES where TYPE='A' and name =?";
|
||||
sta = conn.prepareStatement(sql);
|
||||
sta.setString(1, tableName);
|
||||
|
||||
ExtractMetaDataUtils.getInstance().setQueryStatementTimeout(sta);
|
||||
resultSet = sta.executeQuery(sql);
|
||||
resultSet = sta.executeQuery();
|
||||
while (resultSet.next()) {
|
||||
String baseName = resultSet.getString("base_name").trim();
|
||||
return baseName;
|
||||
@@ -113,15 +115,16 @@ public class IBMDB2ExtractManager extends ExtractManager {
|
||||
ExtractMetaDataUtils extractMeta = ExtractMetaDataUtils.getInstance();
|
||||
// need to retrieve columns of synonym by useing sql rather than get them from jdbc metadata
|
||||
String synSQL = "SELECT a.*\n" + "FROM SYSCAT.COLUMNS a\n" + "LEFT OUTER JOIN SYSIBM.SYSTABLES b\n"
|
||||
+ "ON a.TABNAME = b.NAME\n" + "AND a.TABSCHEMA = b.CREATOR\n" + "where a.TABNAME =" + "\'" + tableName
|
||||
+ "\'\n";
|
||||
+ "ON a.TABNAME = b.NAME\n" + "AND a.TABSCHEMA = b.CREATOR\n" + "where a.TABNAME =?\n";
|
||||
if (!("").equals(metadataConnection.getSchema())) {
|
||||
synSQL += "AND b.CREATOR =\'" + metadataConnection.getSchema() + "\'";
|
||||
}
|
||||
synSQL += "ORDER BY a.COLNO";
|
||||
Statement sta = extractMeta.getConn().createStatement();
|
||||
PreparedStatement sta = extractMeta.getConn().prepareStatement(synSQL);
|
||||
sta.setString(1, tableName);
|
||||
|
||||
extractMeta.setQueryStatementTimeout(sta);
|
||||
ResultSet columns = sta.executeQuery(synSQL);
|
||||
ResultSet columns = sta.executeQuery();
|
||||
String typeName = null;
|
||||
int index = 0;
|
||||
List<String> columnLabels = new ArrayList<String>();
|
||||
|
||||
@@ -14,9 +14,9 @@ package org.talend.core.model.metadata.builder.database.manager.dbs;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
@@ -93,8 +93,8 @@ public class ImpalaExtractManager extends ExtractManager {
|
||||
DatabaseMetaData metaData = conn.getMetaData();
|
||||
if (!tableInfoParameters.isUsedName()) {
|
||||
if (tableInfoParameters.getSqlFiter() != null && !"".equals(tableInfoParameters.getSqlFiter())) { //$NON-NLS-1$
|
||||
Statement stmt = conn.createStatement();
|
||||
ResultSet rsTables = stmt.executeQuery(tableInfoParameters.getSqlFiter());
|
||||
PreparedStatement stmt = conn.prepareStatement(tableInfoParameters.getSqlFiter());
|
||||
ResultSet rsTables = stmt.executeQuery();
|
||||
itemTablesName = ExtractMetaDataFromDataBase.getTableNamesFromQuery(rsTables, conn);
|
||||
rsTables.close();
|
||||
stmt.close();
|
||||
|
||||
@@ -17,7 +17,6 @@ import java.sql.DatabaseMetaData;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -53,16 +52,16 @@ public class MSSQLExtractManager extends ExtractManager {
|
||||
@Override
|
||||
public String getTableNameBySynonyms(Connection conn, String tableName) {
|
||||
|
||||
Statement sta = null;
|
||||
PreparedStatement sta = null;
|
||||
ResultSet resultSet = null;
|
||||
|
||||
try {
|
||||
if (conn != null && conn.getMetaData().getDatabaseProductName().equals(EDatabaseTypeName.MSSQL.getDisplayName())) {
|
||||
String sql = "SELECT object_id ,parent_object_id as parentid, name AS object_name , base_object_name as base_name from sys.synonyms where name ='"
|
||||
+ tableName + "'";
|
||||
sta = conn.createStatement();
|
||||
String sql = "SELECT object_id ,parent_object_id as parentid, name AS object_name , base_object_name as base_name from sys.synonyms where name =?";
|
||||
sta = conn.prepareStatement(sql);
|
||||
sta.setString(1, tableName);
|
||||
ExtractMetaDataUtils.getInstance().setQueryStatementTimeout(sta);
|
||||
resultSet = sta.executeQuery(sql);
|
||||
resultSet = sta.executeQuery();
|
||||
while (resultSet.next()) {
|
||||
String baseName = resultSet.getString("base_name").trim();
|
||||
if (baseName.contains(".") && baseName.length() > 2) {
|
||||
@@ -124,16 +123,25 @@ public class MSSQLExtractManager extends ExtractManager {
|
||||
}
|
||||
}
|
||||
// need to retrieve columns of synonym by useing sql rather than get them from jdbc metadata
|
||||
String synSQL = "select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME =\'" + TABLE_NAME + "\'";
|
||||
String synSQL = "select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME =?";
|
||||
if (null != TABLE_SCHEMA) {
|
||||
synSQL += "\nand TABLE_SCHEMA =\'" + TABLE_SCHEMA + "\'";
|
||||
synSQL += "\nand TABLE_SCHEMA =?";
|
||||
}
|
||||
if (!("").equals(metadataConnection.getDatabase())) {
|
||||
synSQL += "\nand TABLE_CATALOG =\'" + metadataConnection.getDatabase() + "\'";
|
||||
synSQL += "\nand TABLE_CATALOG =?";
|
||||
}
|
||||
PreparedStatement sta = extractMeta.getConn().prepareStatement(synSQL);
|
||||
sta.setString(1, TABLE_NAME);
|
||||
int idx = 2;
|
||||
if (null != TABLE_SCHEMA) {
|
||||
sta.setString(idx, TABLE_SCHEMA);
|
||||
idx++;
|
||||
}
|
||||
if (!("").equals(metadataConnection.getDatabase())) {
|
||||
sta.setString(idx, metadataConnection.getDatabase());
|
||||
}
|
||||
Statement sta = extractMeta.getConn().createStatement();
|
||||
extractMeta.setQueryStatementTimeout(sta);
|
||||
ResultSet columns = sta.executeQuery(synSQL);
|
||||
ResultSet columns = sta.executeQuery();
|
||||
String typeName = null;
|
||||
int index = 0;
|
||||
List<String> columnLabels = new ArrayList<String>();
|
||||
|
||||
@@ -17,7 +17,6 @@ import java.sql.DatabaseMetaData;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -72,20 +71,22 @@ public class OracleExtractManager extends ExtractManager {
|
||||
protected List<String> getTablesToFilter(IMetadataConnection metadataConnection) {
|
||||
|
||||
List<String> tablesToFilter = new ArrayList<String>();
|
||||
Statement stmt;
|
||||
PreparedStatement stmt = null;
|
||||
ExtractMetaDataUtils extractMeta = ExtractMetaDataUtils.getInstance();
|
||||
try {
|
||||
stmt = extractMeta.getConn().createStatement();
|
||||
extractMeta.setQueryStatementTimeout(stmt);
|
||||
if (EDatabaseTypeName.ORACLEFORSID.getDisplayName().equals(metadataConnection.getDbType())
|
||||
|| EDatabaseTypeName.ORACLESN.getDisplayName().equals(metadataConnection.getDbType())
|
||||
|| EDatabaseTypeName.ORACLE_CUSTOM.getDisplayName().equals(metadataConnection.getDbType())
|
||||
|| EDatabaseTypeName.ORACLE_OCI.getDisplayName().equals(metadataConnection.getDbType())) {
|
||||
ResultSet rsTables = stmt.executeQuery(ORACLE_10G_RECBIN_SQL);
|
||||
stmt = extractMeta.getConn().prepareStatement(ORACLE_10G_RECBIN_SQL);
|
||||
extractMeta.setQueryStatementTimeout(stmt);
|
||||
ResultSet rsTables = stmt.executeQuery();
|
||||
tablesToFilter = ExtractMetaDataFromDataBase.getTableNamesFromQuery(rsTables, extractMeta.getConn());
|
||||
rsTables.close();
|
||||
}
|
||||
stmt.close();
|
||||
if (stmt != null) {
|
||||
stmt.close();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
@@ -104,11 +105,12 @@ public class OracleExtractManager extends ExtractManager {
|
||||
List<String> tablesToFilter = getTablesToFilter(metadataConnection);
|
||||
|
||||
try {
|
||||
Statement stmt = extractMeta.getConn().createStatement();
|
||||
PreparedStatement stmt = extractMeta.getConn().prepareStatement(GET_ALL_SYNONYMS);
|
||||
extractMeta.setQueryStatementTimeout(stmt);
|
||||
ResultSet rsTables = stmt.executeQuery(GET_ALL_SYNONYMS);
|
||||
ResultSet rsTables = stmt.executeQuery();
|
||||
getMetadataTables(medataTables, rsTables, dbMetaData.supportsSchemasInTableDefinitions(), tablesToFilter, limit);
|
||||
rsTables.close();
|
||||
stmt.close();
|
||||
} catch (SQLException e) {
|
||||
ExceptionHandler.process(e);
|
||||
log.error(e.toString());
|
||||
@@ -127,18 +129,20 @@ public class OracleExtractManager extends ExtractManager {
|
||||
@Override
|
||||
public String getTableNameBySynonyms(Connection conn, String tableName) {
|
||||
// bug TDI-19382
|
||||
Statement sta = null;
|
||||
PreparedStatement sta = null;
|
||||
ResultSet resultSet = null;
|
||||
|
||||
try {
|
||||
if (conn != null && conn.getMetaData().getDatabaseProductName().equals(DATABASE_PRODUCT_NAME)) {
|
||||
String sql = "select TABLE_NAME from ALL_SYNONYMS where SYNONYM_NAME = '" + tableName + "'"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
String sql = "select TABLE_NAME from ALL_SYNONYMS where SYNONYM_NAME = ?"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
// String sql = "select * from all_tab_columns where upper(table_name)='" + name +
|
||||
// "' order by column_id";
|
||||
// Statement sta;
|
||||
sta = conn.createStatement();
|
||||
sta = conn.prepareStatement(sql);
|
||||
sta.setString(1, tableName);
|
||||
|
||||
ExtractMetaDataUtils.getInstance().setQueryStatementTimeout(sta);
|
||||
resultSet = sta.executeQuery(sql);
|
||||
resultSet = sta.executeQuery();
|
||||
while (resultSet.next()) {
|
||||
return resultSet.getString("TABLE_NAME"); //$NON-NLS-1$
|
||||
}
|
||||
@@ -173,19 +177,25 @@ public class OracleExtractManager extends ExtractManager {
|
||||
// need to retrieve columns of synonym by useing sql rather than get them from jdbc metadata
|
||||
String synSQL = "SELECT all_tab_columns.*\n" + "FROM all_tab_columns\n" + "LEFT OUTER JOIN all_synonyms\n"
|
||||
+ "ON all_tab_columns.TABLE_NAME = all_synonyms.TABLE_NAME\n"
|
||||
+ "AND ALL_SYNONYMS.TABLE_OWNER = all_tab_columns.OWNER\n" + "WHERE all_synonyms.SYNONYM_NAME =" + "\'"
|
||||
+ synonymName + "\'\n";
|
||||
+ "AND ALL_SYNONYMS.TABLE_OWNER = all_tab_columns.OWNER\n" + "WHERE all_synonyms.SYNONYM_NAME =?\n";
|
||||
// bug TDI-19382
|
||||
if (!("").equals(metadataConnection.getSchema())) {
|
||||
synSQL += "and all_synonyms.OWNER =\'" + metadataConnection.getSchema() + "\'";
|
||||
synSQL += "and all_synonyms.OWNER =?";
|
||||
} else if (table.eContainer() instanceof Schema) {
|
||||
Schema schema = (Schema) table.eContainer();
|
||||
synSQL += "and all_synonyms.OWNER =\'" + schema.getName() + "\'";
|
||||
synSQL += "and all_synonyms.OWNER =?";
|
||||
}
|
||||
synSQL += " ORDER BY all_tab_columns.COLUMN_NAME"; //$NON-NLS-1$
|
||||
Statement sta = extractMeta.getConn().createStatement();
|
||||
PreparedStatement sta = extractMeta.getConn().prepareStatement(synSQL);
|
||||
sta.setString(1, synonymName);
|
||||
int idx = 2;
|
||||
if (!("").equals(metadataConnection.getSchema())) {
|
||||
sta.setString(idx, metadataConnection.getSchema());
|
||||
} else if (table.eContainer() instanceof Schema) {
|
||||
Schema schema = (Schema) table.eContainer();
|
||||
sta.setString(idx, schema.getName());
|
||||
}
|
||||
extractMeta.setQueryStatementTimeout(sta);
|
||||
ResultSet columns = sta.executeQuery(synSQL);
|
||||
ResultSet columns = sta.executeQuery();
|
||||
String typeName = null;
|
||||
int index = 0;
|
||||
List<String> columnLabels = new ArrayList<String>();
|
||||
@@ -247,10 +257,11 @@ public class OracleExtractManager extends ExtractManager {
|
||||
throws SQLException {
|
||||
ExtractMetaDataUtils extractMeta = ExtractMetaDataUtils.getInstance();
|
||||
if (extractMeta.isUseAllSynonyms()) {
|
||||
String sql = "select * from all_tab_columns where table_name='" + tableName + "' ORDER BY all_tab_columns.COLUMN_NAME"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
Statement stmt = extractMeta.getConn().createStatement();
|
||||
String sql = "select * from all_tab_columns where table_name=? ORDER BY all_tab_columns.COLUMN_NAME"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
PreparedStatement stmt = extractMeta.getConn().prepareStatement(sql);
|
||||
stmt.setString(1, tableName);
|
||||
extractMeta.setQueryStatementTimeout(stmt);
|
||||
return stmt.executeQuery(sql);
|
||||
return stmt.executeQuery();
|
||||
} else {
|
||||
return super.getColumnsResultSet(dbMetaData, catalogName, schemaName, tableName);
|
||||
}
|
||||
@@ -260,10 +271,10 @@ public class OracleExtractManager extends ExtractManager {
|
||||
public void synchroViewStructure(String catalogName, String schemaName, String tableName) throws SQLException {
|
||||
ExtractMetaDataUtils extractMeta = ExtractMetaDataUtils.getInstance();
|
||||
ResultSet results = null;
|
||||
Statement stmt = null;
|
||||
PreparedStatement stmt = null;
|
||||
String sql = null;
|
||||
if (extractMeta.isUseAllSynonyms()) {
|
||||
sql = "select * from all_tab_columns where table_name='" + tableName + "'"; //$NON-NLS-1$
|
||||
sql = "select * from all_tab_columns where table_name=?"; //$NON-NLS-1$
|
||||
} else {
|
||||
StringBuffer sqlBuffer = new StringBuffer();
|
||||
sqlBuffer.append("SELECT * FROM ");
|
||||
@@ -274,9 +285,12 @@ public class OracleExtractManager extends ExtractManager {
|
||||
sql = sqlBuffer.toString();
|
||||
}
|
||||
try {
|
||||
stmt = extractMeta.getConn().createStatement();
|
||||
stmt = extractMeta.getConn().prepareStatement(sql);
|
||||
if (extractMeta.isUseAllSynonyms()) {
|
||||
stmt.setString(1, tableName);
|
||||
}
|
||||
extractMeta.setQueryStatementTimeout(stmt);
|
||||
results = stmt.executeQuery(sql);
|
||||
results = stmt.executeQuery();
|
||||
} finally {
|
||||
if (results != null) {
|
||||
results.close();
|
||||
@@ -302,8 +316,8 @@ public class OracleExtractManager extends ExtractManager {
|
||||
PreparedStatement statement = null;
|
||||
ExtractMetaDataUtils extractMeta = ExtractMetaDataUtils.getInstance();
|
||||
try {
|
||||
statement = extractMeta.getConn().prepareStatement("SELECT COMMENTS FROM USER_COL_COMMENTS WHERE TABLE_NAME='" //$NON-NLS-1$
|
||||
+ tableName + "'"); //$NON-NLS-1$
|
||||
statement = extractMeta.getConn().prepareStatement("SELECT COMMENTS FROM USER_COL_COMMENTS WHERE TABLE_NAME=?"); //$NON-NLS-1$
|
||||
statement.setString(1, tableName);
|
||||
extractMeta.setQueryStatementTimeout(statement);
|
||||
if (statement.execute()) {
|
||||
keys = statement.getResultSet();
|
||||
@@ -337,9 +351,9 @@ public class OracleExtractManager extends ExtractManager {
|
||||
&& !metadataConnection.getDbVersionString().equals(EDatabaseVersion4Drivers.ORACLE_8.getVersionValue())) {
|
||||
ExtractMetaDataUtils extractMeta = ExtractMetaDataUtils.getInstance();
|
||||
try {
|
||||
Statement stmt = extractMeta.getConn().createStatement();
|
||||
PreparedStatement stmt = extractMeta.getConn().prepareStatement(TableInfoParameters.ORACLE_10G_RECBIN_SQL);
|
||||
extractMeta.setQueryStatementTimeout(stmt);
|
||||
ResultSet rsTables = stmt.executeQuery(TableInfoParameters.ORACLE_10G_RECBIN_SQL);
|
||||
ResultSet rsTables = stmt.executeQuery();
|
||||
itemTablesName.removeAll(ExtractMetaDataFromDataBase.getTableNamesFromQuery(rsTables, extractMeta.getConn()));
|
||||
rsTables.close();
|
||||
stmt.close();
|
||||
@@ -359,27 +373,27 @@ public class OracleExtractManager extends ExtractManager {
|
||||
if (con != null && con.toString().contains("oracle.jdbc.driver") //$NON-NLS-1$
|
||||
&& extractMeta.isUseAllSynonyms()) {
|
||||
Set<String> nameFiters = tableInfoParameters.getNameFilters();
|
||||
Statement stmt = con.createStatement();
|
||||
extractMeta.setQueryStatementTimeout(stmt);
|
||||
|
||||
StringBuffer filters = new StringBuffer();
|
||||
if (!nameFiters.isEmpty()) {
|
||||
filters.append(" and ("); //$NON-NLS-1$
|
||||
final String tStr = " all_synonyms.synonym_name like '"; //$NON-NLS-1$
|
||||
int i = 0;
|
||||
for (String s : nameFiters) {
|
||||
final String tStr = " all_synonyms.synonym_name like ?"; //$NON-NLS-1$
|
||||
for (int i = 0; i < nameFiters.size(); i++) {
|
||||
if (i != 0) {
|
||||
filters.append(" or "); //$NON-NLS-1$
|
||||
}
|
||||
filters.append(tStr);
|
||||
filters.append(s);
|
||||
filters.append('\'');
|
||||
i++;
|
||||
|
||||
}
|
||||
filters.append(')');
|
||||
}
|
||||
ResultSet rsTables = stmt.executeQuery(GET_ALL_SYNONYMS + filters.toString());
|
||||
PreparedStatement stmt = con.prepareStatement(GET_ALL_SYNONYMS + filters.toString());
|
||||
int i = 1;
|
||||
for (String s : nameFiters) {
|
||||
stmt.setString(i, s);
|
||||
i++;
|
||||
}
|
||||
extractMeta.setQueryStatementTimeout(stmt);
|
||||
ResultSet rsTables = stmt.executeQuery();
|
||||
itemTablesName = ExtractMetaDataFromDataBase.getTableNamesFromQuery(rsTables, extractMeta.getConn());
|
||||
rsTables.close();
|
||||
stmt.close();
|
||||
|
||||
@@ -15,8 +15,8 @@ package org.talend.metadata.managment.connection.manager;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.Driver;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
@@ -25,8 +25,6 @@ import java.util.concurrent.FutureTask;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import metadata.managment.i18n.Messages;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
@@ -56,6 +54,8 @@ import org.talend.metadata.managment.hive.handler.HDP200YarnHandler;
|
||||
import org.talend.metadata.managment.hive.handler.HiveConnectionHandler;
|
||||
import org.talend.metadata.managment.hive.handler.Mapr212Handler;
|
||||
|
||||
import metadata.managment.i18n.Messages;
|
||||
|
||||
/**
|
||||
* Created by Marvin Wang on Mar 13, 2013.
|
||||
*/
|
||||
@@ -492,26 +492,18 @@ public class HiveConnectionManager extends DataBaseConnectionManager {
|
||||
}
|
||||
String jdbcPropertiesStr = String.valueOf(jdbcPropertiesObj);
|
||||
List<Map<String, Object>> jdbcProperties = HadoopRepositoryUtil.getHadoopPropertiesList(jdbcPropertiesStr);
|
||||
Statement statement = null;
|
||||
try {
|
||||
statement = dbConn.createStatement();
|
||||
for (Map<String, Object> propMap : jdbcProperties) {
|
||||
String key = TalendQuoteUtils.removeQuotesIfExist(String.valueOf(propMap.get("PROPERTY"))); //$NON-NLS-1$
|
||||
String value = TalendQuoteUtils.removeQuotesIfExist(String.valueOf(propMap.get("VALUE"))); //$NON-NLS-1$
|
||||
if (StringUtils.isNotEmpty(key) && value != null) {
|
||||
statement.execute("SET " + key + "=" + value); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
PreparedStatement ps = dbConn.prepareStatement("SET " + key + "=" + value);
|
||||
ps.execute(); // $NON-NLS-1$ //$NON-NLS-2$
|
||||
ps.close();
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
ExceptionHandler.process(e);
|
||||
} finally {
|
||||
if (statement != null) {
|
||||
try {
|
||||
statement.close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,8 @@ import java.io.StringReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.axis.client.Stub;
|
||||
import org.apache.axis2.client.Options;
|
||||
import org.apache.axis2.client.Stub;
|
||||
import org.talend.core.classloader.ClassLoaderFactory;
|
||||
import org.talend.core.classloader.DynamicClassLoader;
|
||||
import org.talend.core.model.metadata.builder.connection.MDMConnection;
|
||||
@@ -53,11 +54,11 @@ public class S56MdmConnectionHelper extends AbsMdmConnectionHelper {
|
||||
if (invokeMethod instanceof Stub) {
|
||||
stub = (Stub) invokeMethod;
|
||||
if (universe == null || universe.trim().length() == 0) {
|
||||
stub.setUsername(userName);
|
||||
stub._getServiceClient().getOptions().setUserName(userName);
|
||||
} else {
|
||||
stub.setUsername(universe + "/" + userName); //$NON-NLS-1$
|
||||
stub._getServiceClient().getOptions().setUserName(universe + "/" + userName); //$NON-NLS-1$
|
||||
}
|
||||
stub.setPassword(password);
|
||||
stub._getServiceClient().getOptions().setPassword(password);
|
||||
Object wsping = ReflectionUtils.newInstance("org.talend.mdm.webservice.WSPing", classLoader, new Object[0]);
|
||||
ReflectionUtils.invokeMethod(stub, "ping", new Object[] { wsping });
|
||||
}
|
||||
@@ -108,18 +109,18 @@ public class S56MdmConnectionHelper extends AbsMdmConnectionHelper {
|
||||
if (stub == null) {
|
||||
return;
|
||||
}
|
||||
stub.setUsername(userName);
|
||||
stub.setPassword(password);
|
||||
stub._getServiceClient().getOptions().setUserName(userName);
|
||||
stub._getServiceClient().getOptions().setPassword(password);
|
||||
|
||||
Object wsping = ReflectionUtils.newInstance("org.talend.mdm.webservice.WSPing", classLoader, new Object[0]);
|
||||
ReflectionUtils.invokeMethod(stub, "ping", new Object[] { wsping });
|
||||
|
||||
if (universe != null && !"".equals(universe)) { //$NON-NLS-1$
|
||||
stub.setUsername(universe + "/" + userName); //$NON-NLS-1$
|
||||
stub.setPassword(password);
|
||||
stub._getServiceClient().getOptions().setUserName(universe + "/" + userName); //$NON-NLS-1$
|
||||
stub._getServiceClient().getOptions().setPassword(password);
|
||||
} else {
|
||||
stub.setUsername(userName);
|
||||
stub.setPassword(password);
|
||||
stub._getServiceClient().getOptions().setUserName(userName);
|
||||
stub._getServiceClient().getOptions().setPassword(password);
|
||||
}
|
||||
|
||||
// find data model pk
|
||||
@@ -205,7 +206,8 @@ public class S56MdmConnectionHelper extends AbsMdmConnectionHelper {
|
||||
public void resetUniverseUser(Object stub, String universeUser) {
|
||||
if (stub instanceof Stub) {
|
||||
Stub stub2 = (Stub) stub;
|
||||
stub2.setUsername(universeUser + stub2.getUsername());
|
||||
Options options = stub2._getServiceClient().getOptions();
|
||||
options.setUserName(universeUser + options.getUserName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,9 +16,9 @@ import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.Driver;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
@@ -148,7 +148,7 @@ public class DBConnectionFillerImpl extends MetadataFillerImpl<DatabaseConnectio
|
||||
}
|
||||
}
|
||||
java.sql.Connection sqlConnection = null;
|
||||
Statement stmt = null;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
// MetadataConnectionUtils.setMetadataCon(metadataBean);
|
||||
@@ -176,8 +176,8 @@ public class DBConnectionFillerImpl extends MetadataFillerImpl<DatabaseConnectio
|
||||
String databaseType = dbconn.getDatabaseType();
|
||||
// TDQ-16331 Azure Mysql must use 'select version()' to get correct version
|
||||
if (EDatabaseTypeName.MYSQL.getDisplayName().equals(databaseType)) {
|
||||
stmt = sqlConnection.createStatement();
|
||||
rs = stmt.executeQuery("select version()"); //$NON-NLS-1$
|
||||
stmt = sqlConnection.prepareStatement("select version()");
|
||||
rs = stmt.executeQuery(); // $NON-NLS-1$
|
||||
while (rs.next()) {
|
||||
productVersion = rs.getString(1);
|
||||
}
|
||||
@@ -1017,12 +1017,12 @@ public class DBConnectionFillerImpl extends MetadataFillerImpl<DatabaseConnectio
|
||||
isOracle = MetadataConnectionUtils.isOracle(c);
|
||||
isOracleJdbc = MetadataConnectionUtils.isOracleJDBC(c);
|
||||
if ((isOracleJdbc || isOracle) && !isOracle8i) {// oracle and not oracle8
|
||||
Statement stmt;
|
||||
PreparedStatement stmt;
|
||||
try {
|
||||
// MOD qiongli TDQ-4732 use the common method to create statement both DI and DQ,avoid Exception
|
||||
// for top.
|
||||
stmt = dbJDBCMetadata.getConnection().createStatement();
|
||||
ResultSet rsTables = stmt.executeQuery(TableInfoParameters.ORACLE_10G_RECBIN_SQL);
|
||||
stmt = dbJDBCMetadata.getConnection().prepareStatement(TableInfoParameters.ORACLE_10G_RECBIN_SQL);
|
||||
ResultSet rsTables = stmt.executeQuery();
|
||||
tablesToFilter = ExtractMetaDataFromDataBase.getTableNamesFromQuery(rsTables,
|
||||
dbJDBCMetadata.getConnection());
|
||||
rsTables.close();
|
||||
@@ -1120,14 +1120,15 @@ public class DBConnectionFillerImpl extends MetadataFillerImpl<DatabaseConnectio
|
||||
&& dbJDBCMetadata.getDatabaseProductName().equals("Microsoft SQL Server")) { //$NON-NLS-1$
|
||||
for (String element : tableType) {
|
||||
if (element.equals("SYNONYM")) { //$NON-NLS-1$
|
||||
Statement stmt = extractMeta.getConn().createStatement();
|
||||
extractMeta.setQueryStatementTimeout(stmt);
|
||||
String schemaname = schemaPattern + ".sysobjects"; //$NON-NLS-1$
|
||||
String sql = "select name from " + schemaname + " where xtype='SN'"; //$NON-NLS-1$//$NON-NLS-2$
|
||||
if ("dbo".equalsIgnoreCase(schemaPattern)) { //$NON-NLS-1$
|
||||
PreparedStatement stmt = extractMeta.getConn().prepareStatement(sql);
|
||||
extractMeta.setQueryStatementTimeout(stmt);
|
||||
|
||||
// SELECT name AS object_name ,SCHEMA_NAME(schema_id) AS schema_name FROM sys.objects where
|
||||
// type='SN'
|
||||
ResultSet rsTables = stmt.executeQuery(sql);
|
||||
ResultSet rsTables = stmt.executeQuery();
|
||||
while (rsTables.next()) {
|
||||
String nameKey = rsTables.getString("name").trim(); //$NON-NLS-1$
|
||||
|
||||
@@ -1139,6 +1140,8 @@ public class DBConnectionFillerImpl extends MetadataFillerImpl<DatabaseConnectio
|
||||
metadatatable.setLabel(metadatatable.getName());
|
||||
list.add(metadatatable);
|
||||
}
|
||||
rsTables.close();
|
||||
stmt.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1146,10 +1149,12 @@ public class DBConnectionFillerImpl extends MetadataFillerImpl<DatabaseConnectio
|
||||
&& dbJDBCMetadata.getDatabaseProductName().startsWith("DB2/")) { //$NON-NLS-1$
|
||||
for (String element : tableType) {
|
||||
if (element.equals("SYNONYM")) { //$NON-NLS-1$
|
||||
Statement stmt = extractMeta.getConn().createStatement();
|
||||
String sql = "SELECT NAME FROM SYSIBM.SYSTABLES where TYPE='A' and BASE_SCHEMA = ?"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
PreparedStatement stmt = extractMeta.getConn().prepareStatement(sql);
|
||||
stmt.setString(1, schemaPattern);
|
||||
|
||||
extractMeta.setQueryStatementTimeout(stmt);
|
||||
String sql = "SELECT NAME FROM SYSIBM.SYSTABLES where TYPE='A' and BASE_SCHEMA = '" + schemaPattern + "'"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
ResultSet rsTables = stmt.executeQuery(sql);
|
||||
ResultSet rsTables = stmt.executeQuery();
|
||||
while (rsTables.next()) {
|
||||
String nameKey = rsTables.getString("NAME").trim(); //$NON-NLS-1$
|
||||
|
||||
@@ -1161,6 +1166,8 @@ public class DBConnectionFillerImpl extends MetadataFillerImpl<DatabaseConnectio
|
||||
metadatatable.setLabel(metadatatable.getName());
|
||||
list.add(metadatatable);
|
||||
}
|
||||
rsTables.close();
|
||||
stmt.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1273,12 +1280,12 @@ public class DBConnectionFillerImpl extends MetadataFillerImpl<DatabaseConnectio
|
||||
boolean isOracleJdbc = MetadataConnectionUtils.isOracleJDBC(c);
|
||||
// MetadataConnectionUtils.isOracle8i(connection)
|
||||
if ((isOracle || isOracleJdbc) && !flag) {// oracle and not oracle8
|
||||
Statement stmt;
|
||||
try {
|
||||
// MOD qiongli TDQ-4732 use the common method to create statement both DI and DQ,avoid Exception
|
||||
// for top.
|
||||
stmt = dbJDBCMetadata.getConnection().createStatement();
|
||||
ResultSet rsTables = stmt.executeQuery(TableInfoParameters.ORACLE_10G_RECBIN_SQL);
|
||||
PreparedStatement stmt = dbJDBCMetadata.getConnection()
|
||||
.prepareStatement(TableInfoParameters.ORACLE_10G_RECBIN_SQL);
|
||||
ResultSet rsTables = stmt.executeQuery();
|
||||
tablesToFilter = ExtractMetaDataFromDataBase.getTableNamesFromQuery(rsTables,
|
||||
dbJDBCMetadata.getConnection());
|
||||
rsTables.close();
|
||||
@@ -1878,11 +1885,11 @@ public class DBConnectionFillerImpl extends MetadataFillerImpl<DatabaseConnectio
|
||||
*/
|
||||
private String executeGetCommentStatement(String queryStmt, java.sql.Connection connection) {
|
||||
String comment = null;
|
||||
Statement statement = null;
|
||||
PreparedStatement statement = null;
|
||||
ResultSet resultSet = null;
|
||||
try {
|
||||
statement = connection.createStatement();
|
||||
statement.execute(queryStmt);
|
||||
statement = connection.prepareStatement(queryStmt);
|
||||
statement.execute();
|
||||
|
||||
// get the results
|
||||
resultSet = statement.getResultSet();
|
||||
|
||||
@@ -15,10 +15,10 @@ package org.talend.metadata.managment.utils;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.Driver;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.ResultSetMetaData;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
@@ -1340,10 +1340,10 @@ public class MetadataConnectionUtils {
|
||||
*/
|
||||
public static String getColumnTypeName(java.sql.Connection connection, String tableName, int colIndex) {
|
||||
String columnTypeName = null;
|
||||
Statement statement = null;
|
||||
PreparedStatement statement = null;
|
||||
try {
|
||||
statement = connection.createStatement();
|
||||
ResultSet resultSet = statement.executeQuery("SELECT FIRST 1 * FROM " + tableName + ";"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
statement = connection.prepareStatement("SELECT FIRST 1 * FROM " + tableName + ";");
|
||||
ResultSet resultSet = statement.executeQuery(); // $NON-NLS-1$ //$NON-NLS-2$
|
||||
ResultSetMetaData rsMetaData = resultSet.getMetaData();
|
||||
columnTypeName = rsMetaData.getColumnTypeName(colIndex);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -16,6 +16,7 @@ Application.workspaceInvalidMessage=Selected workspace is not valid; choose a di
|
||||
Application.workspaceNotExiste=Workspace not exist, cannot start instances in this path.
|
||||
Application.doNotSupportJavaVersionYetPoweredbyTalend=The Studio does not support Java 8. Java 7 is the recommended JVM version to be used. Refer to the following KB article on Talend Help Center for more information (requires a MyTalend account registration):
|
||||
Application.doNotSupportJavaVersionYetNoPoweredbyTalend=The Studio does not support Java 8. Java 7 is the recommended JVM version to be used.
|
||||
Application.InstallingPatchesTaskName=Installing patches...
|
||||
ApplicationActionBarAdvisor.menuFileLabel=&File
|
||||
ApplicationActionBarAdvisor.menuEditLabel=&Edit
|
||||
ApplicationActionBarAdvisor.navigateLabel=&Navigate
|
||||
|
||||
@@ -14,6 +14,7 @@ package org.talend.rcp.intro;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
@@ -21,6 +22,7 @@ import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Level;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.adaptor.EclipseStarter;
|
||||
@@ -28,6 +30,8 @@ import org.eclipse.core.runtime.preferences.ConfigurationScope;
|
||||
import org.eclipse.equinox.app.IApplication;
|
||||
import org.eclipse.equinox.app.IApplicationContext;
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
|
||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.wizard.WizardDialog;
|
||||
import org.eclipse.osgi.service.datalocation.Location;
|
||||
@@ -275,6 +279,7 @@ public class Application implements IApplication {
|
||||
|
||||
}
|
||||
|
||||
private boolean installed = false;
|
||||
private boolean installLocalPatches() {
|
||||
try {
|
||||
final boolean forceCheck = Boolean.getBoolean("talend.studio.localpatch.forcecheck");
|
||||
@@ -306,7 +311,27 @@ public class Application implements IApplication {
|
||||
boolean needRelaunch = false;
|
||||
final PatchComponent patchComponent = PatchComponentHelper.getPatchComponent();
|
||||
if (patchComponent != null) {
|
||||
final boolean installed = patchComponent.install();
|
||||
Shell shell = Display.getDefault().getActiveShell();
|
||||
if (shell == null) {
|
||||
shell = new Shell();
|
||||
}
|
||||
ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
|
||||
IRunnableWithProgress runnable = new IRunnableWithProgress() {
|
||||
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
||||
monitor.beginTask(Messages.getString("Application.InstallingPatchesTaskName"), IProgressMonitor.UNKNOWN); //$NON-NLS-1$
|
||||
installed = patchComponent.install(monitor);
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
dialog.run(true, false, runnable);
|
||||
} catch (InvocationTargetException | InterruptedException e) {
|
||||
log.log(Level.ERROR, e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
if (installed) {
|
||||
final String installedMessages = patchComponent.getInstalledMessages();
|
||||
if (installedMessages != null) {
|
||||
@@ -322,6 +347,7 @@ public class Application implements IApplication {
|
||||
if (StringUtils.isNotEmpty(patchComponent.getFailureMessage())) {
|
||||
log.log(Level.ERROR, patchComponent.getFailureMessage());
|
||||
}
|
||||
installed = false;
|
||||
}
|
||||
|
||||
final ComponentsInstallComponent installComponent = LocalComponentInstallHelper.getComponent();
|
||||
|
||||
@@ -26,8 +26,11 @@ import org.eclipse.ui.application.IWorkbenchConfigurer;
|
||||
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
|
||||
import org.eclipse.ui.application.WorkbenchWindowAdvisor;
|
||||
import org.eclipse.ui.internal.ide.application.IDEWorkbenchAdvisor;
|
||||
import org.talend.commons.exception.LoginException;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.commons.utils.system.EclipseCommandLine;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
import org.talend.core.repository.utils.LoginTaskRegistryReader;
|
||||
import org.talend.core.ui.branding.IBrandingConfiguration;
|
||||
import org.talend.core.ui.branding.IBrandingService;
|
||||
@@ -36,6 +39,7 @@ import org.talend.designer.runprocess.RunProcessPlugin;
|
||||
import org.talend.login.ILoginTask;
|
||||
import org.talend.rcp.TalendSplashHandler;
|
||||
import org.talend.registration.register.RegisterManagement;
|
||||
import org.talend.repository.RepositoryWorkUnit;
|
||||
|
||||
/**
|
||||
* DOC ccarbone class global comment. Detailled comment <br/>
|
||||
@@ -109,13 +113,19 @@ public class ApplicationWorkbenchAdvisor extends IDEWorkbenchAdvisor {
|
||||
SubMonitor subMonitor = SubMonitor.convert(monitor, allLoginTasks.length + 1);
|
||||
|
||||
// handle the login tasks created using the extension point org.talend.core.repository.login.task
|
||||
for (ILoginTask toBeRun : allLoginTasks) {
|
||||
try {
|
||||
toBeRun.run(subMonitor.newChild(1, SubMonitor.SUPPRESS_NONE));
|
||||
} catch (Exception e) {
|
||||
log.error("Error while execution a login task.", e); //$NON-NLS-1$
|
||||
ProxyRepositoryFactory.getInstance().executeRepositoryWorkUnit(new RepositoryWorkUnit<Void>("Applying login tasks") {
|
||||
|
||||
@Override
|
||||
protected void run() throws LoginException, PersistenceException {
|
||||
for (ILoginTask toBeRun : allLoginTasks) {
|
||||
try {
|
||||
toBeRun.run(subMonitor.newChild(1, SubMonitor.SUPPRESS_NONE));
|
||||
} catch (Exception e) {
|
||||
log.error("Error while execution a login task.", e); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
super.preStartup();
|
||||
|
||||
|
||||
@@ -4,8 +4,7 @@ Bundle-Name: Registration Plug-in
|
||||
Bundle-SymbolicName: org.talend.registration;singleton:=true
|
||||
Bundle-Version: 7.3.1.qualifier
|
||||
Bundle-Vendor: .Talend SA.
|
||||
Require-Bundle: org.apache.axis,
|
||||
javax.xml.rpc,
|
||||
Require-Bundle: javax.xml.rpc,
|
||||
org.eclipse.ui,
|
||||
org.talend.core.runtime,
|
||||
org.talend.core.ui,
|
||||
@@ -15,7 +14,8 @@ Require-Bundle: org.apache.axis,
|
||||
org.talend.metadata.managment,
|
||||
org.talend.common.ui.runtime,
|
||||
org.eclipse.ui.intro,
|
||||
org.talend.commons.ui
|
||||
org.talend.commons.ui,
|
||||
org.talend.libraries.apache.axis2
|
||||
Export-Package: org.talend.registration,
|
||||
org.talend.registration.license,
|
||||
org.talend.registration.register,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
package org.talend.registration.register.proxy;
|
||||
|
||||
public interface RegisterUser extends javax.xml.rpc.Service {
|
||||
public interface RegisterUser {
|
||||
public java.lang.String getRegisterUserPortAddress();
|
||||
|
||||
public org.talend.registration.register.proxy.RegisterUserPortType getRegisterUserPort() throws javax.xml.rpc.ServiceException;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user