Compare commits

..

1 Commits

Author SHA1 Message Date
vdrokov
82bf612299 APPINT-32905: Issue with Rest service flow 2021-04-30 18:17:02 +03:00
260 changed files with 14677 additions and 5887 deletions

View File

@@ -8,7 +8,7 @@
<discovery label="Talend web site" url="http://www.talend.com"/>
</url>
<requires>
<import plugin="org.bouncycastle.bcprov" version="1.68.0" match="greaterOrEqual"/>
<import plugin="org.bouncycastle.bcprov" version="0.0.0" match="greaterOrEqual"/>
<import plugin="com.fasterxml.jackson.core.jackson-databind" version="2.9.8" match="greaterOrEqual"/>
<import plugin="jackson-core-asl" version="0.0.0" match="greaterOrEqual"/>
<import plugin="jackson-mapper-asl" version="0.0.0" match="greaterOrEqual"/>

View File

@@ -39,7 +39,6 @@
<import plugin="org.eclipse.compare" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.compare.core" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.ops4j.pax.url.mvn" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.collections" version="0.0.0" match="greaterOrEqual"/>
</requires>
<plugin id="org.talend.core" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.talend.core.nl" download-size="0" install-size="0" version="0.0.0" fragment="true" unpack="false"/>
@@ -63,7 +62,6 @@
<plugin id="org.talend.metadata.managment.ui" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.talend.metadata.managment.ui.nl" download-size="0" install-size="0" version="0.0.0" fragment="true" unpack="false"/>
<plugin id="org.talend.migrationTool" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.talend.migrationTool.nl" download-size="0" install-size="0" version="0.0.0" fragment="true" unpack="false"/>
<plugin id="org.talend.model" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.talend.model.edit" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.talend.model.edit.nl" download-size="0" install-size="0" version="0.0.0" fragment="true" unpack="false"/>

View File

@@ -57,4 +57,11 @@
version="0.0.0"
unpack="true"/>
<plugin
id="org.talend.libraries.apache.lucene4"
download-size="0"
install-size="0"
version="0.0.0"
unpack="true"/>
</feature>

View File

@@ -38,7 +38,5 @@
<import plugin="org.slf4j.api" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.slf4j.impl.log4j12" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.wst.server.discovery" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.ui.genericeditor" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.e4.ui.ide" version="0.0.0" match="greaterOrEqual"/>
</requires>
</feature>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 404 B

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -132,8 +132,3 @@ 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

View File

@@ -88,8 +88,6 @@ 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$

View File

@@ -14,7 +14,7 @@ package org.talend.commons.ui.runtime.swt.celleditor;
import java.text.MessageFormat;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.util.Assert;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ComboBoxCellEditor;
import org.eclipse.swt.SWT;

View File

@@ -19,7 +19,7 @@ import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.util.Assert;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ColumnLayoutData;
import org.eclipse.jface.viewers.ColumnPixelData;

View File

@@ -22,7 +22,7 @@ package org.talend.commons.ui.runtime.swt.tableviewer.behavior;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.util.Assert;
import org.eclipse.jface.viewers.ColumnLayoutData;
import org.eclipse.jface.viewers.ColumnPixelData;
import org.eclipse.jface.viewers.ColumnWeightData;

View File

@@ -1,56 +0,0 @@
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;
}
}

View File

@@ -32,12 +32,10 @@ import org.talend.commons.i18n.internal.Messages;
*/
public interface ITaCoKitService {
void start();
void start() throws Exception;
boolean isStarted() throws Exception;
void waitForStart();
String reload(IProgressMonitor monitor) throws Exception;
boolean isTaCoKitCar(File file, IProgressMonitor monitor) throws Exception;
@@ -46,7 +44,7 @@ public interface ITaCoKitService {
boolean isTaCoKitType(Object repoType);
public static ITaCoKitService getInstance() {
public static ITaCoKitService getInstance() throws Exception {
BundleContext bc = FrameworkUtil.getBundle(ITaCoKitService.class).getBundleContext();
Collection<ServiceReference<ITaCoKitService>> tacokitServices = Collections.emptyList();
try {

View File

@@ -12,8 +12,6 @@
// ============================================================================
package org.talend.commons.runtime.service;
import org.eclipse.core.runtime.IProgressMonitor;
/**
* DOC ggu class global comment. Detailled comment
*/
@@ -21,10 +19,6 @@ public interface P2InstallComponent {
boolean install();
default boolean install(IProgressMonitor monitor) {
return false;
}
boolean needRelaunch();
String getInstalledMessages();

View File

@@ -29,8 +29,6 @@ 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.

View File

@@ -537,11 +537,6 @@ 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)

View File

@@ -16,6 +16,7 @@ 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;
@@ -108,11 +109,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;
PreparedStatement stmt = null;
Statement stmt = null;
List<String[]> list = new ArrayList<String[]>();
try {
stmt = connection.prepareStatement(sql);
rs = stmt.executeQuery();
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
while (rs.next()) {
String creator = rs.getString("CREATOR"); //$NON-NLS-1$
@@ -330,20 +331,18 @@ 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=? AND TBCREATOR = ? ORDER BY TBCREATOR, TBNAME, COLNO"; //$NON-NLS-1$
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$
// for test
// String sql = "SELECT * FROM SYSIBM.SYSCOLUMNS where NAME='NAME'";
ResultSet rs = null;
PreparedStatement stmt = null;
Statement stmt = null;
List<String[]> list = new ArrayList<String[]>();
try {
stmt = connection.prepareStatement(sql);
stmt.setString(1, tableNamePattern);
stmt.setString(2, schemaPattern);
rs = stmt.executeQuery();
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
while (rs.next()) {
// For real db2 for zos, should use these code.

View File

@@ -25,6 +25,7 @@ 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"
@@ -35,7 +36,6 @@ public class JtdsDatabaseMetadata extends PackageFakeDatabaseMetadata {
}
sql += " ORDER BY TABLE_SCHEM";
java.sql.PreparedStatement statement = connection.prepareStatement(sql);
return statement.executeQuery();
return statement.executeQuery(sql);
}
}

View File

@@ -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,19 +152,15 @@ 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 ?"; //$NON-NLS-1$ //$NON-NLS-2$
sqlcv += " OR PACKAGE_ID LIKE ? )"; //$NON-NLS-1$ //$NON-NLS-2$
sqlcv += " AND (OBJECT_NAME LIKE '" + tableNamePattern + "'"; //$NON-NLS-1$ //$NON-NLS-2$
sqlcv += " OR PACKAGE_ID LIKE '" + tableNamePattern + "')"; //$NON-NLS-1$ //$NON-NLS-2$
}
ResultSet rscv = null;
PreparedStatement stmtcv = null;
Statement stmtcv = null;
List<String[]> listcv = new ArrayList<String[]>();
try {
stmtcv = connection.prepareStatement(sqlcv);
if (tableNamePattern != null && !tableNamePattern.equals("%")) {
stmtcv.setString(1, tableNamePattern);
stmtcv.setString(2, tableNamePattern);
}
rscv = stmtcv.executeQuery();
stmtcv = connection.createStatement();
rscv = stmtcv.executeQuery(sqlcv);
while (rscv.next()) {
String objectName = rscv.getString("OBJECT_NAME"); //$NON-NLS-1$
if (objectName != null) {
@@ -307,11 +303,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;
PreparedStatement stmtcv = null;
Statement stmtcv = null;
List<String[]> listcv = new ArrayList<String[]>();
try {
stmtcv = connection.prepareStatement(sqlcv);
rscv = stmtcv.executeQuery();
stmtcv = connection.createStatement();
rscv = stmtcv.executeQuery(sqlcv);
int i = 1;
while (rscv.next()) {
String tableName = tableNamePattern;

View File

@@ -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;
PreparedStatement stmt = null;
Statement stmt = null;
List<String[]> list = new ArrayList<String[]>();
try {
stmt = connection.prepareStatement(sql);
rs = stmt.executeQuery();
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
while (rs.next()) {
String creator = rs.getString("LIBNAME"); //$NON-NLS-1$
@@ -147,21 +147,17 @@ 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 = ?"; //$NON-NLS-1$ //$NON-NLS-2$
sql = "SELECT * FROM SASHELP.VTABLE where LIBNAME = '" + schema + "'"; //$NON-NLS-1$ //$NON-NLS-2$
} else {
sql = "SELECT * FROM SASHELP.VTABLE"; //$NON-NLS-1$
}
ResultSet rs = null;
PreparedStatement stmt = null;
Statement stmt = null;
List<String[]> list = new ArrayList<String[]>();
try {
stmt = connection.prepareStatement(sql);
if (schema != null) {
stmt.setString(1, schema);
}
rs = stmt.executeQuery();
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
while (rs.next()) {
String name = rs.getString("MEMNAME"); //$NON-NLS-1$
@@ -233,20 +229,18 @@ 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=? AND LIBNAME = ? ORDER BY LIBNAME, MEMNAME, VARNUM"; //$NON-NLS-1$
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$
// for test
// String sql = "SELECT * FROM SYSIBM.SYSCOLUMNS where NAME='NAME'";
ResultSet rs = null;
PreparedStatement stmt = null;
Statement stmt = null;
List<String[]> list = new ArrayList<String[]>();
try {
stmt = connection.prepareStatement(sql);
stmt.setString(1, tableNamePattern);
stmt.setString(2, schemaPattern);
rs = stmt.executeQuery();
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
while (rs.next()) {
String tableName = rs.getString("MEMNAME"); //$NON-NLS-1$
if (tableName != null) {

View File

@@ -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,12 +52,10 @@ public class Sybase16SADatabaseMetaData extends SybaseDatabaseMetaData {
for (String catalogName : catList) {
String sql = createSqlByLoginAndCatalog(login, catalogName);
ResultSet rs = null;
PreparedStatement stmt = null;
Statement stmt = null;
try {
stmt = connection.prepareStatement(sql);
stmt.setString(1, login);
rs = stmt.executeQuery();
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
while (rs.next()) {
int temp = rs.getInt(1);
@@ -115,7 +113,8 @@ 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 = ? )";
+ ".dbo.sysusers where suid in (select suid from "+catalogName+".dbo.syslogins where name = '" + loginName
+ "')";
return sql;
}

View File

@@ -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,13 +54,10 @@ public class SybaseDatabaseMetaData extends PackageFakeDatabaseMetadata {
for (String catalogName : catList) {
String sql = createSqlByLoginAndCatalog(login, catalogName);
ResultSet rs = null;
PreparedStatement stmt = null;
Statement stmt = null;
try {
stmt = connection.prepareStatement(sql);
stmt.setString(1, login);
stmt.setString(2, login);
rs = stmt.executeQuery();
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
while (rs.next()) {
int temp = rs.getInt(1);
@@ -95,11 +92,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;
PreparedStatement stmt = null;
Statement stmt = null;
List<String[]> list = new ArrayList<String[]>();
try {
stmt = connection.prepareStatement(sql);
rs = stmt.executeQuery();
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
while (rs.next()) {
String name = rs.getString("name"); //$NON-NLS-1$
@@ -139,9 +136,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 = ?"
+ ") 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$
+ ".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$
}
@Override

View File

@@ -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,12 +97,13 @@ 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;
PreparedStatement stmt = null;
Statement stmt = null;
String columnName = null;
List<String[]> list = new ArrayList<String[]>();
try {
if (dbMajorVersion > 12) {
sql = "SELECT * from DBC.INDICESV WHERE UPPER(databasename) = UPPER(?) AND UPPER(tablename) = UPPER(?) AND UPPER(UniqueFlag) = UPPER('Y')"; //$NON-NLS-1$ //$NON-NLS-2$
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$
rs = getResultSet(catalog, schema, table, sql);
while (rs.next()) {
columnName = rs.getString("ColumnName").trim(); //$NON-NLS-1$
@@ -111,11 +112,8 @@ public class TeradataDataBaseMetadata extends FakeDatabaseMetaData {
list.add(r);
}
} else {
stmt = connection.prepareStatement(sql);
stmt.setString(1, schema);
stmt.setString(2, table);
rs = stmt.executeQuery();
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
while (rs.next()) {
columnName = rs.getString("Column Name").trim(); //$NON-NLS-1$
String pk = rs.getString("Primary?");//$NON-NLS-1$
@@ -140,10 +138,10 @@ public class TeradataDataBaseMetadata extends FakeDatabaseMetaData {
public ResultSet getResultSet(String catalog, String schema, String table, String sql) throws SQLException {
ResultSet rs = null;
PreparedStatement stmt = null;
Statement stmt = null;
try {
stmt = connection.prepareStatement(sql);
rs = stmt.executeQuery();
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
} catch (SQLException e) {
throw new RuntimeException(e);
}
@@ -205,15 +203,17 @@ 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(?) AND tablekind " + addTypesToSql(types); //$NON-NLS-1$
sql = "SELECT * from " + sysTable + " WHERE UPPER(databasename) = UPPER('" + database //$NON-NLS-1$//$NON-NLS-2$
+ "') 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(?) AND (tablekind = 'T' or tablekind = 'V')"; //$NON-NLS-1$
sql = "SELECT * from " + sysTable + " WHERE UPPER(databasename) = UPPER('" + database //$NON-NLS-1$//$NON-NLS-2$
+ "') AND (tablekind = 'T' or tablekind = 'V')"; //$NON-NLS-1$
}
// add the filter for table/views
if (!StringUtils.isEmpty(tableNamePattern)) {
sql = sql + " AND tablename LIKE ?";//$NON-NLS-1$ //$NON-NLS-2$
sql = sql + " AND tablename LIKE '" + tableNamePattern + "'";//$NON-NLS-1$//$NON-NLS-2$
}
if (types != null && types.length > 0) {
@@ -223,18 +223,11 @@ public class TeradataDataBaseMetadata extends FakeDatabaseMetaData {
}
ResultSet rs = null;
PreparedStatement stmt = null;
Statement stmt = null;
List<String[]> list = new ArrayList<String[]>();
try {
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();
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
while (rs.next()) {
String name = rs.getString("TableName").trim(); //$NON-NLS-1$
@@ -333,33 +326,21 @@ 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(?) AND UPPER(tablename) = UPPER(?)" //$NON-NLS-1$
+ " Order by tablename "; //$NON-NLS-1$ //$NON-NLS-3$
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$
}
} else {
sql = "HELP COLUMN \"" + tableNamePattern + "\".* ";//$NON-NLS-1$//$NON-NLS-2$
if (dbMajorVersion > 12) {
sql = "SELECT * from DBC.COLUMNSV WHERE UPPER(tablename) = UPPER(?)" + " Order by tablename "; //$NON-NLS-1$//$NON-NLS-2$
// //$NON-NLS-3$
sql = "SELECT * from DBC.COLUMNSV WHERE UPPER(tablename) = UPPER('" + tableNamePattern + "')" + " Order by tablename "; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
}
}
ResultSet rs = null;
PreparedStatement stmt = null;
Statement stmt = null;
List<String[]> list = new ArrayList<String[]>();
try {
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();
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
while (rs.next()) {
String tableName = tableNamePattern;
String columnName = null;

View File

@@ -66,22 +66,10 @@ public class NetworkUtil {
private static final String PROP_HTTP_PROXY_SET = "http.proxySet";
private static final String PROP_NETWORK_STATUS = "network.status"; //$NON-NLS-1$
public static boolean isNetworkValid() {
return isNetworkValid(DEFAULT_TIMEOUT);
}
public static boolean isNetworkValidByStatus() {
String status = System.getProperty(PROP_NETWORK_STATUS);
if (status != null) {
return Boolean.valueOf(status);
}
Boolean isValid = isNetworkValid();
System.setProperty(PROP_NETWORK_STATUS, isValid.toString());
return isValid;
}
public static boolean isNetworkValid(Integer timeout) {
String disableInternet = System.getProperty(TALEND_DISABLE_INTERNET);
if ("true".equals(disableInternet)) { //$NON-NLS-1$

View File

@@ -76,8 +76,6 @@ 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...

View File

@@ -27,13 +27,11 @@ 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;
@@ -69,11 +67,7 @@ public class ExtendedToolbarView extends AbstractExtendedToolbar {
protected ResetDBTypesPushButton resetDBTypesButton;
protected SelectContextVariablesPushButton selectContextVariablesButton;
protected CasePushButton caseButton;
protected QuotePushButton quoteButton;
/**
* DOC amaumont MatadataToolbarEditor constructor comment.
*
@@ -109,11 +103,7 @@ public class ExtendedToolbarView extends AbstractExtendedToolbar {
pasteButton = createPastePushButton();
addallButton = createAddAllPushButton();
caseButton = createCasePushButton();
quoteButton = createQuotePushButton();
exportButton = createExportPushButton();
importButton = createImportPushButton();
@@ -179,14 +169,6 @@ public class ExtendedToolbarView extends AbstractExtendedToolbar {
protected SelectContextVariablesPushButton createSelectContextVariablesPushButton() {
return null;
}
protected CasePushButton createCasePushButton() {
return null;
}
protected QuotePushButton createQuotePushButton() {
return null;
}
/**
* Getter for addButton.
@@ -345,14 +327,6 @@ 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;
}
@@ -374,26 +348,6 @@ 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;
}
}
//

View File

@@ -1,48 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.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();
}
}

View File

@@ -1,87 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.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();
}
}

View File

@@ -1,57 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.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;
}
}

View File

@@ -1,205 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.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;
}
}
}

View File

@@ -1,88 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.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() {
}
}

View File

@@ -1,90 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.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() {
}
}

View File

@@ -15,12 +15,12 @@ package org.talend.commons.ui.swt.colorstyledtext.rules;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.text.rules.ICharacterScanner;
import org.eclipse.jface.text.rules.IRule;
import org.eclipse.jface.text.rules.IToken;
import org.eclipse.jface.text.rules.IWordDetector;
import org.eclipse.jface.text.rules.Token;
import org.eclipse.jface.util.Assert;
/**
* An implementation of <code>IRule</code> capable of detecting words Word rules also allow for the association of

View File

@@ -12,7 +12,7 @@
// ============================================================================
package org.talend.commons.ui.swt.colorstyledtext.rules;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.util.Assert;
import org.talend.commons.ui.swt.colorstyledtext.jedit.Rule;
import org.talend.commons.ui.swt.colorstyledtext.jedit.Type;

View File

@@ -178,23 +178,6 @@ 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".

View File

@@ -27,7 +27,6 @@ import org.apache.oro.text.regex.PatternCompiler;
import org.apache.oro.text.regex.PatternMatcher;
import org.apache.oro.text.regex.Perl5Compiler;
import org.apache.oro.text.regex.Perl5Matcher;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.jface.bindings.keys.KeyStroke;
import org.eclipse.jface.dialogs.PopupDialog;
@@ -35,6 +34,7 @@ import org.eclipse.jface.fieldassist.IContentProposal;
import org.eclipse.jface.fieldassist.IContentProposalListener;
import org.eclipse.jface.fieldassist.IContentProposalProvider;
import org.eclipse.jface.fieldassist.IControlContentAdapter;
import org.eclipse.jface.util.Assert;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;

View File

@@ -12,7 +12,7 @@
// ============================================================================
package org.talend.commons.ui.utils.data.text.rules;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.text.Assert;
import org.eclipse.jface.text.rules.ICharacterScanner;
import org.eclipse.jface.text.rules.IPredicateRule;
import org.eclipse.jface.text.rules.IRule;

View File

@@ -12,8 +12,8 @@
// ============================================================================
package org.talend.commons.ui.utils.workbench.preferences;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.preference.FieldEditor;
import org.eclipse.jface.util.Assert;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

View File

@@ -12,14 +12,11 @@
// ============================================================================
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;
@@ -626,7 +623,8 @@ public abstract class AbstractEMFRepositoryFactory extends AbstractRepositoryFac
stream.close();
byte[] currentContent = item.getContent().getInnerContent();
if (!isSameStringContent(innerContent, currentContent)) {
if (!Arrays.equals(innerContent, currentContent)) {
item.getContent().setInnerContent(innerContent);
Project project = getRepositoryContext().getProject();
save(project, item);
@@ -643,44 +641,6 @@ 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) {
@@ -733,7 +693,8 @@ public abstract class AbstractEMFRepositoryFactory extends AbstractRepositoryFac
stream.close();
byte[] currentContent = item.getContent().getInnerContent();
if (!isSameStringContent(innerContent, currentContent)) {
if (!Arrays.equals(innerContent, currentContent)) {
item.getContent().setInnerContent(innerContent);
Project project = getRepositoryContext().getProject();
save(project, item);

View File

@@ -23,6 +23,8 @@ import java.util.Map;
import java.util.Optional;
import java.util.Set;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.PredicateUtils;
import org.apache.commons.lang.ArrayUtils;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.ISafeRunnable;
@@ -93,7 +95,6 @@ import org.talend.core.repository.model.repositoryObject.SalesforceModuleReposit
import org.talend.core.repository.recyclebin.RecycleBinManager;
import org.talend.core.repository.ui.utils.ProjectRepositoryNodeCache;
import org.talend.core.runtime.services.IGenericDBService;
import org.talend.core.runtime.services.IGenericService;
import org.talend.core.runtime.services.IGenericWizardService;
import org.talend.core.ui.ICDCProviderService;
import org.talend.core.ui.ITestContainerProviderService;
@@ -391,7 +392,10 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
}
private void initNodesFromComponentSerivice(RepositoryNode curParentNode) {
IGenericService wizardService = IGenericService.getService();
IGenericWizardService wizardService = null;
if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericWizardService.class)) {
wizardService = GlobalServiceRegister.getDefault().getService(IGenericWizardService.class);
}
if (wizardService != null) {
List<RepositoryNode> nodes = wizardService.createNodesFromComponentService(curParentNode);
for (RepositoryNode repNode : nodes) {

View File

@@ -40,12 +40,10 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
@@ -72,10 +70,8 @@ import org.talend.commons.exception.SystemException;
import org.talend.commons.runtime.model.repository.ERepositoryStatus;
import org.talend.commons.runtime.service.ITaCoKitService;
import org.talend.commons.ui.gmf.util.DisplayUtils;
import org.talend.commons.ui.runtime.CommonUIPlugin;
import org.talend.commons.ui.runtime.exception.MessageBoxExceptionHandler;
import org.talend.commons.utils.data.container.RootContainer;
import org.talend.commons.utils.generation.JavaUtils;
import org.talend.commons.utils.network.TalendProxySelector;
import org.talend.commons.utils.time.TimeMeasurePerformance;
import org.talend.commons.utils.workbench.resources.ResourceUtils;
@@ -89,8 +85,7 @@ import org.talend.core.context.CommandLineContext;
import org.talend.core.context.Context;
import org.talend.core.context.RepositoryContext;
import org.talend.core.exception.TalendInternalPersistenceException;
import org.talend.core.hadoop.IHadoopDistributionService;
import org.talend.core.model.components.IComponentsService;
import org.talend.core.hadoop.BigDataBasicUtil;
import org.talend.core.model.general.ILibrariesService;
import org.talend.core.model.general.ModuleNeeded;
import org.talend.core.model.general.Project;
@@ -139,12 +134,10 @@ import org.talend.core.repository.utils.ProjectDataJsonProvider;
import org.talend.core.repository.utils.RepositoryPathProvider;
import org.talend.core.repository.utils.XmiResourceManager;
import org.talend.core.runtime.CoreRuntimePlugin;
import org.talend.core.runtime.hd.IDynamicDistributionManager;
import org.talend.core.runtime.repository.item.ItemProductKeys;
import org.talend.core.runtime.services.IGenericWizardService;
import org.talend.core.runtime.services.IMavenUIService;
import org.talend.core.runtime.util.ItemDateParser;
import org.talend.core.runtime.util.JavaHomeUtil;
import org.talend.core.runtime.util.SharedStudioUtils;
import org.talend.core.service.ICoreUIService;
import org.talend.core.utils.CodesJarResourceCache;
@@ -2198,6 +2191,9 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
ExceptionHandler.process(e);
}
// init dynamic distirbution after `beforeLogon`, before loading libraries.
initDynamicDistribution(monitor);
// init sdk component
try {
currentMonitor = subMonitor.newChild(1, SubMonitor.SUPPRESS_NONE);
@@ -2228,14 +2224,6 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
}
}
if (CommonsPlugin.isJUnitTest() || PluginChecker.isSWTBotLoaded()) {
// component init for cmdline is done in another place
currentMonitor = subMonitor.newChild(1, SubMonitor.SUPPRESS_NONE);
currentMonitor.beginTask(Messages.getString("ProxyRepositoryFactory.load.componnents"), 1); //$NON-NLS-1$
IComponentsService.get().getComponentsFactory().getComponents();
TimeMeasurePerformance.step("logOnProject", "Initialize components"); //$NON-NLS-1$
}
ICoreService coreService = getCoreService();
if (coreService != null) {
currentMonitor = subMonitor.newChild(1, SubMonitor.SUPPRESS_NONE);
@@ -2252,6 +2240,8 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
ExceptionHandler.process(e);
}
CodesJarResourceCache.initCodesJarCache();
currentMonitor = subMonitor.newChild(1, SubMonitor.SUPPRESS_NONE);
currentMonitor.beginTask("Execute before logon migrations tasks", 1); //$NON-NLS-1$
ProjectManager.getInstance().getMigrationRecords().clear();
@@ -2270,10 +2260,15 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
emptyTempFolder(project);
currentMonitor = subMonitor.newChild(1, SubMonitor.SUPPRESS_NONE);
currentMonitor.beginTask(Messages.getString("ProxyRepositoryFactory.load.componnents"), 1); //$NON-NLS-1$
ICoreUIService coreUiService = null;
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreUIService.class)) {
coreUiService = GlobalServiceRegister.getDefault().getService(ICoreUIService.class);
}
if (coreUiService != null) {
coreUiService.componentsReset();
}
fireRepositoryPropertyChange(ERepositoryActionName.PROJECT_PREFERENCES_RELOAD.getName(), null, null);
@@ -2300,7 +2295,6 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
}
if (coreService != null) {
updateProjectJavaVersionIfNeed();
// clean workspace
currentMonitor.beginTask(Messages.getString("ProxyRepositoryFactory.cleanWorkspace"), 1); //$NON-NLS-1$
@@ -2315,13 +2309,27 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
currentMonitor.beginTask(Messages.getString("ProxyRepositoryFactory.synch.repo.items"), 1); //$NON-NLS-1$
if (!isCommandLineLocalRefProject) {
syncAndInstallCodes(currentMonitor);
try {
coreService.syncAllRoutines();
// PTODO need refactor later, this is not good, I think
coreService.syncAllBeans();
} catch (SystemException e1) {
//
ExceptionHandler.process(e1);
}
}
}
if (monitor != null && monitor.isCanceled()) {
throw new OperationCanceledException(""); //$NON-NLS-1$
}
// rules
if (coreUiService != null && PluginChecker.isRulesPluginLoaded()) {
coreUiService.syncAllRules();
}
if (monitor != null && monitor.isCanceled()) {
throw new OperationCanceledException(""); //$NON-NLS-1$
}
TimeMeasurePerformance.step("logOnProject", "sync repository (routines/rules/beans)"); //$NON-NLS-1$ //$NON-NLS-2$
// log4j prefs
if (coreUiService != null && coreService != null) {
@@ -2340,6 +2348,11 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
ExceptionHandler.process(e);
}
if (runProcessService != null && !isCommandLineLocalRefProject) {
runProcessService.initializeRootPoms(monitor);
TimeMeasurePerformance.step("logOnProject", "install / setup root poms"); //$NON-NLS-1$ //$NON-NLS-2$
}
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITDQRepositoryService.class)) {
ITDQRepositoryService tdqRepositoryService = GlobalServiceRegister.getDefault()
.getService(ITDQRepositoryService.class);
@@ -2347,10 +2360,8 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
tdqRepositoryService.initProxyRepository();
}
}
// regenerate relationship index if error index found
try {
ProjectDataJsonProvider.checkRelationShipSetting(project.getEmfProject());
} catch (Exception e) {
// regenerate relationship index
if (project.getEmfProject().getItemsRelations().isEmpty()) {
RelationshipItemBuilder.getInstance().buildAndSaveIndex();
}
@@ -2375,67 +2386,16 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
throw e;
}
}
private void updateProjectJavaVersionIfNeed() {
String specifiedVersion = null;
String currentVersion = JavaUtils.getProjectJavaVersion();
String newVersion = null;
private void initDynamicDistribution(IProgressMonitor monitor) {
try {
JavaHomeUtil.initializeJavaHome();
} catch (CoreException ex) {
ExceptionHandler.process(ex);
}
if (CommonUIPlugin.isFullyHeadless()) {
specifiedVersion = JavaHomeUtil.getSpecifiedJavaVersion();
}
if (specifiedVersion == null) {
newVersion = currentVersion != null ? currentVersion : JavaUtils.DEFAULT_VERSION;
} else {
newVersion = specifiedVersion;
}
JavaUtils.updateProjectJavaVersion(newVersion);
}
private void syncAndInstallCodes(IProgressMonitor monitor) {
if (CommonsPlugin.isHeadless() || CommonsPlugin.isJUnitTest() || PluginChecker.isSWTBotLoaded()) {
try {
doSyncAndInstallCodes(monitor);
} catch (SystemException e) {
ExceptionHandler.process(e);
if (BigDataBasicUtil.isDynamicDistributionLoaded(monitor)) {
BigDataBasicUtil.reloadAllDynamicDistributions(monitor);
} else {
BigDataBasicUtil.loadDynamicDistribution(monitor);
}
} else {
Job job = new Job("Synchronize and install codes") {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
doSyncAndInstallCodes(monitor);
return org.eclipse.core.runtime.Status.OK_STATUS;
} catch (Exception e) {
return new org.eclipse.core.runtime.Status(IStatus.ERROR, CoreRepositoryPlugin.PLUGIN_ID, 1,
e.getMessage(), e);
}
}
};
job.setUser(false);
job.setPriority(Job.LONG);
job.schedule();
}
}
private void doSyncAndInstallCodes(IProgressMonitor monitor) throws SystemException {
ICoreService coreService = getCoreService();
if (coreService != null) {
CodesJarResourceCache.reset();
coreService.syncAllRoutines();
coreService.syncAllBeans();
TimeMeasurePerformance.step("logOnProject", "sync repository (routines/beans)"); //$NON-NLS-1$ //$NON-NLS-2$
}
if (IRunProcessService.get() != null) {
IRunProcessService.get().initializeRootPoms(monitor);
TimeMeasurePerformance.step("logOnProject", "install / setup root poms"); //$NON-NLS-1$ //$NON-NLS-2$
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
@@ -2496,25 +2456,6 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
if (runProcessService != null) {
runProcessService.clearProjectRelatedSettings();
}
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreUIService.class)) {
ICoreUIService coreUiService = GlobalServiceRegister.getDefault().getService(ICoreUIService.class);
if (coreUiService != null) {
coreUiService.componentsReset();
}
}
if (GlobalServiceRegister.getDefault().isServiceRegistered(IHadoopDistributionService.class)) {
IHadoopDistributionService hdService = GlobalServiceRegister.getDefault()
.getService(IHadoopDistributionService.class);
if (hdService != null) {
IDynamicDistributionManager dynamicDistrManager = hdService.getDynamicDistributionManager();
dynamicDistrManager.reset(null);
}
}
CodesJarResourceCache.reset();
ReferenceProjectProvider.clearTacReferenceList();
ReferenceProjectProblemManager.getInstance().clearAll();
fullLogonFinished = false;
@@ -2833,7 +2774,7 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
ILoginTask[] allLoginTasks = LOGIN_TASK_REGISTRY_READER.getAllTaskListInstance();
for (ILoginTask task : allLoginTasks) {
if (task.isRequiredAlways()) {
task.execute(monitor);
task.run(monitor);
}
}
}

View File

@@ -224,15 +224,14 @@ public class ProjectDataJsonProvider {
ExceptionHandler.process(e);
}
}
public static List<ItemRelationsJson> checkRelationShipSetting(Project project) throws PersistenceException {
List<ItemRelationsJson> itemRelationsJsonsList = null;
public static void checkAndRectifyRelationShipSetting(Project project) throws PersistenceException {
File file = getSavingConfigurationFile(project.getTechnicalLabel(), FileConstants.RELATIONSHIP_FILE_NAME);
if (file == null || !file.exists()) {
return itemRelationsJsonsList;
return;
}
List<ItemRelationsJson> itemRelationsJsonsList = null;
TypeReference<List<ItemRelationsJson>> typeReference = new TypeReference<List<ItemRelationsJson>>() {
};
FileInputStream input = null;
@@ -244,11 +243,6 @@ public class ProjectDataJsonProvider {
} finally {
closeInputStream(input);
}
return itemRelationsJsonsList;
}
public static void checkAndRectifyRelationShipSetting(Project project) throws PersistenceException {
List<ItemRelationsJson> itemRelationsJsonsList = checkRelationShipSetting(project);
if (itemRelationsJsonsList == null || itemRelationsJsonsList.isEmpty()) {
return;

View File

@@ -1,9 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/java"/>
<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/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"/>

View File

@@ -130,7 +130,5 @@ 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/delight-rhino-sandbox-0.0.15.jar,
lib/rhino-1.7.13.jar
lib/json_simple-1.1.jar
Eclipse-RegisterBuddy: org.talend.testutils

View File

@@ -12,9 +12,7 @@ bin.includes = META-INF/,\
lib/,\
talend_metadata_columns_schema.xsd,\
talend_targetschema_columns_schema.xsd,\
dist/,\
lib/delight-rhino-sandbox-0.0.15.jar,\
lib/rhino-1.7.13.jar
dist/
src.includes = META-INF/,\
mappingMetadataTypes.xml,\
mappings/,\

View File

@@ -9,61 +9,19 @@
</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-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>
<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>

View File

@@ -40,6 +40,8 @@ public interface ILibraryManagerService extends IService {
*/
public boolean isInitialized();
public void setInitialized();
public void installModules(Collection<ModuleNeeded> modules, IProgressMonitor monitorWrap);
/**

View File

@@ -34,7 +34,6 @@ import org.talend.core.ILibraryManagerService;
import org.talend.core.database.conn.ConnParameterKeys;
import org.talend.core.database.conn.template.DbConnStrForHive;
import org.talend.core.hadoop.BigDataBasicUtil;
import org.talend.core.hadoop.IHadoopDistributionService;
import org.talend.core.model.general.ModuleNeeded;
import org.talend.core.model.general.Project;
import org.talend.core.model.metadata.IMetadataConnection;
@@ -83,7 +82,7 @@ public class ClassLoaderFactory {
}
public static DynamicClassLoader getClassLoader(String index, boolean showDownloadIfNotExist) {
DynamicClassLoader classLoader = getClassLoaderMap(index).get(index);
DynamicClassLoader classLoader = getClassLoaderMap().get(index);
if (classLoader == null) {
classLoader = findLoader(index, null, showDownloadIfNotExist);
}
@@ -92,7 +91,7 @@ public class ClassLoaderFactory {
}
public static DynamicClassLoader getClassLoader(String index, ClassLoader parentClassLoader) {
DynamicClassLoader classLoader = getClassLoaderMap(index).get(index);
DynamicClassLoader classLoader = getClassLoaderMap().get(index);
if (classLoader == null) {
classLoader = findLoader(index, parentClassLoader, true);
}
@@ -155,12 +154,12 @@ public class ClassLoaderFactory {
private static DynamicClassLoader createCustomClassLoader(String index, Set<String> libraries) {
DynamicClassLoader classLoader = new DynamicClassLoader();
loadLibraries(classLoader, libraries.toArray(new String[0]), true);
getClassLoaderMap(index).put(index, classLoader);
getClassLoaderMap().put(index, classLoader);
return classLoader;
}
private static void init(String index) {
private static void init() {
File tmpFolder = getTmpFolder();
if (tmpFolder.exists()) {
FilesUtils.removeFolder(tmpFolder, true);
@@ -169,7 +168,7 @@ public class ClassLoaderFactory {
}
public static IConfigurationElement findIndex(String index) {
IConfigurationElement[] elements = getConfigurationElements(index);
IConfigurationElement[] elements = getConfigurationElements();
if (StringUtils.isNotEmpty(index) && elements != null) {
for (IConfigurationElement current : elements) {
String key = current.getAttribute(INDEX_ATTR);
@@ -226,7 +225,7 @@ public class ClassLoaderFactory {
}
if (putInCache) {
// if any libraries can't be retreived , do not put it in cache
getClassLoaderMap(index).put(index, classLoader);
getClassLoaderMap().put(index, classLoader);
}
return classLoader;
}
@@ -338,7 +337,7 @@ public class ClassLoaderFactory {
}
public static String[] getDriverModuleList(String connKeyString) {
IConfigurationElement[] elements = getConfigurationElements(connKeyString);
IConfigurationElement[] elements = getConfigurationElements();
if (connKeyString != null && elements != null) {
for (IConfigurationElement current : elements) {
String key = current.getAttribute(INDEX_ATTR);
@@ -366,36 +365,12 @@ public class ClassLoaderFactory {
return hdClassLoader;
}
private static IConfigurationElement[] getConfigurationElements(String index) {
checkCache(index);
private static IConfigurationElement[] getConfigurationElements() {
checkCache();
return configurationElements;
}
private static String getVersion(String index) {
if (StringUtils.isBlank(index)) {
return null;
}
String[] split = index.split(":");
if (2 < split.length) {
return split[2];
} else {
return null;
}
}
private synchronized static void checkCache(String index) {
try {
String version = getVersion(index);
if (StringUtils.isNotBlank(version)) {
IHadoopDistributionService hdService = IHadoopDistributionService.get();
if (hdService != null) {
hdService.checkDynamicDistributionExtensions(version);
}
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
private synchronized static void checkCache() {
boolean isCacheChanged = false;
if (configurationElements != null) {
for (IConfigurationElement configElement : configurationElements) {
@@ -404,17 +379,17 @@ public class ClassLoaderFactory {
}
}
}
if (!StringUtils.equals(cacheVersion, BigDataBasicUtil.getDynamicDistributionPluginExtensionCacheVersion())) {
if (!StringUtils.equals(cacheVersion, BigDataBasicUtil.getDynamicDistributionCacheVersion())) {
isCacheChanged = true;
}
if (isCacheChanged) {
init(index);
init();
IExtensionRegistry registry = Platform.getExtensionRegistry();
configurationElements = registry.getConfigurationElementsFor(EXTENSION_POINT_ID);
cacheVersion = BigDataBasicUtil.getDynamicDistributionPluginExtensionCacheVersion();
cacheVersion = BigDataBasicUtil.getDynamicDistributionCacheVersion();
} else {
if (classLoadersMap == null) {
init(index);
init();
}
if (configurationElements == null) {
IExtensionRegistry registry = Platform.getExtensionRegistry();
@@ -423,8 +398,8 @@ public class ClassLoaderFactory {
}
}
private static Map<String, DynamicClassLoader> getClassLoaderMap(String index) {
checkCache(index);
private static Map<String, DynamicClassLoader> getClassLoaderMap() {
checkCache();
return classLoadersMap;
}
}

View File

@@ -22,14 +22,14 @@ import org.talend.core.runtime.hd.hive.HiveMetadataHelper;
*/
public enum EImpalaDriver {
HIVE2("HIVE2", "HIVE2", "org.apache.hive.jdbc.HiveDriver", "doSupportHive2"),
IMPALA("IMPALA", "IMPALA", "com.cloudera.impala.jdbc.Driver", "doSupportImpalaConnector");
HIVE2("HIVE2", "HIVE2", "org.apache.hive.jdbc.HiveDriver"),
IMPALA40("IMPALA40", "IMPALA40", "com.cloudera.impala.jdbc4.Driver"),
IMPALA41("IMPALA41", "IMPALA41", "com.cloudera.impala.jdbc41.Driver");
EImpalaDriver(String displayName, String name, String driver, String supportDriverMethodName) {
EImpalaDriver(String displayName, String name, String driver) {
this.displayName = displayName;
this.name = name;
this.driver = driver;
this.supportDriverMethodName = supportDriverMethodName;
}
private String displayName;
@@ -38,8 +38,6 @@ public enum EImpalaDriver {
private String driver;
private String supportDriverMethodName;
public String getDisplayName() {
return displayName;
}
@@ -52,10 +50,6 @@ public enum EImpalaDriver {
return driver;
}
public String getSupportDriverMethodName() {
return supportDriverMethodName;
}
public static boolean isSupport(String distribution, String version, boolean byDisplay, String supportMethodName) {
return HiveMetadataHelper.doSupportMethod(distribution, version, byDisplay, supportMethodName);
}
@@ -63,7 +57,7 @@ public enum EImpalaDriver {
public static String[] getImpalaDriverDisplay(String distribution, String version, boolean byDisplay) {
List<String> list = new ArrayList<>(0);
for (EImpalaDriver driver : EImpalaDriver.values()) {
if (isSupport(distribution, version, byDisplay, driver.getSupportDriverMethodName())) {
if (isSupport(distribution, version, byDisplay, "doSupportImpalaConnector")) {
list.add(driver.getDisplayName());
}
}

View File

@@ -228,10 +228,8 @@ public class DatabaseConnStrUtil {
.get(ConnParameterKeys.IMPALA_AUTHENTICATION_PRINCIPLA));
}
String url = null;
String driver = dbConn.getParameters().get(ConnParameterKeys.IMPALA_DRIVER);
if (template.startsWith(DbConnStrForHive.URL_HIVE_2_TEMPLATE)
|| template.startsWith(DbConnStrForHive.URL_IMPALA_TEMPLATE)) {
url = getImpalaURLString(false, server, port, sidOrDatabase, impalaPrincipal, driver);
if (template.startsWith(DbConnStrForHive.URL_HIVE_2_TEMPLATE)) {
url = getImpalaURLString(false, server, port, sidOrDatabase, impalaPrincipal);
}
url = attachAdditionalHiveParameters(url, dbConn, false);
return url;
@@ -378,13 +376,9 @@ public class DatabaseConnStrUtil {
return s;
}
private static String getImpalaURLString(boolean supportContext, String server, String port, String sid, String Principal,
String driver) {
String template = EDatabaseConnTemplate.IMPALA.getUrlTemplate(null);
if (EDatabaseTypeName.IMPALA.getDbType().equals(driver)) {
template = EDatabaseConnTemplate.IMPALA_IMPALA_DRIVER.getUrlTemplate(null);
}
String standardURlString = getImpalaURlString(template, supportContext, server, port, sid);
private static String getImpalaURLString(boolean supportContext, String server, String port, String sid, String Principal) {
String s = EDatabaseConnTemplate.IMPALA.getUrlTemplate(null);
String standardURlString = getImpalaURlString(s, supportContext, server, port, sid);
String principalSuffix = "principal="; //$NON-NLS-1$
boolean hasPrinc = false;
String[] urlArray = standardURlString.split(SEMICOLON);

View File

@@ -30,8 +30,6 @@ public class DbConnStrForHive extends DbConnStr {
public static final String URL_HIVE_2_TEMPLATE = "jdbc:hive2://";//$NON-NLS-1$
public static final String URL_IMPALA_TEMPLATE = "jdbc:impala://";//$NON-NLS-1$
/**
* DOC Marvin DbConnStrForHive constructor comment.
*

View File

@@ -214,9 +214,6 @@ public enum EDatabaseConnTemplate {
IMPALA(new DbConnStr(EDatabaseTypeName.IMPALA, "jdbc:hive2://<host>:<port>/<sid>;auth=noSasl", //$NON-NLS-1$
"21050", null, null, "localhost", "default")), //$NON-NLS-1$
IMPALA_IMPALA_DRIVER(new DbConnStr(EDatabaseTypeName.IMPALA, "jdbc:impala://<host>:<port>/<sid>;auth=noSasl", //$NON-NLS-1$
"21050", null, null, "localhost", "default")), //$NON-NLS-1$
HBASE(new DbConnStr(EDatabaseTypeName.HBASE, "127.0.0.1", //$NON-NLS-1$
"2181")), //$NON-NLS-1$

View File

@@ -84,11 +84,7 @@ 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", //$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" })),
"Microsoft", "MSSQL_PROP", "mssql-jdbc.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
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$

View File

@@ -37,7 +37,5 @@ public interface DownloadListener {
* Notify after download complete.
*/
void downloadComplete();
default void downloadFailed(Exception ex) {
}
}

View File

@@ -24,13 +24,5 @@ public interface IDownloadHelper {
public void setCancel(boolean cancel);
public void download(URL componentUrl, File destination) throws Exception;
default URL getDownloadingURL() {
return null;
}
default long getContentLength() {
return -1l;
}
}

View File

@@ -132,17 +132,4 @@ public class BigDataBasicUtil {
}
return null;
}
public static String getDynamicDistributionPluginExtensionCacheVersion() {
try {
IDynamicDistributionManager ddManager = getDynamicDistributionManager(new NullProgressMonitor());
if (ddManager != null && ddManager.isLoaded()) {
return ddManager.getPluginExtensionCacheVersion();
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
return null;
}
}

View File

@@ -14,7 +14,6 @@ package org.talend.core.hadoop;
import java.util.Map;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.IService;
import org.talend.core.runtime.hd.IDistributionsManager;
import org.talend.core.runtime.hd.IDynamicDistributionManager;
@@ -65,8 +64,6 @@ public interface IHadoopDistributionService extends IService {
*/
IHDistributionVersion getHadoopDistributionVersion(String version, boolean byDisplay);
boolean checkDynamicDistributionExtensions(String version);
/**
*
* for Hadoop Distribution {@link HadoopComponent}.
@@ -131,13 +128,4 @@ public interface IHadoopDistributionService extends IService {
boolean doSupportMapRTicket(IHDistributionVersion distributionVersion);
IDynamicDistributionManager getDynamicDistributionManager();
public static IHadoopDistributionService get() {
GlobalServiceRegister gsr = GlobalServiceRegister.getDefault();
if (gsr.isServiceRegistered(IHadoopDistributionService.class)) {
return gsr.getService(IHadoopDistributionService.class);
}
return null;
}
}

View File

@@ -26,6 +26,11 @@ public enum ECustomVersionGroup {
MAPRDB,
PIG,
PIG_HBASE,
PIG_HCATALOG,
MAP_REDUCE,
SPARK,

View File

@@ -18,6 +18,12 @@ 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$

View File

@@ -483,7 +483,7 @@ public class HadoopCustomVersionDefineDialog extends TitleAreaDialog {
private boolean isSupportHadoop() {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IHadoopService.class)) {
hadoopService = GlobalServiceRegister.getDefault().getService(IHadoopService.class);
hadoopService = (IHadoopService) GlobalServiceRegister.getDefault().getService(IHadoopService.class);
}
return hadoopService != null;
@@ -503,7 +503,11 @@ 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("tMRConfiguration", ComponentCategory.CATEGORY_4_MAPREDUCE.getName());//$NON-NLS-1$
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$
if (node == null) {
filteredTypes = ArrayUtils.removeElement(filteredTypes, ECustomVersionType.MAP_REDUCE);
}

View File

@@ -425,7 +425,7 @@ public class HadoopVersionDialog extends TitleAreaDialog {
if (isFromExistVersion) {
IHadoopService hadoopService = null;
if (GlobalServiceRegister.getDefault().isServiceRegistered(IHadoopService.class)) {
hadoopService = GlobalServiceRegister.getDefault().getService(IHadoopService.class);
hadoopService = (IHadoopService) GlobalServiceRegister.getDefault().getService(IHadoopService.class);
}
if (hadoopService != null) {
for (ECustomVersionGroup group : existVersionSelectionMap.keySet()) {
@@ -437,7 +437,10 @@ public class HadoopVersionDialog extends TitleAreaDialog {
for (ECustomVersionType type : types) {
if (type.getGroup() == group) {
Set<String> hadoopLibraries = new HashSet<String>();
if (ECustomVersionType.MAP_REDUCE == type) {
if (ECustomVersionType.PIG == type || ECustomVersionType.PIG_HBASE == type
|| ECustomVersionType.PIG_HCATALOG == type) {
hadoopLibraries = getLibrariesForPig(type);
} else if (ECustomVersionType.MAP_REDUCE == type) {
hadoopLibraries = getLibrariesForMapReduce(type);
} else if (ECustomVersionType.SPARK == type || ECustomVersionType.SPARK_STREAMING == type) {
hadoopLibraries = getLibrariesForSpark(type);
@@ -539,6 +542,42 @@ 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;
}

View File

@@ -12,126 +12,89 @@
// ============================================================================
package org.talend.core.model.components;
import java.io.File;
import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.xmi.XMLResource;
import org.eclipse.emf.ecore.xmi.impl.XMLParserPoolImpl;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.exception.PersistenceException;
import org.talend.commons.runtime.model.emf.EmfHelper;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.ILibraryManagerService;
import org.talend.core.language.LanguageManager;
import org.talend.core.model.component_cache.ComponentCacheFactory;
import org.talend.core.model.component_cache.ComponentCachePackage;
import org.talend.core.model.component_cache.ComponentsCache;
import org.talend.core.model.component_cache.util.ComponentCacheResourceFactoryImpl;
import org.talend.core.utils.TalendCacheUtils;
import org.talend.core.model.general.ILibrariesService;
/**
* DOC zwzhao class global comment. Detailled comment
*/
public class ComponentManager {
private static final String TALEND_COMPONENTS_CACHE_FILE = "components.cache"; //$NON-NLS-1$
private static ComponentsCache cache;
private static Map<String, ComponentsCache> caches = new HashMap<>();
private static final String TALEND_COMPONENT_CACHE = "ComponentsCache.";
private static Set<File> providerInstallationFolders;
private static final String TALEND_FILE_NAME = "cache";
private static Set<String> modified = new HashSet<>();
private static boolean modified = false;
public static Map<String, ComponentsCache> getComponentCaches() {
if (caches.isEmpty()) {
getProviderInstallationFolders()
.forEach(f -> caches.put(f.getAbsolutePath(), ComponentCacheFactory.eINSTANCE.createComponentsCache()));
public static ComponentsCache getComponentCache() {
if (cache == null) {
cache = ComponentCacheFactory.eINSTANCE.createComponentsCache();
}
return caches;
return cache;
}
public static void saveResource() {
if (!modified.isEmpty()) {
caches.entrySet().stream().filter(entry -> modified.contains(entry.getKey())).forEach(entry -> {
try {
Resource resource = createComponentCacheResource(entry.getKey());
resource.getContents().add(entry.getValue());
EmfHelper.saveResource(entry.getValue().eResource());
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
});
ILibraryManagerService repositoryBundleService = GlobalServiceRegister.getDefault()
if (isModified()) {
String installLocation = new Path(Platform.getConfigurationLocation().getURL().getPath()).toFile().getAbsolutePath();
try {
Resource resource = createComponentCacheResource(installLocation);
resource.getContents().add(cache);
EmfHelper.saveResource(cache.eResource());
} catch (PersistenceException e1) {
ExceptionHandler.process(e1);
}
ILibraryManagerService repositoryBundleService = (ILibraryManagerService) GlobalServiceRegister.getDefault()
.getService(ILibraryManagerService.class);
repositoryBundleService.clearCache();
modified.clear();
}
}
public static boolean needRegenerateCache(String installLocation) {
// if there is no index file or -clean is added to command
return !hasComponentFile(installLocation) || TalendCacheUtils.isSetCleanComponentCache();
}
public static boolean hasComponentFile(String installLocation) {
File file = new File(installLocation, TALEND_COMPONENTS_CACHE_FILE);
return file != null && file.exists();
}
public static void loadComponentResource() throws IOException {
caches.clear();
for (File installationFolder : getProviderInstallationFolders()) {
URI uri = URI.createFileURI(installationFolder.getAbsolutePath()).appendSegment(TALEND_COMPONENTS_CACHE_FILE);
ComponentCacheResourceFactoryImpl compFact = new ComponentCacheResourceFactoryImpl();
Resource resource = compFact.createResource(uri);
Map<Object, Object> optionMap = new HashMap<>();
optionMap.put(XMLResource.OPTION_DEFER_ATTACHMENT, Boolean.TRUE);
optionMap.put(XMLResource.OPTION_DEFER_IDREF_RESOLUTION, Boolean.TRUE);
optionMap.put(XMLResource.OPTION_USE_PARSER_POOL, new XMLParserPoolImpl());
optionMap.put(XMLResource.OPTION_USE_XML_NAME_TO_FEATURE_MAP, new HashMap<>());
optionMap.put(XMLResource.OPTION_USE_DEPRECATED_METHODS, Boolean.FALSE);
// TODO remove the try catch block after merge commits for TDM
try {
resource.load(optionMap);
} catch (IOException e) {
ExceptionHandler.process(e);
continue;
if (GlobalServiceRegister.getDefault().isServiceRegistered(ILibrariesService.class)) {
ILibrariesService libService = (ILibrariesService) GlobalServiceRegister.getDefault().getService(
ILibrariesService.class);
if (libService != null) {
libService.syncLibraries();
}
}
caches.put(installationFolder.getAbsolutePath(), (ComponentsCache) EcoreUtil.getObjectByType(resource.getContents(),
ComponentCachePackage.eINSTANCE.getComponentsCache()));
setModified(false);
}
}
public static void clearAllCaches() {
caches.clear();
}
public static void setModified(String installationFolder) {
modified.add(installationFolder);
}
private static Resource createComponentCacheResource(String installLocation) {
URI uri = URI.createFileURI(installLocation).appendSegment(TALEND_COMPONENTS_CACHE_FILE);
public static Resource createComponentCacheResource(String installLocation) {
String filePath = ComponentManager.TALEND_COMPONENT_CACHE + LanguageManager.getCurrentLanguage().toString().toLowerCase()
+ ComponentManager.TALEND_FILE_NAME;
URI uri = URI.createFileURI(installLocation).appendSegment(filePath);
ComponentCacheResourceFactoryImpl compFact = new ComponentCacheResourceFactoryImpl();
return compFact.createResource(uri);
}
private static Set<File> getProviderInstallationFolders() {
if (providerInstallationFolders == null && IComponentsService.get() != null) {
providerInstallationFolders = IComponentsService.get().getComponentsFactory().getProviderInstallationFolders();
}
if (providerInstallationFolders == null) {
return Collections.emptySet();
}
return providerInstallationFolders;
/**
* Getter for modified.
*
* @return the modified
*/
public static boolean isModified() {
return modified;
}
/**
* Sets the modified.
*
* @param modified the modified to set
*/
public static void setModified(boolean modified) {
ComponentManager.modified = modified;
}
}

View File

@@ -55,7 +55,7 @@ public interface IComponentsFactory {
*/
public Set<IComponent> getComponents();
public boolean isInitializing();
public boolean isInitialising();
/**
* Get a readonly components collection to avoid ConcurrentModificationException caused by multiple thread
@@ -113,9 +113,4 @@ public interface IComponentsFactory {
public List<ComponentProviderInfo> getComponentsProvidersInfo();
public String getCustomComponentBundlePath();
public Set<IComponent> getComponentsForInit();
public Set<File> getProviderInstallationFolders();
}

View File

@@ -12,7 +12,6 @@
// ============================================================================
package org.talend.core.model.components;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.IService;
/**
@@ -27,11 +26,4 @@ public interface IComponentsService extends IService {
public IComponentFileNaming getComponentFileNaming();
public static IComponentsService get() {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IComponentsService.class)) {
return GlobalServiceRegister.getDefault().getService(IComponentsService.class);
}
return null;
}
}

View File

@@ -14,14 +14,12 @@ package org.talend.core.model.general;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.eclipse.core.runtime.Path;
import org.osgi.framework.Version;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.ILibraryManagerService;
import org.talend.core.database.conn.version.DatabaseDriversCache;
@@ -31,9 +29,6 @@ import org.talend.core.runtime.maven.MavenArtifact;
import org.talend.core.runtime.maven.MavenConstants;
import org.talend.core.runtime.maven.MavenUrlHelper;
import org.talend.core.utils.TalendQuoteUtils;
import org.talend.utils.json.JSONException;
import org.talend.utils.json.JSONObject;
import org.talend.utils.json.JSONTokener;
/**
* This bean is use to manage needed moduless (perl) and libraries (java).<br/>
@@ -43,8 +38,6 @@ import org.talend.utils.json.JSONTokener;
*/
public class ModuleNeeded {
public static final String ATTR_USED_BY_DYNAMIC_DISTRIBUTION = "dynamicDistribution";
private String id;
private String context;
@@ -101,8 +94,6 @@ public class ModuleNeeded {
*/
private boolean useReleaseVersion = false;
private Map<String, String> attributes;
ILibraryManagerService libManagerService = (ILibraryManagerService) GlobalServiceRegister.getDefault()
.getService(ILibraryManagerService.class);
@@ -171,10 +162,6 @@ public class ModuleNeeded {
this.required = required;
this.installURL = installURL;
this.requiredIf = requiredIf;
this.attributes = analyseMessage(informationMsg);
if (!this.attributes.isEmpty()) {
this.informationMsg = "";
}
String name = moduleName;
String uri = mavenUrl;
if (moduleName != null) {
@@ -197,32 +184,6 @@ public class ModuleNeeded {
setMavenUri(uri);
}
private Map<String, String> analyseMessage(String msg) {
Map<String, String> attrMap = new HashMap<>();
if (StringUtils.isBlank(msg) || !msg.startsWith("{") || !msg.endsWith("}")) {
return attrMap;
}
try {
JSONObject jo = new JSONObject(new JSONTokener(msg));
Iterator<String> keys = jo.keys();
keys.forEachRemaining(key -> {
try {
Object object = jo.get(key);
if (object != null) {
attrMap.put(key, object.toString());
}
} catch (JSONException e) {
ExceptionHandler.process(e);
}
});
} catch (Exception e) {
if (Boolean.getBoolean("talend.studio.moduleNeeded.init.debug")) {
ExceptionHandler.process(e);
}
}
return attrMap;
}
@Override
public ModuleNeeded clone() {
ModuleNeeded cloned = new ModuleNeeded(context, moduleName, informationMsg, mrRequired, installURL, requiredIf, mavenUri);
@@ -251,7 +212,6 @@ public class ModuleNeeded {
cloned.requiredIf = requiredIf;
cloned.status = status;
cloned.useReleaseVersion = useReleaseVersion;
cloned.attributes = attributes;
return cloned;
}
@@ -711,10 +671,6 @@ public class ModuleNeeded {
}
}
public boolean usedByDynamicDistribution() {
return Boolean.valueOf(attributes.get(ATTR_USED_BY_DYNAMIC_DISTRIBUTION));
}
public boolean isDynamic() {
return this.dynamic;
}

View File

@@ -106,6 +106,4 @@ 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$
}
}

View File

@@ -281,7 +281,9 @@ public final class MetadataToolHelper {
}
public static boolean isAllowSpecificCharacters() {
return CoreRuntimePlugin.getInstance().getProjectPreferenceManager().isAllowSpecificCharacters();
IEclipsePreferences coreUIPluginNode = new InstanceScope().getNode(ITalendCorePrefConstants.CoreUIPlugin_ID);
return coreUIPluginNode
.getBoolean(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS, false);
}
/**

View File

@@ -32,7 +32,9 @@ 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;
@@ -441,13 +443,6 @@ 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;
}
@@ -1537,6 +1532,22 @@ 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);
}

View File

@@ -21,7 +21,6 @@ import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.text.StringEscapeUtils;
import org.eclipse.emf.common.util.EList;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.exception.PersistenceException;
@@ -63,6 +62,7 @@ import org.talend.designer.core.model.utils.emf.talendfile.RoutinesParameterType
import org.talend.designer.runprocess.ItemCacheManager;
import org.talend.repository.ProjectManager;
import org.talend.repository.model.IProxyRepositoryFactory;
import org.apache.commons.text.StringEscapeUtils;
/**
* DOC bqian class global comment. Detailled comment

View File

@@ -52,6 +52,4 @@ 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";
}

View File

@@ -21,13 +21,14 @@ 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;
@@ -35,7 +36,8 @@ 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.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.talend.commons.utils.PasswordEncryptUtil;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.language.ECodeLanguage;
@@ -48,16 +50,14 @@ import org.talend.core.model.metadata.types.JavaTypesManager;
import org.talend.core.model.process.IContext;
import org.talend.core.model.process.IContextManager;
import org.talend.core.model.process.IContextParameter;
import org.talend.core.runtime.CoreRuntimePlugin;
import org.talend.core.model.repository.IRepositoryPrefConstants;
import org.talend.core.prefs.ITalendCorePrefConstants;
import org.talend.core.runtime.services.IGenericDBService;
import org.talend.core.utils.TalendQuoteUtils;
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/>
*
@@ -84,12 +84,6 @@ 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.
*/
@@ -212,37 +206,10 @@ public final class ContextParameterUtils {
}
}
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;
private static ScriptEngine engine = new ScriptEngineManager().getEngineByName("JavaScript");
public static ScriptEngine getScriptEngine() {
return engine;
}
public static String convertContext2Literal4AnyVar(final String code, final IContext context) {
@@ -256,22 +223,23 @@ public final class ContextParameterUtils {
Object result = code;
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) {
engine = new ScriptEngineManager().getEngineByName("JavaScript");
}
String newCode = preProcessScript(code);
if (engine == null) {
throw new RuntimeException("can't find the script engine");
}
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 = SANDBOX.eval(null,
newCode.replace("\r\n", replacement).replace("\n", replacement).replace("\r", replacement));
result = engine.eval(code.replace("\r\n", replacement).replace("\n", replacement).replace("\r", replacement));
} catch (Exception e) {
// ignore the exception
}
@@ -649,12 +617,8 @@ public final class ContextParameterUtils {
}
private static boolean isAllowSpecificCharacters() {
if (Platform.isRunning()) {
return CoreRuntimePlugin.getInstance().getProjectPreferenceManager().isAllowSpecificCharacters();
} else {
// Can not get the value if current code is not working in studio
return false;
}
IEclipsePreferences coreUIPluginNode = new InstanceScope().getNode(ITalendCorePrefConstants.CoreUIPlugin_ID);
return coreUIPluginNode.getBoolean(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS, false);
}
public static boolean isEmptyParameter(String source) {

View File

@@ -27,6 +27,9 @@ 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;
@@ -425,7 +428,7 @@ public class NodeUtil {
* @param node
* @param type - node type to look for
* @return
*/
*/
public static List<? extends IConnection> getFirstIncomingLineConnectionsOfType(INode node, String type) {
if (type == null)
return new ArrayList<IConnection>();
@@ -448,9 +451,9 @@ public class NodeUtil {
INode nextNode = connection.getSource();
if (!uniqueNamesDone.contains(nextNode.getUniqueName())) {
uniqueNamesDone.add(nextNode.getUniqueName());
uniqueNamesDone.add(nextNode.getUniqueName());
if (type.equals((String)nextNode.getElementParameter("COMPONENT_NAME").getValue())) {
if (type.equals((String)nextNode.getElementParameter("COMPONENT_NAME").getValue())) {
conns.add(connection);
} else {
conns.addAll(getFirstIncomingLineConnectionsOfType(nextNode, uniqueNamesDone, type)); // follow this way
@@ -1083,7 +1086,14 @@ public class NodeUtil {
}
private static boolean isValidLiteralValue(String value) {
return ContextParameterUtils.isValidLiteralValue(value);
ScriptEngine se = ContextParameterUtils.getScriptEngine();
if(se==null) return true;
try {
se.eval(value);
return true;
} catch (ScriptException e) {
return false;
}
}
private static String checkStringQuotationMarks(String str) {

View File

@@ -146,7 +146,7 @@ public class TalendMavenResolver {
getMavenResolver();
}
public static MavenResolver getMavenResolver() throws RuntimeException {
private static MavenResolver getMavenResolver() throws RuntimeException {
if (mavenResolver == null) {
final BundleContext context = CoreRuntimePlugin.getInstance().getBundle().getBundleContext();
ServiceReference<org.ops4j.pax.url.mvn.MavenResolver> mavenResolverService = context

View File

@@ -126,9 +126,6 @@ public abstract class AbstractPropertyValueEvaluator implements PropertyValueEva
}
if (GenericTypeUtils.isStringType(property)) {
if (property.isFlag(Property.Flags.ENCRYPT)) {
return TalendQuoteUtils.removeQuotes(stringValue);
}
return TalendQuoteUtils.removeQuotes(StringEscapeUtils.unescapeJava(stringValue));
}
return rawValue;

View File

@@ -31,8 +31,6 @@ public interface IDynamicDistributionManager {
public void reloadAllDynamicDistributions(IProgressMonitor monitor) throws Exception;
public void reset(IProgressMonitor monitor);
public boolean isLoaded();
public void load(IProgressMonitor monitor, boolean resetModulesCache) throws Exception;
@@ -42,7 +40,4 @@ public interface IDynamicDistributionManager {
public boolean isUsersDynamicDistribution(String dynamicDistributionId);
public String getDynamicDistributionCacheVersion();
public String getPluginExtensionCacheVersion();
}

View File

@@ -48,8 +48,6 @@ 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";
/*

View File

@@ -15,7 +15,6 @@ package org.talend.core.runtime.projectsetting;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.Assert;
@@ -28,7 +27,6 @@ import org.talend.commons.exception.PersistenceException;
import org.talend.commons.utils.workbench.resources.ResourceUtils;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.model.general.Project;
import org.talend.core.model.repository.IRepositoryPrefConstants;
import org.talend.designer.runprocess.IRunProcessService;
import org.talend.repository.ProjectManager;
import org.talend.repository.documentation.ERepositoryActionName;
@@ -197,19 +195,7 @@ public class ProjectPreferenceManager {
// return qulifierPreference.getBoolean(key, false);
return getPreferenceStore().getBoolean(key);
}
public boolean isAllowSpecificCharacters() {
String value = getValue(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS);
if (StringUtils.isNotEmpty(value)) {
return Boolean.valueOf(value);
}
return false; // Default value
}
public void setAllowSpecificCharacters(boolean isAllow) {
setValue(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS, isAllow);
}
/**
* Save the configurations.
*/

View File

@@ -21,7 +21,6 @@ import org.talend.core.model.components.IComponent;
import org.talend.core.model.metadata.builder.connection.Connection;
import org.talend.core.model.process.IElementParameter;
import org.talend.core.model.process.INode;
import org.talend.repository.model.RepositoryNode;
/**
* created by ycbai on 2016年3月24日 Detailled comment
@@ -29,20 +28,6 @@ import org.talend.repository.model.RepositoryNode;
*/
public interface IGenericService extends IService {
/**
* Get all the names of generic type.
*
* @return
*/
public List<String> getGenericTypeNames();
/**
* Create repository nodes by component service.
*
* @param curParentNode
*/
public List<RepositoryNode> createNodesFromComponentService(RepositoryNode curParentNode);
/**
* Call method <code>callBeforeActivate()</code> of <code>parameter</code>.
*

View File

@@ -1,52 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.core.runtime.services;
import java.util.List;
import org.talend.components.api.properties.ComponentProperties;
import org.talend.components.api.service.ComponentService;
import org.talend.components.api.wizard.ComponentWizard;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.IService;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.repository.model.IRepositoryNode.ENodeType;
import org.talend.repository.model.RepositoryNode;
/**
* created by ycbai on 2015年9月21日 Detailled comment
*
*/
public interface IGenericWizardInternalService extends IService {
public ERepositoryObjectType createRepositoryType(String type, String label, String alias, String folder, int ordinal);
public RepositoryNode createRepositoryNode(RepositoryNode curParentNode, String label, ERepositoryObjectType type,
ENodeType nodeType);
public ComponentService getComponentService();
public ComponentWizard getComponentWizard(String name, String location);
public List<ComponentWizard> getComponentWizardsForProperties(ComponentProperties properties, String location);
public ComponentWizard getTopLevelComponentWizard(ComponentProperties properties, String location);
public static IGenericWizardInternalService getService() {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericWizardInternalService.class)) {
return GlobalServiceRegister.getDefault().getService(IGenericWizardInternalService.class);
}
return null;
}
}

View File

@@ -39,6 +39,20 @@ import org.talend.repository.model.RepositoryNode;
*/
public interface IGenericWizardService extends IService {
/**
* Create repository nodes by component service.
*
* @param curParentNode
*/
public List<RepositoryNode> createNodesFromComponentService(RepositoryNode curParentNode);
/**
* Get all the names of generic type.
*
* @return
*/
public List<String> getGenericTypeNames();
/**
*
* Estimate whether <code>repObjType</code> is a generic type or not.
@@ -136,8 +150,6 @@ public interface IGenericWizardService extends IService {
*/
public ITreeContextualAction getDefaultAction(RepositoryNode node);
public ITreeContextualAction getGenericAction(String typeName, String location);
public void loadAdditionalJDBC();
public List<String> getAllAdditionalJDBCTypes();

View File

@@ -1,118 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.core.runtime.util;
import java.io.File;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jdt.launching.IVMInstall;
import org.eclipse.jdt.launching.IVMInstall2;
import org.eclipse.jdt.launching.JavaRuntime;
import org.talend.commons.utils.generation.JavaUtils;
/**
* created by nrousseau on Jun 13, 2015 Detailled comment
*
*/
public class JavaHomeUtil {
/**
* Initialize Java Home to the preferences if needed only.<br>
*
* @throws CoreException
*/
public static void initializeJavaHome() throws CoreException {
IEclipsePreferences pref = InstanceScope.INSTANCE.getNode(JavaRuntime.ID_PLUGIN); //$NON-NLS-1$
String defaultVM = pref.get(JavaRuntime.PREF_VM_XML, ""); //$NON-NLS-1$//$NON-NLS-2$
boolean needSetupJVM = false;
if (!"".equals(defaultVM)) { //$NON-NLS-1$
if (isSetJdkHomeVariable() && !getJDKHomeVariable().equals(getCurrentJavaHomeString())) {
needSetupJVM = true;
}
} else {
needSetupJVM = true;
}
if (needSetupJVM) {
IVMInstall currentVM = JavaRuntime.getDefaultVMInstall();
if (isSetJdkHomeVariable()) {
if (currentVM != null) {
File installLocation = new File(getJDKHomeVariable());
currentVM.setInstallLocation(installLocation);
currentVM.setName(installLocation.getName());
}
}
}
}
/**
* Only for TUJ to setup JDK version
* Should invoke after initializeJavaHome()
*/
public static String getSpecifiedJavaVersion() {
if (isSetJdkHomeVariable()) {
IVMInstall currentVM = JavaRuntime.getDefaultVMInstall();
if (currentVM instanceof IVMInstall2) {
return JavaUtils.getCompilerCompliance((IVMInstall2) currentVM, null);
}
}
return null;
}
public static boolean isSetJdkHomeVariable() {
String jdkHomeValue = getJDKHomeVariable();
return jdkHomeValue != null && !"".equals(jdkHomeValue); //$NON-NLS-1$
}
public static String getJDKHomeVariable() {
String jdkHome = System.getProperty("job.compilation.jvm"); //$NON-NLS-1$
if (jdkHome == null || "".equals(jdkHome)) { //$NON-NLS-1$
jdkHome = System.getProperty("jdk.home"); //$NON-NLS-1$
}
if (StringUtils.isNoneEmpty(jdkHome)) {
File jvmFile = new File(jdkHome);
if (jvmFile.exists()) {
return getJDKPath(jvmFile);
}
}
return null;
}
private static String getJDKPath(File file) {
if (file == null) {
return null;
}
if ("bin".equals(file.getName())) {//$NON-NLS-1$
return file.getParent();
} else {
return getJDKPath(file.getParentFile());
}
}
public static File getCurrentJavaHomeFile() {
IVMInstall currentVM = JavaRuntime.getDefaultVMInstall();
if (currentVM == null) {
return null;
}
return currentVM.getInstallLocation();
}
public static String getCurrentJavaHomeString() {
IVMInstall currentVM = JavaRuntime.getDefaultVMInstall();
if (currentVM == null) {
return null;
}
return currentVM.getInstallLocation().getAbsolutePath();
}
}

View File

@@ -7,7 +7,6 @@ import java.util.LinkedHashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.exception.PersistenceException;
@@ -23,7 +22,6 @@ import org.talend.designer.runprocess.IRunProcessService;
import org.talend.repository.ProjectManager;
import org.talend.repository.model.IProxyRepositoryFactory;
import org.talend.repository.model.IProxyRepositoryService;
import org.talend.repository.model.IRepositoryService;
public class CodesJarResourceCache {
@@ -31,14 +29,12 @@ public class CodesJarResourceCache {
private static final Object LOCK = new Object();
private static AtomicBoolean isInitialized = new AtomicBoolean(false);
private static AtomicBoolean isInitializing = new AtomicBoolean(true);
private static boolean isListenerAdded;
private static PropertyChangeListener listener;
public static void initCodesJarCache() {
if (isInitialized.compareAndSet(false, true)) {
synchronized (LOCK) {
CACHE.clear();
List<Project> allProjects = new ArrayList<>();
allProjects.addAll(ProjectManager.getInstance().getAllReferencedProjects(true));
@@ -53,43 +49,40 @@ public class CodesJarResourceCache {
}
}
}
if (listener == null) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
IRunProcessService service = GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
listener = service.addCodesJarChangeListener();
}
}
isInitializing.set(false);
addCodesJarChangeListener();
} catch (PersistenceException e) {
throw new RuntimeException("Failed to init resource cache for custom jars", e);
ExceptionHandler.process(e);
}
}
}
public static Set<CodesJarInfo> getAllCodesJars() {
waitForInit();
return new LinkedHashSet<>(CACHE);
synchronized (LOCK) {
return new LinkedHashSet<>(CACHE);
}
}
public static CodesJarInfo getCodesJarById(String id) {
waitForInit();
Optional<CodesJarInfo> optional = CACHE.stream().filter(info -> info.getId().equals(id)).findFirst();
if (optional.isPresent()) {
return optional.get();
synchronized (LOCK) {
Optional<CodesJarInfo> optional = CACHE.stream().filter(info -> info.getId().equals(id)).findFirst();
if (optional.isPresent()) {
return optional.get();
}
ExceptionHandler.process(new Exception("Codes jar id [" + id + "] is not found!")); //$NON-NLS-1$ //$NON-NLS-2$
return null;
}
ExceptionHandler.process(new Exception("Codes jar id [" + id + "] is not found!")); //$NON-NLS-1$ //$NON-NLS-2$
return null;
}
public static CodesJarInfo getCodesJarByLabel(ERepositoryObjectType type, String projectTechName, String label) {
waitForInit();
Optional<CodesJarInfo> optional = CACHE.stream().filter(info -> info.getType() == type && info.getLabel().equals(label)
&& info.getProjectTechName().equals(projectTechName)).findFirst();
if (optional.isPresent()) {
return optional.get();
synchronized (LOCK) {
Optional<CodesJarInfo> optional = CACHE.stream().filter(info -> info.getType() == type
&& info.getLabel().equals(label) && info.getProjectTechName().equals(projectTechName)).findFirst();
if (optional.isPresent()) {
return optional.get();
}
ExceptionHandler.process(new Exception("Codes jar [" + label + "] is not found!")); //$NON-NLS-1$ //$NON-NLS-2$
return null;
}
ExceptionHandler.process(new Exception("Codes jar [" + label + "] is not found!")); //$NON-NLS-1$ //$NON-NLS-2$
return null;
}
public static CodesJarInfo getCodesJarByInnerCode(RoutineItem routineItem) throws PersistenceException {
@@ -106,7 +99,6 @@ public class CodesJarResourceCache {
}
public static void addToCache(Property newProperty) {
waitForInit();
synchronized (LOCK) {
Iterator<CodesJarInfo> iterator = CACHE.iterator();
while (iterator.hasNext()) {
@@ -121,7 +113,6 @@ public class CodesJarResourceCache {
}
public static void updateCache(String oldId, String oldLabel, String oldVersion, Property newProperty) {
waitForInit();
synchronized (LOCK) {
Iterator<CodesJarInfo> iterator = CACHE.iterator();
while (iterator.hasNext()) {
@@ -136,7 +127,6 @@ public class CodesJarResourceCache {
}
public static void removeCache(Property property) {
waitForInit();
synchronized (LOCK) {
Iterator<CodesJarInfo> iterator = CACHE.iterator();
while (iterator.hasNext()) {
@@ -149,31 +139,18 @@ public class CodesJarResourceCache {
}
}
public static void reset() {
if (isInitialized.compareAndSet(true, false)) {
if (listener != null) {
IRepositoryService.get().getProxyRepositoryFactory().removePropertyChangeListener(listener);
listener = null;
}
isInitializing.set(true);
}
}
public static void waitForInit() {
initCodesJarCache();
int spent = 0;
int time = 500;
int timeout = 1000 * 60 * 10;
while (isInitializing.get()) {
try {
Thread.sleep(time);
spent += time;
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
if (spent >= timeout) {
// may be track in dead lock, throw exception to try to break dead lock
throw new RuntimeException("Waiting for custom jar cache initialization timeout!"); //$NON-NLS-1$
public static void addCodesJarChangeListener() {
if (!isListenerAdded) {
synchronized (LOCK) {
if (!isListenerAdded) {
if (listener == null) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
IRunProcessService service = GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
listener = service.addCodesJarChangeListener();
isListenerAdded = true;
}
}
}
}
}
}

View File

@@ -258,8 +258,6 @@ 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);

View File

@@ -47,9 +47,4 @@ public abstract class AbstractLoginTask implements ILoginTask {
return false;
}
@Override
public boolean isBackground() {
return false;
}
}

View File

@@ -16,9 +16,6 @@ import java.lang.reflect.InvocationTargetException;
import java.util.Date;
import org.eclipse.core.runtime.IProgressMonitor;
import org.talend.commons.CommonsPlugin;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.core.PluginChecker;
/**
* created by wchen on 2015-5-15 Detailled comment Define a login taks that will be execute when login project
@@ -31,26 +28,9 @@ public interface ILoginTask {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException;
default void execute(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
if (CommonsPlugin.isHeadless() || CommonsPlugin.isJUnitTest() || PluginChecker.isSWTBotLoaded()
|| CommonsPlugin.isTUJTest() || !isBackground()) {
run(monitor);
} else {
new Thread(() -> {
try {
run(monitor);
} catch (InvocationTargetException | InterruptedException e) {
ExceptionHandler.process(e);
}
}, getClass().getCanonicalName()).start();
}
}
/**
* Which indicates the task will be executed for each logon of a project, by default return false(execute only once
* at the time of logon studio).
*/
boolean isRequiredAlways();
boolean isBackground();
}

View File

@@ -23,6 +23,7 @@ import org.talend.commons.exception.PersistenceException;
import org.talend.commons.utils.data.container.RootContainer;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.ILibraryManagerService;
import org.talend.core.model.general.ModuleNeeded;
import org.talend.core.model.process.IProcess;
import org.talend.core.model.process.IProcess2;
import org.talend.core.model.properties.Property;
@@ -158,7 +159,7 @@ public abstract class AbsMigrationCheckHandler implements IMigrationCheckHandler
return hasCompilationError;
}
protected void checkModules(Set<String> neededLibraries, MigrateItemInfo itemInfo) {
protected void checkModules(Set<String> neededLibraries, Set<ModuleNeeded> allModulesWithStatus, MigrateItemInfo itemInfo) {
// check libraries status
if (neededLibraries == null || neededLibraries.isEmpty()) {
return;

View File

@@ -22,7 +22,6 @@ import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorPart;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.IService;
import org.talend.core.model.components.IComponentsFactory;
import org.talend.core.model.general.ModuleNeeded;
@@ -150,11 +149,4 @@ public interface IRepositoryService extends IService {
List<ModuleNeeded> getLog4j2Modules();
public static IRepositoryService get() {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRepositoryService.class)) {
return GlobalServiceRegister.getDefault().getService(IRepositoryService.class);
}
return null;
}
}

View File

@@ -103,8 +103,6 @@ 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$

View File

@@ -35,8 +35,7 @@ Require-Bundle: org.apache.commons.lang,
org.apache.httpcomponents.httpcore,
org.apache.httpcomponents.httpclient,
org.slf4j.api,
org.apache.ant,
org.eclipse.m2e.maven.runtime
org.apache.ant
Import-Package: org.eclipse.jdt.internal.ui.workingsets
Export-Package: org.talend.core.ui,
org.talend.core.ui.actions,

View File

@@ -42,10 +42,6 @@
id="org.talend.core.ui.token.AdditionalPackageTokenCollector"
name="addtional package">
</provider>
<provider
collector="org.talend.core.ui.token.AMCUsageTokenCollector"
id="AMCUsageTokenCollector">
</provider>
</extension>
<extension

View File

@@ -9,7 +9,21 @@
</parent>
<artifactId>org.talend.core.ui</artifactId>
<packaging>eclipse-plugin</packaging>
<dependencies>
<dependency>
<groupId>com.github.oshi</groupId>
<artifactId>oshi-core</artifactId>
<version>5.2.5</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
@@ -18,33 +32,17 @@
<version>3.0.2</version>
<executions>
<execution>
<id>copy</id>
<phase>generate-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${project.basedir}/lib</outputDirectory>
<stripVersion>true</stripVersion>
<artifactItems>
<artifactItem>
<groupId>com.github.oshi</groupId>
<artifactId>oshi-core</artifactId>
<version>5.2.5</version>
</artifactItem>
<artifactItem>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>5.6.0</version>
</artifactItem>
<artifactItem>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna-platform</artifactId>
<version>5.6.0</version>
</artifactItem>
</artifactItems>
</configuration>
</execution>
<id>copy-dependencies</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeScope>runtime</includeScope>
<outputDirectory>${project.basedir}/lib</outputDirectory>
<stripVersion>true</stripVersion>
</configuration>
</execution>
</executions>
</plugin>
</plugins>

View File

@@ -15,13 +15,13 @@ package org.talend.core.ui.advanced.composite;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.text.StringMatcher;
import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.ui.internal.misc.StringMatcher;
/**
* DOC ggu class global comment. Detailled comment

View File

@@ -644,6 +644,11 @@ public class ContextTreeTable {
super(treeList);
}
@Override
public String formatDataForDepth(int depth, ContextTreeNode object) {
return object.getName();
}
}
private static class ContextExpansionModel implements TreeList.ExpansionModel<ContextTreeNode> {

View File

@@ -14,10 +14,10 @@ package org.talend.core.ui.context;
import java.text.MessageFormat;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.util.Assert;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.DialogCellEditor;
import org.eclipse.swt.SWT;

View File

@@ -37,7 +37,7 @@ import org.talend.core.ui.i18n.Messages;
* created by ldong on Aug 14, 2014 Detailled comment
*
*/
public class ContextMenuItemProviders {
public class ContextMenuItemProviders extends MenuItemProviders {
// the item of change the context parameter's mode such as from repositroy to build-in
public static IMenuItemProvider changeModeMenuItemProvider(final IDataProvider dataProvider,
@@ -122,7 +122,7 @@ public class ContextMenuItemProviders {
}
private static ContextTreeNode getTreeNodeByRightClickPostion(final IDataProvider dataProvider, SelectionEvent e) {
NatEventData natEventData = MenuItemProviders.getNatEventData(e);
NatEventData natEventData = getNatEventData(e);
NatTable nt = natEventData.getNatTable();
int rowPosition = natEventData.getRowPosition();
int rowIndex = nt.getRowIndexByPosition(rowPosition);

View File

@@ -14,10 +14,10 @@ package org.talend.core.ui.context.nattableTree;
import org.eclipse.nebula.widgets.nattable.NatTable;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.edit.action.CellEditDragMode;
import org.eclipse.nebula.widgets.nattable.edit.action.MouseEditAction;
import org.eclipse.nebula.widgets.nattable.edit.config.DefaultEditBindings;
import org.eclipse.nebula.widgets.nattable.layer.LabelStack;
import org.eclipse.nebula.widgets.nattable.selection.action.CellSelectionDragMode;
import org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry;
import org.eclipse.nebula.widgets.nattable.ui.matcher.CellEditorMouseEventMatcher;
import org.eclipse.swt.events.MouseEvent;
@@ -53,6 +53,6 @@ public class ContextSelectBindings extends DefaultEditBindings {
};
pUiBindingRegistry.registerSingleClickBinding(mouseEventMatcher, new MouseEditAction());
pUiBindingRegistry.registerFirstMouseDragMode(mouseEventMatcher, new CellSelectionDragMode());
pUiBindingRegistry.registerFirstMouseDragMode(mouseEventMatcher, new CellEditDragMode());
}
}

View File

@@ -24,8 +24,6 @@ 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;
@@ -90,14 +88,6 @@ 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() {
@@ -180,14 +170,6 @@ 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) {

View File

@@ -43,7 +43,6 @@ 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;
@@ -68,7 +67,6 @@ 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;
@@ -378,19 +376,8 @@ public class MetadataDialog extends Dialog {
} else {
metadataTableEditor = new MetadataTableEditor(outputMetaTable, titleOutput);
}
//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 = new DialogMetadataTableEditorView(composite, SWT.NONE, metadataTableEditor, outputReadOnly, true,
true, false);
outputMetaView.setMetadataTalendTypeFilter(NodeUtil.createMetadataTalendTypeFilter(outputNode));
outputMetaView.setIsRepository(isRepository(outputNode, outputMetaTable));
initializeMetadataTableView(outputMetaView, outputNode, outputMetaTable);
@@ -557,21 +544,8 @@ public class MetadataDialog extends Dialog {
} else {
metadataTableEditorForOutput = new MetadataTableEditor(outputMetaTable, titleOutput + " (Output)");
}
//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 = 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);
@@ -825,22 +799,7 @@ 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;
}

View File

@@ -1,65 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.core.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);
}
};
}
}

Some files were not shown because too many files have changed in this diff Show More