Compare commits
192 Commits
release/5.
...
release/5.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
72194ae752 | ||
|
|
b4bae1d6fe | ||
|
|
cdb1987563 | ||
|
|
0cfb90e704 | ||
|
|
3a89a8f70c | ||
|
|
14d1cf918c | ||
|
|
5dbbf4355c | ||
|
|
dfdda1fa78 | ||
|
|
2068b4c92b | ||
|
|
a0f11f6306 | ||
|
|
9408850da9 | ||
|
|
12ab02c77c | ||
|
|
1290bba2bc | ||
|
|
b771d41167 | ||
|
|
073a1b6d6e | ||
|
|
de6e63ed40 | ||
|
|
cc9959aedf | ||
|
|
fc2837bb1c | ||
|
|
1e68b00375 | ||
|
|
e6f123e400 | ||
|
|
50ba17ea27 | ||
|
|
3d0883d83d | ||
|
|
a4604938ac | ||
|
|
322edb9e8b | ||
|
|
898eac2281 | ||
|
|
a93bc9b88c | ||
|
|
31c92aa35f | ||
|
|
5f711bb746 | ||
|
|
e38bc0f06b | ||
|
|
32f7bf8187 | ||
|
|
f13fd458aa | ||
|
|
1ff4b3f557 | ||
|
|
f29c206e7e | ||
|
|
b516efe1ed | ||
|
|
6b9c7c35a4 | ||
|
|
fd7be330b9 | ||
|
|
c770c57486 | ||
|
|
a9830686e0 | ||
|
|
3e66a19b49 | ||
|
|
68247df2ab | ||
|
|
8cffb66f47 | ||
|
|
16cea2beb3 | ||
|
|
61e303d05c | ||
|
|
3a9023bf9f | ||
|
|
8506faa505 | ||
|
|
b702c56e55 | ||
|
|
4b39009d67 | ||
|
|
9318abc4e9 | ||
|
|
02e77af11b | ||
|
|
de398b1bcc | ||
|
|
3086d14035 | ||
|
|
dd64c4c38c | ||
|
|
eec07d2941 | ||
|
|
9e6f270797 | ||
|
|
996b2bbaae | ||
|
|
f95e644a5e | ||
|
|
ca86b3d911 | ||
|
|
7e3a95cacc | ||
|
|
f604d95fa1 | ||
|
|
70a4cfd375 | ||
|
|
cbcbafa52f | ||
|
|
af55c03442 | ||
|
|
5972f0cec4 | ||
|
|
ae97890240 | ||
|
|
5901144528 | ||
|
|
1ee049ed17 | ||
|
|
4649721f96 | ||
|
|
951b035c16 | ||
|
|
c330f6a1cc | ||
|
|
0b1a118327 | ||
|
|
c4c328deaf | ||
|
|
43c35c79ec | ||
|
|
dd6f028573 | ||
|
|
e30f028102 | ||
|
|
8c930e257c | ||
|
|
c22ccb9d9e | ||
|
|
125f8ce5a5 | ||
|
|
835168e3d1 | ||
|
|
71a4b4026c | ||
|
|
822fc56947 | ||
|
|
0d7d2a6134 | ||
|
|
6a57518144 | ||
|
|
ec200a7ce7 | ||
|
|
acd8ce8499 | ||
|
|
b8fdde0195 | ||
|
|
1510486bd3 | ||
|
|
c521f72efa | ||
|
|
60deb083fa | ||
|
|
f1f16757bb | ||
|
|
d42e5f2b49 | ||
|
|
170dd05b71 | ||
|
|
7fd3444033 | ||
|
|
758aa56866 | ||
|
|
a567b60ed1 | ||
|
|
165d3b1776 | ||
|
|
778d569ed9 | ||
|
|
b19c5364df | ||
|
|
f869c17101 | ||
|
|
1b2960f889 | ||
|
|
c540d26be4 | ||
|
|
e3e5267080 | ||
|
|
1c7fd683c7 | ||
|
|
3cbfbaec44 | ||
|
|
d1fdb65322 | ||
|
|
bf56b190cf | ||
|
|
a548a15faa | ||
|
|
c5d25f3c7d | ||
|
|
d4842a6d35 | ||
|
|
63ae424e6c | ||
|
|
83597d7b51 | ||
|
|
4b53282447 | ||
|
|
25ed3b60a3 | ||
|
|
9378db4d61 | ||
|
|
31a951bce1 | ||
|
|
5815fedfb3 | ||
|
|
671d85f6b9 | ||
|
|
5d11b7628b | ||
|
|
6da79b1749 | ||
|
|
949c5ccd48 | ||
|
|
c882cf1b7e | ||
|
|
44bf4250ef | ||
|
|
74a9f5be23 | ||
|
|
7dd9eaf7ad | ||
|
|
eb0573cb9a | ||
|
|
0cd35912aa | ||
|
|
06ff32e8e2 | ||
|
|
2198387403 | ||
|
|
413ca62cf4 | ||
|
|
4c9ce8c140 | ||
|
|
a5059ad8b3 | ||
|
|
747c1ac4dc | ||
|
|
e2a6cd769e | ||
|
|
a30482c431 | ||
|
|
002e80155c | ||
|
|
c720071d56 | ||
|
|
cada111ad6 | ||
|
|
ed1715a077 | ||
|
|
9672d061ab | ||
|
|
680a811621 | ||
|
|
0991ea14ec | ||
|
|
6bde1d62a3 | ||
|
|
c08589d2f0 | ||
|
|
3b98a3cc10 | ||
|
|
6d6e9c178d | ||
|
|
a8f36215fe | ||
|
|
0804619f5b | ||
|
|
a356ebe5d7 | ||
|
|
bf7f18a9ed | ||
|
|
d7bdfa5dff | ||
|
|
150e1b3846 | ||
|
|
c5fa78da97 | ||
|
|
1ddc72f5ef | ||
|
|
2a104abf3b | ||
|
|
19eb1997cf | ||
|
|
74f3d2910d | ||
|
|
eb35ccccca | ||
|
|
119d11621d | ||
|
|
b80af2672a | ||
|
|
ee5770ab24 | ||
|
|
3994cbd601 | ||
|
|
c15cec0699 | ||
|
|
874a0c4235 | ||
|
|
453536e41f | ||
|
|
45bf2e9e3b | ||
|
|
c2a3c802da | ||
|
|
b1f75fce20 | ||
|
|
15831dbae7 | ||
|
|
d3b618bd43 | ||
|
|
d88f81a451 | ||
|
|
22a15e0be7 | ||
|
|
a83d1f64ea | ||
|
|
271975215a | ||
|
|
4ac002a57e | ||
|
|
da1153f73e | ||
|
|
fd5a242722 | ||
|
|
93fdeddc27 | ||
|
|
f7b30fbf38 | ||
|
|
253f25a151 | ||
|
|
fd47fb255e | ||
|
|
7a6c5167d6 | ||
|
|
acaef21130 | ||
|
|
e95e65bf25 | ||
|
|
ae4e6801b0 | ||
|
|
0fef3ab346 | ||
|
|
950071f28b | ||
|
|
5bd66a3fce | ||
|
|
0cccb6e4eb | ||
|
|
2f6704d026 | ||
|
|
42a1c62b3c | ||
|
|
b80ef626f5 | ||
|
|
f8e6a731b8 | ||
|
|
4899093457 |
@@ -104,13 +104,13 @@ TableViewerCreator.CellModifier.ExError=\u73FE\u5728\u306E CellModifier \u306F\u
|
||||
TableViewerCreator.columnNoIBeanProperty=\u30AB\u30E9\u30E0 '{0}' ('{1}') \u306F CellEditor \u30BB\u30C3\u30C8\u3092\u6301\u3061\u307E\u3059\u304C\u3001 IBeanPropertyAccessors\u3092\u6301\u3061\u307E\u305B\u3093\u3002
|
||||
TableViewerCreator.columnNullId=\u30AB\u30E9\u30E0 '{0}' \u306FNULL\u5024\u306Eid\u3092\u6301\u3063\u3066\u3044\u307E\u3059\u3002
|
||||
TableViewerCreator.IdProperty.AssertMsg=\u30AB\u30E9\u30E0\u306EidProperty\u306E\u5909\u66F4\u304C\u5FC5\u8981\u3067\u3059\u3001idProperty\u306F\uFF11\u3064\u306E\u30C6\u30FC\u30D6\u30EB\u3067\u30E6\u30CB\u30FC\u30AF\u3067\u306A\u304F\u3066\u306F\u306A\u308A\u307E\u305B\u3093\u3002
|
||||
TableViewerCreator.Table.BeNull=\u30C6\u30FC\u30D6\u30EB\u304CNULL\u5024\u3067\u3059
|
||||
TableViewerCreator.Table.BeNull=\u30C6\u30FC\u30D6\u30EB\u304Cnull\u3067\u3059
|
||||
TableViewerCreator.TableColumn.AssertMsg=idProperty'{0}'\u304C\u3042\u308BTableEditorColumn\u306ETableColumn\u306F\u3001\u6B63\u3057\u3044\u89AATable\u3092\u6301\u3063\u3066\u3044\u307E\u305B\u3093\u3002
|
||||
TreeToTablesLinker.Type.Unsupported=\u3053\u306E\u30BF\u30A4\u30D7\u306EcurrentControl\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093
|
||||
exception.errorOccured=\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F\uFF08{0}\uFF09\n\u8A73\u7D30\u306F\u30ED\u30B0\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
||||
ModelSelectionDialog.Message=\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\uFF11\u3064\u9078\u629E\u3059\u308B\u304B\u3001\u30AD\u30E3\u30F3\u30BB\u30EB\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
||||
ModelSelectionDialog.Option=\u30AA\u30D7\u30B7\u30E7\u30F3
|
||||
ModelSelectionDialog.BuiltIn=\u7D44\u307F\u8FBC\u307F\u30D7\u30ED\u30D1\u30C6\u30A3\u306B\u5909\u66F4
|
||||
ModelSelectionDialog.BuiltIn=\u7D44\u8FBC\u307F\u30D7\u30ED\u30D1\u30C6\u30A3\u306B\u5909\u66F4
|
||||
ModelSelectionDialog.ViewSchema=\u30B9\u30AD\u30FC\u30DE\u306E\u8868\u793A\uFF08\u8AAD\u307F\u53D6\u308A\u5C02\u7528\uFF09\u3002
|
||||
ModelSelectionDialog.ViewQuery=\u30AF\u30A8\u30EA\u306E\u8868\u793A\uFF08\u8AAD\u307F\u53D6\u308A\u5C02\u7528\uFF09\u3002
|
||||
ModelSelectionDialog.Update=\u30EA\u30DD\u30B8\u30C8\u30EA\u63A5\u7D9A\u306E\u66F4\u65B0\u3002
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
AddPushButton.AddButton.Tip=Toevoegen
|
||||
DateDialog.textContent=Selecteer datum & tijd
|
||||
DialogErrorForCellEditorListener.Error.MsgDialogTitle=Fout
|
||||
EventUtil.modify=Wijzigen
|
||||
EventUtil.move=Verplaatsen
|
||||
|
||||
@@ -38,3 +38,5 @@ XmlNodeRetriever.proposal2Node=proposal2Nodes :
|
||||
XmlNodeRetriever.prposal1Node=proposal1Nodes :
|
||||
XmlNodeRetriever.singleQuotes='
|
||||
VersionUtils.readPropertyFileError=Erreur de lecture de propriété dans le fichier talend.properties.
|
||||
DatabaseContentRetriever.PRODUCTNAME=Nom de produit de la base de données :
|
||||
DatabaseContentRetriever.PRODUCTVERSION=Version du produit de la base de données :
|
||||
|
||||
@@ -16,6 +16,7 @@ Export-Package: org.talend.commons,
|
||||
org.talend.commons.utils,
|
||||
org.talend.commons.utils.data.bean,
|
||||
org.talend.commons.utils.data.container,
|
||||
org.talend.commons.utils.data.extractor,
|
||||
org.talend.commons.utils.data.list,
|
||||
org.talend.commons.utils.data.map,
|
||||
org.talend.commons.utils.data.reflection,
|
||||
@@ -33,7 +34,7 @@ Export-Package: org.talend.commons,
|
||||
org.talend.commons.utils.scalability,
|
||||
org.talend.commons.utils.system,
|
||||
org.talend.commons.utils.threading,
|
||||
org.talend.commons.utils.threading.lockerbykey,
|
||||
org.talend.commons.utils.threading.lockerbykey,
|
||||
org.talend.commons.utils.time,
|
||||
org.talend.commons.utils.tracer,
|
||||
org.talend.commons.utils.workbench.extensions,
|
||||
|
||||
@@ -5,6 +5,11 @@ DatabaseContentRetriever.PRODUCTVERSION=Database Product Version:
|
||||
DB2ForZosResultSet.outofRange=\ is out of range.
|
||||
DB2ForZosResultSet.parameterIndex=Invalid argument\: parameter index
|
||||
DB2ForZosResultSet.unknowCloumn=Invalid argument\: unknown column name
|
||||
SybaseResultSet.outofRange=\ is out of range.
|
||||
SybaseResultSet.parameterIndex=Invalid argument\: parameter index
|
||||
SybaseResultSet.unknowCloumn=Invalid argument\: unknown column name
|
||||
AbstractFakeResultSet.unknowCloumn=Invalid argument\: {0} is unknown column name
|
||||
AbstractFakeResultSet.parameterIndexOutOfRange=Invalid argument\: parameter index {0} is out of range
|
||||
EntryLocation.returnTableName={tableName={0}, columnName={1}}
|
||||
ExceptionHandler.Parameter.BeNull=ex param cannot be null
|
||||
ExtensionImplementationProviders.ExtensionPointError=Extension point must authoriez a single instance
|
||||
|
||||
@@ -54,6 +54,10 @@ public final class CommonExceptionHandler {
|
||||
log.log(Level.INFO, message);
|
||||
}
|
||||
|
||||
public static void warn(String message) {
|
||||
log.log(Level.WARN, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return priority corresponding to the exception implementation.
|
||||
*
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 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.utils.data.extractor;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Created by Marvin Wang on Nov 8, 2012.
|
||||
*/
|
||||
public class ModuleNameExtractor {
|
||||
|
||||
/**
|
||||
* Extracts all file names from the given collection. This method is suitable the case that collection includes not
|
||||
* only file names but also paths. And you just need a set only including file names. So this method cuts the
|
||||
* directory of a file only the file name remaining. Added by Marvin Wang on Nov 8, 2012.
|
||||
*
|
||||
* @param collection must not be <code>null<code>, otherwise, it will throw NPE.
|
||||
* @return a set that only includes file name.
|
||||
*/
|
||||
public static Set<String> extractFileName(Collection<String> collection) {
|
||||
Set<String> moduleNameSet = new HashSet<String>();
|
||||
if (!collection.isEmpty()) {
|
||||
for (String module : collection) {
|
||||
if (module != null) {
|
||||
File moduleFile = new File(module);
|
||||
moduleNameSet.add(moduleFile.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
return moduleNameSet;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 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.utils.database;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.talend.fakejdbc.FakeDatabaseMetaData;
|
||||
|
||||
/**
|
||||
* DOC ggu class global comment. Detailled comment <br/>
|
||||
*
|
||||
* $Id: talend.epf 55206 2011-02-15 17:32:14Z mhirt $
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractFakeDatabaseMetaData extends FakeDatabaseMetaData {
|
||||
|
||||
protected static final String[] TABLE_META = { "ID", "TABLE_SCHEM", "TABLE_NAME", "TABLE_TYPE", "REMARKS" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
|
||||
|
||||
protected static final String[] COLUMN_META = { "TABLE_NAME", "COLUMN_NAME", "TYPE_NAME", "COLUMN_SIZE", "DECIMAL_DIGITS", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
|
||||
"NUM_PREC_RADIX", "IS_NULLABLE", "REMARKS", "COLUMN_DEF" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
|
||||
private Connection connection;
|
||||
|
||||
/**
|
||||
*
|
||||
* DOC ggu AbstractFakeDatabaseMetaData constructor comment.
|
||||
*
|
||||
* @param connection
|
||||
*/
|
||||
public AbstractFakeDatabaseMetaData(Connection connection) {
|
||||
this.connection = connection;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.commons.utils.database.FakeDatabaseMetaData#getConnection()
|
||||
*/
|
||||
@Override
|
||||
public Connection getConnection() throws SQLException {
|
||||
return connection;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 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.utils.database;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.talend.commons.i18n.internal.Messages;
|
||||
import org.talend.commons.utils.TalendDBUtils;
|
||||
import org.talend.fakejdbc.FakeResultSet;
|
||||
|
||||
/**
|
||||
* DOC ggu class global comment. Detailled comment <br/>
|
||||
*
|
||||
* $Id: talend.epf 55206 2011-02-15 17:32:14Z mhirt $
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractFakeResultSet extends FakeResultSet {
|
||||
|
||||
private String[] tableMeta = new String[0];
|
||||
|
||||
private List<String[]> data = new ArrayList<String[]>();;
|
||||
|
||||
int index = -1;
|
||||
|
||||
public AbstractFakeResultSet() {
|
||||
super();
|
||||
}
|
||||
|
||||
public void setMetadata(String[] tableMeta) {
|
||||
this.tableMeta = tableMeta;
|
||||
|
||||
}
|
||||
|
||||
public void setData(List<String[]> data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.commons.utils.database.FakeResultSet#next()
|
||||
*/
|
||||
@Override
|
||||
public boolean next() throws SQLException {
|
||||
if (data == null || data.size() == 0 || index >= data.size() - 1) {
|
||||
return false;
|
||||
}
|
||||
index++;
|
||||
return true;
|
||||
}
|
||||
|
||||
protected int indexOf(String string, String[] search) {
|
||||
for (int i = 0; i < search.length; i++) {
|
||||
if (search[i].equals(string)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.commons.utils.database.FakeResultSet#getString(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public String getString(String columnLabel) throws SQLException {
|
||||
int columnIndex = indexOf(columnLabel, tableMeta);
|
||||
|
||||
if (columnIndex == -1) {
|
||||
throw new SQLException(Messages.getString("AbstractFakeResultSet.unknowCloumn", columnLabel)); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
return getString(columnIndex + 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.commons.utils.database.FakeResultSet#getInt(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public int getInt(String columnLabel) throws SQLException {
|
||||
String str = getString(columnLabel);
|
||||
if (columnLabel.equals("TYPE_NAME")) {
|
||||
int index = TalendDBUtils.convertToJDBCType(str);
|
||||
return index;
|
||||
} else if (columnLabel.equals("IS_NULLABLE")) {
|
||||
if (str.equals("N")) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
return Integer.parseInt(str);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.commons.utils.database.FakeResultSet#getBoolean(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public boolean getBoolean(String columnLabel) throws SQLException {
|
||||
String str = getString(columnLabel);
|
||||
return Boolean.parseBoolean(str);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.commons.utils.database.FakeResultSet#getString(int)
|
||||
*/
|
||||
@Override
|
||||
public String getString(int columnIndex) throws SQLException {
|
||||
String[] row = data.get(index);
|
||||
columnIndex--;
|
||||
|
||||
if (columnIndex < 0 || columnIndex > row.length) {
|
||||
throw new SQLException(Messages.getString("AbstractFakeResultSet.parameterIndexOutOfRange", columnIndex)); //$NON-NLS-1$
|
||||
}
|
||||
return row[columnIndex];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 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.utils.database;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
|
||||
/**
|
||||
* DOC ggu class global comment. Detailled comment <br/>
|
||||
*
|
||||
* $Id: talend.epf 55206 2011-02-15 17:32:14Z mhirt $
|
||||
*
|
||||
*/
|
||||
public class EmbeddedHiveResultSet extends AbstractFakeResultSet {
|
||||
|
||||
/**
|
||||
* DOC ggu EmbeddedHiveResultSet constructor comment.
|
||||
*/
|
||||
public EmbeddedHiveResultSet() {
|
||||
super();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.commons.utils.database.AbstractFakeResultSet#getInt(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public int getInt(String columnLabel) throws SQLException {
|
||||
if ("DATA_TYPE".equals(columnLabel)) {
|
||||
String sqlType = getString("TYPE_NAME");
|
||||
if (sqlType.trim().equalsIgnoreCase("TINYINT") || sqlType.trim().equalsIgnoreCase("SMALLINT")) { //$NON-NLS-1$
|
||||
return Types.SMALLINT;
|
||||
} else if (sqlType.trim().equalsIgnoreCase("INT")) { //$NON-NLS-1$
|
||||
return Types.INTEGER;
|
||||
} else if (sqlType.trim().equalsIgnoreCase("BIGINT")) { //$NON-NLS-1$
|
||||
return Types.BIGINT;
|
||||
} else if (sqlType.trim().equalsIgnoreCase("BOOLEAN")) { //$NON-NLS-1$
|
||||
return Types.BOOLEAN;
|
||||
} else if (sqlType.trim().equalsIgnoreCase("FLOAT")) { //$NON-NLS-1$
|
||||
return Types.FLOAT;
|
||||
} else if (sqlType.trim().equalsIgnoreCase("DOUBLE")) { //$NON-NLS-1$
|
||||
return Types.DOUBLE;
|
||||
} else if (sqlType.trim().equalsIgnoreCase("STRING")) { //$NON-NLS-1$
|
||||
return Types.VARCHAR;
|
||||
} else if (sqlType.trim().equalsIgnoreCase("BINARY")) { //$NON-NLS-1$
|
||||
return Types.BINARY;
|
||||
} else if (sqlType.trim().equalsIgnoreCase("TIMESTAMP")) { //$NON-NLS-1$
|
||||
return Types.TIMESTAMP;
|
||||
}
|
||||
}
|
||||
// TODO Auto-generated method stub
|
||||
return super.getInt(columnLabel);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 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.utils.database;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.talend.fakejdbc.FakeDatabaseMetaData;
|
||||
|
||||
/**
|
||||
*
|
||||
* Created by Marvin Wang on Nov 29, 2012.
|
||||
*/
|
||||
public class HiveDatabaseMetaData extends FakeDatabaseMetaData {
|
||||
|
||||
private Connection connection;
|
||||
|
||||
private DatabaseMetaData metaData;
|
||||
|
||||
public HiveDatabaseMetaData(Connection connection) throws SQLException {
|
||||
this.connection = connection;
|
||||
metaData = connection.getMetaData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) throws SQLException {
|
||||
return this.metaData.getTables(catalog, schemaPattern, tableNamePattern, types);
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,141 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 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.utils.database;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import org.talend.commons.i18n.internal.Messages;
|
||||
import org.talend.commons.utils.TalendDBUtils;
|
||||
import org.talend.fakejdbc.FakeResultSet;
|
||||
|
||||
/**
|
||||
* created by xqliu on Oct 26, 2012 Detailled comment
|
||||
*
|
||||
*/
|
||||
public class SybaseResultSet extends FakeResultSet {
|
||||
|
||||
private String[] tableMeta = null;
|
||||
|
||||
private List<String[]> data;
|
||||
|
||||
int index = -1;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.commons.utils.database.FakeResultSet#next()
|
||||
*/
|
||||
@Override
|
||||
public boolean next() throws SQLException {
|
||||
if (data == null || data.size() == 0 || index >= data.size() - 1) {
|
||||
return false;
|
||||
}
|
||||
index++;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static int indexOf(String string, String[] search) {
|
||||
for (int i = 0; i < search.length; i++) {
|
||||
if (search[i].equals(string)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.commons.utils.database.FakeResultSet#getString(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public String getString(String columnLabel) throws SQLException {
|
||||
int columnIndex = indexOf(columnLabel, tableMeta);
|
||||
|
||||
if (columnIndex == -1) {
|
||||
throw new SQLException(Messages.getString("SybaseResultSet.unknowCloumn") + columnLabel); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
return getString(columnIndex + 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.commons.utils.database.FakeResultSet#getInt(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public int getInt(String columnLabel) throws SQLException {
|
||||
int value = 0;
|
||||
String str = getString(columnLabel);
|
||||
if (columnLabel.equals("TYPE_NAME")) { //$NON-NLS-1$
|
||||
value = TalendDBUtils.convertToJDBCType(str);
|
||||
} else if (columnLabel.equals("IS_NULLABLE")) { //$NON-NLS-1$
|
||||
if (str.equals("N")) { //$NON-NLS-1$
|
||||
value = 1;
|
||||
} else {
|
||||
value = 0;
|
||||
}
|
||||
} else {
|
||||
value = Integer.parseInt(str);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.commons.utils.database.FakeResultSet#getBoolean(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public boolean getBoolean(String columnLabel) throws SQLException {
|
||||
String str = getString(columnLabel);
|
||||
return Boolean.parseBoolean(str);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.commons.utils.database.FakeResultSet#getString(int)
|
||||
*/
|
||||
@Override
|
||||
public String getString(int columnIndex) throws SQLException {
|
||||
String[] row = data.get(index);
|
||||
columnIndex--;
|
||||
|
||||
if (columnIndex < 0 || columnIndex > row.length) {
|
||||
throw new SQLException(
|
||||
Messages.getString("SybaseResultSet.parameterIndex") + columnIndex + Messages.getString("SybaseResultSet.outofRange")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
return row[columnIndex];
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC bqian Comment method "setMetadata".
|
||||
*
|
||||
* @param table_meta
|
||||
*/
|
||||
public void setMetadata(String[] tableMeta) {
|
||||
this.tableMeta = tableMeta;
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC bqian Comment method "setData".
|
||||
*
|
||||
* @param tables
|
||||
*/
|
||||
public void setData(List<String[]> data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,8 @@ public final class PluginChecker {
|
||||
|
||||
private static final String TOP_BRANDING = "org.talend.rcp.branding.top"; //$NON-NLS-1$
|
||||
|
||||
private static final String AMCRAP_PLUGIN_ID = "org.talend.amc.rap"; //$NON-NLS-1$
|
||||
|
||||
private PluginChecker() {
|
||||
}
|
||||
|
||||
@@ -74,4 +76,12 @@ public final class PluginChecker {
|
||||
return isPluginLoaded(TOP_BRANDING) && !isTDCPLoaded() && !isTDQLoaded();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method "isAMCRAPLoaded"
|
||||
*
|
||||
*/
|
||||
public static boolean isAMCRAPLoaded() {
|
||||
return isPluginLoaded(AMCRAP_PLUGIN_ID);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
talend.version=5.2.0
|
||||
talend.version=5.2.1
|
||||
@@ -15,7 +15,7 @@ ImportPushButton.ImportButton.Tip=\u3059\u3079\u3066\u306e\u884c\u3092xml\u30d5\
|
||||
LabelledFileField.FileDialog.Text=\u9078\u629E
|
||||
ModelSelectionDialog.Option=\u30AA\u30D7\u30B7\u30E7\u30F3
|
||||
ModelSelectionDialog.Update=\u30EA\u30DD\u30B8\u30C8\u30EA\u63A5\u7D9A\u306E\u66F4\u65B0\u3002
|
||||
TableViewerCreator.Table.BeNull=\u30C6\u30FC\u30D6\u30EB\u304CNULL\u5024\u3067\u3059
|
||||
TableViewerCreator.Table.BeNull=\u30C6\u30FC\u30D6\u30EB\u304Cnull\u3067\u3059
|
||||
ModelSelectionDialog.Title=\u30EA\u30DD\u30B8\u30C8\u30EA\u3092\u4F7F\u7528\u3057\u3066\u30D1\u30E9\u30E1\u30FC\u30BF\u306E\u7DE8\u96C6
|
||||
AddAllPushButton.AddAllButton.Tip=\u3059\u3079\u3066\u8ffd\u52a0
|
||||
ExtendedTableRemoveCommand.Romve.Label=\u30C6\u30FC\u30D6\u30EB\u30A8\u30F3\u30C8\u30EA\u306E\u524A\u9664
|
||||
|
||||
@@ -2,6 +2,7 @@ commons.error=Fout
|
||||
AddPushButton.AddButton.Tip=Toevoegen
|
||||
LabelledFileField.BrowseButton.Text=Blader...
|
||||
DialogErrorForCellEditorListener.Error.MsgDialogTitle=Fout
|
||||
DateDialog.textContent=Selecteer datum & tijd
|
||||
EventUtil.modify=Wijzigen
|
||||
EventUtil.move=Verplaatsen
|
||||
EventUtil.show=Toon
|
||||
|
||||
@@ -167,7 +167,7 @@ public class LabelledDirectoryField {
|
||||
gridLayout.marginWidth = 0;
|
||||
|
||||
compositeButton.setLayout(gridLayout);
|
||||
compositeButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, true));
|
||||
compositeButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
|
||||
button = new Button(compositeButton, SWT.PUSH);
|
||||
GridDataFactory.swtDefaults().applyTo(button);
|
||||
button.setText(Messages.getString("LabelledFileField.BrowseButton.Text")); //$NON-NLS-1$
|
||||
|
||||
@@ -171,7 +171,7 @@ public class LabelledFileField {
|
||||
gridLayout.marginWidth = 0;
|
||||
|
||||
compositeButton.setLayout(gridLayout);
|
||||
compositeButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, true));
|
||||
compositeButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
|
||||
button = new Button(compositeButton, SWT.PUSH);
|
||||
GridDataFactory.swtDefaults().applyTo(button);
|
||||
button.setText(Messages.getString("LabelledFileField.BrowseButton.Text")); //$NON-NLS-1$
|
||||
|
||||
@@ -106,7 +106,9 @@ public abstract class DialogErrorForCellEditorListener implements ICellEditorLis
|
||||
Messages.getString("DialogErrorForCellEditorListener.Error.MsgDialogTitle"), Messages.getString("ErrorDialogWidthDetailArea.ErrorMessage.ColumnText")); //$NON-NLS-1$
|
||||
final int columnPosition = tableViewerCreator.getColumns().indexOf(column);
|
||||
tableViewerCreator.getTableViewer().editElement(currentModifiedBean, columnPosition);
|
||||
text.setText(newValue);
|
||||
if (!("").equals(newValue)) {
|
||||
text.setText(newValue);
|
||||
}
|
||||
text.setSelection(selection.x, selection.y);
|
||||
} else {
|
||||
MessageDialog.openError(text.getShell(),
|
||||
|
||||
@@ -409,7 +409,7 @@ public class FilesUtils {
|
||||
List<URL> urls = new ArrayList<URL>();
|
||||
List<File> files = getFiles(file, extension, excludedFile, excludedFolder, nested);
|
||||
for (File file2 : files) {
|
||||
urls.add(file2.toURL());
|
||||
urls.add(file2.toURI().toURL());
|
||||
}
|
||||
return urls;
|
||||
}
|
||||
@@ -468,6 +468,10 @@ public class FilesUtils {
|
||||
return getFilesFromFolderByName(file, fileName, new String[] { ".jar", ".zip", ".bar" }, null, true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
}
|
||||
|
||||
public static List<File> getDllFilesFromFolder(File file, String fileName) throws MalformedURLException {
|
||||
return getFilesFromFolderByName(file, fileName, new String[] { ".dll" }, null, true); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public static FileFilter getExcludeSystemFilesFilter() {
|
||||
FileFilter filter = new FileFilter() {
|
||||
|
||||
@@ -913,6 +917,36 @@ public class FilesUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static void copyDirectoryWithoutSvnFolder(File source, File target) {
|
||||
File tarpath = new File(target, source.getName());
|
||||
if (source.isDirectory()) {
|
||||
tarpath.mkdir();
|
||||
File[] dir = source.listFiles();
|
||||
for (File element : dir) {
|
||||
if (element.getName().equals(".svn")) { //$NON-NLS-1$
|
||||
continue;
|
||||
}
|
||||
copyDirectoryWithoutSvnFolder(element, tarpath);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
InputStream is = new FileInputStream(source);
|
||||
OutputStream os = new FileOutputStream(tarpath);
|
||||
byte[] buf = new byte[1024];
|
||||
int len = 0;
|
||||
while ((len = is.read(buf)) != -1) {
|
||||
os.write(buf, 0, len);
|
||||
}
|
||||
is.close();
|
||||
os.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void deleteFile(File file, boolean delete) {
|
||||
if (file.exists()) {
|
||||
if (file.isFile() && delete) {
|
||||
@@ -1057,4 +1091,17 @@ public class FilesUtils {
|
||||
getAllFilesFromFolder(aFolder, files, filenameFilter);
|
||||
return files;
|
||||
}
|
||||
|
||||
public static String getFileRealPath(String filePath) {
|
||||
File file = new File(filePath);
|
||||
if (!file.exists()) {
|
||||
filePath = filePath.replace("%20", " "); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
file = new File(filePath);
|
||||
if (file.exists()) {
|
||||
return filePath;
|
||||
}
|
||||
}
|
||||
|
||||
return filePath;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ ColorsCodeViewerPreferencePage.keyword2Color=\u30AD\u30FC\u30EF\u30FC\u30C92\u82
|
||||
MetadataDialog.Message=\u5165\u529B\u30B9\u30AD\u30FC\u30DE\u306E\u3059\u3079\u3066\u306E\u30AB\u30E9\u30E0\u304C\u51FA\u529B\u30B9\u30AD\u30FC\u30DE\u3078\u79FB\u884C\u3055\u308C\u307E\u3059
|
||||
MetadataDialog.TransferMessage=\u51FA\u30B9\u30AD\u30FC\u30DE\u306E\u3059\u3079\u3066\u306E\u30AB\u30E9\u30E0\u304C\u5165\u529B\u30B9\u30AD\u30FC\u30DE\u3078\u79FB\u884C\u3055\u308C\u307E\u3059
|
||||
EMetadataEncoding.Cyrillic=\u30AD\u30EA\u30EB\u8A9E
|
||||
EUpdateResult.BuiltIn=\u30D3\u30EB\u30C9\u30A4\u30F3\u30E2\u30FC\u30C9\u3078\u5909\u66F4
|
||||
EUpdateResult.BuiltIn=\u7D44\u8FBC\u307F\u30E2\u30FC\u30C9\u3078\u5909\u66F4
|
||||
EUpdateResult.Rename=\u540D\u524D\u3092\u5909\u66F4
|
||||
MetadataTypeLengthConstants.DOUBLE_LENGTH=Double
|
||||
ContextProcessSection.ParameterNameIsNotValid=\u5F15\u6570\u540D\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093\u3002
|
||||
@@ -185,7 +185,9 @@ PaletteContentDialog.lable=\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8\u30E9\u30D9\u30E
|
||||
MetadataDialog.CopySelectionToInput.toolTipText=\u9078\u629E\u3055\u308C\u305F\u30AB\u30E9\u30E0\u3092\u51FA\u529B\u30B9\u30AD\u30FC\u30DE\u304B\u3089\u5165\u529B\u30B9\u30AD\u30FC\u30DE\u3078\u30B3\u30D4\u30FC
|
||||
MetadataDialog.CopyToOutput=\u3059\u3079\u3066\u306E\u30AB\u30E9\u30E0\u3092\u5165\u529B\u30B9\u30AD\u30FC\u30DE\u304B\u3089\u51FA\u529B\u30B9\u30AD\u30FC\u30DE\u3078\u30B3\u30D4\u30FC
|
||||
MetadataDialog.CopySelectionToOutput=\u9078\u629E\u3055\u308C\u305F\u30AB\u30E9\u30E0\u3092\u5165\u529B\u30B9\u30AD\u30FC\u30DE\u304B\u3089\u51FA\u529B\u30B9\u30AD\u30FC\u30DE\u3078\u30B3\u30D4\u30FC
|
||||
MetadataTalendType.dbIdNotFound=DBMS Id : {0} \u306F\u898B\u3064\u304B\u308A\u307E\u305B\u3093!
|
||||
PaletteContentDialog.connection=\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8\u63A5\u7D9A\u30C7\u30D5\u30A9\u30EB\u30C8\uFF1A
|
||||
PaletteContentDialog.hint=\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8\u30D2\u30F3\u30C8\u30C7\u30D5\u30A9\u30EB\u30C8\uFF1A
|
||||
PaletteContentDialog.lable=\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8\u30E9\u30D9\u30EB\u30C7\u30D5\u30A9\u30EB\u30C8:
|
||||
ProcessorUtilities.finalizeBuild=\u30D3\u30EB\u30C9\u3092\u7D42\u4E86\u4E2D...
|
||||
ProcessorUtilities.generatingJob=\u30B8\u30E7\u30D6\u751F\u6210\u4E2D...
|
||||
@@ -241,6 +243,8 @@ MetadataTool.schemaNull=\u30B9\u30AD\u30FC\u30DE\u540D\u304CNULL\u3067\u3059\u30
|
||||
MetadataTool.invalidChar=\u7121\u52B9\u306A\u6587\u5B57
|
||||
MetadataTool.nameNull=\u30B9\u30AD\u30FC\u30DE\u540D\u3092\u6307\u5B9A\u3057\u3066\u4E0B\u3055\u3044\u3002
|
||||
MetadataTool.nullValue=Null\u5024
|
||||
MetadataTool.schemaExist=\u30B9\u30AD\u30FC\u30DE\u540D\u306F\u5B58\u5728\u3057\u307E\u3059\u3002
|
||||
MetadataTool.schemaIn=\u30B9\u30AD\u30FC\u30DE\u540D\u304C\u4E0D\u6B63\u3067\u3059\u3002
|
||||
MetadataTool.schemaInvalid=\u30B9\u30AD\u30FC\u30DE\u540D\u304C\u4E0D\u6B63\u3067\u3059\u3002
|
||||
MetadataTool.schemaNull=\u30B9\u30AD\u30FC\u30DE\u540D\u304CNULL\u3067\u3059\u3002
|
||||
RepositoryUpdateManager.NotFoundTitle=\u898B\u3064\u304B\u308A\u307E\u305B\u3093
|
||||
|
||||
@@ -119,3 +119,12 @@ ItemReferenceDialog.project=Projet
|
||||
ItemReferenceDialog.deletedInfor=Dans la Corbeille
|
||||
ItemReferenceDialog.messages=Des éléments ne peuvent être supprimés car ils sont référencés par d'autres.
|
||||
ProxyRepositoryFactory.projectIsNotCompatible=Le projet {0} a été ouvert par un studio plus récent. Impossible de l'ouvrir.
|
||||
NewFolderWizard.label=Libellé
|
||||
NewFolderWizard.nameEmpty=Libellé requis
|
||||
NewFolderWizard.nameIncorrect=Le libellé contient des caractères incorrects.
|
||||
NewFolderWizard.nameInvalid=Libellé {0} interdit.
|
||||
NewFolderWizard.title=Dossier
|
||||
NewFolderWizard.windowTitle=Nouveau dossier
|
||||
CreateFolderAction.action.title=Créer le dossier
|
||||
RenameFolderAction.action.title=Renommer le dossier
|
||||
RenameFolderAction.warning.editorOpen.title=Action indisponible
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
ProxyRepositoryFactory.Label=Labela
|
||||
CreateSandboxProjectDialog.ProjectLabel=Labela
|
||||
PropertiesWizardPage.Select=SELECT
|
||||
DeleteAction.action.logicalTitle=DELETE
|
||||
|
||||
@@ -93,6 +93,8 @@ DeleteAction.dialog.messageAllElements=All the elements will be deleted forever
|
||||
DeleteAction.dialog.title=Delete forever
|
||||
DeleteAction.error.lockedOrOpenedObject.newMessage=The {0} is locked, so you can't delete it.\n If this object is opened ,you must close it before deletion.
|
||||
DeleteAction.error.title=Deletion forbidden
|
||||
DeleteAction.warning.message1=can not delete the folder because at least one item contained in this folder is currently open. Close any open item and try again.
|
||||
DeleteAction.warning.title=Warning
|
||||
DuplicateAction.cannotGenerateItem=Cannot generate pasted item label.
|
||||
DuplicateAction.dialog.message=Give name to new job
|
||||
DuplicateAction.dialog.title=Please input job name
|
||||
|
||||
@@ -28,9 +28,9 @@ public interface IDBMetadataProvider {
|
||||
public Map getConnectionMap();
|
||||
|
||||
/** test connection used for test a connection,for example ,click "check" button on database wizard **/
|
||||
|
||||
public ConnectionStatus testConnection(String dbType, String url, String username, String pwd, String schema, String server,
|
||||
String port, final String driverClassName, final String driverJarPath, String dbVersionString, String additionalParam);
|
||||
String port, final String driverClassName, final String driverJarPath, String dbVersionString,
|
||||
String additionalParam, Map<String, Object> otherParameters);
|
||||
|
||||
/** when check connection ,will update the package,this one no use for HBASE **/
|
||||
public void updatePackage(IMetadataConnection metadataConnection);
|
||||
|
||||
@@ -46,6 +46,9 @@ public class FileConstants {
|
||||
// MOD klliu 2010-11-26
|
||||
public static final String JRXML_EXTENSION = "jrxml"; //$NON-NLS-1$
|
||||
|
||||
/*
|
||||
* file suffix
|
||||
*/
|
||||
public static final String PROPERTIES_FILE_SUFFIX = '.' + PROPERTIES_EXTENSION;
|
||||
|
||||
public static final String ITEM_FILE_SUFFIX = '.' + ITEM_EXTENSION;
|
||||
@@ -67,4 +70,15 @@ public class FileConstants {
|
||||
public static final String SH_FILE_SUFFIX = ".sh"; //$NON-NLS-1$
|
||||
|
||||
public static final String BAT_FILE_SUFFIX = ".bat"; //$NON-NLS-1$
|
||||
|
||||
public static final String KAR_FILE_SUFFIX = ".kar"; //$NON-NLS-1$
|
||||
|
||||
public static final String XLS_FILE_SUFFIX = ".xls"; //$NON-NLS-1$
|
||||
|
||||
/*
|
||||
* file names
|
||||
*/
|
||||
public static final String MANIFEST_MF_FILE_NAME = "MANIFEST.MF"; //$NON-NLS-1$
|
||||
|
||||
public static final String META_INF_FOLDER_NAME = "META-INF"; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.ICoreService;
|
||||
import org.talend.core.IStatusPreferenceInitService;
|
||||
import org.talend.core.model.general.ILibrariesService;
|
||||
import org.talend.core.model.general.LibraryInfo;
|
||||
import org.talend.core.model.general.ModuleNeeded;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.process.EParameterFieldType;
|
||||
@@ -400,7 +401,7 @@ public abstract class AbstractEMFRepositoryFactory extends AbstractRepositoryFac
|
||||
}
|
||||
|
||||
List<IRepositoryViewObject> repositoryObjects = getAll(project, ERepositoryObjectType.ROUTINES, false, false);
|
||||
Map<String, List<String>> routineAndJars = coreSerivce.getRoutineAndJars();
|
||||
Map<String, List<LibraryInfo>> routineAndJars = coreSerivce.getRoutineAndJars();
|
||||
for (URL url : routines) {
|
||||
String[] fragments = url.toString().split("/"); //$NON-NLS-1$
|
||||
String label = fragments[fragments.length - 1];
|
||||
@@ -508,7 +509,7 @@ public abstract class AbstractEMFRepositoryFactory extends AbstractRepositoryFac
|
||||
* @param url
|
||||
* @throws PersistenceException
|
||||
*/
|
||||
private void createRoutine(URL url, IPath path, String label, List<String> neededJars) throws PersistenceException {
|
||||
private void createRoutine(URL url, IPath path, String label, List<LibraryInfo> neededJars) throws PersistenceException {
|
||||
if (url == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
@@ -532,12 +533,13 @@ public abstract class AbstractEMFRepositoryFactory extends AbstractRepositoryFac
|
||||
routineItem.setContent(byteArray);
|
||||
routineItem.setBuiltIn(true);
|
||||
if (neededJars != null) {
|
||||
for (String jar : neededJars) {
|
||||
for (LibraryInfo jar : neededJars) {
|
||||
IMPORTType type = ComponentFactory.eINSTANCE.createIMPORTType();
|
||||
type.setMESSAGE("");
|
||||
type.setNAME(label);
|
||||
type.setREQUIRED(true);
|
||||
type.setMODULE(jar);
|
||||
type.setMODULE(jar.getLibName());
|
||||
type.setBundleID(jar.getBundleId());
|
||||
routineItem.getImports().add(type);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
// ============================================================================
|
||||
package org.talend.core.repository.utils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.emf.ecore.resource.Resource;
|
||||
@@ -20,8 +23,8 @@ import org.talend.core.IService;
|
||||
import org.talend.core.model.properties.ConnectionItem;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.Property;
|
||||
|
||||
import orgomg.cwm.objectmodel.core.ModelElement;
|
||||
import org.talend.core.model.properties.TDQItem;
|
||||
import org.talend.repository.model.IRepositoryNode;
|
||||
|
||||
/**
|
||||
* DOC mzhao Abstract unload resource service which can be extended by client.
|
||||
@@ -32,10 +35,6 @@ public class AbstractResourceChangesService implements IService {
|
||||
}
|
||||
|
||||
// Add new elements to resource, remove elements from resource, delete resource
|
||||
public boolean handleResourceChange(ModelElement modelElement) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void handleLogicalDelete(Property prop) {
|
||||
}
|
||||
|
||||
@@ -76,8 +75,27 @@ public class AbstractResourceChangesService implements IService {
|
||||
* @throws PersistenceException
|
||||
*/
|
||||
public void saveResourceByEMFShared(Resource toSave) {
|
||||
}
|
||||
|
||||
/**
|
||||
* if move TDQReportItem, need to move the generated doc of it also.
|
||||
*
|
||||
* @param tdqItem
|
||||
* @param tarFolder
|
||||
*/
|
||||
public void moveReportGeneratedDocFolder(TDQItem tdqItem, File tarFolder) {
|
||||
}
|
||||
|
||||
public List<IRepositoryNode> getDependentNodes(IRepositoryNode currentNode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<IRepositoryNode> getDependentConnNodesInRecycleBin(List<IRepositoryNode> children) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void openDependcesDialog(List<IRepositoryNode> nodes) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
// ============================================================================
|
||||
package org.talend.core.repository.utils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
@@ -129,8 +129,9 @@ public class XmiResourceManager {
|
||||
|
||||
public void loadScreenshots(Property property, ProcessType processType) {
|
||||
Resource screenshotResource = getScreenshotResource(property.getItem());
|
||||
processType.getScreenshots().addAll(screenshotResource.getContents());
|
||||
|
||||
if (screenshotResource != null) { // if no screenshot, we will try to add later when save
|
||||
processType.getScreenshots().addAll(screenshotResource.getContents());
|
||||
}
|
||||
}
|
||||
|
||||
public Property loadProperty(IResource iResource) {
|
||||
@@ -199,8 +200,8 @@ public class XmiResourceManager {
|
||||
public Resource createTempProjectResource() {
|
||||
URI uri = null;
|
||||
try {
|
||||
uri = URI.createPlatformResourceURI(Platform.getInstallLocation().getURL().toURI().toString());
|
||||
} catch (URISyntaxException e) {
|
||||
uri = URI.createPlatformResourceURI(Platform.getInstallLocation().getURL().getFile(), true);
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return resourceSet.createResource(uri);
|
||||
@@ -342,17 +343,41 @@ public class XmiResourceManager {
|
||||
return itemResource;
|
||||
}
|
||||
|
||||
public Resource getScreenshotResource(Item item) {
|
||||
return getScreenshotResource(item, false);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get a resource obj from Item resource file. if the resouce file does not exist ,will create it first.
|
||||
*/
|
||||
public Resource getScreenshotResource(Item item) {
|
||||
public Resource getScreenshotResource(Item item, boolean createIfNotExist) {
|
||||
URI itemResourceURI = null;
|
||||
itemResourceURI = getScreenshotResourceURI(getItemURI(item));
|
||||
Resource itemResource;
|
||||
try {
|
||||
// judge whether the physical file exists or not
|
||||
itemResource = resourceSet.getResource(itemResourceURI, true);
|
||||
} catch (Exception e) {
|
||||
boolean fileExist = false;
|
||||
if (itemResourceURI.isFile()) {
|
||||
fileExist = new File(itemResourceURI.toFileString()).exists();
|
||||
} else {
|
||||
IPath path = URIHelper.convert(itemResourceURI);
|
||||
if (path != null) {
|
||||
IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
|
||||
if (file.exists()) {
|
||||
fileExist = true;
|
||||
}
|
||||
} else {
|
||||
fileExist = false;
|
||||
}
|
||||
}
|
||||
Resource itemResource = null;
|
||||
if (fileExist) {
|
||||
try {
|
||||
// judge whether the physical file exists or not
|
||||
itemResource = resourceSet.getResource(itemResourceURI, true);
|
||||
} catch (Exception e) {
|
||||
// do nothing, consider the file don't exist
|
||||
itemResource = null;
|
||||
}
|
||||
}
|
||||
if (itemResource == null && createIfNotExist) {
|
||||
itemResource = resourceSet.createResource(itemResourceURI);
|
||||
}
|
||||
return itemResource;
|
||||
|
||||
@@ -1147,7 +1147,7 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
"ProjectRepositoryNode.itemInvalid", repositoryObject.getRepositoryObjectType(), //$NON-NLS-1$,
|
||||
repositoryObject.getLabel()));
|
||||
|
||||
if (repositoryObject.getProperty().getInformations().isEmpty()) {
|
||||
if (repositoryObject.getProperty() != null && repositoryObject.getProperty().getInformations().isEmpty()) {
|
||||
Information info = PropertiesFactory.eINSTANCE.createInformation();
|
||||
info.setLevel(InformationLevel.ERROR_LITERAL);
|
||||
info.setText(Messages.getString("ProjectRepositoryNode.invalidItem")); //$NON-NLS-1$
|
||||
@@ -1813,7 +1813,7 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
}
|
||||
|
||||
public boolean getMergeRefProject() {
|
||||
IPreferenceStore preferenceStore = RepositoryManager.getPreferenceStore();
|
||||
IPreferenceStore preferenceStore = RepositoryManager.getRepositoryPreferenceStore();
|
||||
return preferenceStore.getBoolean(IRepositoryPrefConstants.MERGE_REFERENCE_PROJECT);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,8 +21,6 @@ import org.eclipse.ui.PlatformUI;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.commons.utils.workbench.resources.ResourceUtils;
|
||||
import org.talend.core.model.properties.ConnectionItem;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.model.repository.RepositoryManager;
|
||||
@@ -34,6 +32,7 @@ import org.talend.core.repository.utils.AbstractResourceChangesService;
|
||||
import org.talend.core.repository.utils.TDQServiceRegister;
|
||||
import org.talend.repository.model.ERepositoryStatus;
|
||||
import org.talend.repository.model.IProxyRepositoryFactory;
|
||||
import org.talend.repository.model.IRepositoryNode;
|
||||
import org.talend.repository.model.IRepositoryNode.ENodeType;
|
||||
import org.talend.repository.model.IRepositoryNode.EProperties;
|
||||
import org.talend.repository.model.JobletReferenceBean;
|
||||
@@ -217,6 +216,10 @@ public class MoveObjectAction {
|
||||
public boolean isLock(RepositoryNode sourceNode) {
|
||||
boolean isLock = false;
|
||||
|
||||
if (ProxyRepositoryFactory.getInstance().getRepositoryContext().isEditableAsReadOnly()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
ProxyRepositoryFactory.getInstance().initialize();
|
||||
@@ -291,11 +294,10 @@ public class MoveObjectAction {
|
||||
|| repositoryObjectType == ERepositoryObjectType.METADATA_MDMCONNECTION) {
|
||||
AbstractResourceChangesService resourceChangeService = TDQServiceRegister.getInstance()
|
||||
.getResourceChangeService(AbstractResourceChangesService.class);
|
||||
Item item = objectToMove.getProperty() == null ? null : objectToMove.getProperty().getItem();
|
||||
if (null != resourceChangeService && null != item) {
|
||||
boolean handleResourceChange = resourceChangeService.handleResourceChange(((ConnectionItem) item)
|
||||
.getConnection());
|
||||
if (!handleResourceChange) {
|
||||
if (null != resourceChangeService) {
|
||||
List<IRepositoryNode> dependentNodes = resourceChangeService.getDependentNodes(sourceNode);
|
||||
if (dependentNodes != null && !dependentNodes.isEmpty()) {
|
||||
resourceChangeService.openDependcesDialog(dependentNodes);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,11 @@ public class CopyAction extends AContextualAction {
|
||||
|
||||
LocalSelectionTransfer.getTransfer().setSelection(selection);
|
||||
LocalSelectionTransfer.getTransfer().setSelectionSetTime(System.currentTimeMillis());
|
||||
// init paste action
|
||||
PasteAction pasteActionInstance = PasteAction.getInstance();
|
||||
if (pasteActionInstance != null) {
|
||||
pasteActionInstance.init(null, selection);
|
||||
}
|
||||
// refresh();
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,6 @@ import org.talend.core.model.properties.JobletProcessItem;
|
||||
import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.model.properties.ProjectReference;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.properties.TDQItem;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.Folder;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
@@ -428,14 +427,21 @@ public class DeleteAction extends AContextualAction {
|
||||
ERepositoryObjectType objectType = (ERepositoryObjectType) node.getProperties(EProperties.CONTENT_TYPE);
|
||||
List<IRepositoryNode> repositoryList = node.getChildren();
|
||||
boolean success = true;
|
||||
Exception bex = null;
|
||||
for (IRepositoryNode repositoryNode : repositoryList) {
|
||||
try {
|
||||
deleteRepositoryNode(repositoryNode, factory);
|
||||
} catch (Exception e) {
|
||||
bex = e;
|
||||
ExceptionHandler.process(e);
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
if (bex != null) {
|
||||
final Shell shell = getShell();
|
||||
MessageDialog.openWarning(shell, Messages.getString("DeleteAction.warning.title"),
|
||||
Messages.getString("DeleteAction.warning.message1"));
|
||||
}
|
||||
if (!success) {
|
||||
return;
|
||||
}
|
||||
@@ -1152,18 +1158,8 @@ public class DeleteAction extends AContextualAction {
|
||||
return true;
|
||||
}
|
||||
|
||||
Item item = null;
|
||||
if (objToDelete != null && objToDelete.getProperty() != null) {
|
||||
item = objToDelete.getProperty().getItem();
|
||||
}
|
||||
AbstractResourceChangesService resChangeService = TDQServiceRegister.getInstance().getResourceChangeService(
|
||||
AbstractResourceChangesService.class);
|
||||
if (resChangeService != null && item != null && item instanceof ConnectionItem && item.getState().isDeleted()) {
|
||||
if (!resChangeService.handleResourceChange(((ConnectionItem) item).getConnection())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// To manage case of we have a subitem. This is possible using 'DEL' shortcut:
|
||||
ERepositoryObjectType nodeType = (ERepositoryObjectType) currentJobNode.getProperties(EProperties.CONTENT_TYPE);
|
||||
if (nodeType != null && nodeType.isSubItem()) {
|
||||
@@ -1179,6 +1175,13 @@ public class DeleteAction extends AContextualAction {
|
||||
needReturn = true;
|
||||
} else {
|
||||
if (factory.getStatus(objToDelete) == ERepositoryStatus.DELETED) {
|
||||
if (resChangeService != null) {
|
||||
List<IRepositoryNode> dependentNodes = resChangeService.getDependentNodes(currentJobNode);
|
||||
if (dependentNodes != null && !dependentNodes.isEmpty()) {
|
||||
resChangeService.openDependcesDialog(dependentNodes);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (confirm == null) {
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
|
||||
@@ -1230,8 +1233,11 @@ public class DeleteAction extends AContextualAction {
|
||||
} else {
|
||||
// MOD qiongli 2011-5-10,bug 21189.should remove dependency after showing the question dialog of
|
||||
// physical delete.
|
||||
if (resChangeService != null && (item instanceof TDQItem || item instanceof ConnectionItem)) {
|
||||
resChangeService.removeAllDependecies(item);
|
||||
if (resChangeService != null && objToDelete != null && objToDelete.getProperty() != null) {
|
||||
Item item = objToDelete.getProperty().getItem();
|
||||
if (item != null) {
|
||||
resChangeService.removeAllDependecies(item);
|
||||
}
|
||||
}
|
||||
factory.deleteObjectPhysical(objToDelete);
|
||||
ExpressionPersistance.getInstance().jobDeleted(objToDelete.getLabel());
|
||||
@@ -1312,8 +1318,8 @@ public class DeleteAction extends AContextualAction {
|
||||
if (factory.isUserReadOnlyOnCurrentProject()) {
|
||||
visible = false;
|
||||
}
|
||||
// TDI-23105:only for read-only(tag) project
|
||||
if (!factory.getRepositoryContext().isOffline() && factory.getRepositoryContext().isEditableAsReadOnly()) {
|
||||
// TDI-23105:only for read-only(tag) project > also for offline, since TDI-23336
|
||||
if (factory.getRepositoryContext().isOffline() || factory.getRepositoryContext().isEditableAsReadOnly()) {
|
||||
visible = false;
|
||||
}
|
||||
for (Object o : (selection).toArray()) {
|
||||
@@ -1390,6 +1396,12 @@ public class DeleteAction extends AContextualAction {
|
||||
break;
|
||||
}
|
||||
|
||||
if (contentType == ERepositoryObjectType.METADATA_CON_TABLE) {
|
||||
enabled = false;
|
||||
visible = false;
|
||||
break;
|
||||
}
|
||||
|
||||
IRepositoryViewObject repObj = node.getObject();
|
||||
|
||||
ERepositoryStatus status = repObj.getRepositoryStatus();
|
||||
|
||||
@@ -52,6 +52,7 @@ import org.talend.core.repository.utils.TDQServiceRegister;
|
||||
import org.talend.cwm.helper.SubItemHelper;
|
||||
import org.talend.repository.model.ERepositoryStatus;
|
||||
import org.talend.repository.model.IProxyRepositoryFactory;
|
||||
import org.talend.repository.model.IRepositoryNode;
|
||||
import org.talend.repository.model.IRepositoryNode.ENodeType;
|
||||
import org.talend.repository.model.IRepositoryNode.EProperties;
|
||||
import org.talend.repository.model.RepositoryConstants;
|
||||
@@ -124,11 +125,13 @@ public class DeleteTableAction extends AContextualAction {
|
||||
return;
|
||||
}
|
||||
boolean isSave = true;
|
||||
if (item instanceof ConnectionItem) {
|
||||
AbstractResourceChangesService resChangeService = TDQServiceRegister.getInstance()
|
||||
.getResourceChangeService(AbstractResourceChangesService.class);
|
||||
if (resChangeService != null) {
|
||||
isSave = resChangeService.handleResourceChange(((ConnectionItem) item).getConnection());
|
||||
AbstractResourceChangesService resChangeService = TDQServiceRegister.getInstance().getResourceChangeService(
|
||||
AbstractResourceChangesService.class);
|
||||
if (resChangeService != null) {
|
||||
List<IRepositoryNode> dependentNodes = resChangeService.getDependentNodes(node);
|
||||
if (dependentNodes != null && !dependentNodes.isEmpty()) {
|
||||
resChangeService.openDependcesDialog(dependentNodes);
|
||||
isSave = false;
|
||||
}
|
||||
}
|
||||
if (isSave) {
|
||||
@@ -180,6 +183,7 @@ public class DeleteTableAction extends AContextualAction {
|
||||
}
|
||||
Display.getCurrent().syncExec(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
RepositoryManager.refreshDeletedNode(types);
|
||||
}
|
||||
@@ -205,6 +209,7 @@ public class DeleteTableAction extends AContextualAction {
|
||||
* @see org.talend.repository.ui.actions.ITreeContextualAction#init(org.eclipse.jface.viewers.TreeViewer,
|
||||
* org.eclipse.jface.viewers.IStructuredSelection)
|
||||
*/
|
||||
@Override
|
||||
public void init(TreeViewer viewer, IStructuredSelection selection) {
|
||||
boolean canWork = false;
|
||||
setText(null);
|
||||
|
||||
@@ -48,7 +48,9 @@ import org.talend.core.model.repository.RepositoryManager;
|
||||
import org.talend.core.repository.i18n.Messages;
|
||||
import org.talend.core.repository.model.ISubRepositoryObject;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
import org.talend.core.repository.utils.AbstractResourceChangesService;
|
||||
import org.talend.core.repository.utils.RepositoryNodeDeleteManager;
|
||||
import org.talend.core.repository.utils.TDQServiceRegister;
|
||||
import org.talend.designer.business.diagram.custom.IDiagramModelService;
|
||||
import org.talend.repository.ProjectManager;
|
||||
import org.talend.repository.model.ERepositoryStatus;
|
||||
@@ -86,9 +88,21 @@ public class EmptyRecycleBinAction extends AContextualAction {
|
||||
// TDI-20542
|
||||
List<IRepositoryNode> originalChildren = node.getChildren();
|
||||
final List<IRepositoryNode> children = new ArrayList<IRepositoryNode>(originalChildren);
|
||||
// MOD qiongli 2012-11-23 TUP-273 if a connection in recycle bin which depended by DQ analysis,should give a
|
||||
// warning then return.
|
||||
if (children.size() == 0) {
|
||||
return;
|
||||
} else if (children.size() > 1) {
|
||||
}
|
||||
AbstractResourceChangesService resChangeService = TDQServiceRegister.getInstance().getResourceChangeService(
|
||||
AbstractResourceChangesService.class);
|
||||
if (resChangeService != null) {
|
||||
List<IRepositoryNode> dependentNodes = resChangeService.getDependentConnNodesInRecycleBin(children);
|
||||
if (dependentNodes != null && !dependentNodes.isEmpty()) {
|
||||
resChangeService.openDependcesDialog(dependentNodes);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (children.size() > 1) {
|
||||
message = Messages.getString("DeleteAction.dialog.messageAllElements") + "\n" + //$NON-NLS-1$ //$NON-NLS-2$
|
||||
Messages.getString("DeleteAction.dialog.message2"); //$NON-NLS-1$;
|
||||
} else {
|
||||
@@ -125,6 +139,7 @@ public class EmptyRecycleBinAction extends AContextualAction {
|
||||
|
||||
final IWorkspaceRunnable op = new IWorkspaceRunnable() {
|
||||
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) {
|
||||
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
|
||||
for (IRepositoryNode child : children) {
|
||||
@@ -144,6 +159,7 @@ public class EmptyRecycleBinAction extends AContextualAction {
|
||||
|
||||
IRunnableWithProgress iRunnableWithProgress = new IRunnableWithProgress() {
|
||||
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
||||
IWorkspace workspace = ResourcesPlugin.getWorkspace();
|
||||
try {
|
||||
@@ -167,6 +183,7 @@ public class EmptyRecycleBinAction extends AContextualAction {
|
||||
if (unDeleteItems.size() > 0) {
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
ItemReferenceDialog dialog = new ItemReferenceDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell(), unDeleteItems);
|
||||
@@ -248,6 +265,7 @@ public class EmptyRecycleBinAction extends AContextualAction {
|
||||
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
|
||||
@@ -315,14 +333,15 @@ public class EmptyRecycleBinAction extends AContextualAction {
|
||||
* @see org.talend.repository.ui.actions.ITreeContextualAction#init(org.eclipse.jface.viewers.TreeViewer,
|
||||
* org.eclipse.jface.viewers.IStructuredSelection)
|
||||
*/
|
||||
@Override
|
||||
public void init(TreeViewer viewer, IStructuredSelection selection) {
|
||||
boolean canWork = !selection.isEmpty() && selection.size() == 1;
|
||||
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
|
||||
if (factory.isUserReadOnlyOnCurrentProject()) {
|
||||
canWork = false;
|
||||
}
|
||||
// TDI-23105:only for read-only(tag) project
|
||||
if (!factory.getRepositoryContext().isOffline() && factory.getRepositoryContext().isEditableAsReadOnly()) {
|
||||
// TDI-23105:only for read-only(tag) project > also for offline, since TDI-23336
|
||||
if (factory.getRepositoryContext().isOffline() || factory.getRepositoryContext().isEditableAsReadOnly()) {
|
||||
canWork = false;
|
||||
}
|
||||
if (canWork) {
|
||||
|
||||
@@ -96,10 +96,10 @@ public class PasteAction extends AContextualAction {
|
||||
|
||||
public void init(TreeViewer viewer, IStructuredSelection selection) {
|
||||
boolean enabled = true;
|
||||
if (selection.size() != 1) { // only one current node selected
|
||||
setEnabled(false);
|
||||
return;
|
||||
}
|
||||
// if (selection.size() != 1) { // only one current node selected
|
||||
// setEnabled(false);
|
||||
// return;
|
||||
// }
|
||||
|
||||
Object targetObject = selection.getFirstElement();
|
||||
if (!(targetObject instanceof RepositoryNode)) {
|
||||
|
||||
@@ -38,7 +38,6 @@ import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.model.business.BusinessType;
|
||||
import org.talend.core.model.properties.ConnectionItem;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.properties.RoutineItem;
|
||||
@@ -96,8 +95,9 @@ public class RepositoryDropAdapter extends PluginDropAdapter {
|
||||
case DND.DROP_COPY:
|
||||
RunnableWithReturnValue runnable = new CopyRunnable(
|
||||
Messages.getString("RepositoryDropAdapter_copyingItems"), data, targetNode); //$NON-NLS-1$
|
||||
runInProgressDialog(runnable);
|
||||
toReturn = (Boolean) runnable.getReturnValue();
|
||||
// runInProgressDialog(runnable);
|
||||
// toReturn = (Boolean) runnable.getReturnValue();
|
||||
runCopy(data, targetNode);
|
||||
break;
|
||||
case DND.DROP_MOVE:
|
||||
runnable = new MoveRunnable(Messages.getString("RepositoryDropAdapter_movingItems"), data, targetNode); //$NON-NLS-1$
|
||||
@@ -149,10 +149,10 @@ public class RepositoryDropAdapter extends PluginDropAdapter {
|
||||
// iRepositoryNode.getObject().getProperty().getItem().eResource().unload();
|
||||
Item item = repositoryNode.getObject() == null ? null : repositoryNode.getObject().getProperty().getItem();
|
||||
if (resourceChangeService != null && null != item) {
|
||||
boolean handleResourceChange = resourceChangeService.handleResourceChange(((ConnectionItem) item)
|
||||
.getConnection());
|
||||
if (!handleResourceChange) {
|
||||
return handleResourceChange;
|
||||
List<IRepositoryNode> dependentNodes = resourceChangeService.getDependentNodes(repositoryNode);
|
||||
if (dependentNodes != null && !dependentNodes.isEmpty()) {
|
||||
resourceChangeService.openDependcesDialog(dependentNodes);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -167,8 +167,9 @@ public class RepositoryDropAdapter extends PluginDropAdapter {
|
||||
*/
|
||||
@Override
|
||||
public boolean validateDrop(Object target, int operation, TransferData transferType) {
|
||||
if (target == null)
|
||||
if (target == null) {
|
||||
return false;
|
||||
}
|
||||
super.validateDrop(target, operation, transferType);
|
||||
boolean isValid = true;
|
||||
for (Object obj : ((StructuredSelection) getViewer().getSelection()).toArray()) {
|
||||
@@ -229,9 +230,29 @@ public class RepositoryDropAdapter extends PluginDropAdapter {
|
||||
return isValid;
|
||||
}
|
||||
|
||||
private void runCopy(final Object data, final RepositoryNode targetNode) {
|
||||
String copyName = "User action : Copy Object"; //$NON-NLS-1$
|
||||
RepositoryWorkUnit<Object> repositoryWorkUnit = new RepositoryWorkUnit<Object>(copyName, CopyObjectAction.getInstance()) {
|
||||
|
||||
@Override
|
||||
protected void run() throws LoginException, PersistenceException {
|
||||
try {
|
||||
for (Object obj : ((StructuredSelection) data).toArray()) {
|
||||
final RepositoryNode sourceNode = (RepositoryNode) obj;
|
||||
CopyObjectAction.getInstance().execute(sourceNode, targetNode);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new PersistenceException(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
ProxyRepositoryFactory.getInstance().executeRepositoryWorkUnit(repositoryWorkUnit);
|
||||
}
|
||||
|
||||
private void runInProgressDialog(final IWorkspaceRunnable op) {
|
||||
final IRunnableWithProgress iRunnableWithProgress = new IRunnableWithProgress() {
|
||||
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
||||
IWorkspace workspace = ResourcesPlugin.getWorkspace();
|
||||
try {
|
||||
@@ -279,6 +300,7 @@ public class RepositoryDropAdapter extends PluginDropAdapter {
|
||||
this.targetNode = targetNode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws CoreException {
|
||||
monitor.beginTask(getTaskName(), IProgressMonitor.UNKNOWN);
|
||||
String copyName = "User action : Copy Object"; //$NON-NLS-1$
|
||||
@@ -319,6 +341,7 @@ public class RepositoryDropAdapter extends PluginDropAdapter {
|
||||
this.targetNode = targetNode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(final IProgressMonitor monitor) throws CoreException {
|
||||
monitor.beginTask(getTaskName(), IProgressMonitor.UNKNOWN);
|
||||
// MOD gdbu 2011-10-9 TDQ-3545
|
||||
@@ -340,7 +363,7 @@ public class RepositoryDropAdapter extends PluginDropAdapter {
|
||||
}
|
||||
MessageDialog.openInformation(getViewer().getControl().getShell(),
|
||||
Messages.getString("RepositoryDropAdapter_moveTitle"), //$NON-NLS-1$
|
||||
errorMsg); //$NON-NLS-1$
|
||||
errorMsg);
|
||||
setReturnValue(false);
|
||||
return;
|
||||
}
|
||||
@@ -371,6 +394,7 @@ public class RepositoryDropAdapter extends PluginDropAdapter {
|
||||
protected void run() throws LoginException, PersistenceException {
|
||||
final IWorkspaceRunnable op = new IWorkspaceRunnable() {
|
||||
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws CoreException {
|
||||
try {
|
||||
for (Object obj : ((StructuredSelection) data).toArray()) {
|
||||
|
||||
@@ -193,6 +193,10 @@ public class RepositoryLabelProvider extends LabelProvider implements IColorProv
|
||||
if (object instanceof RepositoryViewObject && ((RepositoryViewObject) object).getCustomImage() != null) {
|
||||
img = ((RepositoryViewObject) object).getCustomImage();
|
||||
} else {
|
||||
if (property == null) {
|
||||
// means item has been deleted or is not available for display now, so just return null
|
||||
return null;
|
||||
}
|
||||
// MOD sizhaoliu 2011-10-14
|
||||
// TDQ-3356 enable different icons of extension points under a same repository node
|
||||
Item item = property.getItem();
|
||||
|
||||
@@ -483,3 +483,4 @@ TalendDataCollectorUploadingPreferencePage_Days=\u65E5
|
||||
repository.servicesOperation=\u64CD\u4F5C
|
||||
repository.servicesPort=\u30DD\u30FC\u30C8
|
||||
BinRepositoryNode.label=\u3054\u307F\u7BB1
|
||||
EMetadataEncoding.Latin9=Latin9
|
||||
|
||||
@@ -6,11 +6,13 @@ Bundle-Version: 2.2.0.qualifier
|
||||
Bundle-Localization: plugin
|
||||
Bundle-Vendor: .Talend SA.
|
||||
Export-Package: org.talend.core,
|
||||
org.talend.core.classloader,
|
||||
org.talend.core.context,
|
||||
org.talend.core.database,
|
||||
org.talend.core.database.conn,
|
||||
org.talend.core.database.conn.template,
|
||||
org.talend.core.database.conn.version,
|
||||
org.talend.core.database.hbase.conn.version,
|
||||
org.talend.core.database.utils,
|
||||
org.talend.core.download,
|
||||
org.talend.core.exception,
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
<extension-point id="check_servers" name="Check servers" schema="schema/check_servers.exsd"/>
|
||||
<extension-point id="repositoryComponent_provider" name="Repository Component Provider" schema="schema/repositoryComponent_provider.exsd"/>
|
||||
<extension-point id="hidePreferencePages_provider" name="Hide Preference Pages" schema="schema/hidePreferencePages_provider.exsd"/>
|
||||
<extension-point id="classloader_provider" name="Classloader Provider" schema="schema/classloader_provider.exsd"/>
|
||||
|
||||
<extension
|
||||
point="org.eclipse.ui.preferencePages">
|
||||
@@ -82,11 +83,4 @@
|
||||
</Component>
|
||||
</SortedComponents>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.talend.cwm.mip.cwmService">
|
||||
<cwmService
|
||||
class="org.talend.core.service.TalendCWMService"
|
||||
serviceId="CWMService">
|
||||
</cwmService>
|
||||
</extension>
|
||||
</plugin>
|
||||
|
||||
@@ -1,109 +1,106 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="org.talend.cwm.mip" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.schema plugin="org.talend.cwm.mip" id="cwmService" name="cwm service"/>
|
||||
</appInfo>
|
||||
<documentation>
|
||||
[Enter description of this extension point.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<element name="extension">
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.element />
|
||||
</appInfo>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<sequence>
|
||||
<element ref="cwmService"/>
|
||||
</sequence>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="id" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="name" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appInfo>
|
||||
<meta.attribute translatable="true"/>
|
||||
</appInfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="cwmService">
|
||||
<complexType>
|
||||
<attribute name="class" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appInfo>
|
||||
<meta.attribute kind="java" basedOn="org.talend.cwm.mip.service.CWMService:"/>
|
||||
</appInfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="serviceId" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.section type="since"/>
|
||||
</appInfo>
|
||||
<documentation>
|
||||
[Enter the first release in which this extension point appears.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.section type="examples"/>
|
||||
</appInfo>
|
||||
<documentation>
|
||||
[Enter extension point usage example here.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.section type="apiinfo"/>
|
||||
</appInfo>
|
||||
<documentation>
|
||||
[Enter API information here.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.section type="implementation"/>
|
||||
</appInfo>
|
||||
<documentation>
|
||||
[Enter information about supplied implementation of this extension point.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
|
||||
</schema>
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="org.talend.core.runtime" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.schema plugin="org.talend.core.runtime" id="classloader_provider" name="Classloader Provider"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter description of this extension point.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<element name="extension">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.element />
|
||||
</appinfo>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<sequence minOccurs="1" maxOccurs="unbounded">
|
||||
<element ref="classloader"/>
|
||||
</sequence>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="id" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="name" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute translatable="true"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="classloader">
|
||||
<complexType>
|
||||
<attribute name="index" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
The index to search the classloader.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="libraries" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
Libraries which classloader search class from. If have multiple values use semicolon to separate.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="since"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter the first release in which this extension point appears.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="examples"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter extension point usage example here.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="apiinfo"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter API information here.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="implementation"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter information about supplied implementation of this extension point.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
|
||||
</schema>
|
||||
@@ -125,6 +125,7 @@ EConnectionType.onRowsEndMenu=On Rows End
|
||||
EConnectionType.mergeMenu=Merge
|
||||
EConnectionType.synchronize=Synchronize
|
||||
EConnectionType.parallelize=Parallelize
|
||||
EConnectionType.startsMenu=Starts
|
||||
EConnectionType.route=Route
|
||||
EConnectionType.when=When
|
||||
EConnectionType.otherwise=Otherwise
|
||||
|
||||
@@ -10,13 +10,12 @@
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.utils;
|
||||
package org.talend.core;
|
||||
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.talend.commons.CommonsPlugin;
|
||||
import org.talend.core.CorePlugin;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||
import org.talend.core.ui.branding.IBrandingService;
|
||||
|
||||
/**
|
||||
@@ -28,7 +27,7 @@ public class BrandingChecker {
|
||||
|
||||
private static boolean isBrandingChanged;
|
||||
|
||||
private static final String LAST_STARTED_PRODUCT = "last started product"; //$NON-NLS-1$
|
||||
private static final String LAST_STARTED_PRODUCT = "last_started_product"; //$NON-NLS-1$
|
||||
|
||||
public static boolean isBrandingChanged() {
|
||||
if (!initialized) {
|
||||
@@ -45,8 +44,9 @@ public class BrandingChecker {
|
||||
}
|
||||
display.syncExec(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
IPreferenceStore preferenceStore = CorePlugin.getDefault().getPreferenceStore();
|
||||
IPreferenceStore preferenceStore = CoreRuntimePlugin.getInstance().getPreferenceStore();
|
||||
String oldBrandingName = preferenceStore.getString(LAST_STARTED_PRODUCT);
|
||||
if (oldBrandingName == null || oldBrandingName.equals("") || !oldBrandingName.equals(fullProductName)) { //$NON-NLS-1$
|
||||
isBrandingChanged = true;
|
||||
@@ -27,6 +27,7 @@ import org.eclipse.swt.graphics.Image;
|
||||
import org.talend.commons.exception.BusinessException;
|
||||
import org.talend.commons.exception.SystemException;
|
||||
import org.talend.commons.ui.swt.actions.ITreeContextualAction;
|
||||
import org.talend.core.model.general.LibraryInfo;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.metadata.ColumnNameChanged;
|
||||
import org.talend.core.model.metadata.IMetadataTable;
|
||||
@@ -60,7 +61,7 @@ public interface ICoreService extends IService {
|
||||
|
||||
public boolean getContextFlagFromQueryUtils();
|
||||
|
||||
public Map<String, List<String>> getRoutineAndJars();
|
||||
public Map<String, List<LibraryInfo>> getRoutineAndJars();
|
||||
|
||||
public String getTemplateString();
|
||||
|
||||
|
||||
@@ -72,6 +72,14 @@ public interface ILibraryManagerService extends IService {
|
||||
*/
|
||||
public Set<String> list(IProgressMonitor... monitorWrap);
|
||||
|
||||
/**
|
||||
*
|
||||
* List all .dll files
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Set<String> listAllDllFiles();
|
||||
|
||||
public boolean delete(String jarName);
|
||||
|
||||
public boolean contains(String jarName);
|
||||
|
||||
@@ -41,7 +41,7 @@ public interface ITDQRepositoryService extends IService {
|
||||
|
||||
public IViewPart getTDQRespositoryView();
|
||||
|
||||
public void openEditor(Item item);
|
||||
public void openConnectionEditor(Item item);
|
||||
|
||||
public void notifySQLExplorer(Item... items);
|
||||
|
||||
@@ -98,4 +98,13 @@ public interface ITDQRepositoryService extends IService {
|
||||
|
||||
// ADD xqliu 2012-07-24 TDQ-5853
|
||||
public void checkUsernameBeforeSaveConnection(ConnectionItem connectionItem);
|
||||
|
||||
// ADD qiongli 2012-11-12 TDQ-6166
|
||||
public void initAllConnectionsToSQLExplorer();
|
||||
|
||||
// Add yyin 2012-11-15 TDQ-6395
|
||||
public void saveConnectionWithDependency(ConnectionItem connectionItem);
|
||||
|
||||
public void refreshConnectionEditor(Item item);
|
||||
|
||||
}
|
||||
|
||||
@@ -80,6 +80,8 @@ public class PluginChecker {
|
||||
|
||||
private static final String HDFS_PLUGIN_ID = "org.talend.repository.hdfs"; //$NON-NLS-1$
|
||||
|
||||
private static final String METADATA_PLUGIN_ID = "org.talend.repository.metadata"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Check if specific plug-in is loaded.
|
||||
*
|
||||
@@ -241,4 +243,8 @@ public class PluginChecker {
|
||||
public static boolean isHDFSPluginLoaded() {
|
||||
return isPluginLoaded(HDFS_PLUGIN_ID);
|
||||
}
|
||||
|
||||
public static boolean isMetadataPluginLoaded() {
|
||||
return isPluginLoaded(METADATA_PLUGIN_ID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 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.classloader;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.IConfigurationElement;
|
||||
import org.eclipse.core.runtime.IExtensionRegistry;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.commons.utils.workbench.resources.ResourceUtils;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.ILibraryManagerService;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.repository.ProjectManager;
|
||||
import org.talend.utils.io.FilesUtils;
|
||||
|
||||
/**
|
||||
* DOC ycbai class global comment. Detailled comment
|
||||
*/
|
||||
public class ClassLoaderFactory {
|
||||
|
||||
private static Logger log = Logger.getLogger(ClassLoaderFactory.class);
|
||||
|
||||
private final static String EXTENSION_POINT_ID = "org.talend.core.runtime.classloader_provider"; //$NON-NLS-1$
|
||||
|
||||
private static IConfigurationElement[] configurationElements = null;
|
||||
|
||||
private final static String SEPARATOR = ";"; //$NON-NLS-1$
|
||||
|
||||
private final static String PATH_SEPARATOR = "/"; //$NON-NLS-1$
|
||||
|
||||
private static Map<String, DynamicClassLoader> classLoadersMap = null;
|
||||
|
||||
private static final String INDEX_ATTR = "index"; //$NON-NLS-1$
|
||||
|
||||
private static final String LIB_ATTR = "libraries"; //$NON-NLS-1$
|
||||
|
||||
static {
|
||||
IExtensionRegistry registry = Platform.getExtensionRegistry();
|
||||
configurationElements = registry.getConfigurationElementsFor(EXTENSION_POINT_ID);
|
||||
}
|
||||
|
||||
public static ClassLoader getClassLoader(String index) {
|
||||
if (classLoadersMap == null) {
|
||||
initClassLoaders();
|
||||
}
|
||||
|
||||
return classLoadersMap.get(index);
|
||||
}
|
||||
|
||||
private static void initClassLoaders() {
|
||||
File tmpFolder = getTmpFolder();
|
||||
if (tmpFolder.exists()) {
|
||||
FilesUtils.removeFolder(tmpFolder, true);
|
||||
}
|
||||
classLoadersMap = new HashMap<String, DynamicClassLoader>();
|
||||
for (IConfigurationElement current : configurationElements) {
|
||||
String index = current.getAttribute(INDEX_ATTR);
|
||||
String libraries = current.getAttribute(LIB_ATTR);
|
||||
if (StringUtils.isNotEmpty(index)) {
|
||||
DynamicClassLoader classLoader = new DynamicClassLoader();
|
||||
if (StringUtils.isNotEmpty(libraries)) {
|
||||
String[] librariesArray = libraries.split(SEPARATOR);
|
||||
List<String> jarPathList = retrieveJarPaths(librariesArray);
|
||||
classLoader.addLibraries(jarPathList);
|
||||
}
|
||||
classLoadersMap.put(index, classLoader);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static List<String> retrieveJarPaths(String[] driversArray) {
|
||||
List<String> jarPathList = new ArrayList<String>();
|
||||
if (driversArray == null || driversArray.length == 0) {
|
||||
return jarPathList;
|
||||
}
|
||||
|
||||
ILibraryManagerService librairesManagerService = (ILibraryManagerService) GlobalServiceRegister.getDefault().getService(
|
||||
ILibraryManagerService.class);
|
||||
String libPath = getLibPath();
|
||||
for (String driverName : driversArray) {
|
||||
String jarPath = libPath + PATH_SEPARATOR + driverName;
|
||||
File jarFile = new File(jarPath);
|
||||
if (!jarFile.exists()) {
|
||||
boolean retrieved = librairesManagerService.retrieve(driverName, libPath, new NullProgressMonitor());
|
||||
if (!retrieved) {
|
||||
log.warn("Cannot retrieve lib: " + driverName);
|
||||
}
|
||||
}
|
||||
jarPathList.add(jarFile.getAbsolutePath());
|
||||
}
|
||||
|
||||
return jarPathList;
|
||||
}
|
||||
|
||||
private static String getLibPath() {
|
||||
File tmpFolder = getTmpFolder();
|
||||
if (!tmpFolder.exists()) {
|
||||
tmpFolder.mkdirs();
|
||||
}
|
||||
try {
|
||||
tmpFolder = File.createTempFile("libs", null, tmpFolder); //$NON-NLS-1$
|
||||
if (tmpFolder.exists() && tmpFolder.isFile()) {
|
||||
tmpFolder.delete();
|
||||
tmpFolder.mkdirs();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
}
|
||||
return tmpFolder.getAbsolutePath();
|
||||
}
|
||||
|
||||
private static File getTmpFolder() {
|
||||
Project project = ProjectManager.getInstance().getCurrentProject();
|
||||
IProject physProject;
|
||||
String tmpFolderPath = System.getProperty("user.dir"); //$NON-NLS-1$
|
||||
try {
|
||||
physProject = ResourceUtils.getProject(project.getTechnicalLabel());
|
||||
tmpFolderPath = physProject.getFolder("temp").getLocation().toPortableString(); //$NON-NLS-1$
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
tmpFolderPath = tmpFolderPath + "/libraries"; //$NON-NLS-1$
|
||||
|
||||
return new File(tmpFolderPath);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 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.classloader;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.List;
|
||||
|
||||
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
|
||||
/**
|
||||
* DOC ycbai class global comment. Detailled comment
|
||||
*/
|
||||
public class DynamicClassLoader extends URLClassLoader {
|
||||
|
||||
/**
|
||||
* DOC ycbai DynamicClassLoader constructor comment.
|
||||
*/
|
||||
public DynamicClassLoader() {
|
||||
super(new URL[0], DynamicClassLoader.class.getClassLoader());
|
||||
}
|
||||
|
||||
public void addLibraries(String lib) {
|
||||
if (lib != null) {
|
||||
File libFile = new File(lib);
|
||||
try {
|
||||
addURL(libFile.toURL());
|
||||
} catch (MalformedURLException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addLibraries(List<String> libs) {
|
||||
if (libs != null && libs.size() > 0) {
|
||||
for (String lib : libs) {
|
||||
addLibraries(lib);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -65,8 +65,11 @@ public enum EDatabase4DriverClassName {
|
||||
SAS(EDatabaseTypeName.SAS, "com.sas.rio.MVADriver"), //$NON-NLS-1$
|
||||
SQLITE(EDatabaseTypeName.SQLITE, "org.sqlite.JDBC"), //$NON-NLS-1$
|
||||
|
||||
SYBASEASE(EDatabaseTypeName.SYBASEASE, "com.sybase.jdbc3.jdbc.SybDriver"), //$NON-NLS-1$
|
||||
SYBASEIQ(EDatabaseTypeName.SYBASEIQ, "com.sybase.jdbc3.jdbc.SybDriver"), //$NON-NLS-1$
|
||||
SYBASEASE(EDatabaseTypeName.SYBASEASE, new String[] {
|
||||
"com.sybase.jdbc3.jdbc.SybDriver", "com.sybase.jdbc3.jdbc.SybDataSource" }, new String[] {}), //$NON-NLS-1$
|
||||
SYBASEIQ(
|
||||
EDatabaseTypeName.SYBASEIQ,
|
||||
new String[] { "com.sybase.jdbc3.jdbc.SybDriver", "com.sybase.jdbc3.jdbc.SybDataSource" }, new String[] {}), //$NON-NLS-1$
|
||||
|
||||
EXASOLUTION(EDatabaseTypeName.EXASOL, "com.exasol.jdbc.EXADriver"), //$NON-NLS-1$
|
||||
// MOD klliu 2010-06-04 bug 12819: upgrade jdbc driver class used in sql explorer
|
||||
|
||||
@@ -27,26 +27,43 @@ public class ConnParameterKeys {
|
||||
/**
|
||||
* The key is used for Hive Mode to store its value.
|
||||
*/
|
||||
public static final String CONN_PARA_KEY_HIVE_MODE = "CONN_PARA_KEY_HIVE_MODE";
|
||||
public static final String CONN_PARA_KEY_HIVE_MODE = "CONN_PARA_KEY_HIVE_MODE"; //$NON-NLS-1$
|
||||
|
||||
public static final String CONN_PARA_KEY_HIVE_DISTRIBUTION = "CONN_PARA_KEY_HIVE_DISTRIBUTION";
|
||||
public static final String CONN_PARA_KEY_HIVE_DISTRIBUTION = "CONN_PARA_KEY_HIVE_DISTRIBUTION"; //$NON-NLS-1$
|
||||
|
||||
public static final String CONN_PARA_KEY_HIVE_VERSION = "CONN_PARA_KEY_HIVE_VERSION";
|
||||
public static final String CONN_PARA_KEY_HIVE_VERSION = "CONN_PARA_KEY_HIVE_VERSION"; //$NON-NLS-1$
|
||||
|
||||
public static final String CONN_PARA_KEY_CHARACTER_ENCODING = "CONN_PARA_KEY_CHARACTER_ENCODING"; //$NON-NLS-1$
|
||||
|
||||
public static final String CONN_PARA_KEY_NAME_NODE_URL = "CONN_PARA_KEY_NAME_NODE_URL"; //$NON-NLS-1$
|
||||
|
||||
public static final String CONN_PARA_KEY_JOB_TRACKER_URL = "CONN_PARA_KEY_JOB_TRACKER_URL"; //$NON-NLS-1$
|
||||
|
||||
public static final String CONN_PARA_KEY_METASTORE_CONN_URL = "CONN_PARA_KEY_METASTORE_CONN_URL"; //$NON-NLS-1$
|
||||
|
||||
public static final String CONN_PARA_KEY_METASTORE_CONN_USERNAME = "CONN_PARA_KEY_METASTORE_CONN_USERNAME"; //$NON-NLS-1$
|
||||
|
||||
public static final String CONN_PARA_KEY_METASTORE_CONN_PASSWORD = "CONN_PARA_KEY_METASTORE_CONN_PASSWORD"; //$NON-NLS-1$
|
||||
|
||||
public static final String CONN_PARA_KEY_METASTORE_CONN_DRIVER_JAR = "CONN_PARA_KEY_METASTORE_CONN_DRIVER_JAR"; //$NON-NLS-1$
|
||||
|
||||
public static final String CONN_PARA_KEY_METASTORE_CONN_DRIVER_NAME = "CONN_PARA_KEY_METASTORE_CONN_DRIVER_NAME"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* The key is for metastore server.
|
||||
*/
|
||||
public static final String CONN_PARA_KEY_METASTORE_SERVERNAME = "CONN_PARA_KEY_METASTORE_SERVERNAME"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* The key is for metastore server port.
|
||||
*/
|
||||
public static final String CONN_PARA_KEY_METASTORE_PROT = "CONN_PARA_KEY_METASTORE_PROT"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* keys used for Hadoop settings.
|
||||
*/
|
||||
public static final String CONN_PARA_KEY_HBASE_DISTRIBUTION = "CONN_PARA_KEY_HBASE_DISTRIBUTION"; //$NON-NLS-1$
|
||||
|
||||
public static final String CONN_PARA_KEY_HBASE_VERSION = "CONN_PARA_KEY_HBASE_VERSION"; //$NON-NLS-1$
|
||||
|
||||
public static final String CONN_PARA_KEY_CHARACTER_ENCODING = "CONN_PARA_KEY_CHARACTER_ENCODING";
|
||||
|
||||
public static final String CONN_PARA_KEY_NAME_NODE_URL = "CONN_PARA_KEY_NAME_NODE_URL";
|
||||
|
||||
public static final String CONN_PARA_KEY_JOB_TRACKER_URL = "CONN_PARA_KEY_JOB_TRACKER_URL";
|
||||
|
||||
public static final String CONN_PARA_KEY_METASTORE_CONN_URL = "CONN_PARA_KEY_METASTORE_CONN_URL";
|
||||
|
||||
public static final String CONN_PARA_KEY_METASTORE_CONN_USERNAME = "CONN_PARA_KEY_METASTORE_CONN_USERNAME";
|
||||
|
||||
public static final String CONN_PARA_KEY_METASTORE_CONN_PASSWORD = "CONN_PARA_KEY_METASTORE_CONN_PASSWORD";
|
||||
|
||||
public static final String CONN_PARA_KEY_METASTORE_CONN_DRIVER_JAR = "CONN_PARA_KEY_METASTORE_CONN_DRIVER_JAR";
|
||||
|
||||
public static final String CONN_PARA_KEY_METASTORE_CONN_DRIVER_NAME = "CONN_PARA_KEY_METASTORE_CONN_DRIVER_NAME";
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 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.database.conn;
|
||||
|
||||
/**
|
||||
* These keys in this enum are the key of configuration properties for Hive from <code>HiveConf</code>. Created by
|
||||
* Marvin Wang on Nov 22, 2012.
|
||||
*/
|
||||
public enum HiveConfKeysForTalend {
|
||||
|
||||
/**
|
||||
* This is for the url of name node, the value of the key is <code>fs.default.name</code>.
|
||||
*/
|
||||
HIVE_CONF_KEY_FS_DEFAULT_NAME("fs.default.name"), //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* This key is for job traker url, value of the key is <code>mapred.job.tracker</code>.
|
||||
*/
|
||||
HIVE_CONF_KEY_MAPRED_JOB_TRACKER("mapred.job.tracker"), //$NON-NLS-1$
|
||||
|
||||
HIVE_CONF_KEY_JDO_CONNECTION_URL("javax.jdo.option.ConnectionURL"), //$NON-NLS-1$
|
||||
|
||||
HIVE_CONF_KEY_JDO_CONNECTION_USERNAME("javax.jdo.option.ConnectionUserName"), //$NON-NLS-1$
|
||||
|
||||
HIVE_CONF_KEY_JDO_CONNECTION_PASSWORD("javax.jdo.option.ConnectionPassword"), //$NON-NLS-1$
|
||||
|
||||
HIVE_CONF_KEY_JDO_CONNECTION_DRIVERNAME("javax.jdo.option.ConnectionDriverName"), //$NON-NLS-1$
|
||||
|
||||
HIVE_CONF_KEY_HIVE_METASTORE_LOCAL("hive.metastore.local"), //$NON-NLS-1$
|
||||
|
||||
HIVE_CONF_KEY_HIVE_METASTORE_URI("hive.metastore.uris"), //$NON-NLS-1$
|
||||
|
||||
HIVE_CONF_KEY_HIVE_METASTORE_EXECUTE_SETUGI("hive.metastore.execute.setugi"), //$NON-NLS-1$
|
||||
|
||||
HIVE_CONF_KEY_TALEND_HIVE_MODE("talend.hive.mode"), //$NON-NLS-1$
|
||||
;
|
||||
|
||||
private String key;
|
||||
|
||||
HiveConfKeysForTalend(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return this.key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.key;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,8 +19,6 @@ import java.util.List;
|
||||
|
||||
import org.talend.core.database.EDatabaseTypeName;
|
||||
import org.talend.core.database.conn.version.EDatabaseVersion4Drivers;
|
||||
import org.talend.core.language.ECodeLanguage;
|
||||
import org.talend.core.language.LanguageManager;
|
||||
|
||||
/**
|
||||
* cli class global comment. Detailled comment
|
||||
@@ -257,37 +255,16 @@ public enum EDatabaseConnTemplate {
|
||||
databaseType.add(typeName);
|
||||
}
|
||||
}
|
||||
if (!all && LanguageManager.getCurrentLanguage() == ECodeLanguage.PERL) {
|
||||
databaseType.remove(getDBTypeName(EDatabaseConnTemplate.MSSQL, display));
|
||||
databaseType.remove(getDBTypeName(EDatabaseConnTemplate.INGRES, display));
|
||||
databaseType.remove(getDBTypeName(EDatabaseConnTemplate.INTERBASE, display));
|
||||
databaseType.remove(getDBTypeName(EDatabaseConnTemplate.INFORMIX, display));
|
||||
databaseType.remove(getDBTypeName(EDatabaseConnTemplate.FIREBIRD, display));
|
||||
databaseType.remove(getDBTypeName(EDatabaseConnTemplate.ACCESS, display));
|
||||
databaseType.remove(getDBTypeName(EDatabaseConnTemplate.TERADATA, display));
|
||||
databaseType.remove(getDBTypeName(EDatabaseConnTemplate.AS400, display));
|
||||
databaseType.remove(getDBTypeName(EDatabaseConnTemplate.JAVADB_DERBYCLIENT, display));
|
||||
databaseType.remove(getDBTypeName(EDatabaseConnTemplate.JAVADB_EMBEDED, display));
|
||||
databaseType.remove(getDBTypeName(EDatabaseConnTemplate.JAVADB_JCCJDBC, display));
|
||||
databaseType.remove(getDBTypeName(EDatabaseConnTemplate.HSQLDB_IN_PROGRESS, display));
|
||||
databaseType.remove(getDBTypeName(EDatabaseConnTemplate.HSQLDB_SERVER, display));
|
||||
databaseType.remove(getDBTypeName(EDatabaseConnTemplate.HSQLDB_WEBSERVER, display));
|
||||
databaseType.remove(getDBTypeName(EDatabaseConnTemplate.VERTICA, display));
|
||||
databaseType.remove(getDBTypeName(EDatabaseConnTemplate.HIVE, display));
|
||||
databaseType.remove(getDBTypeName(EDatabaseConnTemplate.HBASE, display));
|
||||
}
|
||||
if (sort) {
|
||||
String[] sortedArray = databaseType.toArray(new String[0]);
|
||||
Arrays.sort(sortedArray, new Comparator() {
|
||||
Arrays.sort(sortedArray, new Comparator<String>() {
|
||||
|
||||
public int compare(Object o1, Object o2) {
|
||||
if (o1 instanceof String && o2 instanceof String) {
|
||||
return o1.toString().compareTo(o2.toString());
|
||||
}
|
||||
return 0;
|
||||
@Override
|
||||
public int compare(String o1, String o2) {
|
||||
return o1.compareTo(o2);
|
||||
}
|
||||
});
|
||||
return Arrays.asList(sortedArray);
|
||||
return new ArrayList<String>(Arrays.asList(sortedArray));
|
||||
}
|
||||
return databaseType;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public enum EDatabaseVersion4Drivers {
|
||||
SAS_9_2(new DbVersion4Drivers(EDatabaseTypeName.SAS,
|
||||
"SAS 9.2", "SAS_9.2", new String[] { "sas.core.jar", "sas.security.sspi.jar", "sas.svc.connection.jar" })), //$NON-NLS-1$ //$NON-NLS-2$
|
||||
// MYSQL, add for 9594
|
||||
MYSQL_5(new DbVersion4Drivers(EDatabaseTypeName.MYSQL, "MySQL 5", "MYSQL_5", "mysql-connector-java-5.1.0-bin.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
MYSQL_5(new DbVersion4Drivers(EDatabaseTypeName.MYSQL, "MySQL 5", "MYSQL_5", "mysql-connector-java-5.1.22-bin.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
MYSQL_4(new DbVersion4Drivers(EDatabaseTypeName.MYSQL, "MySQL 4", "MYSQL_4", "mysql-connector-java-3.1.14-bin.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
// add for 9594
|
||||
MSSQL(new DbVersion4Drivers(EDatabaseTypeName.MSSQL, "jtds-1.2.5.jar")), //$NON-NLS-1$
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 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.database.hbase.conn.version;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* DOC ycbai class global comment. Detailled comment
|
||||
*/
|
||||
public enum EHBaseDistribution4Versions {
|
||||
|
||||
HDP_1_0(EHBaseDistributions.HORTONWORKS, "Hortonworks Data Platform V1", "HDP_1_0"),
|
||||
|
||||
APACHE_1_0_0(EHBaseDistributions.APACHE, "Apache 1.0.0", "APACHE_1_0_0"),
|
||||
|
||||
APACHE_0_20_204(EHBaseDistributions.APACHE, "Apache 0.20.203", "APACHE_0_20_203"),
|
||||
|
||||
CLOUDERA_CDH4(EHBaseDistributions.CLOUDERA, "Cloudera CDH4", "Cloudera_CDH4"),
|
||||
|
||||
MAPR(EHBaseDistributions.MAPR, "MapR 2.0.0", "MAPR2");
|
||||
|
||||
private EHBaseDistributions distribution;
|
||||
|
||||
private String versionDisplayName;
|
||||
|
||||
private String versionValue;
|
||||
|
||||
EHBaseDistribution4Versions(EHBaseDistributions distribution, String versionDisplayName, String versionValue) {
|
||||
this.distribution = distribution;
|
||||
this.versionDisplayName = versionDisplayName;
|
||||
this.versionValue = versionValue;
|
||||
}
|
||||
|
||||
public static List<EHBaseDistribution4Versions> indexOfByDistribution(String distribution) {
|
||||
List<EHBaseDistribution4Versions> distribution4Versions = new ArrayList<EHBaseDistribution4Versions>();
|
||||
if (distribution != null) {
|
||||
for (EHBaseDistribution4Versions d4v : EHBaseDistribution4Versions.values()) {
|
||||
if (d4v.getDistribution().getName().equals(distribution)
|
||||
|| d4v.getDistribution().getDisplayName().equals(distribution)) {
|
||||
distribution4Versions.add(d4v);
|
||||
}
|
||||
}
|
||||
}
|
||||
return distribution4Versions;
|
||||
}
|
||||
|
||||
public static EHBaseDistribution4Versions indexOfByVersionDisplay(String displayName) {
|
||||
return indexOf(displayName, true);
|
||||
}
|
||||
|
||||
public static EHBaseDistribution4Versions indexOfByVersion(String value) {
|
||||
return indexOf(value, false);
|
||||
}
|
||||
|
||||
private static EHBaseDistribution4Versions indexOf(String name, boolean display) {
|
||||
if (name != null) {
|
||||
for (EHBaseDistribution4Versions version : EHBaseDistribution4Versions.values()) {
|
||||
if (display) {
|
||||
if (name.equalsIgnoreCase(version.getVersionDisplayName())) {
|
||||
return version;
|
||||
}
|
||||
} else {
|
||||
if (name.equalsIgnoreCase(version.getVersionValue())) {
|
||||
return version;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<String> getHadoopDistributionVersions(String distribution) {
|
||||
return getHadoopDistributionVersions(distribution, true);
|
||||
}
|
||||
|
||||
public static List<String> getHadoopDistributionVersions(String distribution, boolean display) {
|
||||
List<String> result = new ArrayList<String>();
|
||||
List<EHBaseDistribution4Versions> d4vList = EHBaseDistribution4Versions.indexOfByDistribution(distribution);
|
||||
for (EHBaseDistribution4Versions d4v : d4vList) {
|
||||
if (display) {
|
||||
result.add(d4v.getVersionDisplayName());
|
||||
} else {
|
||||
result.add(d4v.getVersionValue());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public EHBaseDistributions getDistribution() {
|
||||
return this.distribution;
|
||||
}
|
||||
|
||||
public String getVersionDisplayName() {
|
||||
return this.versionDisplayName;
|
||||
}
|
||||
|
||||
public String getVersionValue() {
|
||||
return this.versionValue;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 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.database.hbase.conn.version;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* DOC ycbai class global comment. Detailled comment
|
||||
*/
|
||||
public enum EHBaseDistributions {
|
||||
|
||||
HORTONWORKS("HortonWorks"),
|
||||
|
||||
CLOUDERA("Cloudera"),
|
||||
|
||||
MAPR("MapR"),
|
||||
|
||||
APACHE("Apache");
|
||||
|
||||
private String displayName;
|
||||
|
||||
EHBaseDistributions(String displayName) {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name();
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return this.displayName;
|
||||
}
|
||||
|
||||
public static List<String> getAllDistributionDisplayNames() {
|
||||
return getAllDistributionNames(true);
|
||||
}
|
||||
|
||||
public static List<String> getAllDistributionNames(boolean display) {
|
||||
List<String> names = new ArrayList<String>();
|
||||
EHBaseDistributions[] values = values();
|
||||
for (EHBaseDistributions distribution : values) {
|
||||
if (display) {
|
||||
names.add(distribution.getDisplayName());
|
||||
} else {
|
||||
names.add(distribution.getName());
|
||||
}
|
||||
}
|
||||
|
||||
return names;
|
||||
}
|
||||
|
||||
public static EHBaseDistributions getDistributionByDisplayName(String name) {
|
||||
return getDistributionByName(name, true);
|
||||
}
|
||||
|
||||
public static EHBaseDistributions getDistributionByName(String name, boolean display) {
|
||||
if (name != null) {
|
||||
for (EHBaseDistributions distribution : values()) {
|
||||
if (display) {
|
||||
if (name.equalsIgnoreCase(distribution.getDisplayName())) {
|
||||
return distribution;
|
||||
}
|
||||
} else {
|
||||
if (name.equalsIgnoreCase(distribution.getName())) {
|
||||
return distribution;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -127,14 +127,17 @@ public class JobContextManager implements IContextManager {
|
||||
loadFromEmf(contextTypeList, defaultContextName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addContextListener(IContextListener listener) {
|
||||
contextListenerList.add(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeContextListener(IContextListener listener) {
|
||||
contextListenerList.remove(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireContextsChangedEvent() {
|
||||
for (IContextListener contextListener : contextListenerList) {
|
||||
contextListener.contextsChanged();
|
||||
@@ -170,6 +173,7 @@ public class JobContextManager implements IContextManager {
|
||||
*
|
||||
* @see org.talend.core.model.process.IContextManager#getDefaultContext()
|
||||
*/
|
||||
@Override
|
||||
public IContext getDefaultContext() {
|
||||
return defaultContext;
|
||||
}
|
||||
@@ -179,6 +183,7 @@ public class JobContextManager implements IContextManager {
|
||||
*
|
||||
* @see org.talend.core.model.process.IContextManager#setDefaultContext(org.talend.core.model.process.IContext)
|
||||
*/
|
||||
@Override
|
||||
public void setDefaultContext(IContext context) {
|
||||
defaultContext = context;
|
||||
}
|
||||
@@ -188,6 +193,7 @@ public class JobContextManager implements IContextManager {
|
||||
*
|
||||
* @see org.talend.core.model.process.IContextManager#getListContext()
|
||||
*/
|
||||
@Override
|
||||
public List<IContext> getListContext() {
|
||||
return listContext;
|
||||
}
|
||||
@@ -197,6 +203,7 @@ public class JobContextManager implements IContextManager {
|
||||
*
|
||||
* @see org.talend.core.model.process.IContextManager#getListContext(java.util.List)
|
||||
*/
|
||||
@Override
|
||||
public void setListContext(List<IContext> listContext) {
|
||||
this.listContext = listContext;
|
||||
}
|
||||
@@ -208,6 +215,7 @@ public class JobContextManager implements IContextManager {
|
||||
* @param uniqueName
|
||||
* @return true if the name is unique
|
||||
*/
|
||||
@Override
|
||||
public boolean checkValidParameterName(String oldContextName, String newContextName) {
|
||||
for (IContextParameter contextParameter : listContext.get(0).getContextParameterList()) {
|
||||
// TDI-17682:avoid to compare the lower/uper case with the parameter itself
|
||||
@@ -234,6 +242,7 @@ public class JobContextManager implements IContextManager {
|
||||
return Pattern.matches(RepositoryConstants.CONTEXT_AND_VARIABLE_PATTERN, newContextName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IContext getContext(String name) {
|
||||
for (int i = 0; i < listContext.size(); i++) {
|
||||
if (listContext.get(i).getName().equals(name)) {
|
||||
@@ -243,6 +252,7 @@ public class JobContextManager implements IContextManager {
|
||||
return defaultContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveToEmf(EList contextTypeList) {
|
||||
ContextType contextType;
|
||||
IContext context;
|
||||
@@ -295,6 +305,7 @@ public class JobContextManager implements IContextManager {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadFromEmf(EList contextTypeList, String defaultContextName) {
|
||||
IContext context;
|
||||
ContextType contextType;
|
||||
@@ -316,7 +327,7 @@ public class JobContextManager implements IContextManager {
|
||||
contextType = (ContextType) contextTypeList.get(i);
|
||||
String name = contextType.getName();
|
||||
if (name == null) {
|
||||
name = "Default";
|
||||
name = IContext.DEFAULT;
|
||||
}
|
||||
context = new JobContext(name);
|
||||
context.setConfirmationNeeded(contextType.isConfirmationNeeded());
|
||||
@@ -342,8 +353,8 @@ public class JobContextManager implements IContextManager {
|
||||
} else {
|
||||
String[] existingTypes;
|
||||
existingTypes = ContextParameterJavaTypeManager.getPerlTypesLabels();
|
||||
for (int k = 0; k < existingTypes.length; k++) {
|
||||
if (existingTypes[k].equals(contextParamType.getType())) {
|
||||
for (String existingType : existingTypes) {
|
||||
if (existingType.equals(contextParamType.getType())) {
|
||||
exists = true;
|
||||
}
|
||||
}
|
||||
@@ -383,6 +394,7 @@ public class JobContextManager implements IContextManager {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sameAs(IContextManager contextManager) {
|
||||
if (!contextManager.getDefaultContext().getName().equals(defaultContext.getName())) {
|
||||
return false;
|
||||
|
||||
@@ -13,10 +13,13 @@
|
||||
package org.talend.core.model.general;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.core.runtime.i18n.Messages;
|
||||
import org.talend.json.JSONException;
|
||||
import org.talend.json.JSONObject;
|
||||
import org.talend.repository.model.RepositoryConstants;
|
||||
|
||||
/**
|
||||
@@ -31,22 +34,26 @@ public class ConnectionBean implements Cloneable {
|
||||
|
||||
private static final String FIELDS_SEPARATOR = "#"; //$NON-NLS-1$
|
||||
|
||||
private String repositoryId;
|
||||
private static final String ID = "id"; //$NON-NLS-1$
|
||||
|
||||
private String name;
|
||||
private static final String DESCRIPTION = "description"; //$NON-NLS-1$
|
||||
|
||||
private String description;
|
||||
private static final String NAME = "name"; //$NON-NLS-1$
|
||||
|
||||
private String user;
|
||||
private static final String PASSWORD = "password"; //$NON-NLS-1$
|
||||
|
||||
private String password;
|
||||
private static final String USER = "user"; //$NON-NLS-1$
|
||||
|
||||
private static final String WORKSPACE = "workSpace"; //$NON-NLS-1$
|
||||
|
||||
private static final String DYNAMICFIELDS = "dynamicFields"; //$NON-NLS-1$
|
||||
|
||||
private static final String COMPLETE = "complete"; //$NON-NLS-1$
|
||||
|
||||
private JSONObject conDetails = new JSONObject();
|
||||
|
||||
private Map<String, String> dynamicFields = new HashMap<String, String>();
|
||||
|
||||
private boolean complete;
|
||||
|
||||
private String workSpace;
|
||||
|
||||
/**
|
||||
* DOC smallet ConnectionBean constructor comment.
|
||||
*/
|
||||
@@ -73,12 +80,33 @@ public class ConnectionBean implements Cloneable {
|
||||
return newConnection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for ID.
|
||||
*
|
||||
* @return the ID
|
||||
*/
|
||||
public String getRepositoryId() {
|
||||
return this.repositoryId;
|
||||
try {
|
||||
if (conDetails.has(ID)) {
|
||||
return conDetails.getString(ID);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the ID.
|
||||
*
|
||||
* @param id the id to set
|
||||
*/
|
||||
public void setRepositoryId(String repositoryId) {
|
||||
this.repositoryId = repositoryId;
|
||||
try {
|
||||
conDetails.put(ID, repositoryId);
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,7 +115,14 @@ public class ConnectionBean implements Cloneable {
|
||||
* @return the description
|
||||
*/
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
try {
|
||||
if (conDetails.has(DESCRIPTION)) {
|
||||
return conDetails.getString(DESCRIPTION);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,7 +131,11 @@ public class ConnectionBean implements Cloneable {
|
||||
* @param description the description to set
|
||||
*/
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
try {
|
||||
conDetails.put(DESCRIPTION, description);
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,7 +144,14 @@ public class ConnectionBean implements Cloneable {
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return this.name;
|
||||
try {
|
||||
if (conDetails.has(NAME)) {
|
||||
return conDetails.getString(NAME);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,7 +160,11 @@ public class ConnectionBean implements Cloneable {
|
||||
* @param name the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
try {
|
||||
conDetails.put(NAME, name);
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -123,7 +173,14 @@ public class ConnectionBean implements Cloneable {
|
||||
* @return the password
|
||||
*/
|
||||
public String getPassword() {
|
||||
return this.password;
|
||||
try {
|
||||
if (conDetails.has(PASSWORD)) {
|
||||
return conDetails.getString(PASSWORD);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -132,7 +189,11 @@ public class ConnectionBean implements Cloneable {
|
||||
* @param password the password to set
|
||||
*/
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
try {
|
||||
conDetails.put(PASSWORD, password);
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -141,7 +202,14 @@ public class ConnectionBean implements Cloneable {
|
||||
* @return the user
|
||||
*/
|
||||
public String getUser() {
|
||||
return this.user;
|
||||
try {
|
||||
if (conDetails.has(USER)) {
|
||||
return conDetails.getString(USER);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -150,7 +218,11 @@ public class ConnectionBean implements Cloneable {
|
||||
* @param user the user to set
|
||||
*/
|
||||
public void setUser(String user) {
|
||||
this.user = user;
|
||||
try {
|
||||
conDetails.put(USER, user);
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -159,10 +231,14 @@ public class ConnectionBean implements Cloneable {
|
||||
* @return the workSpace
|
||||
*/
|
||||
public String getWorkSpace() {
|
||||
if (this.workSpace == null) {
|
||||
return ""; //$NON-NLS-1$
|
||||
try {
|
||||
if (conDetails.has(WORKSPACE)) {
|
||||
return conDetails.getString(WORKSPACE);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return this.workSpace;
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -171,11 +247,15 @@ public class ConnectionBean implements Cloneable {
|
||||
* @param workSpace the workSpace to set
|
||||
*/
|
||||
public void setWorkSpace(String workSpace) {
|
||||
this.workSpace = workSpace;
|
||||
try {
|
||||
conDetails.put(WORKSPACE, workSpace);
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String, String> getDynamicFields() {
|
||||
return this.dynamicFields;
|
||||
return dynamicFields;
|
||||
}
|
||||
|
||||
public void setDynamicFields(Map<String, String> dynamicFields) {
|
||||
@@ -183,53 +263,32 @@ public class ConnectionBean implements Cloneable {
|
||||
}
|
||||
|
||||
public boolean isComplete() {
|
||||
return this.complete;
|
||||
try {
|
||||
if (conDetails.has(COMPLETE)) {
|
||||
return (Boolean) conDetails.get(COMPLETE);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setComplete(boolean complete) {
|
||||
this.complete = complete;
|
||||
try {
|
||||
conDetails.put(COMPLETE, complete);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConnectionBean clone() throws CloneNotSupportedException {
|
||||
ConnectionBean object = (ConnectionBean) super.clone();
|
||||
object.setDynamicFields(new HashMap<String, String>(this.dynamicFields));
|
||||
return object;
|
||||
return writeFromJSON(this.getConDetails());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuffer string = new StringBuffer("Repository:" + getRepositoryId() + ", Name:" + getName() //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ ", Desription:" + getDescription() + ", User:" + getUser() + ", Password:" + getPassword() //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
+ ", WorkSpace:" + getWorkSpace() + ", Complete:" + isComplete()); //$NON-NLS-1$//$NON-NLS-1$ //$NON-NLS-2$
|
||||
string.append(", Dyn:").append(dynamicFields); //$NON-NLS-1$
|
||||
return string.toString();
|
||||
}
|
||||
|
||||
public String readToString() {
|
||||
StringBuffer fields = new StringBuffer(256);
|
||||
fields.append(assertValue(getRepositoryId()));
|
||||
fields.append(FIELDS_SEPARATOR);
|
||||
fields.append(assertValue(getName()));
|
||||
fields.append(FIELDS_SEPARATOR);
|
||||
fields.append(assertValue(getDescription()));
|
||||
fields.append(FIELDS_SEPARATOR);
|
||||
fields.append(assertValue(getUser()));
|
||||
fields.append(FIELDS_SEPARATOR);
|
||||
fields.append(assertValue(getPassword()));
|
||||
fields.append(FIELDS_SEPARATOR);
|
||||
fields.append(assertValue(getWorkSpace()));
|
||||
fields.append(FIELDS_SEPARATOR);
|
||||
fields.append(isComplete());
|
||||
|
||||
if (dynamicFields.size() > 0) {
|
||||
for (String current : dynamicFields.keySet()) {
|
||||
fields.append(FIELDS_SEPARATOR);
|
||||
fields.append(current + DYN_FIELDS_SEPARATOR + dynamicFields.get(current));
|
||||
}
|
||||
}
|
||||
|
||||
return fields.toString();
|
||||
return this.getConDetails().toString();
|
||||
}
|
||||
|
||||
public static ConnectionBean writeFromString(String s) {
|
||||
@@ -244,41 +303,28 @@ public class ConnectionBean implements Cloneable {
|
||||
toReturn.setPassword(st[i++]);
|
||||
toReturn.setWorkSpace(st[i++]);
|
||||
toReturn.setComplete(new Boolean(st[i++]));
|
||||
JSONObject dynamicJson = new JSONObject();
|
||||
toReturn.getConDetails().put(DYNAMICFIELDS, dynamicJson);
|
||||
while (i < st.length) {
|
||||
String[] st2 = st[i++].split(DYN_FIELDS_SEPARATOR, -1);
|
||||
toReturn.getDynamicFields().put(st2[0], st2[1]);
|
||||
dynamicJson.put(st2[0], st2[1]);
|
||||
}
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
// e.printStackTrace();
|
||||
ExceptionHandler.process(e);
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// ConnectionBean tt = new ConnectionBean();
|
||||
// tt.setName("tagada");
|
||||
// System.out.println(tt);
|
||||
// tt.setDescription("MyDesc");
|
||||
// tt.setUser("smallet@talend.com");
|
||||
// tt.setPassword("");
|
||||
// tt.getDynamicFields().put("DbLogin", "root");
|
||||
// tt.getDynamicFields().put("DbPassword", "toor");
|
||||
// String test2 = tt.readToString();
|
||||
// ConnectionBean bean2 = writeFromString(test2);
|
||||
// System.out.println(bean2 + " (" + test2 + ")");
|
||||
// }
|
||||
|
||||
/**
|
||||
*
|
||||
* DOC ggu Comment method "assertValue".
|
||||
*/
|
||||
private String assertValue(final String value) {
|
||||
if (value == null) {
|
||||
return ""; //$NON-NLS-1$
|
||||
public static ConnectionBean writeFromJSON(JSONObject json) {
|
||||
ConnectionBean toReturn = new ConnectionBean();
|
||||
try {
|
||||
toReturn.setConDetails(new JSONObject(json.toString()));
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return value;
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -289,8 +335,43 @@ public class ConnectionBean implements Cloneable {
|
||||
if (!(obj instanceof ConnectionBean)) {
|
||||
return false;
|
||||
}
|
||||
ConnectionBean other = (ConnectionBean) obj;
|
||||
|
||||
return this.readToString().equals(((ConnectionBean) obj).readToString());
|
||||
return this.getConDetails().toString().equals(other.getConDetails().toString());
|
||||
}
|
||||
|
||||
public JSONObject getConDetails() {
|
||||
JSONObject dynamicJson = new JSONObject();
|
||||
try {
|
||||
for (String key : dynamicFields.keySet()) {
|
||||
dynamicJson.put(key, dynamicFields.get(key));
|
||||
}
|
||||
conDetails.put(DYNAMICFIELDS, dynamicJson);
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
|
||||
return conDetails;
|
||||
}
|
||||
|
||||
public void setConDetails(JSONObject conDetails) {
|
||||
this.conDetails = conDetails;
|
||||
try {
|
||||
if (conDetails.has(DYNAMICFIELDS)) {
|
||||
Object object = conDetails.get(DYNAMICFIELDS);
|
||||
if (object instanceof JSONObject) {
|
||||
JSONObject dynamicJson = (JSONObject) object;
|
||||
Iterator sortedKeys = dynamicJson.sortedKeys();
|
||||
while (sortedKeys.hasNext()) {
|
||||
String key = (String) sortedKeys.next();
|
||||
String value = dynamicJson.getString(key);
|
||||
dynamicFields.put(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.model.general;
|
||||
|
||||
/**
|
||||
* DOC ycbai class global comment. Detailled comment
|
||||
*/
|
||||
public class LibraryInfo {
|
||||
|
||||
private String libName;
|
||||
|
||||
private String bundleId;
|
||||
|
||||
public String getLibName() {
|
||||
return this.libName;
|
||||
}
|
||||
|
||||
public void setLibName(String libName) {
|
||||
this.libName = libName;
|
||||
}
|
||||
|
||||
public String getBundleId() {
|
||||
return this.bundleId;
|
||||
}
|
||||
|
||||
public void setBundleId(String bundleId) {
|
||||
this.bundleId = bundleId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((this.bundleId == null) ? 0 : this.bundleId.hashCode());
|
||||
result = prime * result + ((this.libName == null) ? 0 : this.libName.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
LibraryInfo other = (LibraryInfo) obj;
|
||||
if (this.bundleId == null) {
|
||||
if (other.bundleId != null)
|
||||
return false;
|
||||
} else if (!this.bundleId.equals(other.bundleId))
|
||||
return false;
|
||||
if (this.libName == null) {
|
||||
if (other.libName != null)
|
||||
return false;
|
||||
} else if (!this.libName.equals(other.libName))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -244,4 +244,83 @@ public class ModuleNeeded {
|
||||
return moduleName + "[" + bundleName + ":" + bundleVersion + "]";
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hashCode = 31;
|
||||
if (this.getModuleName() != null) {
|
||||
hashCode *= this.getModuleName().hashCode();
|
||||
}
|
||||
if (this.getBundleName() != null) {
|
||||
hashCode *= this.getBundleName().hashCode();
|
||||
}
|
||||
if (this.getBundleVersion() != null) {
|
||||
hashCode *= this.getBundleVersion().hashCode();
|
||||
}
|
||||
hashCode *= new Boolean(this.isRequired()).hashCode();
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (!(obj instanceof ModuleNeeded)) {
|
||||
return false;
|
||||
}
|
||||
ModuleNeeded other = (ModuleNeeded) obj;
|
||||
|
||||
// ModuleName
|
||||
if (other.getModuleName() == null) {
|
||||
if (this.getModuleName() != null) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (this.getModuleName() == null) {
|
||||
return false;
|
||||
} else if (!other.getModuleName().equals(this.getModuleName())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// BundleName
|
||||
if (other.getBundleName() == null) {
|
||||
if (this.getBundleName() != null) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (this.getBundleName() == null) {
|
||||
return false;
|
||||
} else if (!other.getBundleName().equals(this.getBundleName())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// BundleVersion
|
||||
if (other.getBundleVersion() == null) {
|
||||
if (this.getBundleVersion() != null) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (this.getBundleVersion() == null) {
|
||||
return false;
|
||||
} else if (!other.getBundleVersion().equals(this.getBundleVersion())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (other.isRequired() != this.isRequired()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -388,8 +388,12 @@ public class MetadataSchema {
|
||||
if (pattern.getNodeValue() != null) {
|
||||
metadataColumn.setPattern(pattern.getNodeValue());
|
||||
}
|
||||
metadataColumn.setOriginalField(metadataColumn.getLabel());
|
||||
|
||||
if (originalField.getNodeValue() != null) {
|
||||
String originalFieldValue = MetadataToolHelper.validateColumnName(originalField.getNodeValue(), 0);
|
||||
metadataColumn.setOriginalField(originalFieldValue);
|
||||
} else {
|
||||
metadataColumn.setOriginalField(metadataColumn.getLabel());
|
||||
}
|
||||
if (!columnsAlreadyAdded.contains(metadataColumn.getLabel())) {
|
||||
listColumns.add(metadataColumn);
|
||||
columnsAlreadyAdded.add(metadataColumn.getLabel());
|
||||
|
||||
@@ -15,6 +15,8 @@ package org.talend.core.model.metadata.connection.hive;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.talend.commons.utils.platform.PluginChecker;
|
||||
|
||||
/**
|
||||
* @author Marvin Wang
|
||||
* @version 1.0 jdk1.6
|
||||
@@ -31,10 +33,11 @@ public class HiveConnUtils {
|
||||
*/
|
||||
public static String[] getDistributionNames() {
|
||||
List<String> list = getDistributionNameList();
|
||||
if (list == null)
|
||||
if (list == null) {
|
||||
return new String[0];
|
||||
else
|
||||
} else {
|
||||
return list.toArray(new String[list.size()]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -81,8 +84,9 @@ public class HiveConnUtils {
|
||||
HiveConnVersionInfo[] followsBeans = bean.getFollows();
|
||||
if (followsBeans != null && followsBeans.length > 0) {
|
||||
for (HiveConnVersionInfo followsBean : followsBeans) {
|
||||
if (followsBean.getKey().equals(key))
|
||||
if (followsBean.getKey().equals(key)) {
|
||||
listFollowingKey.add(bean);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117,9 +121,15 @@ public class HiveConnUtils {
|
||||
List<HiveConnVersionInfo> list = new ArrayList<HiveConnVersionInfo>();
|
||||
for (HiveConnVersionInfo bean : beans) {
|
||||
int beanLevel = bean.getLevel();
|
||||
if (level == beanLevel)
|
||||
if (level == beanLevel) {
|
||||
list.add(bean);
|
||||
}
|
||||
}
|
||||
// ADD msjian TDQ-6407 2012-11-26:for top not support hive embedded mode
|
||||
if (PluginChecker.isOnlyTopLoaded() && (level == 0 || level == 2)) {
|
||||
list.remove(0);
|
||||
}
|
||||
// TDQ-6407~
|
||||
return list;
|
||||
}
|
||||
return null;
|
||||
@@ -135,8 +145,9 @@ public class HiveConnUtils {
|
||||
String[] names = getDistributionNames();
|
||||
if (names != null && names.length > 0) {
|
||||
for (int i = 0; i < names.length; i++) {
|
||||
if (displayName != null && displayName.equals(names[i]))
|
||||
if (displayName != null && displayName.equals(names[i])) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
@@ -153,8 +164,9 @@ public class HiveConnUtils {
|
||||
List<HiveConnVersionInfo> beans = getObjectsByLevel(level);
|
||||
if (beans != null && beans.size() > 0) {
|
||||
for (HiveConnVersionInfo bean : beans) {
|
||||
if (displayName != null && displayName.equals(bean.getDisplayName()))
|
||||
if (displayName != null && displayName.equals(bean.getDisplayName())) {
|
||||
return bean.getKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -187,10 +199,11 @@ public class HiveConnUtils {
|
||||
|
||||
public static String[] getHiveVersionNames(int distributionIndex) {
|
||||
List<String> hiveVersionNameList = getHiveVersionNameList(distributionIndex);
|
||||
if (hiveVersionNameList != null && hiveVersionNameList.size() > 0)
|
||||
if (hiveVersionNameList != null && hiveVersionNameList.size() > 0) {
|
||||
return hiveVersionNameList.toArray(new String[hiveVersionNameList.size()]);
|
||||
else
|
||||
} else {
|
||||
return new String[0];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -212,6 +225,11 @@ public class HiveConnUtils {
|
||||
|
||||
protected static List<String> getHiveModeNameList(int distributionIndex, int versionIndex) {
|
||||
List<HiveConnVersionInfo> hiveModeObjs = getHiveModes(distributionIndex, versionIndex);
|
||||
// ADD msjian TDQ-6407 2012-11-26: for top, not support hive embeded mode,hide this menu
|
||||
if (PluginChecker.isOnlyTopLoaded() && hiveModeObjs.size() > 1) {
|
||||
hiveModeObjs.remove(0);
|
||||
}
|
||||
// TDQ-6407~
|
||||
if (hiveModeObjs != null && hiveModeObjs.size() > 0) {
|
||||
List<String> hiveModeNameList = new ArrayList<String>();
|
||||
for (HiveConnVersionInfo bean : hiveModeObjs) {
|
||||
@@ -224,10 +242,11 @@ public class HiveConnUtils {
|
||||
|
||||
public static String[] getHiveModeNames(int distributionIndex, int versionIndex) {
|
||||
List<String> hiveModeNameList = getHiveModeNameList(distributionIndex, versionIndex);
|
||||
if (hiveModeNameList != null && hiveModeNameList.size() > 0)
|
||||
if (hiveModeNameList != null && hiveModeNameList.size() > 0) {
|
||||
return hiveModeNameList.toArray(new String[hiveModeNameList.size()]);
|
||||
else
|
||||
} else {
|
||||
return new String[0];
|
||||
}
|
||||
}
|
||||
|
||||
public static int getIndexOfDistribution(String distributionKey) {
|
||||
@@ -235,8 +254,9 @@ public class HiveConnUtils {
|
||||
List<HiveConnVersionInfo> distributions = getObjectsByLevel(level);
|
||||
if (distributions != null && distributions.size() > 0) {
|
||||
for (int i = 0; i < distributions.size(); i++) {
|
||||
if (distributions.get(i).getKey().equals(distributionKey))
|
||||
if (distributions.get(i).getKey().equals(distributionKey)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
@@ -252,8 +272,9 @@ public class HiveConnUtils {
|
||||
List<HiveConnVersionInfo> hiveVersions = getHiveVersions(distributionIndex);
|
||||
if (hiveVersions != null && hiveVersions.size() > 0) {
|
||||
for (int i = 0; i < hiveVersions.size(); i++) {
|
||||
if (hiveVersions.get(i).getKey().equals(hiveVersionKey))
|
||||
if (hiveVersions.get(i).getKey().equals(hiveVersionKey)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
@@ -271,8 +292,9 @@ public class HiveConnUtils {
|
||||
List<HiveConnVersionInfo> hiveModes = getHiveModes(distributionIndex, hiveVersionIndex);
|
||||
if (hiveModes != null && hiveModes.size() > 0) {
|
||||
for (int i = 0; i < hiveModes.size(); i++) {
|
||||
if (hiveModes.get(i).getKey().equals(hiveModeKey))
|
||||
if (hiveModes.get(i).getKey().equals(hiveModeKey)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
@@ -290,8 +312,9 @@ public class HiveConnUtils {
|
||||
List<HiveConnVersionInfo> hiveModes = getHiveModes(distributionIndex, hiveVersionIndex);
|
||||
if (hiveModes != null && hiveModes.size() > 0) {
|
||||
HiveConnVersionInfo hiveMode = hiveModes.get(hiveModeIndex);
|
||||
if (HiveConnVersionInfo.MODE_EMBEDDED.getKey().equals(hiveMode.getKey()))
|
||||
if (HiveConnVersionInfo.MODE_EMBEDDED.getKey().equals(hiveMode.getKey())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -305,8 +328,9 @@ public class HiveConnUtils {
|
||||
*/
|
||||
public static HiveConnVersionInfo getDistributionObj(int index) {
|
||||
List<HiveConnVersionInfo> distributions = getObjectsByLevel(0);
|
||||
if (distributions != null && distributions.size() > 0)
|
||||
if (distributions != null && distributions.size() > 0) {
|
||||
return distributions.get(index);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -320,8 +344,9 @@ public class HiveConnUtils {
|
||||
*/
|
||||
public static HiveConnVersionInfo getHiveVersionObj(int distributionIndex, int hiveVersionIndex) {
|
||||
List<HiveConnVersionInfo> objs = getHiveVersions(distributionIndex);
|
||||
if (objs != null && objs.size() > 0)
|
||||
if (objs != null && objs.size() > 0) {
|
||||
return objs.get(hiveVersionIndex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -336,15 +361,17 @@ public class HiveConnUtils {
|
||||
*/
|
||||
public static HiveConnVersionInfo getHiveModeObj(int distributionIndex, int hiveVersionIndex, int hiveModeIndex) {
|
||||
List<HiveConnVersionInfo> objs = getHiveModes(distributionIndex, hiveVersionIndex);
|
||||
if (objs != null && objs.size() > 0)
|
||||
if (objs != null && objs.size() > 0) {
|
||||
return objs.get(hiveModeIndex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getHiveModeObjKey(int distributionIndex, int hiveVersionIndex, int hiveModeIndex) {
|
||||
HiveConnVersionInfo hiveModeObj = getHiveModeObj(distributionIndex, hiveVersionIndex, hiveModeIndex);
|
||||
if (hiveModeObj != null)
|
||||
if (hiveModeObj != null) {
|
||||
return hiveModeObj.getKey();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1157,6 +1157,13 @@ public class ComponentToRepositoryProperty {
|
||||
}
|
||||
}
|
||||
|
||||
if ("TAC_WEBAPP".equals(repositoryValue)) {//$NON-NLS-1$
|
||||
String value = getParameterValue(connection, node, "TAC_WEBAPP"); //$NON-NLS-1$
|
||||
if (value != null) {
|
||||
connection.setTacWebappName(value);
|
||||
}
|
||||
}
|
||||
|
||||
if ("CLASS_NAME".equals(repositoryValue)) {//$NON-NLS-1$
|
||||
String value = getParameterValue(connection, node, "CLASS_NAME"); //$NON-NLS-1$
|
||||
if (value != null) {
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.model.metadata.designerproperties;
|
||||
|
||||
/**
|
||||
* Uses this to store all repository values of "
|
||||
* <code>NAME<code>" from component t*_java.xml file. Note that the names also can be
|
||||
* used for "<code>REPOSITORY_VALUE</code>" in component t*_java.xml file. Created by Marvin Wang on Nov 26, 2012.
|
||||
*/
|
||||
public enum EParameterNameForComponent {
|
||||
|
||||
PARA_NAME_TYPE("TYPE"), //$NON-NLS-1$
|
||||
|
||||
PARA_NAME_SET_MAPRED_JT("SET_MAPRED_JT"), //$NON-NLS-1$
|
||||
|
||||
PARA_NAME_MAPRED_JT("MAPRED_JT"), //$NON-NLS-1$
|
||||
|
||||
PARA_NAME_SET_FS_DEFAULT_NAME("SET_FS_DEFAULT_NAME"), //$NON-NLS-1$
|
||||
|
||||
PARA_NAME_FS_DEFAULT_NAME("FS_DEFAULT_NAME"); //$NON-NLS-1$
|
||||
|
||||
private String name;
|
||||
|
||||
EParameterNameForComponent(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for name.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,7 +26,6 @@ import org.eclipse.emf.common.util.EList;
|
||||
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.commons.ui.utils.PathUtils;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.database.EDatabase4DriverClassName;
|
||||
import org.talend.core.database.EDatabaseTypeName;
|
||||
import org.talend.core.database.conn.ConnParameterKeys;
|
||||
import org.talend.core.database.conn.template.EDatabaseConnTemplate;
|
||||
@@ -197,7 +196,7 @@ public class RepositoryToComponentProperty {
|
||||
}
|
||||
SAPFunctionUnit unit = null;
|
||||
for (int i = 0; i < conn.getFuntions().size(); i++) {
|
||||
SAPFunctionUnit tmp = (SAPFunctionUnit) conn.getFuntions().get(i);
|
||||
SAPFunctionUnit tmp = conn.getFuntions().get(i);
|
||||
if (tmp.getLabel().equals(functionLabel)) {
|
||||
unit = tmp;
|
||||
break;
|
||||
@@ -214,7 +213,7 @@ public class RepositoryToComponentProperty {
|
||||
value2.clear(); // Make sure for this
|
||||
Map<String, List<Object>> mergedKeyValues = new HashMap<String, List<Object>>(); // all merged columns's key
|
||||
for (int i = 0; i < table.getColumns().size(); i++) {
|
||||
SAPFunctionParameterColumn column = (SAPFunctionParameterColumn) table.getColumns().get(i);
|
||||
SAPFunctionParameterColumn column = table.getColumns().get(i);
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
if (isInput) {
|
||||
mergeColumn(map, column, table.getColumns(), mergedKeyValues);
|
||||
@@ -239,26 +238,26 @@ public class RepositoryToComponentProperty {
|
||||
String value = "";
|
||||
String talendType = getTalendTypeFromJCOType(column.getDataType());
|
||||
if (talendType.contains("String")) { //$NON-NLS-1$
|
||||
value = TalendQuoteUtils.addQuotes(column.getValue()); //$NON-NLS-1$
|
||||
value = TalendQuoteUtils.addQuotes(column.getValue());
|
||||
} else {
|
||||
value = column.getValue(); //$NON-NLS-1$
|
||||
value = column.getValue();
|
||||
}
|
||||
|
||||
for (SAPFunctionParameterColumn current : columns) {
|
||||
String currentValue = "";
|
||||
if (talendType.contains("String")) { //$NON-NLS-1$
|
||||
currentValue = TalendQuoteUtils.addQuotes(current.getValue()); //$NON-NLS-1$
|
||||
currentValue = TalendQuoteUtils.addQuotes(current.getValue());
|
||||
} else {
|
||||
currentValue = current.getValue(); //$NON-NLS-1$
|
||||
currentValue = current.getValue();
|
||||
}
|
||||
if (current.getStructureOrTableName() != null && !"".equals(current.getStructureOrTableName())) {
|
||||
if (current.getStructureOrTableName().equals(column.getStructureOrTableName())
|
||||
&& current.getName().equals(column.getName())) {
|
||||
|
||||
String key = current.getStructureOrTableName() + "_" + current.getName(); //$NON-NLS-N$
|
||||
String key = current.getStructureOrTableName() + "_" + current.getName();
|
||||
if (!mergedMapping.keySet().contains(key)) {// need
|
||||
// merge
|
||||
mergeType = column.getParameterType().replace('.', '_'); //$NON-NLS-0$ //$NON-NLS-1$
|
||||
mergeType = column.getParameterType().replace('.', '_');
|
||||
mergeStructure = current.getStructureOrTableName();
|
||||
if ("".equals(mergeValue)) {
|
||||
mergeValue = value;
|
||||
@@ -274,7 +273,7 @@ public class RepositoryToComponentProperty {
|
||||
*/
|
||||
} else if (mergedMapping.keySet().contains(key) && !mergedMapping.get(key).contains(current.getValue())) {
|
||||
mergedMapping.get(key).add(current.getValue());
|
||||
mergeType = column.getParameterType().replace('.', '_'); //$NON-NLS-0$ //$NON-NLS-1$
|
||||
mergeType = column.getParameterType().replace('.', '_');
|
||||
mergeStructure = current.getStructureOrTableName();
|
||||
if ("".equals(mergeValue)) {
|
||||
mergeValue = value;
|
||||
@@ -316,7 +315,7 @@ public class RepositoryToComponentProperty {
|
||||
return null;
|
||||
}
|
||||
for (int i = 0; i < conn.getFuntions().size(); i++) {
|
||||
unit = (SAPFunctionUnit) conn.getFuntions().get(i);
|
||||
unit = conn.getFuntions().get(i);
|
||||
if (unit.getLabel().equals(functionLabel)) {
|
||||
break;
|
||||
}
|
||||
@@ -657,9 +656,9 @@ public class RepositoryToComponentProperty {
|
||||
private static Object getMDMValue(MDMConnection connection, String value, IMetadataTable table) {
|
||||
if ("MDMURL".equals(value)) { //$NON-NLS-1$
|
||||
if (isContextMode(connection, connection.getServer()) && isContextMode(connection, connection.getPort())) {
|
||||
return "http://" + connection.getServer() + ":" + connection.getPort() + "/talend/TalendPort";//$NON-NLS-1$//$NON-NLS-1$//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
return "http://" + connection.getServer() + ":" + connection.getPort() + "/talend/TalendPort";//$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
|
||||
} else {
|
||||
return TalendQuoteUtils.addQuotes("http://" + connection.getServer() + ":" + connection.getPort()//$NON-NLS-1$//$NON-NLS-1$ //$NON-NLS-2$
|
||||
return TalendQuoteUtils.addQuotes("http://" + connection.getServer() + ":" + connection.getPort()//$NON-NLS-1$//$NON-NLS-2$
|
||||
+ "/talend/TalendPort");//$NON-NLS-1$
|
||||
}
|
||||
} else if ("USERNAME".equals(value)) { //$NON-NLS-1$
|
||||
@@ -746,7 +745,7 @@ public class RepositoryToComponentProperty {
|
||||
|
||||
private static Concept getConcept(MDMConnection connection, IMetadataTable table) {
|
||||
if (table != null) {
|
||||
for (Concept concept : (List<Concept>) connection.getSchemas()) {
|
||||
for (Concept concept : connection.getSchemas()) {
|
||||
// test if sourcename is null, this is only for compatibility with first mdm repository
|
||||
// released.
|
||||
if (concept != null && (concept.getLabel() != null && concept.getLabel().equals(table.getLabel()))) {
|
||||
@@ -912,11 +911,18 @@ public class RepositoryToComponentProperty {
|
||||
|
||||
if (value.equals("DB_VERSION")) { //$NON-NLS-1$
|
||||
String dbVersionString = connection.getDbVersionString();
|
||||
if (EDatabaseConnTemplate.ACCESS.getDBDisplayName().equals(databaseType)) {
|
||||
if (EDatabaseConnTemplate.ACCESS.getDBDisplayName().equals(databaseType)
|
||||
|| EDatabaseConnTemplate.MYSQL.getDBDisplayName().equals(databaseType)) {
|
||||
// @Deprecated: see bug 7262 this bug is Deprecated
|
||||
return dbVersionString;
|
||||
} else {
|
||||
String driverValue = EDatabaseVersion4Drivers.getDriversStr(databaseType, dbVersionString);
|
||||
if (EDatabaseConnTemplate.ORACLE_OCI.getDBDisplayName().equals(databaseType)
|
||||
|| EDatabaseConnTemplate.ORACLE_RAC.getDBDisplayName().equals(databaseType)
|
||||
|| EDatabaseConnTemplate.ORACLEFORSID.getDBDisplayName().equals(databaseType)
|
||||
|| EDatabaseConnTemplate.ORACLESN.getDBDisplayName().equals(databaseType)) {
|
||||
driverValue = dbVersionString;
|
||||
}
|
||||
if (isContextMode(connection, dbVersionString)) {
|
||||
return dbVersionString;
|
||||
} else if (EDatabaseTypeName.VERTICA.getXmlName().equals(databaseType)
|
||||
@@ -971,6 +977,13 @@ public class RepositoryToComponentProperty {
|
||||
String h2Prefix = "jdbc:h2:"; //$NON-NLS-1$
|
||||
if (url.startsWith(h2Prefix)) {
|
||||
String path = url.substring(h2Prefix.length(), url.length());
|
||||
// TDI-23861: handle the server mode of H2 which url has more than one colon.
|
||||
if (path.split(":").length > 2) { //$NON-NLS-1$
|
||||
int startIndex = path.lastIndexOf(":") - 1; //$NON-NLS-1$
|
||||
String filePath = path.substring(startIndex);
|
||||
h2Prefix += path.substring(0, startIndex);
|
||||
path = filePath;
|
||||
}
|
||||
path = PathUtils.getPortablePath(path);
|
||||
url = h2Prefix + path;
|
||||
}
|
||||
@@ -1096,6 +1109,33 @@ public class RepositoryToComponentProperty {
|
||||
if (value.equals("CONNECTION_MODE")) {
|
||||
return connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HIVE_MODE);
|
||||
}
|
||||
|
||||
if (value.equals("HBASE_DISTRIBUTION")) {
|
||||
return connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HBASE_DISTRIBUTION);
|
||||
}
|
||||
|
||||
if (value.equals("HBASE_VERSION")) {
|
||||
return connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HBASE_VERSION);
|
||||
}
|
||||
|
||||
if (value.equals(EParameterNameForComponent.PARA_NAME_FS_DEFAULT_NAME.getName())) {
|
||||
String nameNodeURL = connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_NAME_NODE_URL);
|
||||
if (isContextMode(connection, nameNodeURL)) {
|
||||
return nameNodeURL;
|
||||
} else {
|
||||
return TalendQuoteUtils.addQuotes(nameNodeURL);
|
||||
}
|
||||
}
|
||||
|
||||
if (value.equals(EParameterNameForComponent.PARA_NAME_MAPRED_JT.getName())) {
|
||||
String jobTrackerURL = connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_JOB_TRACKER_URL);
|
||||
if (isContextMode(connection, jobTrackerURL)) {
|
||||
return jobTrackerURL;
|
||||
} else {
|
||||
return TalendQuoteUtils.addQuotes(jobTrackerURL);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1610,7 +1650,7 @@ public class RepositoryToComponentProperty {
|
||||
List<IMetadataTable> newMetaTables = new ArrayList<IMetadataTable>(metaTables);
|
||||
HL7Connection hl7Connection = (HL7Connection) connection;
|
||||
tableInfo.clear();
|
||||
for (MetadataTable repTable : (Set<MetadataTable>) ConnectionHelper.getTables(connection)) {
|
||||
for (MetadataTable repTable : ConnectionHelper.getTables(connection)) {
|
||||
IMetadataTable metaTable = null;
|
||||
Iterator<IMetadataTable> iterator = newMetaTables.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
@@ -1622,7 +1662,7 @@ public class RepositoryToComponentProperty {
|
||||
}
|
||||
}
|
||||
String xpathValue = "";
|
||||
for (MetadataColumn col : (List<MetadataColumn>) repTable.getColumns()) {
|
||||
for (MetadataColumn col : repTable.getColumns()) {
|
||||
String original = col.getOriginalField();
|
||||
if (original != null && !"".equals(original)) {
|
||||
if (original.indexOf(TalendQuoteUtils.LBRACKET) != -1) {
|
||||
@@ -1645,7 +1685,7 @@ public class RepositoryToComponentProperty {
|
||||
.getService(IMetadataManagmentService.class);
|
||||
IMetadataTable convert = mmService.convertMetadataTable(repTable);
|
||||
String uinqueTableName = node.getProcess().generateUniqueConnectionName(
|
||||
MultiSchemasUtil.getConnectionBaseName((String) repTable.getLabel()));
|
||||
MultiSchemasUtil.getConnectionBaseName(repTable.getLabel()));
|
||||
convert.setTableName(uinqueTableName);
|
||||
// IProxyRepositoryFactory factory =
|
||||
// CorePlugin.getDefault().getRepositoryService().getProxyRepositoryFactory();
|
||||
@@ -1925,7 +1965,7 @@ public class RepositoryToComponentProperty {
|
||||
for (MetadataTable table : (Set<MetadataTable>) objectList) {
|
||||
if (table != null && (table.getLabel() == null || table.getLabel().equals(tableOfNode.getLabel()))) {
|
||||
String xpathValue = "";
|
||||
for (MetadataColumn col : (List<MetadataColumn>) table.getColumns()) {
|
||||
for (MetadataColumn col : table.getColumns()) {
|
||||
String original = col.getOriginalField();
|
||||
if (original != null && !"".equals(original)) {
|
||||
if (original.indexOf(TalendQuoteUtils.LBRACKET) != -1) {
|
||||
@@ -2028,8 +2068,9 @@ public class RepositoryToComponentProperty {
|
||||
if (connection.getCustomEncode() == null) {
|
||||
// get the default encoding
|
||||
return TalendQuoteUtils.addQuotes(EMetadataEncoding.getMetadataEncoding("").getName()); //$NON-NLS-1$
|
||||
} else
|
||||
} else {
|
||||
return TalendQuoteUtils.addQuotes(connection.getCustomEncode());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (value.equals("USE_PROXY")) {
|
||||
@@ -2071,14 +2112,29 @@ public class RepositoryToComponentProperty {
|
||||
return connection.getXmlField();
|
||||
}
|
||||
if (value.equals("GUVNOR_URL")) {
|
||||
return connection.getUrlName();
|
||||
return addQuotesIfNecessary(connection, connection.getUrlName());
|
||||
}
|
||||
if (value.equals("TAC_WEBAPP")) {
|
||||
return addQuotesIfNecessary(connection, connection.getTacWebappName());
|
||||
}
|
||||
if (value.equals("CLASS_NAME")) {
|
||||
return connection.getClassName();
|
||||
return addQuotesIfNecessary(connection, connection.getClassName());
|
||||
}
|
||||
if (value.equals("GUVNOR_PACKAGE")) {
|
||||
return addQuotesIfNecessary(connection, connection.getPackage());
|
||||
}
|
||||
if (value.equals("MODULE_USED")) {
|
||||
return connection.getModuleUsed();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Object addQuotesIfNecessary(Connection connection, String value) {
|
||||
if (!isContextMode(connection, value)) {
|
||||
if (!value.startsWith(TalendQuoteUtils.QUOTATION_MARK) && !value.endsWith(TalendQuoteUtils.QUOTATION_MARK)) {
|
||||
return TalendQuoteUtils.addQuotes(value);
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,8 +160,14 @@ public enum EConnectionType implements IConnectionCategory, IDraw2dGraphics {
|
||||
CAMEL | UNIQUE_NAME,
|
||||
"Route", "Route", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
new Integer(LINE_SOLID),
|
||||
new RGB(230, 100, 0));
|
||||
|
||||
new RGB(230, 100, 0)),
|
||||
|
||||
STARTS(21, "STARTS", EConnectionCategory.OTHER,
|
||||
CONDITION | DEPENDENCY | UNIQUE_NAME,
|
||||
"Starts", Messages.getString("EConnectionType.startsMenu"),
|
||||
new Integer(LINE_SOLID),
|
||||
new RGB(0,0,150));
|
||||
|
||||
private String name;
|
||||
|
||||
private int id;
|
||||
|
||||
@@ -33,6 +33,8 @@ public interface IProcess2 extends IRepositoryObject, IProcess {
|
||||
|
||||
ProcessType saveXmlFile() throws IOException;
|
||||
|
||||
ProcessType saveXmlFile(boolean checkJoblet) throws IOException;
|
||||
|
||||
void setPropertyValue(String id, Object value);
|
||||
|
||||
void updateProperties();
|
||||
|
||||
@@ -103,8 +103,6 @@ public class RelationshipItemBuilder {
|
||||
|
||||
public static final String SURVIVOR_RELATION = "survivorshipRuleRelation"; //$NON-NLS-1$
|
||||
|
||||
public static RelationshipItemBuilder instance;
|
||||
|
||||
private Map<Relation, Set<Relation>> currentProjectItemsRelations;
|
||||
|
||||
private Map<Relation, Set<Relation>> referencesItemsRelations;
|
||||
@@ -117,14 +115,20 @@ public class RelationshipItemBuilder {
|
||||
|
||||
private static final String COMMA = ";";
|
||||
|
||||
private static Map<String, RelationshipItemBuilder> projectToInstanceMap = new HashMap<String, RelationshipItemBuilder>();
|
||||
|
||||
private RelationshipItemBuilder() {
|
||||
|
||||
}
|
||||
|
||||
public static RelationshipItemBuilder getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new RelationshipItemBuilder();
|
||||
String currentProject = ProjectManager.getInstance().getCurrentProject().getTechnicalLabel();
|
||||
|
||||
if (projectToInstanceMap.containsKey(currentProject)) {
|
||||
return projectToInstanceMap.get(currentProject);
|
||||
}
|
||||
RelationshipItemBuilder instance = new RelationshipItemBuilder();
|
||||
projectToInstanceMap.put(currentProject, instance);
|
||||
return instance;
|
||||
}
|
||||
|
||||
@@ -588,7 +592,7 @@ public class RelationshipItemBuilder {
|
||||
currentValue = param.getValue();
|
||||
}
|
||||
|
||||
if (builtIn != null && currentValue != null) { //$NON-NLS-1$
|
||||
if (builtIn != null && currentValue != null) {
|
||||
if (!builtIn) {
|
||||
addRelationShip(item, currentValue, LATEST_VERSION, relationType);
|
||||
}
|
||||
@@ -642,7 +646,7 @@ public class RelationshipItemBuilder {
|
||||
currentValue = param.getValue();
|
||||
}
|
||||
|
||||
if (builtIn != null && currentValue != null) { //$NON-NLS-1$
|
||||
if (builtIn != null && currentValue != null) {
|
||||
if (!builtIn) {
|
||||
addRelationShip(item, currentValue, LATEST_VERSION, relationType);
|
||||
}
|
||||
@@ -663,7 +667,7 @@ public class RelationshipItemBuilder {
|
||||
|
||||
// only for SurvivorshipFileItem
|
||||
if (param.getField() != null
|
||||
&& param.getField().equals(EParameterFieldType.SURVIVOR_RELATION.getName())) { //$NON-NLS-1$
|
||||
&& param.getField().equals(EParameterFieldType.SURVIVOR_RELATION.getName())) {
|
||||
String relatedID = param.getValue();
|
||||
addRelationShip(item, relatedID, LATEST_VERSION, SURVIVOR_RELATION);
|
||||
}
|
||||
@@ -702,8 +706,9 @@ public class RelationshipItemBuilder {
|
||||
}
|
||||
|
||||
Property property = service.getJobletComponentItem(cc);
|
||||
if (property != null)
|
||||
if (property != null) {
|
||||
addRelationShip(item, property.getId(), version, JOBLET_RELATION);
|
||||
}
|
||||
}
|
||||
if ("tRunJob".equals(currentNode.getComponentName())) { //$NON-NLS-1$
|
||||
// in case of tRunJob
|
||||
@@ -831,28 +836,37 @@ public class RelationshipItemBuilder {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
if (this == obj) {
|
||||
return true;
|
||||
if (obj == null)
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Relation other = (Relation) obj;
|
||||
if (id == null) {
|
||||
if (other.id != null)
|
||||
if (other.id != null) {
|
||||
return false;
|
||||
} else if (!id.equals(other.id))
|
||||
}
|
||||
} else if (!id.equals(other.id)) {
|
||||
return false;
|
||||
}
|
||||
if (type == null) {
|
||||
if (other.type != null)
|
||||
if (other.type != null) {
|
||||
return false;
|
||||
} else if (!type.equals(other.type))
|
||||
}
|
||||
} else if (!type.equals(other.type)) {
|
||||
return false;
|
||||
}
|
||||
if (version == null) {
|
||||
if (other.version != null)
|
||||
if (other.version != null) {
|
||||
return false;
|
||||
} else if (!version.equals(other.version))
|
||||
}
|
||||
} else if (!version.equals(other.version)) {
|
||||
return false;
|
||||
}
|
||||
// if (name == null) {
|
||||
// if (other.name != null)
|
||||
// return false;
|
||||
@@ -870,6 +884,7 @@ public class RelationshipItemBuilder {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object clone() throws CloneNotSupportedException {
|
||||
return super.clone();
|
||||
}
|
||||
|
||||
@@ -386,9 +386,6 @@ public class ERepositoryObjectType extends DynaEnum<ERepositoryObjectType> {
|
||||
public final static ERepositoryObjectType SYSTEM_INDICATORS_FRAUDDETECTION = new ERepositoryObjectType(
|
||||
"repository.systemIndicators.fraudDetection", "TDQ_Libraries/Indicators/System Indicators/Fraud Detection", "SYSTEM_INDICATORS_FRAUDDETECTION", 103, true, "repository.systemIndicators.fraudDetectionStatistics.alias", new String[] { "DQ" }, new String[] {}, false); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
public final static ERepositoryObjectType METADATA_HDFS = new ERepositoryObjectType(
|
||||
"HDFS", "metadata/hdfs", "HDFS", 104, false, "HDFS", new String[] { "DI" }, new String[] {}); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
private String alias;
|
||||
|
||||
private String folder = "";
|
||||
@@ -478,6 +475,18 @@ public class ERepositoryObjectType extends DynaEnum<ERepositoryObjectType> {
|
||||
return toReturn.toArray(new ERepositoryObjectType[] {});
|
||||
|
||||
}
|
||||
// Bad code here to fix bug TDI-23178. If DQ repository type implemented by extention point like what MDM does
|
||||
// will avoid this bug.
|
||||
if (!PluginChecker.isPluginLoaded("org.talend.dataprofiler.core")) { //$NON-NLS-1$
|
||||
List<ERepositoryObjectType> toReturn = new ArrayList<ERepositoryObjectType>();
|
||||
for (ERepositoryObjectType currentType : values(ERepositoryObjectType.class)) {
|
||||
if (!(currentType.getProducts().length == 1 && ArrayUtils.contains(currentType.getProducts(), "DQ"))) { //$NON-NLS-1$
|
||||
toReturn.add(currentType);
|
||||
}
|
||||
}
|
||||
return toReturn.toArray(new ERepositoryObjectType[0]);
|
||||
}
|
||||
|
||||
return values(ERepositoryObjectType.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,8 @@ public interface IRepositoryPrefConstants {
|
||||
|
||||
public static final String USE_EXPORT_SAVE = "use_export_save_for_jobscript";
|
||||
|
||||
public static final String ADD_CLASSPATH_JAR = "add_classpath_jar_for_export_job";
|
||||
|
||||
public static final String ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS = "allow_specific_characters_for_schema_columns";
|
||||
|
||||
}
|
||||
|
||||
@@ -50,6 +50,16 @@ public final class RepositoryManager {
|
||||
return CoreRuntimePlugin.getInstance().getDesignerCoreService().getDesignerCorePreferenceStore();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* DOC wchen DesignerCorePreference disappear in some case ,so i change to use repository preference store.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static IPreferenceStore getRepositoryPreferenceStore() {
|
||||
return CoreRuntimePlugin.getInstance().getRepositoryService().getRepositoryPreferenceStore();
|
||||
}
|
||||
|
||||
public static boolean isRefreshManually() {
|
||||
return getPreferenceStore().getBoolean(IRepositoryPrefConstants.MANUALLY_REFRESH);
|
||||
}
|
||||
|
||||
@@ -312,7 +312,8 @@ public class RepositoryViewObject implements IRepositoryViewObject {
|
||||
return property;
|
||||
} catch (PersistenceException e) {
|
||||
exception = e;
|
||||
ExceptionHandler.process(e);
|
||||
// for TDI-23371:no need this warning
|
||||
// ExceptionHandler.process(e);
|
||||
// if (!CommonsPlugin.isHeadless() && PlatformUI.isWorkbenchRunning()) {
|
||||
// MessageDialog.openError(Display.getCurrent().getActiveShell(), "Error", exception.getMessage());
|
||||
// }
|
||||
|
||||
@@ -296,6 +296,7 @@ public abstract class RepositoryUpdateManager {
|
||||
boolean cancelable = !needForcePropagation();
|
||||
IRunnableWithProgress runnable = new IRunnableWithProgress() {
|
||||
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
||||
List<UpdateResult> returnResult = checkJobItemsForUpdate(monitor, getTypes(), onlyImpactAnalysis);
|
||||
if (returnResult != null) {
|
||||
@@ -455,7 +456,7 @@ public abstract class RepositoryUpdateManager {
|
||||
}
|
||||
// query for wizard
|
||||
if (parameter instanceof QueriesConnection && object instanceof Query) {
|
||||
for (Query query : (List<Query>) ((QueriesConnection) parameter).getQuery()) {
|
||||
for (Query query : ((QueriesConnection) parameter).getQuery()) {
|
||||
if (query.getId().equals(((Query) object).getId())) {
|
||||
return true;
|
||||
}
|
||||
@@ -508,7 +509,7 @@ public abstract class RepositoryUpdateManager {
|
||||
Set<MetadataTable> tables = ConnectionHelper.getTables((Connection) parameter);
|
||||
if (tables.size() == 1) {
|
||||
IMetadataTable table1 = ((IMetadataTable) object);
|
||||
MetadataTable table2 = (MetadataTable) tables.toArray(new MetadataTable[0])[0];
|
||||
MetadataTable table2 = tables.toArray(new MetadataTable[0])[0];
|
||||
return table1.getId().equals(table2.getId());
|
||||
}
|
||||
if (parameter instanceof XmlFileConnection) {
|
||||
@@ -584,6 +585,10 @@ public abstract class RepositoryUpdateManager {
|
||||
dbConn.setDriverJarPath(newValue);
|
||||
} else if (dbConn.getURL() != null && dbConn.getURL().equals(oldValue)) {
|
||||
dbConn.setURL(newValue);
|
||||
} else if (dbConn.getUiSchema() != null && dbConn.getUiSchema().equals(oldValue)) {
|
||||
// Added by Marvin Wang on Nov.7, 2012 for bug TDI-12596, because schema can not be
|
||||
// propagated to metadata db.
|
||||
dbConn.setUiSchema(newValue);
|
||||
}
|
||||
factory.save(item);
|
||||
}
|
||||
@@ -888,6 +893,7 @@ public abstract class RepositoryUpdateManager {
|
||||
final List<IEditorReference> list = new ArrayList<IEditorReference>();
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
IEditorReference[] reference = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
|
||||
.getEditorReferences();
|
||||
@@ -915,6 +921,7 @@ public abstract class RepositoryUpdateManager {
|
||||
final List<IEditorReference> list = new ArrayList<IEditorReference>();
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
IEditorReference[] reference = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
|
||||
.getEditorReferences();
|
||||
@@ -1491,7 +1498,7 @@ public abstract class RepositoryUpdateManager {
|
||||
Map<String, String> idAndNameMap = new HashMap<String, String>();
|
||||
Set<MetadataTable> tables = ConnectionHelper.getTables(connItem.getConnection());
|
||||
if (tables != null) {
|
||||
for (MetadataTable table : (Set<MetadataTable>) tables) {
|
||||
for (MetadataTable table : tables) {
|
||||
idAndNameMap.put(table.getId(), table.getLabel());
|
||||
}
|
||||
}
|
||||
@@ -1542,7 +1549,7 @@ public abstract class RepositoryUpdateManager {
|
||||
final String prefix = connItem.getProperty().getId() + UpdatesConstants.SEGMENT_LINE;
|
||||
Set<MetadataTable> tables = ConnectionHelper.getTables(connItem.getConnection());
|
||||
if (tables != null) {
|
||||
for (MetadataTable table : (Set<MetadataTable>) tables) {
|
||||
for (MetadataTable table : tables) {
|
||||
String oldName = oldTableMap.get(table.getId());
|
||||
String newName = table.getLabel();
|
||||
if (oldName != null && !oldName.equals(newName)) {
|
||||
@@ -1573,7 +1580,7 @@ public abstract class RepositoryUpdateManager {
|
||||
final String prefix = property.getId() + UpdatesConstants.SEGMENT_LINE;
|
||||
Set<MetadataTable> tables = ConnectionHelper.getTables(connection);
|
||||
if (tables != null) {
|
||||
for (MetadataTable table : (Set<MetadataTable>) tables) {
|
||||
for (MetadataTable table : tables) {
|
||||
String oldName = oldTableMap.get(table.getId());
|
||||
String newName = table.getLabel();
|
||||
if (oldName != null && !oldName.equals(newName)) {
|
||||
@@ -1691,8 +1698,7 @@ public abstract class RepositoryUpdateManager {
|
||||
|
||||
List<IRepositoryViewObject> updateList = new ArrayList<IRepositoryViewObject>();
|
||||
List<RelationshipItemBuilder.Relation> relations = RelationshipItemBuilder.getInstance().getItemsRelatedTo(
|
||||
((ConnectionItem) connItem).getProperty().getId(), ItemCacheManager.LATEST_VERSION,
|
||||
RelationshipItemBuilder.PROPERTY_RELATION);
|
||||
(connItem).getProperty().getId(), ItemCacheManager.LATEST_VERSION, RelationshipItemBuilder.PROPERTY_RELATION);
|
||||
|
||||
/*
|
||||
* the id for schema which stored in .project file is like "_dlkjfhjkdfioi - metadata",not only indicate by a
|
||||
@@ -1700,9 +1706,9 @@ public abstract class RepositoryUpdateManager {
|
||||
* RelationshipItemBuilder.PROPERTY_RELATION,it can't find
|
||||
*/
|
||||
if (connItem instanceof GenericSchemaConnectionItem) {
|
||||
String id = ((ConnectionItem) connItem).getProperty().getId();
|
||||
String id = (connItem).getProperty().getId();
|
||||
if (table instanceof MetadataTable) {
|
||||
id = id + " - " + ((MetadataTable) table).getLabel(); //$NON-NLS-N$
|
||||
id = id + " - " + ((MetadataTable) table).getLabel();
|
||||
}
|
||||
List<RelationshipItemBuilder.Relation> schemaRelations = RelationshipItemBuilder.getInstance().getItemsRelatedTo(id,
|
||||
ItemCacheManager.LATEST_VERSION, RelationshipItemBuilder.SCHEMA_RELATION);
|
||||
@@ -1809,6 +1815,11 @@ public abstract class RepositoryUpdateManager {
|
||||
*/
|
||||
public static boolean sameAsMetadatTable(List<IMetadataTable> newTables, List<IMetadataTable> oldTables,
|
||||
Map<String, String> oldTableMap) {
|
||||
return sameAsMetadatTable(newTables, oldTables, oldTableMap, IMetadataColumn.OPTIONS_NONE);
|
||||
}
|
||||
|
||||
public static boolean sameAsMetadatTable(List<IMetadataTable> newTables, List<IMetadataTable> oldTables,
|
||||
Map<String, String> oldTableMap, int options) {
|
||||
if (newTables == null || oldTables == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -1824,7 +1835,7 @@ public abstract class RepositoryUpdateManager {
|
||||
if (oldTable == null) {
|
||||
return false;
|
||||
} else {
|
||||
if (!newTable.sameMetadataAs(oldTable, IMetadataColumn.OPTIONS_NONE)) {
|
||||
if (!newTable.sameMetadataAs(oldTable, options)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1935,7 +1946,7 @@ public abstract class RepositoryUpdateManager {
|
||||
IProxyRepositoryFactory factory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
|
||||
List<IRepositoryViewObject> updateList = new ArrayList<IRepositoryViewObject>();
|
||||
List<RelationshipItemBuilder.Relation> relations = RelationshipItemBuilder.getInstance().getItemsRelatedTo(
|
||||
((ConnectionItem) connItem).getProperty().getId(), RelationshipItemBuilder.LATEST_VERSION,
|
||||
(connItem).getProperty().getId(), RelationshipItemBuilder.LATEST_VERSION,
|
||||
RelationshipItemBuilder.PROPERTY_RELATION);
|
||||
|
||||
RepositoryUpdateManager repositoryUpdateManager = new RepositoryUpdateManager(table, relations) {
|
||||
|
||||
@@ -112,12 +112,60 @@ public abstract class UpdateResult {
|
||||
case DELETE:
|
||||
setChecked(true);
|
||||
break;
|
||||
case JOBLET_UPDATE:
|
||||
case RELOAD:
|
||||
setChecked(true);
|
||||
break;
|
||||
default:
|
||||
setChecked(true);
|
||||
setReadOnly(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* hwang Comment method "setResult".
|
||||
*
|
||||
* @param updateType
|
||||
* @param resultType
|
||||
* @param parameter
|
||||
* @param remark
|
||||
* @param open
|
||||
*/
|
||||
public void setResult(EUpdateItemType updateType, EUpdateResult resultType, Object parameter, String remark,
|
||||
boolean openedJoblet) {
|
||||
this.updateType = updateType;
|
||||
this.resultType = resultType;
|
||||
this.parameter = parameter;
|
||||
this.remark = remark;
|
||||
// must initialize the checked==true, so it will show in the dialog
|
||||
switch (resultType) {
|
||||
case UPDATE:
|
||||
break;
|
||||
case ADD:
|
||||
case DELETE:
|
||||
setChecked(true);
|
||||
break;
|
||||
case JOBLET_UPDATE:
|
||||
case RELOAD:
|
||||
if (openedJoblet) {
|
||||
setChecked(true);
|
||||
setReadOnly(true);
|
||||
} else {
|
||||
setChecked(false);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// if (openedJoblet) {
|
||||
setChecked(true);
|
||||
// } else {
|
||||
// setChecked(false);
|
||||
// }
|
||||
|
||||
setReadOnly(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void setResult(EUpdateItemType updateType, EUpdateResult resultType, Object parameter) {
|
||||
setResult(updateType, resultType, parameter, null);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.talend.core.language.ECodeLanguage;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.ui.branding.IBrandingService;
|
||||
import org.talend.designer.runprocess.IRunProcessService;
|
||||
import org.talend.repository.ProjectManager;
|
||||
|
||||
@@ -88,4 +89,28 @@ public class JavaResourcesHelper {
|
||||
return projectFolderName;
|
||||
}
|
||||
|
||||
public static String getGroupItemName(String projectName, String itemName) {
|
||||
if (itemName == null) {
|
||||
return null;
|
||||
}
|
||||
String itemGroupPrefixName = "org."; //$NON-NLS-1$
|
||||
String corporationName = null;
|
||||
IBrandingService service = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
|
||||
if (service != null) {
|
||||
corporationName = service.getCorporationName();
|
||||
if (corporationName != null) {
|
||||
corporationName = corporationName.trim();
|
||||
}
|
||||
}
|
||||
if (corporationName == null || "".equals(corporationName)) { //$NON-NLS-1$
|
||||
corporationName = "talend"; //$NON-NLS-1$
|
||||
}
|
||||
itemGroupPrefixName += corporationName;
|
||||
if (projectName != null) {
|
||||
itemGroupPrefixName += '.' + projectName;
|
||||
}
|
||||
itemGroupPrefixName += '.' + itemName;
|
||||
return itemGroupPrefixName.trim().toLowerCase();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -58,8 +58,12 @@ public class NodeUtil {
|
||||
Collections.sort(conns, new Comparator<IConnection>() {
|
||||
|
||||
public int compare(IConnection o1, IConnection o2) {
|
||||
if (EConnectionType.ROUTE_WHEN == o1.getLineStyle())
|
||||
if (EConnectionType.ROUTE_WHEN == o1.getLineStyle()){
|
||||
if(EConnectionType.ROUTE == o2.getLineStyle()){
|
||||
return 1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
if (EConnectionType.ROUTE_OTHER == o1.getLineStyle())
|
||||
if (EConnectionType.ROUTE_WHEN == o2.getLineStyle())
|
||||
return 1;
|
||||
|
||||
@@ -56,4 +56,17 @@ public final class TalendPropertiesUtil {
|
||||
|
||||
return Boolean.parseBoolean(value);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* DOC ggu Comment method "isEnabledMultiBranchesInWorkspacee".
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static boolean isCleanCache() {
|
||||
String value = System.getProperty("talend.clean.cache"); //$NON-NLS-1$
|
||||
|
||||
return Boolean.parseBoolean(value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,6 +22,9 @@ import org.eclipse.jface.preference.IPersistentPreferenceStore;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.talend.core.model.general.ConnectionBean;
|
||||
import org.talend.json.JSONArray;
|
||||
import org.talend.json.JSONException;
|
||||
import org.talend.json.JSONObject;
|
||||
|
||||
/**
|
||||
* Used to store connections / users for the login dialog <br/>
|
||||
@@ -31,6 +34,8 @@ import org.talend.core.model.general.ConnectionBean;
|
||||
*/
|
||||
public final class PreferenceManipulator implements ITalendCorePrefConstants {
|
||||
|
||||
private static final String JSON_CONNECTIONS = "Connections.new";
|
||||
|
||||
private static final String PREF_DELIMITER = "|"; //$NON-NLS-1$
|
||||
|
||||
/** The preference store manipulated. */
|
||||
@@ -74,14 +79,28 @@ public final class PreferenceManipulator implements ITalendCorePrefConstants {
|
||||
return array;
|
||||
}
|
||||
|
||||
private List<String> readStringList(final String prefName) {
|
||||
private JSONArray readJsonArray(final String prefName) {
|
||||
String prefs = store.getString(prefName);
|
||||
List<String> strings = new ArrayList<String>();
|
||||
StringTokenizer st = new StringTokenizer(prefs, PREF_DELIMITER);
|
||||
while (st.hasMoreTokens()) {
|
||||
strings.add(st.nextToken());
|
||||
}
|
||||
|
||||
if (prefs != null) {
|
||||
try {
|
||||
return new JSONArray(prefs);
|
||||
} catch (JSONException e) {
|
||||
//
|
||||
}
|
||||
}
|
||||
return new JSONArray();
|
||||
}
|
||||
|
||||
private List<String> readStringList(final String prefName) {
|
||||
List<String> strings = new ArrayList<String>();
|
||||
String prefs = store.getString(prefName);
|
||||
if (prefs != null) {
|
||||
StringTokenizer st = new StringTokenizer(prefs, PREF_DELIMITER);
|
||||
while (st.hasMoreTokens()) {
|
||||
strings.add(st.nextToken());
|
||||
}
|
||||
}
|
||||
return strings;
|
||||
}
|
||||
|
||||
@@ -103,6 +122,11 @@ public final class PreferenceManipulator implements ITalendCorePrefConstants {
|
||||
save();
|
||||
}
|
||||
|
||||
private void saveJsonArray(final JSONArray prefArray, String prefName) {
|
||||
store.setValue(prefName, prefArray.toString());
|
||||
save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a string to an array preference.
|
||||
*
|
||||
@@ -128,20 +152,38 @@ public final class PreferenceManipulator implements ITalendCorePrefConstants {
|
||||
for (String currentConnectionToLoad : readStringArray(CONNECTIONS)) {
|
||||
toReturn.add(ConnectionBean.writeFromString(currentConnectionToLoad));
|
||||
}
|
||||
// store.setValue(CONNECTIONS, "");
|
||||
|
||||
JSONArray jsonArray = readJsonArray(JSON_CONNECTIONS);
|
||||
for (int i = 0; i < jsonArray.length(); i++) {
|
||||
try {
|
||||
Object object = jsonArray.get(i);
|
||||
if (object instanceof JSONObject) {
|
||||
toReturn.add(ConnectionBean.writeFromJSON((JSONObject) object));
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
//
|
||||
}
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
public void saveConnections(List<ConnectionBean> cons) {
|
||||
String[] prefArray = new String[cons.size()];
|
||||
int i = 0;
|
||||
JSONArray array = new JSONArray();
|
||||
for (ConnectionBean currentConnection : cons) {
|
||||
prefArray[i++] = currentConnection.readToString();
|
||||
array.put(currentConnection.getConDetails());
|
||||
}
|
||||
saveStringArray(prefArray, CONNECTIONS);
|
||||
// clear the old value
|
||||
store.setValue(CONNECTIONS, "");
|
||||
saveJsonArray(array, JSON_CONNECTIONS);
|
||||
}
|
||||
|
||||
public void addConnection(ConnectionBean con) {
|
||||
addStringToArray(con.readToString(), CONNECTIONS);
|
||||
JSONArray array = new JSONArray();
|
||||
array.put(con.getConDetails());
|
||||
// clear the old value
|
||||
store.setValue(CONNECTIONS, "");
|
||||
saveJsonArray(array, JSON_CONNECTIONS);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -340,7 +340,6 @@ public final class RepositoryComponentManager {
|
||||
List<IComponent> exceptedComponents = new ArrayList<IComponent>();
|
||||
|
||||
for (IComponent component : components) {
|
||||
//
|
||||
for (RepositoryComponentDndFilterSetting dndFilter : getDndFilterSettings()) {
|
||||
IRepositoryComponentDndFilter filter = dndFilter.getFilter();
|
||||
if (filter == null) {
|
||||
|
||||
@@ -7,17 +7,25 @@ import org.talend.core.model.context.ContextUtils;
|
||||
import org.talend.core.model.metadata.builder.connection.Connection;
|
||||
import org.talend.core.model.properties.ContextItem;
|
||||
import org.talend.core.model.utils.ContextParameterUtils;
|
||||
import org.talend.cwm.mip.service.CWMService;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ContextParameterType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ContextType;
|
||||
import orgomg.cwm.foundation.softwaredeployment.DataManager;
|
||||
|
||||
public class TalendCWMService extends CWMService {
|
||||
public class TalendCWMService {
|
||||
|
||||
private Logger log = Logger.getLogger(TalendCWMService.class);
|
||||
private static Logger log = Logger.getLogger(TalendCWMService.class);
|
||||
|
||||
@Override
|
||||
public String getReadableName(DataManager dataManager, String contextualName) {
|
||||
/**
|
||||
*
|
||||
* Get the readable name (actual item display name) via context style name when the item is on context mode.<BR>
|
||||
* Note that in order to make it easier for caller to get a name, this contextualName may be passed as an actual
|
||||
* display name, in this case, this name will be simply returned.
|
||||
*
|
||||
* @param dataManager
|
||||
* @param contextualName eigher the contextual name or the actual display name.
|
||||
* @return the readable actual item display name.
|
||||
*/
|
||||
public static String getReadableName(DataManager dataManager, String contextualName) {
|
||||
if (contextualName == null) {
|
||||
log.error("Null context name in connection " + dataManager); //$NON-NLS-1$
|
||||
return contextualName;
|
||||
|
||||
@@ -103,4 +103,6 @@ public interface IJobletProviderService extends IService {
|
||||
public List<INode> checkDeleteNodes(IElement jobletContainer);
|
||||
|
||||
public boolean checkModify(IElement jobletContainer);
|
||||
|
||||
public boolean jobletIsDirty(INode node);
|
||||
}
|
||||
|
||||
@@ -49,4 +49,6 @@ public interface IBrandingService extends IService {
|
||||
public boolean isPoweredOnlyCamel();
|
||||
|
||||
public String getStartingBrowserId();
|
||||
|
||||
public String getUserManuals();
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ public class SelectRepositoryContextGroupDialog extends SelectionDialog {
|
||||
|
||||
private Set<String> nameSet = new HashSet<String>();
|
||||
|
||||
protected SelectRepositoryContextGroupDialog(Shell parentShell, IContextManager manager, ContextManagerHelper helper,
|
||||
public SelectRepositoryContextGroupDialog(Shell parentShell, IContextManager manager, ContextManagerHelper helper,
|
||||
List<ContextItem> selectedContextItems) {
|
||||
super(parentShell);
|
||||
setBlockOnOpen(true);
|
||||
|
||||
@@ -10,11 +10,12 @@
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.commons.utils.data.reflection;
|
||||
package org.talend.core.utils;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
@@ -37,18 +38,18 @@ public class ReflectionUtils {
|
||||
* @param owner
|
||||
* @param fieldName
|
||||
* @return
|
||||
* @throws NoSuchFieldException
|
||||
* @throws SecurityException
|
||||
* @throws IllegalAccessException
|
||||
* @throws IllegalArgumentException
|
||||
* @throws Exception
|
||||
*/
|
||||
public static Object getPublicField(Object owner, String fieldName) {
|
||||
public static Object getPublicField(Object owner, String fieldName) throws SecurityException, NoSuchFieldException,
|
||||
IllegalArgumentException, IllegalAccessException {
|
||||
Object fieldValue = null;
|
||||
Class ownerClass = owner.getClass();
|
||||
try {
|
||||
Field field = ownerClass.getField(fieldName);
|
||||
fieldValue = field.get(owner);
|
||||
} catch (Exception e) {
|
||||
log.error(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
Field field = ownerClass.getField(fieldName);
|
||||
fieldValue = field.get(owner);
|
||||
|
||||
return fieldValue;
|
||||
}
|
||||
@@ -61,18 +62,18 @@ public class ReflectionUtils {
|
||||
* @param owner
|
||||
* @param fieldName
|
||||
* @return
|
||||
* @throws NoSuchFieldException
|
||||
* @throws SecurityException
|
||||
* @throws IllegalAccessException
|
||||
* @throws IllegalArgumentException
|
||||
*/
|
||||
public static Object getPrivateField(Object owner, String fieldName) {
|
||||
public static Object getPrivateField(Object owner, String fieldName) throws SecurityException, NoSuchFieldException,
|
||||
IllegalArgumentException, IllegalAccessException {
|
||||
Object fieldValue = null;
|
||||
Class ownerClass = owner.getClass();
|
||||
try {
|
||||
Field f = ownerClass.getDeclaredField(fieldName);
|
||||
f.setAccessible(true);
|
||||
fieldValue = f.get(owner);
|
||||
} catch (Exception e) {
|
||||
log.error(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
Field f = ownerClass.getDeclaredField(fieldName);
|
||||
f.setAccessible(true);
|
||||
fieldValue = f.get(owner);
|
||||
|
||||
return fieldValue;
|
||||
}
|
||||
@@ -86,31 +87,31 @@ public class ReflectionUtils {
|
||||
* @param loader
|
||||
* @param fieldName
|
||||
* @return
|
||||
* @throws ClassNotFoundException
|
||||
* @throws NoSuchFieldException
|
||||
* @throws SecurityException
|
||||
* @throws IllegalAccessException
|
||||
* @throws IllegalArgumentException
|
||||
*/
|
||||
public static Object getStaticField(String className, ClassLoader loader, String fieldName) {
|
||||
public static Object getStaticField(String className, ClassLoader loader, String fieldName) throws ClassNotFoundException,
|
||||
SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
|
||||
Object fieldValue = null;
|
||||
try {
|
||||
Class ownerClass = null;
|
||||
if (loader != null) {
|
||||
ownerClass = Class.forName(className, true, loader);
|
||||
} else {
|
||||
ownerClass = Class.forName(className);
|
||||
}
|
||||
Field field = ownerClass.getField(fieldName);
|
||||
fieldValue = field.get(ownerClass);
|
||||
} catch (Exception e) {
|
||||
log.error(e);
|
||||
e.printStackTrace();
|
||||
Class ownerClass = null;
|
||||
if (loader != null) {
|
||||
ownerClass = Class.forName(className, true, loader);
|
||||
} else {
|
||||
ownerClass = Class.forName(className);
|
||||
}
|
||||
Field field = ownerClass.getField(fieldName);
|
||||
fieldValue = field.get(ownerClass);
|
||||
|
||||
return fieldValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* To set the field using the given <code>value</code>.
|
||||
* Added by Marvin Wang on Oct 19, 2012.
|
||||
* To set the field using the given <code>value</code>. Added by Marvin Wang on Oct 19, 2012.
|
||||
*/
|
||||
public static void setStaticFieldValue(String className, ClassLoader loader, String fieldName, Object value){
|
||||
public static void setStaticFieldValue(String className, ClassLoader loader, String fieldName, Object value) {
|
||||
try {
|
||||
Class ownerClass = null;
|
||||
if (loader != null) {
|
||||
@@ -122,12 +123,12 @@ public class ReflectionUtils {
|
||||
field.setAccessible(true);
|
||||
field.set(null, value);
|
||||
} catch (Exception e) {
|
||||
log.error(e);
|
||||
e.printStackTrace();
|
||||
log.error("", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static Object getStaticField(String className, String fieldName) {
|
||||
|
||||
public static Object getStaticField(String className, String fieldName) throws SecurityException, IllegalArgumentException,
|
||||
ClassNotFoundException, NoSuchFieldException, IllegalAccessException {
|
||||
return getStaticField(className, null, fieldName);
|
||||
}
|
||||
|
||||
@@ -140,21 +141,22 @@ public class ReflectionUtils {
|
||||
* @param methodName
|
||||
* @param args
|
||||
* @return
|
||||
* @throws NoSuchMethodException
|
||||
* @throws SecurityException
|
||||
* @throws InvocationTargetException
|
||||
* @throws IllegalAccessException
|
||||
* @throws IllegalArgumentException
|
||||
*/
|
||||
public static Object invokeMethod(Object owner, String methodName, Object[] args) {
|
||||
public static Object invokeMethod(Object owner, String methodName, Object[] args) throws SecurityException,
|
||||
NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
|
||||
Object returnValue = null;
|
||||
Class ownerClass = owner.getClass();
|
||||
Class[] argsClass = new Class[args.length];
|
||||
for (int i = 0, j = args.length; i < j; i++) {
|
||||
argsClass[i] = args[i].getClass();
|
||||
}
|
||||
try {
|
||||
Method method = ownerClass.getMethod(methodName, argsClass);
|
||||
returnValue = method.invoke(owner, args);
|
||||
} catch (Exception e) {
|
||||
log.error(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
Method method = ownerClass.getMethod(methodName, argsClass);
|
||||
returnValue = method.invoke(owner, args);
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
@@ -169,31 +171,36 @@ public class ReflectionUtils {
|
||||
* @param methodName
|
||||
* @param args
|
||||
* @return
|
||||
* @throws ClassNotFoundException
|
||||
* @throws NoSuchMethodException
|
||||
* @throws SecurityException
|
||||
* @throws InvocationTargetException
|
||||
* @throws IllegalAccessException
|
||||
* @throws IllegalArgumentException
|
||||
*/
|
||||
public static Object invokeStaticMethod(String className, ClassLoader loader, String methodName, Object[] args) {
|
||||
public static Object invokeStaticMethod(String className, ClassLoader loader, String methodName, Object[] args)
|
||||
throws ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalArgumentException,
|
||||
IllegalAccessException, InvocationTargetException {
|
||||
Object returnValue = null;
|
||||
try {
|
||||
Class ownerClass = null;
|
||||
if (loader != null) {
|
||||
ownerClass = Class.forName(className, true, loader);
|
||||
} else {
|
||||
ownerClass = Class.forName(className);
|
||||
}
|
||||
Class[] argsClass = new Class[args.length];
|
||||
for (int i = 0, j = args.length; i < j; i++) {
|
||||
argsClass[i] = args[i].getClass();
|
||||
}
|
||||
Method method = ownerClass.getMethod(methodName, argsClass);
|
||||
returnValue = method.invoke(null, args);
|
||||
} catch (Exception e) {
|
||||
log.error(e);
|
||||
e.printStackTrace();
|
||||
Class ownerClass = null;
|
||||
if (loader != null) {
|
||||
ownerClass = Class.forName(className, true, loader);
|
||||
} else {
|
||||
ownerClass = Class.forName(className);
|
||||
}
|
||||
Class[] argsClass = new Class[args.length];
|
||||
for (int i = 0, j = args.length; i < j; i++) {
|
||||
argsClass[i] = args[i].getClass();
|
||||
}
|
||||
Method method = ownerClass.getMethod(methodName, argsClass);
|
||||
returnValue = method.invoke(null, args);
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
public static Object invokeStaticMethod(String className, String methodName, Object[] args) {
|
||||
public static Object invokeStaticMethod(String className, String methodName, Object[] args) throws SecurityException,
|
||||
IllegalArgumentException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException,
|
||||
InvocationTargetException {
|
||||
return invokeStaticMethod(className, null, methodName, args);
|
||||
}
|
||||
|
||||
@@ -207,31 +214,37 @@ public class ReflectionUtils {
|
||||
* @param loader
|
||||
* @param args
|
||||
* @return
|
||||
* @throws ClassNotFoundException
|
||||
* @throws NoSuchMethodException
|
||||
* @throws SecurityException
|
||||
* @throws InvocationTargetException
|
||||
* @throws IllegalAccessException
|
||||
* @throws InstantiationException
|
||||
* @throws IllegalArgumentException
|
||||
*/
|
||||
public static Object newInstance(String className, ClassLoader loader, Object[] args) {
|
||||
public static Object newInstance(String className, ClassLoader loader, Object[] args) throws ClassNotFoundException,
|
||||
SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException,
|
||||
InvocationTargetException {
|
||||
Object instance = null;
|
||||
try {
|
||||
Class newClass = null;
|
||||
if (loader != null) {
|
||||
newClass = Class.forName(className, true, loader);
|
||||
} else {
|
||||
newClass = Class.forName(className);
|
||||
}
|
||||
Class[] argsClass = new Class[args.length];
|
||||
for (int i = 0, j = args.length; i < j; i++) {
|
||||
argsClass[i] = args[i].getClass();
|
||||
}
|
||||
Constructor cons = newClass.getConstructor(argsClass);
|
||||
instance = cons.newInstance(args);
|
||||
} catch (Exception e) {
|
||||
log.error(e);
|
||||
e.printStackTrace();
|
||||
Class newClass = null;
|
||||
if (loader != null) {
|
||||
newClass = Class.forName(className, true, loader);
|
||||
} else {
|
||||
newClass = Class.forName(className);
|
||||
}
|
||||
Class[] argsClass = new Class[args.length];
|
||||
for (int i = 0, j = args.length; i < j; i++) {
|
||||
argsClass[i] = args[i].getClass();
|
||||
}
|
||||
Constructor cons = newClass.getConstructor(argsClass);
|
||||
instance = cons.newInstance(args);
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
public static Object newInstance(String className, Object[] args) {
|
||||
public static Object newInstance(String className, Object[] args) throws SecurityException, IllegalArgumentException,
|
||||
ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException,
|
||||
InvocationTargetException {
|
||||
return newInstance(className, null, args);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 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.utils;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.talend.core.BrandingChecker;
|
||||
import org.talend.core.model.utils.TalendPropertiesUtil;
|
||||
|
||||
/**
|
||||
* DOC ggu class global comment. Detailled comment <br/>
|
||||
*
|
||||
* $Id: talend.epf 55206 2011-02-15 17:32:14Z mhirt $
|
||||
*
|
||||
*/
|
||||
public final class TalendCacheUtils {
|
||||
|
||||
private static final String CLEAN = "-clean"; //$NON-NLS-1$
|
||||
|
||||
private static final String CLEAN_COMPONENT_CACHE = "--clean_component_cache"; //$NON-NLS-1$
|
||||
|
||||
public static boolean isSetCleanComponentCache() {
|
||||
return ArrayUtils.contains(Platform.getApplicationArgs(), CLEAN_COMPONENT_CACHE);
|
||||
}
|
||||
|
||||
public static boolean isSetClean() {
|
||||
return ArrayUtils.contains(Platform.getApplicationArgs(), CLEAN);
|
||||
}
|
||||
|
||||
public static boolean cleanComponentCache() {
|
||||
return TalendPropertiesUtil.isCleanCache() || isSetCleanComponentCache() || isSetClean()
|
||||
|| BrandingChecker.isBrandingChanged();
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,7 @@ import org.talend.core.model.components.IComponent;
|
||||
import org.talend.core.model.components.IComponentsFactory;
|
||||
import org.talend.core.model.general.ModuleNeeded;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.metadata.IMetadataConnection;
|
||||
import org.talend.core.model.metadata.IMetadataTable;
|
||||
import org.talend.core.model.process.IConnection;
|
||||
import org.talend.core.model.process.IElementParameter;
|
||||
@@ -142,7 +143,8 @@ public interface IDesignerCoreService extends IService {
|
||||
|
||||
public void removeConnection(INode node, String schemaName);
|
||||
|
||||
public CsvArray convertNode(ConnectionItem connectionItem, String tableName) throws ProcessorException;
|
||||
public CsvArray convertNode(ConnectionItem connectionItem, IMetadataConnection convertedConnection, String tableName)
|
||||
throws ProcessorException;
|
||||
|
||||
public void updateTraceColumnValues(IConnection conn, Map<String, String> changedNameColumns, Set<String> addedColumns);
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.properties.JobletProcessItem;
|
||||
import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.model.relationship.RelationshipItemBuilder;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||
@@ -26,17 +27,18 @@ import org.talend.repository.ProjectManager;
|
||||
import org.talend.repository.model.IProxyRepositoryFactory;
|
||||
|
||||
/**
|
||||
* DOC nrousseau class global comment. Detailled comment
|
||||
*
|
||||
* @deprecated
|
||||
*
|
||||
* Do not cache anymore. This class actually is only used for compatibility, and keep the system of LASTEST_VERSION
|
||||
* Class to review, no cache anymore here.
|
||||
*
|
||||
* to be renamed in future versions.
|
||||
*/
|
||||
public class ItemCacheManager {
|
||||
|
||||
public static final String LATEST_VERSION = "Latest"; //$NON-NLS-1$
|
||||
// variable to replace by RelationshipItemBuilder.LATEST_VERSION later
|
||||
public static final String LATEST_VERSION = RelationshipItemBuilder.LATEST_VERSION;
|
||||
|
||||
@Deprecated
|
||||
public static void clearCache() {
|
||||
// deprecated, do nothing
|
||||
}
|
||||
|
||||
public static ProcessItem getProcessItem(Project project, String processId) {
|
||||
@@ -104,7 +106,7 @@ public class ItemCacheManager {
|
||||
return null;
|
||||
}
|
||||
// feature 19312
|
||||
if (version == null || version.equals("") || LATEST_VERSION.equals(version)) {
|
||||
if (version == null || version.equals("") || LATEST_VERSION.equals(version)) { //$NON-NLS-1$
|
||||
return getProcessItem(project, processId);
|
||||
}
|
||||
ProcessItem selectedProcessItem = null;
|
||||
|
||||
@@ -56,6 +56,14 @@ public final class ProjectManager {
|
||||
|
||||
public static final String UNDER_LINE = "_"; //$NON-NLS-1$
|
||||
|
||||
public static final String SEP_CHAR = SVNConstant.SEP_CHAR;
|
||||
|
||||
public static final String NAME_TRUNK = SVNConstant.NAME_TRUNK;
|
||||
|
||||
public static final String NAME_BRANCHES = SVNConstant.NAME_BRANCHES;
|
||||
|
||||
public static final String NAME_TAGS = SVNConstant.NAME_TAGS;
|
||||
|
||||
private static ProjectManager singleton;
|
||||
|
||||
private Project currentProject;
|
||||
@@ -101,9 +109,11 @@ public final class ProjectManager {
|
||||
Context ctx = CoreRuntimePlugin.getInstance().getContext();
|
||||
if (p != null && ctx != null) {
|
||||
String parentBranch = ProjectManager.getInstance().getMainProjectBranch(p);
|
||||
for (ProjectReference pr : (List<ProjectReference>) p.getReferencedProjects()) {
|
||||
if (pr.getBranch() == null || parentBranch.equals(pr.getBranch())) {
|
||||
resolveRefProject(pr.getReferencedProject()); // only to resolve all
|
||||
if (parentBranch != null) {
|
||||
for (ProjectReference pr : (List<ProjectReference>) p.getReferencedProjects()) {
|
||||
if (pr.getBranch() == null || parentBranch.equals(pr.getBranch())) {
|
||||
resolveRefProject(pr.getReferencedProject()); // only to resolve all
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -113,11 +123,13 @@ public final class ProjectManager {
|
||||
Context ctx = CoreRuntimePlugin.getInstance().getContext();
|
||||
if (ctx != null && p != null) {
|
||||
String parentBranch = ProjectManager.getInstance().getMainProjectBranch(p);
|
||||
for (ProjectReference pr : (List<ProjectReference>) p.getReferencedProjects()) {
|
||||
if (pr.getBranch() == null || parentBranch.equals(pr.getBranch())) {
|
||||
Project project = new Project(pr.getReferencedProject());
|
||||
allReferencedprojects.add(project);
|
||||
resolveSubRefProject(pr.getReferencedProject()); // only to resolve all
|
||||
if (parentBranch != null) {
|
||||
for (ProjectReference pr : (List<ProjectReference>) p.getReferencedProjects()) {
|
||||
if (pr.getBranch() == null || parentBranch.equals(pr.getBranch())) {
|
||||
Project project = new Project(pr.getReferencedProject());
|
||||
allReferencedprojects.add(project);
|
||||
resolveSubRefProject(pr.getReferencedProject()); // only to resolve all
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -473,6 +485,30 @@ public final class ProjectManager {
|
||||
return ""; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* DOC ldong Comment method "getCurrentBranchLabel".
|
||||
*
|
||||
* @param project
|
||||
* @return
|
||||
*/
|
||||
public static String getCurrentBranchLabel(Project project) {
|
||||
// just for TAC session,they do not want the label start with "/"
|
||||
String branchSelection = NAME_TRUNK;
|
||||
String branchSelectionFromProject = ProjectManager.getInstance().getMainProjectBranch(project);
|
||||
if (branchSelectionFromProject != null) {
|
||||
branchSelection = branchSelectionFromProject;
|
||||
} else {
|
||||
ProjectManager.getInstance().setMainProjectBranch(project, NAME_TRUNK);
|
||||
}
|
||||
|
||||
if (!branchSelection.contains(NAME_TAGS) && !branchSelection.contains(NAME_BRANCHES)
|
||||
&& !branchSelection.contains(NAME_TRUNK)) {
|
||||
branchSelection = NAME_BRANCHES + branchSelection;
|
||||
}
|
||||
return branchSelection;
|
||||
}
|
||||
|
||||
public String getMainProjectBranch(Project project) {
|
||||
return project != null ? getMainProjectBranch(project.getEmfProject()) : null;
|
||||
}
|
||||
|
||||
@@ -84,6 +84,9 @@ public class RepositoryConstants {
|
||||
public static final String SERVICES_NAME_PATTERN = "[a-zA-Z_][a-zA-Z0-9\\.\\-_]*";
|
||||
|
||||
public static final String MDM_ITEM_PATTERN = ".*"; //$NON-NLS-1$
|
||||
|
||||
public static final String METADATA_NAME_PATTERN = "^[^\\s\\\\~\\!\\`\\@\\#\\$\\%\\^\\&\\*\\(\\)\\-\\+\\=\\{\\[\\]\\}\\:\\;\\'\\|\\<\\,\\>\\.\\?\\/\"¥;:‘”、《,》。?……]{1,}$";
|
||||
|
||||
public static String getPattern(ERepositoryObjectType type) {
|
||||
if (type == ERepositoryObjectType.FOLDER) {
|
||||
return FOLDER_PATTERN;
|
||||
@@ -99,7 +102,18 @@ public class RepositoryConstants {
|
||||
|| type == ERepositoryObjectType.TDQ_SOURCE_FILE_ELEMENT || type == ERepositoryObjectType.TDQ_RULES
|
||||
|| type == ERepositoryObjectType.TDQ_RULES_SQL || type == ERepositoryObjectType.TDQ_INDICATOR_ELEMENT) {
|
||||
return TDQ_ALL_ITEM_PATTERN;
|
||||
}
|
||||
} else if (type == ERepositoryObjectType.METADATA_CONNECTIONS || type == ERepositoryObjectType.METADATA_FILE_DELIMITED
|
||||
|| type == ERepositoryObjectType.METADATA_FILE_POSITIONAL || type == ERepositoryObjectType.METADATA_FILE_REGEXP
|
||||
|| type == ERepositoryObjectType.METADATA_FILE_XML || type == ERepositoryObjectType.METADATA_FILE_EXCEL
|
||||
|| type == ERepositoryObjectType.METADATA_FILE_LDIF || type == ERepositoryObjectType.METADATA_LDAP_SCHEMA
|
||||
|| type == ERepositoryObjectType.METADATA_SALESFORCE_SCHEMA
|
||||
|| type == ERepositoryObjectType.METADATA_GENERIC_SCHEMA || type == ERepositoryObjectType.METADATA_MDMCONNECTION
|
||||
|| type == ERepositoryObjectType.METADATA_FILE_HL7 || type == ERepositoryObjectType.METADATA_FILE_RULES
|
||||
|| type == ERepositoryObjectType.METADATA_FILE_EBCDIC || type == ERepositoryObjectType.METADATA_WSDL_SCHEMA
|
||||
|| type == ERepositoryObjectType.METADATA_VALIDATION_RULES || type == ERepositoryObjectType.METADATA_FILE_FTP
|
||||
|| type == ERepositoryObjectType.METADATA_EDIFACT) {
|
||||
return METADATA_NAME_PATTERN;
|
||||
}
|
||||
// GLIU: add for TESB-3837
|
||||
else if (type != null && "SERVICES".equals(type.getType())) {
|
||||
return SERVICES_NAME_PATTERN;
|
||||
|
||||
@@ -30,7 +30,11 @@ import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.adaptor.LocationManager;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.core.model.general.ConnectionBean;
|
||||
import org.talend.json.JSONArray;
|
||||
import org.talend.json.JSONException;
|
||||
import org.talend.json.JSONObject;
|
||||
|
||||
/**
|
||||
* DOC hwang class global comment. Detailled comment
|
||||
@@ -89,22 +93,35 @@ public class ConnectionUserPerReader {
|
||||
* @throws DocumentException
|
||||
*/
|
||||
public List<ConnectionBean> readConnections() {
|
||||
if (!isRead)
|
||||
if (!isRead) {
|
||||
this.readProperties();
|
||||
}
|
||||
List<ConnectionBean> toReturn = new ArrayList<ConnectionBean>();
|
||||
|
||||
String userString = proper.getProperty("connection.users"); //$NON-NLS-1$
|
||||
if (userString == null) {
|
||||
userString = "";//$NON-NLS-1$
|
||||
return new ArrayList<ConnectionBean>(0);
|
||||
} else {
|
||||
if (userString != null) {
|
||||
String[] users = userString.split("\\|");//$NON-NLS-1$
|
||||
List<ConnectionBean> toReturn = new ArrayList<ConnectionBean>(users.length);
|
||||
for (String usr : users) {
|
||||
ConnectionBean conBean = ConnectionBean.writeFromString(proper.getProperty(usr));
|
||||
toReturn.add(conBean);
|
||||
}
|
||||
return toReturn;
|
||||
// FIXME
|
||||
// proper.remove("connection.users");
|
||||
}
|
||||
|
||||
try {
|
||||
String jsonString = proper.getProperty("connection.define"); //$NON-NLS-1$
|
||||
if (jsonString != null) {
|
||||
JSONArray users = new JSONArray(jsonString);
|
||||
for (int i = 0; i < users.length(); i++) {
|
||||
JSONObject user = users.getJSONObject(i);
|
||||
ConnectionBean conBean = ConnectionBean.writeFromJSON(user);
|
||||
toReturn.add(conBean);
|
||||
}
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
private ConnectionUserPerReader readProperties() {
|
||||
@@ -151,23 +168,26 @@ public class ConnectionUserPerReader {
|
||||
createPropertyFile();
|
||||
if (!isRead)
|
||||
this.readProperties();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int i = 0;
|
||||
if (cons == null || cons.size() == 0) {
|
||||
proper.remove("connection.users");//$NON-NLS-1$
|
||||
} else {
|
||||
JSONArray usersJsonArray = new JSONArray();
|
||||
for (ConnectionBean currentConnection : cons) {
|
||||
String userName = currentConnection.getName();
|
||||
|
||||
if (i != 0 && userName != null) {
|
||||
sb.append("|");//$NON-NLS-1$
|
||||
}
|
||||
if (userName != null)
|
||||
sb.append(userName);
|
||||
proper.setProperty(userName, currentConnection.readToString());
|
||||
i++;
|
||||
// String userName = currentConnection.getName();
|
||||
// if (i != 0 && userName != null) {
|
||||
// sb.append("|");//$NON-NLS-1$
|
||||
// }
|
||||
// if (userName != null) {
|
||||
JSONObject userJson = currentConnection.getConDetails();
|
||||
// proper.setProperty(userName, userJson.toString());
|
||||
usersJsonArray.put(userJson);
|
||||
// }
|
||||
}
|
||||
proper.setProperty("connection.users", sb.toString());//$NON-NLS-1$
|
||||
//proper.setProperty("connection.users", sb.toString());//$NON-NLS-1$
|
||||
if (proper.getProperty("connection.users") != null) {
|
||||
proper.remove("connection.users");
|
||||
}
|
||||
proper.setProperty("connection.define", usersJsonArray.toString());//$NON-NLS-1$
|
||||
}
|
||||
try {
|
||||
|
||||
|
||||
@@ -64,6 +64,9 @@
|
||||
|
||||
<element name="library">
|
||||
<complexType>
|
||||
<sequence minOccurs="0" maxOccurs="1">
|
||||
<element ref="bundleId"/>
|
||||
</sequence>
|
||||
<attribute name="name" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
@@ -74,6 +77,29 @@
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="bundleId">
|
||||
<complexType>
|
||||
<attribute name="bundleId" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
Note: parameter used only for OSGI, other exports won't use this.
|
||||
|
||||
If defined in the library:
|
||||
- emtpy value:
|
||||
- jar will never be exported.
|
||||
|
||||
- have one value:
|
||||
- jar will be exported, and value will be used for the OSGI bundle (name,version) .
|
||||
|
||||
|
||||
If not defined at all:
|
||||
- jar will always be exported.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.section type="since"/>
|
||||
|
||||
@@ -52,6 +52,7 @@ import org.talend.commons.utils.generation.JavaUtils;
|
||||
import org.talend.commons.xml.XmlUtil;
|
||||
import org.talend.core.language.ECodeLanguage;
|
||||
import org.talend.core.model.components.ComponentUtilities;
|
||||
import org.talend.core.model.general.LibraryInfo;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.metadata.ColumnNameChanged;
|
||||
import org.talend.core.model.metadata.IMetadataTable;
|
||||
@@ -152,7 +153,7 @@ public class CoreService implements ICoreService {
|
||||
*
|
||||
* @see org.talend.core.ICoreService#getRoutineAndJars()
|
||||
*/
|
||||
public Map<String, List<String>> getRoutineAndJars() {
|
||||
public Map<String, List<LibraryInfo>> getRoutineAndJars() {
|
||||
return RoutineLibraryMananger.getInstance().getRoutineAndJars();
|
||||
}
|
||||
|
||||
|
||||
@@ -251,6 +251,14 @@ public class QueryUtil {
|
||||
TalendTextUtils.declareString(" FROM "), declareString + realTableName[0].substring(2, realTableName[0].length() - 2) //$NON-NLS-1$
|
||||
+ declareString);
|
||||
}
|
||||
query = checkAndConcatString(checkAndConcatString(query, columnsQuery), end);
|
||||
} else if (dbType != null && dbType.equals(EDatabaseTypeName.MSSQL.getDisplayName())) {
|
||||
String declareString = TalendTextUtils.getStringDeclare();
|
||||
String end = checkAndConcatString(
|
||||
TalendTextUtils.declareString(" FROM "), declareString + realTableName[0] + declareString); //$NON-NLS-1$
|
||||
|
||||
end = replaceTheSchemaString(end);
|
||||
|
||||
query = checkAndConcatString(checkAndConcatString(query, columnsQuery), end);
|
||||
} else {
|
||||
String end = checkAndConcatString(TalendTextUtils.declareString(" FROM "), tableNameWithQuoteIfNeed); //$NON-NLS-1$
|
||||
|
||||
@@ -19,6 +19,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.eclipse.core.runtime.FileLocator;
|
||||
import org.eclipse.core.runtime.IConfigurationElement;
|
||||
@@ -27,6 +28,8 @@ import org.eclipse.core.runtime.Platform;
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.talend.core.CorePlugin;
|
||||
import org.talend.core.ILibraryManagerService;
|
||||
import org.talend.core.model.general.LibraryInfo;
|
||||
import org.talend.core.repository.constants.FileConstants;
|
||||
|
||||
/**
|
||||
* wchen class global comment. Detailled comment
|
||||
@@ -37,17 +40,17 @@ public class RoutineLibraryMananger {
|
||||
|
||||
private static final String LIB_FOLDER = "/lib"; //$NON-NLS-1$
|
||||
|
||||
private static final String LIB_EXT = ".jar"; //$NON-NLS-1$
|
||||
|
||||
private static final String LIBRARY_ELE = "library"; //$NON-NLS-1$
|
||||
|
||||
private static final String NAME_ATTR = "name"; //$NON-NLS-1$
|
||||
|
||||
private static final String BUNDLE_ID = "bundleId"; //$NON-NLS-1$
|
||||
|
||||
protected static Logger log = Logger.getLogger(RoutineLibraryMananger.class.getName());
|
||||
|
||||
private boolean initialized = false;
|
||||
|
||||
private Map<String, List<String>> routineAndJars = null;
|
||||
private Map<String, List<LibraryInfo>> routineAndJars = null;
|
||||
|
||||
private static IConfigurationElement[] configurationElements = null;
|
||||
|
||||
@@ -79,7 +82,7 @@ public class RoutineLibraryMananger {
|
||||
Object entryPath = entryPaths.nextElement();
|
||||
if (entryPath != null && entryPath instanceof String) {
|
||||
String path = (String) entryPath;
|
||||
if (path.endsWith(LIB_EXT)) {
|
||||
if (path.endsWith(FileConstants.JAR_FILE_SUFFIX)) {
|
||||
URL entry = bundle.getEntry(path);
|
||||
if (entry != null) {
|
||||
try {
|
||||
@@ -98,21 +101,32 @@ public class RoutineLibraryMananger {
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String, List<String>> getRoutineAndJars() {
|
||||
public Map<String, List<LibraryInfo>> getRoutineAndJars() {
|
||||
if (routineAndJars == null) {
|
||||
routineAndJars = new HashMap<String, List<String>>();
|
||||
routineAndJars = new HashMap<String, List<LibraryInfo>>();
|
||||
for (IConfigurationElement current : configurationElements) {
|
||||
String routine = current.getAttribute(NAME_ATTR);
|
||||
List<String> jarList = routineAndJars.get(routine);
|
||||
List<LibraryInfo> jarList = routineAndJars.get(routine);
|
||||
if (jarList == null) {
|
||||
jarList = new ArrayList<String>();
|
||||
jarList = new ArrayList<LibraryInfo>();
|
||||
routineAndJars.put(routine, jarList);
|
||||
}
|
||||
IConfigurationElement[] children = current.getChildren(LIBRARY_ELE);
|
||||
for (IConfigurationElement child : children) {
|
||||
LibraryInfo libraryInfo = new LibraryInfo();
|
||||
String library = child.getAttribute(NAME_ATTR);
|
||||
if (!jarList.contains(library)) {
|
||||
jarList.add(library);
|
||||
libraryInfo.setLibName(library);
|
||||
IConfigurationElement[] bundleIdChildren = child.getChildren(BUNDLE_ID);
|
||||
if (bundleIdChildren == null || bundleIdChildren.length == 0) {
|
||||
libraryInfo.setBundleId(null);
|
||||
} else {
|
||||
for (IConfigurationElement bundleIdChild : bundleIdChildren) {
|
||||
String bundleId = bundleIdChild.getAttribute(BUNDLE_ID);
|
||||
libraryInfo.setBundleId(StringUtils.trimToEmpty(bundleId));
|
||||
}
|
||||
}
|
||||
if (!jarList.contains(libraryInfo)) {
|
||||
jarList.add(libraryInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,6 @@ import java.util.regex.Pattern;
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
import org.talend.core.CorePlugin;
|
||||
import org.talend.core.database.EDatabaseTypeName;
|
||||
import org.talend.core.language.ECodeLanguage;
|
||||
import org.talend.core.language.LanguageManager;
|
||||
import org.talend.core.model.metadata.QueryUtil;
|
||||
import org.talend.core.prefs.ITalendCorePrefConstants;
|
||||
import org.talend.core.utils.KeywordsValidator;
|
||||
@@ -73,17 +71,19 @@ public class TalendTextUtils {
|
||||
return TalendQuoteUtils.addQuotes(text, quoteStyle);
|
||||
}
|
||||
|
||||
public static String addSQLQuotes(String text, boolean force) {
|
||||
if (force) { // in this case, do not consider context params
|
||||
return addSQLQuotes(text, QUOTATION_MARK);
|
||||
} else {
|
||||
return addSQLQuotes(text);
|
||||
}
|
||||
}
|
||||
|
||||
public static String addSQLQuotes(String text) {
|
||||
ECodeLanguage language = LanguageManager.getCurrentLanguage();
|
||||
if (ContextParameterUtils.isContainContextParam(text)) {
|
||||
return text;
|
||||
}
|
||||
switch (language) {
|
||||
case JAVA:
|
||||
return addSQLQuotes(text, QUOTATION_MARK);
|
||||
default: // PERL
|
||||
return addSQLQuotes(text, SINGLE_QUOTE);
|
||||
}
|
||||
return addSQLQuotes(text, QUOTATION_MARK);
|
||||
}
|
||||
|
||||
private static String addSQLQuotes(String text, String quoteStyle) {
|
||||
@@ -474,7 +474,7 @@ public class TalendTextUtils {
|
||||
* @return
|
||||
*/
|
||||
public static boolean isEmptyString(final String str) {
|
||||
return str == null || str.length() > 0;
|
||||
return str == null || str.length() <= 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -589,4 +589,5 @@ public class TalendTextUtils {
|
||||
return string + " ---> " + key; //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -43,4 +43,8 @@ public abstract class AbstractBrandingService implements IBrandingService {
|
||||
// default is StartingBrowser implement in org.talend.rcp
|
||||
return "org.talend.rcp.intro.starting.StartingBrowser";
|
||||
}
|
||||
|
||||
public String getUserManuals() {
|
||||
return "DI";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,31 +169,50 @@ public class TalendJavaSourceViewer extends ReconcilerViewer {
|
||||
}
|
||||
|
||||
public static ISourceViewer createViewer(Composite composite, int styles, boolean checkCode) {
|
||||
/*
|
||||
* Special for cProcessor
|
||||
* https://jira.talendforge.org/browse/TESB-3687
|
||||
* for cJavaDSLProcessor
|
||||
* https://jira.talendforge.org/browse/TESB-7615
|
||||
*/
|
||||
boolean isRouteProcess = isRouteProcess();
|
||||
|
||||
StringBuffer buff = new StringBuffer();
|
||||
buff.append("package internal;\n\n"); //$NON-NLS-1$
|
||||
buff.append(getImports());
|
||||
|
||||
//add special imports for RouteBuilder
|
||||
if(isRouteProcess){
|
||||
buff.append("import org.apache.camel.*;");
|
||||
}
|
||||
|
||||
buff.append("public class " + VIEWER_CLASS_NAME + currentId + " {\n"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
buff.append("\tprivate static java.util.Properties context = new java.util.Properties();\n"); //$NON-NLS-1$
|
||||
buff.append("\tprivate static final java.util.Map<String, Object> globalMap = new java.util.HashMap<String, Object>();\n"); //$NON-NLS-1$
|
||||
|
||||
/*
|
||||
* Special for cProcessor
|
||||
* https://jira.talendforge.org/browse/TESB-3687
|
||||
*/
|
||||
try{
|
||||
IProcess activeProcess = CorePlugin.getDefault().getRunProcessService().getActiveProcess();
|
||||
if(activeProcess != null && "org.talend.camel.designer.ui.editor.RouteProcess".equals(activeProcess.getClass().getName())){
|
||||
buff.append("\tprivate org.apache.camel.Exchange exchange;\n"); //$NON-NLS-1$
|
||||
buff.append("\torg.apache.camel.impl.DefaultCamelContext camelContext;\n"); //$NON-NLS-1$
|
||||
buff.append("\tjavax.jms.ConnectionFactory jmsConnectionFactory;\n"); //$NON-NLS-1$
|
||||
}
|
||||
}catch(Exception e){
|
||||
/*
|
||||
* Special for cProcessor
|
||||
* https://jira.talendforge.org/browse/TESB-3687
|
||||
*/
|
||||
if(isRouteProcess){
|
||||
buff.append("\tprivate org.apache.camel.Exchange exchange;\n"); //$NON-NLS-1$
|
||||
buff.append("\torg.apache.camel.impl.DefaultCamelContext camelContext;\n"); //$NON-NLS-1$
|
||||
buff.append("\tjavax.jms.ConnectionFactory jmsConnectionFactory;\n"); //$NON-NLS-1$
|
||||
}
|
||||
//end of https://jira.talendforge.org/browse/TESB-3687
|
||||
|
||||
buff.append("\tpublic void myFunction(){\n"); //$NON-NLS-1$
|
||||
buff.append("\t if( \n"); //$NON-NLS-1$
|
||||
|
||||
/*
|
||||
* for cJavaDSLProcessor
|
||||
* https://jira.talendforge.org/browse/TESB-7615
|
||||
*/
|
||||
if(isRouteProcess){
|
||||
buff.append("new org.apache.camel.model.RouteDefinition()\n");
|
||||
}
|
||||
// End of https://jira.talendforge.org/browse/TESB-7615
|
||||
|
||||
int documentOffset = buff.toString().length();
|
||||
buff.append("){\n\t}"); //$NON-NLS-1$
|
||||
buff.append("\n\t\n}\n}"); //$NON-NLS-1$
|
||||
@@ -203,6 +222,22 @@ public class TalendJavaSourceViewer extends ReconcilerViewer {
|
||||
return initializeViewer(composite, styles, checkCode, document, documentOffset);
|
||||
}
|
||||
|
||||
/**
|
||||
* if the current process is a route process or not
|
||||
* @return
|
||||
*/
|
||||
private static boolean isRouteProcess(){
|
||||
try {
|
||||
IProcess activeProcess = CorePlugin.getDefault()
|
||||
.getRunProcessService().getActiveProcess();
|
||||
boolean isRouteProcess = (activeProcess != null && "org.talend.camel.designer.ui.editor.RouteProcess"
|
||||
.equals(activeProcess.getClass().getName()));
|
||||
return isRouteProcess;
|
||||
} catch (Throwable e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static ISourceViewer createViewerForIfConnection(Composite composite) {
|
||||
StringBuffer buff = new StringBuffer();
|
||||
buff.append("package internal;\n\n"); //$NON-NLS-1$
|
||||
|
||||
@@ -35,6 +35,7 @@ import org.eclipse.jface.operation.ModalContext;
|
||||
import org.eclipse.osgi.util.NLS;
|
||||
import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
|
||||
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.commons.utils.io.FilesUtils;
|
||||
import org.talend.core.i18n.Messages;
|
||||
|
||||
/**
|
||||
@@ -153,12 +154,14 @@ public class ArchiveFileExportOperationFullPath implements IRunnableWithProgress
|
||||
if (rootName != null && !"".equals(destinationName)) { //$NON-NLS-1$
|
||||
if (file.getName().equals(Messages.getString("ArchiveFileExportOperationFullPath.SpecialFile"))) { //$NON-NLS-1$
|
||||
destinationName = rootName.substring(0, rootName.indexOf("/")) + SEPARATOR + destinationName; //$NON-NLS-1$
|
||||
} else {
|
||||
} else if (!"".equals(rootName)) { //$NON-NLS-1$
|
||||
destinationName = rootName + SEPARATOR + destinationName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
destinationName = destinationName.replace("//", SEPARATOR); //$NON-NLS-1$
|
||||
|
||||
monitor.subTask(destinationName);
|
||||
|
||||
try {
|
||||
@@ -214,7 +217,7 @@ public class ArchiveFileExportOperationFullPath implements IRunnableWithProgress
|
||||
String relativePath = (String) iter.next();
|
||||
Set<URL> resource = fileResource.getResourcesByRelativePath(relativePath);
|
||||
for (URL url : resource) {
|
||||
String currentResource = url.getPath();
|
||||
String currentResource = FilesUtils.getFileRealPath(url.getPath());
|
||||
exportResource(rootName, relativePath, currentResource, 1);
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user